blob: e95a806cef48d2b943c0f7dc97c1d107bb67b9be [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2009 empolis GmbH and brox IT Solutions GmbH. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Juergen Schumacher (empolis GmbH) - initial API and implementation
*******************************************************************************/
package org.eclipse.smila.webservice;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the bundle life cycle.
*/
public class Activator implements BundleActivator {
/**
* The bundle ID.
*/
public static final String BUNDLE_ID = "org.eclipse.smila.webservice";
/**
* The shared instance.
*/
private static Activator s_instance;
/**
* The Webservice Publisher.
*/
private WebservicePublisher _webservicePublisher;
/**
* Returns the shared instance.
*
* @return the shared instance
*/
public static Activator getDefault() {
return s_instance;
}
/** set instance for access via {@link #getDefault()}. */
private static void setDefault(final Activator instance) {
s_instance = instance;
}
/**
* {@inheritDoc} Create and activate Webservice Publisher.
*/
@Override
public void start(final BundleContext context) throws Exception {
setDefault(this);
_webservicePublisher = new WebservicePublisher(context);
_webservicePublisher.open();
}
/**
* {@inheritDoc} Stop and release the webservice publisher.
*/
@Override
public void stop(final BundleContext context) throws Exception {
if (_webservicePublisher != null) {
_webservicePublisher.close();
}
_webservicePublisher = null;
setDefault(null);
}
}