FileDocCategorySizeDatePackage
TargetResolver.javaAPI DocGlassfish v2 API6001Fri May 04 22:34:40 BST 2007com.sun.enterprise.diagnostics

TargetResolver

public abstract class TargetResolver extends Object
author
mu125243

Fields Summary
protected String
target
protected String
repositoryName
protected String
repositoryDir
protected boolean
local
protected TargetType
type
protected List
instances
protected ReportTarget
reportTarget
protected List
serviceConfigs
protected ExecutionContext
context
protected static final String
DEFAULT_FEATURES_PROPERTY_CLASS
protected Logger
logger
Constructors Summary
public TargetResolver(String target, String repositoryDir, boolean local)
Creates a new instance of TargetResolver

           
           
        this.target = target;
        this.repositoryDir = repositoryDir;
        this.local = local;
    
Methods Summary
protected voidaddInstance(java.lang.String instanceName)

        instances.add(instanceName);
    
protected voidaddServiceConfig(java.lang.String instanceName)

        String instanceRepDir = repositoryDir + File.separator +
                            repositoryName ;

        if ((!(instanceName.equals(Constants.SERVER))) &&
                (!(type.equals(TargetType.INSTANCE)))){
            // for example in case of node agent this value would be
            //nodeagents/na1/instance1
            instanceRepDir = instanceRepDir + File.separator + instanceName;
        }
                    
                
        ServiceConfig instanceConfig = ServiceConfigFactory.getInstance().
                        getServiceConfig(context.isLocal(), instanceRepDir, 
                        instanceName);
        if(instanceConfig != null)
            serviceConfigs.add(instanceConfig);
    
protected voidcreateTarget()

        setExecutionContext();
        initLogger();
        determineTargetDetails();
        createTargetObject();
    
protected voidcreateTargetObject()

        reportTarget = new ReportTarget(repositoryDir, repositoryName, target,
        type, instances, local);
    
protected abstract voiddetermineInstances()

protected abstract voiddetermineRepositoryDetails()

protected voiddetermineServiceConfigs()

        if(instances != null) {
            Iterator<String> iterator = instances.iterator();
            while(iterator.hasNext()) {
                addServiceConfig(iterator.next());
            }
        }
    
protected voiddetermineTargetDetails()

        //determineTargetDir();
        determineTargetType();
        determineRepositoryDetails();
        determineInstances();
        determineServiceConfigs();
        logger.log(Level.FINE,"diagnostic-service.target_details",
                new Object[] {target, repositoryDir, type, instances});
    
protected abstract voiddetermineTargetType()

public ExecutionContextgetExecutionContext()

        return context;
    
private java.util.logging.LoggergetLogger()

        return logger;
    
public java.util.ListgetServiceConfigs()

        return serviceConfigs;
     
private voidinitLogger()

        logger = context.getLogger();
    
public ReportTargetresolve()

        if(validateTarget()) {
            createTarget();
            return reportTarget;
        }
        throw new InvalidTargetException(" Unable to resolve target : " + target);
    
protected abstract voidsetExecutionContext()

protected voidsetTargetType(TargetType type)

        this.type = type;
    
public abstract booleanvalidateTarget()