svn-gvsig-desktop / tmp / trunk / cliente / WorkSpace_WPSClient / extWPSCallejero / src / es / logex / gvsig / wps / client / WPSProtocolHandlerFactory.java @ 26601
History | View | Annotate | Download (1001 Bytes)
1 |
package es.logex.gvsig.wps.client; |
---|---|
2 |
|
3 |
public class WPSProtocolHandlerFactory { |
4 |
public WPSProtocolHandler wPSProtocolHandler;
|
5 |
|
6 |
/**
|
7 |
* Método que devuelve una instancia de WPSProtocolHandler adecuada a la versión del servidor, si
|
8 |
* se tiene implementada. Si no, lanzará excepción de versión no soportada.
|
9 |
* @param host
|
10 |
* @return
|
11 |
*/
|
12 |
public static WPSProtocolHandler negotiate(String host) { |
13 |
//TODO: Gestionar las versiones y devolver la instancia que toca.
|
14 |
return createVersionHandler("0.4.0"); |
15 |
} |
16 |
|
17 |
@SuppressWarnings("unchecked") |
18 |
private static WPSProtocolHandler createVersionHandler(String version) { |
19 |
try {
|
20 |
Class handler;
|
21 |
version = version.replace('.', '_'); |
22 |
handler = Class.forName("es.logex.gvsig.wps.wps_"+ version +".WPSProtocolHandler" + version); |
23 |
return (WPSProtocolHandler)handler.newInstance();
|
24 |
} catch (Exception e) { |
25 |
e.printStackTrace(); |
26 |
//throw new Exception("WFSDriverFactory. Unknown driver version " + e);
|
27 |
return null; |
28 |
} |
29 |
} |
30 |
} |