Revision 1624
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistenceManager.java | ||
---|---|---|
282 | 282 |
InputStream definitions, ClassLoader loader, String domainName, |
283 | 283 |
String domainUrl) throws AddDefinitionException; |
284 | 284 |
|
285 |
public void addDefinition(Class theClass, String name, String resourceName); |
|
286 |
|
|
287 |
public void addDefinition(Class theClass, String name, InputStream resource); |
|
288 |
|
|
285 | 289 |
/** |
286 | 290 |
* Add a new definition to the class in the persistent manager. |
287 | 291 |
* |
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/impl/AbstractPersistenceManager.java | ||
---|---|---|
512 | 512 |
public PersistentState loadState(InputStream in) throws PersistenceException { |
513 | 513 |
return this.loadState(in, this.getNewContext()); |
514 | 514 |
} |
515 |
|
|
516 |
public void addDefinition(Class theClass, String name, String resourceName) { |
|
517 |
if( this.getDefinition(name) == null ) { |
|
518 |
InputStream resource = theClass.getResourceAsStream(resourceName); |
|
519 |
if( resource == null ) { |
|
520 |
throw new IllegalArgumentException("Resource '" + resourceName + "' not found as a resource of '" + theClass.getName() + "'."); |
|
521 |
} |
|
522 |
this.addDefinition( |
|
523 |
theClass, |
|
524 |
name, |
|
525 |
resource, |
|
526 |
theClass.getClassLoader(), |
|
527 |
null, |
|
528 |
null |
|
529 |
); |
|
530 |
} |
|
531 |
} |
|
532 |
|
|
533 |
public void addDefinition(Class theClass, String name, InputStream resource) { |
|
534 |
if( this.getDefinition(name) == null ) { |
|
535 |
if( resource == null ) { |
|
536 |
throw new IllegalArgumentException("resource null not allowed."); |
|
537 |
} |
|
538 |
this.addDefinition( |
|
539 |
theClass, |
|
540 |
name, |
|
541 |
resource, |
|
542 |
theClass.getClassLoader(), |
|
543 |
null, |
|
544 |
null |
|
545 |
); |
|
546 |
} |
|
547 |
} |
|
548 |
|
|
549 |
|
|
515 | 550 |
} |
Also available in: Unified diff