Methods Summary |
---|
public void | addClasspath(org.apache.tools.ant.types.Path path)Add the dependent classpath in order to load classes from the specified input jar.
classPaths.add(path);
|
public void | execute()Execute ant task
verifyOptions();
start();
|
private java.util.Vector | getPathElement()
Vector pathElements = new Vector();
for(int i=0;i<classPaths.size();i++){
String thisPath = ((Path)classPaths.get(i)).toString();
if(thisPath!=null){
String[] thisSplitedPath=thisPath.split(File.pathSeparator);
if(thisSplitedPath!=null){
for(int j=0;j<thisSplitedPath.length;j++){
pathElements.add(thisSplitedPath[j]);
}
}
}
}
return pathElements;
|
private java.net.URL[] | getURLs()
Vector pathElements = getPathElement();
URL[] urls = new URL[pathElements.size()];
for(int i=0;i<pathElements.size();i++){
try {
urls[i] = (new File((String)pathElements.get(i))).toURI().toURL();
} catch (MalformedURLException e) {
throw StaticWeaveException.exceptionPerformWeaving(e);
}
}
return urls;
|
public void | setLog(java.lang.String logFile)Set the archive containing persistence.xml while input archive does not contain it.
try{
this.logWriter = new FileWriter(logFile);
}catch(Exception e){
throw StaticWeaveException.openLoggingFileException(logFile,e);
}
|
public void | setLogLevel(java.lang.String logLevel)
if (logLevel.equalsIgnoreCase("OFF") ||
logLevel.equalsIgnoreCase("SEVERE") ||
logLevel.equalsIgnoreCase("WARNING") ||
logLevel.equalsIgnoreCase("INFO") ||
logLevel.equalsIgnoreCase("CONFIG") ||
logLevel.equalsIgnoreCase("FINE") ||
logLevel.equalsIgnoreCase("FINER") ||
logLevel.equalsIgnoreCase("FINEST") ||
logLevel.equalsIgnoreCase("ALL")) {
this.logLevel=AbstractSessionLog.translateStringToLoggingLevel(logLevel.toUpperCase());
} else{
throw StaticWeaveException.illegalLoggingLevel(logLevel);
}
|
public void | setPersistenceinfo(java.lang.String persistenceinfo)
this.persistenceinfo = persistenceinfo;
|
public void | setSource(java.lang.String source)Set the input archive to be used to weave.
this.source = source;
|
public void | setTarget(java.lang.String target)Set output archive to be used to weave to
this.target = target;
|
private void | start()Invoke weaving process..
try{
StaticWeaveProcessor weave = new StaticWeaveProcessor(source, target);
URL[] urls = getURLs();
if(urls!=null){
URLClassLoader classLoader = new URLClassLoader(getURLs(), Thread.currentThread().getContextClassLoader());
weave.setClassLoader(classLoader);
}
if(persistenceinfo!=null){
weave.setPersistenceInfo(persistenceinfo);
}
if(logWriter!=null){
weave.setLog(logWriter);
}
weave.setLogLevel(this.logLevel);
weave.performWeaving();
}catch(Exception e){
throw StaticWeaveException.exceptionPerformWeaving(e);
}
|
private void | verifyOptions()Verify the value of attributes.
if(source==null) {
throw StaticWeaveException.missingSource();
}
if(target==null) {
throw StaticWeaveException.missingTarget();
}
|