KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > backend > Deployer


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * Deployer.java
26  *
27  * Created on December 10, 2001, 11:25 PM
28  */

29
30 package com.sun.enterprise.deployment.backend;
31
32 import com.sun.enterprise.deployment.ApplicationClientDescriptor;
33 import com.sun.enterprise.deployment.util.ModuleDescriptor;
34 import java.io.*;
35 import java.util.List JavaDoc;
36 import java.util.ArrayList JavaDoc;
37 import java.util.Iterator JavaDoc;
38 import java.util.Set JavaDoc;
39 import java.util.HashSet JavaDoc;
40 import java.util.Properties JavaDoc;
41 import java.util.logging.*;
42 import java.util.jar.JarFile JavaDoc;
43 import java.util.jar.Manifest JavaDoc;
44 import java.util.jar.Attributes JavaDoc;
45 import org.xml.sax.SAXParseException JavaDoc;
46 import com.sun.ejb.codegen.IASEJBCTimes;
47 import com.sun.enterprise.config.ConfigContext;
48 import com.sun.enterprise.config.ConfigException;
49 import com.sun.enterprise.config.serverbeans.DasConfig;
50 import com.sun.enterprise.config.serverbeans.ServerBeansFactory;
51 import com.sun.enterprise.deployment.Application;
52 import javax.enterprise.deploy.shared.ModuleType JavaDoc;
53 import com.sun.enterprise.deployment.autodeploy.AutoDeployConstants;
54 import com.sun.enterprise.deployment.archivist.ApplicationArchivist;
55 import com.sun.enterprise.deployment.archivist.Archivist;
56 import com.sun.enterprise.deployment.archivist.ArchivistFactory;
57 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive;
58 import com.sun.enterprise.deployment.deploy.shared.DeploymentPlanArchive;
59 import com.sun.enterprise.deployment.deploy.shared.FileArchive;
60 import com.sun.enterprise.deployment.interfaces.ClientJarMaker;
61 import com.sun.enterprise.deployment.interfaces.DeploymentImplConstants;
62 import com.sun.enterprise.deployment.RootDeploymentDescriptor;
63 import com.sun.enterprise.deployment.util.DeploymentProperties;
64 import com.sun.enterprise.deployment.util.ModuleContentLinker;
65 import com.sun.enterprise.instance.BaseManager;
66 import com.sun.enterprise.instance.InstanceEnvironment;
67 import com.sun.enterprise.instance.ModuleEnvironment;
68 import com.sun.enterprise.loader.EJBClassLoader;
69 import com.sun.enterprise.server.ApplicationServer;
70 import com.sun.enterprise.server.Constants;
71 import com.sun.enterprise.util.ConnectorClassLoader;
72 import com.sun.enterprise.util.diagnostics.Reminder;
73 import com.sun.enterprise.util.FileUtil;
74 import com.sun.enterprise.util.i18n.StringManager;
75 import com.sun.enterprise.util.io.FileUtils;
76 import com.sun.enterprise.util.zip.ZipItem;
77
78 /**
79  *
80  * @author bnevins
81  * @version
82  */

