Revision 40608
trunk/org.gvsig.desktop/pom.xml | ||
---|---|---|
795 | 795 |
</dependency> |
796 | 796 |
<dependency> |
797 | 797 |
<groupId>org.gvsig</groupId> |
798 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
799 |
<version>${gvsig.metadata.version}</version> |
|
800 |
</dependency> |
|
801 |
<dependency> |
|
802 |
<groupId>org.gvsig</groupId> |
|
803 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
804 |
<version>${gvsig.metadata.version}</version> |
|
805 |
</dependency> |
|
806 |
<dependency> |
|
807 |
<groupId>org.gvsig</groupId> |
|
808 |
<artifactId>org.gvsig.metadata.swing.basic.api</artifactId> |
|
809 |
<version>${gvsig.metadata.version}</version> |
|
810 |
</dependency> |
|
811 |
<dependency> |
|
812 |
<groupId>org.gvsig</groupId> |
|
813 |
<artifactId>org.gvsig.metadata.swing.basic.impl</artifactId> |
|
814 |
<version>${gvsig.metadata.version}</version> |
|
815 |
</dependency> |
|
816 |
<dependency> |
|
817 |
<groupId>org.gvsig</groupId> |
|
818 | 798 |
<artifactId>org.gvsig.about.api</artifactId> |
819 | 799 |
<version>${gvsig.about.version}</version> |
820 | 800 |
</dependency> |
... | ... | |
883 | 863 |
|
884 | 864 |
<dependency> |
885 | 865 |
<groupId>org.gvsig</groupId> |
866 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
867 |
<version>2.0.16-SNAPSHOT</version> |
|
868 |
</dependency> |
|
869 |
<dependency> |
|
870 |
<groupId>org.gvsig</groupId> |
|
871 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
872 |
<version>2.0.16-SNAPSHOT</version> |
|
873 |
</dependency> |
|
874 |
<dependency> |
|
875 |
<groupId>org.gvsig</groupId> |
|
876 |
<artifactId>org.gvsig.metadata.swing.basic.api</artifactId> |
|
877 |
<version>2.0.16-SNAPSHOT</version> |
|
878 |
</dependency> |
|
879 |
<dependency> |
|
880 |
<groupId>org.gvsig</groupId> |
|
881 |
<artifactId>org.gvsig.metadata.swing.basic.impl</artifactId> |
|
882 |
<version>2.0.16-SNAPSHOT</version> |
|
883 |
</dependency> |
|
884 |
<dependency> |
|
885 |
<groupId>org.gvsig</groupId> |
|
886 | 886 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
887 | 887 |
<version>2.0.16-SNAPSHOT</version> |
888 | 888 |
</dependency> |
... | ... | |
2232 | 2232 |
<!-- External project versions --> |
2233 | 2233 |
<gvsig.tools.version>3.0.5</gvsig.tools.version> |
2234 | 2234 |
<gvsig.about.version>1.0.0</gvsig.about.version> |
2235 |
<gvsig.metadata.version>1.0.0</gvsig.metadata.version> |
|
2236 | 2235 |
<gvsig.proj.version>1.0.0</gvsig.proj.version> |
2237 | 2236 |
<gvsig.projection.api.version>2.0.11</gvsig.projection.api.version> |
2238 | 2237 |
<gvsig.timesupport.version>1.0.0</gvsig.timesupport.version> |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
DefaultExampleManager class. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.metadata.basic.impl.DefaultExampleManager"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
|
|
26 |
<!-- |
|
27 |
By default, show only logging messages of INFO level or higher, |
|
28 |
through the previously configured CONSOLE appender. |
|
29 |
--> |
|
30 |
<root> |
|
31 |
<priority value="INFO" /> |
|
32 |
<appender-ref ref="CONSOLE" /> |
|
33 |
</root> |
|
34 |
</log4j:configuration> |
|
0 | 35 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
Put into this folder the resources needed by your test classes. |
|
5 |
|
|
6 |
This folder is added to the Tests classpath, so you can load any resources |
|
7 |
through the ClassLoader. |
|
8 |
|
|
9 |
By default, in this folder you can find an example of log4j configuration, |
|
10 |
prepared to log messages through the console, so logging works when you |
|
11 |
run your tests classes. |
|
0 | 12 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/test/java/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
For each class you are going to test, create one Test class with the same |
|
5 |
name as the class to test, ending with Test. |
|
6 |
|
|
7 |
For example, the unit tests of the "ExampleLibrary" class are performed |
|
8 |
by the "ExampleLibraryTest" class. |
|
0 | 9 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/javadoc/overview.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.metadata.basic package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
|
0 | 16 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your library classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find some examples of resource bundle |
|
7 |
property files that may be used by your library classes. |
|
0 | 8 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.metadata.lib.basic.impl.BasicMetadataLibrary |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/resources/org/gvsig/metadata/lib/basic/impl/i18n/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Example.returns_value=devuelve el valor |
|
0 | 3 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/resources/org/gvsig/metadata/lib/basic/impl/i18n/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Example.returns_value=returns value |
|
0 | 3 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/BasicMetadataManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform�ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
*/ |
|
29 |
|
|
30 |
package org.gvsig.metadata.lib.basic.impl; |
|
31 |
|
|
32 |
import org.gvsig.metadata.Metadata; |
|
33 |
import org.gvsig.metadata.MetadataContainer; |
|
34 |
import org.gvsig.metadata.MetadataManager; |
|
35 |
import org.gvsig.tools.dynobject.DynClass; |
|
36 |
import org.gvsig.tools.dynobject.DynStruct; |
|
37 |
|
|
38 |
public class BasicMetadataManager extends AbstractMetadataManager implements |
|
39 |
MetadataManager { |
|
40 |
|
|
41 |
|
|
42 |
protected Metadata createMetadata(DynStruct definition) { |
|
43 |
return new DefaultMetadata(definition); |
|
44 |
} |
|
45 |
|
|
46 |
protected MetadataContainer createMetadataContainer(DynClass dynClass) { |
|
47 |
return new BasicMetadataContainer(dynClass); |
|
48 |
} |
|
49 |
} |
|
0 | 50 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/AbstractMetadataManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2011 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform�ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
*/ |
|
29 |
package org.gvsig.metadata.lib.basic.impl; |
|
30 |
|
|
31 |
import java.io.File; |
|
32 |
import java.io.IOException; |
|
33 |
import java.io.InputStream; |
|
34 |
import java.util.ArrayList; |
|
35 |
import java.util.HashMap; |
|
36 |
import java.util.Iterator; |
|
37 |
import java.util.Map; |
|
38 |
|
|
39 |
import org.slf4j.Logger; |
|
40 |
import org.slf4j.LoggerFactory; |
|
41 |
import org.xmlpull.v1.XmlPullParserException; |
|
42 |
|
|
43 |
import org.gvsig.metadata.Metadata; |
|
44 |
import org.gvsig.metadata.MetadataContainer; |
|
45 |
import org.gvsig.metadata.MetadataManager; |
|
46 |
import org.gvsig.metadata.exceptions.AddMetadataDefinitionException; |
|
47 |
import org.gvsig.metadata.exceptions.DuplicateMetadataDefinitionException; |
|
48 |
import org.gvsig.metadata.exceptions.InvalidMetadataNamespaceException; |
|
49 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
50 |
import org.gvsig.tools.ToolsLocator; |
|
51 |
import org.gvsig.tools.dynobject.DynClass; |
|
52 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
53 |
import org.gvsig.tools.dynobject.DynStruct; |
|
54 |
import org.gvsig.tools.dynobject.impl.DefaultDynClassName; |
|
55 |
import org.gvsig.tools.persistence.impl.exception.CantFindDefinitionInStreamException; |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* Abstract metadata manager used in both metadata basic and full modules. |
|
60 |
*/ |
|
61 |
public abstract class AbstractMetadataManager implements MetadataManager { |
|
62 |
|
|
63 |
private final Logger LOG = LoggerFactory |
|
64 |
.getLogger(AbstractMetadataManager.class); |
|
65 |
|
|
66 |
private Map metadataItems; |
|
67 |
|
|
68 |
protected DynObjectManager dynManager; |
|
69 |
|
|
70 |
protected File metadataHomeFile = null; |
|
71 |
|
|
72 |
private boolean doSavingValidation; |
|
73 |
|
|
74 |
private boolean doExportingValidation; |
|
75 |
|
|
76 |
public AbstractMetadataManager() { |
|
77 |
dynManager = ToolsLocator.getDynObjectManager(); |
|
78 |
} |
|
79 |
|
|
80 |
protected void initDefinitions() { |
|
81 |
this.metadataItems = new HashMap(); |
|
82 |
Iterator definitionsIter = ToolsLocator.getDynObjectManager().iterator( |
|
83 |
MetadataManager.METADATA_NAMESPACE); |
|
84 |
DynStruct definition; |
|
85 |
while (definitionsIter.hasNext()) { |
|
86 |
definition = (DynStruct) definitionsIter.next(); |
|
87 |
if (!this.getMetadataItems().containsKey(definition)) { |
|
88 |
Metadata metadata = createMetadata(definition); |
|
89 |
this.getMetadataItems().put(definition, metadata); |
|
90 |
} |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
public DynStruct addDefinition(String name, String description) |
|
95 |
throws MetadataException { |
|
96 |
|
|
97 |
DynClass definition = dynManager.createDynClass(METADATA_NAMESPACE, |
|
98 |
name, description); |
|
99 |
|
|
100 |
addDefinition(definition); |
|
101 |
return definition; |
|
102 |
} |
|
103 |
|
|
104 |
public DynStruct addDefinition(String metadataDefinitionName, |
|
105 |
InputStream stream, ClassLoader loader) throws MetadataException { |
|
106 |
Map x; |
|
107 |
try { |
|
108 |
x = dynManager.importDynClassDefinitions(stream, loader, |
|
109 |
METADATA_NAMESPACE); |
|
110 |
} catch (XmlPullParserException e) { |
|
111 |
throw new AddMetadataDefinitionException(e, metadataDefinitionName); |
|
112 |
} catch (IOException e) { |
|
113 |
throw new AddMetadataDefinitionException(e, metadataDefinitionName); |
|
114 |
} |
|
115 |
DynClass definition = (DynClass) x.get(metadataDefinitionName); |
|
116 |
if (definition == null) { |
|
117 |
throw new CantFindDefinitionInStreamException( |
|
118 |
metadataDefinitionName, getKeys(x)); |
|
119 |
} |
|
120 |
addDefinition(definition); |
|
121 |
return definition; |
|
122 |
} |
|
123 |
|
|
124 |
private String getKeys(Map theMap) { |
|
125 |
return new ArrayList(theMap.keySet()).toString(); |
|
126 |
} |
|
127 |
|
|
128 |
public DynStruct getDefinition(Metadata metadata) throws MetadataException { |
|
129 |
return dynManager.get(METADATA_NAMESPACE, metadata.getMetadataName()); |
|
130 |
} |
|
131 |
|
|
132 |
public DynStruct getDefinition(String metadataName) { |
|
133 |
if (metadataName == null) |
|
134 |
return null; |
|
135 |
if (metadataName.contains(":")) { |
|
136 |
int index = metadataName.lastIndexOf(":"); |
|
137 |
return dynManager.get(metadataName.substring(0, index), |
|
138 |
metadataName.substring(index + 1, metadataName.length())); |
|
139 |
} |
|
140 |
return dynManager.get(METADATA_NAMESPACE, metadataName); |
|
141 |
} |
|
142 |
|
|
143 |
public void addDefinition(DynClass definition) throws MetadataException { |
|
144 |
if (definition == null) { |
|
145 |
return; |
|
146 |
} |
|
147 |
if ((definition.getNamespace() == null) |
|
148 |
|| (definition.getNamespace().equals(""))) { |
|
149 |
definition.setNamespace(METADATA_NAMESPACE); |
|
150 |
} |
|
151 |
|
|
152 |
if (!METADATA_NAMESPACE.equalsIgnoreCase(definition.getNamespace())) { |
|
153 |
throw new InvalidMetadataNamespaceException(definition.getName(), |
|
154 |
definition.getNamespace()); |
|
155 |
} |
|
156 |
if (dynManager.get(definition.getNamespace(), definition.getName()) != null) { |
|
157 |
throw new DuplicateMetadataDefinitionException(definition.getName()); |
|
158 |
} |
|
159 |
dynManager.add(definition); |
|
160 |
|
|
161 |
LOG.trace("Registered metadata definition {}.", |
|
162 |
definition.getFullName()); |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
public void removeDefinition(DynStruct dynStruct) { |
|
167 |
if (dynStruct == null) |
|
168 |
return; |
|
169 |
this.metadataItems.remove(dynStruct); |
|
170 |
dynManager.remove(dynStruct); |
|
171 |
} |
|
172 |
|
|
173 |
public MetadataContainer createMetadataContainer(String name) { |
|
174 |
DynClass dynClass = dynManager.get(METADATA_NAMESPACE, name); |
|
175 |
if (dynClass == null) { |
|
176 |
throw new IllegalArgumentException( |
|
177 |
"Can't locate class '" |
|
178 |
+ new DefaultDynClassName(METADATA_NAMESPACE, name) |
|
179 |
.getFullName() + "'."); |
|
180 |
} |
|
181 |
|
|
182 |
return createMetadataContainer(dynClass); |
|
183 |
// return new BasicMetadataContainer(dynClass); |
|
184 |
} |
|
185 |
|
|
186 |
protected abstract MetadataContainer createMetadataContainer( |
|
187 |
DynClass dynClass); |
|
188 |
|
|
189 |
public void storeMetadata(Metadata metadata) throws MetadataException { |
|
190 |
// In SimpleMetadataManager do nothing |
|
191 |
} |
|
192 |
|
|
193 |
public void loadMetadata(Metadata metadata) throws MetadataException { |
|
194 |
// In SimpleMetadataManager do nothing |
|
195 |
} |
|
196 |
|
|
197 |
private Map getMetadataItems() { |
|
198 |
if (this.metadataItems == null) { |
|
199 |
initDefinitions(); |
|
200 |
} |
|
201 |
return this.metadataItems; |
|
202 |
} |
|
203 |
|
|
204 |
public Metadata getMetadata(DynStruct definition) |
|
205 |
throws InvalidMetadataNamespaceException { |
|
206 |
if (this.getMetadataItems().containsKey(definition)) { |
|
207 |
return (Metadata) this.getMetadataItems().get(definition); |
|
208 |
} |
|
209 |
|
|
210 |
if (definition == null) { |
|
211 |
return null; |
|
212 |
} |
|
213 |
|
|
214 |
if ((definition.getNamespace() == null) |
|
215 |
|| (!definition.getNamespace().equals(METADATA_NAMESPACE))) { |
|
216 |
throw new InvalidMetadataNamespaceException(definition); |
|
217 |
} |
|
218 |
|
|
219 |
Metadata metadata = createMetadata(definition); |
|
220 |
|
|
221 |
this.getMetadataItems().put(definition, metadata); |
|
222 |
|
|
223 |
LOG.trace("Registered metadata definition {}.", |
|
224 |
definition.getFullName()); |
|
225 |
|
|
226 |
return metadata; |
|
227 |
} |
|
228 |
|
|
229 |
protected abstract Metadata createMetadata(DynStruct definition); |
|
230 |
|
|
231 |
public File getMetadataHomeRepository() { |
|
232 |
if (this.metadataHomeFile == null) { |
|
233 |
String path = System.getProperty("user.home"); |
|
234 |
path += File.separator + ".org.gvsig.metadata"; |
|
235 |
this.metadataHomeFile = new File(path); |
|
236 |
} |
|
237 |
if (!this.metadataHomeFile.exists()) { |
|
238 |
this.metadataHomeFile.mkdirs(); |
|
239 |
} |
|
240 |
return this.metadataHomeFile; |
|
241 |
} |
|
242 |
|
|
243 |
public File getRepositoryFile(String relativePath) { |
|
244 |
if ((relativePath == null) || (relativePath.equals(""))) |
|
245 |
return this.metadataHomeFile; |
|
246 |
return new File(getMetadataHomeRepository().toString() + File.separator |
|
247 |
+ relativePath); |
|
248 |
} |
|
249 |
|
|
250 |
public void storeDefinitions() { |
|
251 |
Iterator it = ToolsLocator.getDynObjectManager().iterator( |
|
252 |
METADATA_NAMESPACE); |
|
253 |
} |
|
254 |
|
|
255 |
public Iterator getDefinitions() { |
|
256 |
// initDefinitions(); |
|
257 |
return getMetadataItems().values().iterator(); |
|
258 |
} |
|
259 |
|
|
260 |
public void setMetadataHomeRepository(File metadataHomeFile) { |
|
261 |
if (metadataHomeFile == null) { |
|
262 |
return; |
|
263 |
} |
|
264 |
|
|
265 |
this.metadataHomeFile = metadataHomeFile; |
|
266 |
if (!this.metadataHomeFile.exists()) |
|
267 |
this.metadataHomeFile.mkdirs(); |
|
268 |
} |
|
269 |
|
|
270 |
public Metadata getMetadata(String metadataID) |
|
271 |
throws InvalidMetadataNamespaceException { |
|
272 |
return this.getMetadata(getDefinition(metadataID)); |
|
273 |
} |
|
274 |
|
|
275 |
public void setValidationBeforeSaving(boolean doValidation) { |
|
276 |
this.doSavingValidation = doValidation; |
|
277 |
} |
|
278 |
|
|
279 |
public boolean getValidationBeforeSaving() { |
|
280 |
return this.doSavingValidation; |
|
281 |
} |
|
282 |
|
|
283 |
public void setValidationBeforeExporting(boolean doValidation) { |
|
284 |
this.doExportingValidation = doValidation; |
|
285 |
} |
|
286 |
|
|
287 |
public boolean getValidationBeforeExporting() { |
|
288 |
return this.doExportingValidation; |
|
289 |
} |
|
290 |
} |
|
0 | 291 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/CantFindDefinitionInStreamException.java | ||
---|---|---|
1 |
package org.gvsig.metadata.lib.basic.impl; |
|
2 |
|
|
3 |
import org.gvsig.metadata.exceptions.AddMetadataDefinitionException; |
|
4 |
|
|
5 |
public class CantFindDefinitionInStreamException extends AddMetadataDefinitionException { |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
*/ |
|
10 |
private static final long serialVersionUID = 450922621905049558L; |
|
11 |
|
|
12 |
public CantFindDefinitionInStreamException(String name) { |
|
13 |
super( |
|
14 |
"Can't find metadata definition %(name) in stream.", |
|
15 |
"_cant_find_metadata_definition_XnameX_in_stream", |
|
16 |
serialVersionUID |
|
17 |
); |
|
18 |
setValue("name",name); |
|
19 |
} |
|
20 |
|
|
21 |
public CantFindDefinitionInStreamException(String name, String found) { |
|
22 |
super( |
|
23 |
"Can't find metadata definition %(name) in stream, found %(found).", |
|
24 |
"_cant_find_metadata_definition_XnameX_in_stream_found_XfoundX", |
|
25 |
serialVersionUID |
|
26 |
); |
|
27 |
setValue("name",name); |
|
28 |
setValue("found",found); |
|
29 |
} |
|
30 |
} |
|
0 | 31 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/AbstractMetadata.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2011 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform�ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
*/ |
|
29 |
package org.gvsig.metadata.lib.basic.impl; |
|
30 |
|
|
31 |
import java.util.HashSet; |
|
32 |
import java.util.Set; |
|
33 |
|
|
34 |
import org.gvsig.metadata.Metadata; |
|
35 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
36 |
import org.gvsig.tools.dynobject.DynStruct; |
|
37 |
import org.gvsig.tools.dynobject.impl.DefaultDynObject; |
|
38 |
|
|
39 |
/** |
|
40 |
* Abstract metadata used in both metadata basic and full modules. |
|
41 |
*/ |
|
42 |
public abstract class AbstractMetadata extends DefaultDynObject implements |
|
43 |
Metadata, Comparable { |
|
44 |
|
|
45 |
public AbstractMetadata(DynStruct dynClass) { |
|
46 |
super(dynClass); |
|
47 |
} |
|
48 |
|
|
49 |
public Set getMetadataChildren() throws MetadataException { |
|
50 |
Set children = new HashSet(); |
|
51 |
DynStruct[] items = this.getDynClass().getSuperDynStructs(); |
|
52 |
if (items == null) |
|
53 |
return children; |
|
54 |
|
|
55 |
Object item; |
|
56 |
for (int i = 0; i < items.length; i++) { |
|
57 |
item = items[i]; |
|
58 |
if (item instanceof Metadata) { |
|
59 |
children.add(item); |
|
60 |
} |
|
61 |
} |
|
62 |
return children; |
|
63 |
} |
|
64 |
|
|
65 |
public Object getMetadataID() throws MetadataException { |
|
66 |
return this.getDynClass().getFullName(); |
|
67 |
} |
|
68 |
|
|
69 |
public String getMetadataName() throws MetadataException { |
|
70 |
return this.getDynClass().getName(); |
|
71 |
} |
|
72 |
|
|
73 |
|
|
74 |
public int compareTo(Object object) { |
|
75 |
if (object == null) { |
|
76 |
return 0; |
|
77 |
} |
|
78 |
if (object instanceof Metadata) { |
|
79 |
return this |
|
80 |
.getDynClass() |
|
81 |
.getFullName() |
|
82 |
.toLowerCase() |
|
83 |
.compareTo( |
|
84 |
((Metadata) object).getDynClass().getFullName() |
|
85 |
.toLowerCase()); |
|
86 |
} |
|
87 |
if (object instanceof DynStruct) { |
|
88 |
return this |
|
89 |
.getDynClass() |
|
90 |
.getFullName() |
|
91 |
.toLowerCase() |
|
92 |
.compareTo(((DynStruct) object).getFullName().toLowerCase()); |
|
93 |
} |
|
94 |
return 0; |
|
95 |
} |
|
96 |
|
|
97 |
public String toString() { |
|
98 |
String name = this.getDynClass().getName(); |
|
99 |
return name.substring(0, 1).toUpperCase() + name.substring(1); |
|
100 |
} |
|
101 |
|
|
102 |
public String toDynObjectString() { |
|
103 |
return super.toString(); |
|
104 |
} |
|
105 |
} |
|
0 | 106 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/BasicMetadataContainer.java | ||
---|---|---|
1 |
package org.gvsig.metadata.lib.basic.impl; |
|
2 |
|
|
3 |
import org.gvsig.metadata.MetadataContainer; |
|
4 |
import org.gvsig.tools.dynobject.DynStruct; |
|
5 |
import org.gvsig.tools.dynobject.impl.DefaultDynObject; |
|
6 |
|
|
7 |
public class BasicMetadataContainer extends DefaultDynObject implements MetadataContainer { |
|
8 |
|
|
9 |
public BasicMetadataContainer(DynStruct dynClass) { |
|
10 |
super(dynClass); |
|
11 |
} |
|
12 |
|
|
13 |
} |
|
0 | 14 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/DefaultMetadata.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2011 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform�ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
*/ |
|
29 |
package org.gvsig.metadata.lib.basic.impl; |
|
30 |
|
|
31 |
import org.gvsig.metadata.Metadata; |
|
32 |
import org.gvsig.tools.dynobject.DynStruct; |
|
33 |
|
|
34 |
/** |
|
35 |
* Default metadata implementation of the basic implementation module. |
|
36 |
*/ |
|
37 |
public class DefaultMetadata extends AbstractMetadata implements Metadata { |
|
38 |
|
|
39 |
public DefaultMetadata(DynStruct dynClass) { |
|
40 |
super(dynClass); |
|
41 |
} |
|
42 |
|
|
43 |
} |
|
0 | 44 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/src/main/java/org/gvsig/metadata/lib/basic/impl/BasicMetadataLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform�ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
* {{Task}} |
|
29 |
*/ |
|
30 |
|
|
31 |
package org.gvsig.metadata.lib.basic.impl; |
|
32 |
|
|
33 |
import java.util.Locale; |
|
34 |
|
|
35 |
import org.gvsig.metadata.MetadataLibrary; |
|
36 |
import org.gvsig.metadata.MetadataLocator; |
|
37 |
import org.gvsig.metadata.MetadataManager; |
|
38 |
import org.gvsig.tools.ToolsLibrary; |
|
39 |
import org.gvsig.tools.ToolsLocator; |
|
40 |
import org.gvsig.tools.i18n.I18nManager; |
|
41 |
import org.gvsig.tools.library.AbstractLibrary; |
|
42 |
import org.gvsig.tools.library.LibraryException; |
|
43 |
|
|
44 |
public class BasicMetadataLibrary extends AbstractLibrary { |
|
45 |
|
|
46 |
public void doRegistration() { |
|
47 |
super.doRegistration(); |
|
48 |
require(ToolsLibrary.class); |
|
49 |
registerAsImplementationOf(MetadataLibrary.class); |
|
50 |
} |
|
51 |
|
|
52 |
protected void doInitialize() throws LibraryException { |
|
53 |
MetadataLocator.registerMetadataManager(BasicMetadataManager.class); |
|
54 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
55 |
|
|
56 |
i18nManager.addResourceFamily("org.gvsig.metadata.basic.impl.i18n.text", |
|
57 |
BasicMetadataLibrary.class.getClassLoader(), |
|
58 |
BasicMetadataLibrary.class.getClass().getName()); |
|
59 |
} |
|
60 |
|
|
61 |
protected void doPostInitialize() throws LibraryException { |
|
62 |
MetadataManager metadataManager = MetadataLocator.getMetadataManager(); |
|
63 |
if (!(metadataManager instanceof MetadataManager)) { |
|
64 |
throw new LibraryException(BasicMetadataManager.class, null); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
0 | 69 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
|
|
7 |
<name>org.gvsig.metadata.lib.basic.impl</name> |
|
8 |
<description>Metadata library basic implementation</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.metadata.basic.lib</artifactId> |
|
12 |
<version>2.0.16-SNAPSHOT</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
|
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
24 |
</dependency> |
|
25 |
</dependencies> |
|
26 |
</project> |
|
0 | 27 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.metadata.basic.lib</artifactId> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<description>This project contains the basic metadata features.</description> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.metadata.basic</artifactId> |
|
13 |
<version>2.0.16-SNAPSHOT</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<modules> |
|
17 |
<module>org.gvsig.metadata.lib.basic.api</module> |
|
18 |
<module>org.gvsig.metadata.lib.basic.impl</module> |
|
19 |
</modules> |
|
20 |
|
|
21 |
</project> |
|
0 | 22 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.metadata.lib.basic.api</name> |
|
8 |
<description>Metadata library basic API</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.metadata.basic.lib</artifactId> |
|
12 |
<version>2.0.16-SNAPSHOT</version> |
|
13 |
</parent> |
|
14 |
<dependencies> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
18 |
</dependency> |
|
19 |
</dependencies> |
|
20 |
</project> |
|
0 | 21 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/javadoc/overview.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.metadata.api package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
|
0 | 16 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/resources/org/gvsig/metadata/lib/api/i18n/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Example.returns_value=devuelve el valor |
|
0 | 3 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/resources/org/gvsig/metadata/lib/api/i18n/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Example.returns_value=returns value |
|
0 | 3 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your library classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find some examples of resource bundle |
|
7 |
property files that may be used by your library classes. |
|
0 | 8 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.metadata.MetadataLibrary |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/Metadata.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
/* |
|
23 |
* AUTHORS (In addition to CIT): |
|
24 |
* 2011 Geographic Information research group: http://www.geoinfo.uji.es |
|
25 |
* Departamento de Lenguajes y Sistemas Informaticos (LSI) |
|
26 |
* Universitat Jaume I |
|
27 |
*/ |
|
28 |
|
|
29 |
package org.gvsig.metadata; |
|
30 |
|
|
31 |
import java.util.Set; |
|
32 |
|
|
33 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
34 |
import org.gvsig.tools.dynobject.DynObject; |
|
35 |
|
|
36 |
/** |
|
37 |
* Metadata is information or data about data {@link http |
|
38 |
* ://en.wikipedia.org/wiki/Metadata}. |
|
39 |
* <p> |
|
40 |
* This interface extends DynObject to add anything needed over the DynObject |
|
41 |
* model to be able to be used as a Metadata model. |
|
42 |
* </p> |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a> |
|
46 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
47 |
* @version $Id$ |
|
48 |
* |
|
49 |
*/ |
|
50 |
public interface Metadata extends DynObject { |
|
51 |
|
|
52 |
/** |
|
53 |
* Returns the unique identifier of the Metadata. |
|
54 |
* |
|
55 |
* @return the Metadata identifier |
|
56 |
*/ |
|
57 |
public Object getMetadataID() throws MetadataException; |
|
58 |
|
|
59 |
/** |
|
60 |
* Returns the name of the Metadata, which allows to identify the type in |
|
61 |
* the Metadata registry. |
|
62 |
* |
|
63 |
* @return the Metadata name |
|
64 |
*/ |
|
65 |
public String getMetadataName() throws MetadataException; |
|
66 |
|
|
67 |
/** |
|
68 |
* Returns an unsorted set of child Metadata objects. |
|
69 |
* |
|
70 |
* @return an unsorted set of child Metadata objects |
|
71 |
*/ |
|
72 |
public Set getMetadataChildren() throws MetadataException; |
|
73 |
|
|
74 |
} |
|
0 | 75 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/exceptions/MetadataException.java | ||
---|---|---|
1 |
package org.gvsig.metadata.exceptions; |
|
2 |
|
|
3 |
import org.gvsig.tools.exception.ListBaseException; |
|
4 |
|
|
5 |
public class MetadataException extends ListBaseException { |
|
6 |
/** |
|
7 |
* |
|
8 |
*/ |
|
9 |
private static final long serialVersionUID = -2654368520999289207L; |
|
10 |
private final static String MESSAGE_FORMAT = "Error getting or setting the state of the object."; |
|
11 |
private final static String MESSAGE_KEY = "_MetadataException"; |
|
12 |
|
|
13 |
public MetadataException(Throwable cause) { |
|
14 |
this(MESSAGE_FORMAT, cause); |
|
15 |
} |
|
16 |
|
|
17 |
protected MetadataException(String messageFormat, String messageKey, |
|
18 |
long code) { |
|
19 |
super(messageFormat, messageKey, code); |
|
20 |
} |
|
21 |
|
|
22 |
protected MetadataException(String messageFormat, Throwable cause, |
|
23 |
String messageKey, long code) { |
|
24 |
super(messageFormat, cause, messageKey, code); |
|
25 |
} |
|
26 |
|
|
27 |
public MetadataException(String messageFormat, Throwable cause) { |
|
28 |
super(messageFormat, cause, MESSAGE_KEY, serialVersionUID); |
|
29 |
} |
|
30 |
} |
|
0 | 31 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/exceptions/AddMetadataDefinitionException.java | ||
---|---|---|
1 |
package org.gvsig.metadata.exceptions; |
|
2 |
|
|
3 |
public class AddMetadataDefinitionException extends MetadataException { |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
*/ |
|
8 |
private static final long serialVersionUID = 564722264607592985L; |
|
9 |
|
|
10 |
public AddMetadataDefinitionException(Throwable cause, String name) { |
|
11 |
super("Can't add definition %(name) to metadata manager.", cause, |
|
12 |
"_Cant_add_definition_XnameX_to_metadata_manager", |
|
13 |
serialVersionUID); |
|
14 |
} |
|
15 |
|
|
16 |
protected AddMetadataDefinitionException(String message, String key, |
|
17 |
long code) { |
|
18 |
super(message, key, code); |
|
19 |
} |
|
20 |
|
|
21 |
} |
|
0 | 22 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/exceptions/DuplicateMetadataDefinitionException.java | ||
---|---|---|
1 |
package org.gvsig.metadata.exceptions; |
|
2 |
|
|
3 |
public class DuplicateMetadataDefinitionException extends |
|
4 |
AddMetadataDefinitionException { |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
*/ |
|
9 |
private static final long serialVersionUID = 1774035106179247051L; |
|
10 |
private final static String MESSAGE_FORMAT = "Duplicated name (%(name)s) in definition of metadata."; |
|
11 |
private final static String MESSAGE_KEY = "_DuplicateMetadataDefinitionException"; |
|
12 |
|
|
13 |
public DuplicateMetadataDefinitionException(String name) { |
|
14 |
super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID); |
|
15 |
this.setValue("name", name); |
|
16 |
} |
|
17 |
|
|
18 |
} |
|
0 | 19 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/exceptions/InvalidMetadataNamespaceException.java | ||
---|---|---|
1 |
package org.gvsig.metadata.exceptions; |
|
2 |
|
|
3 |
import org.gvsig.tools.dynobject.DynStruct; |
|
4 |
|
|
5 |
public class InvalidMetadataNamespaceException extends MetadataException { |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
*/ |
|
10 |
private static final long serialVersionUID = 7848869189284006672L; |
|
11 |
private final static String MESSAGE_FORMAT = "Invalid namespace '%(namespace)s' for class '%(names)s' in metadata context."; |
|
12 |
private final static String MESSAGE_KEY = "_InvalidMetadataNamespaceException"; |
|
13 |
|
|
14 |
public InvalidMetadataNamespaceException(String definitionName, |
|
15 |
String namespace) { |
|
16 |
super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID); |
|
17 |
this.setValue("name", definitionName); |
|
18 |
this.setValue("namespace", namespace); |
|
19 |
} |
|
20 |
|
|
21 |
public InvalidMetadataNamespaceException(DynStruct dynStruct) { |
|
22 |
super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID); |
|
23 |
this.setValue("name", dynStruct.getName()); |
|
24 |
this.setValue("namespace", dynStruct.getNamespace()); |
|
25 |
} |
|
26 |
|
|
27 |
} |
|
0 | 28 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/exceptions/MetadataRuntimeException.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.metadata.exceptions; |
|
32 |
|
|
33 |
import org.gvsig.tools.exception.BaseException; |
|
34 |
import org.gvsig.tools.exception.BaseRuntimeException; |
|
35 |
|
|
36 |
/** |
|
37 |
* @author jjdelcerro |
|
38 |
* |
|
39 |
*/ |
|
40 |
public class MetadataRuntimeException extends BaseRuntimeException { |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
*/ |
|
45 |
private static final long serialVersionUID = -1059880619868712491L; |
|
46 |
|
|
47 |
public MetadataRuntimeException(BaseException exception) { |
|
48 |
super(exception); |
|
49 |
} |
|
50 |
|
|
51 |
protected MetadataRuntimeException(String message, String key, long code) { |
|
52 |
// Don't make public this method. |
|
53 |
super(message, key, code); |
|
54 |
} |
|
55 |
|
|
56 |
protected MetadataRuntimeException(String message, Throwable cause, |
|
57 |
String key, long code) { |
|
58 |
// Don't make public this method. |
|
59 |
super(message, cause, key, code); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
0 | 63 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/MetadataContainer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
/* |
|
23 |
* AUTHORS (In addition to CIT): |
|
24 |
* 2010 Geographic Information research group: http://www.geoinfo.uji.es |
|
25 |
* Departamento de Lenguajes y Sistemas Informaticos (LSI) |
|
26 |
* Universitat Jaume I |
|
27 |
*/ |
|
28 |
package org.gvsig.metadata; |
|
29 |
|
|
30 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
31 |
|
|
32 |
/** |
|
33 |
* This is a utility interface to implement classes that implement the interface |
|
34 |
* Metadata. |
|
35 |
* |
|
36 |
* Use the createMetadataContainer in the MetadataManager to create a container |
|
37 |
* for delegate the implementation of Metadata methods in it. |
|
38 |
* |
|
39 |
* @author gvSIG Team |
|
40 |
* @author jjdelcerro |
|
41 |
* |
|
42 |
* @version $Id$ |
|
43 |
* |
|
44 |
*/ |
|
45 |
public interface MetadataContainer extends DelegatedDynObject { |
|
46 |
|
|
47 |
} |
|
0 | 48 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/src/main/java/org/gvsig/metadata/MetadataLocator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Geographic Information research group: http://www.geoinfo.uji.es |
|
26 |
* Departamento de Lenguajes y Sistemas Inform?ticos (LSI) |
|
27 |
* Universitat Jaume I |
|
28 |
*/ |
|
29 |
|
|
30 |
package org.gvsig.metadata; |
|
31 |
|
|
32 |
import org.gvsig.tools.locator.BaseLocator; |
|
33 |
import org.gvsig.tools.locator.LocatorException; |
|
34 |
|
|
35 |
/** |
|
36 |
* |
|
37 |
* Locator that provides the Metadata manager instance. |
|
38 |
* |
|
39 |
* @author gvSIG Team |
|
40 |
* @author <a href="mailto:reinhold@uji.es">cmartin</a> |
|
41 |
* @version $Id$ |
|
42 |
* |
|
43 |
*/ |
|
44 |
public class MetadataLocator extends BaseLocator { |
Also available in: Unified diff