EclipseLink 2.3.2, build 'v20111125-r10461' API Reference

org.eclipse.persistence.jpa.metadata
Class XMLMetadataSource

java.lang.Object
  extended by org.eclipse.persistence.jpa.metadata.MetadataSourceAdapter
      extended by org.eclipse.persistence.jpa.metadata.XMLMetadataSource
All Implemented Interfaces:
MetadataSource

public class XMLMetadataSource
extends MetadataSourceAdapter

Purpose: Support reading metadata for a persistence unit in an XML format from a URL and if the property is undefined, it will look for a file.


Constructor Summary
XMLMetadataSource()
           
 
Method Summary
 org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings getEntityMappings(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.ClassLoader classLoader, SessionLog log)
          This method is responsible for returning the object representation of the MetadataSource.
 java.io.Reader getEntityMappingsReader(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.ClassLoader classLoader, SessionLog log)
          This class returns a Reader for an EclipseLink-ORM.xml.
 java.lang.String getRepositoryName()
          Used by getEntityMappings when creating the XMLEntityMappings as a way of describing where it was read from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLMetadataSource

public XMLMetadataSource()
Method Detail

getEntityMappingsReader

public java.io.Reader getEntityMappingsReader(java.util.Map<java.lang.String,java.lang.Object> properties,
                                              java.lang.ClassLoader classLoader,
                                              SessionLog log)
This class returns a Reader for an EclipseLink-ORM.xml. It will use the PersistenceUnitProperties.METADATA_SOURCE_XML_URL property if available to create an InputStreamReader from a URL, and if not available, use the PersistenceUnitProperties.METADATA_SOURCE_XML_FILE property will be used to get a file resource from the classloader. It will throw a ValidationException if no reader can be returned.

Parameters:
properties -
classLoader -
log - - SessionLog used for status messages.
Returns:
Reader - a InputStreamReader with data in the form of an EclipseLink-orm.xml
See Also:
getEntityMappings

getEntityMappings

public org.eclipse.persistence.internal.jpa.metadata.xml.XMLEntityMappings getEntityMappings(java.util.Map<java.lang.String,java.lang.Object> properties,
                                                                                             java.lang.ClassLoader classLoader,
                                                                                             SessionLog log)
This method is responsible for returning the object representation of the MetadataSource. This implementation makes a call to getEntityMappingsReader to get a Reader which is passed to an XMLUnmarshaller, and closes the reader in a finally block.

Specified by:
getEntityMappings in interface MetadataSource
Overrides:
getEntityMappings in class MetadataSourceAdapter
Returns:
XMLEntityMappings - object representation of the EclipseLink-orm.xml for this repository

getRepositoryName

public java.lang.String getRepositoryName()
Used by getEntityMappings when creating the XMLEntityMappings as a way of describing where it was read from. Currently returns the current class's simple name.

Returns:
String - repository name to store in the XMLEntityMappings returned from getEntityMappings

EclipseLink 2.3.2, build 'v20111125-r10461' API Reference