Revision 32367 branches/v2_0_0_prep/libraries/org.gvsig.arcims/src/org/gvsig/remoteclient/arcims/ArcImsClient.java
ArcImsClient.java | ||
---|---|---|
46 | 46 |
* |
47 | 47 |
*/ |
48 | 48 |
public abstract class ArcImsClient extends RasterClient { |
49 |
|
|
49 | 50 |
private static Logger logger = LoggerFactory.getLogger(ArcImsProtocolHandler.class |
50 | 51 |
.getName()); |
51 | 52 |
|
... | ... | |
54 | 55 |
* |
55 | 56 |
* @see ArcImsProtocolHandler#ArcImsProtocolHandler() |
56 | 57 |
*/ |
57 |
protected ArcImsProtocolHandler handler; |
|
58 |
protected ArcImsProtocolHandler handler = null;
|
|
58 | 59 |
|
59 | 60 |
/** |
60 | 61 |
* Layers of the service |
... | ... | |
62 | 63 |
private TreeMap layers = new TreeMap(); |
63 | 64 |
|
64 | 65 |
/** |
65 |
* Constructor. the parameter host, indicates the ArcIms host to connect. |
|
66 |
* */ |
|
66 |
* Constructor |
|
67 |
* @param host |
|
68 |
* @param service |
|
69 |
* @param serviceType |
|
70 |
*/ |
|
67 | 71 |
public ArcImsClient(String host, String service, String serviceType) { |
68 | 72 |
|
69 |
setHost(host); |
|
70 |
setServiceName(service); |
|
73 |
this.setHost(host);
|
|
74 |
this.setServiceName(service);
|
|
71 | 75 |
|
72 | 76 |
try { |
73 |
handler = ArcImsProtocolHandlerFactory.negotiate(serviceType); |
|
74 |
|
|
75 |
// handler = new org.gvsig.remoteClient.arcims. |
|
76 |
handler.setHost(host); |
|
77 |
handler.setService(service); |
|
78 |
handler.serviceInfo.setType(serviceType); |
|
77 |
this.handler = ArcImsProtocolHandlerFactory.negotiate(serviceType); |
|
78 |
this.handler.setHost(host); |
|
79 |
this.handler.setService(service); |
|
80 |
this.handler.getServiceInformation().setType(serviceType); |
|
79 | 81 |
} catch (Exception e) { |
80 |
e.printStackTrace(); |
|
81 | 82 |
logger.error(e.getMessage(), e); |
82 | 83 |
} |
83 | 84 |
} |
84 | 85 |
|
85 | 86 |
/** |
86 | 87 |
* <p> |
87 |
* One of the three interfaces that ArcIms defines. Request a map. |
|
88 |
* </p> |
|
89 |
* |
|
90 |
* @throws ServerErrorException |
|
91 |
* @throws ArcImsException |
|
92 |
* @throws ServerErrorException |
|
93 |
*/ |
|
94 |
|
|
95 |
// public abstract File getMap(ArcImsStatus status) throws ArcImsException, |
|
96 |
// ServerErrorException; |
|
97 |
|
|
98 |
/** |
|
99 |
* <p> |
|
100 | 88 |
* One of the three interfaces defined by ArcIms, it gets the service |
101 | 89 |
* capabilities |
102 | 90 |
* </p> |
103 | 91 |
* |
104 | 92 |
*/ |
105 | 93 |
public void getCapabilities(ArcImsStatus status) throws ArcImsException { |
106 |
handler.getCapabilities(status); |
|
94 |
|
|
95 |
this.handler.getCapabilities(status); |
|
96 |
this.layers = this.handler.layers; |
|
97 |
} |
|
107 | 98 |
|
108 |
layers = handler.layers; |
|
109 |
|
|
110 |
// rootLayer = handler.rootLayer; |
|
111 |
} |
|
112 |
|
|
113 | 99 |
/** |
114 | 100 |
* <p> |
115 |
* One of the three interfaces defined by ArcIms, it gets the service |
|
116 |
* capabilities |
|
117 |
* </p> |
|
118 |
* |
|
119 |
*/ |
|
120 |
|
|
121 |
/* |
|
122 |
* public void getCapabilities(URL url) { handler.getCapabilities(url); |
|
123 |
* layers = handler.layers; rootLayer = handler.rootLayer; } |
|
124 |
*/ |
|
125 |
|
|
126 |
/** |
|
127 |
* <p> |
|
128 | 101 |
* One of the three interfaces defined by the ArcIms, it gets the |
129 | 102 |
* information about a feature requested |
130 | 103 |
* </p> |
... | ... | |
133 | 106 |
*/ |
134 | 107 |
public String getFeatureInfo(ArcImsStatus status, int x, int y, |
135 | 108 |
int featureCount) throws ArcImsException { |
136 |
return handler.getElementInfo(status, x, y, featureCount); |
|
109 |
return this.handler.getElementInfo(status, x, y, featureCount);
|
|
137 | 110 |
} |
138 | 111 |
|
139 | 112 |
/** |
... | ... | |
144 | 117 |
* @return a TreeMap with the available layers in the ArcIms |
145 | 118 |
*/ |
146 | 119 |
public TreeMap getLayers() { |
147 |
return layers; |
|
120 |
return this.layers;
|
|
148 | 121 |
} |
149 | 122 |
|
150 | 123 |
/** |
... | ... | |
156 | 129 |
* @return number of layers available |
157 | 130 |
*/ |
158 | 131 |
public int getNumberOfLayers() { |
159 |
if (layers != null) { |
|
160 |
return layers.size(); |
|
132 |
if (this.layers != null) {
|
|
133 |
return this.layers.size();
|
|
161 | 134 |
} |
162 |
|
|
163 | 135 |
return 0; |
164 | 136 |
} |
165 | 137 |
|
... | ... | |
171 | 143 |
* @return a vector with all the available formats |
172 | 144 |
*/ |
173 | 145 |
public boolean isQueryable() { |
174 |
return handler.getServiceInformation().isQueryable(); |
|
146 |
return this.handler.getServiceInformation().isQueryable();
|
|
175 | 147 |
} |
176 | 148 |
|
149 |
/** |
|
150 |
* |
|
151 |
*/ |
|
177 | 152 |
public void close() { |
178 |
// your code here
|
|
153 |
// nothing to do
|
|
179 | 154 |
} |
180 | 155 |
|
181 | 156 |
/** |
182 | 157 |
* Gets the Service information included in the Capabilities |
183 | 158 |
* */ |
184 | 159 |
public ServiceInformation getServiceInformation() { |
185 |
return handler.getServiceInformation(); |
|
160 |
return this.handler.getServiceInformation();
|
|
186 | 161 |
} |
187 | 162 |
|
188 | 163 |
/** |
... | ... | |
193 | 168 |
*/ |
194 | 169 |
public boolean connect(boolean override, ICancellable cancel) { |
195 | 170 |
try { |
196 |
if (handler == null) { |
|
171 |
if (this.handler == null) {
|
|
197 | 172 |
if (getHost().trim().length() > 0) { |
198 |
handler.setHost(getHost()); |
|
173 |
this.handler.setHost(getHost());
|
|
199 | 174 |
} else { |
200 | 175 |
// must to specify host first!!!! |
201 | 176 |
return false; |
202 | 177 |
} |
203 | 178 |
} |
204 | 179 |
|
205 |
getCapabilities(null); |
|
180 |
this.getCapabilities(null);
|
|
206 | 181 |
|
207 | 182 |
return true; |
208 | 183 |
} catch (Exception e) { |
209 | 184 |
logger.error("While connecting", e); |
210 |
|
|
211 | 185 |
return false; |
212 | 186 |
} |
213 | 187 |
} |
214 | 188 |
|
215 | 189 |
public boolean connect(URL server, ICancellable cancel) { |
216 |
setHost(server.toString()); |
|
217 |
|
|
190 |
this.setHost(server.toString()); |
|
218 | 191 |
return connect(false, cancel); |
219 | 192 |
} |
220 | 193 |
|
... | ... | |
224 | 197 |
* @return The handler |
225 | 198 |
*/ |
226 | 199 |
public ArcImsProtocolHandler getHandler() { |
227 |
return handler; |
|
200 |
return this.handler;
|
|
228 | 201 |
} |
229 | 202 |
|
230 | 203 |
/** |
... | ... | |
236 | 209 |
* @throws ArcImsException |
237 | 210 |
*/ |
238 | 211 |
public ILegend getLegend(String layerId) throws ArcImsException { |
239 |
return handler.getLegend(layerId); |
|
212 |
return this.handler.getLegend(layerId);
|
|
240 | 213 |
} |
214 |
|
|
215 |
|
|
241 | 216 |
} |
Also available in: Unified diff