1 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.InputJarArchive; 31 import com.sun.enterprise.deployment.RootDeploymentDescriptor; 32 import com.sun.enterprise.deployment.util.AnnotationDetector; 33 import java.io.File ; 34 import java.io.FileNotFoundException ; 35 import java.io.IOException ; 36 import java.net.MalformedURLException ; 37 import java.net.URI ; 38 import java.net.URISyntaxException ; 39 import java.net.URL ; 40 import java.util.jar.JarEntry ; 41 import java.util.jar.JarFile ; 42 import java.util.logging.Logger ; 43 import org.xml.sax.SAXParseException ; 44 45 50 public class StandAloneAppClientInfo extends AppClientInfo { 51 52 public StandAloneAppClientInfo( 53 boolean isJWS, Logger logger, File archive, 54 Archivist archivist, String mainClassFromCommandLine) 55 throws IOException , ClassNotFoundException , 56 URISyntaxException , SAXParseException { 57 super(isJWS, logger, archive, archivist, mainClassFromCommandLine); 58 } 59 60 protected AbstractArchive expand(File file) 61 throws IOException , Exception { 62 InputJarArchive appArchive = new InputJarArchive (); 63 appArchive.open(file.getAbsolutePath()); 64 return appArchive; 65 } 66 67 protected boolean deleteAppClientDir() { 68 return false; 69 } 70 71 protected void messageDescriptor(RootDeploymentDescriptor d, 72 Archivist archivist, AbstractArchive archive) 73 throws IOException , AnnotationProcessorException { 74 ApplicationClientDescriptor appClient = (ApplicationClientDescriptor)d; 75 appClient.getModuleDescriptor().setStandalone(true); 76 } 77 78 protected boolean classContainsAnnotation( 79 String entry, AnnotationDetector detector, 80 AbstractArchive archive, ApplicationClientDescriptor descriptor) 81 throws FileNotFoundException , IOException { 82 JarFile jar = null; 83 try { 84 jar = new JarFile (archive.getArchiveUri()); 85 JarEntry mainClassEntry = jar.getJarEntry(entry); 86 return detector.containsAnnotation(jar, mainClassEntry); 87 } catch (Throwable thr) { 88 throw new RuntimeException (localStrings.getString( 89 "appclient.errorCheckingAnnos"), thr); 90 } finally { 91 if (jar != null) { 92 try { 93 jar.close(); 94 } catch (IOException ioe) { 95 throw new RuntimeException (localStrings.getString( 96 "appclient.errorClosingJar", archive.getArchiveUri()), ioe); 97 } 98 } 99 } 100 } 101 } 102 | Popular Tags |