Openfire 3.5.0.rc1 Javadoc

org.jivesoftware.openfire.clearspace
Class ClearspaceManager

java.lang.Object
  extended by org.jivesoftware.openfire.container.BasicModule
      extended by org.jivesoftware.openfire.clearspace.ClearspaceManager
All Implemented Interfaces:
ExternalComponentManagerListener, Module

public class ClearspaceManager
extends BasicModule
implements ExternalComponentManagerListener

Centralized administration of Clearspace connections. The getInstance() method should be used to get an instance. The following properties configure this manager:

Author:
Daniel Henninger

Nested Class Summary
static class ClearspaceManager.HttpType
          Different kind of HTTP request types
 
Field Summary
protected static String IM_URL_PREFIX
           
 
Constructor Summary
ClearspaceManager()
          Constructs a new ClearspaceManager instance.
ClearspaceManager(Map<String,String> properties)
          Constructs a new ClearspaceManager instance.
 
Method Summary
 Boolean checkAuthentication(String username, String password)
          Check a username/password pair for valid authentication.
 void componentAllowed(String subdomain, ExternalComponentConfiguration configuration)
          Notification indicating that a new component was allowed to connect using a given configuration.
 void componentBlocked(String subdomain)
          Notification indicating that a component was blocked to connect to the server.
 void componentConfigurationDeleted(String subdomain)
          Notification indicating that the configuration of a component, that was either blocked or allowed to connect, is being deleted.
 void componentSecretUpdated(String subdomain, String newSecret)
          Notification indicating that the configuration of a component, that was either blocked or allowed to connect, is being deleted.
 void defaultSecretChanged(String newSecret)
          Notification indicating that the default secret is being modified.
 org.dom4j.Element executeRequest(ClearspaceManager.HttpType type, String urlSuffix)
          Makes a rest request of either type GET or DELETE at the specified urlSuffix.
 org.dom4j.Element executeRequest(ClearspaceManager.HttpType type, String urlSuffix, String xmlParams)
           
 String getConnectionURI()
          Returns the Clearspace service URI; e.g.
protected  long getGroupID(String groupname)
          Returns the Clearspace group id of the group.
static ClearspaceManager getInstance()
          Provides singleton access to an instance of the ClearspaceManager class.
 String getSharedSecret()
          Returns the password, configured in Clearspace, that Openfire will use to authenticate with Clearspace to perform it's integration.
protected  long getUserID(JID user)
          Returns the Clearspace user id the user by JID.
protected  long getUserID(String username)
          Returns the Clearspace user id the user by username.
 boolean isEnabled()
          Returns true if Clearspace is being used as the backend of Openfire.
 void permissionPolicyChanged(ExternalComponentManager.PermissionPolicy newPolicy)
          Notification indicating that the permission policy is being modified.
 void portChanged(int newPort)
          Notification indicating that the port used by external components is being modified.
 void serviceEnabled(boolean enabled)
          Notification indicating whether the service is being enabled or disabled.
 void setConnectionURI(String uri)
          Sets the URI of the Clearspace service; e.g., https://localhost:80/clearspace.
 void setSharedSecret(String sharedSecret)
          Sets the shared secret for the Clearspace service we're connecting to.
 void start()
          Starts the basic module.
 Boolean testConnection()
          Tests the web services connection with Clearspace given the manager's current configuration.
 
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName, initialize, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IM_URL_PREFIX

protected static final String IM_URL_PREFIX
See Also:
Constant Field Values
Constructor Detail

ClearspaceManager

public ClearspaceManager(Map<String,String> properties)
Constructs a new ClearspaceManager instance. Typically, getInstance() should be called instead of this method. ClearspaceManager instances should only be created directly for testing purposes.

Parameters:
properties - the Map that contains properties used by the Clearspace manager, such as Clearspace host and shared secret.

ClearspaceManager

public ClearspaceManager()
Constructs a new ClearspaceManager instance. Typically, getInstance() should be called instead of this method. ClearspaceManager instances should only be created directly for testing purposes.

Method Detail

getInstance

public static ClearspaceManager getInstance()
Provides singleton access to an instance of the ClearspaceManager class.

Returns:
an ClearspaceManager instance.

checkAuthentication

public Boolean checkAuthentication(String username,
                                   String password)
Check a username/password pair for valid authentication.

Parameters:
username - Username to authenticate against.
password - Password to use for authentication.
Returns:
True or false of the authentication succeeded.

testConnection

public Boolean testConnection()
Tests the web services connection with Clearspace given the manager's current configuration.

Returns:
True if connection test was successful.

getConnectionURI

public String getConnectionURI()
Returns the Clearspace service URI; e.g. https://localhost:80/clearspace. This value is stored as the Jive Property clearspace.uri.

Returns:
the Clearspace service URI.

setConnectionURI

public void setConnectionURI(String uri)
Sets the URI of the Clearspace service; e.g., https://localhost:80/clearspace. This value is stored as the Jive Property clearspace.uri.

Parameters:
uri - the Clearspace service URI.

getSharedSecret

public String getSharedSecret()
Returns the password, configured in Clearspace, that Openfire will use to authenticate with Clearspace to perform it's integration.

Returns:
the password Openfire will use to authenticate with Clearspace.

setSharedSecret

public void setSharedSecret(String sharedSecret)
Sets the shared secret for the Clearspace service we're connecting to.

Parameters:
sharedSecret - the password configured in Clearspace to authenticate Openfire.

isEnabled

