|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.jomc.model.DefaultModelManager
public class DefaultModelManager
Default ModelManager implementation.
Classpath support
getClassLoader()setClassLoader(java.lang.ClassLoader)getDefaultDocumentLocation()getClasspathModule(org.jomc.model.Modules)getClasspathModules(java.lang.String)getDefaultStylesheetLocation()getClasspathTransformers(java.lang.String)Logging
Model bootstrapping
getBootstrapContext()getBootstrapDocumentLocation()getBootstrapMarshaller(boolean, boolean)getBootstrapObjectFactory()getBootstrapSchema()getBootstrapUnmarshaller(boolean)validateBootstrapObject(javax.xml.bind.JAXBElement)transformBootstrapObject(javax.xml.bind.JAXBElement, javax.xml.transform.Transformer)
| Nested Class Summary | |
|---|---|
static interface |
DefaultModelManager.Listener
Listener interface. |
| Field Summary | |
|---|---|
private static String |
BOOTSTRAP_CONTEXT
JAXB context of the bootstrap schema. |
private static String |
BOOTSTRAP_SCHEMA_LOCATION
Classpath location of the bootstrap schema. |
private ObjectFactory |
bootstrapObjectFactory
Bootstrap object factory of the instance. |
private Schema |
bootstrapSchema
The bootstrap schema. |
private ClassLoader |
classLoader
Class loader of the instance. |
private JAXBContext |
context
The context of the instance. |
private static String |
DEFAULT_BOOTSTRAP_DOCUMENT_LOCATION
Classpath location searched for bootstrap documents by default. |
private static String |
DEFAULT_CLASSPATH_MODULE_NAME
Constant for the name of the classpath module. |
private static String |
DEFAULT_DOCUMENT_LOCATION
Classpath location searched for documents by default. |
private static String |
DEFAULT_STYLESHEET_LOCATION
Classpath location searched for style sheets by default. |
private EntityResolver |
entityResolver
The entity resolver of the instance. |
private List<DefaultModelManager.Listener> |
listeners
The listeners of the instance. |
private static Class[] |
NO_CLASSES
Empty Class array. |
private static Object[] |
NO_OBJECTS
Empty Object array. |
private ObjectFactory |
objectFactory
Object factory of the instance. |
private Map |
objects
Maps objects to Instances. |
private LSResourceResolver |
resourceResolver
The L/S resolver of the instance. |
private Schema |
schema
The schema of the instance. |
private static String[] |
SCHEMA_EXTENSIONS
Supported schema name extensions. |
private Set<URL> |
schemaResources
URLs of all available classpath schema resources. |
private Schemas |
schemas
Schemas of the instance. |
| Constructor Summary | |
|---|---|
DefaultModelManager()
Creates a new DefaultModelManager instance. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String DEFAULT_CLASSPATH_MODULE_NAME
getClasspathModuleName(),
Constant Field Valuesprivate static final String DEFAULT_DOCUMENT_LOCATION
getDefaultDocumentLocation(),
Constant Field Valuesprivate static final String DEFAULT_STYLESHEET_LOCATION
getDefaultStylesheetLocation(),
Constant Field Valuesprivate static final String BOOTSTRAP_SCHEMA_LOCATION
private static final String DEFAULT_BOOTSTRAP_DOCUMENT_LOCATION
getBootstrapDocumentLocation(),
Constant Field Valuesprivate static final String BOOTSTRAP_CONTEXT
private static final String[] SCHEMA_EXTENSIONS
private static final Class[] NO_CLASSES
Class array.
private static final Object[] NO_OBJECTS
Object array.
private ClassLoader classLoader
private EntityResolver entityResolver
private LSResourceResolver resourceResolver
private JAXBContext context
private Schema schema
private Schema bootstrapSchema
private Set<URL> schemaResources
private Schemas schemas
private ObjectFactory objectFactory
private ObjectFactory bootstrapObjectFactory
private List<DefaultModelManager.Listener> listeners
private final Map objects
Instances.
| Constructor Detail |
|---|
public DefaultModelManager()
DefaultModelManager instance.
| Method Detail |
|---|
public ObjectFactory getObjectFactory()
ModelManagerObjectFactory.
getObjectFactory in interface ModelManagerObjectFactory.public EntityResolver getEntityResolver()
ModelManager
getEntityResolver in interface ModelManagerpublic LSResourceResolver getLSResourceResolver()
ModelManager
getLSResourceResolver in interface ModelManager
public Schema getSchema()
throws IOException,
SAXException,
JAXBException
ModelManager
getSchema in interface ModelManagerIOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public JAXBContext getContext()
throws IOException,
SAXException,
JAXBException
ModelManagerJAXBContext.
getContext in interface ModelManagerJAXBContext.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public Marshaller getMarshaller(boolean validating,
boolean formattedOutput)
throws IOException,
SAXException,
JAXBException
ModelManagerMarshaller.
getMarshaller in interface ModelManagervalidating - true for a marshaller with additional schema validation support enabled; false
for a marshaller without additional schema validation support enabled.formattedOutput - true for the marshaller to produce formatted output; false for the
marshaller to not apply any formatting when marshalling.
Marshaller.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public Unmarshaller getUnmarshaller(boolean validating)
throws IOException,
SAXException,
JAXBException
ModelManagerUnmarshaller.
getUnmarshaller in interface ModelManagervalidating - true for an unmarshaller with additional schema validation support enabled;
false for an unmarshaller without additional schema validation support enabled.
Unmarshaller.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public void validateModelObject(JAXBElement<? extends ModelObject> modelObject)
throws ModelException,
IOException,
SAXException,
JAXBException
ModelManager
validateModelObject in interface ModelManagermodelObject - The object to validate.
ModelException - if modelObject is invalid.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public void validateModules(Modules modules)
throws ModelException,
IOException,
SAXException,
JAXBException
ModelManager
validateModules in interface ModelManagermodules - The modules to validate.
ModelException - if modules is invalid.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public <T extends ModelObject> T transformModelObject(JAXBElement<T> modelObject,
Transformer transformer)
throws IOException,
SAXException,
JAXBException,
TransformerException
ModelManagerModelObject with a given Transformer.
transformModelObject in interface ModelManagerT - The type of modelObject.modelObject - The ModelObject to transform.transformer - The Transformer to transform modelObject with.
modelObject transformed with transformer.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if binding fails.
TransformerException - if the transformation fails.
public Instance getInstance(Modules modules,
Implementation implementation,
ClassLoader cl)
ModelManager
getInstance in interface ModelManagermodules - The modules declaring the instance to get.implementation - The implementation to get an instance of.cl - The class loader of the instance to get.
implementation or null if no instance is available.
public Instance getInstance(Modules modules,
Implementation implementation,
Dependency dependency,
ClassLoader cl)
ModelManager
getInstance in interface ModelManagermodules - The modules declaring the instance to get.implementation - The implementation to get an instance of.dependency - The dependency declaring the instance to get.cl - The class loader of the instance to get.
implementation or null if no instance is available.
public Instance getInstance(Modules modules,
Object object)
ModelManager
getInstance in interface ModelManagermodules - The modules declaring the instance to get.object - The object to get the instance of.
object or null of nothing is known about object.
public Object getObject(Modules modules,
Specification specification,
Instance instance)
throws InstantiationException
ModelManager
getObject in interface ModelManagermodules - The modules declaring the object to get.specification - The specification specifying the object to get.instance - The instance of the object to get.
instance or null if nothing is known about instance.
InstantiationException - if instantiating the object fails.public ObjectFactory getBootstrapObjectFactory()
public JAXBContext getBootstrapContext()
throws JAXBException
JAXBException - if creating a new bootstrap context instance fails.
public Marshaller getBootstrapMarshaller(boolean validating,
boolean formattedOutput)
throws IOException,
SAXException,
JAXBException
Marshaller.
validating - true for a marshaller with additional schema validation support enabled; false
for a marshaller without additional schema validation support enabled.formattedOutput - true for the marshaller to produce formatted output; false for the
marshaller to not apply any formatting when marshalling.
Marshaller.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public Unmarshaller getBootstrapUnmarshaller(boolean validating)
throws IOException,
SAXException,
JAXBException
Unmarshaller.
validating - true for an unmarshaller with additional schema validation support enabled;
false for an unmarshaller without additional schema validation support enabled.
Unmarshaller.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public Schema getBootstrapSchema()
throws SAXException
SAXException - if parsing the bootstrap schema fails.
public void validateBootstrapObject(JAXBElement<? extends BootstrapObject> bootstrapObject)
throws ModelException,
IOException,
SAXException,
JAXBException
bootstrapObject - The object to validate.
NullPointerException - if bootstrapObject is null.
ModelException - if bootstrapObject is invalid.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.
public <T extends BootstrapObject> T transformBootstrapObject(JAXBElement<T> bootstrapObject,
Transformer transformer)
throws IOException,
SAXException,
JAXBException,
TransformerException
BootstrapObject with a given Transformer.
T - The type of bootstrapObject.bootstrapObject - The BootstrapObject to transform.transformer - The Transformer to transform bootstrapObject with.
bootstrapObject transformed with transformer.
NullPointerException - if bootstrapObject or transformer is null.
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if binding fails.
TransformerException - if the transformation fails.public void setObjectFactory(ObjectFactory value)
value - The new object factory of the instance or null.getObjectFactory()public void setEntityResolver(EntityResolver value)
value - The new entity resolver of the instance or null.getEntityResolver()public void setLSResourceResolver(LSResourceResolver value)
value - The new L/S resolver of the instance or null.getLSResourceResolver()public void setContext(JAXBContext value)
value - The new JAXB context of the instance or null.getContext()public void setSchema(Schema value)
value - The new schema of the instance or null.getSchema()public List<DefaultModelManager.Listener> getListeners()
log(java.util.logging.Level, java.lang.String, java.lang.Throwable)public String getBootstrapDocumentLocation()
The bootstrap document location is controlled by system property
org.jomc.model.DefaultModelManager.bootstrapDocumentLocation holding the location to search at. If that
property is not set, the META-INF/jomc-bootstrap.xml default is returned.
getSchemas()
public Schemas getSchemas()
throws IOException,
JAXBException,
SAXException
IOException - if reading schema resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.getBootstrapDocumentLocation()public String getDefaultDocumentLocation()
The default document location is controlled by system property
org.jomc.model.DefaultModelManager.defaultDocumentLocation holding the location to search at by default.
If that property is not set, the META-INF/jomc.xml default is returned.
getClasspathModules(java.lang.String)
public Modules getClasspathModules(String location)
throws IOException,
SAXException,
JAXBException
Note:
This method does not validate the modules.
location - The location to search at.
location.
NullPointerException - if location is null.
IOException - if reading resources fails.
SAXException - if parsing schema resources fails.
JAXBException - if unmarshalling schema resources fails.getDefaultDocumentLocation()public String getClasspathModuleName()
The classpath module name is controlled by system property
org.jomc.model.DefaultModelManager.classpathModuleName holding the classpath module name.
If that property is not set, the Java Classpath default is returned.
getClasspathModule(org.jomc.model.Modules)public Module getClasspathModule(Modules modules)
This method searches the given modules for unresolved references and tries to resolve each unresolved reference by inspecting the class loader of the instance.
modules - The modules to resolve by inspecting the class loader of the instance.
null if
nothing could be resolved.getClasspathModuleName()public String getDefaultStylesheetLocation()
The default style sheet location is controlled by system property
org.jomc.model.DefaultModelManager.defaultStylesheetLocation holding the location to search at by
default. If that property is not set, the META-INF/jomc.xslt default is returned.
getClasspathTransformers(java.lang.String)
public List<Transformer> getClasspathTransformers(String location)
throws IOException,
TransformerConfigurationException
location - The location to search at.
location.
NullPointerException - if location is null.
IOException - if reading resources fails.
TransformerConfigurationException - if getting the transformers fails.getDefaultStylesheetLocation()public ClassLoader getClassLoader()
setClassLoader(java.lang.ClassLoader)public void setClassLoader(ClassLoader value)
value - The new class loader of the instance.getClassLoader()
protected void log(Level level,
String message,
Throwable throwable)
level - The level of the event.message - The message of the event or null.throwable - The throwable of the event null.getListeners()
private void resolveClasspath(Modules modules,
Module cpModule)
modules - The modules to resolve.cpModule - The module for resolved references.
NullPointerException - if cpModule is null.
private void resolveClasspath(Modules modules,
SpecificationReference ref,
Module cpModule)
private void resolveClasspath(Modules modules,
Specifications references,
Module cpModule)
private void resolveClasspath(Modules modules,
Implementations implementations,
Module cpModule)
private void resolveClasspath(Modules modules,
Dependencies dependencies,
Module cpModule)
private void resolveClasspath(String identifier,
Module cpModule)
private void resolveClasspath(Specification specification,
Module cpModule)
private boolean checkFactoryMethod(Class clazz,
Class type,
String methodName)
private Method getFactoryMethod(Class clazz,
String methodName)
private Set<URL> getSchemaResources()
throws IOException
META-INF/MANIFEST.MF resources and gets a set containing URLs of entries whose
name end with a known schema extension.
IOException - if reading or parsing fails.
private Implementation getImplementation(Modules modules,
Object object)
modules - The modules to search for the implementation of object.object - The object to get the implementation for.
object or null, if nothing is known about object.
private Implementation collectImplementation(Modules modules,
Class clazz)
private void collectFinalSuperDependencies(Modules modules,
Implementation implementation,
String dependencyName,
Implementations implementations,
Implementations seen,
boolean includeImplementation)
private void collectFinalSuperMessages(Modules modules,
Implementation implementation,
String messageName,
Implementations implementations,
Implementations seen,
boolean includeImplementation)
private void collectFinalSuperProperties(Modules modules,
Implementation implementation,
String propertyName,
Implementations implementations,
Implementations seen,
boolean includeImplementation)
private void collectFinalSuperSpecifications(Modules modules,
Implementation implementation,
String specificationIdentifier,
Implementations implementations,
Implementations seen,
boolean includeImplementation)
private void collectFinalSuperImplementations(Modules modules,
Implementation implementation,
Implementations implementations,
Implementations seen,
boolean includeImplementation)
private Implementation findInheritanceCycle(Modules modules,
Implementation current,
Implementation report,
Implementations implementations)
private String getMessage(String key,
Object args)
private void assertImplementationMessagesUniqueness(Implementation implementation,
List<ModelException.Detail> details)
private void assertImplementationPropertiesUniqueness(Implementation implementation,
List<ModelException.Detail> details)
private ModelException.Detail newIncompatibleImplementationDetail(JAXBElement<? extends ModelObject> element,
String implementation,
String implementationModule,
String specification,
String specificationModule,
String implementedVersion,
String specifiedVersion)
private ModelException.Detail newIncompatibleDependencyDetail(JAXBElement<? extends ModelObject> element,
String implementation,
String implementationModule,
String specification,
String specificationModule,
String requiredVersion,
String availableVersion)
private ModelException.Detail newImplementationNameConstraintDetail(JAXBElement<? extends ModelObject> element,
Specification specification,
Implementation implementation)
private ModelException.Detail newMandatoryDependencyConstraintDetail(JAXBElement<? extends ModelObject> element,
String implementation,
String dependencyName)
private ModelException.Detail newMultiplicityConstraintDetail(JAXBElement<? extends ModelObject> element,
Specification specification,
Implementation implementation)
private ModelException.Detail newImplementationInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Implementation finalSuperImplementation)
private ModelException.Detail newSpecificationInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
SpecificationReference specification,
Implementation finalSuperSpecification)
private ModelException.Detail newDependencyInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Dependency dependency,
Implementation finalSuperDependency)
private ModelException.Detail newPropertyInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Property property,
Implementation finalSuperProperty)
private ModelException.Detail newPropertyInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
PropertyReference reference,
Implementation finalSuperProperty)
private ModelException.Detail newMessageInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Message message,
Implementation finalSuperMessage)
private ModelException.Detail newMessageInheritanceConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
MessageReference reference,
Implementation finalSuperMessage)
private ModelException.Detail newDependencyPropertyReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Dependency dependency,
PropertyReference reference)
private ModelException.Detail newDependencyPropertiesOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Dependency dependency,
Specification specification,
Property property)
private ModelException.Detail newImplementationSpecificationDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Specification specification)
private ModelException.Detail newModuleMessageReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
MessageReference reference)
private ModelException.Detail newModulePropertyReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
PropertyReference reference)
private ModelException.Detail newModuleImplementationReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
ImplementationReference reference)
private ModelException.Detail newImplementationImplementationDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Implementation declaration)
private ModelException.Detail newModuleSpecificationReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
SpecificationReference reference)
private ModelException.Detail newDependencyOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Dependency dependency)
private ModelException.Detail newMessageOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Message message)
private ModelException.Detail newMessageOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
MessageReference reference)
private ModelException.Detail newPropertyOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Property property)
private ModelException.Detail newPropertyOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
PropertyReference reference)
private ModelException.Detail newSpecificationOverrideConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
SpecificationReference reference)
private ModelException.Detail newAbstractLocationConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
String location)
private ModelException.Detail newFinalModuleMessageConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
Message message)
private ModelException.Detail newOverrideModuleMessageConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
Message message)
private ModelException.Detail newFinalModulePropertyConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
Property property)
private ModelException.Detail newOverrideModulePropertyConstraintDetail(JAXBElement<? extends ModelObject> element,
Module module,
Property property)
private ModelException.Detail newSpecificationPropertyReferenceDeclarationConstraintDetail(JAXBElement<? extends ModelObject> element,
Specification specification,
PropertyReference reference)
private ModelException.Detail newSpecificationMultipleInheritanceContraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
SpecificationReference reference)
private ModelException.Detail newDependencyMultipleInheritanceContraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Dependency dependency)
private ModelException.Detail newMessageMultipleInheritanceContraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Message message)
private ModelException.Detail newPropertyMultipleInheritanceContraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Property property)
private ModelException.Detail newImplementationInheritanceCycleConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Implementation cycle)
private ModelException.Detail newImplementationInheritanceCompatibilityConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Implementation superImplementation,
String expectedVersion)
private ModelException.Detail newSpecificationVersioningConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation implementation,
Specification specification)
private ModelException.Detail newImplementationVersioningConstraintDetail(JAXBElement<? extends ModelObject> element,
Implementation declaring,
Implementation implementation)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||