Revision 42062

View differences:

tags/org.gvsig.desktop-2.0.89/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.89</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

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import org.gvsig.metadata.Metadata;
27
import org.gvsig.metadata.MetadataContainer;
28
import org.gvsig.metadata.MetadataManager;
29
import org.gvsig.tools.dynobject.DynClass;
30
import org.gvsig.tools.dynobject.DynStruct;
31

  
32
public class BasicMetadataManager extends AbstractMetadataManager implements
33
		MetadataManager {
34

  
35

  
36
	protected Metadata createMetadata(DynStruct definition) {
37
		return new DefaultMetadata(definition);
38
	}
39

  
40
	protected MetadataContainer createMetadataContainer(DynClass dynClass) {
41
		return new BasicMetadataContainer(dynClass);
42
	}
43
}
0 44

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import java.io.File;
27
import java.io.IOException;
28
import java.io.InputStream;
29
import java.util.ArrayList;
30
import java.util.HashMap;
31
import java.util.Iterator;
32
import java.util.Map;
33

  
34
import org.slf4j.Logger;
35
import org.slf4j.LoggerFactory;
36
import org.xmlpull.v1.XmlPullParserException;
37

  
38
import org.gvsig.metadata.Metadata;
39
import org.gvsig.metadata.MetadataContainer;
40
import org.gvsig.metadata.MetadataManager;
41
import org.gvsig.metadata.exceptions.AddMetadataDefinitionException;
42
import org.gvsig.metadata.exceptions.DuplicateMetadataDefinitionException;
43
import org.gvsig.metadata.exceptions.InvalidMetadataNamespaceException;
44
import org.gvsig.metadata.exceptions.MetadataException;
45
import org.gvsig.tools.ToolsLocator;
46
import org.gvsig.tools.dynobject.DynClass;
47
import org.gvsig.tools.dynobject.DynObjectManager;
48
import org.gvsig.tools.dynobject.DynStruct;
49
import org.gvsig.tools.dynobject.impl.DefaultDynClassName;
50
import org.gvsig.tools.persistence.impl.exception.CantFindDefinitionInStreamException;
51

  
52

  
53
/**
54
 * Abstract metadata manager used in both metadata basic and full modules.
55
 */
56
public abstract class AbstractMetadataManager implements MetadataManager {
57

  
58
	private final Logger LOG = LoggerFactory
59
			.getLogger(AbstractMetadataManager.class);
60

  
61
	private Map metadataItems;
62

  
63
	protected DynObjectManager dynManager;
64

  
65
	protected File metadataHomeFile = null;
66

  
67
	private boolean doSavingValidation;
68

  
69
	private boolean doExportingValidation;
70

  
71
	public AbstractMetadataManager() {
72
		dynManager = ToolsLocator.getDynObjectManager();
73
	}
74

  
75
	protected void initDefinitions() {
76
		this.metadataItems = new HashMap();
77
		Iterator definitionsIter = ToolsLocator.getDynObjectManager().iterator(
78
				MetadataManager.METADATA_NAMESPACE);
79
		DynStruct definition;
80
		while (definitionsIter.hasNext()) {
81
			definition = (DynStruct) definitionsIter.next();
82
			if (!this.getMetadataItems().containsKey(definition)) {
83
				Metadata metadata = createMetadata(definition);
84
				this.getMetadataItems().put(definition, metadata);
85
			}
86
		}
87
	}
88

  
89
	public DynStruct addDefinition(String name, String description)
90
			throws MetadataException {
91

  
92
		DynClass definition = dynManager.createDynClass(METADATA_NAMESPACE,
93
				name, description);
94

  
95
		addDefinition(definition);
96
		return definition;
97
	}
98

  
99
	public DynStruct addDefinition(String metadataDefinitionName,
100
			InputStream stream, ClassLoader loader) throws MetadataException {
101
		Map x;
102
		try {
103
			x = dynManager.importDynClassDefinitions(stream, loader,
104
					METADATA_NAMESPACE);
105
		} catch (XmlPullParserException e) {
106
			throw new AddMetadataDefinitionException(e, metadataDefinitionName);
107
		} catch (IOException e) {
108
			throw new AddMetadataDefinitionException(e, metadataDefinitionName);
109
		}
110
		DynClass definition = (DynClass) x.get(metadataDefinitionName);
111
		if (definition == null) {
112
			throw new CantFindDefinitionInStreamException(
113
					metadataDefinitionName, getKeys(x));
114
		}
115
		addDefinition(definition);
116
		return definition;
117
	}
118

  
119
	private String getKeys(Map theMap) {
120
		return new ArrayList(theMap.keySet()).toString();
121
	}
122

  
123
	public DynStruct getDefinition(Metadata metadata) throws MetadataException {
124
		return dynManager.get(METADATA_NAMESPACE, metadata.getMetadataName());
125
	}
126

  
127
	public DynStruct getDefinition(String metadataName) {
128
		if (metadataName == null)
129
			return null;
130
		if (metadataName.contains(":")) {
131
			int index = metadataName.lastIndexOf(":");
132
			return dynManager.get(metadataName.substring(0, index),
133
					metadataName.substring(index + 1, metadataName.length()));
134
		}
135
		return dynManager.get(METADATA_NAMESPACE, metadataName);
136
	}
137

  
138
	public void addDefinition(DynClass definition) throws MetadataException {
139
		if (definition == null) {
140
			return;
141
		}
142
		if ((definition.getNamespace() == null)
143
				|| (definition.getNamespace().equals(""))) {
144
			definition.setNamespace(METADATA_NAMESPACE);
145
		}
146

  
147
		if (!METADATA_NAMESPACE.equalsIgnoreCase(definition.getNamespace())) {
148
			throw new InvalidMetadataNamespaceException(definition.getName(),
149
					definition.getNamespace());
150
		}
151
		if (dynManager.get(definition.getNamespace(), definition.getName()) != null) {
152
			throw new DuplicateMetadataDefinitionException(definition.getName());
153
		}
154
		dynManager.add(definition);
155

  
156
		LOG.trace("Registered metadata definition {}.",
157
				definition.getFullName());
158

  
159
	}
160

  
161
	public void removeDefinition(DynStruct dynStruct) {
162
		if (dynStruct == null)
163
			return;
164
		this.metadataItems.remove(dynStruct);
165
		dynManager.remove(dynStruct);
166
	}
167

  
168
	public MetadataContainer createMetadataContainer(String name) {
169
		DynClass dynClass = dynManager.get(METADATA_NAMESPACE, name);
170
		if (dynClass == null) {
171
			throw new IllegalArgumentException(
172
					"Can't locate class '"
173
							+ new DefaultDynClassName(METADATA_NAMESPACE, name)
174
									.getFullName() + "'.");
175
		}
176

  
177
		return createMetadataContainer(dynClass);
178
		// return new BasicMetadataContainer(dynClass);
179
	}
180

  
181
	protected abstract MetadataContainer createMetadataContainer(
182
			DynClass dynClass);
183

  
184
	public void storeMetadata(Metadata metadata) throws MetadataException {
185
		// In SimpleMetadataManager do nothing
186
	}
187

  
188
	public void loadMetadata(Metadata metadata) throws MetadataException {
189
		// In SimpleMetadataManager do nothing
190
	}
191

  
192
	private Map getMetadataItems() {
193
		if (this.metadataItems == null) {
194
			initDefinitions();
195
		}
196
		return this.metadataItems;
197
	}
198

  
199
	public Metadata getMetadata(DynStruct definition)
200
			throws InvalidMetadataNamespaceException {
201
		if (this.getMetadataItems().containsKey(definition)) {
202
			return (Metadata) this.getMetadataItems().get(definition);
203
		}
204

  
205
		if (definition == null) {
206
			return null;
207
		}
208

  
209
		if ((definition.getNamespace() == null)
210
				|| (!definition.getNamespace().equals(METADATA_NAMESPACE))) {
211
			throw new InvalidMetadataNamespaceException(definition);
212
		}
213

  
214
		Metadata metadata = createMetadata(definition);
215

  
216
		this.getMetadataItems().put(definition, metadata);
217

  
218
		LOG.trace("Registered metadata definition {}.",
219
				definition.getFullName());
220

  
221
		return metadata;
222
	}
223

  
224
	protected abstract Metadata createMetadata(DynStruct definition);
225

  
226
	public File getMetadataHomeRepository() {
227
		if (this.metadataHomeFile == null) {
228
			String path = System.getProperty("user.home");
229
			path += File.separator + ".org.gvsig.metadata";
230
			this.metadataHomeFile = new File(path);
231
		}
232
		if (!this.metadataHomeFile.exists()) {
233
			this.metadataHomeFile.mkdirs();
234
		}
235
		return this.metadataHomeFile;
236
	}
237

  
238
	public File getRepositoryFile(String relativePath) {
239
		if ((relativePath == null) || (relativePath.equals("")))
240
			return this.metadataHomeFile;
241
		return new File(getMetadataHomeRepository().toString() + File.separator
242
				+ relativePath);
243
	}
244

  
245
	public void storeDefinitions() {
246
		Iterator it = ToolsLocator.getDynObjectManager().iterator(
247
				METADATA_NAMESPACE);
248
	}
249

  
250
	public Iterator getDefinitions() {
251
		// initDefinitions();
252
		return getMetadataItems().values().iterator();
253
	}
254

  
255
	public void setMetadataHomeRepository(File metadataHomeFile) {
256
		if (metadataHomeFile == null) {
257
			return;
258
		}
259

  
260
		this.metadataHomeFile = metadataHomeFile;
261
		if (!this.metadataHomeFile.exists())
262
			this.metadataHomeFile.mkdirs();
263
	}
264

  
265
	public Metadata getMetadata(String metadataID)
266
			throws InvalidMetadataNamespaceException {
267
		return this.getMetadata(getDefinition(metadataID));
268
	}
269

  
270
	public void setValidationBeforeSaving(boolean doValidation) {
271
		this.doSavingValidation = doValidation;
272
	}
273

  
274
	public boolean getValidationBeforeSaving() {
275
		return this.doSavingValidation;
276
	}
277

  
278
	public void setValidationBeforeExporting(boolean doValidation) {
279
		this.doExportingValidation = doValidation;
280
	}
281

  
282
	public boolean getValidationBeforeExporting() {
283
		return this.doExportingValidation;
284
	}
285
}
0 286

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import org.gvsig.metadata.exceptions.AddMetadataDefinitionException;
27

  
28
public class CantFindDefinitionInStreamException extends AddMetadataDefinitionException {
29

  
30
	/**
31
	 * 
32
	 */
33
	private static final long serialVersionUID = 450922621905049558L;
34

  
35
	public CantFindDefinitionInStreamException(String name) {
36
		super(
37
			"Can't find metadata definition %(name) in stream.", 
38
			"_cant_find_metadata_definition_XnameX_in_stream", 
39
			serialVersionUID
40
		);
41
		setValue("name",name);
42
	}
43

  
44
	public CantFindDefinitionInStreamException(String name, String found) {
45
		super(
46
				"Can't find metadata definition %(name) in stream, found %(found).", 
47
				"_cant_find_metadata_definition_XnameX_in_stream_found_XfoundX", 
48
				serialVersionUID
49
			);
50
		setValue("name",name);
51
		setValue("found",found);
52
	}
53
}
0 54

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import java.util.HashSet;
27
import java.util.Set;
28

  
29
import org.gvsig.metadata.Metadata;
30
import org.gvsig.metadata.exceptions.MetadataException;
31
import org.gvsig.tools.dynobject.DynStruct;
32
import org.gvsig.tools.dynobject.impl.DefaultDynObject;
33

  
34
/**
35
 * Abstract metadata used in both metadata basic and full modules.
36
 */
