1 23 24 29 30 package com.sun.enterprise.deployment.backend; 31 32 import javax.enterprise.deploy.shared.ModuleType ; 33 import com.sun.enterprise.deployment.util.XModuleType; 34 import java.io.*; 35 import java.util.*; 36 import java.util.jar.*; 37 import java.util.jar.Manifest ; 38 import java.util.jar.Attributes ; 39 import java.util.jar.Attributes.Name; 40 import java.util.zip.ZipEntry ; 41 import com.sun.enterprise.util.io.FileUtils; 42 import com.sun.enterprise.util.i18n.StringManager; 43 import com.sun.enterprise.deployment.util.DeploymentProperties; 44 45 50 51 public class DeployableObjectType 52 { 53 public boolean isEJB() 54 { 55 return this == EJB; 56 } 57 58 60 public boolean isWEB() 61 { 62 return this == WEB; 63 } 64 65 67 public boolean isAPP() 68 { 69 return this == APP; 70 } 71 72 74 public boolean isCONN() 75 { 76 return this == CONN; 77 } 78 79 81 public boolean isCAR() 82 { 83 return this == CAR; 84 } 85 86 public boolean isLCM() 87 { 88 return this == LCM; 89 } 90 91 public boolean isCMB() 92 { 93 return this == CMB; 94 } 95 96 98 public String toString() 99 { 100 return name; 101 } 102 103 105 public ModuleType getModuleType() 106 { 107 return jsr88Type; 108 } 109 110 112 private DeployableObjectType(String theName, 113 String theDDName, String theRuntimeDD, String ext, ModuleType type) { 114 115 name = theName; 116 ddName = theDDName; 117 runtimeDD = theRuntimeDD; 118 extension = ext; 119 jsr88Type = type; 120 allTypes.add(this); 121 } 122 123 125 public static final DeployableObjectType APP; 126 public static final DeployableObjectType EJB; 127 public static final DeployableObjectType WEB; 128 public static final DeployableObjectType CONN; 129 public static final DeployableObjectType CAR; 130 public static final DeployableObjectType LCM; 131 public static final DeployableObjectType CMB; 132 private final String name; 133 private final String ddName; 134 private final String runtimeDD; 135 private final String extension; 136 private final ModuleType jsr88Type; 137 private static StringManager localStrings = StringManager.getManager(DeployableObjectType.class); 138 private static List allTypes; 139 140 static { 141 allTypes = new ArrayList(7); 142 APP = new DeployableObjectType("Application", 143 "META-INF/application.xml", 144 "META-INF/sun-application.xml", 145 ".ear", ModuleType.EAR); 146 147 WEB = new DeployableObjectType("Web Module", 148 "WEB-INF/web.xml", 149 "WEB-INF/sun-web.xml", 150 ".war", ModuleType.WAR); 151 152 CONN = new DeployableObjectType("Connector Module", 153 "META-INF/ra.xml", 154 "META-INF/sun-ra.xml", 155 ".rar", ModuleType.RAR); 156 157 CAR = new DeployableObjectType("AppClient Module", 158 "META-INF/application-client.xml", 159 "META-INF/sun-application-client.xml", 160 ".jar", ModuleType.CAR); 161 162 EJB = new DeployableObjectType("EJB Module", 163 "META-INF/ejb-jar.xml", 164 "META-INF/sun-ejb-jar.xml", 165 ".jar", ModuleType.EJB); 166 167 LCM = new DeployableObjectType("Lifecycle Module", 168 null, 169 null, 170 ".jar", XModuleType.LCM); 171 172 CMB = new DeployableObjectType("Custom MBean Module", 173 null, 174 null, 175 ".jar", XModuleType.CMB); 176 177 } 178 179 180 182 public static void main(String [] args) 183 { 184 String [] files = new String [] { "pkgingEApp.ear", "foof.rar", "hello.war", "foo.jar", "nothere", "junk.ear", 185 "ear", "ejb", "rar", "war"}; 186 187 for(int i = 0; i < files.length; i++) 188 { 189 File f = new File("C:/ias8samples/" + files[i]); 190 191 try 192 { 193 } 195 catch (Exception ex) 196 { 197 ex.printStackTrace(); 198 } 199 } 200 } 201 } 202 | Popular Tags |