Top Description Fields Constructors Methods
org.eclipse.persistence.tools.weaving.jpa

public Class StaticWeaveProcessor

extends Object
Class Inheritance
Annotations
@SuppressWarnings:deprecation
Imports
java.io.ByteArrayOutputStream, .File, .FileOutputStream, .IOException, .InputStream, .Writer, java.net.MalformedURLException, .URI, .URISyntaxException, .URL, .URLClassLoader, java.util.Iterator, java.util.jar.JarEntry, .JarOutputStream, org.eclipse.persistence.exceptions.StaticWeaveException, org.eclipse.persistence.internal.helper.Helper, org.eclipse.persistence.internal.jpa.deployment.ArchiveFactoryImpl, .PersistenceUnitProcessor, org.eclipse.persistence.internal.jpa.weaving.AbstractStaticWeaveOutputHandler, .StaticWeaveDirectoryOutputHandler, .StaticWeaveJAROutputHandler, org.eclipse.persistence.internal.localization.ToStringLocalization, org.eclipse.persistence.jpa.Archive, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog

Description: The StaticWeaveProcessor controls the static weaving process. It is invoked by both the command line StaticWeave class and the StaticWeaveAntTask.

Responsibilities: Process the source classes, performs weaving as necessary out outputs to the target

Field Summary

Modifier and TypeField and Description
private ClassLoader
private int
private Writer
private static final int
private URL
private String
private URL
private URL

Constructor Summary

AccessConstructor and Description
public
StaticWeaveProcessor(String
the name of the location to be weaved
source
,
String
the name of the location to be weaved to
target
)

Constructs an instance of StaticWeaveProcessor

public
StaticWeaveProcessor(File
the File object of the source to be weaved
source
,
File
the File object of the target to be weaved to
target
)

Constructs an instance of StaticWeaveProcessor

public
StaticWeaveProcessor(URL
the URL of the source to be weaved
source
,
URL
the URL of the target to be weaved to
target
)

Constructs an instance of StaticWeaveProcessor

Method Summary

Modifier and TypeMethod and Description
public static String
public String
private URL[]
getURLs()

Generate URL array for specified source and persistenceinfo.

private boolean
isDirectory(URL url)

Determine whether or not the URL is pointing to directory.

public void
performWeaving()

This method performs weaving function on the class individually from the specified source.

private void
preProcess()

INTERNAL: This method perform all necessary steps(verification, pre-build the target directory) prior to the invocation of the weaving function.

private void
process()

INTERNAL: The method performs weaving function

public void
setClassLoader(ClassLoader classLoader)

Set the user classloader.

public void
setLog(Writer
the location where the log message writes to. the default value is standard out
logWriter
)

The method allows user to specify the output for the log message.

public void
setLogLevel(int
- the integer value of log level. default is OFF.
level
)

The method allows user to define nine levels EclipseLink logging.

public void
setPersistenceInfo(URL
the URL of the location containing persistence.xml, the URL must point to the root of META-INF/persistence.xml
persistenceInfo
)

Set an explicitly identified URL of the location containing persistence.xml.

public void
setPersistenceInfo(String
the path of the location containing persistence.xml, the path must point to the root of META-INF/persistence.xml
persistenceInfoPath
)

Set an explicitly identified the location containing persistence.xml.

public void
setPersistenceInfo(File
the file containing persistence.xml, the file should contain META-INF/persistence.xml
persistenceInfoFile
)

Set an explicitly identified the location containing persistence.xml.

public void
setPersistenceXMLLocation(String persistenceXMLLocation)

Set a specific location to look for persistence.xml by default we will look in META-INF/persistence.xml

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classLoaderback to summary
private ClassLoader classLoader
logLevelback to summary
private int logLevel
logWriterback to summary
private Writer logWriter
NUMBER_OF_BYTESback to summary
private static final int NUMBER_OF_BYTES
persistenceInfoback to summary
private URL persistenceInfo
persistenceXMLLocationback to summary
private String persistenceXMLLocation
sourceback to summary
private URL source
targetback to summary
private URL target

Constructor Detail

StaticWeaveProcessorback to summary
public StaticWeaveProcessor(String source, String target) throws MalformedURLException

Constructs an instance of StaticWeaveProcessor

Parameters
source:String

the name of the location to be weaved

target:String

the name of the location to be weaved to

StaticWeaveProcessorback to summary
public StaticWeaveProcessor(File source, File target) throws MalformedURLException

Constructs an instance of StaticWeaveProcessor

Parameters
source:File

the File object of the source to be weaved

target:File

the File object of the target to be weaved to

StaticWeaveProcessorback to summary
public StaticWeaveProcessor(URL source, URL target)

Constructs an instance of StaticWeaveProcessor

Parameters
source:URL

the URL of the source to be weaved

target:URL

the URL of the target to be weaved to

Method Detail

getDirectoryFromEntryNameback to summary
public static String getDirectoryFromEntryName(String entryName)
getPersistenceXMLLocationback to summary
public String getPersistenceXMLLocation()
getURLsback to summary
private URL[] getURLs()

Generate URL array for specified source and persistenceinfo.

isDirectoryback to summary
private boolean isDirectory(URL url) throws URISyntaxException

Determine whether or not the URL is pointing to directory.

performWeavingback to summary
public void performWeaving() throws URISyntaxException, MalformedURLException, IOException

This method performs weaving function on the class individually from the specified source.

preProcessback to summary
private void preProcess() throws URISyntaxException, MalformedURLException

INTERNAL: This method perform all necessary steps(verification, pre-build the target directory) prior to the invocation of the weaving function.

processback to summary
private void process() throws IOException, URISyntaxException

INTERNAL: The method performs weaving function

setClassLoaderback to summary
public void setClassLoader(ClassLoader classLoader)

Set the user classloader.

setLogback to summary
public void setLog(Writer logWriter)

The method allows user to specify the output for the log message.

Parameters
logWriter:Writer

the location where the log message writes to. the default value is standard out

setLogLevelback to summary
public void setLogLevel(int level)

The method allows user to define nine levels EclipseLink logging.

Parameters
level:int

- the integer value of log level. default is OFF.

setPersistenceInfoback to summary
public void setPersistenceInfo(URL persistenceInfo)

Set an explicitly identified URL of the location containing persistence.xml.

Parameters
persistenceInfo:URL

the URL of the location containing persistence.xml, the URL must point to the root of META-INF/persistence.xml

setPersistenceInfoback to summary
public void setPersistenceInfo(String persistenceInfoPath) throws MalformedURLException

Set an explicitly identified the location containing persistence.xml.

Parameters
persistenceInfoPath:String

the path of the location containing persistence.xml, the path must point to the root of META-INF/persistence.xml

setPersistenceInfoback to summary
public void setPersistenceInfo(File persistenceInfoFile) throws MalformedURLException

Set an explicitly identified the location containing persistence.xml.

Parameters
persistenceInfoFile:File

the file containing persistence.xml, the file should contain META-INF/persistence.xml

setPersistenceXMLLocationback to summary
public void setPersistenceXMLLocation(String persistenceXMLLocation)

Set a specific location to look for persistence.xml by default we will look in META-INF/persistence.xml