KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > deployment > main > Main


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  package com.sun.enterprise.tools.deployment.main;
24
25 import java.util.*;
26 import java.io.*;
27 //Added by Ludo to the Sun ONE Application Server Assembly Tool IASRI4691307
28
import javax.swing.*;
29
30 import com.sun.enterprise.Version;
31 import com.sun.enterprise.util.FileUtil;
32 import com.sun.enterprise.deployment.*;
33 import com.sun.enterprise.tools.packager.ComponentPackager;
34 import com.sun.enterprise.util.LocalStringManagerImpl;
35 import com.sun.enterprise.tools.deployment.backend.JarInstaller;
36 import com.sun.enterprise.resource.ConnectorInfo;
37 import com.sun.enterprise.resource.NameNotFoundException;
38 import com.sun.enterprise.resource.DuplicateNameException;
39 import com.sun.enterprise.resource.ConfigurationPropertyException;
40
41
42 /** This is the entry point for the J2EE Deployment Tool. Use -help for usage help.
43 ** @author Danny Coward
44 */

45
46 public class Main
47 {
48
49     /* -------------------------------------------------------------------------
50     ** Localization
51     */

52
53     private static LocalStringManagerImpl localStrings =
54     new LocalStringManagerImpl(Main.class);
55
56     //private static String VERSION = Version.version; // IASRI 4691307
57
public static String JavaDoc VERSION = "1.0"; // IASRI 4691307 // NOI18N
58
// private static String VERSION =
59
// localStrings.getLocalString(
60
// "enterprise.tools.deployment.main.version",
61
// "1.3");
62

63     private static String JavaDoc NAME =
64     localStrings.getLocalString(
65     "enterprise.tools.deployment.main.name",
66     "Deployment tool version {0}.",
67     new Object JavaDoc[] { VERSION });
68
69     private static String JavaDoc UI_STARTUP_MESSAGE =
70     localStrings.getLocalString(
71     "enterprise.tools.deployment.main.defaultstartupmessage",
72     "Starting Assembly tool, version {0}\n(Type 'assemblytool -help' for command line options.)", // IASRI 4691307
73
new Object JavaDoc[] { VERSION });
74
75     private static String JavaDoc LOG_NAME =
76     localStrings.getLocalString(
77     "enterprise.tools.deployment.main.logname",
78     "Deploytool");
79
80     /* -------------------------------------------------------------------------
81     */

82
83     /** The deploy option.*/
84     public static String JavaDoc DEPLOY_APPLICATION = "-deploy"; // NOI18N
85
private static String JavaDoc EJB_WIZARD = "-ejbWizard"; // NOI18N
86
private static String JavaDoc PACKAGE_EJBS = "-packageEjbs"; // NOI18N
87
private static String JavaDoc LIST_APPLICATIONS = "-listApps"; // NOI18N
88
private static String JavaDoc NO_OVER_WRITE = "-noOverWrite"; // NOI18N
89
private static String JavaDoc DEPLOY_CONNECTOR = "-deployConnector"; // NOI18N
90
private static String JavaDoc UNDEPLOY_CONNECTOR = "-undeployConnector"; // NOI18N
91
private static String JavaDoc LIST_CONNECTORS = "-listConnectors"; // NOI18N
92
private static String JavaDoc ADD_FACTORY = "-addConnectionFactory"; // NOI18N
93
private static String JavaDoc REMOVE_FACTORY = "-removeConnectionFactory"; // NOI18N
94

95     /** The undeploy option.*/
96     public static String JavaDoc UNINSTALL = "-uninstall"; // NOI18N
97
/** Option to generate SQL.*/
98     public static String JavaDoc GENERATE_SQL = "-generateSQL"; // NOI18N
99
/** The overwrite coption for SQL generation.*/
100     public static String JavaDoc DONT_OVER_WRITE_SQL = "-noOverWrite"; // NOI18N
101
/** Option to bring up the UI.*/
102     public static String JavaDoc UI = "-ui"; // NOI18N
103
/** Help option.*/
104     public static String JavaDoc HELP = "-help"; // NOI18N
105

106     /* -------------------------------------------------------------------------
107     */

108
109     /** The main method for the J2EE deployment tool.*/
110     public static void main(String JavaDoc args[]) {
111         
112         com.sun.enterprise.util.Utility.checkJVMVersion();
113 //Added by Ludo to the Sun ONE Application Server Assembly Tool IASRI4691307
114
//This look and feel is more compliant with the NetBeans one. Do not use BOLD for Menus and Labels
115
int uiFontSize=11;
116             java.awt.Font JavaDoc nbDialogPlain = new java.awt.Font JavaDoc ("Dialog", java.awt.Font.PLAIN, uiFontSize); // NOI18N
117
java.awt.Font JavaDoc nbSerifPlain = new java.awt.Font JavaDoc ("Serif", java.awt.Font.PLAIN, uiFontSize); // NOI18N
118
java.awt.Font JavaDoc nbSansSerifPlain = new java.awt.Font JavaDoc ("SansSerif", java.awt.Font.PLAIN, uiFontSize); // NOI18N
119
java.awt.Font JavaDoc nbMonospacedPlain = new java.awt.Font JavaDoc ("Monospaced", java.awt.Font.PLAIN, uiFontSize); // NOI18N
120
UIManager.getDefaults ().put ("Button.font", nbDialogPlain); // NOI18N
121
UIManager.getDefaults ().put ("ToggleButton.font", nbDialogPlain); // NOI18N
122
UIManager.getDefaults ().put ("RadioButton.font", nbDialogPlain); // NOI18N
123
UIManager.getDefaults ().put ("CheckBox.font", nbDialogPlain); // NOI18N
124
UIManager.getDefaults ().put ("ColorChooser.font", nbDialogPlain); // NOI18N
125
UIManager.getDefaults ().put ("ComboBox.font", nbDialogPlain); // NOI18N
126
UIManager.getDefaults ().put ("Label.font", nbDialogPlain); // NOI18N
127
UIManager.getDefaults ().put ("List.font", nbDialogPlain); // NOI18N
128
UIManager.getDefaults ().put ("MenuBar.font", nbDialogPlain); // NOI18N
129
UIManager.getDefaults ().put ("MenuItem.font", nbDialogPlain); // NOI18N
130
UIManager.getDefaults ().put ("RadioButtonMenuItem.font", nbDialogPlain); // NOI18N
131
UIManager.getDefaults ().put ("CheckBoxMenuItem.font", nbDialogPlain); // NOI18N
132
UIManager.getDefaults ().put ("Menu.font", nbDialogPlain); // NOI18N
133
UIManager.getDefaults ().put ("PopupMenu.font", nbDialogPlain); // NOI18N
134
UIManager.getDefaults ().put ("OptionPane.font", nbDialogPlain); // NOI18N
135
UIManager.getDefaults ().put ("Panel.font", nbDialogPlain); // NOI18N
136
UIManager.getDefaults ().put ("ProgressBar.font", nbDialogPlain); // NOI18N
137
UIManager.getDefaults ().put ("ScrollPane.font", nbDialogPlain); // NOI18N
138
UIManager.getDefaults ().put ("Viewport.font", nbDialogPlain); // NOI18N
139
UIManager.getDefaults ().put ("TabbedPane.font", nbDialogPlain); // NOI18N
140
UIManager.getDefaults ().put ("Table.font", nbDialogPlain); // NOI18N
141
UIManager.getDefaults ().put ("TableHeader.font", nbDialogPlain); // NOI18N
142
UIManager.getDefaults ().put ("TextField.font", nbSansSerifPlain); // NOI18N
143
UIManager.getDefaults ().put ("PasswordField.font", nbMonospacedPlain); // NOI18N
144
UIManager.getDefaults ().put ("TextArea.font", nbMonospacedPlain); // NOI18N
145
UIManager.getDefaults ().put ("TextPane.font", nbSerifPlain); // NOI18N
146
UIManager.getDefaults ().put ("EditorPane.font", nbSerifPlain); // NOI18N
147
UIManager.getDefaults ().put ("TitledBorder.font", nbDialogPlain); // NOI18N
148
UIManager.getDefaults ().put ("ToolBar.font", nbDialogPlain); // NOI18N
149
UIManager.getDefaults ().put ("ToolTip.font", nbSansSerifPlain); // NOI18N
150
UIManager.getDefaults ().put ("Tree.font", nbDialogPlain); // NOI18N
151
//End Added by Ludo to the Sun ONE Application Server Assembly Tool IASRI4691307
152

153             /*
154         for (int i=0; i< args.length; i++){
155             System.out.println("args :" + args[i]);
156         }
157         System.out.println("==========");
158         
159         Properties props = System.getProperties();
160         for(Enumeration en = props.propertyNames(); en.hasMoreElements(); ){
161             String key = (String)en.nextElement();
162             System.out.println(key + " = " + (String) (props.get(key)));
163         }
164         System.out.println("======");
165              */

166             
167     /* startup UI */
168     if (args.length == 0) {
169         System.out.println(UI_STARTUP_MESSAGE);
170         new DeployTool(true);
171         return;
172     } else
173     if (args[0].equals(UI)) {
174         new DeployTool(true);
175         return;
176     }
177             
178         //anissa IASRI 4691307
179
if (args[0].equals("-userdir")){ // NOI18N
180
if (args.length >=2){
181                 new DeployTool(true, args[1]);
182                 return;
183             }else {
184                 help();
185             }
186         }
187         help();
188         
189         // anissa IASRI 4691307 commented out all the unsupported option.
190
/* misc */
191         /*
192     if (args[0].equals(LIST_APPLICATIONS)) {
193             if( args.length >= 2 ) {
194                 String server = args[1];
195                 listApplications(server);
196                 return;
197             } else {
198                 help();
199                 return;
200             }
201         } else
202     if (args[0].equals(HELP)) {
203         help();
204         return;
205     } else
206     if (args[0].equals(EJB_WIZARD)) {
207         // XXX no longer supported
208         //new com.sun.enterprise.tools.deployment.ui.NewAppClientWizard(null);
209         return;
210     }
211         */

212         
213     /* command line support */
214         /*
215     DeployTool deployTool = new DeployTool(false);
216
217     if (args[0].equals(DEPLOY_APPLICATION)) {
218             int argIndex = 1;
219             boolean allowRedeploy = true;
220             if (args.length <= argIndex) {
221                 help();
222                 return;
223             }
224             if (args[argIndex].equals(NO_OVER_WRITE)) {
225                 allowRedeploy = false;
226                 argIndex++;
227             }
228         if (args.length < argIndex+2) {
229             help();
230             return;
231         }
232
233         String applicationJar = args[argIndex]; argIndex++;
234         String serverName = args[argIndex]; argIndex++;
235         
236         File clientCodeFile = null;
237         if (args.length > argIndex) {
238             clientCodeFile = new File(args[argIndex]);
239         }
240         // System.out.println("Deploy on:" + serverName);
241                 String applicationName = null;
242                 File applicationJarFile = new File(applicationJar);
243         try {
244                     applicationName = ApplicationArchivist.getApplicationName(new File(applicationJar));
245         } catch (Exception ioe) {
246             ioe.printStackTrace();
247             Log.print(LOG_NAME, localStrings.getLocalString(
248             "enterprise.tools.deployment.main.warning",
249             "{0}", new Object[] {ioe.getMessage()}));
250             System.exit(1);
251         }
252         try {
253
254                     boolean isInstalled =
255                         deployTool.getServerManager().isInstalled(applicationName, serverName);
256             if (isInstalled) {
257                             if (!allowRedeploy) {
258                     Log.print(LOG_NAME, localStrings.getLocalString(
259                     "enterprise.tools.deployment.main.logmessagetodeploy",
260                     "To deploy the application {0} must be uninstalled before it can be re-deployed", new Object[] {applicationName}));
261                     System.exit(1);
262                 }
263                         else {
264                             System.out.println("Note : application " + applicationName +
265                                 " is already installed. Redeploying...");
266                         }
267             }
268             deployTool.deploy(applicationName, applicationJarFile, serverName, null, clientCodeFile);
269         } catch (Exception t) {
270             Log.print(LOG_NAME, localStrings.getLocalString(
271             "enterprise.tools.deployment.main.warning",
272             "{0}", new Object[] {t.getMessage()}));
273             System.exit(1);
274         }
275         System.exit(0);
276     }
277
278     if (args[0].equals(PACKAGE_EJBS)) {
279         if (args.length < 5) {
280             help();
281             return;
282         }
283         String codebase = args[1];
284         String classes = args[2];
285         String descriptorFile = args[3];
286         String jarFile = args[4];
287         Vector classNames = new Vector();
288         StringTokenizer st = new StringTokenizer(classes, ":");
289         while(st.hasMoreTokens()) {
290             classNames.addElement(st.nextToken());
291         }
292         String optionalEjbBundleFilename = "";
293         String optionalRuntimeFiename = "";
294         if (args.length > 5) {
295             if (args[5] != null) {
296             optionalEjbBundleFilename = args[5];
297             }
298             if (args[6] != null) {
299             optionalRuntimeFiename = args[6];
300             }
301         }
302         try {
303             deployTool.getComponentPackager().packageEjbs(codebase, classNames,
304             descriptorFile, jarFile, optionalEjbBundleFilename, optionalRuntimeFiename);
305         } catch (Exception e) {
306             deployTool.getComponentPackager().handlePackagingException(e);
307             System.exit(1);
308         }
309         System.exit(0);
310     }
311         
312          
313         
314     if (args[0].equals(UNINSTALL)) {
315         if (args.length < 3) {
316             help();
317             return;
318         }
319         String applicationName = args[1];
320         String serverName = args[2];
321         try {
322             if (deployTool.getServerManager().isInstalled(applicationName, serverName)) {
323             deployTool.getServerManager().undeployApplication(applicationName, serverName);
324             Log.print(LOG_NAME, localStrings.getLocalString(
325                 "enterprise.tools.deployment.main.applicationuninstalledfromserver",
326                 "The application {0} was uninstalled from {1}", new Object[] {applicationName, serverName}));
327             } else {
328             Log.print(LOG_NAME, localStrings.getLocalString(
329                 "enterprise.tools.deployment.main.applicationnotdeployed",
330                 "The application {0} is not deployed on {1}", new Object[] {applicationName, serverName}));
331             }
332             return;
333         } catch (Exception e) {
334             Log.print(LOG_NAME, e.getMessage());
335             System.exit(1);
336         }
337     }
338
339     if (args[0].equals(GENERATE_SQL)) {
340         String applicationFilename = args[1];
341         String serverName = args[2];
342         boolean overWrite = true;
343         if (args.length > 3) {
344             if (args[3].equals(DONT_OVER_WRITE_SQL)) {
345             overWrite = false;
346             }
347         }
348                 // Call sql generator for all ejb-jars in the application.
349                 // Set VM return codes as follows based on results :
350                 // 0 : no errors
351                 // 1 : EJB QL error
352                 // 2 : other type of error
353                 // NOTE : This return code behavior is NOT a publicly documented contract.
354                 // It is an internal contract used for testing purposes and is
355                 // subject to change.
356         try {
357             deployTool.doGenerateSQL(applicationFilename, serverName, overWrite);
358                 } catch (com.sun.ejb.ejbql.EjbQLParseException e) {
359                     e.printStackTrace();
360                     System.exit(1);
361         } catch (Throwable t) {
362             t.printStackTrace();
363             System.exit(2);
364         }
365         return;
366     }
367
368     if (args[0].equals(DEPLOY_CONNECTOR)) {
369
370                 if (args.length != 3) help();
371                 int i = 1;
372                 String rarFilename = args[i++];
373                 String serverName = args[i++];
374
375                 try {
376                     JarInstaller backend = deployTool.getServerManager().
377                         getServerForName(serverName);
378                     File file = new File(rarFilename);
379                     if (!file.exists()) {
380                         System.out.println(localStrings.getLocalString
381                                            ("deploytool.msg001",
382                                             "File does not exist: {0}",
383                                             new Object[] {file.toString()}));
384                         System.exit(1);
385                     }
386                     if (!ConnectorArchivist.isConnector(file)) {
387                         System.out.println(localStrings.getLocalString
388                                            ("deploytool.msg002",
389                                          "File is not a resource archive: {0}",
390                                             new Object[] {file.toString()}));
391                         System.exit(1);
392                     }
393                     byte[] data = new byte[(int) file.length()];
394                     DataInputStream ds =
395                         new DataInputStream(new BufferedInputStream
396                                             (new FileInputStream(file)));
397                     ds.readFully(data);
398                     String name = file.getName();
399                     backend.deployConnector(data, name);
400                     System.out.println(localStrings.getLocalString
401                                        ("deploytool.msg003",
402                                         "Resource adapter {0} is deployed successfully", new Object[] {name}));
403                 } catch (Exception ex) {
404                     handleDeploymentException(ex);
405                 }
406                 return;
407     }
408
409     // XXX still used by CTS. Should remove at FCS
410     if (args[0].equals(ADD_FACTORY)) {
411
412                 if (args.length < 4) help();
413                 int i = 1;
414                 String name = args[i++];
415                 String jndiName = args[i++];
416                 String serverName = args[i++];
417                 Properties props = new Properties();
418                 while (i < args.length) {
419                     String str = args[i++];
420                     int idx = str.indexOf('=');
421                     String propName = str.substring(0, idx);
422                     String val = str.substring(idx + 1);
423                     // strip out delimiters
424                     if (val.startsWith("\"") &&
425                         val.endsWith("\"")) {
426                         val = val.substring(1, val.length() - 1);
427                     }
428                     if (val.startsWith("'") &&
429                         val.endsWith("'")) {
430                         val = val.substring(1, val.length() - 1);
431                     }
432                     props.put(propName, val);
433                 }
434
435                 try {
436                     JarInstaller backend = deployTool.getServerManager().
437                         getServerForName(serverName);
438                     String appName = null;
439                     String connectorName = name;
440                     int index = name.indexOf(':');
441                     if (index != -1) {
442                         appName = name.substring(0, index);
443                         connectorName = name.substring(index+1);
444                     }
445                     // XXX - should pass user/password
446                     backend.addConnectionFactory(appName, connectorName,
447                                                  jndiName, null, null,
448                                                  props);
449                     System.out.println("Connector factory " + jndiName +
450                                        " is added successfully");
451                 } catch (Exception ex) {
452                     handleDeploymentException(ex);
453                 }
454                 return;
455     }
456
457     // XXX still used by CTS. Should remove at FCS
458     if (args[0].equals(REMOVE_FACTORY)) {
459                 if (args.length != 3) help();
460                 int i = 1;
461                 String jndiName = args[i++];
462                 String serverName = args[i++];
463                 try {
464                     JarInstaller backend = deployTool.getServerManager().
465                         getServerForName(serverName);
466                     backend.removeConnectionFactory(jndiName);
467                     System.out.println("Connector factory " + jndiName +
468                                        " is removed successfully");
469                 } catch (Exception ex) {
470                     handleDeploymentException(ex);
471                 }
472                 return;
473     }
474
475     if (args[0].equals(UNDEPLOY_CONNECTOR)) {
476                 if (args.length != 3) help();
477                 int i = 1;
478                 String name = args[i++];
479                 String serverName = args[i++];
480
481                 try {
482                     JarInstaller backend = deployTool.getServerManager().
483                         getServerForName(serverName);
484                     backend.undeployConnector(name);
485                     System.out.println(localStrings.getLocalString(
486                         "deploytool.msg004",
487                         "Resource adapter {0} is undeployed successfully", new Object[] {name}));
488                 } catch (NameNotFoundException ex) {
489                     String msg = localStrings.getLocalString
490                         ("connector.not.found", "",
491                          new Object[] {name});
492                     System.out.println(msg);
493                 } catch (Exception ex) {
494                     handleDeploymentException(ex);
495                 }
496                 return;
497     }
498
499     if (args[0].equals(LIST_CONNECTORS)) {
500
501                 if (args.length != 2) help();
502                 int j = 1;
503                 String serverName = args[j++];
504
505                 try {
506                     JarInstaller backend = deployTool.getServerManager().getServerForName(serverName);
507                     ConnectorInfo v = backend.listConnectors();
508                     if (v.connectors.length == 0) {
509                         System.out.println
510                             (localStrings.getLocalString
511                              ("no.connector.installed", ""));
512                     } else {
513                         System.out.println
514                             (localStrings.getLocalString
515                              ("installed.connectors", ""));
516                         int size = v.connectors.length;
517                         for (int i=0; i<size; i++) {
518                             String msg = localStrings.getLocalString
519                                 ("connector.info", "",
520                                  new Object[] {
521                                     v.connectors[i]
522                                  });
523                             System.out.println(msg);
524                         }
525                     }
526                     System.out.println();
527                     if (v.connectionFactories.length == 0) {
528                         System.out.println
529                             (localStrings.getLocalString
530                              ("no.factories.installed", ""));
531                     } else {
532                         System.out.println
533                             (localStrings.getLocalString
534                              ("installed.factories", ""));
535                         int size = v.connectionFactories.length;
536                         for (int i=0; i<size; i++) {
537                             String msg = localStrings.getLocalString
538                                 ("factory.info", "",
539                                  new Object[] {
540                                     v.connectionFactories[i]
541                                  });
542                             System.out.println(msg);
543                         }
544                     }
545                     
546                 } catch (Exception ex) {
547                     handleDeploymentException(ex);
548                 }
549                 return;
550     }
551
552     // otherwise....
553     help();
554          *
555          *
556          * IASRI 4691307 ENd of commented code.
557          */

558
559     }
560    
561     /** Prints out the deploytool help message.*/
562     public static void help() {
563
564     System.out.println(localStrings.getLocalString
565                            ("enterprise.tools.deployment.main.deploymenttoolversion", "The deployment tool version is {0}", new Object JavaDoc[] {VERSION})); // NOI18N
566

567     System.out.println(localStrings.getLocalString
568                            ("enterprise.tools.deployment.main.options",
569                             "Options:"));
570         System.out.print(" "); // NOI18N
571

572         /* IASRI 4691307 remove help msg for unsupported options.
573          *
574     System.out.println(localStrings.getLocalString
575                            ("enterprise.tools.deployment.main.runstoolwithUI",
576                             "{0} Runs the tool with a UI (default mode)", new Object[] {UI}));
577         System.out.print(" ");
578     System.out.println(localStrings.getLocalString
579                            ("enterprise.tools.deployment.main.displayhelpmessage", "{0} Display this help message", new Object[] {HELP}));
580         System.out.print(" ");
581     System.out.println(localStrings.getLocalString
582                            ("enterprise.tools.deployment.main.lastparameteroptional", "{0} <ear file> <server name> [<client jar>]", new Object[] {DEPLOY_APPLICATION}));
583         System.out.print(" ");
584     System.out.println(localStrings.getLocalString
585                            ("enterprise.tools.deployment.main.uninstallapplicationfromserver", "{0} <application name> <server name>", new Object[] {UNINSTALL}));
586         System.out.print(" ");
587     System.out.println(localStrings.getLocalString
588                ("enterprise.tools.deployment.main.listApps",
589                 "{0} <server name>", new Object[] {LIST_APPLICATIONS}));
590     System.out.print(" ");
591     System.out.println(localStrings.getLocalString
592                ("enterprise.tools.deployment.main.deployConnector",
593                 "{0} <rar filename> <server name>",
594                 new Object[] {DEPLOY_CONNECTOR}));
595     System.out.print(" ");
596     System.out.println(localStrings.getLocalString
597                ("enterprise.tools.deployment.main.undeployConnector",
598                 "{0} <rar filename> <server name>",
599                 new Object[] {UNDEPLOY_CONNECTOR}));
600     System.out.print(" ");
601     System.out.println(localStrings.getLocalString
602                ("enterprise.tools.deployment.main.listConnectors",
603                 "{0} <server name>",
604                 new Object[] {LIST_CONNECTORS}));
605         System.out.print(" ");
606     System.out.println(localStrings.getLocalString
607                            ("enterprise.tools.deployment.main.generateSQL",
608                 "{0} <ear file> <server name> [-noOverWrite]",
609                 new Object[] {GENERATE_SQL}));
610          * End of changes IASRI 4691307
611         */

612         
613         // Add -userdir option IASRI 4691307
614
System.out.println("-userdir <userdir>"); // NOI18N
615

616     System.exit(1);
617     }
618
619     public static void listApplications(String JavaDoc serverName) {
620         try {
621             DeployTool deployTool = new DeployTool(false);
622             JarInstaller backend = deployTool.getServerManager().getServerForName(serverName);
623             Vector deployedApps = backend.getApplicationNames();
624             if( deployedApps.size() > 0 ) {
625                 System.out.println(localStrings.getLocalString
626                         ("enterprise.tools.deployment.main.followingapps",
627                                 "The following apps are deployed on {0}:",
628                                 new Object JavaDoc[] {serverName}));
629                 for(int appIndex = 0; appIndex < deployedApps.size(); appIndex++) {
630                     System.out.println("\t" + (String JavaDoc) deployedApps.elementAt(appIndex)); // NOI18N
631
}
632             }
633             else {
634                 System.out.println(localStrings.getLocalString
635                         ("enterprise.tools.deployment.main.nodeployedapps", // NOI18N
636
"There are no deployed applications on {0}", // NOI18N
637
new Object JavaDoc[] {serverName}));
638             }
639         }
640         catch(Exception JavaDoc e) {
641             // @@@
642
Log.print(LOG_NAME, e.getMessage());
643         }
644     }
645
646     static private void handleDeploymentException(Exception JavaDoc ex) {
647         if (ex instanceof DuplicateNameException) {
648             String JavaDoc msg = localStrings.getLocalString
649                 ("duplicatename.exception", "",
650                  new Object JavaDoc[] {ex.getMessage()});
651             System.err.println(msg);
652         } else if (ex instanceof NameNotFoundException) {
653             String JavaDoc msg = localStrings.getLocalString
654                 ("namenotfound.exception", "",
655                  new Object JavaDoc[] {ex.getMessage()});
656             System.err.println(msg);
657         } else if (ex instanceof ConfigurationPropertyException) {
658             String JavaDoc msg = localStrings.getLocalString
659                 ("configproperty.exception", "",
660                  new Object JavaDoc[] {ex.getMessage()});
661             System.err.println(msg);
662         } else {
663             String JavaDoc msg = localStrings.getLocalString
664                 ("generic.exception", "",
665                  new Object JavaDoc[] {ex.toString()});
666             System.err.println(msg);
667         }
668     }
669
670 }
671
672
Popular Tags