[prev in list] [next in list] [prev in thread] [next in thread]
List: forrest-svn
Subject: svn commit: r447343 -
From: thorsten () apache ! org
Date: 2006-09-18 9:44:10
Message-ID: 20060918094410.C29CE1A981A () eris ! apache ! org
[Download RAW message or body]
Author: thorsten
Date: Mon Sep 18 02:44:10 2006
New Revision: 447343
URL: http://svn.apache.org/viewvc?view=rev&rev=447343
Log:
white noise - formating changes
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatch \
er/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest. \
plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?view=diff&rev=447343&r1=447342&r2=447343
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java \
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java \
Mon Sep 18 02:44:10 2006 @@ -72,7 +72,7 @@
* format for the request.
*
* <pre>
- * <<strong>forrest:view</strong> \
format="html"/> + * \
<<strong>forrest:view</strong> \
format="html"/>
* </pre>
*/
public static final String STRUCTURER_ELEMENT = "view";
@@ -84,7 +84,7 @@
* <strong>format</strong>.
*
* <pre>
- * <forrest:view \
<strong>format</strong>="html"/> + * \
<forrest:view \
<strong>format</strong>="html"/>
* </pre>
*/
public static final String STRUCTURER_FORMAT_ATTRIBUTE = "type";
@@ -101,7 +101,7 @@
* layout via e.g. css. In html for example
*
* <pre>
- * <forrest:hook name="test"/>
+ * <forrest:hook name="test"/>
* </pre>
*
* <p>
@@ -109,7 +109,7 @@
* </p>
*
* <pre>
- * <div id="test"/>
+ * <div id="test"/>
* </pre>
*/
public static final String DISPATCHER_HOOK_ELEMENT = "hook";
@@ -119,7 +119,7 @@
* css. In html for example
*
* <pre>
- * <forrest:css url="pelt.basic.css" \
media="screen" theme="Pelt"/> + * <forrest:css \
url="pelt.basic.css" media="screen" \
theme="Pelt"/>
* </pre>
*
* <p>
@@ -127,7 +127,7 @@
* </p>
*
* <pre>
- * <link media="screen" \
href="../themes/pelt.basic.css" title="Pelt" \
rel="stylesheet" type="text/css" /> + * <link \
media="screen" href="../themes/pelt.basic.css" \
title="Pelt" rel="stylesheet" \
type="text/css" />
* </pre>
*/
public static final String DISPATCHER_CSS_ELEMENT = "css";
@@ -184,7 +184,7 @@
private boolean insideStructurer = false;
- private String hooksXSL,cacheKey,validityFile;
+ private String hooksXSL, cacheKey, validityFile;
private HashMap hooksPosition;
@@ -205,15 +205,16 @@
public static final String PATH_PARAMETER = "path";
static public final String DISPATCHER_REQUEST_ATTRIBUTE = "request";
+
public static final String CACHE_PARAMETER = "cacheKey";
+
public static final String VALIDITY_PARAMETER = "validityFile";
private static final String VALIDITY_OVERRIDE_PARAMETER = "dispatcher.caching";
-
+
private static final String CACHING_OFF = "off";
-
+
private static final String CACHING_ON = "on";
-
/**
* Constructor Set the namespace
@@ -239,19 +240,19 @@
* component is currently not cacheable.
*/
public SourceValidity getValidity() {
-// You can either request URL?dispatcher.caching=off
+ // You can either request URL?dispatcher.caching=off
// or add this property to forrest.properties.xml
// to force a SourceValidity.INVALID
- if(null!=validityFile&!(validityOverride.equals(CACHING_OFF))){
- this.validity= new AggregatedValidity();
+ if (null != validityFile & !(validityOverride.equals(CACHING_OFF))) {
+ this.validity = new AggregatedValidity();
try {
- this.validity.add(m_resolver.resolveURI(validityFile).getValidity());
+ this.validity.add(m_resolver.resolveURI(validityFile)
+ .getValidity());
} catch (Exception e) {
getLogger().error(e.getMessage());
}
- }
- else
- this.validity=null;
+ } else
+ this.validity = null;
return this.validity;
}
@@ -289,9 +290,11 @@
* Setup the file generator. Try to get the last modification date of the
* source for caching.
*/
- // FIXME: See http://cocoon.zones.apache.org/daisy/documentation/writing/690.html
+ // FIXME: See
+ // http://cocoon.zones.apache.org/daisy/documentation/writing/690.html
// Writing Cache Efficient Components
- // we have to do all the heavy stuff later and only prepare the basics here, \
this will + // we have to do all the heavy stuff later and only prepare the basics \
here, + // this will
// help enhance caching. I mark them with *
public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException, SAXException,
@@ -299,10 +302,14 @@
super.setup(resolver, objectModel, src, par);
localRecycle();
try {
- if (null==this.dispatcherHelper)this.dispatcherHelper = new \
DispatcherHelper(manager);
- if (null==this.processor)this.processor = (XPathProcessor) this.manager
- .lookup(XPathProcessor.ROLE);
- if (null==m_resolver) m_resolver= (SourceResolver) \
manager.lookup(SourceResolver.ROLE); + if (null == this.dispatcherHelper)
+ this.dispatcherHelper = new DispatcherHelper(manager);
+ if (null == this.processor)
+ this.processor = (XPathProcessor) this.manager
+ .lookup(XPathProcessor.ROLE);
+ if (null == m_resolver)
+ m_resolver = (SourceResolver) manager
+ .lookup(SourceResolver.ROLE);
} catch (Exception e) {
String error = "dispatcherError:\n Could not set up the \
dispatcherHelper!\n DispatcherStack: " + e;
@@ -316,17 +323,18 @@
this.allowMarkup = Boolean.getBoolean(parameters.getParameter(
DISPATCHER_ALLOW_MARKUP, null));
- this.requestId= parameters.getParameter(
- DISPATCHER_REQUEST_ATTRIBUTE, null);
- this.cacheKey = parameters.getParameter(
- CACHE_PARAMETER, null);
- if(null==this.cacheKey) getLogger().warn("Caching not activated! Declare the \
CACHE_KEY_PARAMETER="+CACHE_PARAMETER+" in your sitemap.");
- this.validityFile = parameters.getParameter(
- VALIDITY_PARAMETER, null);
+ this.requestId = parameters.getParameter(DISPATCHER_REQUEST_ATTRIBUTE,
+ null);
+ this.cacheKey = parameters.getParameter(CACHE_PARAMETER, null);
+ if (null == this.cacheKey)
+ getLogger().warn(
+ "Caching not activated! Declare the CACHE_KEY_PARAMETER="
+ + CACHE_PARAMETER + " in your sitemap.");
+ this.validityFile = parameters.getParameter(VALIDITY_PARAMETER, null);
this.validityOverride = parameters.getParameter(
VALIDITY_OVERRIDE_PARAMETER, "");
- this.cacheKey+=validityOverride;
-
+ this.cacheKey += validityOverride;
+
if (requestId == null) {
String error = "dispatcherError:\n"
+ "You have to set the \"request\" parameter in the sitemap!";
@@ -334,15 +342,16 @@
throw new ProcessingException(error);
}
// * just store the $requestId and do the DOM-reading/storing later
- String propertyURI= "cocoon://"+requestId+".props";
+ String propertyURI = "cocoon://" + requestId + ".props";
try {
this.defaultProperties = org.apache.forrest.dispatcher.util.SourceUtil
- .readDOM(propertyURI, this.manager);
+ .readDOM(propertyURI, this.manager);
} catch (Exception e1) {
String error = "dispatcherError:\n"
- + "Could not get the properties for "+propertyURI +"\n \
DispatcherStack: "+ e1;
- getLogger().error(error);
- throw new ProcessingException(error);
+ + "Could not get the properties for " + propertyURI
+ + "\n DispatcherStack: " + e1;
+ getLogger().error(error);
+ throw new ProcessingException(error);
}
parameterHelper.put(DISPATCHER_REQUEST_ATTRIBUTE, requestId);
this.requestedFormat = parameters.getParameter(
@@ -364,7 +373,8 @@
+ " For text output where you would not have to use hooks as \
structurer, the way you want it."; getLogger().warn(warning);
} else {
- // * just store the $hooksXSL and do the DOM-reading/storing later
+ // * just store the $hooksXSL and do the DOM-reading/storing
+ // later
DOMSource stylesheet = new DOMSource(dispatcherHelper
.getDocument(this.hooksXSL));
this.structurerTransformer = dispatcherHelper
@@ -450,17 +460,17 @@
Element currentElement = dispatcher.getDocument().createElement(name);
dispatcherHelper.setAttributesDOM(attr, currentElement);
String tempPathWithoutAttr = path + "/" + name;
- String tempPath = dispatcherHelper.setAttributesXPath(attr, \
tempPathWithoutAttr);
- // If the hook has already been met, we use the position in the XPath to \
avoid confusion ...
- if( hooksPosition.containsKey( tempPath ) )
- {
- int pos = ((Integer)hooksPosition.get( tempPath )).intValue() + 1;
- hooksPosition.put( tempPath, new Integer( pos ) );
- tempPath = dispatcherHelper.setAttributesXPathWithPosition(attr, \
tempPathWithoutAttr, pos );
- }
- else
- {
- hooksPosition.put( tempPath, new Integer( 1 ) ) ;
+ String tempPath = dispatcherHelper.setAttributesXPath(attr,
+ tempPathWithoutAttr);
+ // If the hook has already been met, we use the position in the XPath to
+ // avoid confusion ...
+ if (hooksPosition.containsKey(tempPath)) {
+ int pos = ((Integer) hooksPosition.get(tempPath)).intValue() + 1;
+ hooksPosition.put(tempPath, new Integer(pos));
+ tempPath = dispatcherHelper.setAttributesXPathWithPosition(attr,
+ tempPathWithoutAttr, pos);
+ } else {
+ hooksPosition.put(tempPath, new Integer(1));
}
if (path == null || path.equals("")) {
path = name;
@@ -661,10 +671,10 @@
try {
if (contract == null)
contract = new ContractBeanDOMImpl(this.manager,
- parameterHelper,defaultProperties,(URIResolver)this);
+ parameterHelper, defaultProperties, (URIResolver) this);
// This is not needed since the manager did not change.
- //else
- // contract.initialize();
+ // else
+ // contract.initialize();
} catch (Exception e) {
String error = DispatcherException.ERROR_500 + "\n"
+ "component: ContractBean" + "\n"
@@ -683,12 +693,14 @@
+ currentFormat + "." + value;
try {
// Adding the contract to the validity object.
- // As soon the contract changes we want a rebuild of
+ // As soon the contract changes we want a rebuild of
// the page and not the cached object.
- if(!validityOverride.equals(CACHING_OFF)&null!=this.validity) {
- SourceValidity contractValidityId = \
m_resolver.resolveURI(contractUri).getValidity();
-// we cannot allow null in an AggregatedValidity
- if (null!=contractValidityId)
+ if (!validityOverride.equals(CACHING_OFF)
+ & null != this.validity) {
+ SourceValidity contractValidityId = m_resolver
+ .resolveURI(contractUri).getValidity();
+ // we cannot allow null in an AggregatedValidity
+ if (null != contractValidityId)
this.validity.add(contractValidityId);
}
Document doc = org.apache.forrest.dispatcher.util.SourceUtil
@@ -718,12 +730,14 @@
contract.setNugget(true);
try {
// Adding the raw data to the validity object.
- // As soon the raw data changes we want a rebuild of
+ // As soon the raw data changes we want a rebuild of
// the page and not the cached object.
- if(!validityOverride.equals(CACHING_OFF)&null!=this.validity) {
- SourceValidity contractValidityRaw = \
m_resolver.resolveURI(value).getValidity(); + if \
(!validityOverride.equals(CACHING_OFF) + & null != \
this.validity) { + SourceValidity contractValidityRaw = \
m_resolver + .resolveURI(value).getValidity();
// we cannot allow null in an AggregatedValidity
- if(null!=contractValidityRaw)
+ if (null != contractValidityRaw)
this.validity.add(contractValidityRaw);
}
Document doc = org.apache.forrest.dispatcher.util.SourceUtil
@@ -1054,20 +1068,20 @@
+ xslSource.getURI());
}
-// if (m_checkIncludes) {
-// // Populate included validities
-// List includes = (List) m_includesMap.get(base);
-// if (includes != null) {
-// SourceValidity included = xslSource.getValidity();
-// if (included != null) {
-// includes.add(new Object[] { xslSource.getURI(),
-// xslSource.getValidity() });
-// } else {
-// // One of the included stylesheets is not cacheable
-// m_includesMap.remove(base);
-// }
-// }
-// }
+ // if (m_checkIncludes) {
+ // // Populate included validities
+ // List includes = (List) m_includesMap.get(base);
+ // if (includes != null) {
+ // SourceValidity included = xslSource.getValidity();
+ // if (included != null) {
+ // includes.add(new Object[] { xslSource.getURI(),
+ // xslSource.getValidity() });
+ // } else {
+ // // One of the included stylesheets is not cacheable
+ // m_includesMap.remove(base);
+ // }
+ // }
+ // }
return new StreamSource(is.getByteStream(), is.getSystemId());
} catch (SourceException e) {
@@ -1100,7 +1114,7 @@
m_resolver.release(xslSource);
}
}
-
+
/**
* Return a new <code>InputSource</code> object that uses the
* <code>InputStream</code> and the system ID of the <code>Source</code>
@@ -1109,7 +1123,8 @@
* @throws IOException
* if I/O error occured.
*/
- private static InputSource getInputSource(final Source source) throws \
IOException, SourceException { + private static InputSource getInputSource(final \
Source source) + throws IOException, SourceException {
final InputSource newObject = new InputSource(source.getInputStream());
newObject.setSystemId(source.getURI());
return newObject;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic