Revision 43300

View differences:

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

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

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

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

  
tags/org.gvsig.desktop-2.0.187/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
tags/org.gvsig.desktop-2.0.187/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
/**
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 org.gvsig.tools.dynobject.DelegatedDynObject;
27

  
28
/**
29
 * This is a utility interface to implement classes that implement the interface
30
 * Metadata.
31
 * 
32
 * Use the createMetadataContainer in the MetadataManager to create a container
33
 * for delegate the implementation of Metadata methods in it.
34
 * 
35
 * @author gvSIG Team
36
 * @author jjdelcerro
37
 * 
38
 * @version $Id$
39
 * 
40
 */
41
public interface MetadataContainer extends DelegatedDynObject {
42

  
43
}
0 44

  
tags/org.gvsig.desktop-2.0.187/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
/**
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 org.gvsig.tools.locator.BaseLocator;
27
import org.gvsig.tools.locator.LocatorException;
28

  
29
/**
30
 * 
31
 * Locator that provides the Metadata manager instance.
32
 * 
33
 * @author gvSIG Team
34
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
35
 * @version $Id$
36
 * 
37
 */
38
public class MetadataLocator extends BaseLocator {
39

  
40
	public static final String METADATA_MANAGER_NAME = "org.gvsig.metadata.manager";
41

  
42
	private static final String METADATA_MANAGER_DESCRIPTION = "Implementation for MetadataManager";
43

  
44
	/**
45
	 * Unique instance.
46
	 */
47
	private static final MetadataLocator instance = new MetadataLocator();
48

  
49
	/**
50
	 * Return the singleton instance.
51
	 * 
52
	 * @return the singleton instance
53
	 */
54
	public static MetadataLocator getInstance() {
55
		return instance;
56
	}
57

  
58
	/**
59
	 * Return a reference to MetadataManager.
60
	 * 
61
	 * @return a reference to MetadataManager
62
	 * @throws org.gvsig.tools.locator.LocatorException
63
	 *             if there is no access to the class or the class cannot be
64
	 *             instantiated
65
	 * @see org.gvsig.tools.locator.Locator#get(String)
66
	 */
67
	public static MetadataManager getMetadataManager() throws LocatorException {
68
		return (MetadataManager) getInstance().get(METADATA_MANAGER_NAME);
69
	}
70

  
71
	/**
72
	 * Registers the Class implementing the MetadataManager interface.
73
	 * 
74
	 * @param clazz
75
	 *            implementing the MetadataManager interface
76
	 */
77
	public static void registerMetadataManager(Class clazz) {
78
		getInstance().register(METADATA_MANAGER_NAME,
79
				METADATA_MANAGER_DESCRIPTION, clazz);
80
	}
81

  
82
}
0 83

  
tags/org.gvsig.desktop-2.0.187/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/MetadataLibrary.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 org.gvsig.tools.ToolsLibrary;
27
import org.gvsig.tools.library.AbstractLibrary;
28
import org.gvsig.tools.library.LibraryException;
29
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
30

  
31
/**
32
 * Library that initalizes the Metadata module.
33
 * 
34
 * @author gvSIG Team
35
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
36
 * @version $Id$
37
 * 
38
 */
39
public class MetadataLibrary extends AbstractLibrary {
40

  
41
	public void doRegistration() {
42
		super.doRegistration();
43
		registerAsAPI(MetadataLibrary.class);
44
		require(ToolsLibrary.class);
45
	}
46

  
47
	protected void doInitialize() throws LibraryException {
48
	}
49

  
50
	protected void doPostInitialize() throws LibraryException {
51
		// Validate if there is any implementation registered.
52
		MetadataManager manager = MetadataLocator.getMetadataManager();
53

  
54
		if (manager == null) {
55
			throw new ReferenceNotRegisteredException(
56
					MetadataLocator.METADATA_MANAGER_NAME,
57
					MetadataLocator.getInstance());
58
		}
59
	}
60

  
61
}
0 62

  
tags/org.gvsig.desktop-2.0.187/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/DefinitionsMap.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.Iterator;
27
import java.util.List;
28
import java.util.Map;
29

  
30
import org.gvsig.tools.dispose.DisposableIterator;
31
import org.gvsig.tools.dynobject.DynField;
32
import org.gvsig.tools.dynobject.DynStruct;
33

  
34
/**
35
 * 
36
 * This is the intermediary of the ImportExport module, which enables to have a
37
 * disposable iterator of a list of DynStructs. It also permits to obtain
38
 * another disposable iterator of the related DynFields based on a given
39
 * DynStruct. It extends from a Map<String, DynStruct>.
40
 * 
41
 * 
42
 * @author gvSIG Team
43
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
44
 * @version $Id$
45
 * 
46
 */
