1 23 package com.sun.enterprise.diagnostics; 24 25 import java.io.File ; 26 import java.util.logging.Level ; 27 28 32 public class PELocalTargetResolver extends TargetResolver { 33 34 35 public PELocalTargetResolver(String target, String repositoryDir, boolean local) { 36 super(target,repositoryDir,local); 37 } 38 39 48 public boolean validateTarget() throws DiagnosticException { 49 if(repositoryDir != null && target != null){ 50 logger.log(Level.FINEST, "validate_local_target" , new String []{target, repositoryDir}); 51 return isAInstance(repositoryDir,target); 52 } throw new DiagnosticException("Targetdir and targetname are null"); 54 } 55 56 private boolean isAInstance(String repositoryDir, String target) { 57 if(repositoryDir != null && target != null){ 58 String absoluteDir = repositoryDir + File.separator + target; 59 File applicationsDirObj = new File (absoluteDir + 60 Constants.APPLICATIONS_DIR); 61 File generatedDirObj = new File (absoluteDir + 62 Constants.GENERATED_DIR); 63 File configDirObj = new File (absoluteDir + 64 Constants.CONFIG_DIR); 65 if(applicationsDirObj.exists() && 66 generatedDirObj.exists() && 67 configDirObj.exists()) 68 return true; 69 return false; 70 } return false; 72 } 73 74 protected void determineRepositoryDetails() { 75 repositoryName = target; 76 } 77 78 protected void setExecutionContext() { 79 context = ExecutionContext.LOCAL_EC; 80 81 } 82 83 protected void determineTargetType() { 84 if(type == null) 85 setTargetType(TargetType.DAS); 86 } 87 88 protected void determineTargetDir() { 89 } 91 92 protected void determineInstances(){ 93 addInstance(TargetType.DAS.getType()); 94 } 95 96 } 97 | Popular Tags |