com.sun.enterprise.config.serverbeans.Server.getConfigRef()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中com.sun.enterprise.config.serverbeans.Server.getConfigRef()方法的一些代码示例,展示了Server.getConfigRef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getConfigRef()方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Server
类名称:Server
方法名:getConfigRef

Server.getConfigRef介绍

[英]Gets the value of the configRef property. Points to a named config. Needed for stand-alone servers. If server instance is part of a cluster, then it points to the cluster config
[中]获取configRef属性的值。指向一个命名的配置。需要独立服务器。如果服务器实例是集群的一部分,那么它将指向集群配置

代码示例

代码示例来源:origin: org.glassfish.admin/config-api

public static String getReference(Server server) {
  return server.getConfigRef();
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static String getReference(Server server) {
  return server.getConfigRef();
}

代码示例来源:origin: org.glassfish.common/internal-api

/**
 * 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());
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

/**
 * 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());
  }
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

/**
 * 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());
  }
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * 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());
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

/**
 * 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);
}

代码示例来源:origin: org.glassfish.main.core/kernel

private boolean configHas(SystemProperty sp) {
  Config c = domain.getConfigNamed(server.getConfigRef());
  return c != null ? hasSystemProperty(c.getSystemProperty(), sp) : false;
}

代码示例来源:origin: org.glassfish.main.core/kernel

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();
  }
}

代码示例来源:origin: org.glassfish.main.core/kernel

private SystemProperty getConfigSystemProperty(String spName) {
  Config c = domain.getConfigNamed(server.getConfigRef());
  return c != null ? getSystemProperty(c.getSystemProperty(), spName) : null;
}

代码示例来源:origin: org.glassfish.admin/config-api

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);
}

代码示例来源:origin: org.glassfish.main.admin/config-api

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);
}

代码示例来源:origin: org.glassfish.admin/config-api

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);
  }
}

代码示例来源:origin: org.glassfish.admin/config-api

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);
}

代码示例来源:origin: org.glassfish.main.orb/orb-iiop

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 ;
}

代码示例来源:origin: org.glassfish.main.admin/config-api

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);
}

代码示例来源:origin: org.glassfish.admin/config-api

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;
    }
  }
}

代码示例来源:origin: org.glassfish.main.admin/config-api

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;
    }
  }
}

代码示例来源:origin: org.glassfish.security/security

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);
}

代码示例来源:origin: org.glassfish.main.admin/config-api

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;
}

相关文章