37
public abstract class AbstractMetadata extends DefaultDynObject implements
38
		Metadata, Comparable {
39

  
40
	public AbstractMetadata(DynStruct dynClass) {
41
		super(dynClass);
42
	}
43

  
44
	public Set getMetadataChildren() throws MetadataException {
45
		Set children = new HashSet();
46
		DynStruct[] items = this.getDynClass().getSuperDynStructs();
47
		if (items == null)
48
			return children;
49

  
50
		Object item;
51
		for (int i = 0; i < items.length; i++) {
52
			item = items[i];
53
			if (item instanceof Metadata) {
54
				children.add(item);
55
			}
56
		}
57
		return children;
58
	}
59

  
60
	public Object getMetadataID() throws MetadataException {
61
		return this.getDynClass().getFullName();
62
	}
63

  
64
	public String getMetadataName() throws MetadataException {
65
		return this.getDynClass().getName();
66
	}
67

  
68

  
69
	public int compareTo(Object object) {
70
		if (object == null) {
71
			return 0;
72
		}
73
		if (object instanceof Metadata) {
74
			return this
75
					.getDynClass()
76
					.getFullName()
77
					.toLowerCase()
78
					.compareTo(
79
							((Metadata) object).getDynClass().getFullName()
80
									.toLowerCase());
81
		}
82
		if (object instanceof DynStruct) {
83
			return this
84
					.getDynClass()
85
					.getFullName()
86
					.toLowerCase()
87
					.compareTo(((DynStruct) object).getFullName().toLowerCase());
88
		}
89
		return 0;
90
	}
91

  
92
	public String toString() {
93
		String name = this.getDynClass().getName();
94
		return name.substring(0, 1).toUpperCase() + name.substring(1);
95
	}
96

  
97
	public String toDynObjectString() {
98
		return super.toString();
99
	}
100
}
0 101

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import org.gvsig.metadata.MetadataContainer;
27
import org.gvsig.tools.dynobject.DynStruct;
28
import org.gvsig.tools.dynobject.impl.DefaultDynObject;
29

  
30
public class BasicMetadataContainer extends DefaultDynObject implements MetadataContainer {
31

  
32
	public BasicMetadataContainer(DynStruct dynClass) {
33
		super(dynClass);
34
	}
35

  
36
}
0 37

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import org.gvsig.metadata.Metadata;
27
import org.gvsig.tools.dynobject.DynStruct;
28

  
29
/**
30
 * Default metadata implementation of the basic implementation module.
31
 */
