net.sourceforge.mflow.impl
Class ContactMethodManagerImpl

java.lang.Object
  extended bynet.sourceforge.mflow.impl.ContactMethodManagerImpl
All Implemented Interfaces:
ContactMethodManager

public class ContactMethodManagerImpl
extends java.lang.Object
implements ContactMethodManager

A class for managing instances of ContactMethod

Version:
$Revision: 1.3 $
Author:
David Carr

Method Summary
 void addContactMethodType(java.lang.Class cmt, java.lang.String protocol)
          Adds a new type of contact method
 ContactMethod getInstance(java.lang.String protocol, java.lang.String identifier)
          Gets an instance of a matching ContactMethod.
 java.lang.String[] getProtocols()
          Returns an array of all known protocols
 ContactMethod parse(java.lang.String s)
          Returns a ContactMethod from a string in the format protocol:identifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addContactMethodType

public void addContactMethodType(java.lang.Class cmt,
                                 java.lang.String protocol)
                          throws java.util.TooManyListenersException,
                                 java.lang.ClassCastException
Description copied from interface: ContactMethodManager
Adds a new type of contact method

Specified by:
addContactMethodType in interface ContactMethodManager
Parameters:
cmt - the Class object for the ContactMethod implementation
protocol - the protocol that this ContactMethod implementation handles
Throws:
java.util.TooManyListenersException - when a handler for this protocol has already been defined
java.lang.ClassCastException

parse

public ContactMethod parse(java.lang.String s)
                    throws java.text.ParseException
Description copied from interface: ContactMethodManager
Returns a ContactMethod from a string in the format protocol:identifier

Specified by:
parse in interface ContactMethodManager
Parameters:
s - the string to parse
Returns:
a ContactMethod from this string, or null if getInstance fails
Throws:
java.text.ParseException - if the passed string cannot be parsed
See Also:
ContactMethodManager.getInstance(String,String)

getInstance

public ContactMethod getInstance(java.lang.String protocol,
                                 java.lang.String identifier)
Description copied from interface: ContactMethodManager
Gets an instance of a matching ContactMethod. If none exists, a new ContactMethod is created and returned. If there are multiple ContactMethods with the same protocol and identifier, it is undefined which is returned.

Specified by:
getInstance in interface ContactMethodManager
Parameters:
protocol - the protocol for the ContactMethod
identifier - the identifier for the ContactMethod
Returns:
a ContactMethod with the specified information, returning an existing instance if there is one. Returns null if no ContactMethod implementation is available for the protocol.

getProtocols

public java.lang.String[] getProtocols()
Description copied from interface: ContactMethodManager
Returns an array of all known protocols

Specified by:
getProtocols in interface ContactMethodManager
Returns:
an array of Strings containing the defined protocols


Copyright © 2002-2004 MFlow Group. All Rights Reserved.