47
public interface DefinitionsMap extends Map {
48

  
49

  
50
	/**
51
	 * Removes a definition from the list
52
	 * 
53
	 * @param definition
54
	 *            the definition to be removed.
55
	 */
56
	public void remove(DynStruct definition);
57

  
58
	/**
59
	 * Adds a definition to the list
60
	 * 
61
	 * @param definition
62
	 *            the definition to be added.
63
	 */
64
	public void add(DynStruct newDefinition);
65

  
66
	public void addAll(Map map);
67

  
68
	/**
69
	 * Determines if this definition is already included.
70
	 * 
71
	 * @param definition
72
	 *            the current definition to be checked.
73
	 * @return true if the definition is contained, false otherwise.
74
	 */
75
	public boolean hasDefinition(DynStruct definition);
76

  
77
	/**
78
	 * Saves the current Metadata elements of the list.
79
	 * 
80
	 */
81
	public void save();
82

  
83
	/**
84
	 * Retrieves the size of the list of elements.
85
	 */
86
	public int size();
87

  
88
	/**
89
	 * Sets the current user definitions linked to the current hierarchy
90
	 * definitions.
91
	 * 
92
	 * @param userDefs
93
	 *            the user Definitions
94
	 * @param hierarchyDefs
95
	 *            the hierarchy Definitions
96
	 */
97
	public void setHierarchyDefinitions(Map userDefs, Map hierarchyDefs);
98

  
99
	/**
100
	 * Returns a list containing definitions ( {@link DynStruct} ), which are
101
	 * disposable.
102
	 * 
103
	 * @return the disposable DynStructs iterator.
104
	 */
105
	public Iterator iterator();
106

  
107
	/**
108
	 * Returns a disposable list iteration containing {@link DynField}s based on
109
	 * a given definition ( {@link DynStruct} ).
110
	 * 
111
	 * @param definition
112
	 *            the DynStruct definition from which to obtain the associated
113
	 *            DynFields.
114
	 * @return the disposable DynFields iterator.
115
	 */
116
	public DisposableIterator dynFieldsIterator(DynStruct definition);
117

  
118
	/**
119
	 * Returns a list containing children definitions ({@link DynStruct}s) based
120
	 * on a given definition.
121
	 * 
122
	 * @param definition
123
	 *            the DynStruct definition from which to obtain the associated
124
	 *            children.
125
	 * @return the disposable DynFields iterator.
126
	 */
127
	public List getChildren(DynStruct definition);
128

  
129
	/**
130
	 * Returns a disposable list iteration containing the current elements of
131
	 * the list.
132
	 * 
133
	 * @return the disposable DynFields iterator.
134
	 */
135
	public DisposableIterator disposableIterator();
136

  
137
	/**
138
	 * Returns a list iteration containing the current parent element
139
	 * definitions of a given childDefinition.
140
	 * 
141
	 * @param childDefinition
142
	 * @return the parent definitions' iterator.
143
	 */
144
	public Iterator parentsIterator(DynStruct childDefinition);
145

  
146
	/**
147
	 * Returns a list iteration containing the current children element
148
	 * definitions of a given parentDefinition.
149
	 * 
150
	 * @return the parent definitions' iterator.
151
	 */
152
	public Iterator childrenIterator(DynStruct parentDefinition);
153

  
154
}
0 155

  
tags/org.gvsig.desktop-2.0.187/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.187/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.187/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
/**
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.ListBaseException;
27

  
28
public class MetadataException extends ListBaseException {
29
	/**
30
	 * 
31
	 */
32
	private static final long serialVersionUID = -2654368520999289207L;
33
	private final static String MESSAGE_FORMAT = "Error getting or setting the state of the object.";
34
	private final static String MESSAGE_KEY = "_MetadataException";
35

  
36
	public MetadataException(Throwable cause) {
37
		this(MESSAGE_FORMAT, cause);
38
	}
39

  
40
	protected MetadataException(String messageFormat, String messageKey,
41
			long code) {
42
		super(messageFormat, messageKey, code);
43
	}
44

  
45
	protected MetadataException(String messageFormat, Throwable cause,
46
			String messageKey, long code) {
47
		super(messageFormat, cause, messageKey, code);
48
	}
49

  
50
	public MetadataException(String messageFormat, Throwable cause) {
51
		super(messageFormat, cause, MESSAGE_KEY, serialVersionUID);
52
	}
53
}
0 54

  
tags/org.gvsig.desktop-2.0.187/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.187/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.187/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.187/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;
28

  
29
/**
30
 * @author jjdelcerro
31
 * 
32
 */
33
public class MetadataRuntimeException extends BaseRuntimeException {
34

  
35
	/**
36
	 * 
37
	 */
38
	private static final long serialVersionUID = -1059880619868712491L;
39

  
40
	public MetadataRuntimeException(BaseException exception) {
41
		super(exception);
42
	}
43

  
44
	protected MetadataRuntimeException(String message, String key, long code) {
45
		// Don't make public this method.
46
		super(message, key, code);
47
	}
48

  
49
	protected MetadataRuntimeException(String message, Throwable cause,
50
			String key, long code) {
51
		// Don't make public this method.
52
		super(message, cause, key, code);
53
	}
54

  
55
}
0 56

  
tags/org.gvsig.desktop-2.0.187/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/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.api.junit.AbstractMetadataTest">
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.187/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/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.187/org.gvsig.desktop.compat.cdc/org.gvsig.metadata.basic/org.gvsig.metadata.basic.lib/org.gvsig.metadata.lib.basic.api/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.187/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.187</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

  
tags/org.gvsig.desktop-2.0.187/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.187/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.187/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.187/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.187/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,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff