@Override public boolean isValid(ServiceLocator habitat, String target) { Domain domain = habitat.getService(Domain.class); return domain.getConfigNamed(target) != null; }
@Override public boolean isValid(Habitat habitat, String target) { Domain domain = habitat.getComponent(Domain.class); return domain.getConfigNamed(target) != null; }
public PropertyResolver(Domain domain, String instanceName) { _domain = domain; _server = _domain.getServerNamed(instanceName); if (_server != null) { _config = _domain.getConfigNamed(_server.getConfigRef()); } else { _config = _domain.getConfigNamed(instanceName); } _cluster = _domain.getClusterForInstance(instanceName); }
public PropertyResolver(Domain domain, String instanceName) { _domain = domain; _server = _domain.getServerNamed(instanceName); if (_server != null) { _config = _domain.getConfigNamed(_server.getConfigRef()); } else { _config = _domain.getConfigNamed(instanceName); } _cluster = _domain.getClusterForInstance(instanceName); }
private Config getConfigForName(String name) { if (domain.getConfigNamed(name) != null) return domain.getConfigNamed(name); if (domain.getServerNamed(name) != null) return domain.getServerNamed(name).getConfig(); return null; } }
private List<Server> getServersForConfig() { Config config = domain.getConfigNamed(whichTarget); if (config == null) { return null; } List<ReferenceContainer> rcs = domain.getReferenceContainersOf(config); List<Server> servers = new LinkedList<Server>(); for (ReferenceContainer rc : rcs) { if (rc.isServer()) { servers.add((Server) rc); } } return servers; }
private List<Server> getServersForConfig() { Config config = domain.getConfigNamed(whichTarget); if (config == null) { return null; } List<ReferenceContainer> rcs = domain.getReferenceContainersOf(config); List<Server> servers = new LinkedList<Server>(); for (ReferenceContainer rc : rcs) { if (rc.isServer()) { servers.add((Server) rc); } } return servers; }
private List<Cluster> getClustersForConfig() { Config config = domain.getConfigNamed(whichTarget); if (config == null) return null; List<ReferenceContainer> rcs = domain.getReferenceContainersOf(config); List<Cluster> clusters = new LinkedList<Cluster>(); for (ReferenceContainer rc : rcs) if (rc.isCluster()) clusters.add((Cluster) rc); return clusters; }
private List<Cluster> getClustersForConfig() { Config config = domain.getConfigNamed(whichTarget); if (config == null) return null; List<ReferenceContainer> rcs = domain.getReferenceContainersOf(config); List<Cluster> clusters = new LinkedList<Cluster>(); for (ReferenceContainer rc : rcs) if (rc.isCluster()) clusters.add((Cluster) rc); return clusters; }
/** * Returns the config element that represents a given cluster * @param targetName the name of the target * @return Config element representing the cluster */ public Config getClusterConfig(String targetName) { Cluster cl = getCluster(targetName); if(cl == null) return null; return(domain.getConfigNamed(cl.getConfigRef())); }
/** * Returns config element that represents a given server * @param targetName the name of the target * @return Config element representing the server instance */ public Config getServerConfig(String targetName) { Server s = domain.getServerNamed(targetName); if(s == null) return null; return domain.getConfigNamed(s.getConfigRef()); }
/** * Get the size of the admin threadpool */ private int getAdminThreadPoolSize(Logger logger) { final int DEFAULT_POOL_SIZE = 5; // Get the DAS configuratoin Config config = domain.getConfigNamed("server-config"); if (config == null) return DEFAULT_POOL_SIZE; AdminEndpointDecider aed = new AdminEndpointDecider(config, logger); return aed.getMaxThreadPoolSize(); }
/** * Returns the config element that represents a given cluster * @param targetName the name of the target * @return Config element representing the cluster */ public Config getClusterConfig(String targetName) { Cluster cl = getCluster(targetName); if(cl == null) return null; return(domain.getConfigNamed(cl.getConfigRef())); }
/** * Get the size of the admin threadpool */ private int getAdminThreadPoolSize(Logger logger) { final int DEFAULT_POOL_SIZE = 5; // Get the DAS configuratoin Config config = domain.getConfigNamed("server-config"); if (config == null) return DEFAULT_POOL_SIZE; AdminEndpointDecider aed = new AdminEndpointDecider(config); return aed.getMaxThreadPoolSize(); }
/** * Returns config element that represents a given server * @param targetName the name of the target * @return Config element representing the server instance */ public Config getServerConfig(String targetName) { Server s = domain.getServerNamed(targetName); if(s == null) return null; return domain.getConfigNamed(s.getConfigRef()); }
private boolean configHas(SystemProperty sp) { Config c = domain.getConfigNamed(server.getConfigRef()); return c != null ? hasSystemProperty(c.getSystemProperty(), sp) : false; }
private SystemProperty getConfigSystemProperty(String spName) { Config c = domain.getConfigNamed(server.getConfigRef()); return c != null ? getSystemProperty(c.getSystemProperty(), spName) : null; }
ServerPorts(Domain domain, Server theServer) { Cluster cluster = null; Config config = null; if (theServer.isInstance()) cluster = domain.getClusterForInstance(theServer.getName()); String configName = theServer.getConfigRef(); if (StringUtils.ok(configName)) config = domain.getConfigNamed(configName); initialize(cluster, config, domain, theServer); }
ServerPorts(Domain domain, Server theServer) { Cluster cluster = null; Config config = null; if (theServer.isInstance()) cluster = domain.getClusterForInstance(theServer.getName()); String configName = theServer.getConfigRef(); if (StringUtils.ok(configName)) config = domain.getConfigNamed(configName); initialize(cluster, config, domain, theServer); }
/** * Given a name (of instance or cluster or config), returns the appropriate Config object * @param targetName name of target * @return Config element of this target */ public Config getConfig(String targetName) { if(CommandTarget.CONFIG.isValid(habitat, targetName)) return domain.getConfigNamed(targetName); if(CommandTarget.DAS.isValid(habitat, targetName)) return getServerConfig(targetName); if(CommandTarget.STANDALONE_INSTANCE.isValid(habitat, targetName)) return getServerConfig(targetName); if(CommandTarget.CLUSTER.isValid(habitat, targetName)) return getClusterConfig(targetName); return null; }