当前位置: 首页>>代码示例>>Java>>正文


Java InstallerContext类代码示例

本文整理汇总了Java中com.install4j.api.context.InstallerContext的典型用法代码示例。如果您正苦于以下问题:Java InstallerContext类的具体用法?Java InstallerContext怎么用?Java InstallerContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InstallerContext类属于com.install4j.api.context包,在下文中一共展示了InstallerContext类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateServerIsNotRunning

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
/**
 * Validates that the server is not running.
 *
 * @noinspection MethodWithMoreThanThreeNegations
 */
private void validateServerIsNotRunning(final InstallerContext ctx) throws UserCanceledException {
  try {
    ctx.getProgressInterface().setStatusMessage("Validating Service Status...");

    // check if unix, we care about unix only
    if (!RuntimeUtils.isUnix()) {
      return;
    }

    // get install dir
    final File installationDirectory = ctx.getInstallationDirectory();
    if (!installationDirectory.exists()) {
      return;
    }

    // get tomcat config file
    final File serverXML = new File(installationDirectory, ETC_CONF_SERVER_XML);
    if (!serverXML.exists()) {
      LOG.warn("Could not find configuration file at " + ETC_CONF_SERVER_XML);
      return;
    }

    final ServerPresenceValidator validator = new ServerPresenceValidator();
    if (!validator.serverIsRunning(installationDirectory)) {
      return;
    }

    // we could connect, throw an exception;
    throw new UserCanceledException("Parabuild service is running. Please stop Parabuild service before launching the installer.");
  } catch (IOException e) {
    throw makeUserCancelledException(e);
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:ParabuildPreInstallAction.java

示例2: createDaemon

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public final void createDaemon(final InstallerContext installerContext) throws IOException, UserCanceledException {
  this.ictx = installerContext;
  createGroup();
  createUser();
  installDaemon();
  createRunlevelSymlinks();
  chownDirs();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:AbstractUnixDaemonCreator.java

示例3: install

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public boolean install(final InstallerContext ctx) throws UserCanceledException {
  try {
    uninstallEndorsedJars(ctx);
    createUnixDaemon(ctx);
  } catch (UserCanceledException e) {
    ctx.getProgressInterface().showFailure(StringUtils.toString(e));
    log.warn("Exaception while performing unattened action", e);
    throw e;
  }
  return true;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:ParabuildPostInstallAction.java

示例4: createUnixDaemon

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
/**
 * Creates files necessary to make a daemon.
 */
public void createUnixDaemon(final InstallerContext installerContext) throws UserCanceledException {
  try {
    final UnixDaemonCreator creator = UnixDaemonCreatorFactory.getCreator();
    creator.createDaemon(installerContext);
  } catch (IOException e) {
    final UserCanceledException uce = new UserCanceledException(StringUtils.toString(e));
    uce.initCause(e);
    throw uce;
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:ParabuildPostInstallAction.java

示例5: createDaemon

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public void createDaemon(final InstallerContext installerContext) throws IOException, UserCanceledException {
  this.ictx = installerContext;
  createUser();
  createGroup();
  chownDirs();
  installDaemon();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:MacOsXDaemonCreator.java

示例6: install

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public boolean install(InstallerContext installerContext) throws UserCanceledException {
    final String osName = System.getProperty("os.name").toLowerCase();
    boolean isWindows = osName.startsWith("windows");

    if (!isWindows) {
        return true;
    }

    final File sparkDirectory;
    String sparkPath = "";
    try {
        sparkDirectory = new File(installerContext.getInstallationDirectory(), "Spark.exe");
        sparkPath = sparkDirectory.getCanonicalPath();

    }
    catch (Exception e) {
        e.printStackTrace();
    }

    if (sparkPath != null && sparkPath.length() > 0) {
        // Add Spark to startup
        addSparkToStartup(sparkPath);

        // Add Spark XMPP:URI mapping
        setURI(sparkPath);
    }


    return true;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:31,代码来源:Installer.java

示例7: upgradeDatabaseVersion

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
private void upgradeDatabaseVersion(final InstallerContext ctx, final File databaseDirectory) throws IOException {
  ctx.getProgressInterface().setStatusMessage("Upgrading Database Engine...");
  final HSQLDBUpgraderFrom17To18 hsqldbUpgraderFrom17To18 = new HSQLDBUpgraderFrom17To18();
  hsqldbUpgraderFrom17To18.upgrade(databaseDirectory);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:6,代码来源:ParabuildPreInstallAction.java

示例8: createDaemon

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public void createDaemon(final InstallerContext installerContext) throws IOException, UserCanceledException {
  // do nothing
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:4,代码来源:DummyDaemonCreator.java

示例9: uninstallEndorsedJars

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
/**
 * This action uninstalls Tomcat's endorsed jars that conflict with JRE 1.5.
 */
private void uninstallEndorsedJars(final InstallerContext installerContext) {
  deleteIfExists(new File(installerContext.getInstallationDirectory(), XERCES_IMPL_JAR));
  deleteIfExists(new File(installerContext.getInstallationDirectory(), XML_PARSER_APIS_JAR));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:ParabuildPostInstallAction.java

示例10: rollback

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public void rollback(InstallerContext installerContext) {
    WinRegistry.deleteValue(RegistryRoot.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:4,代码来源:Installer.java

示例11: databaseFileExists

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
/**
 * Returns true if the database file exists.
 *
 * @param installerContext
 * @return true if the database file exists.
 * @noinspection BooleanMethodIsAlwaysInverted
 */
private boolean databaseFileExists(final InstallerContext installerContext) {
  final File databaseFile = new File(makeDatabaseDirectoryPath(installerContext.getInstallationDirectory()), "parabuild.data");
  return databaseFile.exists();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:ParabuildPreInstallAction.java

示例12: createDaemon

import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
void createDaemon(InstallerContext installerContext) throws IOException, UserCanceledException; 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:2,代码来源:UnixDaemonCreator.java


注:本文中的com.install4j.api.context.InstallerContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。