1 26 27 package org.objectweb.jonas.ear; 28 29 import java.net.URL ; 30 import java.util.ArrayList ; 31 32 import javax.management.MalformedObjectNameException ; 33 import javax.management.ObjectName ; 34 35 import org.objectweb.jonas.jmx.J2eeObjectName; 36 import org.objectweb.jonas.management.j2eemanagement.J2EEDeployedObject; 37 38 49 public class Ear extends J2EEDeployedObject implements EarMBean { 50 51 54 private URL [] ejbJars = null; 55 56 57 60 private URL [] wars = null; 61 62 65 private URL [] rars = null; 66 67 70 private URL earUrl = null; 71 72 75 private String name = null; 76 77 80 private String unpackName = null; 81 82 85 private String [] modules = null; 86 87 90 private String [] webModules = null; 91 92 103 public Ear(String objectName, String pName, String pUnpackName, URL earUrl, String deploymentDescriptor, URL [] ejbJars, URL [] wars, 104 URL [] rars) { 105 super(objectName); 106 this.earUrl = earUrl; 107 setDeploymentDescriptor(deploymentDescriptor); 109 this.ejbJars = ejbJars; 110 this.wars = wars; 111 this.rars = rars; 112 name = pName; 113 unpackName = pUnpackName; 114 setModules(); 115 setWebModules(); 116 } 117 118 122 public URL getEarUrl() { 123 return earUrl; 124 } 125 126 130 public URL [] getEjbJars() { 131 return ejbJars; 132 } 133 134 138 public URL [] getWars() { 139 return wars; 140 } 141 142 146 public URL [] getRars() { 147 return rars; 148 } 149 150 154 public String getName() { 155 return name; 156 } 157 158 162 public String getUnpackName() { 163 return unpackName; 164 } 165 166 169 private void setModules() { 170 ArrayList al = new ArrayList (); 171 try { 172 ObjectName on = ObjectName.getInstance(getObjectName()); 174 String domain = on.getDomain(); 175 String serverName = on.getKeyProperty(J2EE_TYPE_SERVER); 176 String appName = on.getKeyProperty(NAME); 177 ObjectName modulesOn = J2eeObjectName.getEJBModules(domain, serverName, appName); 179 al.addAll(J2eeObjectName.queryStrings(modulesOn)); 180 modulesOn = J2eeObjectName.getWebModules(domain, serverName, appName); 182 al.addAll(J2eeObjectName.queryStrings(modulesOn)); 183 modulesOn = J2eeObjectName.getResourceAdapterModules(domain, serverName, appName); 185 al.addAll(J2eeObjectName.queryStrings(modulesOn)); 186 modulesOn = J2eeObjectName.getAppClientModules(domain, serverName, appName); 188 al.addAll(J2eeObjectName.queryStrings(modulesOn)); 189 } catch (MalformedObjectNameException e) { 190 throw new RuntimeException ("Error while using an objectname", e); 192 } 193 modules = ((String []) al.toArray(new String [al.size()])); 194 } 195 199 public String [] getModules() { 200 return modules; 201 } 202 205 public String [] getWebModules() { 206 return webModules; 207 } 208 211 public void setWebModules() { 212 ArrayList al = new ArrayList (); 213 try { 214 ObjectName on = ObjectName.getInstance(getObjectName()); 216 String domain = on.getDomain(); 217 String serverName = on.getKeyProperty(J2EE_TYPE_SERVER); 218 String appName = on.getKeyProperty(NAME); 219 ObjectName modulesOn = J2eeObjectName.getWebModules(domain, serverName, appName); 221 al.addAll(J2eeObjectName.queryStrings(modulesOn)); 222 } catch (MalformedObjectNameException e) { 223 throw new RuntimeException ("Error while using an objectname", e); 225 } 226 webModules = ((String []) al.toArray(new String [al.size()])); 227 } 228 } | Popular Tags |