Revision 2322 org.gvsig.raster.postgis/branches/org.gvsig.raster.postgis_dataaccess_refactoring/org.gvsig.raster.postgis.io/src/main/java/org/gvsig/raster/postgis/io/PostGISRasterServerExplorerParameters.java
PostGISRasterServerExplorerParameters.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
26 | 26 |
import org.gvsig.fmap.dal.spi.AbstractDataParameters; |
27 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
27 | 28 |
import org.gvsig.tools.ToolsLocator; |
28 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
29 | 29 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
30 |
import org.gvsig.tools.dynobject.DynClass; |
|
31 |
import org.gvsig.tools.dynobject.DynField; |
|
32 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
30 |
import org.gvsig.tools.dynobject.DynStruct; |
|
31 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
33 | 32 |
|
34 | 33 |
/** |
35 | 34 |
* Parameters for the PostGIS Raster provider |
36 | 35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
37 | 36 |
*/ |
38 | 37 |
public class PostGISRasterServerExplorerParameters extends AbstractDataParameters implements DataServerExplorerParameters { |
39 |
public static final String DYNCLASS_NAME = "PostGISRasterServerExplorerParameters"; |
|
40 | 38 |
protected static final String FIELD_HOST = "host"; |
41 |
protected static DynClass DYNCLASS = null;
|
|
39 |
private static final String AXIS_ORDER = "axisorder";
|
|
42 | 40 |
private DelegatedDynObject delegatedDynObject = null; |
43 | 41 |
|
44 | 42 |
public PostGISRasterServerExplorerParameters() { |
... | ... | |
46 | 44 |
initialize(); |
47 | 45 |
} |
48 | 46 |
|
47 |
|
|
49 | 48 |
protected void initialize() { |
50 | 49 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
51 | 50 |
.getDynObjectManager().createDynObject( |
52 |
DYNCLASS);
|
|
51 |
registerDynClass());
|
|
53 | 52 |
} |
54 | 53 |
|
55 |
@SuppressWarnings("deprecation") |
|
56 |
public static void registerDynClass() { |
|
57 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
|
58 |
DynClass dynClass; |
|
59 |
DynField field; |
|
60 |
|
|
61 |
if(dynman == null) |
|
62 |
return; |
|
63 |
|
|
64 |
if (DYNCLASS == null) { |
|
65 |
dynClass = dynman.add(DYNCLASS_NAME); |
|
66 |
|
|
67 |
field = dynClass.addDynField(FIELD_HOST); |
|
68 |
field.setTheTypeOfAvailableValues(DynField.ANY); |
|
69 |
field.setDescription("Uniform Resource Identifier (File name or URL)"); |
|
70 |
field.setType(DataTypes.STRING); |
|
71 |
field.setMandatory(true); |
|
72 |
|
|
73 |
DYNCLASS = dynClass; |
|
54 |
public static DynStruct registerDynClass() { |
|
55 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
56 |
DynStruct definition = manager.getDefinition("PostGISRasterServerExplorerParameters_Persistent"); |
|
57 |
if( definition == null ) { |
|
58 |
definition = manager.addDefinition( |
|
59 |
PostGISRasterServerExplorerParameters.class, |
|
60 |
"PostGISRasterServerExplorerParameters_Persistent", |
|
61 |
"PostGISRasterServerExplorerParameters Persistency", |
|
62 |
null, |
|
63 |
null |
|
64 |
); |
|
74 | 65 |
} |
75 | 66 |
|
67 |
AbstractRasterDataParameters.registerDynClass(definition); |
|
68 |
|
|
69 |
definition.addDynFieldBoolean(AXIS_ORDER) |
|
70 |
.setDescription("Longitude first in axis order") |
|
71 |
.setMandatory(false); |
|
72 |
|
|
73 |
definition.addDynFieldString(FIELD_HOST) |
|
74 |
.setDescription("Uniform Resource Identifier (File name or URL)") |
|
75 |
.setMandatory(false); |
|
76 |
return definition; |
|
76 | 77 |
} |
77 | 78 |
|
78 | 79 |
protected DelegatedDynObject getDelegatedDynObject() { |
... | ... | |
94 | 95 |
public void setHost(String host) { |
95 | 96 |
this.setDynValue(FIELD_HOST, host); |
96 | 97 |
} |
98 |
|
|
99 |
/** |
|
100 |
* Returns true if the longitude is first in axis order |
|
101 |
* @return |
|
102 |
*/ |
|
103 |
public boolean isLongitudeFirst() { |
|
104 |
Boolean b = (Boolean)getDynValue(AXIS_ORDER); |
|
105 |
if(b != null) |
|
106 |
return ((Boolean)b).booleanValue(); |
|
107 |
return false; |
|
108 |
} |
|
97 | 109 |
|
98 |
/* |
|
99 |
* (non-Javadoc)
|
|
100 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName()
|
|
110 |
/**
|
|
111 |
* Sets the longitude first in axis order
|
|
112 |
* @param longFirst
|
|
101 | 113 |
*/ |
114 |
public void setLongitudeFirst(boolean longFirst) { |
|
115 |
this.setDynValue(AXIS_ORDER, new Boolean(longFirst)); |
|
116 |
} |
|
117 |
|
|
102 | 118 |
public String getDataStoreName() { |
103 | 119 |
return PostGISRasterProvider.NAME; |
104 | 120 |
} |
105 | 121 |
|
106 |
/* |
|
107 |
* (non-Javadoc) |
|
108 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription() |
|
109 |
*/ |
|
110 | 122 |
public String getDescription() { |
111 | 123 |
return PostGISRasterProvider.DESCRIPTION; |
112 | 124 |
} |
Also available in: Unified diff