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 2003/02/02 06:26:54 UTC
cvs commit: xml-cocoon2/src/scratchpad/src/org/apache/cocoon/ant CocoonProcessorDelegate.java
vgritsenko 2003/02/01 21:26:53
Modified: src/java/org/apache/cocoon/bean CocoonBean.java
src/java/org/apache/cocoon/environment/commandline
FileSavingEnvironment.java
LinkSamplingEnvironment.java
src/scratchpad/src/org/apache/cocoon/ant
CocoonProcessorDelegate.java
Log:
Populate CONTEXT object in objectModel in CLI environment.
Reported by fernando (fern@interdimensions.com)
Revision Changes Path
1.2 +27 -23 xml-cocoon2/src/java/org/apache/cocoon/bean/CocoonBean.java
Index: CocoonBean.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/bean/CocoonBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CocoonBean.java 2 Feb 2003 00:46:21 -0000 1.1
+++ CocoonBean.java 2 Feb 2003 05:26:53 -0000 1.2
@@ -127,6 +127,7 @@
private PrintWriter brokenLinkWriter;
// Internal Objects
+ private CommandlineContext cliContext;
private Cocoon cocoon;
private Destination dest;
private static Logger log;
@@ -168,9 +169,9 @@
try {
DefaultContext appContext = new DefaultContext();
appContext.put(Constants.CONTEXT_CLASS_LOADER, Main.class.getClassLoader());
- CommandlineContext clContext = new CommandlineContext(contextDir);
- clContext.enableLogging(new LogKitLogger(log));
- appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, clContext);
+ cliContext = new CommandlineContext(contextDir);
+ cliContext.enableLogging(new LogKitLogger(log));
+ appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, cliContext);
DefaultLogKitManager logKitManager = null;
if (logKit != null) {
final FileInputStream fis = new FileInputStream(logKit);
@@ -431,7 +432,7 @@
*/
public void warmup() throws Exception {
//log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
- cocoon.generateSitemap(new LinkSamplingEnvironment("/", context, attributes, null,
+ cocoon.generateSitemap(new LinkSamplingEnvironment("/", context, attributes, null, cliContext,
new LogKitLogger(log)));
}
@@ -533,7 +534,7 @@
private void processXSP(String uri) throws Exception {
String markupLanguage = "xsp";
String programmingLanguage = "java";
- Environment env = new LinkSamplingEnvironment("/", context, attributes, null,
+ Environment env = new LinkSamplingEnvironment("/", context, attributes, null, cliContext,
new LogKitLogger(log));
cocoon.precompile(uri, env, markupLanguage, programmingLanguage);
}
@@ -547,7 +548,7 @@
private void processXMAP(String uri) throws Exception {
String markupLanguage = "sitemap";
String programmingLanguage = "java";
- Environment env = new LinkSamplingEnvironment("/", context, attributes, null,
+ Environment env = new LinkSamplingEnvironment("/", context, attributes, null, cliContext,
new LogKitLogger(log));
cocoon.precompile(uri, env, markupLanguage, programmingLanguage);
}
@@ -765,10 +766,11 @@
*/
protected Collection getLinks(String deparameterizedURI, Map parameters) throws Exception {
LinkSamplingEnvironment env = new LinkSamplingEnvironment(deparameterizedURI,
- context,
- attributes,
- parameters,
- new LogKitLogger(log));
+ context,
+ attributes,
+ parameters,
+ cliContext,
+ new LogKitLogger(log));
processLenient(env);
return env.getLinks();
}
@@ -785,12 +787,13 @@
*/
protected String getPage(String deparameterizedURI, Map parameters, Map links, OutputStream stream) throws Exception {
FileSavingEnvironment env = new FileSavingEnvironment(deparameterizedURI,
- context,
- attributes,
- parameters,
- links,
- stream,
- new LogKitLogger(log));
+ context,
+ attributes,
+ parameters,
+ links,
+ cliContext,
+ stream,
+ new LogKitLogger(log));
// Here Cocoon can throw an exception if there are errors in processing the page
cocoon.process(env);
// if we get here, the page was created :-)
@@ -815,12 +818,13 @@
*/
protected String getType(String deparameterizedURI, Map parameters) throws Exception {
FileSavingEnvironment env = new FileSavingEnvironment(deparameterizedURI,
- context,
- attributes,
- parameters,
- empty,
- new NullOutputStream(),
- new LogKitLogger(log));
+ context,
+ attributes,
+ parameters,
+ empty,
+ cliContext,
+ new NullOutputStream(),
+ new LogKitLogger(log));
processLenient(env);
return env.getContentType();
}
1.8 +3 -3 xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment.java
Index: FileSavingEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FileSavingEnvironment.java 31 Jan 2003 22:51:44 -0000 1.7
+++ FileSavingEnvironment.java 2 Feb 2003 05:26:53 -0000 1.8
@@ -66,7 +66,6 @@
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @version CVS $Id$
*/
-
public class FileSavingEnvironment extends AbstractCommandLineEnvironment {
public FileSavingEnvironment(String uri,
@@ -74,14 +73,15 @@
Map attributes,
Map parameters,
Map links,
+ CommandlineContext cliContext,
OutputStream stream,
Logger log)
throws MalformedURLException {
super(uri, null, context, stream, log);
- this.getLogger().debug("FileSavingEnvironment: uri = " + uri);
this.objectModel.put(Constants.LINK_OBJECT, links);
this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, new CommandLineRequest(this, null, uri, null, attributes, parameters));
this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, new CommandLineResponse());
+ this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, cliContext);
}
}
1.13 +3 -1 xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/LinkSamplingEnvironment.java
Index: LinkSamplingEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/commandline/LinkSamplingEnvironment.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- LinkSamplingEnvironment.java 31 Jan 2003 22:51:44 -0000 1.12
+++ LinkSamplingEnvironment.java 2 Feb 2003 05:26:53 -0000 1.13
@@ -76,6 +76,7 @@
File contextFile,
Map attributes,
Map parameters,
+ CommandlineContext cliContext,
Logger log)
throws MalformedURLException, IOException {
super(uri, Constants.LINK_VIEW, contextFile, new ByteArrayOutputStream(), log);
@@ -84,6 +85,7 @@
}
this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, new CommandLineRequest(this, null, uri, null, attributes, parameters));
this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, new CommandLineResponse());
+ this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, cliContext);
}
/**
1.4 +1 -2 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/ant/CocoonProcessorDelegate.java
Index: CocoonProcessorDelegate.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/ant/CocoonProcessorDelegate.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CocoonProcessorDelegate.java 31 Jan 2003 22:54:38 -0000 1.3
+++ CocoonProcessorDelegate.java 2 Feb 2003 05:26:53 -0000 1.4
@@ -368,11 +368,10 @@
this.contextDir,
attributes,
parameters,
+ clContext,
getLogger());
cocoon.process(env);
return env.getLinks();
}
}
-
-
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org