public class DefaultModelContext extends ModelContext
ModelContext
implementation.ModelContextFactory
ModelContext.Listener
Modifier and Type | Field and Description |
---|---|
static String |
PLATFORM_PROVIDER_LOCATION_ATTRIBUTE_NAME
Constant for the name of the model context attribute backing property
platformProviderLocation . |
static String |
PROVIDER_LOCATION_ATTRIBUTE_NAME
Constant for the name of the model context attribute backing property
providerLocation . |
Constructor and Description |
---|
DefaultModelContext()
Creates a new
DefaultModelContext instance. |
DefaultModelContext(ClassLoader classLoader)
Creates a new
DefaultModelContext instance taking a class loader. |
Modifier and Type | Method and Description |
---|---|
javax.xml.bind.JAXBContext |
createContext(String model)
Creates a new JAXB context instance of a given model.
|
javax.xml.bind.JAXBContext |
createContext(URI publicId)
Deprecated.
|
EntityResolver |
createEntityResolver(String model)
Creates a new SAX entity resolver instance of a given model.
|
EntityResolver |
createEntityResolver(URI publicId)
Deprecated.
|
javax.xml.bind.Marshaller |
createMarshaller(String model)
Creates a new JAXB marshaller instance of a given model.
|
javax.xml.bind.Marshaller |
createMarshaller(URI publicId)
Deprecated.
|
LSResourceResolver |
createResourceResolver(String model)
Creates a new L/S resource resolver instance of a given model.
|
LSResourceResolver |
createResourceResolver(URI publicId)
Deprecated.
|
Schema |
createSchema(String model)
Creates a new JAXP schema instance of a given model.
|
Schema |
createSchema(URI publicId)
Deprecated.
|
<T> T |
createServiceObject(Service service,
Class<T> type)
Deprecated.
As of JOMC 1.9, please use method
createServiceObjects(java.lang.String, java.lang.String, java.lang.Class) .
This method will be removed in JOMC 2.0. |
<T> Collection<? extends T> |
createServiceObjects(String model,
String service,
Class<T> type)
Creates service objects of a model.
|
javax.xml.bind.Unmarshaller |
createUnmarshaller(String model)
Creates a new JAXB unmarshaller instance of a given model.
|
javax.xml.bind.Unmarshaller |
createUnmarshaller(URI publicId)
Deprecated.
|
Model |
findModel(Model model)
Populates a given
Model instance. |
Model |
findModel(String model)
Creates a new
Model instance. |
Modlets |
findModlets()
Deprecated.
As of JOMC 1.6, replaced by
findModlets(org.jomc.modlet.Modlets) . This method will be
removed in JOMC 2.0. |
Modlets |
findModlets(Modlets modlets)
Searches the context for
Modlets . |
static String |
getDefaultPlatformProviderLocation()
Gets the default location searched for platform provider resources.
|
static String |
getDefaultProviderLocation()
Gets the default location searched for provider resources.
|
String |
getPlatformProviderLocation()
Gets the location searched for platform provider resources.
|
String |
getProviderLocation()
Gets the location searched for provider resources.
|
Model |
processModel(Model model)
Processes a
Model . |
Modlets |
processModlets(Modlets modlets)
Processes a list of
Modlet s. |
static void |
setDefaultPlatformProviderLocation(String value)
Sets the default location searched for platform provider resources.
|
static void |
setDefaultProviderLocation(String value)
Sets the default location searched for provider resources.
|
void |
setPlatformProviderLocation(String value)
Sets the location searched for platform provider resources.
|
void |
setProviderLocation(String value)
Sets the location searched for provider resources.
|
ModelValidationReport |
validateModel(Model model)
Validates a given
Model . |
ModelValidationReport |
validateModel(String model,
Source source)
Validates a given model.
|
ModelValidationReport |
validateModlets(Modlets modlets)
Validates a list of
Modlet s. |
clearAttribute, createModelContext, findClass, findResource, findResources, getAttribute, getAttribute, getAttributeNames, getClassLoader, getDefaultLogLevel, getDefaultModletSchemaSystemId, getExecutorService, getListeners, getLogLevel, getModelContextClassName, getModlets, getModletSchemaSystemId, isLoggable, log, setAttribute, setDefaultLogLevel, setDefaultModletSchemaSystemId, setExecutorService, setLogLevel, setModelContextClassName, setModlets, setModletSchemaSystemId
public static final String PROVIDER_LOCATION_ATTRIBUTE_NAME
providerLocation
.getProviderLocation()
,
ModelContext.getAttribute(java.lang.String)
,
Constant Field Valuespublic static final String PLATFORM_PROVIDER_LOCATION_ATTRIBUTE_NAME
platformProviderLocation
.getPlatformProviderLocation()
,
ModelContext.getAttribute(java.lang.String)
,
Constant Field Valuespublic DefaultModelContext()
DefaultModelContext
instance.public DefaultModelContext(ClassLoader classLoader)
DefaultModelContext
instance taking a class loader.classLoader
- The class loader of the context.public static String getDefaultProviderLocation()
The default provider location is controlled by system property
org.jomc.modlet.DefaultModelContext.defaultProviderLocation
holding the location to search
for provider resources by default. If that property is not set, the META-INF/services
default is
returned.
setDefaultProviderLocation(java.lang.String)
public static void setDefaultProviderLocation(String value)
value
- The new default location to search for provider resources or null
.getDefaultProviderLocation()
public final String getProviderLocation()
getDefaultProviderLocation()
,
setProviderLocation(java.lang.String)
,
PROVIDER_LOCATION_ATTRIBUTE_NAME
public final void setProviderLocation(String value)
value
- The new location to search for provider resources or null
.getProviderLocation()
public static String getDefaultPlatformProviderLocation()
The default platform provider location is controlled by system property
org.jomc.modlet.DefaultModelContext.defaultPlatformProviderLocation
holding the location to
search for platform provider resources by default. If that property is not set, the
<java-home>/lib/jomc.properties
default is returned.
setDefaultPlatformProviderLocation(java.lang.String)
public static void setDefaultPlatformProviderLocation(String value)
value
- The new default location to search for platform provider resources or null
.getDefaultPlatformProviderLocation()
public final String getPlatformProviderLocation()
getDefaultPlatformProviderLocation()
,
setPlatformProviderLocation(java.lang.String)
,
PLATFORM_PROVIDER_LOCATION_ATTRIBUTE_NAME
public final void setPlatformProviderLocation(String value)
value
- The new location to search for platform provider resources or null
.getPlatformProviderLocation()
@Deprecated public Modlets findModlets() throws ModelException
findModlets(org.jomc.modlet.Modlets)
. This method will be
removed in JOMC 2.0.Modlets
.
This method loads ModletProvider
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ModletProvider
resources to return a list of Modlets
.
findModlets
in class ModelContext
Modlets
found in the context or null
.ModelException
- if searching Modlets
fails.getProviderLocation()
,
getPlatformProviderLocation()
,
ModletProvider.findModlets(org.jomc.modlet.ModelContext, org.jomc.modlet.Modlets)
public Modlets findModlets(Modlets modlets) throws ModelException
Modlets
.
This method loads ModletProvider
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ModletProvider
resources to return a list of Modlets
.
findModlets
in class ModelContext
modlets
- The Modlets
currently being searched.Modlets
found in the context or null
.ModelException
- if searching Modlets
fails.getProviderLocation()
,
getPlatformProviderLocation()
,
ModletProvider.findModlets(org.jomc.modlet.ModelContext, org.jomc.modlet.Modlets)
public Modlets processModlets(Modlets modlets) throws ModelException
Modlet
s.
This method loads ModletProcessor
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ModletProcessor
resources to process a list of Modlets
.
processModlets
in class ModelContext
modlets
- The Modlets
currently being processed.Modlets
or null
.ModelException
- if processing Modlets
fails.getProviderLocation()
,
getPlatformProviderLocation()
,
ModletProcessor.processModlets(org.jomc.modlet.ModelContext, org.jomc.modlet.Modlets)
public ModelValidationReport validateModlets(Modlets modlets) throws ModelException
Modlet
s.
This method loads ModletValidator
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ModletValidator
resources to validate a list of Modlets
.
validateModlets
in class ModelContext
modlets
- The Modlets
to validate.ModelException
- if validating modlets
fails.getProviderLocation()
,
getPlatformProviderLocation()
,
ModletValidator.validateModlets(org.jomc.modlet.ModelContext, org.jomc.modlet.Modlets)
public Model findModel(String model) throws ModelException
Model
instance.
This method creates all ModelProvider
service objects of the model identified by model
to create
a new Model
instance.
findModel
in class ModelContext
model
- The identifier of the Model
to create.Model
identified by model
.ModelException
- if creating a new Model
instance fails.findModel(org.jomc.modlet.Model)
,
createServiceObjects( model, ModelProvider.class.getName(), ModelProvider.class )
,
ModelProvider.findModel(org.jomc.modlet.ModelContext, org.jomc.modlet.Model)
public Model findModel(Model model) throws ModelException
Model
instance.
This method creates all ModelProvider
service objects of the given model to populate the given model
instance.
findModel
in class ModelContext
model
- The Model
to populate.ModelException
- if populating model
fails.createServiceObjects( model, ModelProvider.class.getName(), ModelProvider.class )
,
ModelProvider.findModel(org.jomc.modlet.ModelContext, org.jomc.modlet.Model)
public Model processModel(Model model) throws ModelException
Model
.
This method creates all ModelProcessor
service objects of model
to process the given
Model
.
processModel
in class ModelContext
model
- The Model
to process.Model
.ModelException
- if processing model
fails.createServiceObjects( model, ModelProcessor.class.getName(), ModelProcessor.class )
,
ModelProcessor.processModel(org.jomc.modlet.ModelContext, org.jomc.modlet.Model)
public ModelValidationReport validateModel(Model model) throws ModelException
Model
.
This method creates all ModelValidator
service objects of model
to validate the given
Model
.
validateModel
in class ModelContext
model
- The Model
to validate.ModelException
- if validating model
fails.createServiceObjects( model, ModelValidator.class.getName(), ModelValidator.class )
,
ModelValidator.validateModel(org.jomc.modlet.ModelContext, org.jomc.modlet.Model)
public ModelValidationReport validateModel(String model, Source source) throws ModelException
validateModel
in class ModelContext
model
- The identifier of the Model
to use for validating source
.source
- A source providing the model to validate.ModelException
- if validating the model fails.createSchema(java.lang.String)
public EntityResolver createEntityResolver(String model) throws ModelException
ModelContext
createEntityResolver
in class ModelContext
model
- The identifier of the model to create a new SAX entity resolver of.model
.ModelException
- if creating a new SAX entity resolver instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public EntityResolver createEntityResolver(URI publicId) throws ModelException
ModelContext
createEntityResolver
in class ModelContext
publicId
- The public identifier URI to create a new SAX entity resolver for.publicId
.ModelException
- if creating a new SAX entity resolver instance fails.ModletObject.PUBLIC_ID
public LSResourceResolver createResourceResolver(String model) throws ModelException
ModelContext
createResourceResolver
in class ModelContext
model
- The identifier of the model to create a new L/S resource resolver of.model
.ModelException
- if creating a new L/S resource resolver instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public LSResourceResolver createResourceResolver(URI publicId) throws ModelException
ModelContext
createResourceResolver
in class ModelContext
publicId
- The public identifier URI to create a new L/S resource resolver for.publicId
.ModelException
- if creating a new L/S resource resolver instance fails.ModletObject.PUBLIC_ID
public Schema createSchema(String model) throws ModelException
ModelContext
createSchema
in class ModelContext
model
- The identifier of the model to create a new JAXP schema instance of.model
.ModelException
- if creating a new JAXP schema instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public Schema createSchema(URI publicId) throws ModelException
ModelContext
createSchema
in class ModelContext
publicId
- The public identifier URI to create a new JAXP schema instance for.publicId
.ModelException
- if creating a new JAXP schema instance fails.ModletObject.PUBLIC_ID
public javax.xml.bind.JAXBContext createContext(String model) throws ModelException
ModelContext
createContext
in class ModelContext
model
- The identifier of the model to create a new JAXB context instance of.model
.ModelException
- if creating a new JAXB context instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public javax.xml.bind.JAXBContext createContext(URI publicId) throws ModelException
ModelContext
createContext
in class ModelContext
publicId
- The public identifier URI to create a new JAXB context instance for.publicId
.ModelException
- if creating a new JAXB context instance fails.ModletObject.PUBLIC_ID
public javax.xml.bind.Marshaller createMarshaller(String model) throws ModelException
ModelContext
createMarshaller
in class ModelContext
model
- The identifier of the model to create a new JAXB marshaller instance of.model
.ModelException
- if creating a new JAXB marshaller instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public javax.xml.bind.Marshaller createMarshaller(URI publicId) throws ModelException
ModelContext
createMarshaller
in class ModelContext
publicId
- The public identifier URI to create a new JAXB marshaller instance for.publicId
.ModelException
- if creating a new JAXB marshaller instance fails.ModletObject.PUBLIC_ID
public javax.xml.bind.Unmarshaller createUnmarshaller(String model) throws ModelException
ModelContext
createUnmarshaller
in class ModelContext
model
- The identifier of the model to create a new JAXB unmarshaller instance of.model
.ModelException
- if creating a new JAXB unmarshaller instance fails.ModletObject.MODEL_PUBLIC_ID
@Deprecated public javax.xml.bind.Unmarshaller createUnmarshaller(URI publicId) throws ModelException
ModelContext
createUnmarshaller
in class ModelContext
publicId
- The public identifier URI to create a new JAXB unmarshaller instance for.publicId
.ModelException
- if creating a new JAXB unmarshaller instance fails.ModletObject.PUBLIC_ID
@Deprecated public <T> T createServiceObject(Service service, Class<T> type) throws ModelException
createServiceObjects(java.lang.String, java.lang.String, java.lang.Class)
.
This method will be removed in JOMC 2.0.
This method loads ServiceFactory
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ServiceFactory
resources to create a new service object.
createServiceObject
in class ModelContext
T
- The type of the service.service
- The service to create a new object of.type
- The class of the type of the service.service
.ModelException
- if creating the service object fails.getProviderLocation()
,
getPlatformProviderLocation()
,
ServiceFactory.createServiceObject(org.jomc.modlet.ModelContext, org.jomc.modlet.Service, java.lang.Class)
public <T> Collection<? extends T> createServiceObjects(String model, String service, Class<T> type) throws ModelException
This method loads ServiceFactory
classes setup via the platform provider configuration file and
<provider-location>/org.jomc.modlet.ServiceFactory
resources to create new service objects.
createServiceObjects
in class ModelContext
T
- The type of the service.model
- The identifier of the Model
to create service objects of.service
- The identifier of the service to create objects of.type
- The class of the type of the service.service
of the model
identified by model
.ModelException
- if creating service objects fails.ModelProvider
,
ModelProcessor
,
ModelValidator
Copyright © 2005–2016 The JOMC Project. All rights reserved.