KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > MyCLI


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  * MyCLI.java
26  *
27  * Created on February 5, 2004, 3:54 PM
28  */

29
30 package com.sun.enterprise.config.backup;
31 import java.util.*;
32 import java.net.*;
33 import com.sun.enterprise.cli.framework.CLIMain;
34 import com.sun.enterprise.cli.framework.InputsAndOutputs;
35
36 /**
37  *
38  * @author Byron Nevins
39  */

40 public class MyCLI
41 {
42
43     /** Creates a new instance of MyCLI */
44     public MyCLI()
45     {
46     }
47
48     /**
49      * @param args the command line arguments
50      */

51     public static void main(String JavaDoc[] args)
52     {
53         try
54         {
55             String JavaDoc drive = "C:";
56             String JavaDoc tempDirDomains = drive + "/tmp/domains";
57             String JavaDoc iasroot = drive + "/ee";
58             System.setProperty("com.sun.aas.instanceRoot", iasroot);
59             System.setProperty("com.sun.aas.domainsRoot", iasroot + "/domains");
60             System.setProperty("com.sun.aas.instanceName", "server");
61             System.setProperty("java.library.path", iasroot + "/bin");
62             System.setProperty("com.sun.aas.configRoot", iasroot + "/config" );
63             System.setProperty("java.endorsed.dirs", iasroot + "/lib/endorsed");
64             //System.setProperty("com.sun.appserv.admin.pluggable.features=com.sun.enterprise.ee.admin.pluggable.EEClientPluggableFeatureImpl
65

66             MyCLI cli = new MyCLI();
67             Enumeration urls = MyCLI.class.getClassLoader().getResources("CLIDescriptor.xml");
68
69             if ((urls == null) || (!urls.hasMoreElements()))
70             {
71                 System.out.println("No URLS");
72             }
73             else
74                 System.out.println(urls);
75
76             while (urls.hasMoreElements())
77             {
78                 URL url = (URL) urls.nextElement();
79                 System.out.println(url);
80             }
81
82             //String cmdline = "restore-domain --domaindir " + tempDirDomains
83
// + " domain1 ";
84
//String cmdline = "restore-domain --domaindir " + tempDirDomains
85
//+ " --filename C:/tmp/domains/domain1/backups/1080108915404.zip " + " domain23 ";
86
//String cmdline = "backup-domain --domaindir " + tempDirDomains + " domain1";
87

88             //String cmdline = "list-backups domain1";
89
String JavaDoc cmdline = "backup-domain domain1 --verbose --description foobarski";
90             //String cmdline = "restore-domain domain1";
91

92
93             System.out.println(cmdline);
94             CLIMain.invokeCLI(cmdline, InputsAndOutputs.getInstance());
95         }
96         catch(Exception JavaDoc e)
97         {
98             e.printStackTrace();
99         }
100     }
101
102 }
103 /*
104  *
105  -Dcom.sun.aas.instanceRoot=$AS_INSTALL
106 -Dcom.sun.aas.instanceName=server
107 -Djava.library.path="d:\ias8ee\bin";"d:\ias8ee\bin"
108 -Dcom.sun.aas.configRoot="d:\ias8ee\config"
109 -Djava.endorsed.dirs="d:\ias8ee\lib\endorsed"
110 -Dcom.sun.appserv.admin.pluggable.features=com.sun.enterprise.ee.admin.pluggable.EEClientPluggableFeatureImpl
111
112
113
114 -cp "d:\ias8ee\lib";"d:\ias8ee\lib\appserv-rt.jar";"d:\ias8ee\lib\appserv-ext.jar";"d:\ias8ee\lib\j2ee.jar";"d:\ias8ee\lib\admin-cli.jar";"d:\ias8ee\lib\appserv-ad
115 min.jar";"d:\ias8ee\lib\commons-launcher.jar";"d:\ias8ee\lib\ant\lib\ant.jar";"d:\ias8ee\lib\ant\lib\optional.jar";"d:\ias8ee\imq\
116 lib\imqadmin.jar";"d:\ias8ee\lib\appserv-se.jar"
117
118
119 com.sun.enterprise.cli.framework.CLIMain
120  **/
Popular Tags