diff options
author | Emil Ivov <emcho@jitsi.org> | 2006-08-04 11:26:04 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2006-08-04 11:26:04 +0000 |
commit | 6c7b19a20cdce3253b31ed5ce6a6c1161254fbc5 (patch) | |
tree | 0b061ffc5c6d08ec64662650713370dbdcae8fbe /src | |
parent | 0df2d5ee197a6f85f6df37e6eae05c118a9acfb6 (diff) | |
download | jitsi-6c7b19a20cdce3253b31ed5ce6a6c1161254fbc5.zip jitsi-6c7b19a20cdce3253b31ed5ce6a6c1161254fbc5.tar.gz jitsi-6c7b19a20cdce3253b31ed5ce6a6c1161254fbc5.tar.bz2 |
Renamed to proto factory
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/icq/AccountManagerIcqImpl.java | 156 | ||||
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/AccountManager.java | 99 |
2 files changed, 0 insertions, 255 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/AccountManagerIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/AccountManagerIcqImpl.java deleted file mode 100644 index 20b328f..0000000 --- a/src/net/java/sip/communicator/impl/protocol/icq/AccountManagerIcqImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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.protocol.icq; - -import java.util.*; - -import org.osgi.framework.*; -import net.java.sip.communicator.service.protocol.*; -import net.java.sip.communicator.service.configuration.*; - -/** - * The ICQ implementation of the ProtocolAccountManager. - * @author Emil Ivov - */ -public class AccountManagerIcqImpl - implements AccountManager -{ - private Hashtable registeredAccounts = new Hashtable(); - - - /** - * Creates an instance of the IcqAccountManager. - */ - protected void IcqAccountManager() - { - - } - /** - * Returns a copy of the list containing all accounts currently - * registered in this protocol provider. - * - * @return a copy of the llist containing all accounts currently installed - * in the protocol provider. - */ - public ArrayList getRegisteredAccounts() - { - return new ArrayList(registeredAccounts.keySet()); - } - - /** - * Returns the ServiceReference for the protocol provider corresponding to - * the specified accountID or null if the accountID is unknown. - * @param accountID the accountID of the protocol provider we'd like to get - * @return a ServiceReference object to the protocol provider with the - * specified account id and null if the account id is unknwon to the - * account manager. - */ - public ServiceReference getProviderForAccount(AccountID accountID) - { - ServiceRegistration registration - = (ServiceRegistration)registeredAccounts.get(accountID); - - return (registration == null ) - ? null - : registration.getReference(); - } - - /** - * Initializaed and creates an accoung corresponding to the specified - * accountProperties and registers the resulting ProtocolProvider in the - * <tt>context</tt> BundleContext parameter. - * - * @param context the BundleContext parameter where the newly created - * ProtocolProviderService would have to be registered. - * @param userIDStr the user identifier for the new account - * @param accountProperties a set of protocol (or implementation) - * specific properties defining the new account. - * @return the AccountID of the newly created account - */ - public AccountID installAccount( BundleContext context, - String userIDStr, - Map accountProperties) - { - if(context == null) - throw new NullPointerException("The specified BundleContext was null"); - - if(userIDStr == null) - throw new NullPointerException("The specified AccountID was null"); - - if(accountProperties == null) - throw new NullPointerException("The specified property map was null"); - - AccountID accountID = new IcqAccountID(userIDStr, accountProperties); - - //make sure we haven't seen this account id before. - if( registeredAccounts.containsKey(accountID) ) - throw new IllegalStateException( - "An account for id " + userIDStr + " was already installed!"); - - Hashtable properties = new Hashtable(); - properties.put( - AccountManager.PROTOCOL_PROPERTY_NAME, ProtocolNames.ICQ); - properties.put( - AccountManager.ACCOUNT_ID_PROPERTY_NAME, userIDStr); - - ProtocolProviderServiceIcqImpl icqProtocolProvider - = new ProtocolProviderServiceIcqImpl(); - - icqProtocolProvider.initialize(userIDStr, accountID); - - ServiceRegistration registration - = context.registerService( ProtocolProviderService.class.getName(), - icqProtocolProvider, - properties); - - registeredAccounts.put(accountID, registration); - return accountID; - } - - /** - * Removes the specified account from the list of accounts that this - * account manager is handling. If the specified accountID is unknown to the - * AccountManager, the call has no effect and false is returned. This method - * is persistent in nature and once called the account corresponding to the - * specified ID will not be loaded during future runs of the project. - * - * @param accountID the ID of the account to remove. - * @return true if an account with the specified ID existed and was removed - * and false otherwise. - */ - public boolean uninstallAccount(AccountID accountID) - { - ServiceRegistration registration - = (ServiceRegistration)registeredAccounts.remove(accountID); - - if(registration == null) - return false; - - //kill the service - registration.unregister(); - - return true; - - } - - /** - * Loads all previously installed accounts that were stored in the - * configuration service. The method is only loading accounts the first - * time it gets called. - * - * @param context the context where icq protocol providers shouold be - * registered - * @param configurationService ConfigurationService - */ - void loadStoredAccounts(BundleContext context, - ConfigurationService configurationService) - { - /** @todo implement loadStoredAccounts() */ - //make sure we haven't already done so. - //load all accounts stored in the configuration service - } -} diff --git a/src/net/java/sip/communicator/service/protocol/AccountManager.java b/src/net/java/sip/communicator/service/protocol/AccountManager.java deleted file mode 100644 index 286a710..0000000 --- a/src/net/java/sip/communicator/service/protocol/AccountManager.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.service.protocol; - -import java.util.*; -import org.osgi.framework.*; - -/** - * The AccountManager is what actually creates instances of a - * ProtocolProviderService implementation. An account managere would register, - * persistently store, and remove when necessary, ProtocolProviders. The way - * things are in the SIP Communicator, a user account is representedy (in a 1:1 - * relationship) by an AccountID and a ProtocolProvider. In other words - one - * would have as many protocol providers installed in a given moment as they - * would user account registered through the various services. - * - * @author Emil Ivov - */ -public interface AccountManager -{ - /** - * The name of the OSGI service property which represents the name of the - * protocol for an AccountManager - */ - public static final String PROTOCOL_PROPERTY_NAME = "protocol.name"; - - /** - * The name of the OSGI service property which represents the AccountID of - * a ProtocolProvider. - */ - public static final String ACCOUNT_ID_PROPERTY_NAME = "account.id"; - - /** - * Initializaed and creates an account corresponding to the specified - * accountProperties and registers the resulting ProtocolProvider in the - * <tt>context</tt> BundleContext parameter. Note that account - * registration is persistent and accounts that are registered during - * a particular sip-communicator session would be automatically reloaded - * during all following sessions until they are removed through the - * removeAccount method. - * - * @param context the BundleContext parameter where the newly created - * ProtocolProviderService would have to be registered. - * @param userID tha/a user identifier uniquely representing the newly - * created account within the protocol namespace. - * @param accountProperties a set of protocol (or implementation) specific - * properties defining the new account. - * @return the AccountID of the newly created account. - * @throws java.lang.IllegalArgumentException if userID does not correspond - * to an identifier in the context of the underlying protocol or if - * accountProperties does not contain a complete set of account installation - * properties. - * @throws java.lang.IllegalStateException if the account has already been - * installed. - * @throws java.lang.NullPointerException if any of the arguments is null. - */ - public AccountID installAccount(BundleContext context, - String userID, Map accountProperties) - throws IllegalArgumentException, - IllegalStateException, - NullPointerException; - - - /** - * Returns a copy of the list containing all accounts currently registered - * in this protocol provider. - * @return ArrayList - */ - public ArrayList getRegisteredAccounts(); - - /** - * Returns the ServiceReference for the protocol provider corresponding to - * the specified accountID or null if the accountID is unknown. - * @param accountID the accountID of the protocol provider we'd like to get - * @return a ServiceReference object to the protocol provider with the - * specified account id and null if the account id is unknwon to the - * account manager. - */ - public ServiceReference getProviderForAccount(AccountID accountID); - - /** - * Removes the specified account from the list of accounts that this - * account manager is handling. If the specified accountID is unknown to the - * AccountManager, the call has no effect and false is returned. This method - * is persistent in nature and once called the account corresponding to the - * specified ID will not be loaded during future runs of the project. - * - * @param accountID the ID of the account to remove. - * @return true if an account with the specified ID existed and was removed - * and false otherwise. - */ - public boolean uninstallAccount(AccountID accountID); - - -} |