01: /**
02: * $Id: CMCImpl.java,v 1.1 2005/06/27 23:33:07 jtb Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.community.mc.impl.manager;
14:
15: import com.sun.portal.community.mc.CMCException;
16: import com.sun.portal.community.mc.impl.CMCProperties;
17: import com.sun.portal.community.mc.impl.Debug;
18:
19: import java.util.Properties;
20: import java.util.Map;
21: import java.util.HashMap;
22: import java.util.Set;
23: import java.util.Iterator;
24: import java.util.Collection;
25:
26: /**
27: * Community MC manager implementation.
28: */
29: abstract class CMCImpl {
30: protected abstract Class getClass(String type);
31:
32: /**
33: * Initialization depends on super class.
34: */
35: protected abstract void initContributor(Object contributor)
36: throws CMCException;
37:
38: protected Object createContributor(String type) throws CMCException {
39: Class c = getClass(type);
40:
41: if (c == null) {
42: throw new CMCException(
43: "contributor class name is null, type: " + type);
44: }
45:
46: Object o = null;
47:
48: try {
49: o = c.newInstance();
50: } catch (NoClassDefFoundError ncdfe) {
51: ncdfe.printStackTrace();
52: throw new CMCException(ncdfe);
53: } catch (IllegalAccessException iae) {
54: throw new CMCException(iae);
55: } catch (ClassCastException cce) {
56: throw new CMCException(cce);
57: } catch (InstantiationException ie) {
58: throw new CMCException(ie);
59: }
60:
61: initContributor(o);
62:
63: //Debug.log("CommunityImpl", "createContributor", "success, type=" + type + ", className=" + className);
64:
65: return o;
66: }
67: }
|