Class XMLSessionConfigLoader
java.lang.Object
org.eclipse.persistence.sessions.factories.XMLSessionConfigLoader
Provide a mechanism for loading Session configuration XML files.
This is used by the SessionManager to define how to find and load a Session from a sessions XML file.
The sessions XML file is typically deployed in the applications jar (ejb-jar) and named sessions.xml in the /META-INF directory.
Several loading options are provided,
- resourceName : The resource path and file name to the sessions XML file, default is /sessions.xml or /META-INF/sessions.xml. (ensure "/" is used, not "\"). A file path can also be provided, although a resource is typically used.
- shouldLogin : Define if the loaded session should be connected, default true.
- shouldRefresh : Define if the loaded session should be refreshed from the file, (this old session will be disconnected) default false.
- classLoader : Define the class loader that should be used to find the resource. This loader will also be used as the loaded session's class loader. This should be the application's class loader. Default is the ConversionManager loader, which is thread-based.
- shouldCheckClassLoader : Defines if the session will be refreshed from the file if the class loader requesting the load, is different than the loaded session's class loader. This can be used to handle re-deployment.
- Author:
- Guy Pelletier
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassINTERNAL: -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassLoaderDefine the class loader that should be used to find the resource.protected static final Stringprotected static final Stringstatic final Stringprotected org.eclipse.persistence.internal.sessions.factories.PersistenceEntityResolverUsed to store the entity resolver to validate the XML schema when parsing.Stores any exceptions that occurred to provide all the exceptions up front if the load fails.protected static final ProjectCache the creation and initialization of the Session XML mapping project.protected Stringprotected StringStores the resource path to provide a better error message if the load fails.protected StringStores the name of the Session in the sessions XML file desired to be loaded.protected booleanDefines if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader.protected booleanDefine if the loaded session should be connected, default true.protected booleanDefine if the loaded session should be refreshed from the file. -
Constructor Summary
ConstructorsConstructorDescriptionPUBLIC: This constructor is used when the file resource named 'sessions.xml' will be parsed for configuration.XMLSessionConfigLoader(String resourceName) PUBLIC: This constructor is used when passing in the resource name of the configuration file that should be parsed -
Method Summary
Modifier and TypeMethodDescriptionPUBLIC: Return the class loader that should be used to find the resource.INTERNAL:protected static ProjectCache the creation and initialization of the Session XML mapping project.PUBLIC: Returns the resource name we are trying to load.INTERNAL: Will return the the resource name with full path of the resource file.PUBLIC: Returns the name of the Session in the sessions XML file desired to be loaded.booleanload(SessionManager sessionManager, ClassLoader loader) INTERNAL: This method instantiates the parser and builds the document based on the schema.org.eclipse.persistence.internal.sessions.factories.model.SessionConfigsINTERNAL: This method is to be used to load config objects for the Mapping Workbench only.org.eclipse.persistence.internal.sessions.factories.model.SessionConfigsloadConfigsForMappingWorkbench(ClassLoader loader, boolean validate) INTERNAL: This method is to be used to load config objects for the Mapping Workbench only.protected DocumentloadDocument(ClassLoader loader) INTERNAL: Load a session.xml document.protected DocumentloadDocument(ClassLoader loader, boolean validate) INTERNAL: Load a session.xml document.voidsetClassLoader(ClassLoader classLoader) PUBLIC: Set the class loader that should be used to find the resource.voidsetResourceName(String resourceName) PUBLIC: Set the resource name we are trying to load.voidsetSessionName(String sessionName) PUBLIC: Set the name of the Session in the sessions XML file desired to be loaded.voidsetShouldCheckClassLoader(boolean shouldCheckClassLoader) PUBLIC: Set if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader.voidsetShouldLogin(boolean shouldLogin) PUBLIC: Set if the loaded session should be connected.voidsetShouldRefresh(boolean shouldRefresh) PUBLIC: Set if the loaded session should be refreshed from the file.booleanPUBLIC: Return if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader.booleanPUBLIC: Return if the loaded session should be connected.booleanPUBLIC: Return if the loaded session should be refreshed from the file.
-
Field Details
-
resourceName
-
resourcePath
Stores the resource path to provide a better error message if the load fails. -
sessionName
Stores the name of the Session in the sessions XML file desired to be loaded. -
shouldLogin
protected boolean shouldLoginDefine if the loaded session should be connected, default true. -
shouldRefresh
protected boolean shouldRefreshDefine if the loaded session should be refreshed from the file. -
classLoader
Define the class loader that should be used to find the resource. -
shouldCheckClassLoader
protected boolean shouldCheckClassLoaderDefines if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader. -
exceptionStore
Stores any exceptions that occurred to provide all the exceptions up front if the load fails. -
entityResolver
protected org.eclipse.persistence.internal.sessions.factories.PersistenceEntityResolver entityResolverUsed to store the entity resolver to validate the XML schema when parsing. -
ECLIPSELINK_SESSIONS_SCHEMA
- See Also:
-
DEFAULT_RESOURCE_NAME
- See Also:
-
DEFAULT_RESOURCE_NAME_IN_META_INF
- See Also:
-
project
Cache the creation and initialization of the Session XML mapping project.
-
-
Constructor Details
-
XMLSessionConfigLoader
public XMLSessionConfigLoader()PUBLIC: This constructor is used when the file resource named 'sessions.xml' will be parsed for configuration. -
XMLSessionConfigLoader
PUBLIC: This constructor is used when passing in the resource name of the configuration file that should be parsed
-
-
Method Details
-
getProject
Cache the creation and initialization of the Session XML mapping project. -
getResourcePath
INTERNAL: Will return the the resource name with full path of the resource file. -
getExceptionStore
INTERNAL: -
getResourceName
PUBLIC: Returns the resource name we are trying to load. -
setResourceName
PUBLIC: Set the resource name we are trying to load. -
getSessionName
PUBLIC: Returns the name of the Session in the sessions XML file desired to be loaded. -
setSessionName
PUBLIC: Set the name of the Session in the sessions XML file desired to be loaded. -
shouldLogin
public boolean shouldLogin()PUBLIC: Return if the loaded session should be connected. -
setShouldLogin
public void setShouldLogin(boolean shouldLogin) PUBLIC: Set if the loaded session should be connected. -
shouldRefresh
public boolean shouldRefresh()PUBLIC: Return if the loaded session should be refreshed from the file. -
setShouldRefresh
public void setShouldRefresh(boolean shouldRefresh) PUBLIC: Set if the loaded session should be refreshed from the file. -
shouldCheckClassLoader
public boolean shouldCheckClassLoader()PUBLIC: Return if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader. -
setShouldCheckClassLoader
public void setShouldCheckClassLoader(boolean shouldCheckClassLoader) PUBLIC: Set if the session will be refreshed from the file if the class loader requesting the load is different than the loaded session's class loader. -
getClassLoader
PUBLIC: Return the class loader that should be used to find the resource. -
setClassLoader
PUBLIC: Set the class loader that should be used to find the resource. -
load
INTERNAL: This method instantiates the parser and builds the document based on the schema. If the document is loaded without errors, then the configs are converted to sessions and stored on the session manager and true is returned to indicate success. -
loadConfigsForMappingWorkbench
public org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs loadConfigsForMappingWorkbench(ClassLoader loader) INTERNAL: This method is to be used to load config objects for the Mapping Workbench only. Do not call this method. -
loadConfigsForMappingWorkbench
public org.eclipse.persistence.internal.sessions.factories.model.SessionConfigs loadConfigsForMappingWorkbench(ClassLoader loader, boolean validate) INTERNAL: This method is to be used to load config objects for the Mapping Workbench only. Do not call this method. -
loadDocument
INTERNAL: Load a session.xml document. The error handler will capture all the errors and allow for a document to be returned. -
loadDocument
INTERNAL: Load a session.xml document. The error handler will capture all the errors and allow for a document to be returned.
-