Added static methods for retrieving

cusax-fix
Emil Ivov 20 years ago
parent 7332d1d840
commit 0e9b96f460

@ -8,6 +8,9 @@
import org.osgi.framework.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.service.configuration.*;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* Activates the SIP package
@ -18,6 +21,12 @@ public class SipActivator
{
private Logger logger = Logger.getLogger(SipActivator.class.getName());
private ServiceRegistration sipPpFactoryServReg = null;
private static BundleContext bundleContext = null;
private static ConfigurationService configurationService = null;
private static ProtocolProviderFactorySipImpl sipProviderFactory = null;
/**
* Called when this bundle is started so the Framework can perform the
* bundle-specific activities necessary to start this bundle.
@ -31,6 +40,63 @@ public class SipActivator
public void start(BundleContext context) throws Exception
{
logger.debug("Started.");
this.bundleContext = context;
Hashtable hashtable = new Hashtable();
hashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.SIP);
sipProviderFactory = new ProtocolProviderFactorySipImpl();
//load all icq providers
sipProviderFactory.loadStoredAccounts();
//reg the icq account man.
sipPpFactoryServReg = context.registerService(
ProtocolProviderFactory.class.getName(),
sipProviderFactory,
hashtable);
}
/**
* Returns a reference to a ConfigurationService implementation currently
* registered in the bundle context or null if no such implementation was
* found.
*
* @return ConfigurationService a currently valid implementation of the
* configuration service.
*/
public static ConfigurationService getConfigurationService()
{
if(configurationService == null)
{
ServiceReference confReference
= bundleContext.getServiceReference(
ConfigurationService.class.getName());
configurationService
= (ConfigurationService) bundleContext.getService(confReference);
}
return configurationService;
}
/**
* Returns a reference to the bundle context that we were started with.
* @return a reference to the BundleContext instance that we were started
* witn.
*/
public static BundleContext getBundleContext()
{
return bundleContext;
}
/**
* Retrurns a reference to the protocol provider factory that we have
* registered.
* @return a reference to the <tt>ProtocolProviderFactorySipImpl</tt>
* instance that we have registered from this package.
*/
static ProtocolProviderFactorySipImpl getProtocolProviderFactory()
{
return sipProviderFactory;
}
/**

Loading…
Cancel
Save