vgritsenko 2004/07/06 13:21:51
Modified: src/java/org/apache/cocoon Cocoon.java
Added: src/java/org/apache/cocoon CocoonAccess.java
Log:
Provide a way to share Cocoon instance between several servlets/portlets.
Better way to do it is welcome.
Revision Changes Path
1.28 +6 -1 cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Cocoon.java 11 Jun 2004 21:37:04 -0000 1.27
+++ Cocoon.java 6 Jul 2004 20:21:51 -0000 1.28
@@ -94,6 +94,7 @@
Contextualizable,
Composable,
InstrumentManageable {
+ static Cocoon instance;
private ThreadManager threads;
@@ -155,6 +156,10 @@
public Cocoon() throws ConfigurationException {
// Set the system properties needed by Xalan2.
setSystemProperties();
+
+ // HACK: Provide a way to share an instance of Cocoon object between
+ // several servlets/portlets.
+ instance = this;
}
/**
1.1 cocoon-2.1/src/java/org/apache/cocoon/CocoonAccess.java
Index: CocoonAccess.java
===================================================================
/*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.cocoon;
/**
* Accessor to the Cocoon object instance
*/
public class CocoonAccess {
protected Cocoon getCocoon() {
return Cocoon.instance;
}
}