// Path: chameria-service/src/main/java/de/akquinet/chameria/services/ActivationService.java
// public interface ActivationService {
// 
//     /**
//      * Method called by the launcher every time the application is activate.
//      * The given arguments are the launcher argument, and so can contain
//      * the <code>-open</code> argument.
//      * @param args the arguments
//      */
//     public void activation(String[] args);
// 
//     /**
//      * Method called by the launcher when the application stops.
//      */
//     public void deactivation();
// 
// 
// }


import org.ow2.chameleon.core.Chameleon;
import de.akquinet.chameria.services.ActivationService;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.launch.Framework;
            cache = new File(storage);
        }

        return conf;
    }


    public static File detectLocation() {
        String location = System.getProperty(CHAMERIA_INSTALL_LOCATION_PROP);

        location =
                SubstVars.substVars(location, CHAMERIA_INSTALL_LOCATION_PROP, null, System
                        .getProperties());

        return new File(location);
    }

    public Framework start(String[] args) throws BundleException {
        File lock = new File(cache, ".lock");
        if (lock.exists()) {
            return null;
        }

        m_framework =  start();

        // To avoid race condition for the activation service
        // this must be synchronized
        synchronized (this) {
            try {
                m_framework.getBundleContext().addServiceListener(new ActivationListener(),
// Path: chameria-service/src/main/java/de/akquinet/chameria/services/ActivationService.java
// public interface ActivationService {
// 
//     /**
//      * Method called by the launcher every time the application is activate.
//      * The given arguments are the launcher argument, and so can contain
//      * the <code>-open</code> argument.
//      * @param args the arguments
//      */
//     public void activation(String[] args);
// 
//     /**
//      * Method called by the launcher when the application stops.
//      */
//     public void deactivation();
// 
// 
// }


// Path: chameria-launcher/src/main/java/de/akquinet/chameria/launcher/ChameRIA.java
import org.ow2.chameleon.core.Chameleon;
import de.akquinet.chameria.services.ActivationService;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.launch.Framework;

            cache = new File(storage);
        }

        return conf;
    }


    public static File detectLocation() {
        String location = System.getProperty(CHAMERIA_INSTALL_LOCATION_PROP);

        location =
                SubstVars.substVars(location, CHAMERIA_INSTALL_LOCATION_PROP, null, System
                        .getProperties());

        return new File(location);
    }

    public Framework start(String[] args) throws BundleException {
        File lock = new File(cache, ".lock");
        if (lock.exists()) {
            return null;
        }

        m_framework =  start();

        // To avoid race condition for the activation service
        // this must be synchronized
        synchronized (this) {
            try {
                m_framework.getBundleContext().addServiceListener(new ActivationListener(),
                        "(" + Constants.OBJECTCLASS + "=" + ActivationService.class.getName() + ")");