Class XRServiceFactory
- Direct Known Subclasses:
ProviderHelper
INTERNAL: helper class that knows how to build a XRServiceAdapter (a.k.a DBWS). An
XRService requires the following resources:
- metadata in the form of a descriptor file called
eclipselink-dbws.xml
- an XML Schema Definition (
.xsd) file calledeclipselink-dbws-schema.xsd - a TopLink
sessions.xmlfile calledeclipselink-dbws-sessions.xml
the naming convention for thesessions.xmlfiles can be overriden by the optional<sessions-file>entry in theeclipselink-dbws.xmldescriptor file. - EclipseLink metadata in the form of a EclipseLink
Project(either deployment XML or Java classes).A typical
XRServicerequires two projects: one to represent the O-R side, the other to represent the O-X side.
The O-R and O-XProjectsmetadata must have:
i) identical case-sensitiveProjectnames:<?xml version="1.0" encoding="UTF-8"?> <eclipselink:object-persistence version="Eclipse Persistence Services ..." xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eclipselink="http://xmlns.oracle.com/ias/xsds/eclipselink" > <eclipselink:name>example</eclipselink:name> or ... import org.eclipse.persistence.sessions.Project; public class SomeORProject extends Project { public SomeORProject () { setName("Example"); ... } public class SomeOXProject extends Project { public SomeOXProject () { setName("Example"); ... }ii) identical case-sensitive aliases forDescriptorsthat are common between the projects:<eclipselink:class-mapping-descriptor xsi:type="eclipselink:relational-class-mapping-descriptor"> <eclipselink:class>some.package.SomeClass</eclipselink:class> <eclipselink:alias>SomeAlias</eclipselink:alias> ... <eclipselink:class-mapping-descriptor xsi:type="eclipselink:xml-class-mapping-descriptor"> <eclipselink:class>some.package.SomeClass</eclipselink:class> <eclipselink:alias>SomeAlias</eclipselink:alias>
eclipselink-dbws.xml descriptor file:
<?xml version="1.0" encoding="UTF-8"?>
<dbws
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<name>example</name>
<sessions-file>example-dbws-sessions.xml</sessions-file>
<query>
<name>countEmployees</name>
<result>
<type>xsd:int</type>
<simple-xml-format>
<simple-xml-format-tag>employee-info</simple-xml-format-tag>
<simple-xml-tag>aggregate-info</simple-xml-tag>
</simple-xml-format>
</result>
<sql><![CDATA[select count(*) from EMP]]></sql>
</query>
<query>
<name>findAllEmployees</name>
<result isCollection="true">
<type>empType</type>
</result>
<sql><![CDATA[select * from EMP]]></sql>
</query>
</dbws>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classINTERNAL: Implementation of MetadataSource to allow passing JPA metadata to the MetadataProcessor.static final classINTERNAL: Implementation of MetadataSource to allow passing XmlBindings to the DynamicJAXBContextFactorystatic final classINTERNAL: PersistenceUnitInfo implementation to allow creation of a MetadataProcessor instance. -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidINTERNAL:buildService(XRServiceModel xrServiceModel) voidINTERNAL:voidcustomizeSession(Session orSession, Session oxSession) protected static ClassDescriptorgetDescriptorForClassName(Project project, String javaClassName) Returns a ClassDescriptor from the given project with the matching javaClassName, or null if not found.static DocumentBuilderstatic TransformervoidINTERNAL:voidinitializeService(ClassLoader parentClassLoader, InputStream xrSchemaStream) INTERNAL: Initialize the various components (of theXRService} (O-R Project, O-X Project, Schema definitions, auto-generated classes, etc.)protected ProjectloadORMetadata(XRDynamicClassLoader xrdecl, ServerSession session) INTERNAL: Create a Project using ORM metadata.protected ProjectloadOXMetadata(ClassLoader xrdecl, Session session) INTERNAL: Create a Project using OXM metadata.voidloadXMLSchema(InputStream xrSchemaStream) INTERNAL: Read and unmarshalXRService's.xsdfile.voidINTERNAL:protected voidINTERNAL:protected static voidprepareDescriptors(Project oxProject, Project orProject, XRDynamicClassLoader xrdcl) INTERNAL: Perform any post-load descriptor modifications, such as altering attribute classification on a given mapping, or converting class names to classes.protected QNameresolveName(String name, NamespaceResolver ns) INTERNAL:protected static voidupdateFindQueryNames(Project orProject) INTERNAL: Legacy projects have 'findAll' and 'findByPrimaryKey' queries, whereas we now expect these to have the descriptor alias appended (preceded with underscore), + 'Type'.voidINTERNAL:
-
Field Details
-
xrService
-
parentClassLoader
-
xrSchemaStream
-
-
Constructor Details
-
XRServiceFactory
public XRServiceFactory()
-
-
Method Details
-
buildService
-
buildService
-
initializeService
INTERNAL: Initialize the various components (of the
XRService} (O-R Project, O-X Project, Schema definitions, auto-generated classes, etc.)- Parameters:
parentClassLoader- the parentClassLoaderfor the auto-generated classes.xrSchemaStream- stream resource for theXRService's.xsdfile.
-
customizeSession
-
loadXMLSchema
INTERNAL: Read and unmarshal
XRService's.xsdfile.- Parameters:
xrSchemaStream- Stream resource for theXRService's.xsdfile.
-
loadORMetadata
INTERNAL: Create a Project using ORM metadata. The given classloader is expected to successfully load 'META-INF/eclipselink-dbws-or.xml'.
- Parameters:
xrdecl-ClassLoaderused to search foreclipselink-dbws-or.xml.session- ORM session.
-
loadOXMetadata
INTERNAL: Create a Project using OXM metadata. The given classloader is expected to successfully load 'META-INF/eclipselink-dbws-ox.xml'.
- Parameters:
xrdecl-ClassLoaderused to search foreclipselink-dbws-ox.xml.session- OXM session (only for logging).
-
prepareDescriptors
protected static void prepareDescriptors(Project oxProject, Project orProject, XRDynamicClassLoader xrdcl) INTERNAL: Perform any post-load descriptor modifications, such as altering attribute classification on a given mapping, or converting class names to classes. In addition, JAXB and JPA Embeddables will have the descriptor alias set to the class name (w/o package), which will contain an upper case first character, meaning that the OR/OX descriptors will have to be aligned in some cases.
-
getDescriptorForClassName
Returns a ClassDescriptor from the given project with the matching javaClassName, or null if not found. -
buildSessions
public void buildSessions()INTERNAL:
-
loginSessions
public void loginSessions()INTERNAL:
-
buildDescriptorIndex
public void buildDescriptorIndex()INTERNAL:
-
validateOperations
public void validateOperations()INTERNAL:
-
initializeOperations
public void initializeOperations()INTERNAL:
-
logoutSessions
protected void logoutSessions()INTERNAL:
-
resolveName
INTERNAL:
-
getDocumentBuilder
-
getTransformer
-
updateFindQueryNames
INTERNAL: Legacy projects have 'findAll' and 'findByPrimaryKey' queries, whereas we now expect these to have the descriptor alias appended (preceded with underscore), + 'Type'. For example, if we have an Employee descriptor, the find queries would be: 'findAll_employeeType' and 'findByPrimaryKey_employeeType'.
-