[wsas-java-dev] svn commit r9532 -
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/installer
svn at wso2.org
svn at wso2.org
Wed Nov 7 02:42:03 PST 2007
Author: azeez
Date: Wed Nov 7 02:41:58 2007
New Revision: 9532
Modified:
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/installer/InstallationManager.java
Log:
Do not show Install/Uninstall NT service on non-Windows platforms
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/installer/InstallationManager.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/installer/InstallationManager.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/installer/InstallationManager.java Wed Nov 7 02:41:58 2007
@@ -43,12 +43,21 @@
* The supported installation modes. If we need to support any new installation modes, we have
* to add an entry here.
*/
- private static final InstallationMode[] INSTALLATION_MODES =
+ private final InstallationMode[] INSTALLATION_MODES;
+
+ public InstallationManager() {
+ String osName = System.getProperty("os.name");
+ if (osName.toLowerCase().indexOf("win") != -1) {
+ INSTALLATION_MODES =
new InstallationMode[]{eclipsePluginInstMode, scInstMode,
ntServiceInstMode, ntServiceUninstMode};
+ } else {
+ INSTALLATION_MODES =
+ new InstallationMode[]{eclipsePluginInstMode, scInstMode};
+ }
+ }
- public static void main(String[] args) {
-
+ private void doInstallation(String[] params) {
Properties props = new Properties();
try {
props.load(new FileInputStream("bin" + File.separator + "version.txt"));
@@ -66,11 +75,11 @@
System.out.println("# #");
System.out.println("###########################################################\n");
- scInstMode.setEnvVariables(args);
+ scInstMode.setEnvVariables(params);
scInstMode.setWsasVersion(wsasVersion);
try {
- int installationMode = InstallationManager.getInstallationMode();
+ int installationMode = getInstallationMode();
INSTALLATION_MODES[installationMode].doInstallation();
} catch (InstallationException e) {
System.err.println(" Installation failed : " + e);
@@ -79,6 +88,10 @@
}
}
+ public static void main(String[] args) {
+ new InstallationManager().doInstallation(args);
+ }
+
public static String getWSASHome() {
File defaultWSASHome = new File(System.getProperty("user.home") +
File.separator + ".wso2wsas");
@@ -116,11 +129,11 @@
return wsasHome.trim();
}
- private static int getInstallationMode() throws InstallationException {
+ private int getInstallationMode() throws InstallationException {
System.out.println("\nPlease select your installation mode: ");
- for (int i = 0; i < InstallationManager.INSTALLATION_MODES.length; i++) {
+ for (int i = 0; i < INSTALLATION_MODES.length; i++) {
System.out.println(((i + 1) + ") ") +
- InstallationManager.INSTALLATION_MODES[i].getDescription());
+ INSTALLATION_MODES[i].getDescription());
}
int modeId = 0;
@@ -131,14 +144,14 @@
} catch (Exception e) {
System.err.println("Please enter a valid mode");
}
- if (modeId > 0 && modeId <= InstallationManager.INSTALLATION_MODES.length) {
+ if (modeId > 0 && modeId <= INSTALLATION_MODES.length) {
break;
} else {
System.err.println("Please enter a valid mode");
}
}
System.out.println();
- System.out.println("Selection: " + InstallationManager.INSTALLATION_MODES[modeId - 1]);
+ System.out.println("Selection: " + INSTALLATION_MODES[modeId - 1]);
return modeId - 1;
}
}
More information about the Wsas-java-dev
mailing list