32
public class DefaultMetadata extends AbstractMetadata implements Metadata {
33

  
34
	public DefaultMetadata(DynStruct dynClass) {
35
		super(dynClass);
36
	}
37

  
38
}
0 39

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.lib.basic.impl;
25

  
26
import java.util.Locale;
27

  
28
import org.gvsig.metadata.MetadataLibrary;
29
import org.gvsig.metadata.MetadataLocator;
30
import org.gvsig.metadata.MetadataManager;
31
import org.gvsig.tools.ToolsLibrary;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.i18n.I18nManager;
34
import org.gvsig.tools.library.AbstractLibrary;
35
import org.gvsig.tools.library.LibraryException;
36

  
37
public class BasicMetadataLibrary extends AbstractLibrary {
38

  
39
	public void doRegistration() {
40
		super.doRegistration();
41
		require(ToolsLibrary.class);
42
		registerAsImplementationOf(MetadataLibrary.class);
43
	}
44

  
45
	protected void doInitialize() throws LibraryException {
46
        MetadataLocator.registerMetadataManager(BasicMetadataManager.class);
47
        I18nManager i18nManager = ToolsLocator.getI18nManager();
48

  
49
        i18nManager.addResourceFamily("org.gvsig.metadata.basic.impl.i18n.text",
50
				BasicMetadataLibrary.class.getClassLoader(),
51
				BasicMetadataLibrary.class.getClass().getName());
52
	}
53

  
54
	protected void doPostInitialize() throws LibraryException {
55
		MetadataManager metadataManager = MetadataLocator.getMetadataManager();
56
		if (!(metadataManager instanceof MetadataManager)) {
57
			throw new LibraryException(BasicMetadataManager.class, null);
58
		}
59
	}
60
	
61
}
0 62

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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

  
tags/org.gvsig.desktop-2.0.89/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.89</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

  
tags/org.gvsig.desktop-2.0.89/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/MetadataManager.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata;
25

  
26
import java.io.File;
27
import java.io.InputStream;
28
import java.util.Iterator;
29

  
30
import org.gvsig.metadata.exceptions.InvalidMetadataNamespaceException;
31
import org.gvsig.metadata.exceptions.MetadataException;
32
import org.gvsig.tools.dynobject.DynClass;
33
import org.gvsig.tools.dynobject.DynStruct;
34

  
35
/**
36
 * Manages the load and storage of Metadata objects.
37
 * 
38
 * @author gvSIG Team
39
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
40
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
41
 * 
42
 * @version $Id$
43
 * 
44
 */
