Revision 30619 branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/persistence/PersistenceManager.java

View differences:

PersistenceManager.java
53 53
	 *         Persistent Object.
54 54
	 * @throws PersistenceException
55 55
	 * @throws PersistenceValidateExceptions
56
	 * @throws PersistenceTypeNotSupportedException TODO
56
	 * @throws PersistenceTypeNotSupportedException
57
	 * @throws PersistenceClassNotRegistered
57 58
	 */
58 59
	public PersistentState getState(Object obj)
59
			throws PersistenceException, PersistenceValidateExceptions, PersistenceTypeNotSupportedException;
60
			throws PersistenceException,
61
			PersistenceValidateExceptions,
62
			PersistenceTypeNotSupportedException, PersistenceClassNotRegistered;
60 63

  
61 64
	/**
62 65
	 * <p>
......
78 81
			throws PersistenceException, PersistenceCreateException;
79 82

  
80 83
	/**
81
	 * <p>Associates an alias with a class. This is similar to a symbolic link, which allows
82
	 * to access the class by means of its alias.</p>
84
	 * <p>
85
	 * Associates an alias with a class. This is similar to a symbolic link,
86
	 * which allows to access the class by means of its alias.
87
	 * </p>
83 88
	 *
84
	 * <p>When an alias is defined, it replaces any
85
	 * class whose qualified name is equal to the alias. Therefore, this class will never
86
	 * be instantiated, and instead the class pointed by the the alias will be instantiated.</p>
89
	 * <p>
90
	 * When an alias is defined, it replaces any class whose qualified name is
91
	 * equal to the alias. Therefore, this class will never be instantiated, and
92
	 * instead the class pointed by the the alias will be instantiated.
93
	 * </p>
87 94
	 *
88
	 * <p>For example, if the following alias is defined:</p>
95
	 * <p>
96
	 * For example, if the following alias is defined:
97
	 * </p>
89 98
	 *
90
	 * <pre>Class aClass = org.gvsig.fmap.mapcontext.rendering.symbols.SimpleMarkerSymbol.class;
91
	 * manager.addAlias("org.gvsig.fmap.mapcontext.rendering.symbols.ArrowMarkerSymbol", aClass);
99
	 * <pre>
100
	 * Class aClass = org.gvsig.fmap.mapcontext.rendering.symbols.SimpleMarkerSymbol.class;
101
	 * manager
102
	 * 		.addAlias(
103
	 * 				&quot;org.gvsig.fmap.mapcontext.rendering.symbols.ArrowMarkerSymbol&quot;,
104
	 * 				aClass);
92 105
	 * </pre>
93
	 * <p>then, SimpleMarkerSymbol will be instantiated instead of ArrowMarkerSymbol from any
94
	 * PersistentState which references ArrowMarkerSymbol.</p>
106
	 * <p>
107
	 * then, SimpleMarkerSymbol will be instantiated instead of
108
	 * ArrowMarkerSymbol from any PersistentState which references
109
	 * ArrowMarkerSymbol.
110
	 * </p>
95 111
	 *
96
	 * <p>Aliases are useful to provided backward-compatibility paths (as old unexisting classes
97
	 * may be aliased to substitution classes), but are also useful to avoid limitations on
98
	 * ClassLoaders. As a Class object is provided, it will be possible to instantiate it even
99
	 * if the current ClassLoader has no direct visibility of the class to instantiate.</p>
112
	 * <p>
113
	 * Aliases are useful to provided backward-compatibility paths (as old no
114
	 * existing classes may be aliased to substitution classes), but are also
115
	 * useful to avoid limitations on ClassLoaders. As a Class object is
116
	 * provided, it will be possible to instantiate it even if the current
117
	 * ClassLoader has no direct visibility of the class to instantiate.
118
	 * </p>
100 119
	 *
101
	 * @param alias The alias to reference a class
102
	 * @param aClass The class to be referenced by the alias
120
	 * @param alias
121
	 *            The alias to reference a class
122
	 * @param aClass
123
	 *            The class to be referenced by the alias
124
	 *
125
	 * @throws PersistenceClassNotRegistered
126
	 *             if <code>aClass</code> is not registered
103 127
	 */
104
	public void addAlias(String alias, Class aClass);
128
	public void addAlias(String alias, Class aClass)
129
			throws PersistenceClassNotRegistered;
105 130

  
106 131
	/**
107 132
	 * <p>
......
125 150
	/**
126 151
	 * <p>
127 152
	 * Register a class that implements {@link Persistent} for use in the
128
	 * manager with definition to validate it and a namespace identification.
153
	 * manager with definition to validate it and a domainName identification.
154
	 * The domainURL will be the previously set, if it's not set will the gvSIG
155
	 * standard domainURL.
129 156
	 * </p>
130 157
	 *
131 158
	 * @param persistentClass
......
140 167
	 * @see #create(PersistentState)
141 168
	 */
142 169
	public void registerClass(Class persistentClass, DynStruct definition,
143
			String namespace);
170
			String domainName);
144 171

  
145 172
	/**
146 173
	 * <p>
147 174
	 * Register a class that implements {@link Persistent} for use in the
175
	 * manager with definition to validate it and a domainName identification
176
	 * and the domainURL.
177
	 * </p>
178
	 *
179
	 *<p>
180
	 * <b>Note:</b> A <code>domainName</code> can by in only one
181
	 *<code>domainURL</code>. If you try to register the same
182
	 * <code>domainName</code> with two URL an exception will be raised.
183
	 *</p>
184
	 *
185
	 * @param persistentClass
186
	 *            The class to register
187
	 * @param definition
188
	 *            The definition of the attributes allowed for the
189
	 *            persistentClass
190
	 *
191
	 * @see #validateAll(PersistentState, int)
192
	 * @see #validateAll(PersistentState)
193
	 * @see #registerClass(Class)
194
	 * @see #create(PersistentState)
195
	 */
196
	public void registerClass(Class persistentClass, DynStruct definition,
197
			String domainName, String domainURL);
198

  
199
	/**
200
	 * <p>
201
	 * Register a class that implements {@link Persistent} for use in the
148 202
	 * manager.
149 203
	 * </p>
150 204
	 *
......
171 225
	 *
172 226
	 * @param persistentClass
173 227
	 *
174
	 * @see #registerClass(Class)
228
	 * @see #registerClass(Class, DynStruct, String)
229
	 *
230
	 * @throws PersistenceClassNotRegistered
231
	 *             if <code>persistentClass</code> is not registered
175 232
	 */
176
	public void unregisterClass(Class persistentClass);
233
	public void unregisterClass(Class persistentClass)
234
			throws PersistenceClassNotRegistered;
177 235

  
178 236
	/**
179 237
	 * <p>
......
183 241
	 * @param persistentClass
184 242
	 *
185 243
	 * @see #registerClass(Class)
244
	 *
245
	 * @throws PersistenceClassNotRegistered
246
	 *             if <code>className</code> is not registered
186 247
	 */
187
	public void unregisterClass(String className);
248
	public void unregisterClass(String className)
249
			throws PersistenceClassNotRegistered;
188 250

  
189 251
	/**
190 252
	 * <p>

Also available in: Unified diff