1 /*
2 * (C) 2002 David Carr david@carr.name
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package net.sourceforge.mflow.api;
20
21 import java.text.ParseException;
22 import java.util.TooManyListenersException;
23
24 /***
25 * A class for managing instances of ContactMethod
26 *
27 * @author <a href="mailto:david@carr.name">David Carr</a>
28 * @version $Revision: 1.4 $
29 */
30 public interface ContactMethodManager {
31 /***
32 * Adds a new type of contact method
33 *
34 * @param cmt the Class object for the ContactMethod implementation
35 * @param protocol the protocol that this ContactMethod implementation
36 * handles
37 * @throws TooManyListenersException when a handler for this protocol has
38 * already been defined
39 */
40 void addContactMethodType(Class cmt, String protocol)
41 throws TooManyListenersException;
42
43 /***
44 * Returns a ContactMethod from a string in the format protocol:identifier
45 *
46 * @param s the string to parse
47 * @return a ContactMethod from this string, or null if getInstance fails
48 * @throws ParseException if the passed string cannot be parsed
49 * @see #getInstance(String,String)
50 */
51 ContactMethod parse(String s) throws ParseException;
52
53 /***
54 * Gets an instance of a matching ContactMethod. If none exists, a new
55 * ContactMethod is created and returned. If there are multiple
56 * ContactMethods with the same protocol and identifier, it is undefined
57 * which is returned.
58 *
59 * @param protocol the protocol for the ContactMethod
60 * @param identifier the identifier for the ContactMethod
61 * @return a ContactMethod with the specified information, returning an
62 * existing instance if there is one. Returns null if no
63 * ContactMethod implementation is available for the protocol.
64 */
65 ContactMethod getInstance(String protocol, String identifier);
66
67 /***
68 * Returns an array of all known protocols
69 *
70 * @return an array of Strings containing the defined protocols
71 */
72 String[] getProtocols();
73 }
This page was automatically generated by Maven