// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
// 
//     public static final boolean LOG_INFO = true;
//     public static final boolean LOG_DEBUG = false;
//     public static final boolean LOG_ERROR = true;
// 
//     private static final String SEP = ":: ";
// 
//     private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 
//     public static void logInfo( Object owner, String msg ) {
//         if (LOG_INFO) {
//             msg = toMessage(owner, msg);
//             System.out.println(msg);
//         }
//     }
// 
//     public static void logDebug( Object owner, String msg ) {
//         if (LOG_DEBUG) {
//             msg = toMessage(owner, msg);
//             System.out.println(msg);
//         }
//     }
// 
//     public static void logError( Object owner, String msg, Throwable e ) {
//         if (LOG_ERROR) {
//             msg = toMessage(owner, msg);
//             System.err.println(msg);
//             e.printStackTrace();
//         }
//     }
// 
//     public static void logError( Object owner, Throwable e ) {
//         logError(owner, null, e);
//     }
// 
//     private static String toMessage( Object owner, String msg ) {
//         if (msg == null)
//             msg = "";
//         String newMsg = f.format(new Date()) + SEP;
//         if (owner instanceof String) {
//             newMsg = newMsg + owner + SEP;
//         } else {
//             newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
//         }
//         newMsg = newMsg + msg;
//         return newMsg;
//     }
// 
// }


import java.io.File;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import eu.hydrologis.stage.libs.log.StageLogger;
package eu.hydrologis.stage.libs;




public class StageLibsActivator implements BundleActivator {

    private static File bundleFile;

    /**
     * The java -D commandline property that defines the workspace.
     */
    private static final String STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY = "stage.javaexec";

    private static File geotoolsLibsFolder;

    private static File spatialToolboxFolder;

    private static File stageJavaExecFile;

    @Override
    public void start( BundleContext context ) throws Exception {
        Bundle bundle = context.getBundle();

        bundleFile = FileLocator.getBundleFile(bundle);

        StageLogger.logInfo(this, "Libs bundle file: " + bundleFile.getAbsolutePath());

        geotoolsLibsFolder = new File(bundleFile, "libs-geotools");
        spatialToolboxFolder = new File(bundleFile, "spatialtoolbox");

        String stageJavaExecPath = System.getProperty(STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY);
        boolean javaMissing = false;
        if (stageJavaExecPath != null) {
            stageJavaExecFile = new File(stageJavaExecPath);
            if (stageJavaExecFile.exists()) {
// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
// 
//     public static final boolean LOG_INFO = true;
//     public static final boolean LOG_DEBUG = false;
//     public static final boolean LOG_ERROR = true;
// 
//     private static final String SEP = ":: ";
// 
//     private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 
//     public static void logInfo( Object owner, String msg ) {
//         if (LOG_INFO) {
//             msg = toMessage(owner, msg);
//             System.out.println(msg);
//         }
//     }
// 
//     public static void logDebug( Object owner, String msg ) {
//         if (LOG_DEBUG) {
//             msg = toMessage(owner, msg);
//             System.out.println(msg);
//         }
//     }
// 
//     public static void logError( Object owner, String msg, Throwable e ) {
//         if (LOG_ERROR) {
//             msg = toMessage(owner, msg);
//             System.err.println(msg);
//             e.printStackTrace();
//         }
//     }
// 
//     public static void logError( Object owner, Throwable e ) {
//         logError(owner, null, e);
//     }
// 
//     private static String toMessage( Object owner, String msg ) {
//         if (msg == null)
//             msg = "";
//         String newMsg = f.format(new Date()) + SEP;
//         if (owner instanceof String) {
//             newMsg = newMsg + owner + SEP;
//         } else {
//             newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
//         }
//         newMsg = newMsg + msg;
//         return newMsg;
//     }
// 
// }


// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/StageLibsActivator.java
import java.io.File;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import eu.hydrologis.stage.libs.log.StageLogger;

package eu.hydrologis.stage.libs;




public class StageLibsActivator implements BundleActivator {

    private static File bundleFile;

    /**
     * The java -D commandline property that defines the workspace.
     */
    private static final String STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY = "stage.javaexec";

    private static File geotoolsLibsFolder;

    private static File spatialToolboxFolder;

    private static File stageJavaExecFile;

    @Override
    public void start( BundleContext context ) throws Exception {
        Bundle bundle = context.getBundle();

        bundleFile = FileLocator.getBundleFile(bundle);

        StageLogger.logInfo(this, "Libs bundle file: " + bundleFile.getAbsolutePath());

        geotoolsLibsFolder = new File(bundleFile, "libs-geotools");
        spatialToolboxFolder = new File(bundleFile, "spatialtoolbox");

        String stageJavaExecPath = System.getProperty(STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY);
        boolean javaMissing = false;
        if (stageJavaExecPath != null) {
            stageJavaExecFile = new File(stageJavaExecPath);
            if (stageJavaExecFile.exists()) {
                StageLogger.logInfo(this, "Java executable: " + stageJavaExecFile.getAbsolutePath());