1 23 24 package com.sun.enterprise.management.model; 25 26 import javax.management.ObjectName ; 27 import java.util.Set ; 28 29 public class ResourceAdapterMdl extends J2EEManagedObjectMdl { 30 private static String MANAGED_OBJECT_TYPE = "ResourceAdapter"; 31 32 private String raModuleName = null; 33 private String applicationName = null; 34 private String resourceAdapterName = null; 35 36 public ResourceAdapterMdl(String name, String rarName, String appName) { 37 super(name, false, false, false); 38 raModuleName = rarName; 39 if(appName != null){ 40 this.applicationName = appName; 41 if(J2EEModuleMdl.isStandAloneModule(applicationName)) 42 this.applicationName = "null"; 43 } 44 else { 45 this.applicationName = "null"; 47 } 48 resourceAdapterName = name; 49 } 50 51 public ResourceAdapterMdl(String name, String rarName, String appName, String serverName) { 52 super(name, serverName, false, false, false); 53 raModuleName = rarName; 54 if(appName != null){ 55 this.applicationName = appName; 56 if(J2EEModuleMdl.isStandAloneModule(applicationName)) 57 this.applicationName = "null"; 58 } 59 else { 60 this.applicationName = "null"; 62 } 63 resourceAdapterName = name; 64 } 65 66 69 public String getj2eeType() { 70 return MANAGED_OBJECT_TYPE; 71 } 72 73 77 public String getobjectName() { 78 Set s = findNames("j2eeType="+getj2eeType()+",name="+this.resourceAdapterName+",ResourceAdapterModule="+this.getResourceAdapterModule()+",J2EEApplication="+this.getJ2EEApplication()+",J2EEServer="+this.getJ2EEServer()); 79 Object [] objs = s.toArray(); 80 if (objs.length > 0) { 81 String name = ((ObjectName )objs[0]).toString(); 82 return name; 83 } else { 84 return null; 85 } 86 } 87 88 91 public String getjcaResource() { 92 Set s = findNames("j2eeType=JCAResource,ResourceAdapter="+this.resourceAdapterName+",J2EEServer="+this.getJ2EEServer()); 93 Object [] objs = s.toArray(); 94 if (objs.length > 0) { 95 String name = ((ObjectName )objs[0]).toString(); 96 return name; 97 } else { 98 return null; 99 } 100 } 101 102 105 public String getResourceAdapterModule(){ 106 return raModuleName; 107 } 108 109 112 public String getJ2EEApplication(){ 113 return this.applicationName; 114 } 115 } 116 | Popular Tags |