KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlet > exomvc > config > POJOPageConfig


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portlet.exomvc.config;
6
7 import org.exoplatform.portlet.exomvc.Page;
8 /**
9  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
10  * @since Nov 11, 2004
11  * @version $Id$
12  */

13 public class POJOPageConfig extends PageConfig {
14   private String JavaDoc className_ ;
15   private Page cache_ ;
16   
17   public String JavaDoc getClassName() { return className_ ; }
18   public POJOPageConfig setClassName(String JavaDoc className) {
19     className_ = className ;
20     return this ;
21   }
22   
23   public Page getPageObject(Configuration configuration) throws Exception JavaDoc {
24     if(cache_ != null) return cache_ ;
25     synchronized(configuration) {
26       ClassLoader JavaDoc cl = Thread.currentThread().getContextClassLoader() ;
27       Class JavaDoc clazz = cl.loadClass(className_) ;
28       cache_ = (Page) clazz.newInstance() ;
29       cache_.setConfiguration(configuration) ;
30       cache_.setPageName(getPageName()) ;
31     }
32     return cache_ ;
33   }
34 }
Popular Tags