public boolean isEnabled()
Returns true if Clearspace is being used as the backend of Openfire. When integrated with Clearspace then users and groups will be pulled out from Clearspace. User authentication will also rely on Clearspace.

Returns:
true if Clearspace is being used as the backend of Openfire.

start

public void start()
           throws IllegalStateException
Description copied from class: BasicModule

Starts the basic module.

Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.

Specified by:
start in interface Module
Overrides:
start in class BasicModule
Throws:
IllegalStateException - If start is called before initialize successfully returns

serviceEnabled

public void serviceEnabled(boolean enabled)
                    throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating whether the service is being enabled or disabled. The listener may throw an exception to not allow the change from taking place.

Specified by:
serviceEnabled in interface ExternalComponentManagerListener
Parameters:
enabled - true if the service is being enabled.
Throws:
ModificationNotAllowedException - if the operation was denied.

portChanged

public void portChanged(int newPort)
                 throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that the port used by external components is being modified. The listener may throw an exception to not allow the change from taking place.

Specified by:
portChanged in interface ExternalComponentManagerListener
Parameters:
newPort - new default secret being set.
Throws:
ModificationNotAllowedException - if the operation was denied.

defaultSecretChanged

public void defaultSecretChanged(String newSecret)
                          throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that the default secret is being modified. The listener may throw an exception to not allow the change from taking place.

Specified by:
defaultSecretChanged in interface ExternalComponentManagerListener
Parameters:
newSecret - new default secret being set.
Throws:
ModificationNotAllowedException - if the operation was denied.

permissionPolicyChanged

public void permissionPolicyChanged(ExternalComponentManager.PermissionPolicy newPolicy)
                             throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that the permission policy is being modified. See ExternalComponentManager.PermissionPolicy for more information. The listener may throw an exception to not allow the change from taking place.

Specified by:
permissionPolicyChanged in interface ExternalComponentManagerListener
Parameters:
newPolicy - new permission policy being set.
Throws:
ModificationNotAllowedException - if the operation was denied.

componentAllowed

public void componentAllowed(String subdomain,
                             ExternalComponentConfiguration configuration)
                      throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that a new component was allowed to connect using a given configuration. The listener may throw an exception to not allow the change from taking place.

Specified by:
componentAllowed in interface ExternalComponentManagerListener
Parameters:
subdomain - subdomain of the added component.
configuration - configuration for the external component.
Throws:
ModificationNotAllowedException - if the operation was denied.

componentBlocked

public void componentBlocked(String subdomain)
                      throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that a component was blocked to connect to the server. The listener may throw an exception to not allow the change from taking place.

Specified by:
componentBlocked in interface ExternalComponentManagerListener
Parameters:
subdomain - subdomain of the blocked component.
Throws:
ModificationNotAllowedException - if the operation was denied.

componentSecretUpdated

public void componentSecretUpdated(String subdomain,
                                   String newSecret)
                            throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that the configuration of a component, that was either blocked or allowed to connect, is being deleted. The listener may throw an exception to not allow the change from taking place.

Specified by:
componentSecretUpdated in interface ExternalComponentManagerListener
Parameters:
subdomain - subdomain of the component.
newSecret - new secret being set for the component.
Throws:
ModificationNotAllowedException - if the operation was denied.

componentConfigurationDeleted

public void componentConfigurationDeleted(String subdomain)
                                   throws ModificationNotAllowedException
Description copied from interface: ExternalComponentManagerListener
Notification indicating that the configuration of a component, that was either blocked or allowed to connect, is being deleted. The listener may throw an exception to not allow the change from taking place.

Specified by:
componentConfigurationDeleted in interface ExternalComponentManagerListener
Parameters:
subdomain - subdomain of the component.
Throws:
ModificationNotAllowedException - if the operation was denied.

executeRequest

public org.dom4j.Element executeRequest(ClearspaceManager.HttpType type,
                                        String urlSuffix)
                                 throws ConnectException,
                                        Exception
Makes a rest request of either type GET or DELETE at the specified urlSuffix.

urlSuffix should be of the form /userService/users

Parameters:
type - Must be GET or DELETE
urlSuffix - The url suffix of the rest request
Returns:
The response as a xml doc.
Throws:
ConnectException - Thrown if there are issues perfoming the request.
Exception - Thrown if the response from Clearspace contains an exception.

executeRequest

public org.dom4j.Element executeRequest(ClearspaceManager.HttpType type,
                                        String urlSuffix,
                                        String xmlParams)
                                 throws ConnectException,
                                        Exception
Throws:
ConnectException
Exception

getUserID

protected long getUserID(String username)
                  throws UserNotFoundException
Returns the Clearspace user id the user by username.

Parameters:
username - Username to retrieve ID of.
Returns:
The ID number of the user in Clearspace.
Throws:
UserNotFoundException - If the user was not found.

getUserID

protected long getUserID(JID user)
                  throws UserNotFoundException
Returns the Clearspace user id the user by JID.

Parameters:
user - JID of user to retrieve ID of.
Returns:
The ID number of the user in Clearspace.
Throws:
UserNotFoundException - If the user was not found.

getGroupID

protected long getGroupID(String groupname)
                   throws GroupNotFoundException
Returns the Clearspace group id of the group.

Parameters:
groupname - Name of the group to retrieve ID of.
Returns:
The ID number of the group in Clearspace.
Throws:
GroupNotFoundException - If the group was not found.

Openfire 3.5.0.rc1 Javadoc

Copyright © 2003-2007 Jive Software.