KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > optional > sun > appserv > DeployTask


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  * The Apache Software License, Version 1.1
26  *
27  * Copyright (c) 1999 The Apache Software Foundation. All rights
28  * reserved.
29  *
30  * Redistribution and use in source and binary forms, with or without
31  * modification, are permitted provided that the following conditions
32  * are met:
33  *
34  * 1. Redistributions of source code must retain the above copyright
35  * notice, this list of conditions and the following disclaimer.
36  *
37  * 2. Redistributions in binary form must reproduce the above copyright
38  * notice, this list of conditions and the following disclaimer in
39  * the documentation and/or other materials provided with the
40  * distribution.
41  *
42  * 3. The end-user documentation included with the redistribution, if
43  * any, must include the following acknowlegement:
44  * "This product includes software developed by the
45  * Apache Software Foundation (http://www.apache.org/)."
46  * Alternately, this acknowlegement may appear in the software itself,
47  * if and wherever such third-party acknowlegements normally appear.
48  *
49  * 4. The names "The Jakarta Project", "Ant", and "Apache Software
50  * Foundation" must not be used to endorse or promote products derived
51  * from this software without prior written permission. For written
52  * permission, please contact apache@apache.org.
53  *
54  * 5. Products derived from this software may not be called "Apache"
55  * nor may "Apache" appear in their names without prior written
56  * permission of the Apache Group.
57  *
58  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
59  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
60  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
61  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
62  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
63  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
64  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
65  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
66  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
67  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
68  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69  * SUCH DAMAGE.
70  * ====================================================================
71  *
72  * This software consists of voluntary contributions made by many
73  * individuals on behalf of the Apache Software Foundation. For more
74  * information on the Apache Software Foundation, please see
75  * <http://www.apache.org/>.
76  */

77
78 package org.apache.tools.ant.taskdefs.optional.sun.appserv;
79
80 import org.apache.tools.ant.Project;
81 import org.apache.tools.ant.BuildException;
82
83 import java.io.File JavaDoc;
84
85 /**
86  * This task deploys J2EE components to the Sun ONE Application Server 7. The
87  * following components may be deployed:
88  * <ul>
89  * <li>Enterprise application (EAR file)
90  * <li>Web application (WAR file)
91  * <li>Enterprise Java Bean (EJB-JAR file)
92  * <li>Enterprise connector (RAR file)
93  * <li>Application client
94  * </ul>
95  *
96  * @see AppServerAdmin
97  * @see ComponentAdmin
98  * @author Greg Nelson <a HREF="mailto:gn@sun.com">gn@sun.com</a>
99  */

100 public class DeployTask extends ComponentAdmin {
101     private static final String JavaDoc DEPLOY_COMMAND = "deploy";
102     private static final String JavaDoc DEPLOY_DIR_COMMAND = "deploydir";
103     LocalStringsManager lsm = new LocalStringsManager();
104
105     protected Server getNewServer() {
106         return new DeployServer(server);
107     }
108
109     protected Component getNewComponent() {
110         return new DeployComponent(component);
111     }
112
113     /**
114      * Set if the component should be transferred to the (potentially)
115      * remote server before executing the command. Defaults to
116      * <code>true</code>.
117      *
118      * @param upload If set to <code>true</code>, components are transferred to
119      * the server before the command is executed.
120      */

121     public void setUpload(boolean upload) {
122         ((DeployServer)server).setUpload(upload); // Delegates to server object
123
}
124
125     /**
126      * Specifies the virtual server (or servers) where the component will be
127      * deployed. This applies to only EAR and WAR files.
128      *
129      * @param virtualServers The name of the virtual server or the names of
130      * multiple virtual servers separated by commas (',')
131      */

132     public void setVirtualServers(String JavaDoc virtualServers) {
133         ((DeployServer)server).setVirtualServers(virtualServers);
134     }
135     
136     /**
137      * Sets if the command should overwrite existing values or components.
138      *
139      * @param force If set to <code>true</code>, components are automatically
140      * overwritten. If set to <code>false</code>, administrative commands will
141      * fail if the component already exists.
142      */

143     public void setForce(boolean force) {
144         ((DeployComponent)component).setForce(force); // Delegates to component object
145
}
146
147     /**
148      * Sets if the command is enabled or disabled.
149      *
150      * @param enabled If set to <code>true</code>, component is enabled.
151      * If set to <code>false</code>, component is disabled.
152      */

153     public void setEnabled(boolean enabled) {
154         ((DeployComponent)component).setEnabled(enabled); // Delegates to component object
155
}
156
157     /**
158      * Sets the directory where the JAR file with client stubs will be saved.
159      *
160      * @param dir The directory where client stubs will be saved.
161      */

162     public void setRetrieveStubs(File JavaDoc stubsDir) {
163         ((DeployComponent)component).setRetrieveStubs(stubsDir); // Delegates to component object
164
}
165
166     /**
167      * Sets the context root for a web module (WAR file). This attribute is only
168      * used when deploying WAR files to the application server.
169      *
170      * @param contextroot The contextroot for the web application.
171      */

172     public void setContextroot(String JavaDoc contextroot) {
173         ((DeployComponent)component).setContextroot(contextroot); // Delegates to component obj
174
}
175
176     /**
177      * Sets the deploymentplan, a jar containing the sun-specifi descriptors which should be
178      * passed along when deploying a pure ear.
179      *
180      * @param deploymentplan
181      */

182     public void setDeploymentplan(File JavaDoc deploymentplan) {
183         ((DeployComponent)component).setDeploymentplan(deploymentplan); // Delegates to component obj
184
}
185     
186     /**
187      * Sets the dbvendorname - the name of database vendor being used.
188      *
189      * @param dbvendorname
190      */

191     public void setDbvendorname(String JavaDoc dbvendorname) {
192         ((DeployComponent)component).setDbvendorname(dbvendorname); // Delegates to component obj
193
}
194     
195     /**
196      * Sets if creates tables at deploy of an application with unmapped CMP beans.
197      *
198      * @param createtables
199      */

200     public void setCreatetables(boolean createtables) {
201         ((DeployComponent)component).setCreatetables(createtables); // Delegates to component object
202
}
203
204     /**
205      * Sets if drops tables at undeploy of an already deployed application with
206      * unmapped CMP beans.
207      *
208      * @param dropandcreatetables
209      */

210     public void setDropandcreatetables(boolean dropandcreatetables) {
211         ((DeployComponent)component).setDropandcreatetables(dropandcreatetables); // Delegates to component object
212
}
213
214     /**
215      * Sets the unique table names for all the beans and results in a hascode added
216      * to the table names.
217      *
218      * @param uniquetablenames
219      */

220     public void setUniquetablenames(boolean uniquetablenames) {
221         ((DeployComponent)component).setUniquetablenames(uniquetablenames); // Delegates to component object
222
}
223
224     /**
225      * Sets availabilityenabled option. If <code>false</code> then all SFSB checkpointing is disabled for
226      * either the given j2ee app or the given ejb module. If it is <code>true</code> then the j2ee app
227      * or stand-alone ejb modules may be ha enabled.
228      *
229      * @param availabilityenabled
230      */

231     public void setAvailabilityenabled(boolean availabilityenabled) {
232         ((DeployComponent)component).setAvailabilityenabled(availabilityenabled); // Delegates to component object
233
}
234
235     /**
236      * Sets generatermistubs option. If <code>true</code> then generate the static RMI-IIOP
237      * stubs and put it in the client.jar.
238      *
239      * @param generatermistubs
240      */

241     public void setGeneratermistubs(boolean generatermistubs) {
242         ((DeployComponent)component).setGeneratermistubs(generatermistubs); // Delegates to component object
243
}
244
245
246     /**
247      * Sets if the command should precompile JSPs when deploying them to the
248      * server.
249      *
250      * @param precompile If set to <code>true</code>, JSPs are automatically
251      * compiled.
252      */

253     public void setPrecompileJsp(boolean precompile) {
254         ((DeployComponent)component).setPrecompileJsp(precompile); // Delegates to component object
255
}
256
257     /**
258      * Sets if the deployment descriptors should be verified as part of the
259      * deployment process.
260      *
261      * @param verify If set to <code>true</code>, the deployment descriptors
262      * will be verified.
263      */

264     public void setVerify(boolean verify) {
265         ((DeployComponent)component).setVerify(verify);
266     }
267
268     /**
269      * Creates a nested <code>server</code> element.
270      *
271      * @return Server which has been added
272      */

273     public Server createServer() {
274         log("createServer using DeployServer object", Project.MSG_DEBUG);
275         Server aNestedServer = new DeployServer(server);
276         servers.add(aNestedServer);
277         return aNestedServer;
278     }
279
280     protected void checkComponentConfig(Server aServer, Component comp)
281             throws BuildException {
282         log("Checking component and server config in DeployTask", Project.MSG_DEBUG);
283
284         DeployServer deployServer = (DeployServer) aServer;
285         DeployComponent deployComp = (DeployComponent) comp;
286
287         // file must be specified
288
File JavaDoc theFile = comp.getFile();
289         if (theFile == null) {
290             throw new BuildException(lsm.getString("ComponentFileMustBeSpecified",
291                          new Object JavaDoc[] {getTaskName()}), getLocation());
292         }
293
294         /*
295          * The file attribute is checked before the superclass implementation.
296          * If the superclass is called first and no file is specified, a
297          * somewhat misleading error message is provided complaining the
298          * component name couldn't be determined.
299          */

300         super.checkComponentConfig(aServer, comp);
301
302         // if an "exploded" archive is being deployed, --upload is not allowed
303
if (theFile.isDirectory() && deployServer.getUpload()) {
304             String JavaDoc hostname = aServer.getHost();
305             if (hostname == null) {
306                 hostname = "localhost";
307             }
308             throw new BuildException(lsm.getString("UploadMayNotBeSetToTrue",
309                          new Object JavaDoc[] {theFile.getAbsolutePath()}),
310                          getLocation());
311         }
312
313         // retrievestubs (if specified) must be a directory
314
File JavaDoc theDir = deployComp.getRetrieveStubs();
315         if (theDir != null) {
316             if (!theDir.exists()) {
317                 throw new BuildException(lsm.getString(
318                              "RetrieveStubsDirectoryDoesNotExist",
319                              new Object JavaDoc[] {theDir}), getLocation());
320             }
321             if (!theDir.isDirectory()) {
322                 throw new BuildException(lsm.getString(
323                                                          "RetrievesStbusDoesNotReferToADirectory",
324                              new Object JavaDoc[] {theDir}), getLocation());
325             }
326         }
327     }
328
329     protected String JavaDoc getCommandString(Server aServer, Component comp)
330                                       throws BuildException {
331         DeployServer deployServer = (DeployServer) aServer;
332         DeployComponent deployComp = (DeployComponent) comp;
333
334         CheckForMutuallyExclusiveAttribute(deployComp);
335
336         StringBuffer JavaDoc cmdString;
337         boolean isFile = comp.getFile().isFile();
338         
339         cmdString = new StringBuffer JavaDoc(isFile ? DEPLOY_COMMAND : DEPLOY_DIR_COMMAND);
340         cmdString.append(aServer.getCommandParameters(true));
341         if (comp.getType() != null) {
342             log(lsm.getString("DeprecatedTypeAttribute"), Project.MSG_WARN);
343         }
344         cmdString.append(" --force=").append(deployComp.isForce());
345         cmdString.append(" --enabled=").append(deployComp.isEnabled());
346         cmdString.append(" --name ").append(comp.getName());
347         cmdString.append(" --verify=").append(deployComp.isVerify());
348         cmdString.append(" --precompilejsp=").append(deployComp.isPrecompileJsp());
349         if (isFile) {
350             cmdString.append(" --upload=").append(deployServer.getUpload());
351         }
352         if (deployServer.getVirtualServers() != null) {
353             cmdString.append(" --virtualservers ");
354             cmdString.append(deployServer.getVirtualServers());
355         }
356
357         if (deployComp.getRetrieveStubs() != null) {
358             cmdString.append(" --retrieve ");
359             cmdString.append("\""+deployComp.getRetrieveStubs()+"\"");
360         }
361         if (deployComp.getDeploymentplan() != null) {
362             cmdString.append(" --deploymentplan ");
363             cmdString.append("\""+deployComp.getDeploymentplan()+"\"");
364         }
365
366         if (deployComp.contextRootIsSet()) {
367             cmdString.append(" --contextroot ").append(deployComp.getContextroot());
368         }
369         if (deployComp.getDbvendorname() != null) {
370             cmdString.append(" --dbvendorname ").append(deployComp.getDbvendorname());
371         }
372         if (deployComp.createtablesIsSet) {
373             cmdString.append(" --createtables=").append(deployComp.getCreatetables());
374             deployComp.createtablesIsSet = false; // set it back to false
375
}
376         if (deployComp.dropandcreatetablesIsSet) {
377             cmdString.append(" --dropandcreatetables=").append(deployComp.getDropandcreatetables());
378             deployComp.dropandcreatetablesIsSet = false; // set it back to false
379
}
380         if (deployComp.uniquetablenamesIsSet) {
381             cmdString.append(" --uniquetablenames=").append(deployComp.getUniquetablenames());
382             deployComp.uniquetablenamesIsSet = false; // set it back to false
383
}
384         if (deployComp.availabilityenabledIsSet) {
385             cmdString.append(" --availabilityenabled=").append(deployComp.getAvailabilityenabled());
386             deployComp.availabilityenabledIsSet = false; // set it back to false
387
}
388         if (deployComp.generatermistubsIsSet) {
389             cmdString.append(" --generatermistubs=").append(deployComp.getGeneratermistubs());
390             deployComp.generatermistubsIsSet = false; // set it back to false
391
}
392
393         // check the value and append target
394
String JavaDoc lTarget = deployComp.getTarget();
395         if ((lTarget != null) && (lTarget.length() > 0)) {
396                 cmdString.append(" --target ").append(lTarget);
397         }
398
399         cmdString.append(" ").append("\""+comp.getFile().getPath()+"\"");
400
401         return cmdString.toString();
402     }
403
404
405         /**
406          * This private class checks for any mutually exclusive attributes.
407          * If mutually exclusive attributes that are specified, then a
408          * BuildException is thrown.
409          */

410     private void CheckForMutuallyExclusiveAttribute(DeployComponent deployComp)
411         throws BuildException
412     {
413         if (deployComp.createtablesIsSet &&
414             deployComp.dropandcreatetablesIsSet ) {
415             final String JavaDoc msg = lsm.getString("MutuallyExclusivelyAttribute",
416                                              new Object JavaDoc[] {"createtables",
417                                                            "dropandcreatetables"});
418             throw new BuildException(msg, getLocation());
419         }
420     }
421     
422
423     /**
424      * This inner class is used to represent administration instances of the
425      * Sun ONE Application Server for the deployment process. The administration
426      * instance may be sent commands which enable users to configure their
427      * application servers.
428      *
429          * @author Greg Nelson <a HREF="mailto:gn@sun.com">gn@sun.com</a>
430      */

431     public class DeployServer extends Server {
432         private boolean upload; // Uploads component to server if true
433
private String JavaDoc virtualServers = null; // Comma-separated list of virtual svrs
434

435         /*
436          * It's easy to determine if reference types have been explicitly set by
437          * the user, since they're null if unset. These variables track whether
438          * or not the boolean attribute have been explictly set by the user or
439          * not.
440          */

441         private boolean uploadIsSet = false;
442
443         private static final boolean DEFAULT_UPLOAD = true;
444
445         /**
446          * Constructs a new DeployServer object without specifying a parent
447          * server from which values are inherited.
448          */

449         public DeployServer() {
450             this(null);
451         }
452
453         /**
454          * Constructs a new DeployServer object and specifies the parent server
455          * from which attribute values are inherited
456          *
457          * @param server The parent server for this object.
458          */

459         public DeployServer(Server theParent) {
460             super(theParent);
461         }
462
463         /**
464          * Set if the component should be transferred to the (potentially)
465          * remote server before executing the command. Defaults to
466          * <code>true</code>.
467          *
468          * @param upload If set to <code>true</code>, components are transferred
469          * to the server before the command is executed.
470          */

471         public void setUpload(boolean upload) {
472             this.upload = upload;
473             uploadIsSet = true; // Indicates that "upload" has been explicitly set
474
}
475
476         /**
477          * Indicates if the component should be transferred to the (potentially)
478          * remote server before executing the command.
479          *
480          * @return <code>true</code> if components are to be transferred to the
481          * server before the command is executed.
482          */

483         protected boolean getUpload() {
484             DeployServer theParent = (DeployServer) getParent();
485             if (!uploadIsSet) {
486                 return (theParent == null) ? DEFAULT_UPLOAD : theParent.getUpload();
487             }
488             return upload;
489         }
490         
491         /**
492          * Specifies the virtual server (or servers) where the component will be
493          * deployed. This applies to only EAR and WAR files.
494          *
495          * @param virtualServers The name of the virtual server or the names of
496          * multiple virtual servers separated by commas (',')
497          */

498         public void setVirtualServers(String JavaDoc virtualServers) {
499             this.virtualServers = virtualServers;
500         }
501
502         /**
503          * Returns the name of the virtual server (or servers) where the
504          * component will be deployed. If multiple servers are specified, the
505          * names will be separated by commas (',')
506          *
507          * @return the name of the virtual server (or servers)
508          */

509         public String JavaDoc getVirtualServers() {
510             return virtualServers;
511         }
512     }
513
514
515     /**
516      * This inner class is used to represent J2EE components deployed to the
517      * Sun ONE Application Server.
518      *
519      * @author Greg Nelson <a HREF="mailto:gn@sun.com">gn@sun.com</a>
520      */

521     public class DeployComponent extends Component {
522         private boolean force; // Overwrites existing component if true
523
private boolean precompile; // Precompiles JSPs on server if true
524
private File JavaDoc stubsDir; // Directory where client stubs are saved
525
private String JavaDoc contextroot; // Context root for web applications
526
private boolean verify; // Verifies descriptors if true
527
private boolean enabled; // Disables or enables the component.
528
// Default is true.
529
private File JavaDoc deploymentplan; // Deployment plan which is a jar containing
530
// the sun-specific descriptors.
531
private boolean availabilityenabled; // If "false" then all SFSB checkpointing is
532
// disabled for either the given j2ee app or
533
// the given ejb module. If it is "true" then
534
// the j2ee app or stand-alone jeb modules may
535
// ha enabled. Default value is "false".
536
private boolean generatermistubs; // If "true" then generate the static RMI-IIOP
537
// stubs and put it in the client.jar.
538
// Default value is "false".
539
private String JavaDoc dbvendorname; // Name of database vendor being used
540
private boolean createtables; // Creates tables at deploy of an application
541
// with unmaped CMP beans
542
private boolean dropandcreatetables; // Drops tables at undeploy of an already
543
// deployed application with unmapped CMP beans.
544
private boolean uniquetablenames; // Guarantees unique table names for all the
545
// beans and results in a hashcode added to
546
// the tablenames.
547

548         /*
549          * It's easy to determine if reference types have been explicitly set by
550          * the user, since they're null if unset. These variables track whether
551          * or not the boolean attribute have been explictly set by the user or
552          * not.
553          */

554         private boolean forceIsSet = false;
555         private boolean enabledIsSet = false;
556         private boolean precompileIsSet = false;
557         private boolean verifyIsSet = false;
558         public boolean createtablesIsSet = false;
559         public boolean dropandcreatetablesIsSet = false;
560         public boolean uniquetablenamesIsSet = false;
561         public boolean availabilityenabledIsSet = false;
562         public boolean generatermistubsIsSet = false;
563         
564
565         /*
566          * Default values for some attributes.
567          */

568         private static final boolean DEFAULT_FORCE = true;
569         private static final boolean DEFAULT_PRECOMPILE = false;
570         private static final boolean DEFAULT_VERIFY = false;
571         private static final boolean DEFAULT_ENABLED = true;
572
573         /**
574          * Constructs a new DeployComponent object and specifies the parent
575          * component from which attribute values are inherited
576          *
577          * @param theParent The parent component for this object.
578          */

579         public DeployComponent(Component theParent) {
580             super(theParent);
581         }
582
583         /**
584          * Sets if the command should overwrite existing values or components.
585          *
586          * @param force If set to <code>true</code>, components are
587          * automatically overwritten. If set to <code>false</code>,
588          * administrative commands will fail if the component already exists.
589          */

590         public void setForce(boolean force) {
591             this.force = force;
592             forceIsSet = true; // Indicates that "force" has been explicitly set
593
}
594
595         /**
596          * Indicates if the command should overwrite existing values or
597          * components.
598          *
599          * @return <code>true</code> if components are to be automatically
600          * overwritten.
601          */

602         protected boolean isForce() {
603             if (!forceIsSet) {
604                 return (parent == null) ? DEFAULT_FORCE : ((DeployComponent)parent).isForce();
605             }
606             return force;
607         }
608         
609         /**
610          * Sets if the command should overwrite existing values or components.
611          *
612          * @param enabled If set to <code>true</code>, component is enabled
613          */

614         public void setEnabled(boolean enabled) {
615             this.enabled = enabled;
616             enabledIsSet = true; // Indicates that "enabled" has been explicitly set
617
}
618
619         /**
620          * @return <code>true</code> if component is to be enabled.
621          */

622         protected boolean isEnabled() {
623             if (!enabledIsSet) {
624                 return (parent == null) ? DEFAULT_ENABLED : ((DeployComponent)parent).isEnabled();
625             }
626             return enabled;
627         }
628
629         /**
630          * Sets <code>false</code> then all SFSB checkingpointing is disabled for either
631          * the given j2ee app or the given ejb module. If it is <code>true</code> then
632          * the j2ee app or stand-alone ejb modules may be ha enabled.
633          * Defaul value is <code>false</code>.
634          *
635          * @param availabilityenabled
636          */

637         public void setAvailabilityenabled(boolean availabilityenabled) {
638             this.availabilityenabled = availabilityenabled;
639             availabilityenabledIsSet = true; // Indicates that "availabilityenabled" has been explicitly set
640
}
641
642         /**
643          * @return <code>true</code> then the j2ee app or stand-alone ejb modules may be
644          * ha enabled.
645          * <code>false</code> then all SFSB checkpointing is disabled for either the
646          * given ejb module.
647          */

648         protected boolean getAvailabilityenabled() {
649             return availabilityenabled;
650         }
651
652         
653         /**
654          * Sets <code>true</code> then generate the static RMI-IIOP stubs and put it
655          * in the client.jar.
656          *
657          * @param generatermistubs
658          */

659         public void setGeneratermistubs(boolean generatermistubs) {
660             this.generatermistubs = generatermistubs;
661             generatermistubsIsSet = true; // Indicates that "availabilityenabled" has been explicitly set
662
}
663
664         /**
665          * @return <code>true</code> then generate the static RMI-IIOP stubs and put
666          * it in the client.jar.
667          */

668         protected boolean getGeneratermistubs() {
669             return generatermistubs;
670         }
671
672         /**
673          * Sets the directory where the JAR file with client stubs will be saved.
674          *
675          * @param dir The directory where client stubs will be saved.
676          */

677         public void setRetrieveStubs(File JavaDoc stubsDir) {
678             this.stubsDir = stubsDir;
679         }
680
681         /**
682          * Returns the directory where the JAR file with client stubs will be
683          * saved.
684          *
685          * @return The directory where client stubs will be saved or <code>null
686          * </code> if no directory has been specified.
687          */

688         protected File JavaDoc getRetrieveStubs() {
689             if (stubsDir == null) {
690                 return (parent == null) ? null : ((DeployComponent)parent).getRetrieveStubs();
691             }
692             return stubsDir;
693         }
694
695         /**
696          * Sets the context root for a web module (WAR file). This attribute is
697          * only used when deploying WAR files to the application server.
698          *
699          * @param contextroot The contextroot for the web application.
700          */

701         public void setContextroot(String JavaDoc contextroot) {
702             this.contextroot = contextroot;
703         }
704
705         /**
706          * Returns the context root for a web module (WAR file).
707          *
708          * @return The contextroot for the web application.
709          */

710         protected String JavaDoc getContextroot() {
711             return (contextroot != null) ? contextroot : getName();
712         }
713
714         /**
715          * Indicates if the user has explicitly set the contextroot attribute.
716          *
717          * @return boolean indicating if the contextroot has been explicitly set.
718          */

719         protected boolean contextRootIsSet() {
720             return (contextroot != null);
721         }
722
723
724         /**
725          * Sets deploymentplan - a jar containing the sun-specific
726          * descriptors which should be passed along when deploying
727          * a pure ear.
728          *
729          * @param deploymentplan - name of the jar file.
730          */

731         public void setDeploymentplan(File JavaDoc deploymentplan) {
732             this.deploymentplan = deploymentplan;
733         }
734
735         /**
736          * Returns the deploymentplan, the name of the jar file
737          * containing the sun-specific descriptors which should
738          * be pssed along with deploying a pure ear.
739          *
740          * @return deploymentplan
741          */

742         protected File JavaDoc getDeploymentplan() {
743             if (deploymentplan == null) {
744                 return (parent == null) ? null : ((DeployComponent)parent).getDeploymentplan();
745             }
746             return deploymentplan;
747         }
748
749         /**
750          * Sets dbvendorname. dbvendorname is the name of database
751          *
752          * @param dbvendorname is the database vendor name
753          */

754         public void setDbvendorname(String JavaDoc dbvendorname) {
755             this.dbvendorname = dbvendorname;
756         }
757
758         /**
759          * Returns the dbvendorname for the database vendor being used
760          *
761          * @return the dbvendorname
762          */

763         protected String JavaDoc getDbvendorname() {
764             return (dbvendorname != null) ? dbvendorname : null;
765         }
766
767         /**
768          * Creates tables at deploy of an application with unmapped CMP beans.
769          *
770          * @param createtables
771          */

772         public void setCreatetables(boolean createtables) {
773             this.createtables = createtables;
774             createtablesIsSet = true; // Indicates that "createtables" has been explicitly set
775
}
776
777         /**
778          * Indicates if the createtables has been set.
779          *
780          * @return <code>true</code> if createtables has been set else return false.
781          */

782         protected boolean getCreatetables() {
783             return createtables;
784         }
785
786         /**
787          * Drop tables at undeploy of an already deployed application with unmapped
788          * CMP beans. If not specified, the tables will be dropped if the
789          * drop-tables-at-undeploy entry in the cmp-resource element of sun-ejb-jar.xml
790          * file is set to true.
791          *
792          * @param dropandcreatetables
793          */

794         public void setDropandcreatetables(boolean dropandcreatetables) {
795             this.dropandcreatetables = dropandcreatetables;
796             dropandcreatetablesIsSet = true; // Indicates that "dropandcreatetables"
797
// has been explicitly set
798
}
799
800         /**
801          * @return the value of dropandcreatetables
802          */

803         protected boolean getDropandcreatetables() {
804             return dropandcreatetables;
805         }
806         
807         /**
808          * Guarantees unique table names for all the beans and results in a hashcode
809          * added to the table names.
810          *
811          * @param uniquetablenames
812          */

813         public void setUniquetablenames(boolean uniquetablenames) {
814             this.uniquetablenames = uniquetablenames;
815             uniquetablenamesIsSet = true; // Indicates that "uniquetablenames"
816
// has been explicitly set
817
}
818
819         /**
820          * @return the value of uniquetablenamse
821          */

822         protected boolean getUniquetablenames() {
823             return uniquetablenames;
824         }
825
826         
827
828         /**
829          * Sets if JSPs should be compiled when deployed to the server.
830          *
831          * @param precompile If set to <code>true</code>, JSPs are automatically
832          * compiled when deployed to the server.
833          */

834         public void setPrecompileJsp(boolean precompile) {
835             this.precompile = precompile;
836             precompileIsSet = true; // Indicates attribute was explicitly set
837
}
838
839         /**
840          * Indicates if JSPs will automatically be compiled when deployed to the
841          * server.
842          *
843          * @return <code>true</code> if JSPs are to be automatically compiled.
844          */

845         protected boolean isPrecompileJsp() {
846             if (!precompileIsSet) {
847                 return (parent == null) ? DEFAULT_PRECOMPILE : ((DeployComponent)parent).isPrecompileJsp();
848             }
849             return precompile;
850         }
851
852         /**
853          * Sets if the deployment descriptors should be verified as part of the
854          * deployment process.
855          *
856          * @param verify If set to <code>true</code>, the deployment descriptors
857          * will be verified.
858          */

859         public void setVerify(boolean verify) {
860             this.verify = verify;
861             verifyIsSet = true; // Indicates attribute was explicitly set
862
}
863
864         /**
865          * Indicates if deployment descriptors will automatically be verified
866          * as part of the deployment process.
867          *
868          * @return <code>true</code> if deployment descriptors will be verified
869          */

870         protected boolean isVerify() {
871             if (!verifyIsSet) {
872                 return (parent == null) ? DEFAULT_VERIFY : ((DeployComponent)parent).isVerify();
873             }
874             return verify;
875         }
876     }
877 }
878
Popular Tags