Commit b339f0f6 authored by Piotr Wendykier's avatar Piotr Wendykier

Removed izpack directory.

parent e55381b2
<langpack>
<str id="data.validation.error.title" txt="Error"/>
<str id="data.validation.warning.title" txt="Warning"/>
</langpack>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="IzPackConditions" default="default" basedir=".">
<description>Builds, tests, and runs the project IzPackConditions.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="IzPackConditions-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
This diff is collapsed.
build.xml.data.CRC32=2728cc0c
build.xml.script.CRC32=555bec3a
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2728cc0c
nbproject/build-impl.xml.script.CRC32=bf24ff0d
nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46
This diff is collapsed.
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=IzPackConditions
application.vendor=babor
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/IzPackConditions.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.standalone-compiler.jar=../standalone-compiler.jar
file.reference.WinRegistry-4.4.jar=WinRegistry-4.4.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.WinRegistry-4.4.jar}:\
${file.reference.standalone-compiler.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=izpackconditions.IzPackConditions
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>IzPackConditions</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import com.izforge.izpack.installer.AutomatedInstallData;
import com.izforge.izpack.installer.DataValidator;
import com.izforge.izpack.util.Debug;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class CustomValidator implements com.izforge.izpack.installer.DataValidator
{
private static final String ERROR_MESSAGE_JAVA_VERSION = "ERROR!\n\nJava version too low.\nVisNow requires at least Java 1.6.\n\nPlease upgrade Java or contact\nyour system adminstrator.\n\n";
private String errorMessage = "";
private String warningMessage = "";
@Override
public Status validateData(AutomatedInstallData aid)
{
//validate java version
String jv = System.getProperty("java.version");
jv = jv.substring(0, 5);
int jVersion0 = 0;
int jVersion1 = 0;
int jVersion2 = 0;
jVersion0 = Integer.parseInt(jv.substring(0, 1));
jVersion1 = Integer.parseInt(jv.substring(2, 3));
jVersion2 = Integer.parseInt(jv.substring(4, 5));
if (jVersion0 < 1 || (jVersion0 == 1 && jVersion1 < 6)) {
Debug.trace("CustomValidator: Java version validation failed");
errorMessage = ERROR_MESSAGE_JAVA_VERSION;
return DataValidator.Status.ERROR;
}
Debug.trace("CustomValidator: Java version validation succeded");
String homeDirPath = System.getProperty("user.home");
String os = System.getProperty("os.name");
String testAppPath, finalAppPath, appDir;
File f;
boolean ok;
if (os.startsWith("Windows")) {
//windows
testAppPath = System.getenv("PROGRAMFILES");
appDir = aid.getVariable("APP_NAME") + File.separator + "v" + aid.getVariable("APP_VER");
} else if (os.startsWith("Mac")) {
//macos
testAppPath = "/Applications";
appDir = aid.getVariable("APP_NAME") + " v" + aid.getVariable("APP_VER");
} else {
//assume unix
testAppPath = "/opt";
appDir = aid.getVariable("APP_NAME") + File.separator + "v" + aid.getVariable("APP_VER");
}
f = new File(testAppPath);
if (f.exists() && f.canWrite()) {
try {
File ff = new File(testAppPath + File.separator + "test.file");
FileOutputStream fos = new FileOutputStream(ff);
OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
out.write("test", 0, 4);
out.close();
ff.delete();
ok = true;
finalAppPath = testAppPath;
} catch (Exception ex) {
ok = false;
finalAppPath = homeDirPath;
}
} else {
ok = false;
finalAppPath = homeDirPath;
}
Debug.trace("CustomValidator: " + os + " with" + (ok ? "" : "out") + " " + testAppPath + " write permission. Setting installation path to " + finalAppPath);
aid.setVariable("APPLICATIONS_DEFAULT_ROOT", finalAppPath);
aid.setVariable("INSTALL_PATH", finalAppPath + File.separator + appDir);
return DataValidator.Status.OK;
}
@Override
public String getErrorMessageId()
{
return errorMessage;
}
@Override
public String getWarningMessageId()
{
return warningMessage;
}
@Override
public boolean getDefaultAnswer()
{
return false;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import com.izforge.izpack.installer.AutomatedInstallData;
import com.izforge.izpack.installer.DataValidator;
import com.izforge.izpack.util.Debug;
import java.io.File;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class CustomValidator1 implements com.izforge.izpack.installer.DataValidator
{
private static final String ERROR_MESSAGE_JAVA_VERSION = "ERROR!\n\nJava version too low.\nVisNow requires at least Java 1.6.\n\nPlease upgrade Java or contact\nyour system adminstrator.\n\n";
private String errorMessage = "";
private String warningMessage = "";
@Override
public Status validateData(AutomatedInstallData aid)
{
Debug.trace("CustomValidator: #1");
//validate java version
String jv = System.getProperty("java.version");
jv = jv.substring(0, 5);
int jVersion0 = 0;
int jVersion1 = 0;
int jVersion2 = 0;
jVersion0 = Integer.parseInt(jv.substring(0, 1));
jVersion1 = Integer.parseInt(jv.substring(2, 3));
jVersion2 = Integer.parseInt(jv.substring(4, 5));
if (jVersion0 < 1 || (jVersion0 == 1 && jVersion1 < 6)) {
Debug.trace("CustomValidator: Java version validation failed");
errorMessage = ERROR_MESSAGE_JAVA_VERSION;
return DataValidator.Status.ERROR;
}
Debug.trace("CustomValidator: Java version validation succeded");
//linux application path to /opt
String os = System.getProperty("os.name");
if (!os.startsWith("Windows") && !os.startsWith("Mac")) {
//assume unix
File f = new File("/opt");
if (f.exists() && f.canWrite()) {
Debug.trace("CustomValidator: assumed Unix-like system with /opt write permission. Setting installation path to /opt");
aid.setVariable("APPLICATIONS_DEFAULT_ROOT", "/opt");
aid.setVariable("INSTALL_PATH", "/opt/" + aid.getVariable("APP_NAME"));
}
}
return DataValidator.Status.OK;
}
@Override
public String getErrorMessageId()
{
return errorMessage;
}
@Override
public String getWarningMessageId()
{
return warningMessage;
}
@Override
public boolean getDefaultAnswer()
{
return false;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class IzPackConditions
{
public static boolean IS_ARCH64 = false;
//public static boolean IS_JAVA3D_PRESENT = false;
//public static boolean IS_JAVA3D_VERSION = false;
static {
//os architecture check
String arch = System.getProperty("os.arch");
IS_ARCH64 = arch.contains("64");
// //Java3D presence check
// try {
// Class cl = Class.forName("javax.media.j3d.VirtualUniverse");
// IS_JAVA3D_PRESENT = true;
// } catch (Exception ex) {
// IS_JAVA3D_PRESENT = false;
// }
// //Java3D version check
// try {
// Class cl = Class.forName("javax.media.j3d.VirtualUniverse");
// IS_JAVA3D_VERSION = Java3DChecker.checkJava3DVersion();
// } catch (Exception ex) {
// IS_JAVA3D_VERSION = false;
// }
}
private IzPackConditions()
{
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import com.izforge.izpack.installer.AutomatedInstallData;
import com.izforge.izpack.installer.DataValidator;
import java.util.Properties;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class JavaVersionValidator implements com.izforge.izpack.installer.DataValidator
{
@Override
public Status validateData(AutomatedInstallData aid)
{
//System.out.println("");
//System.out.println("HUHU jvv");
//System.out.println("");
String jv = System.getProperty("java.version");
jv = jv.substring(0, 5);
int jVersion0 = 0;
int jVersion1 = 0;
int jVersion2 = 0;
jVersion0 = Integer.parseInt(jv.substring(0, 1));
jVersion1 = Integer.parseInt(jv.substring(2, 3));
jVersion2 = Integer.parseInt(jv.substring(4, 5));
if (jVersion0 < 1 || (jVersion0 == 1 && jVersion1 < 6)) {
return DataValidator.Status.ERROR;
}
return DataValidator.Status.OK;
}
@Override
public String getErrorMessageId()
{
//return "java.version.validation.error.text";
return "ERROR!\n\nJava version too low.\nVisNow requires at least Java 1.6.\n\nPlease upgrade Java or contact\nyour system adminstrator.\n\n";
}
@Override
public String getWarningMessageId()
{
return "";
}
@Override
public boolean getDefaultAnswer()
{
return false;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import at.jta.Key;
import at.jta.Regor;
import com.izforge.izpack.util.Debug;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.BackingStoreException;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class SearchRegistry
{
public static String[] searchJava3DEntries() throws BackingStoreException
{
Debug.trace("SearchRegistry: starting registry search");
ArrayList<String> entries = new ArrayList<String>();
String basePath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
try {
Regor reg = new Regor();
Key HKLM = new Key(Regor._HKEY_LOCAL_MACHINE, "");
Key uninstallKey = reg.openKey(HKLM, basePath);
List uninstallList = reg.listKeys(uninstallKey);
Key entryKey;
String displayName;
String publisher;
String fullPath;
for (int i = 0; i < uninstallList.size(); i++) {
String entryStr = (String) uninstallList.get(i);
if (!entryStr.startsWith("{"))
continue;
entryKey = reg.openKey(HKLM, basePath + "\\" + entryStr);
publisher = reg.readValueAsString(entryKey, "Publisher");
displayName = reg.readValueAsString(entryKey, "DisplayName");
if (publisher == null || displayName == null)
continue;
if (publisher.startsWith("Sun") && displayName.startsWith("Java 3D")) {
fullPath = "HKEY_LOCAL_MACHINE\\" + basePath + "\\" + entryStr;
Debug.trace("SearchRegistry: found entry at " + fullPath);
//entries.add(fullPath);
entries.add(entryStr);
}
}
} catch (Exception ex) {
Debug.trace("SearchRegistry: error searching registry");
ex.printStackTrace();
return null;
}
String[] out = null;
if (!entries.isEmpty()) {
out = new String[entries.size()];
for (int i = 0; i < out.length; i++) {
out[i] = entries.get(i);
}
}
return out;
}
private SearchRegistry()
{
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import com.izforge.izpack.util.AbstractUIProcessHandler;
import com.izforge.izpack.util.Debug;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class SearchRegistryJob
{
private static final String j3dRegistrySearchCommand = "@echo off\necho Searching Registry for Java3D Installs\nfor /f %%I in ('reg query HKLM\\SOFTWARE\\microsoft\\windows\\currentversion\\uninstall') do echo %%I | find \"{\" > nul && call :All-Installations %%I\necho Search Complete..\ngoto :EOF\n\n:All-Installations\nfor /f \"tokens=2*\" %%T in ('reg query %1 /v DisplayName 2^> nul') do echo . Found - %%U: | find \"Java 3D\" && call :Sun-Java3D-Installs %~n1\ngoto :EOF\n\n:Sun-Java3D-Installs\nset JAVA3D_REGISTRY_FOUND=true\nset JAVA3D_REGISTRY_PATH=%1\necho . Resuming Search..\ngoto :EOF\n\n:Quit\nif \"%JAVA3D_REGISTRY_FOUND%\"==\"true\" (\nexit /B 0\n) else (\nexit /B 1\n)\n";
public static void run(AbstractUIProcessHandler handler, String[] args)
{
//search windows registry
try {
Debug.trace("CustomValidator: searching Windows registry for Java3D installations");
String tmpDir = System.getProperty("java.io.tmpdir");
String tmpFile = tmpDir + "j3d_search_registry.bat";
Debug.trace("CustomValidator: creating script " + tmpFile);
File tmpf = new File(tmpFile);
if (tmpf.exists()) {
if (!tmpf.delete())
throw new IOException();
}
BufferedWriter out = new BufferedWriter(new FileWriter(tmpf));
out.write(j3dRegistrySearchCommand);
out.close();
Process p = Runtime.getRuntime().exec(tmpFile);
p.waitFor();
int exitValue = p.exitValue();
System.out.println("CustomValidator: execute exit value: " + exitValue + " - registry entry " + (exitValue == 0 ? "found" : "not found"));
} catch (IOException ex) {
Debug.trace("CustomValidator: canot search Windows registry, error writting search script");
} catch (InterruptedException ex) {
Debug.trace("CustomValidator: canot search Windows registry, error executing search script");
}
}
private SearchRegistryJob()
{
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pl.edu.icm.visnow.izpack;
import com.izforge.izpack.installer.AutomatedInstallData;
import com.izforge.izpack.installer.DataValidator;
import java.io.File;
/**
* @author Bartosz Borucki (babor@icm.edu.pl)
* University of Warsaw, Interdisciplinary Centre
* for Mathematical and Computational Modelling
*/
public class SystemJava3DWritableValidator implements com.izforge.izpack.installer.DataValidator
{
@Override
public Status validateData(AutomatedInstallData aid)
{
String os = System.getProperty("os.name");
String java_home = System.getProperty("java.home");
String java_extdirs = System.getProperty("java.ext.dirs");
String java_libdirs = System.getProperty("java.library.path");
String[] extDirs = java_extdirs.split(File.pathSeparator);
String[] libDirs = java_libdirs.split(File.pathSeparator);
boolean superuser = false;
System.out.println("");
//search JARs
String j3dcoreLocation = null;
for (int i = 0; i < extDirs.length; i++) {
j3dcoreLocation = searchDir(extDirs[i], "j3dcore.jar");