gov.nist.toolkit.installation.server.Installation类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(194)

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

Installation介绍

暂无

代码示例

代码示例来源:origin: usnistgov/iheos-toolkit2

private String getEndpointPort(boolean isTLS, boolean isProxy) throws Exception {
  if (isTLS && isProxy)
    throw new Exception("Proxy does not support TLS");
  if (isProxy)
    return Installation.instance().propertyServiceManager().getProxyPort();
  return (isTLS) ? Installation.instance().propertyServiceManager().getToolkitTlsPort() : Installation.instance().propertyServiceManager().getToolkitPort();
}

代码示例来源:origin: usnistgov/iheos-toolkit2

private File getRepositoryCache() {
  File cache = new File(Installation.instance().warHome(), "DocumentCache");
  cache.mkdirs();
  return cache;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public EnvSetting(String envName) {
  this.envName = envName;
  this.envDir = Installation.instance().environmentFile(envName);
  validateEnvironment();
}

代码示例来源:origin: usnistgov/iheos-toolkit2

@Override
public String getKeystorePassword() throws IOException, EnvironmentNotSelectedException {
  return Installation.instance().getKeystorePassword(environmentName);
}

代码示例来源:origin: usnistgov/iheos-toolkit2

@Override
public String getTruststorePassword() throws IOException, EnvironmentNotSelectedException {
  return Installation.instance().getTruststorePassword(environmentName);
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public File getDefaultCodesFile() {
  return new File(environmentFile(defaultEnvironmentName()), "codes.xml");
}

代码示例来源:origin: usnistgov/iheos-toolkit2

static public TestConfig testConfigWithTestMgmt() {
  TestConfig tc = new TestConfig();
  File toolkit = Installation.instance().toolkitxFile();
  tc.testmgmt_dir = toolkit + File.separator + "xdstest";
  return tc;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

protected String mkEndpoint(SimulatorConfig asc, SimulatorConfigElement ele, String actor, boolean isTLS, boolean isProxy) throws Exception {
    String transtype = SimDb.getTransactionDirName(ele.transType);

    String contextName = Installation.instance().getServletContextName();

    return "http"
    + ((isTLS) ? "s" : "")
    + "://" 
    + Installation.instance().propertyServiceManager().getToolkitHost()
    + ":"
        + getEndpointPort(isTLS, isProxy)
//        + ((isTLS) ? Installation.instance().propertyServiceManager().getToolkitTlsPort() : Installation.instance().propertyServiceManager().getToolkitPort())
//        + "/"  context name includes preceding /
    + contextName  
    + (ele.transType.isHttpOnly() ? "/httpsim/" : "/sim/" )
    + asc.getId() 
    + "/" +
    actor           //asc.getActorType().toLowerCase()
    + "/" 
    + transtype;
  }

代码示例来源:origin: usnistgov/iheos-toolkit2

public static int allocatePort(String simId) {
    if (Installation.isTestRunning()) {
      if (!isInitialized) {
//                 Call the Pid service
        try {
          String endpoint =
              "http://"
              + Installation.instance().propertyServiceManager().getToolkitHost()
              + ":"
              + Installation.instance().propertyServiceManager().getToolkitPort()
              + "/testEnvPidPort?cmd=allocate&simId=" + simId;
          logger.debug("Requesting new port from " + endpoint);
          String pidPort = HttpClient.httpGet(endpoint);
          pidPort = pidPort.trim();
          return Integer.parseInt(pidPort);
        } catch (Exception e) {
          throw new ToolkitRuntimeException(e.getCause());
        }
      }
    }

    ThreadPoolItem threadPoolItem =  allocateThreadPoolItem();
    threadPoolItem.simId = simId;
    return threadPoolItem.port;

  }

代码示例来源:origin: usnistgov/iheos-toolkit2

public static void generateCurrentlyConfiguredListeners() throws IOException, NoSimException, ClassNotFoundException {
  for (TestSession testSession : Installation.instance().getTestSessions()) {
    List<SimId> simIds = new SimDb().getSimulatorIdsforActorType(ActorType.REGISTRY, testSession);
    generateListeners(simIds);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

synchronized public static void reinitialize(File location) throws XdsException {
  logger.info("Reinitialize External Cache to " + location);
  Installation.instance().externalCache(null);  // so that it can be updated
  String error = initialize(location);
  if (error != null) throw new XdsException(error, "");
  File environment = Installation.instance().environmentFile();
  // initialize environment
  initializeExternalCacheWithInternalData(location);
  // initialize test log cache
  Installation.instance().testLogCache(TestSession.DEFAULT_TEST_SESSION).mkdirs();
  // initialize SimDb
  Installation.instance().simDbFile(TestSession.DEFAULT_TEST_SESSION).mkdirs();
  // initialize actors
  Installation.instance().actorsDir(TestSession.DEFAULT_TEST_SESSION).mkdirs();
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public void init(ServletConfig sConfig) {
  configuredHost = Installation.instance().propertyServiceManager().getToolkitHost();
  configuredPort = Installation.instance().propertyServiceManager().getToolkitPort();
  configuredTlsPort = Installation.instance().propertyServiceManager().getToolkitTlsPort();
  configuredProxyPort = Installation.instance().propertyServiceManager().getProxyPort();
  configuredContext = Installation.instance().getServletContextName();
  if (configuredContext.startsWith("/"))
    configuredContext = configuredContext.substring(1);
  logger.info("Reconfiguring Simulators to host " + getConfiguredHost() + " port " + getConfiguredPort() + " context " + getConfiguredContext());
  logger.info("Reconfiguring simulators in " + Installation.instance().getTestSessions());
  for (TestSession testSession : Installation.instance().getTestSessions()) {
    for (SimId simId : SimDb.getAllSimIds(testSession)) {
      try {
        reconfigure(simId);
      } catch (Throwable e) {
        logger.fatal("Reconfigure of sim " + simId + " failed - " + ExceptionUtil.exception_details(e));
      }
    }
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

@Override
public void init(ServletConfig sConfig) throws ServletException {
  super.init(sConfig);
  if (config != null)
    return;
  config = sConfig;
  logger.info("Initializing toolkit in SimServlet");
  File warHome = new File(config.getServletContext().getRealPath("/"));
  logger.info("...warHome is " + warHome);
  Installation.instance().warHome(warHome);
  logger.info("...warHome initialized to " + Installation.instance().warHome());
  Installation.instance().setServletContextName(getServletContext().getContextPath());
  Installation.instance().setServletContextName(getServletContext().getContextPath());
  patientIdentityFeedServlet = new PatientIdentityFeedServlet();
  patientIdentityFeedServlet.init(config);
  onServiceStart();
  logger.info("SimServlet initialized");
  // Initialize SimProxy
  try {
    long id = Thread.currentThread().getId();
    Object it = this;
    logger.info("Proxy Operation: start proxy from SimServlet on thread " + id + " port " + Installation.instance().propertyServiceManager().getProxyPort());
    proxyThread = ElementalReverseProxy.start(Installation.instance().propertyServiceManager().getProxyPort());
  } catch (Exception e) {
    logger.fatal("Proxy startup on port " +  Thread.currentThread().getId()  + " failed - " + ExceptionUtil.exception_details(e));
    throw new ServletException(e);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public File testSessionMgmtDir() {
  return new File(Installation.instance().externalCache(), "TestSessionMgmt");
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public List<Result> querySts(SiteSpec siteSpec, String query, Map<String, String> params, boolean persistResult, TestSession testSession) {
  setGazelleTruststore();
  String environmentName = "default";
  Session mySession = new Session(Installation.instance().warHome(), testSession.toString());
  mySession.setEnvironment(environmentName);
  // Site must exist
  if (mySession.getTestSession() == null)
    mySession.setTestSession(testSession);
  mySession.setSiteSpec(siteSpec);
  mySession.setTls(true); // Required for STS
  String stsTpName = Installation.instance().propertyServiceManager().getStsTpName();
  TestInstance testInstance = new TestInstance(stsTpName, TestSession.DEFAULT_TEST_SESSION);
  List<String> sections = new ArrayList<String>();
  sections.add(query);
  XdsTestServiceManager xtsm = new XdsTestServiceManager(mySession);
  List<Result> results =  runTestInstance(xtsm, environmentName,testSession,siteSpec,testInstance,sections,params,true, persistResult);
  return results;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

logger.info("+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ");
logger.info("uri is " + uri);
logger.info("warHome is " + Installation.instance().warHome());
RegIndex regIndex = null;
RepIndex repIndex = null;
  if (Installation.instance().propertyServiceManager().getArchiveLogs()) {
    SimDb simDb = dsSimCommon.simDb();
    if (simDb != null) {
      File eventDir = simDb.getEventDir();
      if (eventDir.exists()) {
        FileUtils.copyDirectory(eventDir, new File(Installation.instance().archive(), simDb.getEvent()));

代码示例来源:origin: usnistgov/iheos-toolkit2

public static String validate() {
  File location = Installation.instance().externalCache();
  if (!location.exists()) return String.format("External Cache location %s does not exist. " + HOW_TO_FIX, location);
  if (!location.isDirectory()) return String.format("External Cache location %s is not a directory. " + HOW_TO_FIX, location);
  if (!location.canWrite()) return String.format("External Cache location %s cannot be written. " + HOW_TO_FIX, location);
  File defEnv = Installation.instance().environmentFile("default");
  if (!defEnv.exists()) return String.format("Default Environment (default) not found in External Cache (%s). " +
          HOW_TO_FIX,
      location);
  return null;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public TestKitSourceEnum detectSource() {
    String testDir = getTestDir().toString();
    if ((testDir != null)) {
      if (testDir.startsWith(Installation.instance().warHome().toString())) {
        return TestKitSourceEnum.EMBEDDED;
      } else if (testDir.startsWith(Installation.instance().externalCache().toString())) {
        return TestKitSourceEnum.LOCAL;
      }
    }
  return TestKitSourceEnum.UNKNOWN;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

private static void initializeExternalCacheWithInternalData(File externalCache) throws XdsException {
  logger.info("Initialize external cache check");
  if (!Installation.instance().environmentFile().exists() || !Installation.instance().environmentFile(Installation.DEFAULT_ENVIRONMENT_NAME).exists()) {
    logger.info("Initializing environments in " + externalCache);
    try {
      FileUtils.copyDirectory(Installation.instance().internalEnvironmentsFile(), new File(externalCache, "environment"));
    } catch (IOException e) {
      throw new XdsException("Cannot initialize environments area of External Cache at " + externalCache, "", e);
    }
  } else {
    logger.info("Environments exist - not updating.");
  }
    logger.info("Initializing datasets in " + externalCache);
    try {
      FileUtils.copyDirectory(Installation.instance().internalDatasetsFile(), new File(externalCache, "datasets"));
    } catch (IOException e) {
      String msg = "Cannot initialize datasets area of External Cache at " + externalCache + " - " + e.getMessage();
      logger.error(msg);
    }
    logger.info("Initializing resource cache in " + externalCache);
    try {
      FileUtils.copyDirectory(Installation.instance().internalResourceCacheFile(), new File(externalCache, "resourceCache"));
    } catch (IOException e) {
      String msg = "Cannot initialize resourceCache area of External Cache at " + externalCache + " - " + e.getMessage();
      logger.error(msg);
    }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

if (Installation.instance().propertyServiceManager().getArchiveLogs()) {
  File now = Installation.instance().newArchiveDir();
  testConfig.archiveLogFile = new File(now, "log.xml");

相关文章