Methods Summary |
---|
public void | cleanup_internal()
// nothing to do.
|
protected void | deploy()
try
{
Application app;
if(isArchive()) {
app = explodeArchive();
} else { //directory deploy
//create the generated/xml directory for directory deploy
getXMLDir().mkdirs();
getJWSDir().mkdirs();
getStubsDir().mkdirs();
// construct the standard application.xml if omitted
ApplicationArchivist appArchivist = new ApplicationArchivist();
String dir = request.getDeployedDirectory().getAbsolutePath();
FileArchive appArchive = new FileArchive();
appArchive.open(dir);
if (!appArchivist.hasStandardDeploymentDescriptor(appArchive)) {
Application appDesc =
Application.createApplication(appArchive,true,true);
request.setDescriptor(appDesc);
}
// load deployment descriptors
app = loadDescriptors();
}
request.setDescriptor(app);
// Set the generated XML directory in application desc
request.getDescriptor().setGeneratedXMLDirectory(getXMLDir().getAbsolutePath());
// create a DeploymentStatus for runEJBC stage
// it is a substage of J2EECPhase status
DeploymentStatus runEJBCStatus =
new DeploymentStatus(J2EECPhaseStatus);
request.setCurrentDeploymentStatus(runEJBCStatus);
runJSPC();
runVerifier();
ZipItem[] clientStubs = runEJBC();
checkAppclientsMainClasses();
createClientJar(clientStubs);
// create a DeploymentStatus for postDeploy stage
// it is a substage of J2EECPhase status
DeploymentStatus postDeployStatus =
new DeploymentStatus(J2EECPhaseStatus);
request.setCurrentDeploymentStatus(postDeployStatus);
postDeploy();
addToSummary(getSuccessMessage() + getAppName() + "\n*********************\n");
}
catch(IASDeploymentException e)
{
throw e;
}
catch(Exception e)
{
throw new IASDeploymentException(e);
}
|
public void | doRequest()
doRequestPrepare();
doRequestFinish();
|
public void | doRequestFinish()
try
{
predeploy();
deploy();
generatePolicy();
}
catch(Exception e)
{
String msg = localStrings.getString(
"enterprise.deployment.backend.dorequest_exception" );
if (e.getCause() != null )
msg+= e.getCause().toString();
rollback();
logger.log(Level.FINE, msg, e);
if (e instanceof IASDeploymentException) {
throw (IASDeploymentException) e;
} else {
throw new IASDeploymentException( msg, e);
}
}
finally
{
finish();
}
|
public void | doRequestPrepare()
// retrieve the J2EECPhase deployment status
J2EECPhaseStatus = request.getCurrentDeploymentStatus();
try
{
begin();
}
catch(Exception e)
{
rollback();
String msg = localStrings.getString(
"enterprise.deployment.backend.dorequest_exception" );
if (e.getCause() != null )
msg+= e.getCause().toString();
logger.log(Level.WARNING, msg, e);
if (e instanceof IASDeploymentException) {
throw (IASDeploymentException) e;
} else {
throw new IASDeploymentException( msg, e);
}
}
|
private com.sun.enterprise.deployment.Application | explodeArchive()
// first explode the ear file
Application appDesc = J2EEModuleExploder.explodeEar(request.getFileSource().getFile(), getAppDir());
appDesc.setRegistrationName(request.getName());
request.setDescriptor(appDesc);
getXMLDir().mkdirs();
getJWSDir().mkdirs();
getStubsDir().mkdirs();
// now I can call the normal descriptor loading...
loadDescriptors();
return appDesc;
|
protected final java.lang.String | getFailureMessage()
return stars + "**** " + whatAreYou() + " failed for " + getAppName() + " ****" + stars;
|
protected final java.lang.String | getSuccessMessage()
return stars + "**** " + whatAreYou() + " successful for " + getAppName() + " ****" + stars;
|
protected void | postDeploy()
// handle undeleted files if there is any
handleUndeletedFiles();
Application applicationDD = request.getDescriptor();
getManager().registerDescriptor(applicationDD.getRegistrationName(),
applicationDD);
DeploymentEventInfo info = new DeploymentEventInfo(
getAppDir(), getStubsDir(),
applicationDD, getRequest());
DeploymentEvent ev = new DeploymentEvent(
DeploymentEventType.POST_DEPLOY, info);
DeploymentEventManager.notifyDeploymentEvent(ev);
// need to populate web security PolicyConfig
WebSecurityManagerFactory wsmfactory =
WebSecurityManagerFactory.getInstance();
for (Iterator iter = applicationDD.getWebBundleDescriptors().iterator(); iter.hasNext();)
{
wsmfactory.newWebSecurityManager((WebBundleDescriptor)iter.next());
}
// need to populate ejb security PolicyConfig
EJBSecurityManagerFactory ejbmfactory =
(EJBSecurityManagerFactory)EJBSecurityManagerFactory.getInstance();
for (Object ejbBundleDescObj : applicationDD.getEjbBundleDescriptors()) {
for (Object ejbDescObj : ((EjbBundleDescriptor)ejbBundleDescObj).getEjbs()) {
ejbmfactory.createSecurityManager((EjbDescriptor)ejbDescObj);
}
}
if(!isDirectory()) {
postDeployArchive();
}
getManager().registerDescriptor(request.getName(), request.getDescriptor());
// save the object type in optional attributes
Properties optionalAttributes = request.getOptionalAttributes();
if (optionalAttributes == null) {
optionalAttributes = new Properties();
}
String resourceType = getResourceType(getAppDir());
if(resourceType != null) {
optionalAttributes.setProperty(ServerTags.OBJECT_TYPE,
resourceType);
}
request.setExternallyManagedApp(
isExternallyManagedApp(getAppDir()));
|
private void | postDeployArchive()
|
protected void | predeploy()
// create a DeploymentStatus for preDeploy stage
// it is a substage of J2EECPhase status
DeploymentStatus preDeployStatus =
new DeploymentStatus(J2EECPhaseStatus);
request.setCurrentDeploymentStatus(preDeployStatus);
super.predeploy();
// if the directories already exist on disk -- wipe them out
// We do this because otherwise they'd never get this App deployed
// without wiping the dirs manually
if(request.isDeploy())
liquidate();
|
protected void | rollback()
try {
getManager().unregisterDescriptor(getAppName());
liquidate(true);
} catch(IASDeploymentException ide) {
// Can't do anything about it!!
logger.log( Level.WARNING,
"enterprise.deployment_rollback_error", ide);
}
|
private com.sun.enterprise.util.zip.ZipItem[] | runEJBC()
ZipItem[] clientStubs = null;
try {
// ejbc timing info
IASEJBCTimes timing = new IASEJBCTimes();
EJBCompiler compiler = new EJBCompiler
(
getAppName(),
getAppDir(),
getStubsDir(),
getManager(),
request,
timing
);
// runs ejbc
clientStubs = compiler.compile();
/*
*Clean up the temporary jar expansion directory.
*
*Commenting this out to avoid degrading performance.
*/
// cleanTempUnjarDirectories(adjustedClassPathList);
// add the ejbc timing info to deployment time
addEJBCTime(timing);
}
catch(IASDeploymentException e) {
throw e;
}
catch (Exception e) {
logger.log( Level.WARNING,
"enterprise.deployment_ejbc_error", e );
String msg = localStrings.getString(
"enterprise.deployment.backend.ejbc_error" );
throw new IASDeploymentException(msg, e);
}
// returns the client stubs or an empty array if no stubs
return clientStubs;
|
private void | runJSPC()
if(!request.getPrecompileJSP())
return;
Application app = request.getDescriptor();
Set webBundleDescriptors = app.getWebBundleDescriptors();
if (webBundleDescriptors == null) {
return;
}
Iterator itr = webBundleDescriptors.iterator();
while (itr.hasNext())
{
WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
String warDirName = FileUtils.makeFriendlyFilename(
wbd.getModuleDescriptor().getArchiveUri());
File outDir = new File(getJSPDir(), warDirName);
File inDir = new File(getAppDir(), warDirName);
//String msg = "***** Call JSPCompiler(" + inDir.getPath()+ ", " + outDir.getPath() + ")";
//logger.log(Level.SEVERE, msg);
long time = System.currentTimeMillis();
JSPCompiler.compile(inDir, outDir, wbd,
request.getCompleteClasspath());
addJSPCTime(System.currentTimeMillis() - time);
}
|
private void | runVerifier()Runs the verifier on this module if verification is ON in
the deployment request.
if (request.isVerifying()) {
try {
String archive = request.getDeployedDirectory().getCanonicalPath();
File jspDir = (request.getPrecompileJSP())? getJSPDir():null;
new AppVerifier().verify(request.getDescriptor(),
(new FileArchiveFactory()).openArchive(archive),
request.getCompleteClasspath(),
jspDir);
} catch (Exception e) {
String msg = localStrings.getString(
"enterprise.deployment.backend.verifier_error");
throw new IASDeploymentException(msg);
}
}
|
protected java.io.File | setAppDir()
// brand-new deployment, so no versioning required.
ApplicationEnvironment aenv = getAppEnv();
File appDirectory;
if(isArchive()) {
File parent = new File(getInstanceEnv().getApplicationRepositoryPath());
appDirectory = new File(parent, getAppName());
appDirectory.mkdirs();
}
else if(isDirectory()) {
FileSource fileSource = request.getFileSource();
if(!fileSource.exists()) {
String msg = localStrings.getString(
"enterprise.deployment.backend.file_source_does_not_exist",
fileSource.toString() );
throw new IASDeploymentException( msg );
}
assert fileSource.isDirectory();
appDirectory = fileSource.getFile();
}
else {
String msg = localStrings.getString(
"enterprise.deployment.backend.deployment_not_dir_or_archive");
throw new IASDeploymentException( msg );
}
return appDirectory;
|
protected java.lang.String | whatAreYou()
return "Deployment";
|