1 17 package org.apache.geronimo.j2ee.j2eeobjectnames; 18 19 import javax.management.ObjectName ; 20 21 24 public class J2eeContextImpl implements J2eeContext { 25 26 private final String domainName; 27 private final String serverName; 28 private final String applicationName; 29 private final String moduleType; 30 private final String moduleName; 31 private final String j2eeName; 32 private final String j2eeType; 33 34 public J2eeContextImpl(String domainName, String serverName, String applicationName, String moduleType, String moduleName, String j2eeName, String j2eeType) { 35 this.domainName = domainName; 36 this.serverName = serverName; 37 this.applicationName = applicationName; 38 this.moduleType = moduleType; 39 this.moduleName = moduleName; 40 this.j2eeName = j2eeName; 41 this.j2eeType = j2eeType; 42 } 43 44 public static J2eeContextImpl newContext(ObjectName source, String moduleType) { 45 return new J2eeContextImpl(source.getDomain(), 46 source.getKeyProperty(NameFactory.J2EE_SERVER), 47 source.getKeyProperty(NameFactory.J2EE_APPLICATION), 48 moduleType, 49 source.getKeyProperty(moduleType), source.getKeyProperty(NameFactory.J2EE_NAME), 51 source.getKeyProperty(NameFactory.J2EE_TYPE)); 52 } 53 54 61 public static J2eeContextImpl newModuleContext(ObjectName source, String moduleType) { 62 return new J2eeContextImpl(source.getDomain(), 63 source.getKeyProperty(NameFactory.J2EE_SERVER), 64 source.getKeyProperty(NameFactory.J2EE_APPLICATION), 65 moduleType, 66 source.getKeyProperty(NameFactory.J2EE_NAME), 67 source.getKeyProperty(NameFactory.J2EE_NAME), 68 source.getKeyProperty(NameFactory.J2EE_TYPE)); 69 } 70 71 public static J2eeContextImpl newModuleContextFromApplication(ObjectName source, String moduleType, String moduleName) { 72 return new J2eeContextImpl(source.getDomain(), 73 source.getKeyProperty(NameFactory.J2EE_SERVER), 74 source.getKeyProperty(NameFactory.J2EE_NAME), moduleType, 76 moduleName, 77 null, 78 null); 79 } 80 81 public static J2eeContextImpl newModuleContextFromApplication(J2eeContext source, String moduleType, String moduleName) { 82 return new J2eeContextImpl(source.getJ2eeDomainName(), 83 source.getJ2eeServerName(), 84 source.getJ2eeApplicationName(), 85 moduleType, 86 moduleName, 87 null, 88 null); 89 } 90 91 public String getJ2eeDomainName() { 92 return domainName; 93 } 94 95 public String getJ2eeServerName() { 96 return serverName; 97 } 98 99 public String getJ2eeApplicationName() { 100 return applicationName; 101 } 102 103 public String getJ2eeModuleType() { 104 return moduleType; 105 } 106 107 public String getJ2eeModuleName() { 108 return moduleName; 109 } 110 111 public String getJ2eeName() { 112 return j2eeName; 113 } 114 115 public String getJ2eeType() { 116 return j2eeType; 117 } 118 119 public String getJ2eeDomainName(String override) { 120 return override == null ? domainName : override; 121 } 122 123 public String getJ2eeServerName(String override) { 124 return override == null ? serverName : override; 125 } 126 127 public String getJ2eeApplicationName(String override) { 128 return override == null ? applicationName : override; 129 } 130 131 public String getJ2eeModuleType(String override) { 132 return override == null ? moduleType : override; 133 } 134 135 public String getJ2eeModuleName(String override) { 136 return override == null ? moduleName : override; 137 } 138 139 public String getJ2eeName(String override) { 141 return override == null ? j2eeName : override; 142 } 143 144 public String getJ2eeType(String override) { 145 return override == null ? j2eeType : override; 146 } 147 } 148 | Popular Tags |