| Method from org.apache.cocoon.components.treeprocessor.InvokeContext Detail: |
public void compose(ComponentManager manager) throws ComponentException {
this.currentManager = manager;
}
|
public void dispose() {
if (!this.isBuildingPipelineOnly && this.pipelinesManager != null) {
if (this.pipelineSelector != null) {
this.pipelineSelector.release(this.processingPipeline);
this.processingPipeline = null;
this.pipelinesManager.release(this.pipelineSelector);
this.pipelineSelector = null;
}
this.pipelinesManager = null;
this.processingPipelineName = null;
this.processingPipelineParameters = null;
this.processingPipelineObjectModel = null;
this.errorHandler = null;
}
}
Release the pipelines, if any, if they were looked up by this context. |
protected void dumpParameters() {
if (!this.mapStack.isEmpty()) {
StringBuffer sb = new StringBuffer();
sb.append("\nCurrent Sitemap Parameters:\n");
String path = "";
for (int i = this.mapStack.size() - 1; i >= 0; i--) {
Map map = (Map) this.mapStack.get(i);
sb.append("LEVEL ").append(i+1);
if (this.mapToName.containsKey(map)) {
sb.append(" is named '").append(String.valueOf(this.mapToName.get(map))).append("'");
}
sb.append("\n");
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
final Map.Entry me = (Map.Entry)iter.next();
final Object key = me.getKey();
sb.append("PARAM: '").append(path).append(key).append("' ");
sb.append("VALUE: '").append(me.getValue()).append("'\n");
}
path = "../" + path;
}
getLogger().debug(sb.toString());
}
}
Dumps all sitemap parameters to log |
public final Map getMapByAnchor(String anchor) {
return (Map) this.nameToMap.get(anchor);
}
Get the result Map by anchor name |
public final List getMapStack() {
return this.mapStack;
}
Get the current Map stack used to resolve expressions. |
public ProcessingPipeline getProcessingPipeline() throws Exception {
if (this.processingPipeline == null) {
// Keep current manager for proper release
this.pipelinesManager = this.currentManager;
this.pipelineSelector = (ComponentSelector)this.pipelinesManager.lookup(ProcessingPipeline.ROLE+"Selector");
this.processingPipeline = (ProcessingPipeline)this.pipelineSelector.select(this.processingPipelineName);
this.processingPipeline.recompose( this.pipelinesManager );
this.processingPipeline.setup(
VariableResolver.buildParameters(this.processingPipelineParameters,
this,
this.processingPipelineObjectModel)
);
if (this.isBuildingPipelineOnly) {
CocoonComponentManager.addComponentForAutomaticRelease(this.pipelineSelector,
this.processingPipeline,
this.pipelinesManager);
}
this.processingPipeline.setErrorHandler(this.errorHandler);
}
return this.processingPipeline;
}
Get the current ProcessingPipeline |
public Redirector getRedirector() {
return this.redirector;
}
Get the redirector to be used by nodes that need it. |
public void inform(String pipelineName,
Map parameters,
Map objectModel) {
this.processingPipelineName = pipelineName;
this.processingPipelineParameters = parameters;
this.processingPipelineObjectModel = objectModel;
}
Informs the context about a new pipeline section |
public final boolean isBuildingPipelineOnly() {
return this.isBuildingPipelineOnly;
}
Are we building a pipeline (and not executing it) ? |
public boolean pipelineIsSet() {
return (this.processingPipeline != null);
}
Determines if the Pipeline been set for this context |
public final void popMap() {
Object map = this.mapStack.remove(this.mapStack.size() - 1);
Object name = this.mapToName.get(map);
this.mapToName.remove(map);
this.nameToMap.remove(name);
}
Pop the topmost element of the current Map stack. |
public final void pushMap(String anchorName,
Map map) {
this.mapStack.add(map);
if (getLogger().isDebugEnabled()) {
dumpParameters();
}
if (anchorName != null) {
if (!this.nameToMap.containsKey(anchorName)) {
this.nameToMap.put(anchorName,map);
this.mapToName.put(map,anchorName);
} else {
if (getLogger().isErrorEnabled()) {
getLogger().error("name [" + anchorName + "] clashes");
}
}
}
}
Push a Map on top of the current Map stack. |
public void recompose(ComponentManager manager) throws ComponentException {
this.currentManager = manager;
if (this.processingPipeline != null) {
this.processingPipeline.recompose(manager);
}
}
|
public void setErrorHandler(SitemapErrorHandler handler) {
this.errorHandler = handler;
}
Set the error handler for the pipeline. |
public void setProcessingPipeline(ProcessingPipeline pipeline) {
this.processingPipeline = pipeline;
}
Set the processing pipeline for sub-sitemaps |
public void setRedirector(Redirector redirector) {
this.redirector = redirector;
}
Set the redirector to be used by nodes that need it. |