KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > appclient > ClassFileAppClientInfo


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 package com.sun.enterprise.appclient;
25
26 import com.sun.enterprise.deployment.annotation.AnnotationProcessorException;
27 import com.sun.enterprise.deployment.ApplicationClientDescriptor;
28 import com.sun.enterprise.deployment.archivist.Archivist;
29 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive;
30 import com.sun.enterprise.deployment.deploy.shared.FileArchive;
31 import com.sun.enterprise.deployment.RootDeploymentDescriptor;
32 import java.io.File JavaDoc;
33 import java.io.IOException JavaDoc;
34 import java.net.MalformedURLException JavaDoc;
35 import java.net.URI JavaDoc;
36 import java.net.URISyntaxException JavaDoc;
37 import java.net.URL JavaDoc;
38 import java.util.logging.Logger JavaDoc;
39
40 /**
41  * Represents an app client specified by a .class file on the command line.
42  * @author tjquinn
43  */

44 public class ClassFileAppClientInfo extends AppClientInfo {
45     
46     /** the class file name specified on the command line */
47     private String JavaDoc classFileFromCommandLine;
48     
49     /**
50      *Creates a new instance of the class file app client info.
51      *@param isJWS whether Java Web Start was used to launch the app client
52      *@param logger the Logger available for writing log messages
53      *@param archive the archive containing the app client (and perhaps other files as well)
54      *@param archivist the archivist appropriate to the type of archive being processed
55      *@param mainClassFromCommandLine the main class command-line argument value
56      *@param classFileFromCommandLine the class file name from the command line arguments
57      */

58     protected ClassFileAppClientInfo(
59             boolean isJWS, Logger JavaDoc logger, File JavaDoc archive,
60             Archivist archivist, String JavaDoc mainClassFromCommandLine,
61             String JavaDoc classFileFromCommandLine) {
62         super(isJWS, logger, archive, archivist, mainClassFromCommandLine);
63         this.classFileFromCommandLine = classFileFromCommandLine;
64     }
65
66     protected String JavaDoc getMainClassNameToRun(ApplicationClientDescriptor acDescr) {
67         return classFileFromCommandLine;
68     }
69
70     protected void messageDescriptor(RootDeploymentDescriptor d,
71         Archivist archivist, AbstractArchive archive)
72             throws IOException JavaDoc, AnnotationProcessorException {
73         ApplicationClientDescriptor appClient = (ApplicationClientDescriptor)d;
74         appClient.setMainClassName(classFileFromCommandLine);
75         appClient.getModuleDescriptor().setStandalone(true);
76         archivist.processAnnotations(appClient, archive);
77     }
78     
79     protected AbstractArchive expand(File JavaDoc file)
80         throws IOException JavaDoc, Exception JavaDoc {
81         FileArchive appArchive = new FileArchive();
82         appArchive.open(file.getAbsolutePath());
83         return appArchive;
84     }
85
86     protected boolean deleteAppClientDir() {
87         return false;
88     }
89 }
90
Popular Tags