01: /*
02: *
03: * InitiatorMapper.java -
04: *
05: *
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: */
21:
22: package hero.initiatorMapper;
23:
24: import hero.interfaces.BnProjectLocal;
25: import hero.initiatorMapper.LdapInitiatorMapper;
26: import hero.util.HeroException;
27: import java.io.Serializable;
28: import java.util.Collection;
29:
30: public abstract class InitiatorMapper implements Serializable {
31:
32: public static final int LDAP = 0;
33: public static final int CUSTOM = 1;
34:
35: private String name;
36: private int type;
37:
38: public static InitiatorMapper make(String name, int type)
39: throws HeroException {
40: if (type == LDAP) {
41: return new LdapInitiatorMapper(name, type);
42: }
43: if (type == CUSTOM) {
44: return new CustomInitiatorMapper(name, type);
45: }
46:
47: throw new HeroException("Wrong Mapper Type " + type);
48: }
49:
50: protected InitiatorMapper(String name, int type) {
51: this .name = name;
52: this .type = type;
53: }
54:
55: public String getName() {
56: return this .name;
57: }
58:
59: public void setName(String name) {
60: this .name = name;
61: }
62:
63: public int getType() {
64: return this .type;
65: }
66:
67: public void setType(int type) {
68: this .type = type;
69: }
70:
71: public String toXML() {
72: String result = new String();
73: result = "<initiator mapper name=\"" + this .getName()
74: + "\" type=\"" + this .getType() + "\"/>";
75: return result;
76: }
77:
78: public abstract Collection execute(Object bean, int type,
79: BnProjectLocal project, String userName)
80: throws HeroException;
81:
82: }
|