本文整理汇总了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);
}
}
示例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();
}
示例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;
}
示例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;
}
}
示例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();
}
示例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;
}
示例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);
}
示例8: createDaemon
import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
public void createDaemon(final InstallerContext installerContext) throws IOException, UserCanceledException {
// do nothing
}
示例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));
}
示例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");
}
示例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();
}
示例12: createDaemon
import com.install4j.api.context.InstallerContext; //导入依赖的package包/类
void createDaemon(InstallerContext installerContext) throws IOException, UserCanceledException;