bloritsch 01/06/08 07:42:25
Modified: src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
AbstractSitemap.java ContentAggregator.java
ErrorNotifier.java Handler.java LinkTranslator.java
Manager.java PatternException.java Sitemap.java
SitemapComponentSelector.java
SitemapModelComponent.java
SitemapOutputComponent.java SitemapRedirector.java
XSLTFactoryLoader.java
Log:
Code formatting only.
Revision Changes Path
No revision
No revision
1.4.2.4 +83 -107
xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -u -r1.4.2.3 -r1.4.2.4
--- AbstractSitemap.java 2001/06/08 14:13:17 1.4.2.3
+++ AbstractSitemap.java 2001/06/08 14:41:59 1.4.2.4
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -43,13 +44,11 @@
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.4.2.3 $ $Date: 2001/06/08 14:13:17 $
+ * @version CVS $Revision: 1.4.2.4 $ $Date: 2001/06/08 14:41:59 $
*/
public abstract class AbstractSitemap extends AbstractLoggable implements
Sitemap, Disposable, ThreadSafe {
private Context context;
-
private static final int BYTE_ARRAY_SIZE = 1024;
-
private static RoleManager roleManager;
private static Configuration defaultConfig;
@@ -64,7 +63,6 @@
/** The creation date */
protected static long dateCreated = -1L;
-
protected ExcaliburComponentSelector generators;
protected ExcaliburComponentSelector transformers;
protected SitemapComponentSelector serializers;
@@ -87,47 +85,38 @@
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
*/
- public void compose(ComponentManager manager) throws ComponentException
{
+ public void compose(ComponentManager manager) throws ComponentException {
this.manager = new ExcaliburComponentManager(manager);
this.manager.setLogger(getLogger());
this.manager.contextualize(this.context);
this.manager.setRoleManager(AbstractSitemap.roleManager);
-
try {
this.manager.configure(AbstractSitemap.defaultConfig);
-
- this.urlFactory = (URLFactory) manager.lookup(Roles.URL_FACTORY);
-
+ this.urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
this.generators = new ExcaliburComponentSelector();
this.setupSelector(this.generators);
this.manager.addComponentInstance(Roles.GENERATORS,
this.generators);
-
this.transformers = new ExcaliburComponentSelector();
this.setupSelector(this.transformers);
this.manager.addComponentInstance(Roles.TRANSFORMERS,
this.transformers);
-
this.serializers = new SitemapComponentSelector();
this.setupSelector(this.serializers);
this.manager.addComponentInstance(Roles.SERIALIZERS,
this.serializers);
-
this.readers = new SitemapComponentSelector();
this.setupSelector(this.readers);
this.manager.addComponentInstance(Roles.READERS, this.readers);
-
this.actions = new ExcaliburComponentSelector();
this.setupSelector(this.actions);
this.manager.addComponentInstance(Roles.ACTIONS, this.actions);
-
this.matchers = new ExcaliburComponentSelector();
this.setupSelector(this.matchers);
this.manager.addComponentInstance(Roles.MATCHERS, this.matchers);
-
this.selectors = new ExcaliburComponentSelector();
this.setupSelector(this.selectors);
this.manager.addComponentInstance(Roles.SELECTORS,
this.selectors);
} catch (Exception e) {
getLogger().error("cannot obtain the Component", e);
- throw new ComponentException ("cannot obtain the URLFactory", e);
+ throw new ComponentException("cannot obtain the URLFactory", e);
}
}
@@ -160,58 +149,61 @@
* @param request The request whose data must be inspected to assert
whether
* dynamically generated content has changed
* @return Whether content has changes for this request's data
- *//*
+ */
+
+ /*
public boolean hasContentChanged(Request request) {
- return true;
+ return true;
}
+ */
- /**
- * Loads a class specified in a sitemap component definition and
- * initialize it
- */
- public void load_component(int type, Object hint, String classURL,
Configuration configuration, String mime_type)
- throws Exception {
- Class clazz = null;
- //FIXME(GP): Is it true that a class name containing a colon should
be an URL?
- if (classURL.indexOf(':') > 1) {
- URL url = urlFactory.getURL(classURL);
- byte [] b = getByteArrayFromStream(url.openStream());
- clazz =
((RepositoryClassLoader)ClassUtils.getClassLoader()).defineClass(b);
- } else {
- clazz = ClassUtils.loadClass(classURL);
- }
- if (!Component.class.isAssignableFrom(clazz)) {
- throw new IllegalAccessException ("Object " + classURL + " is
not a Component");
- }
-
- switch (type) {
- case Sitemap.GENERATOR:
- this.generators.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.TRANSFORMER:
- this.transformers.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.SERIALIZER:
- this.serializers.addSitemapComponent(hint, clazz,
configuration, mime_type);
- break;
- case Sitemap.READER:
- this.readers.addSitemapComponent(hint, clazz, configuration,
mime_type);
- break;
- case Sitemap.ACTION:
- this.actions.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.MATCHER:
- this.matchers.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.SELECTOR:
- this.selectors.addComponent(hint, clazz, configuration);
- break;
- }
+ /**
+ * Loads a class specified in a sitemap component definition and
+ * initialize it
+ */
+
+ public void load_component(int type, Object hint, String classURL,
Configuration configuration,
+ String mime_type) throws Exception {
+ Class clazz = null;
+ //FIXME(GP): Is it true that a class name containing a colon
should be an URL?
+ if (classURL.indexOf(':') > 1) {
+ URL url = urlFactory.getURL(classURL);
+ byte[] b = getByteArrayFromStream(url.openStream());
+ clazz =
((RepositoryClassLoader)ClassUtils.getClassLoader()).defineClass(b);
+ } else {
+ clazz = ClassUtils.loadClass(classURL);
+ }
+ if (!Component.class.isAssignableFrom(clazz)) {
+ throw new IllegalAccessException("Object " + classURL + " is
not a Component");
+ }
+ switch (type) {
+ case Sitemap.GENERATOR:
+ this.generators.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.TRANSFORMER:
+ this.transformers.addComponent(hint, clazz,
configuration);
+ break;
+ case Sitemap.SERIALIZER:
+ this.serializers.addSitemapComponent(hint, clazz,
configuration, mime_type);
+ break;
+ case Sitemap.READER:
+ this.readers.addSitemapComponent(hint, clazz,
configuration, mime_type);
+ break;
+ case Sitemap.ACTION:
+ this.actions.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.MATCHER:
+ this.matchers.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.SELECTOR:
+ this.selectors.addComponent(hint, clazz, configuration);
+ break;
+ }
}
- private byte [] getByteArrayFromStream (InputStream stream) {
+ private byte[] getByteArrayFromStream(InputStream stream) {
List list = new ArrayList();
- byte [] b = new byte[BYTE_ARRAY_SIZE];
+ byte[] b = new byte[BYTE_ARRAY_SIZE];
int last = 0;
try {
while ((last = stream.read(b)) == BYTE_ARRAY_SIZE) {
@@ -219,13 +211,13 @@
b = new byte[BYTE_ARRAY_SIZE];
}
} catch (IOException ioe) {
- getLogger().error ("cannot read class byte stream", ioe);
+ getLogger().error("cannot read class byte stream", ioe);
}
list.add(b);
int listSize = list.size();
- b = new byte [(listSize-1) * BYTE_ARRAY_SIZE + last];
+ b = new byte[(listSize - 1) * BYTE_ARRAY_SIZE + last];
int i;
- for (i = 0; i < listSize-1; i++) {
+ for (i = 0; i < listSize - 1; i++) {
System.arraycopy(list.get(i), 0, b, i * BYTE_ARRAY_SIZE,
BYTE_ARRAY_SIZE);
}
System.arraycopy(list.get(i), 0, b, i * BYTE_ARRAY_SIZE, last);
@@ -236,12 +228,10 @@
* Replaces occurences of xpath like expressions in an argument String
* with content from a List of Maps
*/
- protected String substitute (List list, String expr)
- throws PatternException, NumberFormatException {
+ protected String substitute(List list, String expr) throws
PatternException, NumberFormatException {
if (expr == null) {
return null;
}
-
StringBuffer result = new StringBuffer();
String s = null;
int j = 0;
@@ -255,31 +245,26 @@
result.append(expr.substring(ii, i));
j = expr.indexOf('}', i);
if (j < i) {
- throw new PatternException ("invalid expression in
\""+expr+"\"");
+ throw new PatternException("invalid expression in \"" +
expr + "\"");
}
-
- ii = j+1;
+ ii = j + 1;
if (j == -1) {
- throw new PatternException ("invalid expression in URL
"+expr);
+ throw new PatternException("invalid expression in URL "
+ expr);
}
-
k = list.size() - 1;
- s = expr.substring (i+1,j);
-
+ s = expr.substring(i + 1, j);
l = -1;
-
- while ((l = s.indexOf("../",l+1)) != -1) {
+ while ((l = s.indexOf("../", l + 1)) != -1) {
k--;
}
-
m = s.lastIndexOf('/');
if (m == -1) {
result.append((String)((Map)list.get(k)).get(s));
} else {
-
result.append((String)((Map)list.get(k)).get(s.substring(m+1)));
+
result.append((String)((Map)list.get(k)).get(s.substring(m + 1)));
}
- getLogger().debug("substitute evaluated value for " + ((m ==
-1) ? s : s.substring(m+1))
- + " as " + (String)((Map)list.get(k)).get((m == -1) ?
s : s.substring(m+1)));
+ getLogger().debug("substitute evaluated value for " + ((m ==
-1) ? s : s.substring(m + 1)) + " as " +
+ (String)((Map)list.get(k)).get((m == -1) ? s :
s.substring(m + 1)));
}
if (ii < expr.length()) {
result.append(expr.substring(ii));
@@ -287,10 +272,8 @@
return (result.toString());
} catch (Exception e) {
getLogger().error("AbstractSitemap:substitute()", e);
- throw new PatternException
- ("error occurred during evaluation of expression \""
- +expr+"\" at position "+(i+1)+"\n"
- + e.getMessage());
+ throw new PatternException("error occurred during evaluation of
expression \"" + expr + "\" at position " +
+ (i + 1) + "\n" + e.getMessage());
}
}
@@ -298,17 +281,15 @@
* Constructs a resource for the <code>Environment</code> arguments.
* This method is supplied by the generated Sitemap.
*/
- public abstract boolean process (Environment environment)
- throws Exception;
+ public abstract boolean process(Environment environment) throws
Exception;
/**
* Constructs a resource for the <code>Environment</code> arguments.
* This method is supplied by the generated Sitemap.
*/
- public abstract boolean process (Environment environment, StreamPipeline
pipeline, EventPipeline eventPipeline)
- throws Exception;
+ public abstract boolean process(Environment environment, StreamPipeline
pipeline,
+ EventPipeline eventPipeline) throws Exception;
-
/**
* Invokes a method of this class using Java Reflection
*
@@ -322,49 +303,44 @@
try {
getLogger().debug("Dynamically invoking " + methodName);
java.lang.reflect.Method method =
this.getClass().getDeclaredMethod(methodName, argTypes);
- return ((Boolean) method.invoke(this, argValues)).booleanValue();
+ return ((Boolean)method.invoke(this, argValues)).booleanValue();
} catch (NoSuchMethodException e) {
getLogger().error("AbstractSitemap:invokeMethod()", e);
int prefix = methodName.indexOf("_");
- throw new Exception ("Sitemap: " +
methodName.substring(0,prefix) + " '" + methodName.substring(prefix + 1) + "'
not found");
+ throw new Exception("Sitemap: " + methodName.substring(0,
prefix) + " '" +
+ methodName.substring(prefix + 1) + "' not found");
} catch (Exception e) {
getLogger().error("AbstractSitemap:invokeMethod()", e);
throw e;
}
}
+
/**
* dispose
*/
public void dispose() {
- if (this.urlFactory!=null) {
+ if (this.urlFactory != null) {
manager.release((Component)this.urlFactory);
}
-
- if (this.generators!=null) {
+ if (this.generators != null) {
manager.release((Component)this.generators);
}
-
- if (this.transformers!=null) {
+ if (this.transformers != null) {
manager.release((Component)this.transformers);
}
-
- if (this.serializers!=null) {
+ if (this.serializers != null) {
manager.release((Component)this.serializers);
}
-
- if (this.readers!=null) {
+ if (this.readers != null) {
manager.release((Component)this.readers);
}
-
- if (this.actions!=null) {
+ if (this.actions != null) {
manager.release((Component)this.actions);
}
-
- if (this.matchers!=null) {
+ if (this.matchers != null) {
manager.release((Component)this.matchers);
}
-
- if (this.selectors!=null) {
+ if (this.selectors != null) {
manager.release((Component)this.selectors);
}
}
1.5.2.2 +33 -38
xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java
Index: ContentAggregator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- ContentAggregator.java 2001/06/08 14:13:17 1.5.2.1
+++ ContentAggregator.java 2001/06/08 14:42:00 1.5.2.2
@@ -42,11 +42,9 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: ContentAggregator.java,v 1.5.2.1 2001/06/08 14:13:17
bloritsch Exp $
+ * @version CVS $Id: ContentAggregator.java,v 1.5.2.2 2001/06/08 14:42:00
bloritsch Exp $
*/
-
-public class ContentAggregator extends ContentHandlerWrapper
- implements Generator, Cacheable, Composable {
+public class ContentAggregator extends ContentHandlerWrapper implements
Generator, Cacheable, Composable {
/** the current sitemap */
protected Sitemap sitemap;
@@ -120,7 +118,8 @@
public String namespace;
public String prefix;
boolean stripRootElement;
- public Part (String uri, String element, String namespace, String
stripRoot, String prefix) {
+
+ public Part(String uri, String element, String namespace, String
stripRoot, String prefix) {
this.uri = uri;
this.element = element;
this.namespace = namespace;
@@ -161,7 +160,7 @@
ep.process(this.environment);
} catch (Exception e) {
getLogger().error("ContentAggregator: cannot process
event pipeline for URI " + part.uri, e);
- throw new ProcessingException ("ContentAggregator:
cannot process event pipeline for URI " + part.uri, e);
+ throw new ProcessingException("ContentAggregator: cannot
process event pipeline for URI " + part.uri, e);
} finally {
this.manager.release(ep);
this.environment.popURI();
@@ -190,20 +189,20 @@
pipeline =
(StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
} catch (ComponentException cme) {
getLogger().error("ContentAggregator: could not lookup
pipeline components", cme);
- throw new ProcessingException ("could not lookup
pipeline components", cme);
+ throw new ProcessingException("could not lookup pipeline
components", cme);
}
try {
pipeline.setEventPipeline(eventPipeline);
} catch (Exception cme) {
getLogger().error("ContentAggregator: could not set
event pipeline on stream pipeline", cme);
- throw new ProcessingException ("could not set event
pipeline on stream pipeline", cme);
+ throw new ProcessingException("could not set event
pipeline on stream pipeline", cme);
}
try {
this.environment.pushURI(part.uri);
this.sitemap.process(this.environment, pipeline,
eventPipeline);
} catch (Exception cme) {
getLogger().error("ContentAggregator: could not process
pipeline", cme);
- throw new ProcessingException ("could not process
pipeline", cme);
+ throw new ProcessingException("could not process
pipeline", cme);
} finally {
this.manager.release(pipeline);
this.environment.popURI();
@@ -219,12 +218,12 @@
* @return The generated key hashes the src
*/
public long generateKey() {
- try{
+ try {
collectParts();
long key = 0;
for (int i = 0; i < this.partEventPipelines.size(); i++) {
EventPipeline ep =
(EventPipeline)this.partEventPipelines.get(i);
- if(ep instanceof CacheableEventPipeline){
+ if (ep instanceof CacheableEventPipeline) {
((XMLProducer)ep).setConsumer(this);
PipelineCacheKey pck =
((CacheableEventPipeline)ep).generateKey(environment);
if (pck == null) {
@@ -232,12 +231,12 @@
} else {
key += HashUtil.hash(pck.toString());
}
- }else{
+ } else {
return 0;
}
}
return key;
- }catch(Exception e){
+ } catch (Exception e) {
getLogger().error("ContentAggregator: could not generateKey", e);
return 0;
}
@@ -250,20 +249,18 @@
* component is currently not cacheable.
*/
public CacheValidity generateValidity() {
- try{
+ try {
collectParts();
final AggregatedCacheValidity v = new AggregatedCacheValidity();
for (int i = 0; i < this.parts.size(); i++) {
EventPipeline ep =
(EventPipeline)this.partEventPipelines.get(i);
- if(ep instanceof CacheableEventPipeline){
+ if (ep instanceof CacheableEventPipeline) {
Map map =
((CacheableEventPipeline)ep).generateValidity(environment);
- if(map == null) {
+ if (map == null) {
return null;
}
-
Iterator j = map.values().iterator();
-
- while(j.hasNext()) {
+ while (j.hasNext()) {
CacheValidity epv = (CacheValidity)j.next();
v.add(epv);
}
@@ -272,7 +269,7 @@
}
}
return v;
- }catch(Exception e){
+ } catch (Exception e) {
getLogger().error("ContentAggregator: could not
generateValidity", e);
return null;
}
@@ -295,8 +292,8 @@
public void addPart(String uri, String element, String namespace, String
stripRootElement, String prefix) {
this.parts.add(new Part(uri, element, namespace, stripRootElement,
prefix));
- getLogger().debug("ContentAggregator: part uri='" + uri + "'
element='" + element + "' ns='" + namespace
- + "' stripRootElement='" + stripRootElement + "'
prefix='" + prefix + "'");
+ getLogger().debug("ContentAggregator: part uri='" + uri + "'
element='" + element + "' ns='" + namespace +
+ "' stripRootElement='" + stripRootElement + "' prefix='" +
prefix + "'");
}
/**
@@ -329,7 +326,7 @@
/**
* Recycle the producer by removing references
*/
- public void recycle () {
+ public void recycle() {
super.recycle();
this.sitemap = null;
this.resolver = null;
@@ -352,12 +349,12 @@
* Set the <code>SourceResolver</code>, object model <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException {
- this.resolver=resolver;
- this.objectModel=objectModel;
- this.source=src;
- this.parameters=par;
+ public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException {
+ this.resolver = resolver;
+ this.objectModel = objectModel;
+ this.source = src;
+ this.parameters = par;
}
private String pushNS(String ns) {
@@ -366,14 +363,14 @@
}
private String popNS() {
- int last = currentNS.size()-1;
+ int last = currentNS.size() - 1;
String ns = (String)currentNS.get(last);
currentNS.remove(last);
return ns;
}
private String getNS() {
- int last = currentNS.size()-1;
+ int last = currentNS.size() - 1;
return (String)currentNS.get(last);
}
@@ -397,16 +394,15 @@
/**
* Ignore start and end document events
*/
- public void startDocument () throws SAXException {
+ public void startDocument() throws SAXException {
}
- public void endDocument () throws SAXException {
+ public void endDocument() throws SAXException {
}
- public void startElement (String namespaceURI, String localName,
- String qName, Attributes atts) throws SAXException {
+ public void startElement(String namespaceURI, String localName, String
qName, Attributes atts) throws SAXException {
String ns = namespaceURI;
- if (ns ==null || ns.equals("")) {
+ if (ns == null || ns.equals("")) {
ns = (String)this.getNS();
}
this.pushNS(ns);
@@ -418,8 +414,7 @@
}
}
- public void endElement (String namespaceURI, String localName,
- String qName) throws SAXException {
+ public void endElement(String namespaceURI, String localName, String
qName) throws SAXException {
if (rootElementIndex != currentNS.size()) {
this.documentHandler.endElement((String)this.popNS(), localName,
qName);
} else {
1.2.2.2 +2 -4
xml-cocoon2/src/org/apache/cocoon/sitemap/ErrorNotifier.java
Index: ErrorNotifier.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ErrorNotifier.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- ErrorNotifier.java 2001/06/08 14:13:18 1.2.2.1
+++ ErrorNotifier.java 2001/06/08 14:42:01 1.2.2.2
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import org.apache.avalon.excalibur.pool.Recyclable;
@@ -19,10 +20,9 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @created 31 July 2000
- * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/08 14:13:18 $
+ * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/06/08 14:42:01 $
*/
public class ErrorNotifier extends ComposerGenerator implements Recyclable {
-
/**
* The <code>Notification</code> to report.
*/
@@ -66,6 +66,4 @@
super.recycle();
this.notification = null;
}
-
}
-
1.9.2.3 +174 -185 xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -r1.9.2.2 -r1.9.2.3
--- Handler.java 2001/06/08 14:13:18 1.9.2.2
+++ Handler.java 2001/06/08 14:42:03 1.9.2.3
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.FileNotFoundException;
@@ -38,237 +39,225 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9.2.2 $ $Date: 2001/06/08 14:13:18 $
+ * @version CVS $Revision: 1.9.2.3 $ $Date: 2001/06/08 14:42:03 $
*/
-public class Handler extends AbstractLoggable
-implements Runnable, Configurable, Composable, Contextualizable, Processor,
Disposable {
-
- private Context context;
+public class Handler extends AbstractLoggable implements Runnable,
Configurable, Composable,
+ Contextualizable, Processor, Disposable {
+ private Context context;
/** the configuration */
- private Configuration conf;
+ private Configuration conf;
/** the component manager */
- private ComponentManager manager;
+ private ComponentManager manager;
/** the source of this sitemap */
- private String sourceFileName;
- private Source source;
+ private String sourceFileName;
+ private Source source;
/** the URLFactory */
- private URLFactory urlFactory;
+ private URLFactory urlFactory;
/** The URLResolver for the sitemap components */
- private URLResolver urlResolver;
+ private URLResolver urlResolver;
/** the last error */
- private Exception exception;
+ private Exception exception;
/** the managed sitemap */
-
- private Sitemap sitemap = null;
- private boolean check_reload = true;
+ private Sitemap sitemap = null;
+ private boolean check_reload = true;
/** the regenerating thread */
- private Thread regeneration;
- private volatile boolean isRegenerationRunning = false;
- private Environment environment;
+ private Thread regeneration;
+ private volatile boolean isRegenerationRunning = false;
+ private Environment environment;
/** the sitemaps base path */
- private String basePath;
+ private String basePath;
- public void compose (ComponentManager manager) {
- this.manager = manager;
- try {
- urlFactory = (URLFactory) manager.lookup(Roles.URL_FACTORY);
- this.urlResolver = new FactoryURLResolver(urlFactory);
- } catch (Exception e) {
- getLogger().error ("cannot obtain URLFactory", e);
- }
- }
-
- public void configure (Configuration conf) {
- this.conf = conf;
- }
-
- public void contextualize (Context context) throws ContextException {
- this.context = context;
- }
-
- protected Handler (String sourceFileName, boolean check_reload)
- throws FileNotFoundException {
- this.check_reload = check_reload;
- this.sourceFileName = sourceFileName;
- }
-
- protected boolean available () {
- return (sitemap != null);
- }
-
- protected boolean hasChanged () {
- if (available()) {
- if (check_reload) {
- this.source.refresh();
- return sitemap.modifiedSince(this.source.getLastModified());
- }
- return false;
- }
- return true;
- }
-
- protected boolean isRegenerating () {
- return isRegenerationRunning;
- }
-
- protected void regenerateAsynchronously (Environment environment)
- throws Exception {
- if (this.sourceFileName.charAt(this.sourceFileName.length() - 1) ==
'/') {
- this.sourceFileName = this.sourceFileName + "sitemap.xmap";
- }
- try {
- environment.setURLResolver(this.urlResolver);
- this.source = environment.resolve(this.sourceFileName);
- } finally {
- environment.setURLResolver(null);
- }
-
- if (!this.isRegenerationRunning) {
- isRegenerationRunning = true;
- regeneration = new Thread (this);
- /* HACK for reducing class loader problems.
*/
- /* example: xalan extensions fail if someone adds xalan jars in
tomcat3.2.1/lib */
+ public void compose(ComponentManager manager) {
+ this.manager = manager;
try {
-
regeneration.setContextClassLoader(Thread.currentThread().getContextClassLoader());
- } catch (Exception e){}
- this.environment = environment;
-
- /* clear old exception if any */
- this.exception = null;
-
- /* start the thread */
- regeneration.start();
- }
- }
-
- protected void regenerate (Environment environment)
- throws Exception {
- getLogger().debug("Beginning sitemap regeneration");
-
- this.regenerateAsynchronously(environment);
-
- if (regeneration != null) {
- this.regeneration.join();
- }
-
- throwEventualException();
- }
-
- public boolean process (Environment environment)
- throws Exception {
- checkSanity();
- try {
- environment.setURLResolver(this.urlResolver);
- return sitemap.process(environment);
- } finally {
- environment.setURLResolver(null);
- }
- }
-
- public boolean process (Environment environment, StreamPipeline
pipeline, EventPipeline eventPipeline)
- throws Exception {
- checkSanity();
- try {
- environment.setURLResolver(this.urlResolver);
- return sitemap.process(environment, pipeline, eventPipeline);
- } finally {
- environment.setURLResolver(null);
- }
- }
-
- private void checkSanity () throws Exception {
- throwEventualException();
- if (sitemap == null) {
- getLogger().fatalError("Sitemap is not set for the Handler!!!!");
- throw new RuntimeException("The Sitemap is null, this should
never be!");
- }
- }
-
- public void setBasePath (String basePath) {
- this.basePath = basePath;
- }
+ urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
+ this.urlResolver = new FactoryURLResolver(urlFactory);
+ } catch (Exception e) {
+ getLogger().error("cannot obtain URLFactory", e);
+ }
+ }
- /** Generate the Sitemap class */
- public void run() {
- Sitemap smap = null;
+ public void configure(Configuration conf) {
+ this.conf = conf;
+ }
- String markupLanguage = "sitemap";
- String programmingLanguage = "java";
+ public void contextualize(Context context) throws ContextException {
+ this.context = context;
+ }
- ProgramGenerator programGenerator = null;
- try {
- /* FIXME: Workaround -- set the logger XSLTFactoryLoader used to
generate source
- * within the sitemap generation phase.
- * Needed because we never have the opportunity to handle the
lifecycle of the
- * XSLTFactoryLoader, since it is created by the Xalan engine.
- */
- XSLTFactoryLoader.setLogger(getLogger());
+ protected Handler(String sourceFileName, boolean check_reload)
throws FileNotFoundException {
+ this.check_reload = check_reload;
+ this.sourceFileName = sourceFileName;
+ }
- programGenerator = (ProgramGenerator)
this.manager.lookup(Roles.PROGRAM_GENERATOR);
+ protected boolean available() {
+ return (sitemap != null);
+ }
+ protected boolean hasChanged() {
+ if (available()) {
+ if (check_reload) {
+ this.source.refresh();
+ return
sitemap.modifiedSince(this.source.getLastModified());
+ }
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean isRegenerating() {
+ return isRegenerationRunning;
+ }
+
+ protected void regenerateAsynchronously(Environment environment)
throws Exception {
+ if (this.sourceFileName.charAt(this.sourceFileName.length() - 1)
== '/') {
+ this.sourceFileName = this.sourceFileName + "sitemap.xmap";
+ }
try {
environment.setURLResolver(this.urlResolver);
- smap = (Sitemap) programGenerator.load(this.sourceFileName,
markupLanguage, programmingLanguage, environment);
+ this.source = environment.resolve(this.sourceFileName);
} finally {
environment.setURLResolver(null);
}
+ if (!this.isRegenerationRunning) {
+ isRegenerationRunning = true;
+ regeneration = new Thread(this);
- if (this.sitemap != null) {
- programGenerator.release((CompiledComponent) this.sitemap);
- }
+ /* HACK for reducing class loader problems. */
+
+ /* example: xalan extensions fail if someone adds xalan jars
in tomcat3.2.1/lib */
+
+ try {
+
regeneration.setContextClassLoader(Thread.currentThread().getContextClassLoader());
+ } catch (Exception e) {
+ }
+ this.environment = environment;
+
+ /* clear old exception if any */
+
+ this.exception = null;
- this.sitemap = smap;
- getLogger().debug("Sitemap regeneration complete");
+ /* start the thread */
- if (this.sitemap != null) {
- getLogger().debug("The sitemap has been successfully
compiled!");
- } else {
- getLogger().debug("No errors, but the sitemap has not been
set.");
+ regeneration.start();
}
- } catch (Throwable t) {
- getLogger().error("Error compiling sitemap", t);
+ }
- if (t instanceof Exception) {
- this.exception = (Exception) t;
+ protected void regenerate(Environment environment) throws Exception {
+ getLogger().debug("Beginning sitemap regeneration");
+ this.regenerateAsynchronously(environment);
+ if (regeneration != null) {
+ this.regeneration.join();
}
- } finally {
- if(programGenerator != null) {
- this.manager.release(programGenerator);
+ throwEventualException();
+ }
+
+ public boolean process(Environment environment) throws Exception {
+ checkSanity();
+ try {
+ environment.setURLResolver(this.urlResolver);
+ return sitemap.process(environment);
+ } finally {
+ environment.setURLResolver(null);
}
+ }
- this.regeneration = null;
- this.environment = null;
- this.isRegenerationRunning = false;
+ public boolean process(Environment environment, StreamPipeline
pipeline,
+ EventPipeline eventPipeline) throws Exception {
+ checkSanity();
+ try {
+ environment.setURLResolver(this.urlResolver);
+ return sitemap.process(environment, pipeline,
eventPipeline);
+ } finally {
+ environment.setURLResolver(null);
+ }
+ }
+
+ private void checkSanity() throws Exception {
+ throwEventualException();
+ if (sitemap == null) {
+ getLogger().fatalError("Sitemap is not set for the
Handler!!!!");
+ throw new RuntimeException("The Sitemap is null, this should
never be!");
+ }
}
- }
- public void throwEventualException() throws Exception {
- if (this.exception != null) {
- throw new ProcessingException("Exception in
Handler",this.exception);
+ public void setBasePath(String basePath) {
+ this.basePath = basePath;
}
- }
- public Exception getException() {
- return this.exception;
- }
+ /** Generate the Sitemap class */
+ public void run() {
+ Sitemap smap = null;
+ String markupLanguage = "sitemap";
+ String programmingLanguage = "java";
+ ProgramGenerator programGenerator = null;
+ try {
+ /* FIXME: Workaround -- set the logger XSLTFactoryLoader
used to generate source
+ * within the sitemap generation phase.
+ * Needed because we never have the opportunity to handle the
lifecycle of the
+ * XSLTFactoryLoader, since it is created by the Xalan engine.
+ */
+
+ XSLTFactoryLoader.setLogger(getLogger());
+ programGenerator =
(ProgramGenerator)this.manager.lookup(Roles.PROGRAM_GENERATOR);
+ try {
+ environment.setURLResolver(this.urlResolver);
+ smap =
(Sitemap)programGenerator.load(this.sourceFileName, markupLanguage,
+ programmingLanguage, environment);
+ } finally {
+ environment.setURLResolver(null);
+ }
+ if (this.sitemap != null) {
+
programGenerator.release((CompiledComponent)this.sitemap);
+ }
+ this.sitemap = smap;
+ getLogger().debug("Sitemap regeneration complete");
+ if (this.sitemap != null) {
+ getLogger().debug("The sitemap has been successfully
compiled!");
+ } else {
+ getLogger().debug("No errors, but the sitemap has not
been set.");
+ }
+ } catch (Throwable t) {
+ getLogger().error("Error compiling sitemap", t);
+ if (t instanceof Exception) {
+ this.exception = (Exception)t;
+ }
+ } finally {
+ if (programGenerator != null) {
+ this.manager.release(programGenerator);
+ }
+ this.regeneration = null;
+ this.environment = null;
+ this.isRegenerationRunning = false;
+ }
+ }
+
+ public void throwEventualException() throws Exception {
+ if (this.exception != null) {
+ throw new ProcessingException("Exception in Handler",
this.exception);
+ }
+ }
+
+ public Exception getException() {
+ return this.exception;
+ }
/**
* dispose
*/
- public void dispose() {
- if(urlFactory != null) {
- manager.release((Component)urlFactory);
+ public void dispose() {
+ if (urlFactory != null) {
+ manager.release((Component)urlFactory);
+ }
+ this.urlResolver = null;
}
-
- this.urlResolver = null;
- }
}
1.2.2.2 +13 -14
xml-cocoon2/src/org/apache/cocoon/sitemap/LinkTranslator.java
Index: LinkTranslator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/LinkTranslator.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- LinkTranslator.java 2001/06/08 14:13:18 1.2.2.1
+++ LinkTranslator.java 2001/06/08 14:42:03 1.2.2.2
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -20,31 +21,29 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/08 14:13:18 $
+ * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/06/08 14:42:03 $
*/
-
public class LinkTranslator extends ExtendedXLinkPipe implements Transformer
{
-
private Map links;
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException {
- this.links = (Map) objectModel.get(Constants.LINK_OBJECT);
+ public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException {
+ this.links = (Map)objectModel.get(Constants.LINK_OBJECT);
}
- public void simpleLink(String href, String role, String arcrole, String
title, String show, String actuate, String uri, String name, String raw,
Attributes attr)
- throws SAXException {
- String newHref = (String) this.links.get(href);
- super.simpleLink((newHref != null) ? newHref : href, role, arcrole,
title, show, actuate, uri, name, raw, attr);
+ public void simpleLink(String href, String role, String arcrole, String
title, String show, String actuate, String uri,
+ String name, String raw, Attributes attr) throws SAXException {
+ String newHref = (String)this.links.get(href);
+ super.simpleLink((newHref != null) ? newHref : href, role,
arcrole, title, show, actuate, uri, name, raw, attr);
}
- public void startLocator(String href, String role, String title, String
label, String uri, String name, String raw, Attributes attr)
- throws SAXException {
- String newHref = (String) this.links.get(href);
- super.startLocator((newHref != null) ? newHref : href, role, title,
label, uri, name, raw, attr);
+ public void startLocator(String href, String role, String title, String
label, String uri, String name, String raw,
+ Attributes attr) throws SAXException {
+ String newHref = (String)this.links.get(href);
+ super.startLocator((newHref != null) ? newHref : href, role,
title, label, uri, name, raw, attr);
}
}
1.2.2.3 +51 -61 xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
Index: Manager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- Manager.java 2001/06/08 14:13:19 1.2.2.2
+++ Manager.java 2001/06/08 14:42:05 1.2.2.3
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.util.HashMap;
@@ -32,10 +33,9 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/06/08 14:13:19 $
+ * @version CVS $Revision: 1.2.2.3 $ $Date: 2001/06/08 14:42:05 $
*/
public class Manager extends AbstractLoggable implements Component,
Configurable, Composable, Contextualizable, ThreadSafe {
-
private Context context;
/** The vectors of sub sitemaps */
@@ -60,21 +60,21 @@
/** get a configuration
* @param conf the configuration
*/
- public void configure (Configuration conf) {
+ public void configure(Configuration conf) {
this.conf = conf;
}
/** get a context
* @param context the context object
*/
- public void contextualize (Context context) throws ContextException {
+ public void contextualize(Context context) throws ContextException {
this.context = context;
}
/** get a component manager
* @param manager the component manager
*/
- public void compose (ComponentManager manager) {
+ public void compose(ComponentManager manager) {
this.manager = manager;
}
@@ -87,16 +87,13 @@
* @throws Exception there may be several excpetions thrown
* @return states if the requested resource was produced
*/
- public boolean invoke (Environment environment, String uri_prefix,
- String source, boolean check_reload, boolean
reload_asynchron)
- throws Exception {
-
- // get a sitemap handler
- Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
-
- // setup to invoke the processing
- setupProcessing(environment, sitemapHandler, uri_prefix, source);
- return sitemapHandler.process(environment);
+ public boolean invoke(Environment environment, String uri_prefix, String
source, boolean check_reload,
+ boolean reload_asynchron) throws Exception {
+ // get a sitemap handler
+ Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
+ // setup to invoke the processing
+ setupProcessing(environment, sitemapHandler, uri_prefix, source);
+ return sitemapHandler.process(environment);
}
/** invokes the sitemap handler to process a request
@@ -108,17 +105,13 @@
* @throws Exception there may be several excpetions thrown
* @return states if the requested resource was produced
*/
- public boolean invoke (Environment environment, String uri_prefix,
- String source, boolean check_reload, boolean
reload_asynchron,
- StreamPipeline pipeline, EventPipeline
eventPipeline)
- throws Exception {
-
- // get a sitemap handler
- Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
-
- // setup to invoke the processing
- setupProcessing(environment, sitemapHandler, uri_prefix, source);
- return sitemapHandler.process(environment, pipeline, eventPipeline);
+ public boolean invoke(Environment environment, String uri_prefix, String
source, boolean check_reload,
+ boolean reload_asynchron, StreamPipeline pipeline, EventPipeline
eventPipeline) throws Exception {
+ // get a sitemap handler
+ Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
+ // setup to invoke the processing
+ setupProcessing(environment, sitemapHandler, uri_prefix, source);
+ return sitemapHandler.process(environment, pipeline,
eventPipeline);
}
/** has the sitemap changed
@@ -128,7 +121,7 @@
Handler sitemapHandler = null;
Iterator iter = sitemaps.values().iterator();
while (iter.hasNext()) {
- sitemapHandler = (Handler) iter.next();
+ sitemapHandler = (Handler)iter.next();
if ((sitemapHandler != null) && (sitemapHandler.hasChanged())) {
return true;
}
@@ -138,55 +131,52 @@
/**
* make sure the uri_prefix ends with a slash
- *
+ *
* NOTE: Together 5 marks this as unused. If verified, we need to
remove it.
*/
- private String getPrefix (String uri_prefix) {
+ /*
+ private String getPrefix(String uri_prefix) {
if (uri_prefix.length() > 0) {
return ((uri_prefix.charAt(uri_prefix.length() - 1) == '/') ?
uri_prefix : uri_prefix + "/");
} else {
return uri_prefix;
}
}
+ */
- private Handler getHandler(final Environment environment,
- final String source,
- final boolean check_reload,
- final boolean reload_asynchron)
- throws Exception {
- Handler sitemapHandler = (Handler) sitemaps.get(source);
-
- if (sitemapHandler != null) {
- if (sitemapHandler.available()) {
- if (check_reload
- && sitemapHandler.hasChanged()
- && !sitemapHandler.isRegenerating()) {
- if (reload_asynchron) {
- sitemapHandler.regenerateAsynchronously(environment);
- } else {
- sitemapHandler.regenerate(environment);
+ private Handler getHandler(final Environment environment, final String
source, final boolean check_reload,
+ final boolean reload_asynchron) throws Exception {
+ Handler sitemapHandler = (Handler)sitemaps.get(source);
+ if (sitemapHandler != null) {
+ if (sitemapHandler.available()) {
+ if (check_reload && sitemapHandler.hasChanged() &&
!sitemapHandler.isRegenerating()) {
+ if (reload_asynchron) {
+
sitemapHandler.regenerateAsynchronously(environment);
+ } else {
+ sitemapHandler.regenerate(environment);
+ }
}
+ } else {
+ sitemapHandler.regenerate(environment);
}
} else {
+ sitemapHandler = new Handler(source, check_reload);
+ sitemapHandler.contextualize(this.context);
+ sitemapHandler.setLogger(getLogger());
+ sitemapHandler.compose(this.manager);
+ sitemapHandler.configure(this.conf);
sitemapHandler.regenerate(environment);
+ sitemaps.put(source, sitemapHandler);
}
- } else {
- sitemapHandler = new Handler(source, check_reload);
- sitemapHandler.contextualize(this.context);
- sitemapHandler.setLogger(getLogger());
- sitemapHandler.compose(this.manager);
- sitemapHandler.configure(this.conf);
- sitemapHandler.regenerate(environment);
- sitemaps.put(source, sitemapHandler);
- }
- return sitemapHandler;
+ return sitemapHandler;
}
- private void setupProcessing (Environment environment, Handler
sitemapHandler, String uri_prefix, String source)
- throws Exception {
- environment.changeContext(uri_prefix, source);
- if (! sitemapHandler.available()) {
- throw new ProcessingException("The sitemap handler's sitemap is
not available.", sitemapHandler.getException());
- }
+ private void setupProcessing(Environment environment, Handler
sitemapHandler, String uri_prefix,
+ String source) throws Exception {
+ environment.changeContext(uri_prefix, source);
+ if (!sitemapHandler.available()) {
+ throw new ProcessingException("The sitemap handler's sitemap
is not available.",
+ sitemapHandler.getException());
+ }
}
}
1.1.1.1.2.1 +2 -2
xml-cocoon2/src/org/apache/cocoon/sitemap/PatternException.java
Index: PatternException.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/PatternException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- PatternException.java 2001/05/09 20:49:36 1.1.1.1
+++ PatternException.java 2001/06/08 14:42:06 1.1.1.1.2.1
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
/**
@@ -14,10 +15,9 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:36 $
+ * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/08 14:42:06 $
*/
public class PatternException extends Exception {
-
/**
* Construct a new <code>PatternException</code> instance.
*/
1.1.1.1.2.1 +3 -3 xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java
Index: Sitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- Sitemap.java 2001/05/09 20:49:37 1.1.1.1
+++ Sitemap.java 2001/06/08 14:42:07 1.1.1.1.2.1
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import org.apache.avalon.framework.component.ComponentManager;
@@ -20,7 +21,7 @@
* Base interface for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:37 $
+ * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/08 14:42:07 $
*/
public interface Sitemap extends CompiledComponent, Configurable,
Contextualizable, Processor {
int GENERATOR = 1;
@@ -40,6 +41,5 @@
* Process the given <code>Environment</code> assebling
* a <code>StreamPipeline</code> and an <code>EventPipeline</code>
*/
- boolean process(Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline)
- throws Exception;
+ boolean process(Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline) throws Exception;
}
1.2.2.3 +7 -8
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java
Index: SitemapComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- SitemapComponentSelector.java 2001/06/08 14:13:19 1.2.2.2
+++ SitemapComponentSelector.java 2001/06/08 14:42:08 1.2.2.3
@@ -20,26 +20,25 @@
/** Default component manager for Cocoon's sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: SitemapComponentSelector.java,v 1.2.2.2 2001/06/08
14:13:19 bloritsch Exp $
+ * @version CVS $Id: SitemapComponentSelector.java,v 1.2.2.3 2001/06/08
14:42:08 bloritsch Exp $
*/
public class SitemapComponentSelector extends ExcaliburComponentSelector {
private HashMap mime_types;
/** The conctructors (same as the Avalon ComponentManager)
*/
- public SitemapComponentSelector () {
+ public SitemapComponentSelector() {
super();
this.mime_types = new HashMap();
}
public String getMimeTypeForRole(String role) {
- return (String) this.mime_types.get(role);
+ return (String)this.mime_types.get(role);
}
- protected void addSitemapComponent(Object hint, Class component,
Configuration conf, String mime_type)
- throws ComponentException,
- ConfigurationException {
- super.addComponent(hint, component, conf);
- this.mime_types.put(hint, mime_type);
+ protected void addSitemapComponent(Object hint, Class component,
Configuration conf, String mime_type) throws ComponentException,
+ ConfigurationException {
+ super.addComponent(hint, component, conf);
+ this.mime_types.put(hint, mime_type);
}
}
1.2.2.1 +4 -4
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapModelComponent.java
Index: SitemapModelComponent.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapModelComponent.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- SitemapModelComponent.java 2001/05/22 14:45:42 1.2
+++ SitemapModelComponent.java 2001/06/08 14:42:09 1.2.2.1
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -19,14 +20,13 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:45:42 $
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/08 14:42:09 $
*/
public interface SitemapModelComponent extends Component {
-
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException;
+ void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException;
}
1.1.1.1.2.1 +2 -2
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapOutputComponent.java
Index: SitemapOutputComponent.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapOutputComponent.java,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -r1.1.1.1 -r1.1.1.1.2.1
--- SitemapOutputComponent.java 2001/05/09 20:49:37 1.1.1.1
+++ SitemapOutputComponent.java 2001/06/08 14:42:10 1.1.1.1.2.1
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -14,10 +15,9 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.1.1 $ $Date: 2001/05/09 20:49:37 $
+ * @version CVS $Revision: 1.1.1.1.2.1 $ $Date: 2001/06/08 14:42:10 $
*/
public interface SitemapOutputComponent extends Component {
-
/**
* Set the <code>OutputStream</code> where the requested resource should
* be serialized.
1.1.2.2 +3 -4
xml-cocoon2/src/org/apache/cocoon/sitemap/Attic/SitemapRedirector.java
Index: SitemapRedirector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Attic/SitemapRedirector.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- SitemapRedirector.java 2001/06/07 21:05:34 1.1.2.1
+++ SitemapRedirector.java 2001/06/08 14:42:12 1.1.2.2
@@ -10,14 +10,13 @@
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.environment.Redirector;
-
import java.io.IOException;
/**
* Wrapper for sitemap redirection
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/06/07 21:05:34 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/06/08 14:42:12 $
*/
public class SitemapRedirector implements Redirector {
private boolean hasRedirected = false;
@@ -26,14 +25,14 @@
/**
* Constructor with environment--so redirection happens as expected
*/
- public SitemapRedirector (Environment e) {
+ public SitemapRedirector(Environment e) {
this.e = e;
}
/**
* Perform actual redirection
*/
- public void redirect (boolean sessionMode, String url) throws
IOException {
+ public void redirect(boolean sessionMode, String url) throws IOException
{
e.redirect(sessionMode, url);
this.hasRedirected = true;
}
1.2.2.2 +48 -59
xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java
Index: XSLTFactoryLoader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- XSLTFactoryLoader.java 2001/06/08 14:13:19 1.2.2.1
+++ XSLTFactoryLoader.java 2001/06/08 14:42:13 1.2.2.2
@@ -25,32 +25,27 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/06/08 14:13:19 $
+ * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/06/08 14:42:13 $
*/
-
public class XSLTFactoryLoader {
protected static Logger log;
-
private HashMap obj = new HashMap();
-
- public String getClassSource(String className, String prefix, String
pattern, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) {
- factory = ClassUtils.newInstance(className);
- }
-
- obj.put(className, factory);
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateClassSource(prefix,
pattern, conf);
- }
-
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getClassSource(String className, String prefix, String
pattern, NodeList conf) throws ClassNotFoundException,
+ InstantiationException, IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateClassSource(prefix,
pattern, conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
public static void setLogger(Logger logger) {
@@ -58,51 +53,45 @@
log = logger;
}
}
-
- public String getParameterSource(String className, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) {
- factory = ClassUtils.newInstance(className);
- }
- obj.put (className, factory);
-
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateParameterSource(conf);
- }
-
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getParameterSource(String className, NodeList conf) throws
ClassNotFoundException, InstantiationException,
+ IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateParameterSource(conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
-
- public String getMethodSource(String className, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) {
- factory = ClassUtils.newInstance(className);
- }
-
- obj.put (className, factory);
-
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateMethodSource(conf);
- }
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getMethodSource(String className, NodeList conf) throws
ClassNotFoundException, InstantiationException,
+ IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateMethodSource(conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
- public boolean isFactory (String className) {
+ public boolean isFactory(String className) {
boolean result = false;
try {
- result = ClassUtils.implementsInterface (className,
CodeFactory.class.getName());
+ result = ClassUtils.implementsInterface(className,
CodeFactory.class.getName());
} catch (ClassNotFoundException e) {
log.debug("ClassNotFoundException in XSLTFactoryLoader.isFactory
checking for " + className, e);
} catch (Exception e) {
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]