45
public interface MetadataManager {
46

  
47
	public final static String METADATA_NAMESPACE = "metadata";
48

  
49
	/**
50
	 * Adds a new definition in the metadata manager.
51
	 * 
52
	 * The new definition is defined in the namespace by default for DynClasses
53
	 * used for metadata.
54
	 * 
55
	 * @param name
56
	 *            the definition Name
57
	 * @param description
58
	 *            the definition Description
59
	 * @return the created DynStruct definition
60
	 * 
61
	 * @throws MetadataException
62
	 */
63
	public DynStruct addDefinition(String name, String description)
64
			throws MetadataException;
65

  
66
	/**
67
	 * Adds a new definition in the metadata manager.
68
	 * 
69
	 * The new definition is defined in the namespace by default for DynClasses
70
	 * used for metadata.
71
	 * 
72
	 * @param dynClass
73
	 *            the new definition
74
	 * 
75
	 * @return the DynStruct definition
76
	 * 
77
	 * @throws MetadataException
78
	 */
79
	public void addDefinition(DynClass definition) throws MetadataException;
80

  
81
	/**
82
	 * Adds a new definition in the metadata manager.
83
	 * 
84
	 * The new definition is defined in the namespace by default for DynClasses
85
	 * used for metadata.
86
	 * 
87
	 * @param name
88
	 *            the definition Name
89
	 * @param stream
90
	 *            the input stream to be parsed.
91
	 * @param loader
92
	 *            the Class loader that can parse this input stream
93
	 * @return the created DynStruct definition
94
	 * 
95
	 * @throws MetadataException
96
	 */
97
	public DynStruct addDefinition(String name, InputStream stream,
98
			ClassLoader loader) throws MetadataException;
99

  
100
	/**
101
	 * <p>
102
	 * If a Metadata definition ( {@link DynStruct} ) with the given definition
103
	 * name has been previously registered in this manager, then this method
104
	 * returns that definition. Otherwise, it returns null.
105
	 * </p>
106
	 * 
107
	 * @param definitionName
108
	 *            the name whose corresponding attribute definition is to be
109
	 *            retrieved.
110
	 * 
111
	 * @return The attribute definition corresponding to the provided metadata
112
	 *         class, or null otherwise.
113
	 */
114
	public DynStruct getDefinition(String definitionName);
115

  
116
	/**
117
	 * <p>
118
	 * Retrieves all the current definitions in the form of an Iterator
119
	 * interface.
120
	 * </p>
121
	 * 
122
	 * @return The Metadata iterator containing the current metadata definitions
123
	 */
124
	public Iterator getDefinitions();
125

  
126
	/**
127
	 * <p>
128
	 * If a Metadata definition ( {@link DynStruct} ) with a given metadata that
129
	 * has been previously registered in this manager, then this method returns
130
	 * that definition. Otherwise, it returns null.
131
	 * </p>
132
	 * 
133
	 * @param metadata
134
	 *            the given metadata.
135
	 * 
136
	 * @return The attribute definition corresponding to the provided metadata
137
	 *         class, or null otherwise.
138
	 */
139
	public DynStruct getDefinition(Metadata metadata) throws MetadataException;
140

  
141
	/**
142
	 * 
143
	 * If the current dynStruct has been previously registered, it is removed
144
	 * from both the dynObjectManager and the metadataManager lists. Otherwise,
145
	 * does nothing.
146
	 * 
147
	 * @param dynStruct
148
	 *            the dynStruct to be removed.
149
	 */
150
	public void removeDefinition(DynStruct dynStruct);
151

  
152
	/**
153
	 * Creates a default {@link Metadata} instance based on a given
154
	 * {@link DynStruct}, if it has not been previously registered, and adds
155
	 * this Metadata to the system.
156
	 * 
157
	 * @param dynStruct
158
	 *            the given dynStruct object.
159
	 * @return the resultant Metadata object.
160
	 * @throws InvalidMetadataNamespaceException
161
	 */
162
	public Metadata getMetadata(DynStruct dynStruct)
163
			throws InvalidMetadataNamespaceException;
164

  
165
	/**
166
	 * This function populates the given Metadata object with the current values
167
	 * that the system contains. If there is any invalid access to an undeclared
168
	 * field, for example, a MetadataException will be thrown.
169
	 * 
170
	 * @param metadata
171
	 *            the metadata that needs to be populated.
172
	 * 
173
	 * @throws MetadataException
174
	 *             Exception caused by any access violation.
175
	 */
176
	public void loadMetadata(Metadata metadata) throws MetadataException;
177

  
178
	/**
179
	 * This function stores the given Metadata object to an output resource, be
180
	 * it a database or a file containing its information.
181
	 * 
182
	 * @param metadata
183
	 *            the metadata that needs to be stored.
184
	 * 
185
	 * @throws MetadataException
186
	 *             Exception caused by any access violation.
187
	 */
188
	public void storeMetadata(Metadata metadata) throws MetadataException;
189

  
190
	/**
191
	 * This is a utility interface to implement classes that implement the
192
	 * interface Metadata.
193
	 * 
194
	 * Use the createMetadataContainer in the MetadataManager to create a
195
	 * container for delegate the implementation of Metadata methods in it.
196
	 * 
197
	 * @param name
198
	 *            the DynStruct name.
199
	 * 
200
	 * @return the metadata container.
201
	 */
202
	public MetadataContainer createMetadataContainer(String name);
203

  
204
	/**
205
	 * Returns the main Metadata extension root repository.
206
	 * 
207
	 * @return the File object containing the home repository folder
208
	 * 
209
	 */
210
	public File getMetadataHomeRepository();
211

  
212
	/**
213
	 * Sets the main Metadata root repository for this manager.
214
	 * 
215
	 * @param metadataHomeRepository
216
	 *            the main Repository folder.
217
	 */
218
	public void setMetadataHomeRepository(File metadataHomeRepository);
219

  
220
	/**
221
	 * Retrieves a metadata object based on its metadata ID. This metadata
222
	 * object is basically a dynObject if metadata namespace set to "metadata".
223
	 * 
224
	 * @param metadataID
225
	 *            the metadata ID of the metadata object.
226
	 * @return
227
	 * @throws InvalidMetadataNamespaceException
228
	 *             if the metadataID was not previously registered as Metadata.
229
	 */
230
	public Metadata getMetadata(String metadataID)
231
			throws InvalidMetadataNamespaceException;
232

  
233
	/**
234
	 * Added options properties setter for validating before the saving
235
	 * function. If it is set to false, the validation will not be performed.
236
	 * @param doValidation
237
	 *		if the validation must be performed or not before saving metadata objects.
238
	 */
239
	public void setValidationBeforeSaving(boolean doValidation);
240

  
241
	/**
242
	 * Added options properties getter for validating before the saving
243
	 * function. If it is set to false, the validation will not be performed.
244
	 * @return
245
	 *            if the validation must be performed or not before saving metadata objects.
246
	 */
247
	public boolean getValidationBeforeSaving();
248

  
249
	/**
250
	 * Added options properties setter for validating before the exporting
251
	 * function. If it is set to false, the validation will not be performed.
252
	 * @param doValidation
253
	 *		if the validation must be performed or not before saving metadata objects.
254
	 */
255
	public void setValidationBeforeExporting(boolean doValidation);
256

  
257
	/**
258
	 * Added options properties getter for validating before the exporting
259
	 * function. If it is set to false, the validation will not be performed.
260
	 * @return
261
	 *            if the validation must be performed or not before saving metadata objects.
262
	 */
263
	public boolean getValidationBeforeExporting();
264
}
0 265

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata;
25

  
26
import java.util.Set;
27

  
28
import org.gvsig.metadata.exceptions.MetadataException;
29
import org.gvsig.tools.dynobject.DynObject;
30

  
31
/**
32
 * Metadata is information or data about data {@link http
33
 * ://en.wikipedia.org/wiki/Metadata}.
34
 * <p>
35
 * This interface extends DynObject to add anything needed over the DynObject
36
 * model to be able to be used as a Metadata model.
37
 * </p>
38
 * 
39
 * @author gvSIG Team
40
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
41
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
42
 * @version $Id$
43
 * 
44
 */
