You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/09/09 03:07:53 UTC

svn commit: rev 43554 - cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/xscript

Author: vgritsenko
Date: Wed Sep  8 18:07:53 2004
New Revision: 43554

Modified:
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptManagerImpl.java
Log:
Implement dispose; clean up context on dispose


Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptManagerImpl.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptManagerImpl.java	(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptManagerImpl.java	Wed Sep  8 18:07:53 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.components.xscript;
 
+import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.ParameterException;
@@ -39,24 +40,24 @@
  * The actual implementation of the <code>XScriptManager</code> interface.
  *
  * @author <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
- * @version CVS $Id: XScriptManagerImpl.java,v 1.1 2004/03/10 12:58:08 stephan Exp $
+ * @version CVS $Id$
  * @since August  4, 2001
  */
 public class XScriptManagerImpl
         extends AbstractLogEnabled
-        implements XScriptManager, Serviceable, Component, Parameterizable, Contextualizable, ThreadSafe
+        implements XScriptManager, Serviceable, Component, Parameterizable, Contextualizable, ThreadSafe, Disposable
 {
     public static final String CONTEXT = "org.apache.cocoon.components.xscript.scope";
 
     /**
      * The <code>ServiceManager</code> instance.
      */
-    protected ServiceManager manager = null;
+    protected ServiceManager manager;
 
     /**
      * The <code>Context</code> instance.
      */
-    protected Context context = null;
+    protected Context context;
 
 
     public void contextualize(org.apache.avalon.framework.context.Context context)
@@ -88,6 +89,12 @@
             String resourceString = params.getParameter(names[i]);
             XScriptObject resource = new XScriptObjectFromURL(this, resourceString);
             s.put(names[i], resource);
+        }
+    }
+
+    public void dispose() {
+        if (context != null) {
+            context.removeAttribute(CONTEXT);
         }
     }