KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.net.URL JavaDoc;
8 import javax.portlet.PortletContext;
9 import org.exoplatform.container.RootContainer;
10 import org.exoplatform.container.groovy.GroovyManager;
11 import org.exoplatform.container.groovy.GroovyManagerContainer;
12
13 /**
14  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
15  * @since Nov 12, 2004
16  * @version $Id$
17  */

18 public class GroovyResourceManager {
19   private GroovyManager gmanager_ ;
20   
21   public GroovyResourceManager(PortletContext context, String JavaDoc repo ) throws Exception JavaDoc {
22     RootContainer root = RootContainer.getInstance() ;
23     GroovyManagerContainer container =
24       (GroovyManagerContainer)root.getComponentInstanceOfType(GroovyManagerContainer.class) ;
25     String JavaDoc realpath = context.getRealPath(repo + "/groovy") + "/" ;
26     URL JavaDoc classpath = root.getOSEnvironment().createURL(realpath) ;
27     container.removeGroovyManager(classpath) ;
28     gmanager_ = container.getGroovyManager(classpath) ;
29   }
30   
31   public GroovyManager getGroovyManager() { return gmanager_ ; }
32   
33   public void destroy() {
34     gmanager_.setDispose(true) ;
35   }
36 }
37
Popular Tags