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.xml
file calledeclipselink-dbws-sessions.xml
the naming convention for thesessions.xml
files can be overriden by the optional<sessions-file>
entry in theeclipselink-dbws.xml
descriptor file. - EclipseLink metadata in the form of a EclipseLink
Project
(either deployment XML or Java classes).A typical
XRService
requires two projects: one to represent the O-R side, the other to represent the O-X side.
The O-R and O-XProjects
metadata must have:
i) identical case-sensitiveProject
names:<?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 forDescriptors
that 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
Modifier and TypeClassDescriptionstatic final class
INTERNAL: Implementation of MetadataSource to allow passing JPA metadata to the MetadataProcessor.static final class
INTERNAL: Implementation of MetadataSource to allow passing XmlBindings to the DynamicJAXBContextFactorystatic final class
INTERNAL: PersistenceUnitInfo implementation to allow creation of a MetadataProcessor instance. -
Field Summary
Modifier and TypeFieldDescription -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
INTERNAL:buildService
(XRServiceModel xrServiceModel) void
INTERNAL:void
customizeSession
(Session orSession, Session oxSession) protected static ClassDescriptor
getDescriptorForClassName
(Project project, String javaClassName) Returns a ClassDescriptor from the given project with the matching javaClassName, or null if not found.static DocumentBuilder
static Transformer
void
INTERNAL:void
initializeService
(ClassLoader parentClassLoader, InputStream xrSchemaStream) INTERNAL: Initialize the various components (of theXRService
} (O-R Project, O-X Project, Schema definitions, auto-generated classes, etc.)protected Project
loadORMetadata
(XRDynamicClassLoader xrdecl, ServerSession session) INTERNAL: Create a Project using ORM metadata.protected Project
loadOXMetadata
(ClassLoader xrdecl, Session session) INTERNAL: Create a Project using OXM metadata.void
loadXMLSchema
(InputStream xrSchemaStream) INTERNAL: Read and unmarshalXRService
's.xsd
file.void
INTERNAL:protected void
INTERNAL: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.protected QName
resolveName
(String name, NamespaceResolver ns) INTERNAL:protected static void
updateFindQueryNames
(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'.void
INTERNAL:
-
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 parentClassLoader
for the auto-generated classes.xrSchemaStream
- stream resource for theXRService
's.xsd
file.
-
customizeSession
-
loadXMLSchema
INTERNAL: Read and unmarshal
XRService
's.xsd
file.- Parameters:
xrSchemaStream
- Stream resource for theXRService
's.xsd
file.
-
loadORMetadata
INTERNAL: Create a Project using ORM metadata. The given classloader is expected to successfully load 'META-INF/eclipselink-dbws-or.xml'.
- Parameters:
xrdecl
-ClassLoader
used 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
-ClassLoader
used 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'.
-