public static String getReference(Server server) { return server.getConfigRef(); }
public static String getReference(Server server) { return server.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 names of any realm files in the config directory * and add them to the set of file names. This will normally * find at least the "admin-keyfile" and "keyfile" files. */ private void getRealmFileNames(Server server, Set<String> files) { File configDir = env.getConfigDirPath(); URI configURI = configDir.toURI(); Config config = domain.getConfigNamed(server.getConfigRef()); for (String file : FileRealm.getRealmFileNames(config)) { File rfile = new File(file); if (!rfile.exists()) // skip if file doesn't exist continue; URI f = configURI.relativize(rfile.toURI()); if (!f.isAbsolute()) // if file is in config dir, add it files.add(f.toString()); } }
/** * Get the names of any realm files in the config directory * and add them to the set of file names. This will normally * find at least the "admin-keyfile" and "keyfile" files. */ private void getRealmFileNames(Server server, Set<String> files) { File configDir = env.getConfigDirPath(); URI configURI = configDir.toURI(); Config config = domain.getConfigNamed(server.getConfigRef()); for (String file : FileRealm.getRealmFileNames(config)) { File rfile = new File(file); if (!rfile.exists()) // skip if file doesn't exist continue; URI f = configURI.relativize(rfile.toURI()); if (!f.isAbsolute()) // if file is in config dir, add it files.add(f.toString()); } }
/** * 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()); }
/** * Synchronize the config-specific directory. * The directory for the instance is in the instance-config-specific * config directory, which is in the main config directory. * The instance-config-specific config directory is named * <config-name>. */ private void synchronizeConfigSpecificDir(Payload.Outbound payload, Server server, SyncRequest sr) throws URISyntaxException { String configDirName = server.getConfigRef(); File configDir = env.getConfigDirPath(); File configSpecificDir = new File(configDir, configDirName); if (logger.isLoggable(Level.FINEST)) logger.finest("ServerSynchronizer: " + "config-specific directory is " + configSpecificDir); if (!configSpecificDir.exists()) { if (logger.isLoggable(Level.FINE)) logger.fine("ServerSynchronizer: no config-specific " + "directory to synchronize: " + configSpecificDir); return; // nothing to do } List<String> fileSet = new ArrayList<String>(); getFileNames(configSpecificDir, configDir, null, fileSet, SyncLevel.DIRECTORY); synchronizeDirectory(payload, server, sr, configDir, fileSet); }
private boolean configHas(SystemProperty sp) { Config c = domain.getConfigNamed(server.getConfigRef()); return c != null ? hasSystemProperty(c.getSystemProperty(), sp) : false; }
private List<SystemProperty> getConfigSystemProperties() { try { String configName = server.getConfigRef(); Configs configs = domain.getConfigs(); List<Config> configsList = configs.getConfig(); Config config = null; for (Config c : configsList) { if (c.getName().equals(configName)) { config = c; break; } } return (List<SystemProperty>) (config != null ? config.getSystemProperty() : Collections.emptyList()); } catch (Exception e) { //possible NPE if domain.xml has issues! return Collections.emptyList(); } }
private SystemProperty getConfigSystemProperty(String spName) { Config c = domain.getConfigNamed(server.getConfigRef()); return c != null ? getSystemProperty(c.getSystemProperty(), spName) : 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); }
protected void decorate() { Server server = habitat.getComponent(Server.class, env.getInstanceName()); habitat.addIndex(new ExistingSingletonInhabitant<Server>(server), Server.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME); habitat.addIndex(new ExistingSingletonInhabitant<Config>(habitat.getComponent(Config.class, server.getConfigRef())), Config.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME); Cluster c = server.getCluster(); if (c != null) { habitat.addIndex(new ExistingSingletonInhabitant<Cluster>(c), Cluster.class.getName(), ServerEnvironment.DEFAULT_INSTANCE_NAME); } }
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); }
private Config getConfigForServer( Server server ) { fineLog( "getConfigForServer: server {0}", server ) ; String configRef = server.getConfigRef() ; fineLog( "getConfigForServer: configRef {0}", configRef ) ; Configs configs = services.getService( Configs.class ) ; fineLog( "getConfigForServer: configs {0}", configs ) ; Config config = configs.getConfigByName(configRef) ; fineLog( "getConfigForServer: config {0}", config ) ; return config ; }
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); }
private void setupSupplemental(AdminCommandContext context, final Server instance) { if (clusterName != null) { InstanceRegisterInstanceCommandParameters cp = new InstanceRegisterInstanceCommandParameters(); context.getActionReport(). setResultType(InstanceRegisterInstanceCommandParameters.class, cp); Node instNode = domain.getNodeNamed(node); cp.config = instance.getConfigRef(); cp.nodehost = instNode.getNodeHost(); cp.nodedir = instNode.getNodeDir(); cp.installdir = instNode.getInstallDir(); List<SystemProperty> spList = instance.getSystemProperty(); if (spList != null) { Properties p = new Properties(); for (SystemProperty sp : spList) { p.put(sp.getName(), sp.getValue()); } cp.systemProperties = p; } } }
private void setupSupplemental(AdminCommandContext context, final Server instance) { if (clusterName != null) { InstanceRegisterInstanceCommandParameters cp = new InstanceRegisterInstanceCommandParameters(); context.getActionReport(). setResultType(InstanceRegisterInstanceCommandParameters.class, cp); Node instNode = domain.getNodeNamed(node); cp.config = instance.getConfigRef(); cp.nodehost = instNode.getNodeHost(); cp.nodedir = instNode.getNodeDir(); cp.installdir = instNode.getInstallDir(); List<SystemProperty> spList = instance.getSystemProperty(); if (spList != null) { Properties p = new Properties(); for (SystemProperty sp : spList) { p.put(sp.getName(), sp.getValue()); } cp.systemProperties = p; } } }
private void configure(StringBuilder sb) throws TransactionFailure, PropertyVetoException { Server s = ConfigBeansUtilities.getServerNamed(ADMIN_SERVER); String ac = s.getConfigRef(); Config asc = null; //admin server config, that needs the configuration for (Config cfg : allConfigs.getConfig()) { if (cfg.getName().equals(ac)) { asc = cfg; break; } } //following things should happen transactionally - TODO replace SingleConfigCode by ConfigCode ... //createBackupRealm(sb, getAdminRealm(asc.getSecurityService()), getNewRealmName(asc.getSecurityService())); deleteRealm(asc.getSecurityService(), sb); createRealm(asc.getSecurityService(), sb); configureAdminService(asc.getAdminService()); //configure(asc.getSecurityService(), asc.getAdminService(), sb); }
protected Config getConfigForName(String targetName, ServiceLocator serviceLocator, Domain domain) { if (CommandTarget.CONFIG.isValid(serviceLocator, targetName)) { return domain.getConfigNamed(targetName); } if (CommandTarget.DAS.isValid(serviceLocator, targetName) || CommandTarget.STANDALONE_INSTANCE.isValid(serviceLocator, targetName)) { Server s = domain.getServerNamed(targetName); return s == null ? null : domain.getConfigNamed(s.getConfigRef()); } if (CommandTarget.CLUSTER.isValid(serviceLocator, targetName)) { Cluster cl = domain.getClusterNamed(targetName); return cl == null ? null : domain.getConfigNamed(cl.getConfigRef()); } return null; }