45
public interface Metadata extends DynObject {
46

  
47
	/**
48
	 * Returns the unique identifier of the Metadata.
49
	 * 
50
	 * @return the Metadata identifier
51
	 */
52
	public Object getMetadataID() throws MetadataException;
53

  
54
	/**
55
	 * Returns the name of the Metadata, which allows to identify the type in
56
	 * the Metadata registry.
57
	 * 
58
	 * @return the Metadata name
59
	 */
60
	public String getMetadataName() throws MetadataException;
61

  
62
	/**
63
	 * Returns an unsorted set of child Metadata objects.
64
	 * 
65
	 * @return an unsorted set of child Metadata objects
66
	 */
67
	public Set getMetadataChildren() throws MetadataException;
68

  
69
}
0 70

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.exceptions;
25

  
26
public class AddMetadataDefinitionException extends MetadataException {
27

  
28
	/**
29
	 * 
30
	 */
31
	private static final long serialVersionUID = 564722264607592985L;
32

  
33
	public AddMetadataDefinitionException(Throwable cause, String name) {
34
		super("Can't add definition %(name) to metadata manager.", cause,
35
				"_Cant_add_definition_XnameX_to_metadata_manager",
36
				serialVersionUID);
37
	}
38

  
39
	protected AddMetadataDefinitionException(String message, String key,
40
			long code) {
41
		super(message, key, code);
42
	}
43

  
44
}
0 45

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.exceptions;
25

  
26
public class DuplicateMetadataDefinitionException extends
27
		AddMetadataDefinitionException {
28

  
29
	/**
30
	 * 
31
	 */
32
	private static final long serialVersionUID = 1774035106179247051L;
33
	private final static String MESSAGE_FORMAT = "Duplicated name (%(name)s) in definition of metadata.";
34
	private final static String MESSAGE_KEY = "_DuplicateMetadataDefinitionException";
35

  
36
	public DuplicateMetadataDefinitionException(String name) {
37
		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
38
		this.setValue("name", name);
39
	}
40

  
41
}
0 42

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.exceptions;
25

  
26
import org.gvsig.tools.dynobject.DynStruct;
27

  
28
public class InvalidMetadataNamespaceException extends MetadataException {
29

  
30
	/**
31
	 * 
32
	 */
33
	private static final long serialVersionUID = 7848869189284006672L;
34
	private final static String MESSAGE_FORMAT = "Invalid namespace '%(namespace)s' for class '%(names)s' in metadata context.";
35
	private final static String MESSAGE_KEY = "_InvalidMetadataNamespaceException";
36

  
37
	public InvalidMetadataNamespaceException(String definitionName,
38
			String namespace) {
39
		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
40
		this.setValue("name", definitionName);
41
		this.setValue("namespace", namespace);
42
	}
43

  
44
	public InvalidMetadataNamespaceException(DynStruct dynStruct) {
45
		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
46
		this.setValue("name", dynStruct.getName());
47
		this.setValue("namespace", dynStruct.getNamespace());
48
	}
49

  
50
}
0 51

  
tags/org.gvsig.desktop-2.0.89/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
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.metadata.exceptions;
25

  
26
import org.gvsig.tools.exception.BaseException;
27
import org.gvsig.tools.exception.BaseRuntimeException;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff