KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > annotation > impl > AppClientScanner


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.deployment.annotation.impl;
24
25 import java.io.File JavaDoc;
26 import java.io.FileFilter JavaDoc;
27 import java.io.FileInputStream JavaDoc;
28 import java.io.IOException JavaDoc;
29 import java.io.FileNotFoundException JavaDoc;
30 import java.util.Enumeration JavaDoc;
31 import java.util.logging.Level JavaDoc;
32 import java.util.jar.JarFile JavaDoc;
33 import java.util.jar.JarEntry JavaDoc;
34
35 import java.nio.channels.Channels JavaDoc;
36 import java.nio.channels.ReadableByteChannel JavaDoc;
37
38 import com.sun.enterprise.deployment.ApplicationClientDescriptor;
39 import com.sun.enterprise.deployment.ServiceReferenceDescriptor;
40
41 /**
42  * Implementation of the Scanner interface for AppClient
43  *
44  * @author Shing Wai Chan
45  */

46 public class AppClientScanner extends ModuleScanner {
47     private ApplicationClientDescriptor descriptor;
48     
49     public AppClientScanner(File JavaDoc archiveFile, ApplicationClientDescriptor desc)
50             throws IOException JavaDoc {
51         this(archiveFile, desc, null);
52     }
53
54     /**
55      * This scanner will scan the given main class for annotation processing.
56      * The archiveFile and libJarFiles correspond to classpath.
57      * @param archiveFile
58      * @param descriptor
59      * @param classLoader
60      */

61     public AppClientScanner(File JavaDoc archiveFile, ApplicationClientDescriptor desc,
62             ClassLoader JavaDoc classLoader) throws IOException JavaDoc {
63         if (AnnotationUtils.getLogger().isLoggable(Level.FINE)) {
64             AnnotationUtils.getLogger().fine("archiveFile is " + archiveFile);
65             AnnotationUtils.getLogger().fine("classLoader is " + classLoader);
66         }
67         this.descriptor = desc;
68
69         //always add main class
70
String JavaDoc mainClassName = desc.getMainClassName();
71         addScanClassName(mainClassName);
72
73         // add callback handle if it exist in appclient-client.xml
74
String JavaDoc callbackHandler = desc.getCallbackHandler();
75         if (callbackHandler != null && !callbackHandler.trim().equals("")) {
76             addScanClassName(desc.getCallbackHandler());
77         }
78
79         this.classLoader = classLoader;
80         this.archiveFile = archiveFile;
81     }
82 }
83
Popular Tags