/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.impl.credentialsstorage;

import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;

import org.osgi.framework.*;

/**
 * Activator for the {@link CredentialsStorageService}.
 *
 * @author Dmitri Melnikov
 */
public class CredentialsStorageActivator
    implements BundleActivator
{
    /**
     * The <tt>Logger</tt> used by the <tt>CredentialsStorageActivator</tt>
     * class and its instances.
     */
    private static final Logger logger
        = Logger.getLogger(CredentialsStorageActivator.class);

    /**
     * The {@link CredentialsStorageService} implementation.
     */
    private CredentialsStorageServiceImpl impl;
    
    /**
     * The {@link BundleContext}.
     */
    private static BundleContext bundleContext;
    
    /**
     * The user interface service.
     */
    private static UIService uiService;

    /**
     * Starts the credentials storage service
     * 
     * @param bundleContext the <tt>BundleContext</tt> as provided from the OSGi
     * framework
     * @throws Exception if anything goes wrong
     */
    public void start(BundleContext bundleContext) throws Exception
    {
        if (logger.isDebugEnabled())
        {
            logger.debug(
                    "Service Impl: " + getClass().getName() + " [  STARTED ]");
        }
        
        CredentialsStorageActivator.bundleContext = bundleContext;

        impl = new CredentialsStorageServiceImpl();
        impl.start(bundleContext);

        bundleContext.registerService(
            CredentialsStorageService.class.getName(), impl, null);

        if (logger.isDebugEnabled())
        {
            logger.debug(
                    "Service Impl: " + getClass().getName() + " [REGISTERED]");
        }
    }

    /**
     * Unregisters the credentials storage service.
     * 
     * @param bundleContext BundleContext
     * @throws Exception if anything goes wrong
     */
    public void stop(BundleContext bundleContext) throws Exception
    {
        logger.logEntry();
        impl.stop();
        logger
            .info("The CredentialsStorageService stop method has been called.");
    }

    /**
     * Returns a reference to an UIService implementation currently registered
     * in the bundle context or null if no such implementation was found.
     *
     * @return a reference to an UIService implementation currently registered
     * in the bundle context or null if no such implementation was found.
     */
    public static UIService getUIService()
    {
        if (uiService == null)
            uiService = ServiceUtils.getService(bundleContext, UIService.class);
        return uiService;
    }

    /**
     * Returns the service corresponding to the <tt>ServiceReference</tt>.
     *
     * @param serviceReference service reference
     * @return service
     */
    public static Object getService(ServiceReference serviceReference)
    {
        return bundleContext.getService(serviceReference);
    }
}

@@ -279,56 +279,8 @@
 .*;%0A
-import net.java.sip.communicator.service.gui.*;%0A
 impo
@@ -316,16 +316,16 @@
 util.*;%0A
+
 %0Aimport 
@@ -867,21 +867,17 @@
 l impl;%0A
-    
 %0A
+
     /**%0A
@@ -969,104 +969,8 @@
 ext;
-%0A    %0A    /**%0A     * The user interface service.%0A     */%0A    private static UIService uiService;
 %0A%0A  
@@ -2157,32 +2157,32 @@
 %0A        logger%0A
+
             .inf
@@ -2257,531 +2257,8 @@
  %7D%0A%0A
-    /**%0A     * Returns a reference to an UIService implementation currently registered%0A     * in the bundle context or null if no such implementation was found.%0A     *%0A     * @return a reference to an UIService implementation currently registered%0A     * in the bundle context or null if no such implementation was found.%0A     */%0A    public static UIService getUIService()%0A    %7B%0A        if (uiService == null)%0A            uiService = ServiceUtils.getService(bundleContext, UIService.class);%0A        return uiService;%0A    %7D%0A%0A
     

Remove unused method and variable.