1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*
* 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.irc;
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.protocol.*;
/**
* The IRC protocol provider factory creates instances of the IRC protocol
* provider service. One Service instance corresponds to one account.
*
* @author Stephane Remy
* @author Loic Kempf
*/
public class ProtocolProviderFactoryIrcImpl
extends ProtocolProviderFactory
{
public ProtocolProviderFactoryIrcImpl()
{
super(IrcActivator.bundleContext, ProtocolNames.IRC);
}
/**
* Initialized and creates an account corresponding to the specified
* accountProperties and registers the resulting ProtocolProvider in the
* <tt>context</tt> BundleContext parameter.
*
* @param userIDStr the 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.
*/
public AccountID installAccount( String userIDStr,
Map<String, String> accountProperties)
{
BundleContext context = IrcActivator.bundleContext;
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");
accountProperties.put(USER_ID, userIDStr);
AccountID accountID = new IrcAccountID(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!");
//first store the account and only then load it as the load generates
//an OSGI event, the OSGI event triggers (through the UI) a call to the
//ProtocolProviderService.register() method and it needs to access
//the configuration service and check for a stored password.
this.storeAccount(accountID);
accountID = loadAccount(accountProperties);
return accountID;
}
protected AccountID createAccountID(String userID, Map<String, String> accountProperties)
{
return new IrcAccountID(userID, accountProperties);
}
protected ProtocolProviderService createService(String userID,
AccountID accountID)
{
ProtocolProviderServiceIrcImpl service =
new ProtocolProviderServiceIrcImpl();
service.initialize(userID, accountID);
return service;
}
@Override
public void modifyAccount( ProtocolProviderService protocolProvider,
Map<String, String> accountProperties)
throws NullPointerException
{
// TODO Auto-generated method stub
}
}
|