1 23 package com.sun.enterprise.diagnostics; 24 25 import com.sun.enterprise.config.ConfigContext; 26 import com.sun.enterprise.config.ConfigException; 27 import com.sun.enterprise.config.serverbeans.ServerHelper; 28 import com.sun.enterprise.server.ApplicationServer; 29 import com.sun.enterprise.server.ServerContext; 30 import java.io.File ; 31 import java.util.logging.Level ; 32 33 37 public class PERemoteTargetResolver extends TargetResolver { 38 39 private static final String REPOSITORY_CONFIG_CLASS_NAME = 40 "com.sun.enterprise.admin.servermgmt.DomainConfig"; 41 private static final String GET_REP_ROOT_METHOD ="getRepositoryRoot"; 42 private static final String GET_REP_NAME = "getRepositoryName"; 43 44 45 public PERemoteTargetResolver(String target, String repositoryDir, boolean local) { 46 super(target,repositoryDir,local); 47 } 48 49 50 public boolean validateTarget() throws DiagnosticException { 51 ConfigContext configContext = getServerContext().getConfigContext(); 52 try { 53 String domainName = ServerHelper.getAdministrativeDomainName( 54 configContext,null); 55 56 if(domainName != null) 57 return domainName.equals(target); 58 } catch(ConfigException ce) { 59 throw new DiagnosticException("Couldn't determine domain name"); 60 } 61 throw new DiagnosticException("Couldn't determine domain name"); 62 } 63 64 65 protected ServerContext getServerContext() { 66 return ApplicationServer.getServerContext(); 67 } 68 69 protected void setExecutionContext() { 70 context = ExecutionContext.REMOTE_EC; 71 } 72 73 protected void determineRepositoryDetails() { 74 File instanceRoot = new File (getServerContext(). 75 getInstanceEnvironment().getInstancesRoot()); 76 repositoryDir = instanceRoot.getParentFile().getAbsolutePath(); 77 repositoryName = instanceRoot.getName(); 78 79 logger.log(Level.FINE, "diagnostic-service.resolver_repositoryDetails", 80 new Object [] {repositoryDir, repositoryName}); 81 102 } 103 104 protected void determineTargetType() { 105 if(type == null) 106 setTargetType(TargetType.DAS); 107 } 108 109 protected void determineInstances(){ 110 addInstance(TargetType.DAS.getType()); 111 } 112 113 114 } 115 | Popular Tags |