cziegeler 2003/03/03 10:08:54
Modified: src/java/org/apache/cocoon/transformation
SourceWritingTransformer.java
CIncludeTransformer.java
src/scratchpad/src/org/apache/cocoon/taglib/core
SourceTag.java
src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components
PortalManager.java
src/java/org/apache/cocoon/components
CocoonComponentManager.java
src/blocks/chaperon/java/org/apache/cocoon/transformation
LexicalTransformer.java ParserTransformer.java
PatternTransformer.java
src/java/org/apache/cocoon/transformation/helpers
DefaultIncludeCacheManager.java
PreemptiveLoader.java
src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context
SimpleSessionContext.java
src/java/org/apache/cocoon/components/source SourceUtil.java
src/java/org/apache/cocoon/components/modules/input
XMLFileModule.java
src/java/org/apache/cocoon/components/treeprocessor
DefaultTreeBuilder.java TreeProcessor.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context
SessionContextImpl.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation
ConfigurationGenerator.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components
AuthenticationManager.java
src/java/org/apache/cocoon/environment
AbstractEnvironment.java
Log:
Updating SourceUtil; fixing component lookup problems
Revision Changes Path
1.22 +1 -1
xml-cocoon2/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
Index: SourceWritingTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- SourceWritingTransformer.java 28 Feb 2003 15:16:42 -0000 1.21
+++ SourceWritingTransformer.java 3 Mar 2003 18:08:53 -0000 1.22
@@ -581,7 +581,7 @@
target = source.getURI();
if ( exists == true && this.state == STATE_INSERT ) {
message = "content inserted at: " + path;
- resource = SourceUtil.toDOM( source, this.manager );
+ resource = SourceUtil.toDOM( source );
// import the fragment
Node importNode = resource.importNode(fragment, true);
// get the node
1.27 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
Index: CIncludeTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- CIncludeTransformer.java 28 Feb 2003 14:28:14 -0000 1.26
+++ CIncludeTransformer.java 3 Mar 2003 18:08:53 -0000 1.27
@@ -382,7 +382,7 @@
this.resourceParameters,
this.resolver);
- SourceUtil.toSAX(source, this.xmlConsumer, manager,
this.configurationParameters, true);
+ SourceUtil.toSAX(source, this.xmlConsumer,
this.configurationParameters, true);
} catch (SourceException se) {
if (!ignoreErrors) throw SourceUtil.handle(se);
1.4 +1 -1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/taglib/core/SourceTag.java
Index: SourceTag.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/taglib/core/SourceTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SourceTag.java 31 Jan 2003 22:54:43 -0000 1.3
+++ SourceTag.java 3 Mar 2003 18:08:53 -0000 1.4
@@ -93,7 +93,7 @@
try {
embeddedXMLPipe.setConsumer(this.xmlConsumer);
source = resolver.resolveURI(src);
- SourceUtil.toSAX(source, this.embeddedXMLPipe, this.manager);
+ SourceUtil.toSAX(source, this.embeddedXMLPipe);
} catch (Exception e) {
if (e instanceof ProcessingException) {
ProcessingException pe = (ProcessingException) e;
1.10 +16 -31
xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManager.java
Index: PortalManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManager.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PortalManager.java 31 Jan 2003 22:49:27 -0000 1.9
+++ PortalManager.java 3 Mar 2003 18:08:53 -0000 1.10
@@ -521,8 +521,7 @@
pars,
copletsFragment,
this.resolver,
- "xml",
- this.manager);
+ "xml");
// now the hardest part, clean up the whole cache
this.cleanUpCache(null, null, configuration);
@@ -667,8 +666,7 @@
copletsFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
context.setAttribute(ATTRIBUTE_ADMIN_COPLETS, copletsFragment);
}
IncludeXMLConsumer.includeNode(DOMUtil.selectSingleNode(copletsFragment,
@@ -3476,8 +3474,7 @@
SourceUtil.readDOM(resource,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
} else {
this.buildProfile(type, role, id, adminProfile);
}
@@ -3523,8 +3520,7 @@
copletsFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("coplet base profile loaded");
@@ -3540,8 +3536,7 @@
layoutFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("layout base profile loaded");
@@ -3571,8 +3566,7 @@
typeFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
profileRoot.appendChild(profileDoc.importNode(DOMUtil.selectSingleNode(typeFragment,
"type-profile"), true));
@@ -3614,8 +3608,7 @@
globalFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("global profile loaded");
}
@@ -3634,8 +3627,7 @@
globalFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("global type profile loaded");
}
@@ -3672,8 +3664,7 @@
roleFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("role profile loaded");
}
@@ -3693,8 +3684,7 @@
roleFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("role type profile loaded");
}
@@ -3729,8 +3719,7 @@
userFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("user profile loaded");
}
@@ -3750,8 +3739,7 @@
userFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("user type profile loaded");
}
@@ -3792,8 +3780,7 @@
userFragment = SourceUtil.readDOM(res,
null,
pars,
- this.resolver,
- this.manager);
+ this.resolver);
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("user status profile loaded");
}
@@ -3857,8 +3844,7 @@
pars,
userFragment,
this.resolver,
- "xml",
- this.manager);
+ "xml");
} finally {
userFragment.removeChild(saveStatus);
@@ -4044,8 +4030,7 @@
pars,
delta,
this.resolver,
- "xml",
- this.manager);
+ "xml");
if (delta.getParentNode() != null)
delta.getParentNode().removeChild(delta);
delta = null;
@@ -4311,7 +4296,7 @@
null,
parameters,
this.resolver);
- return SourceUtil.toDOM(source, this.manager);
+ return SourceUtil.toDOM(source);
} catch (SourceException se) {
throw SourceUtil.handle(se);
} finally {
1.47 +16 -1
xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java
Index: CocoonComponentManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- CocoonComponentManager.java 31 Jan 2003 22:51:22 -0000 1.46
+++ CocoonComponentManager.java 3 Mar 2003 18:08:53 -0000 1.47
@@ -216,6 +216,21 @@
}
/**
+ * Get the current sitemap component manager.
+ * This method return the current sitemap component manager. This
+ * is the manager that holds all the components of the currently
+ * processed (sub)sitemap.
+ * FIXME: Do we really want to expose this?
+ */
+ static public ComponentManager getSitemapComponentManager() {
+ Environment env = getCurrentEnvironment();
+ if ( null != env ) {
+ return env.getComponentManager();
+ }
+ return null;
+ }
+
+ /**
* Configure the RoleManager
*/
public void setRoleManager( final RoleManager roles ) {
1.3 +2 -3
xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/LexicalTransformer.java
Index: LexicalTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/LexicalTransformer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LexicalTransformer.java 4 Feb 2003 15:14:26 -0000 1.2
+++ LexicalTransformer.java 3 Mar 2003 18:08:53 -0000 1.3
@@ -213,8 +213,7 @@
this.lexiconSource.getURI()+
"' not found");
}
- SourceUtil.toSAX(this.lexiconSource, confighandler,
- this.manager);
+ SourceUtil.toSAX(this.lexiconSource, confighandler);
Configuration config = confighandler.getConfiguration();
Lexicon lexicon = LexiconFactory.createLexicon(config);
1.3 +2 -3
xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/ParserTransformer.java
Index: ParserTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/ParserTransformer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ParserTransformer.java 4 Feb 2003 15:14:26 -0000 1.2
+++ ParserTransformer.java 3 Mar 2003 18:08:53 -0000 1.3
@@ -226,8 +226,7 @@
this.grammarSource.getURI()+
"' not found");
}
- SourceUtil.toSAX(this.grammarSource, confighandler,
- this.manager);
+ SourceUtil.toSAX(this.grammarSource, confighandler);
Configuration config = confighandler.getConfiguration();
Grammar grammar = GrammarFactory.createGrammar(config);
1.5 +2 -3
xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/PatternTransformer.java
Index: PatternTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/chaperon/java/org/apache/cocoon/transformation/PatternTransformer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PatternTransformer.java 5 Feb 2003 12:55:05 -0000 1.4
+++ PatternTransformer.java 3 Mar 2003 18:08:53 -0000 1.5
@@ -208,8 +208,7 @@
this.lexiconSource.getURI()+
"' not found");
}
- SourceUtil.toSAX(this.lexiconSource, confighandler,
- this.manager);
+ SourceUtil.toSAX(this.lexiconSource, confighandler);
Configuration config = confighandler.getConfiguration();
Lexicon lexicon = LexiconFactory.createLexicon(config);
1.2 +4 -4
xml-cocoon2/src/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java
Index: DefaultIncludeCacheManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/helpers/DefaultIncludeCacheManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultIncludeCacheManager.java 28 Feb 2003 14:14:24 -0000 1.1
+++ DefaultIncludeCacheManager.java 3 Mar 2003 18:08:54 -0000 1.2
@@ -377,7 +377,7 @@
serializer = (XMLSerializer)this.manager.lookup(XMLSerializer.ROLE);
XMLTeePipe tee = new XMLTeePipe(handler, serializer);
- SourceUtil.toSAX(source, tee, this.manager);
+ SourceUtil.toSAX(source, tee);
SourceValidity[] validities = new SourceValidity[1];
validities[0] = session.getExpiresValidity();
@@ -385,7 +385,7 @@
(byte[])serializer.getSAXFragment());
session.getCacheStorageProxy().put(uri, response);
} else {
- SourceUtil.toSAX(source, handler, this.manager);
+ SourceUtil.toSAX(source, handler);
}
} catch (ProcessingException pe) {
@@ -464,7 +464,7 @@
public void run() {
try {
- SourceUtil.toSAX(this.source, this.serializer, this.manager);
+ SourceUtil.toSAX(this.source, this.serializer);
this.content = (byte[])this.serializer.getSAXFragment();
} catch (Exception local) {
this.exception = local;
1.2 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/transformation/helpers/PreemptiveLoader.java
Index: PreemptiveLoader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/helpers/PreemptiveLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PreemptiveLoader.java 28 Feb 2003 14:14:24 -0000 1.1
+++ PreemptiveLoader.java 3 Mar 2003 18:08:54 -0000 1.2
@@ -155,7 +155,7 @@
source = resolver.resolveURI(uri);
serializer = (XMLSerializer)manager.lookup(XMLSerializer.ROLE);
- SourceUtil.toSAX(source, serializer, manager);
+ SourceUtil.toSAX(source, serializer);
SourceValidity[] validities = new SourceValidity[1];
validities[0] = new
ExpiresValidity(((Long)object[2]).longValue() * 1000); // milliseconds!
1.5 +2 -3
xml-cocoon2/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/SimpleSessionContext.java
Index: SimpleSessionContext.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/SimpleSessionContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleSessionContext.java 31 Jan 2003 22:49:31 -0000 1.4
+++ SimpleSessionContext.java 3 Mar 2003 18:08:54 -0000 1.5
@@ -496,7 +496,7 @@
Source source = null;
try {
source = SourceUtil.getSource(this.loadResource, null, parameters,
resolver);
- Document doc = SourceUtil.toDOM(source, manager);
+ Document doc = SourceUtil.toDOM(source);
DocumentFragment df = doc.createDocumentFragment();
df.appendChild(doc.getDocumentElement());
this.setXML(path, df);
@@ -532,8 +532,7 @@
parameters,
frag,
resolver,
- "xml",
- manager);
+ "xml");
}
}
1.26 +100 -82
xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceUtil.java
Index: SourceUtil.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SourceUtil.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- SourceUtil.java 28 Feb 2003 15:26:02 -0000 1.25
+++ SourceUtil.java 3 Mar 2003 18:08:54 -0000 1.26
@@ -50,6 +50,7 @@
*/
package org.apache.cocoon.components.source;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
@@ -58,12 +59,16 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
+import org.apache.cocoon.components.CocoonComponentManager;
+import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.xml.IncludeXMLConsumer;
import org.apache.cocoon.xml.XMLUtils;
import org.apache.cocoon.xml.dom.DOMBuilder;
+import org.apache.cocoon.xml.dom.DOMStreamer;
import org.apache.excalibur.source.ModifiableSource;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
@@ -115,10 +120,9 @@
* @throws ProcessingException if no suitable converter is found
*/
static public void toSAX( Source source,
- ContentHandler handler,
- ComponentManager manager )
+ ContentHandler handler)
throws SAXException, IOException, ProcessingException {
- toSAX(source, null, handler, manager);
+ toSAX(source, null, handler);
}
/**
@@ -131,9 +135,9 @@
*/
static public void toSAX( Source source,
String mimeTypeHint,
- ContentHandler handler,
- ComponentManager manager )
+ ContentHandler handler)
throws SAXException, IOException, ProcessingException {
+ ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();
if ( source instanceof XMLizable ) {
((XMLizable)source).toSAX( handler );
} else {
@@ -167,10 +171,10 @@
*/
static public void toSAX( Source source,
ContentHandler handler,
- ComponentManager manager,
Parameters typeParameters,
boolean filterDocumentEvent)
throws SAXException, IOException, ProcessingException {
+ ComponentManager manager =
CocoonComponentManager.getSitemapComponentManager();
// Test for url rewriting
@@ -184,9 +188,9 @@
}
if (filterDocumentEvent) {
IncludeXMLConsumer filter = new IncludeXMLConsumer(handler);
- toSAX(source, mimeTypeHint, filter, manager);
+ toSAX(source, mimeTypeHint, filter);
} else {
- toSAX(source, mimeTypeHint, handler, manager);
+ toSAX(source, mimeTypeHint, handler);
}
}
@@ -201,13 +205,12 @@
* @throws ProcessingException if no suitable converter is found
* @throws SAXException If a SAX exception occurs.
*/
- static public Document toDOM(Source source,
- ComponentManager manager)
+ static public Document toDOM(Source source)
throws SAXException, IOException,
ProcessingException {
DOMBuilder builder = new DOMBuilder();
- toSAX(source, builder, manager);
+ toSAX(source, builder);
Document document = builder.getDocument();
@@ -395,9 +398,8 @@
SourceParameters parameters,
DocumentFragment frag,
SourceResolver resolver,
- String serializerName,
- ComponentManager manager)
- throws ProcessingException {
+ String serializerName)
+ throws ProcessingException {
Source source = null;
@@ -409,70 +411,87 @@
frag.normalize();
- // Lookup the Serializer
- // FIXME (CZ) : Due to the CM hierarchy we don't get the
- // correct serializer selector...
-// ComponentSelector selector = null;
-// Serializer serializer = null;
-// OutputStream oStream = null;
-// try {
-// selector = (ComponentSelector)manager.lookup(Serializer.ROLE
+ "Selector");
-// serializer = (Serializer)selector.select(serializerName);
-// oStream = ws.getOutputStream();
-// serializer.setOutputStream(oStream);
-// DOMStreamer streamer = new DOMStreamer(serializer);
-// streamer.stream(frag);
-// } finally {
-// if (oStream != null) {
-// oStream.flush();
-// try {
-// oStream.close();
-// } finally {
-// if ( selector != null ) {
-// selector.release( serializer );
-// manager.release( selector );
-// }
-// }
-// }
-// }
- final String content = XMLUtils.serializeNode(frag,
-
XMLUtils.defaultSerializeToXMLFormat(false));
- OutputStream oStream = ws.getOutputStream();
-
- oStream.write(content.getBytes());
- oStream.flush();
- oStream.close();
+ if ( null != serializerName) {
+ // Lookup the Serializer
+ // FIXME (CZ) : Due to the CM hierarchy we don't get the
+ // correct serializer selector...
+ // we now use the getSitemapComponentManager()
+ ComponentManager manager =
CocoonComponentManager.getSitemapComponentManager();
+
+ ComponentSelector selector = null;
+ Serializer serializer = null;
+ OutputStream oStream = null;
+ try {
+ selector =
(ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
+ serializer = (Serializer)selector.select(serializerName);
+ oStream = ws.getOutputStream();
+ serializer.setOutputStream(oStream);
+ DOMStreamer streamer = new DOMStreamer(serializer);
+ streamer.stream(frag);
+ } catch (ComponentException e) {
+ throw new ProcessingException("Unable to lookup
serializer.", e);
+ } finally {
+ if (oStream != null) {
+ oStream.flush();
+ try {
+ oStream.close();
+ } catch (Exception ignore) {
+ }
+ }
+ if ( selector != null ) {
+ selector.release( serializer );
+ manager.release( selector );
+ }
+ }
+ } else {
+ final String content = XMLUtils.serializeNode(frag,
+
XMLUtils.defaultSerializeToXMLFormat(false));
+ OutputStream oStream = ws.getOutputStream();
+
+ oStream.write(content.getBytes());
+ oStream.flush();
+ oStream.close();
+ }
} else {
- // and now serializing...
- // Lookup the Serializer
- // FIXME (CZ) : Due to the CM hierarchy we don't get the
- // correct serializer selector...
-// ComponentSelector selector = null;
-// Serializer serializer = null;
-// ByteArrayOutputStream oStream = new ByteArrayOutputStream();
-// try {
-// selector = (ComponentSelector)manager.lookup(Serializer.ROLE
+ "Selector");
-// serializer = (Serializer)selector.select(serializerName);
-// serializer.setOutputStream(oStream);
-// DOMStreamer streamer = new DOMStreamer(serializer);
-// streamer.stream(frag);
-// } finally {
-// if (oStream != null) {
-// oStream.flush();
-// try {
-// oStream.close();
-// } finally {
-// if ( selector != null ) {
-// selector.release( serializer );
-// manager.release( selector );
-// }
-// }
-// }
-// }
-// final String content = oStream.toString();
- final String content = XMLUtils.serializeNode(frag,
+ String content;
+ if ( null != serializerName) {
+ // and now serializing...
+ // Lookup the Serializer
+ // FIXME (CZ) : Due to the CM hierarchy we don't get the
+ // correct serializer selector...
+ // we now use the getSitemapComponentManager()
+ ComponentManager manager =
CocoonComponentManager.getSitemapComponentManager();
+
+ ComponentSelector selector = null;
+ Serializer serializer = null;
+ ByteArrayOutputStream oStream = new ByteArrayOutputStream();
+ try {
+ selector =
(ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
+ serializer = (Serializer)selector.select(serializerName);
+ serializer.setOutputStream(oStream);
+ DOMStreamer streamer = new DOMStreamer(serializer);
+ streamer.stream(frag);
+ } catch (ComponentException e) {
+ throw new ProcessingException("Unable
to lookup serializer.", e);
+ } finally {
+ if (oStream != null) {
+ oStream.flush();
+ try {
+ oStream.close();
+ } catch (Exception ignore) {
+ }
+ }
+ if ( selector != null ) {
+ selector.release( serializer );
+ manager.release( selector );
+ }
+ }
+ content = oStream.toString();
+ } else {
+ content = XMLUtils.serializeNode(frag,
XMLUtils.defaultSerializeToXMLFormat(false));
-
+ }
+
if (parameters==null) {
parameters = new SourceParameters();
} else {
@@ -481,7 +500,7 @@
parameters.setSingleParameterValue("content", content);
source = SourceUtil.getSource(location, typeParameters,
parameters, resolver);
- SourceUtil.toSAX(source, new DefaultHandler(), manager);
+ SourceUtil.toSAX(source, new DefaultHandler());
}
} catch (SourceException se) {
throw SourceUtil.handle(se);
@@ -515,16 +534,15 @@
public static DocumentFragment readDOM(String location,
Parameters typeParameters,
SourceParameters parameters,
- SourceResolver resolver,
- ComponentManager manager)
- throws ProcessingException {
+ SourceResolver resolver)
+ throws ProcessingException {
Source source = null;
try {
source = SourceUtil.getSource(location, typeParameters,
parameters, resolver);
- Document doc = SourceUtil.toDOM(source, manager);
+ Document doc = SourceUtil.toDOM(source);
DocumentFragment fragment = doc.createDocumentFragment();
fragment.appendChild(doc.getDocumentElement());
1.9 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
Index: XMLFileModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XMLFileModule.java 31 Jan 2003 22:51:28 -0000 1.8
+++ XMLFileModule.java 3 Mar 2003 18:08:54 -0000 1.9
@@ -153,7 +153,7 @@
logger.debug("document not cached... reloading uri "+this.uri);
src = resolver.resolveURI(this.uri);
this.srcVal = src.getValidity();
- this.document = SourceUtil.toDOM(src, manager);
+ this.document = SourceUtil.toDOM(src);
dom = this.document;
resolver.release(src);
} else {
@@ -167,7 +167,7 @@
if (logger.isDebugEnabled())
logger.debug("reloading document... uri "+this.uri);
this.srcVal = valid;
- this.document = SourceUtil.toDOM(src, manager);
+ this.document = SourceUtil.toDOM(src);
}
resolver.release(src);
}
1.19 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java
Index: DefaultTreeBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DefaultTreeBuilder.java 22 Feb 2003 23:22:32 -0000 1.18
+++ DefaultTreeBuilder.java 3 Mar 2003 18:08:54 -0000 1.19
@@ -385,7 +385,7 @@
try {
// Build a namespace-aware configuration object
NamespacedSAXConfigurationHandler handler = new
NamespacedSAXConfigurationHandler();
- SourceUtil.toSAX( source, handler, this.parentManager );
+ SourceUtil.toSAX( source, handler );
Configuration treeConfig = handler.getConfiguration();
return build(treeConfig);
1.26 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Index: TreeProcessor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TreeProcessor.java 31 Jan 2003 22:51:36 -0000 1.25
+++ TreeProcessor.java 3 Mar 2003 18:08:54 -0000 1.26
@@ -250,7 +250,7 @@
org.apache.excalibur.source.Source source = resolver.resolveURI(
xconfURL );
try {
SAXConfigurationHandler handler = new SAXConfigurationHandler();
- SourceUtil.toSAX(source, handler, manager);
+ SourceUtil.toSAX(source, handler);
builtin = handler.getConfiguration();
} finally {
resolver.release( source );
1.4 +4 -8
xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/SessionContextImpl.java
Index: SessionContextImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/context/SessionContextImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SessionContextImpl.java 31 Jan 2003 22:49:03 -0000 1.3
+++ SessionContextImpl.java 3 Mar 2003 18:08:54 -0000 1.4
@@ -680,8 +680,7 @@
parameters,
fragment,
resolver,
- "xml",
- manager);
+ "xml");
} // end synchronized
}
@@ -715,8 +714,7 @@
frag = SourceUtil.readDOM(this.authLoadResource,
null,
parameters,
- resolver,
- manager);
+ resolver);
this.setXML(path, frag);
@@ -752,8 +750,7 @@
fragment = SourceUtil.readDOM(this.loadResource,
null,
parameters,
- resolver,
- manager);
+ resolver);
this.setXML(path, fragment);
} // end synchronized
@@ -796,8 +793,7 @@
parameters,
fragment,
resolver,
- "xml",
- manager);
+ "xml");
} // end synchronized
1.6 +1 -1
xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ConfigurationGenerator.java
Index: ConfigurationGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ConfigurationGenerator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConfigurationGenerator.java 31 Jan 2003 22:49:15 -0000 1.5
+++ ConfigurationGenerator.java 3 Mar 2003 18:08:54 -0000 1.6
@@ -697,7 +697,7 @@
null,
parameters,
this.resolver);
- return SourceUtil.toDOM(source, this.manager);
+ return SourceUtil.toDOM(source);
} catch (SourceException se) {
throw SourceUtil.handle(se);
} finally {
1.10 +2 -2
xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java
Index: AuthenticationManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AuthenticationManager.java 31 Jan 2003 22:49:01 -0000 1.9
+++ AuthenticationManager.java 3 Mar 2003 18:08:54 -0000 1.10
@@ -463,7 +463,7 @@
parameters,
this.resolver);
- Document doc =
org.apache.cocoon.components.source.SourceUtil.toDOM(source, this.manager);
+ Document doc =
org.apache.cocoon.components.source.SourceUtil.toDOM(source);
authenticationFragment = doc.createDocumentFragment();
authenticationFragment.appendChild(doc.getDocumentElement());
} catch (SAXException se) {
@@ -841,7 +841,7 @@
null,
parameters,
this.resolver);
- Document doc =
org.apache.cocoon.components.source.SourceUtil.toDOM(source, this.manager);
+ Document doc =
org.apache.cocoon.components.source.SourceUtil.toDOM(source);
fragment = doc.createDocumentFragment();
fragment.appendChild(doc.getDocumentElement());
} catch (SourceException se) {
1.43 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- AbstractEnvironment.java 26 Feb 2003 15:02:34 -0000 1.42
+++ AbstractEnvironment.java 3 Mar 2003 18:08:54 -0000 1.43
@@ -115,7 +115,7 @@
private Map attributes = new HashMap();
/** The current manager */
- protected ComponentManager manager = null;
+ protected ComponentManager manager;
/** The secure Output Stream */
protected BufferedOutputStream secureOutputStream;