Methods Summary |
---|
protected void | begin()Before even attempting the deployment operation -- check and verify and set lots of
useful variables and references.
super.begin();
try
{
appEnv = request.getAppEnv();
if(appEnv == null) {
String msg = localStrings.getString(
"enterprise.deployment.backend.null_applicationenvironment_object");
throw new IASDeploymentException( msg );
}
appMgr = new AppsManager(getInstanceEnv());
appName = request.getName();
if(!StringUtils.ok(appName)) {
String msg = localStrings.getString(
"enterprise.deployment.backend.null_appname" );
throw new IASDeploymentException( msg );
}
isReg = DeploymentServiceUtils.isRegistered(
getAppName(), request.getType());
verify();
}
catch(IASDeploymentException e)
{
throw e;
}
catch(Exception e)
{
throw new IASDeploymentException(e);
}
|
protected void | generatePolicy()
try{
// generate policy for all web modules with
// moduleName + contextRoot and then generate for ejbs
// with Appname
Application applicationDD = request.getDescriptor();
// link with the ejb name
String linkName = null;
boolean lastInService = false;
for (Iterator iter = applicationDD.getWebBundleDescriptors().iterator();
iter.hasNext();){
String name
= WebSecurityManager.getContextID((WebBundleDescriptor)iter.next());
lastInService = SecurityUtil.linkPolicyFile(name, linkName, lastInService);
linkName = name;
}
for (Iterator iter = applicationDD.getEjbBundleDescriptors().iterator(); iter.hasNext();) {
String name =
EJBSecurityManager.getContextID((EjbBundleDescriptor)iter.next());
lastInService = SecurityUtil.linkPolicyFile(name, linkName, lastInService);
linkName = name;
}
// generate policies
for (Iterator iter = applicationDD.getWebBundleDescriptors().iterator();
iter.hasNext();){
String name
= WebSecurityManager.getContextID((WebBundleDescriptor)iter.next());
SecurityUtil.generatePolicyFile(name);
}
for (Iterator iter = applicationDD.getEjbBundleDescriptors().iterator(); iter.hasNext();) {
String name =
EJBSecurityManager.getContextID((EjbBundleDescriptor)iter.next());
SecurityUtil.generatePolicyFile(name);
}
} catch(IASSecurityException se){
// log this
String msg =
localStrings.getString("enterprise.deployment.backend.generate_policy_error", request.getName());
throw new IASDeploymentException(msg, se);
}
|
protected final java.io.File | getAppDir()
return appDir;
|
protected final com.sun.enterprise.instance.ApplicationEnvironment | getAppEnv()
return appEnv;
|
protected final java.lang.String | getAppName()
return appName;
|
protected final java.io.File | getJSPDir()
return jspDir;
|
protected final java.io.File | getJWSDir()
return jwsDir;
|
protected com.sun.enterprise.instance.BaseManager | getManager()
return appMgr;
|
protected java.util.List | getModuleClasspath(com.sun.enterprise.deployment.archivist.Archivist archivist, com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive)
try {
Application application = request.getDescriptor();
if (application==null) {
application = (Application)archivist.readStandardDeploymentDescriptor(archive);
application.setRegistrationName(request.getName());
}
return EJBClassPathUtils.getAppClassPath(
application, request.getDeployedDirectory().getAbsolutePath(), getManager());
} catch(Exception e) {
throw new IASDeploymentException(e);
}
|
protected final java.io.File | getModuleDir()
return appDir;
|
protected final java.io.File | getStubsDir()
return stubsDir;
|
protected final java.io.File | getXMLDir()
return xmlDir;
|
protected void | liquidate(boolean isRollback)
if (request.isUnDeploy()) {
if (! (DeploymentServiceUtils.isDirectoryDeployed(getAppName(),
request.getType()) || request.isReload()) ) {
cleanAndCheck(getAppDir());
}
} else {
if (isArchive()) {
cleanAndCheck(getAppDir());
}
}
if (isRollback) {
DeleteOrKeepFailedStubs(getStubsDir());
} else {
cleanAndCheck(getStubsDir());
}
cleanAndCheck(getJSPDir());
cleanAndCheck(getXMLDir());
cleanAndCheck(getJWSDir());
liquidateTimeStamp = System.currentTimeMillis();
|
protected void | liquidate()
liquidate(false);
|
protected com.sun.enterprise.deployment.Application | loadDescriptors()
Application app = super.loadDescriptors();
(new com.sun.enterprise.webservice.WsUtil()).genWSInfo(app, request);
return app;
|
protected void | predeploy()Before even attempting the deployment operation -- check and verify and set lots of
useful variables and references.
try
{
appDir = setAppDir();
request.setDeployedDirectory(appDir);
setGeneratedDirs();
}
catch(IASDeploymentException e)
{
throw e;
}
catch(Exception e)
{
throw new IASDeploymentException(e);
}
|
public void | removePolicy()
String name = request.getName();
try {
WebSecurityManagerFactory wsmf =
WebSecurityManagerFactory.getInstance();
String[] webcontexts
= wsmf.getAndRemoveContextIdForWebAppName(name);
if(webcontexts !=null){
for(int i=0; i<webcontexts.length; i++){
if(webcontexts[i] != null){
SecurityUtil.removePolicy(webcontexts[i]);
wsmf.removeWebSecurityManager(webcontexts[i]);
}
}
}
// removing ejb policy
EJBSecurityManagerFactory ejbsmf =
(EJBSecurityManagerFactory)EJBSecurityManagerFactory.getInstance();
String[] ejbContextIds
= ejbsmf.getAndRemoveContextIdForEjbAppName(name);
if (ejbContextIds != null) {
for (String ejbContextId : ejbContextIds) {
if (ejbContextId != null) {
SecurityUtil.removePolicy(ejbContextId);
ejbsmf.removeSecurityManager(ejbContextId);
}
}
}
//remove any remaining policy
//This is to address the bug where the CONTEXT_ID in
//WebSecurityManagerFactory is not properly populated.
//We force the sub-modules to be removed in this case.
//This should not impact undeploy performance on DAS.
//This needs to be fixed better later.
String policyRootDir = System.getProperty(
"com.sun.enterprise.jaccprovider.property.repository");
if (policyRootDir != null) {
List<String> contextIds = new ArrayList<String>();
File policyDir = new File(
policyRootDir + File.separator + name);
if (policyDir.exists()) {
File[] policies = policyDir.listFiles();
for (int i = 0; i < policies.length; i++) {
if (policies[i].isDirectory()) {
contextIds.add(name + '/" + policies[i].getName());
}
}
} else {
//we tried. give up now.
}
if (contextIds.size() > 0) {
for (String cId : contextIds) {
SecurityUtil.removePolicy(cId);
}
}
}
} catch(IASSecurityException ex) {
String msg = localStrings.getString(
"enterprise.deployment.backend.remove_policy_error", name);
logger.log(Level.WARNING, msg, ex);
throw new IASDeploymentException(msg, ex);
}
|
protected abstract java.io.File | setAppDir()
|
private final void | setGeneratedDirs()
try
{
stubsDir = new File(getAppEnv().getAppStubPath());
jspDir = new File(getAppEnv().getAppJSPPath());
xmlDir = new File(getAppEnv().getAppGeneratedXMLPath());
jwsDir = new File(getAppEnv().getJavaWebStartPath());
request.setJSPDirectory(jspDir);
request.setStubsDirectory(stubsDir);
request.setGeneratedXMLDirectory(xmlDir);
}
catch(Exception e)
{
String msg = localStrings.getString(
"enterprise.deployment.backend.error_getting_generated_dirs",
e );
throw new IASDeploymentException( msg );
}
|
protected final void | verify()
if(!request.isApplication()) {
String msg = localStrings.getString(
"enterprise.deployment.backend.attempt_to_deploy_non_application");
throw new IASDeploymentException( msg );
}
if(request.isUnDeploy())
{
if(!isReg) {
String msg = localStrings.getString(
"enterprise.deployment.backend.undeploy_error_application_not_registered");
throw new IASDeploymentException( msg );
}
}
else if(request.isDeploy())
{
if(isReg)
{
String msg = localStrings.getString(
"enterprise.deployment.backend.deploy_error_application_exists");
throw new IASDeploymentException( msg );
}
// isReg is false. This means that it isn't registered as an App.
// But we might be clashing with a registered module of a different flavor.
// E.g. there may be a web module already deployed with the same name.
// this will throw an IASDeploymentException if it is registered to another type...
checkRegisteredAnywhereElse(appName);
}
else if(request.isReDeploy())
{
if(!isReg)
{
String msg = localStrings.getString(
"enterprise.deployment.backend.redeploy_error_application_does_not_exist");
throw new IASDeploymentException( msg );
}
}
|