dims 01/02/24 16:20:51
Modified: src/org/apache/cocoon/generation Tag: xml-cocoon2
FragmentExtractorGenerator.java
Log:
Fix for command-line generation. Don't cleanup the store if we are in the
LINK_VIEW
Revision Changes Path
No revision
No revision
1.1.2.9 +17 -2
xml-cocoon/src/org/apache/cocoon/generation/Attic/FragmentExtractorGenerator.java
Index: FragmentExtractorGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FragmentExtractorGenerator.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- FragmentExtractorGenerator.java 2001/02/23 14:56:59 1.1.2.8
+++ FragmentExtractorGenerator.java 2001/02/25 00:20:50 1.1.2.9
@@ -11,6 +11,8 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.generation.AbstractGenerator;
import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.apache.cocoon.environment.AbstractEnvironment;
+import org.apache.cocoon.Constants;
import org.apache.avalon.Parameters;
import org.apache.avalon.Poolable;
@@ -35,13 +37,16 @@
* This is by no means complete yet, but it should prove useful, particularly
* for offline generation.
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Russell</a>
- * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/23 14:56:59 $
+ * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/25 00:20:50 $
*/
public class FragmentExtractorGenerator extends AbstractGenerator implements
Poolable {
/** The fragment store. */
private static Map fragmentStore = new HashMap();
+ /** flag for cleanup */
+ boolean cleanupStore = true;
+
/** Construct a new <code>FragmentExtractorGenerator</code> and ensure
that the
* fragment store is initialized and threadsafe (since it is a global
store, not
* per-instance.
@@ -53,6 +58,13 @@
throws ProcessingException, SAXException, IOException {
super.setup(resolver,objectModel,src,par);
+ // Fix for commandline generation.
+ // Don't cleanup the store if we are in LINK_VIEW
+ AbstractEnvironment env = (AbstractEnvironment) resolver;
+ String view = env.getView();
+ if(view != null && view.equals(Constants.LINK_VIEW))
+ cleanupStore = false;
+
synchronized (FragmentExtractorGenerator.fragmentStore) {
if ( FragmentExtractorGenerator.fragmentStore.get(source) ==
null ) {
throw new ResourceNotFoundException("Could not find fragment
" + source + ".");
@@ -69,7 +81,10 @@
DOMStreamer streamer = new
DOMStreamer(this.contentHandler,this.lexicalHandler);
streamer.stream(doc);
- FragmentExtractorGenerator.fragmentStore.remove(source);
+ // Fix for commandline generation.
+ // Don't cleanup the store if we are in LINK_VIEW
+ if(cleanupStore)
+ FragmentExtractorGenerator.fragmentStore.remove(source);
}
}