KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > ObjectFactoryImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.core;
10
11 import org.jboss.portal.common.metadata.MetaData;
12 import org.jboss.portal.core.metadata.ModelMetaData;
13 import org.jboss.portal.core.metadata.PageMetaData;
14 import org.jboss.portal.core.metadata.PageSetMetaData;
15 import org.jboss.portal.core.metadata.ProxyPreferenceSetMetaData;
16 import org.jboss.portal.core.metadata.AccessControllerMetaData;
17 import org.jboss.portal.core.metadata.TransactionMetaData;
18 import org.jboss.portal.core.plugins.page.Page;
19 import org.jboss.portal.core.plugins.page.PageRepository;
20 import org.jboss.portal.core.plugins.preferences.ProxyPreferenceSetPlugin;
21 import org.jboss.portal.core.plugins.security.ModelPlugin;
22 import org.jboss.portal.core.plugins.security.AccessController;
23 import org.jboss.portal.core.plugins.transaction.TransactionPlugin;
24 import org.jboss.portal.server.metadata.PortalMetaData;
25
26 /**
27  * @jmx.mbean
28  * @jboss.xmbean
29  *
30  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
31  * @version $Revision: 1.6 $
32  */

33 public class ObjectFactoryImpl extends org.jboss.portal.portlet.ObjectFactoryImpl
34 {
35
36    public Object JavaDoc create(MetaData metaData)
37    {
38       if (metaData instanceof PortalMetaData)
39       {
40          return new CorePortal((PortalMetaData)metaData, ((PortalMetaData)metaData).getName());
41       }
42       else if (metaData instanceof PageSetMetaData)
43       {
44          return new PageRepository();
45       }
46       else if (metaData instanceof PageMetaData)
47       {
48          return new Page((PageMetaData)metaData);
49       }
50       else if (metaData instanceof ProxyPreferenceSetMetaData)
51       {
52          return new ProxyPreferenceSetPlugin();
53       }
54       else if (metaData instanceof AccessControllerMetaData)
55       {
56          return new AccessController();
57       }
58       else if (metaData instanceof ModelMetaData)
59       {
60          return new ModelPlugin();
61       }
62       else if (metaData instanceof TransactionMetaData)
63       {
64          return new TransactionPlugin();
65       }
66       else
67       {
68          return super.create(metaData);
69       }
70    }
71 }
72
Popular Tags