package com.cognifide.apm.core.activator;

import com.cognifide.apm.core.launchers.StartupScriptLauncher;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.SynchronousBundleListener;

public class Activator implements BundleActivator, SynchronousBundleListener {

  @Override
  public void start(BundleContext context) throws Exception {
    context.addBundleListener(this);
  }

  @Override
  public void stop(BundleContext context) throws Exception {

  }

  @Override
  public void bundleChanged(BundleEvent event) {
    if (event.getType() == BundleEvent.STARTED) {
      BundleContext context = event.getBundle().getBundleContext();
      ServiceReference<StartupScriptLauncher> reference = context.getServiceReference(StartupScriptLauncher.class);
      StartupScriptLauncher startupScriptLauncher = context.getService(reference);
      startupScriptLauncher.process();
    }
  }

}

@@ -1,8 +1,832 @@
+/*-%0D%0A * ========================LICENSE_START=================================%0D%0A * AEM Permission Management%0D%0A * %25%25%0D%0A * Copyright (C) 2013 Wunderman Thompson Technology%0D%0A * %25%25%0D%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A * you may not use this file except in compliance with the License.%0D%0A * You may obtain a copy of the License at%0D%0A *%0D%0A *      http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A * Unless required by applicable law or agreed to in writing, software%0D%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A * See the License for the specific language governing permissions and%0D%0A * limitations under the License.%0D%0A * =========================LICENSE_END==================================%0D%0A */%0D%0A
 package 

fix onStartup and onStartupIfModified issue