83 public abstract class Deployer
84 {
85
86     public static final String JavaDoc WEB_INF_LIB_PREFIX = "WEB-INF/lib/";
87     public static final String JavaDoc TEMP_DIRECTORY_SUFFIX = "__temp";
88
89     private static String JavaDoc CLIENT_JAR_MAKER_CHOICE = System.getProperty(
90                             DeploymentImplConstants.CLIENT_JAR_MAKER_CHOICE);
91
92     ///////////////////////////////////////////////////////////////////////////
93
///////// Abstract Methods ///////
94
///////////////////////////////////////////////////////////////////////////
95

96     /** @deprecated
97      */

98     public abstract void doRequest() throws IASDeploymentException;
99
100     public abstract void doRequestPrepare() throws IASDeploymentException;
101     public abstract void doRequestFinish() throws IASDeploymentException;
102
103     public abstract void cleanup_internal();
104     protected abstract List JavaDoc getModuleClasspath(Archivist archivist,
105                 AbstractArchive archive) throws IASDeploymentException;
106
107     ///////////////////////////////////////////////////////////////////////////
108
///////// Public Methods ///////
109
///////////////////////////////////////////////////////////////////////////
110
public final void cleanup()
111     {
112         cleanup_internal();
113     }
114
115     ///////////////////////////////////////////////////////////////////////////
116

117     public String JavaDoc toString()
118     {
119         return summary.toString();
120     }
121
122     /**@return the value of the boolean flag keepFailedStubsValue
123      * wbn 4/03 -- WHY IS THIS PUBLIC???
124      */

125     public static final boolean getKeepFailedStubsValue()
126     {
127         return keepFailedStubsValue;
128     }
129
130     ///////////////////////////////////////////////////////////////////////////
131
///////// EVERYTHING below here is protected or private //////////////
132
///////////////////////////////////////////////////////////////////////////
133

134     Deployer(DeploymentRequest r) throws IASDeploymentException
135     {
136             if(r == null) {
137                 String JavaDoc msg = localStrings.getString(
138                 "enterprise.deployment.backend.null_deployment_request_object");
139                 throw new IASDeploymentException( msg );
140             }
141             
142             request = r;
143             instanceEnv = request.getInstanceEnv();
144             
145             if(instanceEnv == null) {
146                 String JavaDoc msg = localStrings.getString(
147                 "enterprise.deployment.backend.null_instanceenvironment_in_deployment_request");
148                 throw new IASDeploymentException( msg );
149             }
150             
151             // since we want to cache all of our schema validation
152
// we need to make sure our grammar pool is initialized
153
// DOLGrammarPool.initializeGrammarPool();
154

155     }
156     
157     
158     ///////////////////////////////////////////////////////////////////////////
159

160     protected final InstanceEnvironment getInstanceEnv()
161     {
162         return instanceEnv;
163     }
164     
165     ///////////////////////////////////////////////////////////////////////////
166

167     protected final DeploymentRequest getRequest()
168     {
169         return request;
170     }
171     
172     ///////////////////////////////////////////////////////////////////////////
173

174     protected final boolean isDirectory() throws IASDeploymentException
175     {
176         return request.isDirectory();
177     }
178     
179     ///////////////////////////////////////////////////////////////////////////
180

181     protected final boolean isArchive() throws IASDeploymentException
182     {
183         return request.isArchive();
184     }
185
186     ///////////////////////////////////////////////////////////////////////////
187

188     protected void addToSummary(String JavaDoc s)
189     {
190         summary.append(s);
191         summary.append("\n");
192     }
193
194     ///////////////////////////////////////////////////////////////////////////
195

196     protected void begin() throws IASDeploymentException
197     {
198         // start profiling...
199
timeDeployStarted = System.currentTimeMillis();
200         
201         try
202         {
203             instanceEnv.verify();
204         }
205         catch(Exception JavaDoc e)
206         {
207             throw new IASDeploymentException(e);
208         }
209     }
210     
211         /**
212          * @return the validation level
213          */

214         public static String JavaDoc getValidationLevel() throws IASDeploymentException {
215             
216             init();
217             return validationLevel;
218         }
219         
220     /**
221      * @return a fully initialized and validated deployment descriptors for this
222      * deployment request.
223      */

224     protected Application loadDescriptors() throws IASDeploymentException {
225
226
227         // we will need this later
228
BaseManager manager = getManager();
229         if (manager==null) {
230         throw new IASDeploymentException(
231             localStrings.getString(
232             "enterprise.deployment.backend.no_manager_registered",
233             request.getType() ));
234         }
235         
236         // look if we should validate the deployment descriptors
237
init();
238         
239         
240         boolean validateXml = true;
241         
242         try {
243         Archivist archivist = ArchivistFactory.getArchivistForType(request.getType().getModuleType());
244                 archivist.setAnnotationProcessingRequested(true);
245
246         String JavaDoc appDir = request.getDeployedDirectory().getAbsolutePath();
247         FileArchive in = new FileArchive();
248         in.open(appDir);
249
250         if (request.isVerifying()) {
251             archivist.setRuntimeXMLValidation(true);
252             archivist.setRuntimeXMLValidationLevel("full");
253         }
254         if (validationLevel.equals("none")) {
255             archivist.setXMLValidation(false);
256         } else {
257             archivist.setXMLValidation(true);
258             archivist.setXMLValidationLevel(validationLevel);
259         }
260
261                 //Note in copying of deployment plan to the portable archive,
262
//we should make sure the manifest in the deployment plan jar
263
//file does not overwrite the one in the original archive
264
//NOTE. We are not checking the size of the deploymentPlan file
265
//here, since it looks like on windows the size of this tmp
266
//file is always zero when we attempt to query its size.
267
//Instead, we are making sure the 0 length deployment plan is
268
//not uploaded in DeploymentFacility implementation.
269
if (request.getDeploymentPlan() != null) {
270                     DeploymentPlanArchive dpa = new DeploymentPlanArchive();
271                     dpa.open(request.getDeploymentPlan().getAbsolutePath());
272
273                     if (request.isApplication()) {
274                         ApplicationArchivist aa = (ApplicationArchivist)archivist;
275                         aa.copyInto(request.getDescriptor(), dpa, in, false);
276                     } else {
277                         archivist.copyInto(dpa, in, false);
278                     }
279                 }
280         
281         // now let's create a class loader for this module
282

283         // parent class loader (from admin server)
284
ClassLoader JavaDoc parent =
285             (Boolean.getBoolean(com.sun.enterprise.server.PELaunch.USE_NEW_CLASSLOADER_PROPERTY))
286                     ? com.sun.enterprise.server.PELaunch.getAppServerChain()
287                     : ClassLoader.getSystemClassLoader();
288
289         // sets the parent class loader and class paths in deployment req
290
DeploymentUtils.setParentClassLoader(parent, getManager(), request);
291         // parent class paths for this deployment request
292
List JavaDoc allClassPaths = request.getParentClasspath();
293
294         // parent class loader for this deployment request
295
ClassLoader JavaDoc sharedClassLoader = request.getParentClassLoader();
296
297         List JavaDoc moduleClasspath = getModuleClasspath(archivist, in);
298             request.setModuleClasspath(moduleClasspath);
299
300         allClassPaths.addAll(moduleClasspath);
301
302         final ClassLoader JavaDoc ejbClassLoader = DeploymentUtils.getClassLoader(
303                                         moduleClasspath, sharedClassLoader, null);
304
305         // sets the ejb class loader & class paths - used during jspc
306
request.setEjbClassLoader(ejbClassLoader);
307         request.setCompleteClasspath(allClassPaths);
308
309                 // set classloader used for annotation processing
310
archivist.setClassLoader(ejbClassLoader);
311                 Application application = request.getDescriptor();
312                 if (application!=null && ModuleType.EAR.equals(archivist.getModuleType())) {
313                     archivist.readPersistenceDeploymentDescriptors(in, application);
314                     // Now process standard DDs, do this before runtime DDs
315
archivist.setHandleRuntimeInfo(false);
316                     boolean modulesReadSuccess = ((ApplicationArchivist) archivist).readModulesDescriptors(application, in);
317                     if (modulesReadSuccess) {
318                         // now process runtime DDs
319
archivist.setHandleRuntimeInfo(true);
320                         archivist.readRuntimeDeploymentDescriptor(in, application);
321                     } else {
322                         // it failed reading sub modules, I null our application which will trigger
323
// deployment failure handling
324
application=null;
325                     }
326                 } else {
327                     application = ApplicationArchivist.openArchive(archivist, in, true);
328                 }
329                 if (application==null) {
330                     throw new IASDeploymentException(localStrings.getString(
331                             "enterprise.deployment.backend.error_loading_dds",
332                             new Object JavaDoc[] { request.getName(), " " }));
333                 }
334         application.setRegistrationName(request.getName());
335         
336         application.setClassLoader(ejbClassLoader);
337                 archivist.setDescriptor(application);
338   
339                 // let's check for optional dependencies
340
archivist.performOptionalPkgDependenciesCheck(in);
341                                 
342         archivist.validate(ejbClassLoader);
343         
344         if (!application.getWebServiceDescriptors().isEmpty()) {
345             ModuleContentLinker visitor = new ModuleContentLinker(in);
346             application.visit((com.sun.enterprise.deployment.util.ApplicationVisitor) visitor);
347         }
348         request.setDescriptor(application);
349                 
350         return application;
351         } catch(SAXParseException JavaDoc spe) {
352         IASDeploymentException e = new IASDeploymentException(
353             localStrings.getString(
354             "enterprise.deployment.backend.saxerror_loading_dds",
355             request.getName(),String.valueOf(spe.getLineNumber()),
356                             String.valueOf(spe.getColumnNumber()), spe.getLocalizedMessage() ));
357         e.initCause(spe);
358         throw e;
359             } catch(IASDeploymentException e) {
360                 throw e;
361             } catch (Throwable JavaDoc t) {
362         IASDeploymentException e = new IASDeploymentException(
363             localStrings.getString(
364             "enterprise.deployment.backend.error_loading_dds",
365             request.getName(), t.getMessage() ));
366         e.initCause(t);
367         throw e;
368         }
369     }
370         
371         protected void copyAutodeployedClassFile(File JavaDoc srcFile, File JavaDoc destDir)
372             throws IOException {
373
374             File JavaDoc autodeployDir = srcFile.getParentFile();
375             String JavaDoc packageNameDirs="";
376             while (!autodeployDir.getName().equals(AutoDeployConstants.DEFAULT_AUTODEPLOY_DIR)) {
377                 packageNameDirs=autodeployDir.getName()+ File.separator + packageNameDirs;
378                 autodeployDir = autodeployDir.getParentFile();
379             }
380             destDir = new File JavaDoc(destDir, packageNameDirs);
381             File JavaDoc destFile = new File JavaDoc(destDir, srcFile.getName());
382             FileUtils.copy(request.getFileSource().getFile(), destFile);
383         }
384     
385         protected final void createClientJar(ZipItem[] clientStubs) throws IASDeploymentException {
386             
387             Properties JavaDoc props = request.getOptionalArguments();
388             String JavaDoc clientJarRequested = props.getProperty(DeploymentProperties.CLIENTJARREQUESTED);
389
390             // destination file for the client jar file
391
File JavaDoc appDirectory = request.getGeneratedXMLDirectory();
392
393             // for upgrade scenario, we fall back to original directory
394
if (appDirectory == null ||
395                 !FileUtils.safeIsDirectory(appDirectory)) {
396                 appDirectory = request.getDeployedDirectory();
397             }
398             File JavaDoc clientJar = new File JavaDoc(appDirectory, request.getName()
399                 + DeploymentImplConstants.ClientJarSuffix);
400             
401             // now we look if the client jar file is being requested by the client
402
// tool
403
if (clientJarRequested!=null &&
404                     Boolean.valueOf(clientJarRequested).booleanValue()) {
405                 
406                 // the client jar file is requested upon deployment,
407
// we need to build synchronously
408
ClientJarMakerThread.createClientJar(
409                     request, clientJar, clientStubs, CLIENT_JAR_MAKER_CHOICE);
410             
411                 // sets the newly created client jar in the deployment request
412
request.setClientJar(clientJar);
413             } else {
414                 
415                 // the client jar file is not requester, we build it asynchronously.
416
Thread JavaDoc clientJarThread = new ClientJarMakerThread(
417                     request, clientJar, clientStubs, CLIENT_JAR_MAKER_CHOICE);
418                 clientJarThread.start();
419                 
420                 // done !
421
}
422         }
423         
424     
425     /**
426      * Perform class level initialization. I do not want to put it
427      * in the static initializer since the config beans I am accessing
428      * may have not been initialized properly when the class loader
429      * invokes the static initializer.
430      */

431     private static void init() throws IASDeploymentException {
432         
433         // already initialized
434
if (validationLevel!=null) {
435         return;
436         }
437         
438         try {
439         ConfigContext ctx = ApplicationServer.getServerContext().getConfigContext();
440         DasConfig dc = ServerBeansFactory.getDasConfigBean(ctx);
441         validationLevel = dc.getDeployXmlValidation();
442         } catch(ConfigException ce) {
443         IASDeploymentException e = new IASDeploymentException(
444             localStrings.getString(
445             "enterprise.deployment.backend.cannot_get_validationlevel",
446             ce.getMessage() ));
447         e.initCause(ce);
448         throw e;
449         }
450         
451     }
452         
453     /**
454      * @author bnevins
455      * 9-23-03 for S1AS 8.0PE
456      * The namespace has been flattened for 8.0
457      * This method is called to see if a name is registered for a different
458      * type of J2EE Deployable Object. Deployment Backend itself will check the
459      * Manager for the same type of object to see if it is a re-deploy. If that
460      * check is negative, it will call here to check all the other types. If a different
461      * type is registered with the same name, Deployment will fail the deployment
462      * instead of wiping out the other app/module with the same name.
463      * @throws IASDeploymentException if it is registered elsewhere already.
464      */

465     
466     void checkRegisteredAnywhereElse(String JavaDoc id) throws IASDeploymentException
467     {
468         String JavaDoc error = BaseManager.isRegisteredAnywhere(instanceEnv, id);
469         
470         if(error != null)
471         {
472             String JavaDoc msg = localStrings.getString("enterprise.deployment.backend.nameAlreadyExists", new Object JavaDoc[] { id, error});
473             throw new IASDeploymentException(msg);
474         }
475     }
476             
477
478     ///////////////////////////////////////////////////////////////////////////
479

480     protected void addEJBCTime(IASEJBCTimes ejbcT)
481     {
482         ejbcTime += ejbcT.getTotalTime();
483         ejbcTiming = ejbcT;
484     }
485     ///////////////////////////////////////////////////////////////////////////
486

487     protected void addJSPCTime(long time)
488     {
489         jspcTime += time;
490     }
491
492     ///////////////////////////////////////////////////////////////////////////
493
protected final void finish() throws IASDeploymentException
494     {
495         long total = System.currentTimeMillis() - timeDeployStarted;
496         
497         if(total <= 0)
498             total = 1;
499         
500         int percentEJBC = (int)(((double)ejbcTime) / ((double)total) * 100.0);
501         int percentJSPC = (int)(((double)jspcTime) / ((double)total) * 100.0);
502         
503         deleteLockFile();
504         StringBuffer JavaDoc timing = new StringBuffer JavaDoc("Total Deployment Time: ");
505         timing.append(total);
506         timing.append(" msec, ");
507         if(jspcTime > 0)
508         {
509             timing.append("Total JSP Compile Time: ");
510             timing.append(jspcTime);
511             timing.append(" msec (").append(percentJSPC).append("%), ");
512         }
513         timing.append("Total EJB Compiler Module Time: ");
514         timing.append(ejbcTime);
515         timing.append(" msec, Portion spent EJB Compiling: ");
516         timing.append(percentEJBC);
517         timing.append("%");
518         
519         
520         
521         if(ejbcTiming != null)
522             timing.append("\nBreakdown of EJBC Module Time: " + ejbcTiming);
523         
524         logger.fine(timing.toString());
525         logger.finer(toString());
526
527             // helps garbage collection
528
releaseClassLoader();
529     }
530
531     ///////////////////////////////////////////////////////////////////////////
532

533     public final void releaseClassLoader()
534     {
535         try
536         {
537             // releases the parent class loader
538
ClassLoader JavaDoc parentCL = request.getParentClassLoader();
539             if ( (parentCL != null) && (parentCL instanceof EJBClassLoader) )
540             {
541                 ((EJBClassLoader) parentCL).done();
542             }
543             
544             // releases the ejb class loader
545
ClassLoader JavaDoc ejbCL = request.getEjbClassLoader();
546             if ( (ejbCL != null) && (ejbCL instanceof EJBClassLoader) )
547             {
548                 ((EJBClassLoader) ejbCL).done();
549             }
550             
551         }
552         catch (Exception JavaDoc e)
553         {
554             // ignore
555
}
556
557     }
558
559     ///////////////////////////////////////////////////////////////////////////
560

561     /** This is a backdoor designed for QA and support staff.
562      * If the magical environmental variable, "KeepFailedStubs",
563      * is set to "true", then this method returns true.
564      * It results in the generated stubs files being retained and
565      * place into the expected directory with "_failed" appended to the name. The
566      * Directory will be deleted and replaced the next time there
567      * is a failed deployment. It will never be automatically cleaned up.
568      * Note: KeepFailedStubs and true are both case insensitive.
569      * <p>This method will do the following, if the flag is set:
570      * <br>delete already existing _fail directory, if any
571      * <br>rename the given stubsdir to xxx_failed
572      * <p>If the flag is not set, it will wipeout the stubsDir recursively.
573      * @param stubsDir The directory with the generated ejb files that would normally be wiped out.
574      * @returns true if the backdoor is open.
575      */

576     protected void DeleteOrKeepFailedStubs(File JavaDoc stubsDir)
577     {
578         //4704059 - backdoor for analyzing stubs
579
if(!FileUtils.safeIsDirectory(stubsDir))
580             return; // not an error
581

582         if(keepFailedStubsValue)
583         {
584             File JavaDoc failedStubsDir = new File JavaDoc(stubsDir.getPath() + FAILED_SUFFIX);
585
586             // blow-away any already existing failed dir
587
FileUtils.whack(failedStubsDir);
588
589             stubsDir.renameTo(failedStubsDir);
590             logger.info(Constants.KEEP_FAILED_STUBS + " is set. Backdoor is open. Saving failed generated ejb files in: " + failedStubsDir.getPath());
591         }
592         else
593         {
594             FileUtils.whack(stubsDir);
595         }
596     }
597     ///////////////////////////////////////////////////////////////////////////
598

599     protected String JavaDoc getResourceType(File JavaDoc appDir)
600     {
601         FileInputStream fis = null;
602         try{
603             File JavaDoc manifestFile = new File JavaDoc(appDir, JarFile.MANIFEST_NAME);
604             fis = new FileInputStream(manifestFile);
605             Manifest JavaDoc manifest = new Manifest JavaDoc(fis);
606             Attributes JavaDoc attrs = manifest.getMainAttributes();
607             return attrs.getValue(Constants.APPLICATION_TYPE);
608         }catch(Throwable JavaDoc t){
609             // by default resource-type will be assigned "user". Need just return null;
610
return null;
611         } finally {
612             try {
613                 if (fis != null) {
614                     fis.close();
615                 }
616             } catch (IOException ioe) {
617             }
618         }
619     }
620
621     ///////////////////////////////////////////////////////////////////////////
622

623     private final void deleteLockFile()
624     {
625         if(lockFile != null)
626             lockFile.delete();
627     }
628     
629     ///////////////////////////////////////////////////////////////////////////
630

631     /**
632      * @return the BaseManager implementation for this deployer
633      */

634     protected abstract BaseManager getManager();
635
636     /**
637      *Makes sure each app client specifies Main-Class in its manifest.
638      *Logs warnings for any client that fails to do so.
639      */

640     protected boolean checkAppclientsMainClasses() {
641         /*
642          *Use the ModuleDescriptors from getModules to obtain the URIs for
643          *use in the warning if needed.
644          */

645         boolean result = true;
646         StringBuilder JavaDoc sb = new StringBuilder JavaDoc();
647         for (Iterator JavaDoc it = request.getDescriptor().getModules(); it != null && it.hasNext(); ) {
648             ModuleDescriptor md = (ModuleDescriptor) it.next();
649             if (md.getModuleType() == ModuleType.CAR) {
650                 String JavaDoc archiveURI = md.getArchiveUri();
651                 ApplicationClientDescriptor acd = (ApplicationClientDescriptor) md.getDescriptor();
652                 String JavaDoc mainClassName = acd.getMainClassName();
653                 if (mainClassName == null || mainClassName.length() == 0) {
654                     result = false;
655                     logger.log(Level.WARNING, localStrings.getString("enterprise.deployment.backend.no_main_class"), archiveURI);
656                     if (sb.length() > 0) {
657                         sb.append(", ");
658                     }
659                     sb.append(archiveURI);
660                 }
661             }
662         }
663         if ( ! result) {
664             /*
665              *At least one app client failed to identify its main class. Add a
666              *deployment sub-status warning of the problem.
667              */

668             DeploymentStatus mainClassesNotOKStatus = new DeploymentStatus(request.getCurrentDeploymentStatus());
669             mainClassesNotOKStatus.setStageDescription(localStrings.getString("enterprise.deployment.backend.appclient_mainclass_checking"));
670             mainClassesNotOKStatus.setStageStatus(DeploymentStatus.WARNING);
671             mainClassesNotOKStatus.setStageStatusMessage(localStrings.getString("enterprise.deployment.backend.appclient_mainclass_checking_failed", sb.toString()));
672         }
673         return result;
674     }
675
676     protected DeploymentRequest request;
677     protected Logger logger = DeploymentLogger.get();
678     protected StringBuffer JavaDoc summary = new StringBuffer JavaDoc();
679     private InstanceEnvironment instanceEnv;
680     private ModuleEnvironment moduleEnv;
681     private long timeDeployStarted;
682     private long ejbcTime = 0;
683     private long jspcTime = 0;
684     private File JavaDoc lockFile = null;
685     private static StringManager localStrings = StringManager.getManager( Deployer.class );
686     private static final boolean keepFailedStubsValue;
687     private final static String JavaDoc FAILED_SUFFIX = "_failed";
688     private static String JavaDoc validationLevel=null;
689     private IASEJBCTimes ejbcTiming = null;
690     static
691     {
692         String JavaDoc s = DeploymentUtils.getSystemPropertyIgnoreCase(Constants.KEEP_FAILED_STUBS);
693         
694         if(s != null && s.compareToIgnoreCase("true") == 0)
695             keepFailedStubsValue = true;
696         else
697             keepFailedStubsValue = false;
698
699         
700         //Reminder.message("KeepFailedStubs is: " + keepFailedStubsValue);
701
}
702     /* HARRY JACC Changes
703        TBD: A different exception in line with ias7 should be propagated ahead
704        instead of classnotfound.
705     */

706     protected void generatePolicy() throws IASDeploymentException
707
708     {
709     // Each subtype of deployer, overrides this
710
}
711
712     public abstract void removePolicy() throws IASDeploymentException;
713 }
714
Popular Tags