Update installer.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8987 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-08-22 20:20:38 +00:00
committed by derek
parent 834ca9834e
commit 76f10da5c1
6 changed files with 84 additions and 81 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<install4j version="4.0.5" transformSequenceNumber="1">
<directoryPresets config="../../documentation" />
<directoryPresets config="../../target/classes/org/jivesoftware/launcher" />
<application name="${compiler:APP_NAME}" distributionSourceDir="" applicationId="3057-7228-2063-7466" mediaDir="../../../../.." mediaFilePattern="spark_${compiler:sys.version}" compression="9" lzmaCompression="true" pack200Compression="false" excludeSignedFromPacking="true" keepModificationTimes="false" shortName="${compiler:APP_SHORT_NAME}" publisher="${compiler:PUBLISHER}" publisherWeb="${compiler:PUBLISHER_URL}" version="${compiler:VERSION_MAJOR}.${compiler:VERSION_MINOR}.${compiler:VERSION_REVISION}" allPathsRelative="true" backupOnSave="false" autoSave="false" convertDotsToUnderscores="true" macSignature="????" javaMinVersion="1.5" javaMaxVersion="1.6" allowBetaVM="false">
<languages skipLanguageSelection="false">
<principalLanguage id="en" customLocalizationFile="" />
@ -215,18 +215,6 @@
</serializedBean>
<condition />
</action>
<action name="" id="29" beanClass="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction">
<void property="programGroupName">
<string>${compiler:sys.fullName}</string>
</void>
</object>
</java>
</serializedBean>
<condition />
</action>
<action name="" id="30" beanClass="com.install4j.runtime.beans.actions.desktop.RegisterAddRemoveAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
@ -251,6 +239,18 @@
</serializedBean>
<condition>context.getBooleanVariable("createDesktopLinkAction")</condition>
</action>
<action name="" id="29" beanClass="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction">
<void property="programGroupName">
<string>${compiler:sys.fullName}</string>
</void>
</object>
</java>
</serializedBean>
<condition />
</action>
</actions>
<formComponents />
</screen>
@ -263,6 +263,27 @@
<condition />
<validation />
<actions>
<action name="" id="72" beanClass="com.install4j.runtime.beans.actions.registry.SetRegistryValueAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.registry.SetRegistryValueAction">
<void property="keyName">
<string>Software\\Microsoft\\Windows\\CurrentVersion\\Run</string>
</void>
<void property="registryRoot">
<object class="com.install4j.api.windows.RegistryRoot" field="HKEY_CURRENT_USER" />
</void>
<void property="value">
<string>${installer:sys.installationDir}${compiler:APP_SHORT_NAME}</string>
</void>
<void property="valueName">
<string>Spark</string>
</void>
</object>
</java>
</serializedBean>
<condition />
</action>
<action name="" id="41" beanClass="com.install4j.runtime.beans.actions.finish.ExecuteLauncherAction" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,30 +10,34 @@
package org.jivesoftware.launcher;
import com.install4j.api.InstallAction;
import com.install4j.api.InstallerWizardContext;
import com.install4j.api.ProgressInterface;
import com.install4j.api.UserCanceledException;
import com.install4j.api.actions.InstallAction;
import com.install4j.api.context.Context;
import com.install4j.api.context.InstallerContext;
import com.install4j.api.context.UserCanceledException;
import com.install4j.api.windows.RegistryRoot;
import com.install4j.api.windows.WinRegistry;
import java.io.File;
import java.io.IOException;
/**
* The installer class is used by the Install4j Installer to setup registry entries
* during the setup process.
*/
public class Installer extends InstallAction {
public class Installer implements InstallAction {
private InstallerWizardContext context;
private InstallerContext context;
public int getPercentOfTotalInstallation() {
return 0;
}
public boolean performAction(InstallerWizardContext installerWizardContext, ProgressInterface progressInterface) throws UserCanceledException {
context = installerWizardContext;
public void init(Context context) {
}
public boolean install(InstallerContext installerContext) throws UserCanceledException {
context = installerContext;
final String osName = System.getProperty("os.name").toLowerCase();
boolean isWindows = osName.startsWith("windows");
@ -42,24 +46,45 @@ public class Installer extends InstallAction {
return true;
}
addSparkToStartup(installerWizardContext.getInstallationDirectory());
final File sparkDirectory;
String sparkPath = "";
try {
String executable = installerContext.getMediaName();
sparkDirectory = new File(installerContext.getInstallationDirectory(), executable);
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;
}
public void rollback(InstallerContext installerContext) {
WinRegistry.deleteValue(RegistryRoot.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
}
/**
* Adds Spark to the users registry.
*
* @param dir the installation directory of Spark.
* @param sparkPath the canonical path to spark.
*/
public void addSparkToStartup(File dir) {
final File sparkDirectory = new File(dir, "Spark.exe");
public void addSparkToStartup(String sparkPath) {
try {
final String sparkPath = sparkDirectory.getCanonicalPath();
WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", sparkPath);
setURI(sparkPath);
WinRegistry.setValue(RegistryRoot.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", sparkPath);
}
catch (IOException e) {
catch (Exception e) {
e.printStackTrace();
}
}
@ -70,18 +95,18 @@ public class Installer extends InstallAction {
* @param path the installation directory of spark.
*/
private void setURI(String path) {
boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
boolean exists = WinRegistry.keyExists(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp");
if (exists) {
}
// JOptionPane.showConfirmDialog(null, "Another application is currently registered to handle XMPP instant messaging. Make Spark the default XMPP instant messaging client?", "Confirmation", }
WinRegistry.deleteKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", true);
WinRegistry.deleteKey(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp", true);
WinRegistry.createKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", "", "URL:XMPP Address");
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp", "URL Protocol", "");
WinRegistry.createKey(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp");
WinRegistry.setValue(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp", "", "URL:XMPP Address");
WinRegistry.setValue(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp", "URL Protocol", "");
WinRegistry.createKey(WinRegistry.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command");
WinRegistry.setValue(WinRegistry.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command", "", path + " %1");
WinRegistry.createKey(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command");
WinRegistry.setValue(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp\\shell\\open\\command", "", path + " %1");
}

View File

@ -1,43 +0,0 @@
/**
* $Revision: $
* $Date: $
*
* Copyright (C) 2006 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Lesser Public License (LGPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.launcher;
import com.install4j.api.Context;
import com.install4j.api.ProgressInterface;
import com.install4j.api.UninstallAction;
import com.install4j.api.windows.WinRegistry;
import java.io.File;
/**
* Performs registry operations on removal of the Spark client. This is a windows only function.
*
* @author Derek DeMoro
*/
public class Uninstaller extends UninstallAction {
public int getPercentOfTotalInstallation() {
return 0;
}
public boolean performAction(Context context, ProgressInterface progressInterface) {
return super.performAction(context, progressInterface); //To change body of overridden methods use File | Settings | File Templates.
}
/**
* Removes Spark from the start up registration in the registry.
*
* @param dir the directory where Spark resides.
*/
public void removeStartup(File dir) {
WinRegistry.deleteValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
}
}