cziegeler 2002/06/06 07:43:42
Modified: src/java/org/apache/cocoon/acting LangSelect.java
src/java/org/apache/cocoon/components/notification
Notifier.java
src/java/org/apache/cocoon/components/pipeline
OutputComponentSelector.java
src/java/org/apache/cocoon/components/validation/schematron
SchematronFactory.java
src/java/org/apache/cocoon/environment
AbstractEnvironment.java Environment.java
src/java/org/apache/cocoon/environment/http
HttpEnvironment.java
src/java/org/apache/cocoon/matching
AbstractRegexpMatcher.java RegexpURIMatcher.java
src/java/org/apache/cocoon/transformation
XMLFormTransformer.java
src/java/org/apache/cocoon/webapps/authentication/context
SessionContextProviderImpl.java
src/java/org/apache/cocoon/webapps/portal/context
SessionContextProviderImpl.java
src/java/org/apache/cocoon/webapps/session/context
SessionContextProvider.java
StandardSessionContextProvider.java
src/scratchpad/src/org/apache/cocoon/precept
ConfigurationHelper.java Constraint.java
Context.java Instance.java InstanceFactory.java
InstanceTransformer.java
InvalidXPathSyntaxException.java
NoSuchNodeException.java Preceptor.java
PreceptorViolationException.java
src/scratchpad/src/org/apache/cocoon/precept/acting
AbstractMethodAction.java
AbstractPreceptorAction.java
PreceptorDemoAction.java
src/scratchpad/src/org/apache/cocoon/precept/preceptors
AbstractPreceptor.java PreceptorBuilder.java
src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax
AbstractPreceptorNode.java
AttributePreceptorNode.java ConstraintFactory.java
ElementPreceptorNode.java PreceptorBuilderImpl.java
PreceptorImpl.java
src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints
AbstractConstraint.java ChoiceConstraint.java
RegexprConstraint.java
src/scratchpad/src/org/apache/cocoon/precept/stores
AbstractInstance.java
src/scratchpad/src/org/apache/cocoon/precept/stores/bean
InstanceImpl.java
src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test
CocoonInstallationBean.java SystemBean.java
UserBean.java
src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple
AttributeNode.java ElementNode.java
InstanceImpl.java Node.java
Log:
Fixing some javadocs
Revision Changes Path
1.8 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/acting/LangSelect.java
Index: LangSelect.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/LangSelect.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LangSelect.java 22 Feb 2002 06:59:26 -0000 1.7
+++ LangSelect.java 6 Jun 2002 14:43:40 -0000 1.8
@@ -85,9 +85,9 @@
*
* Creation date: (3.11.2000 14:32:19)
* Modification date: (29.05.2001 0:30:01)
- * @author: <a href="mailto:[EMAIL PROTECTED]">Konstantin Piroumian</a>
- * @author: <a href="mailto:[EMAIL PROTECTED]">Lassi Immonen</a>
- * @version CVS $Id: LangSelect.java,v 1.7 2002/02/22 06:59:26 cziegeler Exp
$
+ * @author <a href="mailto:[EMAIL PROTECTED]">Konstantin Piroumian</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Lassi Immonen</a>
+ * @version CVS $Id: LangSelect.java,v 1.8 2002/06/06 14:43:40 cziegeler Exp
$
* @deprecated Use LocaleAction instead.
*/
public class LangSelect extends AbstractLoggable implements Action,
Configurable, ThreadSafe {
1.10 +9 -9
xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifier.java
Index: Notifier.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/notification/Notifier.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Notifier.java 1 Jun 2002 14:41:17 -0000 1.9
+++ Notifier.java 6 Jun 2002 14:43:40 -0000 1.10
@@ -64,9 +64,9 @@
/**
* Generates a representations of the specified Notifying Object.
*
- * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
+ * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Id: Notifier.java,v 1.9 2002/06/01 14:41:17 nicolaken Exp $
+ * @version CVS $Id: Notifier.java,v 1.10 2002/06/06 14:43:40 cziegeler Exp $
*/
public class Notifier {
@@ -78,13 +78,13 @@
* @param outputStream The output stream the notification is written to
* This could be <code>null</code>.
* @deprecated There is no way in which this method could understand what
mime/type to use. Instead use void notify(Notifying n, OutputStream
outputStream, String mimetype), where the mime/type is requested.
- * @see notify(Notifying n, OutputStream outputStream, String mimetype)
+ * @see #notify(Notifying n, OutputStream, String)
*/
public static String notify(Notifying n, OutputStream outputStream) throws
IOException {
notify(n, outputStream, "text/html") ;
return "text/html";
}
-
+
/**
* Generate notification information as a response.
* The notification is directly written to the OutputStream.
@@ -94,7 +94,7 @@
*/
public static void notify(Notifying n, OutputStream outputStream, String
mimetype) throws IOException {
//(NKB) FIXME should use error page templates, one per mime-type
- // currently uses hardcoded html, should be used only as last resort.
+ // currently uses hardcoded html, should be used only as last resort.
notifyHTML(n, outputStream);
}
@@ -140,16 +140,16 @@
if (outputStream != null)
outputStream.write(sb.toString().getBytes());
}
-
+
/**
* Generate notification information in XML format.
- * @deprecated Using a ContentHandler doesn't mean that a mimetype cannot
be specified; it could be svg or
- * @see notify(Notifying n, ContentHandler ch, String mimetype)
+ * @deprecated Using a ContentHandler doesn't mean that a mimetype cannot
be specified; it could be svg or
+ * @see #notify(Notifying, ContentHandler, String)
*/
public static void notify(Notifying n, ContentHandler ch) throws
SAXException {
notify(n, ch, "text/xml");
}
-
+
/**
* Generate notification information in XML format.
*/
1.5 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/OutputComponentSelector.java
Index: OutputComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/OutputComponentSelector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OutputComponentSelector.java 22 Feb 2002 07:00:11 -0000 1.4
+++ OutputComponentSelector.java 6 Jun 2002 14:43:40 -0000 1.5
@@ -53,11 +53,11 @@
import org.apache.avalon.framework.component.ComponentSelector;
/**
- * A <code>ComponentSelector</code> for output components used by a [EMAIL
PROTECTED] StreamPipeline}.
+ * A <code>ComponentSelector</code> for output components used by a [EMAIL
PROTECTED] ProcessingPipeline}.
* This selector is able to associate a MIME type to a hint.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Id: OutputComponentSelector.java,v 1.4 2002/02/22 07:00:11
cziegeler Exp $
+ * @version CVS $Id: OutputComponentSelector.java,v 1.5 2002/06/06 14:43:40
cziegeler Exp $
*/
public interface OutputComponentSelector extends ComponentSelector {
1.4 +50 -50
xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronFactory.java
Index: SchematronFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SchematronFactory.java 25 May 2002 16:04:48 -0000 1.3
+++ SchematronFactory.java 6 Jun 2002 14:43:40 -0000 1.4
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronFactory.java,v
1.3 2002/05/25 16:04:48 ivelin Exp $
- * $Revision: 1.3 $
- * $Date: 2002/05/25 16:04:48 $
+ * $Header:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronFactory.java,v
1.4 2002/06/06 14:43:40 cziegeler Exp $
+ * $Revision: 1.4 $
+ * $Date: 2002/06/06 14:43:40 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -70,7 +70,7 @@
import java.util.List;
import java.io.IOException;
import java.net.URL;
-
+
// XML classes
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
@@ -97,18 +97,18 @@
* from a DOM source
*
* @author Ivelin Ivanov, [EMAIL PROTECTED], [EMAIL PROTECTED]
- * @author: Michael Ratliff, [EMAIL PROTECTED] <[EMAIL PROTECTED]>, May 2002
+ * @author Michael Ratliff, [EMAIL PROTECTED] <[EMAIL PROTECTED]>, May 2002
*/
public class SchematronFactory extends SchemaFactory
{
-
+
/**
* the schema name space prefix used in the schema document
*/
private String schemaPrefix_;
-
+
/**
- * the default schema name space prefix
+ * the default schema name space prefix
*/
private String defaultSchemaPrefix_ = "sch";
@@ -116,8 +116,8 @@
* private logger
*/
private Logger logger = setupLogger();
-
-
+
+
//
// Constructors
//
@@ -131,9 +131,9 @@
logger.setPriority( Priority.ERROR );
return logger;
}
-
+
/**
- * Builds a new Schema instance from
+ * Builds a new Schema instance from
* the given XML InputSource
*
* @param schemaSrc
@@ -148,7 +148,7 @@
// load Schema file into a DOM document
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
DocumentBuilder dbld = dbf.newDocumentBuilder ();
- Document document = dbld.parse( schemaSrc );
+ Document document = dbld.parse( schemaSrc );
schema = buildSchema( document );
@@ -182,23 +182,23 @@
jxpContext.setLenient(false);
// Bind sch:schema element
-
+
// schema title
String title = (String) jxpContext.getValue ( "/schema/title",
String.class );
schema.setTitle( title );
logger.debug( "Schema title: " + schema.getTitle());
-
+
bindPatterns( schema, jxpContext );
bindPhases( schema, jxpContext );
-
+
return schema;
}
-
+
/**
* populates the patterns elements from the dom tree
*
* @param schema the schema instance
- * @param jxpContext
+ * @param jxpContext
*/
protected void bindPatterns( SchematronSchema schema, JXPathContext
jxpContext)
{
@@ -215,26 +215,26 @@
Pattern pattern = new Pattern();
String ptprefix = "/schema/pattern[" + i + "]";
- String name = (String) jxpContext.getValue ( ptprefix + "/@name",
String.class );
+ String name = (String) jxpContext.getValue ( ptprefix + "/@name",
String.class );
pattern.setName( name );
logger.debug( "Pattern name : " + pattern.getName());
- String id = (String) jxpContext.getValue ( ptprefix + "/@id",
String.class );
+ String id = (String) jxpContext.getValue ( ptprefix + "/@id",
String.class );
pattern.setId( id );
logger.debug( "Pattern id : " + pattern.getId() );
-
+
bindRules( pattern, ptprefix, jxpContext );
-
+
schema.addPattern( pattern );
}
}
-
+
/**
* populates the rules elements for a pattern
* from the dom tree
*
- * @param pattern
+ * @param pattern
* @param pathPrefix pattern path prefix
* @param jxpContext JXPathContext
*/
@@ -253,26 +253,26 @@
Rule rule = new Rule();
String rulePrefix = pathPrefix + "/rule[" + i + "]";
- String context = (String) jxpContext.getValue ( rulePrefix +
"/@context", String.class );
+ String context = (String) jxpContext.getValue ( rulePrefix +
"/@context", String.class );
rule.setContext( context );
logger.debug( "Rule context : " + rule.getContext());
bindAsserts( rule, rulePrefix, jxpContext );
-
+
// Patch to make reports work in schematron
// Note change to name of bindRerports [sic] function
bindReports( rule, rulePrefix, jxpContext );
-
+
pattern.addRule( rule );
}
}
-
+
/**
* populates the assert elements for a rule
* from the dom tree
*
- * @param rule
+ * @param rule
* @param pathPrefix rule path prefix
* @param jxpContext JXPathContext
*/
@@ -291,7 +291,7 @@
Assert assert = new Assert();
String assertPrefix = pathPrefix + "/assert[" + i + "]";
- String test = (String) jxpContext.getValue ( assertPrefix + "/@test",
String.class );
+ String test = (String) jxpContext.getValue ( assertPrefix + "/@test",
String.class );
assert.setTest( test );
logger.debug( "Assert test : " + assert.getTest());
@@ -299,7 +299,7 @@
// since diagnostics is a non-mandatory element
// we will try to get its value in a lenient mode
jxpContext.setLenient(true);
- String diagnostics = (String) jxpContext.getValue ( assertPrefix +
"/@diagnostics", String.class );
+ String diagnostics = (String) jxpContext.getValue ( assertPrefix +
"/@diagnostics", String.class );
assert.setDiagnostics( diagnostics );
logger.debug( "Assert diagnostics : " + assert.getDiagnostics());
jxpContext.setLenient(false);
@@ -311,13 +311,13 @@
rule.addAssert( assert );
}
}
-
-
+
+
/**
* populates the report elements for a rule
* from the dom tree
*
- * @param rule
+ * @param rule
* @param pathPrefix rule path prefix
* @param jxpContext JXPathContext
*/
@@ -337,19 +337,19 @@
Report report = new Report();
String assertPrefix = pathPrefix + "/report[" + i + "]";
- String test = (String) jxpContext.getValue ( assertPrefix + "/@test",
String.class );
+ String test = (String) jxpContext.getValue ( assertPrefix + "/@test",
String.class );
report.setTest( test );
logger.debug( "Report test : " + report.getTest());
// since diagnostics is a non-mandatory element
// we will try to get its value in a lenient mode
jxpContext.setLenient(true);
- String diagnostics = (String) jxpContext.getValue ( assertPrefix +
"/@diagnostics", String.class );
+ String diagnostics = (String) jxpContext.getValue ( assertPrefix +
"/@diagnostics", String.class );
report.setDiagnostics( diagnostics );
logger.debug( "Report diagnostics : " + report.getDiagnostics());
jxpContext.setLenient(false);
- String message = (String) jxpContext.getValue ( assertPrefix,
String.class );
+ String message = (String) jxpContext.getValue ( assertPrefix,
String.class );
report.setMessage( message );
logger.debug( "Report message : " + report.getMessage());
@@ -357,12 +357,12 @@
}
}
-
+
/**
* populates the phases elements from the dom tree
*
* @param schema the schema instance
- * @param jxpContext
+ * @param jxpContext
*/
protected void bindPhases( SchematronSchema schema, JXPathContext
jxpContext)
{
@@ -373,24 +373,24 @@
// schema phases
int phaseCount = ((Integer) jxpContext.getValue (
"count(/schema/phase)", Integer.class )).intValue();
logger.debug( "\nNumber of phases: " + phaseCount);
-
+
for (int i = 1; i <= phaseCount; i++)
{
logger.debug( "phase# : " + i);
Phase phase = new Phase();
String phprefix = "/schema/phase[" + i + "]";
- String id = (String) jxpContext.getValue ( phprefix + "/@id",
String.class );
+ String id = (String) jxpContext.getValue ( phprefix + "/@id",
String.class );
phase.setId( id );
logger.debug( "phase id : " + phase.getId());
bindPhaseActivePatterns( phase, phprefix, jxpContext );
-
+
schema.addPhase( phase );
}
}
-
-
+
+
protected void bindPhaseActivePatterns( Phase phase, String pathPrefix,
JXPathContext jxpContext)
{
// ensure that mandatory elements which are not found
@@ -406,7 +406,7 @@
ActivePattern activePattern = new ActivePattern();
String assertPrefix = pathPrefix + "/active[" + i + "]";
- String pt = (String) jxpContext.getValue ( assertPrefix + "/@pattern",
String.class );
+ String pt = (String) jxpContext.getValue ( assertPrefix + "/@pattern",
String.class );
activePattern.setPattern( pt );
logger.debug( "Phase active pattern : " + activePattern.getPattern());
@@ -414,14 +414,14 @@
}
}
-
-
-
+
+
+
/*
* Replace all occurances of sch: with the actual Schema prefix used in
the document
*
- * @todo fix this implementaion. There are problems with DOM.
- * Returns null instead of the actual namespace prefix (e.g. "sch") as
expected.
+ * @todo fix this implementaion. There are problems with DOM.
+ * Returns null instead of the actual namespace prefix (e.g. "sch") as
expected.
*/
protected String fixns( String path )
{
1.21 +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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- AbstractEnvironment.java 4 Jun 2002 07:31:52 -0000 1.20
+++ AbstractEnvironment.java 6 Jun 2002 14:43:40 -0000 1.21
@@ -74,7 +74,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: AbstractEnvironment.java,v 1.20 2002/06/04 07:31:52
cziegeler Exp $
+ * @version CVS $Id: AbstractEnvironment.java,v 1.21 2002/06/06 14:43:40
cziegeler Exp $
*/
public abstract class AbstractEnvironment extends AbstractLoggable
implements Environment {
@@ -371,7 +371,7 @@
* "resource" was requested.
* The caller has to test if it is really the same "resource"
* which is requested.
- * @result true if the response is modified or if the
+ * @return true if the response is modified or if the
* environment is not able to test it
*/
public boolean isResponseModified(long lastModified) {
1.11 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java
Index: Environment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/Environment.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Environment.java 26 Apr 2002 10:42:16 -0000 1.10
+++ Environment.java 6 Jun 2002 14:43:40 -0000 1.11
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: Environment.java,v 1.10 2002/04/26 10:42:16 cziegeler
Exp $
+ * @version CVS $Id: Environment.java,v 1.11 2002/06/06 14:43:40 cziegeler
Exp $
*/
public interface Environment
@@ -173,7 +173,7 @@
* "resource" was requested.
* The caller has to test if it is really the same "resource"
* which is requested.
- * @result true if the response is modified or if the
+ * @return true if the response is modified or if the
* environment is not able to test it
*/
boolean isResponseModified(long lastModified);
1.13 +5 -5
xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java
Index: HttpEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HttpEnvironment.java 27 Mar 2002 15:13:40 -0000 1.12
+++ HttpEnvironment.java 6 Jun 2002 14:43:40 -0000 1.13
@@ -68,7 +68,7 @@
/**
* @author ?
- * @version CVS $Id: HttpEnvironment.java,v 1.12 2002/03/27 15:13:40 sylvain
Exp $
+ * @version CVS $Id: HttpEnvironment.java,v 1.13 2002/06/06 14:43:40
cziegeler Exp $
*/
public class HttpEnvironment extends AbstractEnvironment implements
Redirector {
@@ -90,7 +90,7 @@
/** Cache content type as there is no getContentType() in reponse object
*/
private String contentType = null;
-
+
/** Did we redirect ? */
private boolean hasRedirected = false;
@@ -159,9 +159,9 @@
getLogger().debug("redirect: something's broken, request =
null");
return;
}
-
+
this.hasRedirected = true;
-
+
// check if session mode shall be activated
if (sessionmode) {
// The session
@@ -243,7 +243,7 @@
* "resource" was requested.
* The caller has to test if it is really the same "resource"
* which is requested.
- * @result true if the response is modified or if the
+ * @return true if the response is modified or if the
* environment is not able to test it
*/
public boolean isResponseModified(long lastModified) {
1.8 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/matching/AbstractRegexpMatcher.java
Index: AbstractRegexpMatcher.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/matching/AbstractRegexpMatcher.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractRegexpMatcher.java 1 May 2002 10:53:16 -0000 1.7
+++ AbstractRegexpMatcher.java 6 Jun 2002 14:43:40 -0000 1.8
@@ -69,8 +69,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @authos <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Id: AbstractRegexpMatcher.java,v 1.7 2002/05/01 10:53:16
haul Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
+ * @version CVS $Id: AbstractRegexpMatcher.java,v 1.8 2002/06/06 14:43:40
cziegeler Exp $
*/
public abstract class AbstractRegexpMatcher extends
AbstractPreparableMatcher implements ThreadSafe {
1.6 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/matching/RegexpURIMatcher.java
Index: RegexpURIMatcher.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/matching/RegexpURIMatcher.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RegexpURIMatcher.java 22 Feb 2002 07:03:52 -0000 1.5
+++ RegexpURIMatcher.java 6 Jun 2002 14:43:41 -0000 1.6
@@ -68,8 +68,8 @@
/**
* Matches the request URIs against a regular expression pattern.
*
- * @authos <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
- * @version CVS $Id: RegexpURIMatcher.java,v 1.5 2002/02/22 07:03:52
cziegeler Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a>
+ * @version CVS $Id: RegexpURIMatcher.java,v 1.6 2002/06/06 14:43:41
cziegeler Exp $
*/
public class RegexpURIMatcher extends AbstractRegexpMatcher
{
1.6 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java
Index: XMLFormTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLFormTransformer.java 4 Jun 2002 09:42:02 -0000 1.5
+++ XMLFormTransformer.java 6 Jun 2002 14:43:41 -0000 1.6
@@ -92,9 +92,9 @@
* The original code was built by Torsten Curdt as
* part of the Preceptor API
*
- * @author: Ivelin Ivanov <[EMAIL PROTECTED]>, May 2002
- * @author: Michael Ratliff, [EMAIL PROTECTED] <[EMAIL PROTECTED]>, May 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>, March 2002
+ * @author Ivelin Ivanov <[EMAIL PROTECTED]>, May 2002
+ * @author Michael Ratliff, [EMAIL PROTECTED] <[EMAIL PROTECTED]>, May 2002
+ * @author Torsten Curdt <[EMAIL PROTECTED]>, March 2002
*/
public class XMLFormTransformer extends AbstractSAXTransformer
1.2 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/webapps/authentication/context/SessionContextProviderImpl.java
Index: SessionContextProviderImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/authentication/context/SessionContextProviderImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SessionContextProviderImpl.java 17 Apr 2002 10:04:52 -0000 1.1
+++ SessionContextProviderImpl.java 6 Jun 2002 14:43:41 -0000 1.2
@@ -67,7 +67,7 @@
* Context provider for the authentication context
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: SessionContextProviderImpl.java,v 1.1 2002/04/17
10:04:52 cziegeler Exp $
+ * @version CVS $Id: SessionContextProviderImpl.java,v 1.2 2002/06/06
14:43:41 cziegeler Exp $
*/
public final class SessionContextProviderImpl
implements SessionContextProvider {
@@ -78,7 +78,7 @@
* @param objectModel The objectModel of the current request.
* @param resolver The source resolver
* @param componentManager manager
- * @result The context
+ * @return The context
* @throws ProcessingException If the context is not available.
*/
public SessionContext getSessionContext(String name,
1.3 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/webapps/portal/context/SessionContextProviderImpl.java
Index: SessionContextProviderImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/portal/context/SessionContextProviderImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SessionContextProviderImpl.java 19 Apr 2002 11:02:58 -0000 1.2
+++ SessionContextProviderImpl.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -75,7 +75,7 @@
* Context provider for the portal context
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: SessionContextProviderImpl.java,v 1.2 2002/04/19
11:02:58 cziegeler Exp $
+ * @version CVS $Id: SessionContextProviderImpl.java,v 1.3 2002/06/06
14:43:41 cziegeler Exp $
*/
public final class SessionContextProviderImpl
implements SessionContextProvider {
@@ -84,7 +84,7 @@
* Get the context
* @param name The name of the context
* @param objectModel The objectModel of the current request.
- * @result The context
+ * @return The context
* @throws ProcessingException If the context is not available.
*/
public SessionContext getSessionContext(String name,
1.3 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/webapps/session/context/SessionContextProvider.java
Index: SessionContextProvider.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/session/context/SessionContextProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SessionContextProvider.java 17 Apr 2002 10:04:52 -0000 1.2
+++ SessionContextProvider.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -63,7 +63,7 @@
* for each request.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: SessionContextProvider.java,v 1.2 2002/04/17 10:04:52
cziegeler Exp $
+ * @version CVS $Id: SessionContextProvider.java,v 1.3 2002/06/06 14:43:41
cziegeler Exp $
*/
public interface SessionContextProvider {
@@ -73,7 +73,7 @@
* @param objectModel The objectModel of the current request.
* @param resolver The source resolver
* @param componentManager manager
- * @result The context
+ * @return The context
* @throws ProcessingException If the context is not available.
*/
SessionContext getSessionContext(String name,
1.2 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/webapps/session/context/StandardSessionContextProvider.java
Index: StandardSessionContextProvider.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/session/context/StandardSessionContextProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StandardSessionContextProvider.java 17 Apr 2002 08:43:57 -0000
1.1
+++ StandardSessionContextProvider.java 6 Jun 2002 14:43:41 -0000
1.2
@@ -62,7 +62,7 @@
* response context.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Id: StandardSessionContextProvider.java,v 1.1 2002/04/17
08:43:57 cziegeler Exp $
+ * @version CVS $Id: StandardSessionContextProvider.java,v 1.2 2002/06/06
14:43:41 cziegeler Exp $
*/
public final class StandardSessionContextProvider
implements SessionContextProvider {
@@ -73,7 +73,7 @@
* @param objectModel The objectModel of the current request.
* @param resolver The source resolver
* @param componentManager manager
- * @result The context
+ * @return The context
* @throws ProcessingException If the context is not available.
*/
public SessionContext getSessionContext(String name,
1.2 +76 -38
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/ConfigurationHelper.java
Index: ConfigurationHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/ConfigurationHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConfigurationHelper.java 26 Mar 2002 19:58:10 -0000 1.1
+++ ConfigurationHelper.java 6 Jun 2002 14:43:41 -0000 1.2
@@ -1,38 +1,76 @@
-/*
- * @version: Mar 26, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-package org.apache.cocoon.precept;
-
-import org.apache.avalon.framework.configuration.Configuration;
-
-public class ConfigurationHelper {
- public final static String toString( Configuration conf ) {
- String result = "<" + conf.getName();
-
- String[] attributes = conf.getAttributeNames();
- for(int i=0;i<attributes.length;i++) {
- try {
- result += " " + attributes[i] + "=\"" +
conf.getAttribute(attributes[i]) + "\"";
- }
- catch(Throwable t) {
- }
- }
-
- result += ">";
-
- try {
- result += conf.getValue();
- }
- catch(Throwable t) {
- }
-
- Configuration[] childs = conf.getChildren();
- for(int i=0;i<childs.length;i++) {
- Configuration child = childs[i];
- result += toString(child);
- }
-
- return(result + "</" + conf.getName() + ">");
- }
-}
+/*
+
+ * @version: Mar 26, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+
+
+public class ConfigurationHelper {
+
+ public final static String toString( Configuration conf ) {
+
+ String result = "<" + conf.getName();
+
+
+
+ String[] attributes = conf.getAttributeNames();
+
+ for(int i=0;i<attributes.length;i++) {
+
+ try {
+
+ result += " " + attributes[i] + "=\"" +
conf.getAttribute(attributes[i]) + "\"";
+
+ }
+
+ catch(Throwable t) {
+
+ }
+
+ }
+
+
+
+ result += ">";
+
+
+
+ try {
+
+ result += conf.getValue();
+
+ }
+
+ catch(Throwable t) {
+
+ }
+
+
+
+ Configuration[] childs = conf.getChildren();
+
+ for(int i=0;i<childs.length;i++) {
+
+ Configuration child = childs[i];
+
+ result += toString(child);
+
+ }
+
+
+
+ return(result + "</" + conf.getName() + ">");
+
+ }
+
+}
+
1.3 +136 -68
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Constraint.java
Index: Constraint.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Constraint.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Constraint.java 25 Mar 2002 23:23:54 -0000 1.2
+++ Constraint.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,68 +1,136 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import org.apache.cocoon.precept.Context;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public interface Constraint {
- public boolean isSatisfiedBy( Object value, Context context );
- public String getId();
- public String getType();
- public void toSAX(ContentHandler handler) throws SAXException;
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.cocoon.precept.Context;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public interface Constraint {
+
+ public boolean isSatisfiedBy( Object value, Context context );
+
+ public String getId();
+
+ public String getType();
+
+ public void toSAX(ContentHandler handler) throws SAXException;
+
+}
+
1.3 +122 -61
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Context.java
Index: Context.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Context.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Context.java 25 Mar 2002 23:23:54 -0000 1.2
+++ Context.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,61 +1,122 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import java.util.Locale;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class Context {
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import java.util.Locale;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class Context {
+
+}
+
1.5 +120 -60
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Instance.java
Index: Instance.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Instance.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Instance.java 4 Apr 2002 14:12:47 -0000 1.4
+++ Instance.java 6 Jun 2002 14:43:41 -0000 1.5
@@ -1,77 +1,137 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept;
import org.apache.avalon.framework.component.Component;
import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
+import org.xml.sax.SAXException;
+
+
+
import java.util.Collection;
-/*
- * @version: Mar 15, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @version: Mar 15, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public interface Instance extends Component {
public String ROLE = "org.apache.cocoon.precept.Instance";
-
+
+
public void setValue(String xpath, Object value) throws
PreceptorViolationException, InvalidXPathSyntaxException;
public void setValue(String xpath, Object value, Context context) throws
PreceptorViolationException, InvalidXPathSyntaxException;
- public Object getValue(String xpath) throws InvalidXPathSyntaxException,
NoSuchNodeException;
+ public Object getValue(String xpath) throws InvalidXPathSyntaxException,
NoSuchNodeException;
+
public Collection getNodePaths();
public void setPreceptor( Preceptor preceptor );
public Preceptor getPreceptor();
-
+
+
public void toSAX( ContentHandler handler, boolean constraints) throws
SAXException;
public long getLastModified();
}
1.4 +118 -59
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InstanceFactory.java
Index: InstanceFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InstanceFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InstanceFactory.java 4 Apr 2002 07:00:40 -0000 1.3
+++ InstanceFactory.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,54 +1,105 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept;
import org.apache.avalon.framework.logger.AbstractLoggable;
@@ -65,10 +116,14 @@
import org.apache.cocoon.precept.preceptors.PreceptorBuilder;
-/*
- * @version: Mar 18, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @version: Mar 18, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public class InstanceFactory extends AbstractLoggable implements Component,
Configurable, Composable, ThreadSafe {
public final static String ROLE =
"org.apache.cocoon.precept.InstanceFactory";
@@ -85,10 +140,14 @@
Configuration instance = instances[p];
String name = instance.getAttribute("name");
getLogger().debug("registering instance [name=" +
String.valueOf(name) + ";impl=" + String.valueOf(instance.getAttribute("impl"))
+ "]");
- if (instanceConfigurationMap.containsKey(name)) {
- getLogger().error("instance [name=" + String.valueOf(name) + "]
appears more than once");
- throw new ConfigurationException("instance [name=" +
String.valueOf(name) + "] appears more than once");
- }
+ if (instanceConfigurationMap.containsKey(name)) {
+
+ getLogger().error("instance [name=" + String.valueOf(name) + "]
appears more than once");
+
+ throw new ConfigurationException("instance [name=" +
String.valueOf(name) + "] appears more than once");
+
+ }
+
instanceConfigurationMap.put(name, instance);
}
}
1.5 +586 -293
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InstanceTransformer.java
Index: InstanceTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InstanceTransformer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InstanceTransformer.java 4 Apr 2002 07:02:09 -0000 1.4
+++ InstanceTransformer.java 6 Jun 2002 14:43:41 -0000 1.5
@@ -1,296 +1,589 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.precept.acting.AbstractPreceptorAction;
-import org.apache.cocoon.caching.CacheValidity;
-import org.apache.cocoon.caching.NOPCacheValidity;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Session;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.transformation.AbstractTransformer;
-import org.apache.log.Logger;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.List;
-import java.util.Iterator;
-import java.util.Collection;
-
-/*
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class InstanceTransformer extends AbstractTransformer {
- //implements Cacheable {
-
- public final static String NS = "http://www.dff.st/ns/desire/instance/1.0";
-
- public final static Attributes NOATTR = new AttributesImpl();
-
- public final static String TAG_INSERTINSTANCE = "insert-instance";
- public final static String TAG_INSERTINSTANCE_ATTR_ID = "id";
-
- public final static String TAG_INSTANCE = "instance";
- public final static String TAG_INSTANCE_ATTR_ID = "id";
-
- public final static String TAG_INSERTVIOLATIONS = "insert-violations";
-
- public final static String TAG_BUTTON = "button";
-
- public final static String TAG_LABEL = "label";
-
- public final static String TAG_OUTPUT = "output";
- public final static String TAG_TEXTBOX = "textbox";
- public final static String TAG_PASSWORD = "password";
- public final static String TAG_SELECTBOOLEAN = "selectBoolean";
- public final static String TAG_SELECTONE = "selectOne";
-
- public final static String TAG_SELECTMANY = "selectMany";
-
- public final static String TAG_COMMON_ATTR_REF = "ref";
- public final static String TAG_COMMON_ATTR_INSTANCE = "instance";
-
- private Request request;
- private Session session;
- private Instance defaultInstance;
- private Object value;
- private String prefix;
-
- public void setup(SourceResolver resolver, Map objectModel, String source,
Parameters parameters) throws ProcessingException, SAXException, IOException {
- request = ObjectModelHelper.getRequest(objectModel);
- if (request == null) {
- getLogger().debug("no request object");
- throw new ProcessingException("no request object");
- }
-
- session = request.getSession(false);
- defaultInstance = null;
- prefix = null;
- }
-
-
- public void startElement(String uri, String name, String raw, Attributes
attributes) throws SAXException {
- if (NS.equals(uri)) {
- if (prefix == null) {
- prefix = raw.substring(0, raw.length() - name.length() - 1);
- getLogger().debug("found prefix [" + String.valueOf(prefix) + "] for
namespace [" + NS + "]");
- }
-
- if (TAG_INSERTINSTANCE.equals(name)) {
- if (session != null) {
- String id = attributes.getValue(TAG_INSERTINSTANCE_ATTR_ID);
-
- getLogger().debug("inserting instance [id=" + String.valueOf(id) +
"]");
- Instance instance = (Instance) session.getAttribute(id);
- if (instance != null) {
- instance.toSAX(this, true);
- }
- else {
- getLogger().debug("could not find instance [id=" +
String.valueOf(id) + "]");
- }
- }
- else {
- getLogger().debug("no session - no instance");
- }
- }
- else if (TAG_INSERTVIOLATIONS.equals(name)) {
- Collection violations = (Collection)
request.getAttribute(AbstractPreceptorAction.PRECEPTORVIOLATIONS);
- if (violations != null) {
- for (Iterator it = violations.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- super.startElement(uri, "constraint", prefix + ":" +
"constraint", NOATTR);
- String v = String.valueOf(constraint);
- super.characters(v.toCharArray(), 0, v.length());
- super.endElement(uri, "constraint", prefix + ":" + "constraint");
- }
- }
- }
- else if (TAG_INSTANCE.equals(name)) {
- if (session != null) {
- String id = attributes.getValue(TAG_INSTANCE_ATTR_ID);
- defaultInstance = (Instance) session.getAttribute(id);
- if (defaultInstance != null) {
- getLogger().debug("using default instance [id=" +
String.valueOf(id) + "]");
- }
- else {
- getLogger().error("could not find instance [id=" +
String.valueOf(id) + "]");
- }
- }
- }
- else if (TAG_OUTPUT.equals(name) ||
- TAG_TEXTBOX.equals(name) ||
- TAG_PASSWORD.equals(name) ||
- TAG_SELECTBOOLEAN.equals(name) ||
- TAG_SELECTONE.equals(name)) {
- String ref = attributes.getValue(TAG_COMMON_ATTR_REF);
- String id = attributes.getValue(TAG_COMMON_ATTR_INSTANCE);
-
- getLogger().debug("[" + String.valueOf(name) + "] getting value from
[" + String.valueOf(ref) + "]");
-
- if (ref != null) {
- Instance instance = defaultInstance;
-
- if (id != null) {
- if (session != null) {
- instance = (Instance) session.getAttribute(id);
- if (instance != null) {
- getLogger().debug("using instance [id=" + String.valueOf(id)
+ "]");
- }
- else {
- getLogger().error("could not find instance [id=" +
String.valueOf(id) + "]");
- }
- }
- }
-
- super.startElement(uri, name, raw, attributes);
- try {
- value = instance.getValue(ref);
-
- getLogger().debug("[" + String.valueOf(ref) + "] = " +
String.valueOf(value));
-
- super.startElement(uri, "value", prefix + ":" + "value", NOATTR);
- if (value != null) {
- String v = String.valueOf(value);
- super.characters(v.toCharArray(),0,v.length());
- }
- super.endElement(uri, "value", prefix + ":" + "value");
-
- if (instance.getPreceptor() != null) {
- Collection constraints =
instance.getPreceptor().getConstraintsFor(ref);
- if (constraints != null) {
- for (Iterator it = constraints.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- constraint.toSAX(this);
- }
- }
- }
- }
- catch (InvalidXPathSyntaxException e) {
- throw new SAXException(e);
- }
- catch (NoSuchNodeException e) {
- //throw new SAXException(e);
- }
- }
- else {
- throw new SAXException("[" + String.valueOf(name) + "] needs an
\"" + TAG_COMMON_ATTR_REF + "\" attribute");
- }
- }
- else if (TAG_SELECTMANY.equals(name)) {
- //NYI
- throw new SAXException("NYI");
- }
- else if (TAG_BUTTON.equals(name)) {
- //NYI
- super.startElement(uri, name, raw, attributes);
- }
- else {
- getLogger().error("unknown element [" + String.valueOf(name) + "]");
- super.startElement(uri, name, raw, attributes);
- }
- }
- else {
- super.startElement(uri, name, raw, attributes);
- }
- }
-
-
- public void endElement(String uri, String name, String raw) throws
SAXException {
- if (NS.equals(uri)) {
- if (TAG_INSERTINSTANCE.equals(name)) {
- }
- else if (TAG_INSERTVIOLATIONS.equals(name)) {
- }
- else if (TAG_INSTANCE.equals(name)) {
- }
- else if (TAG_OUTPUT.equals(name) ||
- TAG_TEXTBOX.equals(name) ||
- TAG_PASSWORD.equals(name) ||
- TAG_SELECTBOOLEAN.equals(name) ||
- TAG_SELECTONE.equals(name) ) {
- super.endElement(uri, name, raw);
- }
- else if (TAG_SELECTMANY.equals(name)) {
- }
- else if (TAG_BUTTON.equals(name)) {
- super.endElement(uri, name, raw);
- }
- else {
- getLogger().error("unknown element [" + String.valueOf(name) + "]");
- super.endElement(uri, name, raw);
- }
- }
- else {
- super.endElement(uri, name, raw);
- }
- }
-
- public void characters(char[] chars, int start, int len) throws
SAXException {
- super.characters(chars, start, len);
- }
-
- public long generateKey() {
- return (1);
- }
-
- public CacheValidity generateValidity() {
- return (new NOPCacheValidity());
- }
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.avalon.framework.parameters.Parameters;
+
+import org.apache.cocoon.ProcessingException;
+
+import org.apache.cocoon.precept.acting.AbstractPreceptorAction;
+
+import org.apache.cocoon.caching.CacheValidity;
+
+import org.apache.cocoon.caching.NOPCacheValidity;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+
+import org.apache.cocoon.environment.Request;
+
+import org.apache.cocoon.environment.Session;
+
+import org.apache.cocoon.environment.SourceResolver;
+
+import org.apache.cocoon.transformation.AbstractTransformer;
+
+import org.apache.log.Logger;
+
+import org.xml.sax.Attributes;
+
+import org.xml.sax.SAXException;
+
+import org.xml.sax.helpers.AttributesImpl;
+
+
+
+import java.io.IOException;
+
+import java.util.Map;
+
+import java.util.List;
+
+import java.util.Iterator;
+
+import java.util.Collection;
+
+
+
+/*
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class InstanceTransformer extends AbstractTransformer {
+
+ //implements Cacheable {
+
+
+
+ public final static String NS = "http://www.dff.st/ns/desire/instance/1.0";
+
+
+
+ public final static Attributes NOATTR = new AttributesImpl();
+
+
+
+ public final static String TAG_INSERTINSTANCE = "insert-instance";
+
+ public final static String TAG_INSERTINSTANCE_ATTR_ID = "id";
+
+
+
+ public final static String TAG_INSTANCE = "instance";
+
+ public final static String TAG_INSTANCE_ATTR_ID = "id";
+
+
+
+ public final static String TAG_INSERTVIOLATIONS = "insert-violations";
+
+
+
+ public final static String TAG_BUTTON = "button";
+
+
+
+ public final static String TAG_LABEL = "label";
+
+
+
+ public final static String TAG_OUTPUT = "output";
+
+ public final static String TAG_TEXTBOX = "textbox";
+
+ public final static String TAG_PASSWORD = "password";
+
+ public final static String TAG_SELECTBOOLEAN = "selectBoolean";
+
+ public final static String TAG_SELECTONE = "selectOne";
+
+
+
+ public final static String TAG_SELECTMANY = "selectMany";
+
+
+
+ public final static String TAG_COMMON_ATTR_REF = "ref";
+
+ public final static String TAG_COMMON_ATTR_INSTANCE = "instance";
+
+
+
+ private Request request;
+
+ private Session session;
+
+ private Instance defaultInstance;
+
+ private Object value;
+
+ private String prefix;
+
+
+
+ public void setup(SourceResolver resolver, Map objectModel, String source,
Parameters parameters) throws ProcessingException, SAXException, IOException {
+
+ request = ObjectModelHelper.getRequest(objectModel);
+
+ if (request == null) {
+
+ getLogger().debug("no request object");
+
+ throw new ProcessingException("no request object");
+
+ }
+
+
+
+ session = request.getSession(false);
+
+ defaultInstance = null;
+
+ prefix = null;
+
+ }
+
+
+
+
+
+ public void startElement(String uri, String name, String raw, Attributes
attributes) throws SAXException {
+
+ if (NS.equals(uri)) {
+
+ if (prefix == null) {
+
+ prefix = raw.substring(0, raw.length() - name.length() - 1);
+
+ getLogger().debug("found prefix [" + String.valueOf(prefix) + "] for
namespace [" + NS + "]");
+
+ }
+
+
+
+ if (TAG_INSERTINSTANCE.equals(name)) {
+
+ if (session != null) {
+
+ String id = attributes.getValue(TAG_INSERTINSTANCE_ATTR_ID);
+
+
+
+ getLogger().debug("inserting instance [id=" + String.valueOf(id) +
"]");
+
+ Instance instance = (Instance) session.getAttribute(id);
+
+ if (instance != null) {
+
+ instance.toSAX(this, true);
+
+ }
+
+ else {
+
+ getLogger().debug("could not find instance [id=" +
String.valueOf(id) + "]");
+
+ }
+
+ }
+
+ else {
+
+ getLogger().debug("no session - no instance");
+
+ }
+
+ }
+
+ else if (TAG_INSERTVIOLATIONS.equals(name)) {
+
+ Collection violations = (Collection)
request.getAttribute(AbstractPreceptorAction.PRECEPTORVIOLATIONS);
+
+ if (violations != null) {
+
+ for (Iterator it = violations.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ super.startElement(uri, "constraint", prefix + ":" +
"constraint", NOATTR);
+
+ String v = String.valueOf(constraint);
+
+ super.characters(v.toCharArray(), 0, v.length());
+
+ super.endElement(uri, "constraint", prefix + ":" + "constraint");
+
+ }
+
+ }
+
+ }
+
+ else if (TAG_INSTANCE.equals(name)) {
+
+ if (session != null) {
+
+ String id = attributes.getValue(TAG_INSTANCE_ATTR_ID);
+
+ defaultInstance = (Instance) session.getAttribute(id);
+
+ if (defaultInstance != null) {
+
+ getLogger().debug("using default instance [id=" +
String.valueOf(id) + "]");
+
+ }
+
+ else {
+
+ getLogger().error("could not find instance [id=" +
String.valueOf(id) + "]");
+
+ }
+
+ }
+
+ }
+
+ else if (TAG_OUTPUT.equals(name) ||
+
+ TAG_TEXTBOX.equals(name) ||
+
+ TAG_PASSWORD.equals(name) ||
+
+ TAG_SELECTBOOLEAN.equals(name) ||
+
+ TAG_SELECTONE.equals(name)) {
+
+ String ref = attributes.getValue(TAG_COMMON_ATTR_REF);
+
+ String id = attributes.getValue(TAG_COMMON_ATTR_INSTANCE);
+
+
+
+ getLogger().debug("[" + String.valueOf(name) + "] getting value from
[" + String.valueOf(ref) + "]");
+
+
+
+ if (ref != null) {
+
+ Instance instance = defaultInstance;
+
+
+
+ if (id != null) {
+
+ if (session != null) {
+
+ instance = (Instance) session.getAttribute(id);
+
+ if (instance != null) {
+
+ getLogger().debug("using instance [id=" + String.valueOf(id)
+ "]");
+
+ }
+
+ else {
+
+ getLogger().error("could not find instance [id=" +
String.valueOf(id) + "]");
+
+ }
+
+ }
+
+ }
+
+
+
+ super.startElement(uri, name, raw, attributes);
+
+ try {
+
+ value = instance.getValue(ref);
+
+
+
+ getLogger().debug("[" + String.valueOf(ref) + "] = " +
String.valueOf(value));
+
+
+
+ super.startElement(uri, "value", prefix + ":" + "value", NOATTR);
+
+ if (value != null) {
+
+ String v = String.valueOf(value);
+
+ super.characters(v.toCharArray(),0,v.length());
+
+ }
+
+ super.endElement(uri, "value", prefix + ":" + "value");
+
+
+
+ if (instance.getPreceptor() != null) {
+
+ Collection constraints =
instance.getPreceptor().getConstraintsFor(ref);
+
+ if (constraints != null) {
+
+ for (Iterator it = constraints.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ constraint.toSAX(this);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ catch (InvalidXPathSyntaxException e) {
+
+ throw new SAXException(e);
+
+ }
+
+ catch (NoSuchNodeException e) {
+
+ //throw new SAXException(e);
+
+ }
+
+ }
+
+ else {
+
+ throw new SAXException("[" + String.valueOf(name) + "] needs an
\"" + TAG_COMMON_ATTR_REF + "\" attribute");
+
+ }
+
+ }
+
+ else if (TAG_SELECTMANY.equals(name)) {
+
+ //NYI
+
+ throw new SAXException("NYI");
+
+ }
+
+ else if (TAG_BUTTON.equals(name)) {
+
+ //NYI
+
+ super.startElement(uri, name, raw, attributes);
+
+ }
+
+ else {
+
+ getLogger().error("unknown element [" + String.valueOf(name) + "]");
+
+ super.startElement(uri, name, raw, attributes);
+
+ }
+
+ }
+
+ else {
+
+ super.startElement(uri, name, raw, attributes);
+
+ }
+
+ }
+
+
+
+
+
+ public void endElement(String uri, String name, String raw) throws
SAXException {
+
+ if (NS.equals(uri)) {
+
+ if (TAG_INSERTINSTANCE.equals(name)) {
+
+ }
+
+ else if (TAG_INSERTVIOLATIONS.equals(name)) {
+
+ }
+
+ else if (TAG_INSTANCE.equals(name)) {
+
+ }
+
+ else if (TAG_OUTPUT.equals(name) ||
+
+ TAG_TEXTBOX.equals(name) ||
+
+ TAG_PASSWORD.equals(name) ||
+
+ TAG_SELECTBOOLEAN.equals(name) ||
+
+ TAG_SELECTONE.equals(name) ) {
+
+ super.endElement(uri, name, raw);
+
+ }
+
+ else if (TAG_SELECTMANY.equals(name)) {
+
+ }
+
+ else if (TAG_BUTTON.equals(name)) {
+
+ super.endElement(uri, name, raw);
+
+ }
+
+ else {
+
+ getLogger().error("unknown element [" + String.valueOf(name) + "]");
+
+ super.endElement(uri, name, raw);
+
+ }
+
+ }
+
+ else {
+
+ super.endElement(uri, name, raw);
+
+ }
+
+ }
+
+
+
+ public void characters(char[] chars, int start, int len) throws
SAXException {
+
+ super.characters(chars, start, len);
+
+ }
+
+
+
+ public long generateKey() {
+
+ return (1);
+
+ }
+
+
+
+ public CacheValidity generateValidity() {
+
+ return (new NOPCacheValidity());
+
+ }
+
}
1.3 +136 -68
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InvalidXPathSyntaxException.java
Index: InvalidXPathSyntaxException.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/InvalidXPathSyntaxException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InvalidXPathSyntaxException.java 25 Mar 2002 23:23:54 -0000 1.2
+++ InvalidXPathSyntaxException.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,68 +1,136 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import org.apache.avalon.framework.CascadingException;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class InvalidXPathSyntaxException extends CascadingException {
- public InvalidXPathSyntaxException(String s) {
- super(s);
- }
-
- public InvalidXPathSyntaxException(Throwable t) {
- super("",t);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.avalon.framework.CascadingException;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class InvalidXPathSyntaxException extends CascadingException {
+
+ public InvalidXPathSyntaxException(String s) {
+
+ super(s);
+
+ }
+
+
+
+ public InvalidXPathSyntaxException(Throwable t) {
+
+ super("",t);
+
+ }
+
+}
+
1.3 +136 -68
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/NoSuchNodeException.java
Index: NoSuchNodeException.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/NoSuchNodeException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NoSuchNodeException.java 25 Mar 2002 23:23:54 -0000 1.2
+++ NoSuchNodeException.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,68 +1,136 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import org.apache.avalon.framework.CascadingException;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class NoSuchNodeException extends CascadingException {
- public NoSuchNodeException(String s) {
- super(s);
- }
-
- public NoSuchNodeException(Throwable t) {
- super("",t);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.avalon.framework.CascadingException;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class NoSuchNodeException extends CascadingException {
+
+ public NoSuchNodeException(String s) {
+
+ super(s);
+
+ }
+
+
+
+ public NoSuchNodeException(Throwable t) {
+
+ super("",t);
+
+ }
+
+}
+
1.4 +126 -63
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Preceptor.java
Index: Preceptor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/Preceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Preceptor.java 4 Apr 2002 07:02:09 -0000 1.3
+++ Preceptor.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,75 +1,138 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept;
import org.apache.avalon.framework.component.Component;
-import java.util.Collection;
+import java.util.Collection;
+
import java.net.URL;
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public interface Preceptor extends Component {
public String ROLE = "org.apache.cocoon.precept.Preceptor";
-
+
+
public Collection getConstraintsFor( String xpath ) throws
InvalidXPathSyntaxException, NoSuchNodeException;
-
+
+
public boolean isValidNode( String xpath ) throws
InvalidXPathSyntaxException;
-
+
+
public void buildInstance( Instance instance );
-
- public Collection validate(Instance instance, String xpath, Context
context) throws InvalidXPathSyntaxException, NoSuchNodeException;
- public Collection validate(Instance instance, Context context) throws
InvalidXPathSyntaxException;
-
+
+
+ public Collection validate(Instance instance, String xpath, Context
context) throws InvalidXPathSyntaxException, NoSuchNodeException;
+
+ public Collection validate(Instance instance, Context context) throws
InvalidXPathSyntaxException;
+
+
+
}
1.3 +136 -68
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/PreceptorViolationException.java
Index: PreceptorViolationException.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/PreceptorViolationException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PreceptorViolationException.java 25 Mar 2002 23:23:54 -0000 1.2
+++ PreceptorViolationException.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,68 +1,136 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept;
-
-import org.apache.avalon.framework.CascadingException;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class PreceptorViolationException extends CascadingException {
- public PreceptorViolationException(String s) {
- super(s);
- }
-
- public PreceptorViolationException(Throwable t) {
- super("",t);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept;
+
+
+
+import org.apache.avalon.framework.CascadingException;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class PreceptorViolationException extends CascadingException {
+
+ public PreceptorViolationException(String s) {
+
+ super(s);
+
+ }
+
+
+
+ public PreceptorViolationException(Throwable t) {
+
+ super("",t);
+
+ }
+
+}
+
1.3 +272 -136
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/AbstractMethodAction.java
Index: AbstractMethodAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/AbstractMethodAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractMethodAction.java 25 Mar 2002 23:23:54 -0000 1.2
+++ AbstractMethodAction.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,136 +1,272 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.acting;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.acting.ConfigurableComposerAction;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.lang.reflect.Method;
-
-
-/*
- * @version: Feb 25, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public abstract class AbstractMethodAction extends
ConfigurableComposerAction {
-
- private static final String ACTION_METHOD_PREFIX = "do";
- private static final String ACTION_METHOD_PARAMETER = "method";
-
- private HashMap methodIndex = null;
-
- public void configure(Configuration conf) throws ConfigurationException {
- super.configure(conf);
-
- if (methodIndex == null) {
- try {
- Method[] methods = this.getClass().getMethods();
- methodIndex = new HashMap();
-
- int prefixLen = ACTION_METHOD_PREFIX.length();
- for (int i = 0; i < methods.length; i++) {
- String methodName = methods[i].getName();
- if (methodName.startsWith(ACTION_METHOD_PREFIX)) {
- String actionName = methodName.substring(prefixLen, prefixLen +
1).toLowerCase() +
- methodName.substring(prefixLen + 1);
- methodIndex.put(actionName, methods[i]);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("registered method \"" + methodName + "\"
as action \"" + actionName + "\"");
- }
- }
- }
- }
- catch (Exception e) {
- throw new ConfigurationException("cannot get methods by
reflection", e);
- }
- }
- }
-
- public Map introspection( Redirector redirector, SourceResolver resolver,
Map objectModel, String source, Parameters parameters) throws Exception {
- return(EMPTY_MAP);
- }
-
- public Map act( Redirector redirector, SourceResolver resolver, Map
objectModel, String source, Parameters parameters) throws Exception {
- String actionMethod =
parameters.getParameter(ACTION_METHOD_PARAMETER,null);
- if (actionMethod != null) {
- Method method = (Method) methodIndex.get(actionMethod);
- if (method != null) {
- getLogger().debug("calling method ["+ String.valueOf(actionMethod) +
"]");
- return((Map) method.invoke(this, new Object[]{
redirector,resolver,objectModel,source,parameters }));
- }
- else {
- throw new Exception("action has no method \"" + actionMethod + "\"");
- }
- }
- else {
- Request request = ObjectModelHelper.getRequest(objectModel);
- if (request != null && "GET".equalsIgnoreCase(request.getMethod())) {
- // just the first view of the page
- // call introspection
- getLogger().debug("calling introspection");
-
return(introspection(redirector,resolver,objectModel,source,parameters ));
- }
- else {
- getLogger().debug("already in flow - no introspection");
- return(EMPTY_MAP);
- }
- }
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.acting;
+
+
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.avalon.framework.parameters.Parameters;
+
+import org.apache.cocoon.environment.Redirector;
+
+import org.apache.cocoon.environment.SourceResolver;
+
+import org.apache.cocoon.environment.Request;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+
+import org.apache.cocoon.acting.ConfigurableComposerAction;
+
+
+
+import java.util.HashMap;
+
+import java.util.Map;
+
+import java.lang.reflect.Method;
+
+
+
+
+
+/*
+
+ * @version: Feb 25, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public abstract class AbstractMethodAction extends
ConfigurableComposerAction {
+
+
+
+ private static final String ACTION_METHOD_PREFIX = "do";
+
+ private static final String ACTION_METHOD_PARAMETER = "method";
+
+
+
+ private HashMap methodIndex = null;
+
+
+
+ public void configure(Configuration conf) throws ConfigurationException {
+
+ super.configure(conf);
+
+
+
+ if (methodIndex == null) {
+
+ try {
+
+ Method[] methods = this.getClass().getMethods();
+
+ methodIndex = new HashMap();
+
+
+
+ int prefixLen = ACTION_METHOD_PREFIX.length();
+
+ for (int i = 0; i < methods.length; i++) {
+
+ String methodName = methods[i].getName();
+
+ if (methodName.startsWith(ACTION_METHOD_PREFIX)) {
+
+ String actionName = methodName.substring(prefixLen, prefixLen +
1).toLowerCase() +
+
+ methodName.substring(prefixLen + 1);
+
+ methodIndex.put(actionName, methods[i]);
+
+ if (getLogger().isDebugEnabled()) {
+
+ getLogger().debug("registered method \"" + methodName + "\"
as action \"" + actionName + "\"");
+
+ }
+
+ }
+
+ }
+
+ }
+
+ catch (Exception e) {
+
+ throw new ConfigurationException("cannot get methods by
reflection", e);
+
+ }
+
+ }
+
+ }
+
+
+
+ public Map introspection( Redirector redirector, SourceResolver resolver,
Map objectModel, String source, Parameters parameters) throws Exception {
+
+ return(EMPTY_MAP);
+
+ }
+
+
+
+ public Map act( Redirector redirector, SourceResolver resolver, Map
objectModel, String source, Parameters parameters) throws Exception {
+
+ String actionMethod =
parameters.getParameter(ACTION_METHOD_PARAMETER,null);
+
+ if (actionMethod != null) {
+
+ Method method = (Method) methodIndex.get(actionMethod);
+
+ if (method != null) {
+
+ getLogger().debug("calling method ["+ String.valueOf(actionMethod) +
"]");
+
+ return((Map) method.invoke(this, new Object[]{
redirector,resolver,objectModel,source,parameters }));
+
+ }
+
+ else {
+
+ throw new Exception("action has no method \"" + actionMethod + "\"");
+
+ }
+
+ }
+
+ else {
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+
+ if (request != null && "GET".equalsIgnoreCase(request.getMethod())) {
+
+ // just the first view of the page
+
+ // call introspection
+
+ getLogger().debug("calling introspection");
+
+
return(introspection(redirector,resolver,objectModel,source,parameters ));
+
+ }
+
+ else {
+
+ getLogger().debug("already in flow - no introspection");
+
+ return(EMPTY_MAP);
+
+ }
+
+ }
+
+ }
+
+}
+
1.4 +316 -158
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/AbstractPreceptorAction.java
Index: AbstractPreceptorAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/AbstractPreceptorAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractPreceptorAction.java 4 Apr 2002 07:02:09 -0000 1.3
+++ AbstractPreceptorAction.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,158 +1,316 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.acting;
-
-import org.apache.cocoon.environment.*;
-import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-
-import java.util.*;
-
-import org.apache.cocoon.precept.*;
-import org.apache.cocoon.precept.acting.AbstractMethodAction;
-
-/*
- * @version: Feb 25, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public abstract class AbstractPreceptorAction extends AbstractMethodAction
implements ThreadSafe {
-
- public final static String PRECEPTORVIOLATIONS = "preceptorViolations";
-
- final protected Session createSession( Map objectModel ) {
- Request request = ObjectModelHelper.getRequest(objectModel);
- return(request.getSession(true));
- }
-
- final protected Instance getInstance( Map objectModel, String instanceId )
{
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(false);
- return((Instance)session.getAttribute(instanceId));
- }
-
- final protected Instance createInstance(String id) throws
ComponentException {
- InstanceFactory factory = (InstanceFactory)
manager.lookup(InstanceFactory.ROLE);
- Instance instance = factory.createInstance(id);
- manager.release(factory);
- return(instance);
- }
-
- final protected void populate(Map objectModel, String instanceId, String
xpath) throws PreceptorViolationException, InvalidXPathSyntaxException {
- Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = request.getSession(false);
- if (session != null) {
- Instance instance = (Instance)session.getAttribute(instanceId);
- if (instance != null) {
- String value = request.getParameter(xpath);
- //String[] values = request.getParameterValues(xpath);
-
- if (value == null) value = "false";
-
- getLogger().debug("populating into " + String.valueOf(xpath) + " = "
+ String.valueOf(value));
- instance.setValue(xpath,value);
- }
- }
- }
-
- final protected void populate(Map objectModel, String instanceId, String[]
xpaths) throws PreceptorViolationException, InvalidXPathSyntaxException {
- for(int i=0; i < xpaths.length; i++) {
- populate(objectModel,instanceId,xpaths[i]);
- }
- }
-
- final protected Collection validate(Map objectModel, String instanceId)
throws InvalidXPathSyntaxException, NoSuchNodeException {
- Instance instance = getInstance(objectModel,instanceId);
- Preceptor preceptor = instance.getPreceptor();
- Collection violations = preceptor.validate(instance,null);
- return(violations);
- }
-
- final protected Collection validate(Map objectModel, String instanceId,
String xpath) throws InvalidXPathSyntaxException, NoSuchNodeException {
- Instance instance = getInstance(objectModel,instanceId);
- Preceptor preceptor = instance.getPreceptor();
- Collection violations = preceptor.validate(instance,xpath,null);
- return(violations);
- }
-
- final protected void pass(Map objectModel, Collection violations) {
- if (violations != null) {
- Request request = ObjectModelHelper.getRequest(objectModel);
- List currentViolations = (List)
request.getAttribute(PRECEPTORVIOLATIONS);
- if (currentViolations == null) {
- request.setAttribute(PRECEPTORVIOLATIONS, violations);
- }
- else {
- }
- }
- }
-
- final protected Collection validate(Map objectModel, String instanceId,
String[] xpaths) throws InvalidXPathSyntaxException, NoSuchNodeException {
- Instance instance = getInstance(objectModel,instanceId);
- Preceptor preceptor = instance.getPreceptor();
- ArrayList allErrors = null;
- for(int i=0; i < xpaths.length; i++) {
- Collection errors = preceptor.validate(instance,xpaths[i],null);
- if (errors != null) {
- if (allErrors == null) allErrors = new ArrayList(1);
- allErrors.addAll(errors);
- }
- }
- return(allErrors);
- }
-
- final protected Map page( String id ) {
- Map m = new HashMap(1);
- m.put("page",id);
- return(m);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.acting;
+
+
+
+import org.apache.cocoon.environment.*;
+
+import org.apache.avalon.framework.parameters.Parameters;
+
+import org.apache.avalon.framework.component.ComponentException;
+
+import org.apache.avalon.framework.thread.ThreadSafe;
+
+
+
+import java.util.*;
+
+
+
+import org.apache.cocoon.precept.*;
+
+import org.apache.cocoon.precept.acting.AbstractMethodAction;
+
+
+
+/*
+
+ * @version: Feb 25, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public abstract class AbstractPreceptorAction extends AbstractMethodAction
implements ThreadSafe {
+
+
+
+ public final static String PRECEPTORVIOLATIONS = "preceptorViolations";
+
+
+
+ final protected Session createSession( Map objectModel ) {
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+
+ return(request.getSession(true));
+
+ }
+
+
+
+ final protected Instance getInstance( Map objectModel, String instanceId )
{
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+
+ Session session = request.getSession(false);
+
+ return((Instance)session.getAttribute(instanceId));
+
+ }
+
+
+
+ final protected Instance createInstance(String id) throws
ComponentException {
+
+ InstanceFactory factory = (InstanceFactory)
manager.lookup(InstanceFactory.ROLE);
+
+ Instance instance = factory.createInstance(id);
+
+ manager.release(factory);
+
+ return(instance);
+
+ }
+
+
+
+ final protected void populate(Map objectModel, String instanceId, String
xpath) throws PreceptorViolationException, InvalidXPathSyntaxException {
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+
+ Session session = request.getSession(false);
+
+ if (session != null) {
+
+ Instance instance = (Instance)session.getAttribute(instanceId);
+
+ if (instance != null) {
+
+ String value = request.getParameter(xpath);
+
+ //String[] values = request.getParameterValues(xpath);
+
+
+
+ if (value == null) value = "false";
+
+
+
+ getLogger().debug("populating into " + String.valueOf(xpath) + " = "
+ String.valueOf(value));
+
+ instance.setValue(xpath,value);
+
+ }
+
+ }
+
+ }
+
+
+
+ final protected void populate(Map objectModel, String instanceId, String[]
xpaths) throws PreceptorViolationException, InvalidXPathSyntaxException {
+
+ for(int i=0; i < xpaths.length; i++) {
+
+ populate(objectModel,instanceId,xpaths[i]);
+
+ }
+
+ }
+
+
+
+ final protected Collection validate(Map objectModel, String instanceId)
throws InvalidXPathSyntaxException, NoSuchNodeException {
+
+ Instance instance = getInstance(objectModel,instanceId);
+
+ Preceptor preceptor = instance.getPreceptor();
+
+ Collection violations = preceptor.validate(instance,null);
+
+ return(violations);
+
+ }
+
+
+
+ final protected Collection validate(Map objectModel, String instanceId,
String xpath) throws InvalidXPathSyntaxException, NoSuchNodeException {
+
+ Instance instance = getInstance(objectModel,instanceId);
+
+ Preceptor preceptor = instance.getPreceptor();
+
+ Collection violations = preceptor.validate(instance,xpath,null);
+
+ return(violations);
+
+ }
+
+
+
+ final protected void pass(Map objectModel, Collection violations) {
+
+ if (violations != null) {
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+
+ List currentViolations = (List)
request.getAttribute(PRECEPTORVIOLATIONS);
+
+ if (currentViolations == null) {
+
+ request.setAttribute(PRECEPTORVIOLATIONS, violations);
+
+ }
+
+ else {
+
+ }
+
+ }
+
+ }
+
+
+
+ final protected Collection validate(Map objectModel, String instanceId,
String[] xpaths) throws InvalidXPathSyntaxException, NoSuchNodeException {
+
+ Instance instance = getInstance(objectModel,instanceId);
+
+ Preceptor preceptor = instance.getPreceptor();
+
+ ArrayList allErrors = null;
+
+ for(int i=0; i < xpaths.length; i++) {
+
+ Collection errors = preceptor.validate(instance,xpaths[i],null);
+
+ if (errors != null) {
+
+ if (allErrors == null) allErrors = new ArrayList(1);
+
+ allErrors.addAll(errors);
+
+ }
+
+ }
+
+ return(allErrors);
+
+ }
+
+
+
+ final protected Map page( String id ) {
+
+ Map m = new HashMap(1);
+
+ m.put("page",id);
+
+ return(m);
+
+ }
+
+}
+
1.4 +376 -188
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/PreceptorDemoAction.java
Index: PreceptorDemoAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/acting/PreceptorDemoAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PreceptorDemoAction.java 4 Apr 2002 07:02:09 -0000 1.3
+++ PreceptorDemoAction.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,188 +1,376 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-/*
- * @version: Feb 25, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-package org.apache.cocoon.precept.acting;
-
-import org.apache.cocoon.environment.*;
-import org.apache.avalon.framework.parameters.Parameters;
-
-import java.util.*;
-
-import org.apache.cocoon.precept.Instance;
-import org.apache.cocoon.precept.acting.AbstractPreceptorAction;
-
-/*
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class PreceptorDemoAction extends AbstractPreceptorAction {
-
- private final static String VIEW1 = "view1";
- private final static String VIEW2 = "view2";
- private final static String VIEW3 = "view3";
- private final static String VIEW4 = "view4";
- private final static String VIEW_THANKS = "thanks";
- private final static String VIEW_ERROR = "error";
-
- private final static String[] SET_PERSON = {
- "cocoon-installation/user/firstname",
- "cocoon-installation/user/lastname",
- "cocoon-installation/user/email",
- "cocoon-installation/user/age"
- };
-
- private final static String[] SET_INSTALLATION = {
- "cocoon-installation/number",
- "cocoon-installation/live-url",
- "cocoon-installation/publish"
- };
-
- private final static String[] SET_SYSTEM = {
- "cocoon-installation/system/os",
- "cocoon-installation/system/processor",
- "cocoon-installation/system/ram",
- "cocoon-installation/system/servlet-engine",
- "cocoon-installation/system/java-version"
- };
-
-
- public Map introspection(Redirector redirector, SourceResolver resolver,
Map objectModel, String src, Parameters par) throws Exception {
- getLogger().debug("start of flow");
-
- Session session = createSession(objectModel);
- Instance instance = createInstance("feedback");
-
- session.setAttribute("form-feedback",instance);
- return(page(VIEW1));
- }
-
- public Map doPrev1(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- populate(objectModel, "form-feedback", SET_INSTALLATION );
- return (page(VIEW1));
- }
- public Map doPrev2(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- populate(objectModel, "form-feedback", SET_SYSTEM );
- return (page(VIEW2));
- }
- public Map doPrev3(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- return (page(VIEW3));
- }
-
- public Map doNext2(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- getLogger().debug("populating");
- populate(objectModel, "form-feedback", SET_PERSON );
-
- Collection errors = validate(objectModel, "form-feedback", SET_PERSON );
- if(errors != null) {
- getLogger().debug("some constraints FAILED");
- pass(objectModel,errors);
- return (page(VIEW1));
- }
- else {
- getLogger().debug("all constraints are ok");
- return (page(VIEW2));
- }
- }
-
- public Map doNext3(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- getLogger().debug("populating");
- populate(objectModel, "form-feedback", SET_INSTALLATION );
-
- Collection errors = validate(objectModel, "form-feedback",
SET_INSTALLATION );
- if(errors != null) {
- getLogger().debug("some constraints FAILED");
- pass(objectModel,errors);
- return (page(VIEW2));
- }
- else {
- getLogger().debug("all constraints are ok");
- return (page(VIEW3));
- }
- }
-
- public Map doNext4(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- getLogger().debug("populating");
- populate(objectModel, "form-feedback", SET_SYSTEM );
-
- Collection errors = validate(objectModel, "form-feedback", SET_SYSTEM );
- if(errors != null) {
- getLogger().debug("some constraints FAILED");
- pass(objectModel,errors);
- return (page(VIEW3));
- }
- else {
- getLogger().debug("all constraints are ok");
- return (page(VIEW4));
- }
- }
-
- public Map doSubmit(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
- getLogger().debug("submitting");
- Collection errors = validate(objectModel, "form-feedback");
- if (errors != null) {
- getLogger().debug("some constraints FAILED");
- pass(objectModel,errors);
- return (page(VIEW_ERROR));
- }
- else {
- getLogger().debug("instance is valid - submitting");
-
- /*
- * do whatever you want with the instance data
- */
-
- return (page(VIEW_THANKS));
- }
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+/*
+
+ * @version: Feb 25, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+package org.apache.cocoon.precept.acting;
+
+
+
+import org.apache.cocoon.environment.*;
+
+import org.apache.avalon.framework.parameters.Parameters;
+
+
+
+import java.util.*;
+
+
+
+import org.apache.cocoon.precept.Instance;
+
+import org.apache.cocoon.precept.acting.AbstractPreceptorAction;
+
+
+
+/*
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class PreceptorDemoAction extends AbstractPreceptorAction {
+
+
+
+ private final static String VIEW1 = "view1";
+
+ private final static String VIEW2 = "view2";
+
+ private final static String VIEW3 = "view3";
+
+ private final static String VIEW4 = "view4";
+
+ private final static String VIEW_THANKS = "thanks";
+
+ private final static String VIEW_ERROR = "error";
+
+
+
+ private final static String[] SET_PERSON = {
+
+ "cocoon-installation/user/firstname",
+
+ "cocoon-installation/user/lastname",
+
+ "cocoon-installation/user/email",
+
+ "cocoon-installation/user/age"
+
+ };
+
+
+
+ private final static String[] SET_INSTALLATION = {
+
+ "cocoon-installation/number",
+
+ "cocoon-installation/live-url",
+
+ "cocoon-installation/publish"
+
+ };
+
+
+
+ private final static String[] SET_SYSTEM = {
+
+ "cocoon-installation/system/os",
+
+ "cocoon-installation/system/processor",
+
+ "cocoon-installation/system/ram",
+
+ "cocoon-installation/system/servlet-engine",
+
+ "cocoon-installation/system/java-version"
+
+ };
+
+
+
+
+
+ public Map introspection(Redirector redirector, SourceResolver resolver,
Map objectModel, String src, Parameters par) throws Exception {
+
+ getLogger().debug("start of flow");
+
+
+
+ Session session = createSession(objectModel);
+
+ Instance instance = createInstance("feedback");
+
+
+
+ session.setAttribute("form-feedback",instance);
+
+ return(page(VIEW1));
+
+ }
+
+
+
+ public Map doPrev1(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ populate(objectModel, "form-feedback", SET_INSTALLATION );
+
+ return (page(VIEW1));
+
+ }
+
+ public Map doPrev2(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ populate(objectModel, "form-feedback", SET_SYSTEM );
+
+ return (page(VIEW2));
+
+ }
+
+ public Map doPrev3(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ return (page(VIEW3));
+
+ }
+
+
+
+ public Map doNext2(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ getLogger().debug("populating");
+
+ populate(objectModel, "form-feedback", SET_PERSON );
+
+
+
+ Collection errors = validate(objectModel, "form-feedback", SET_PERSON );
+
+ if(errors != null) {
+
+ getLogger().debug("some constraints FAILED");
+
+ pass(objectModel,errors);
+
+ return (page(VIEW1));
+
+ }
+
+ else {
+
+ getLogger().debug("all constraints are ok");
+
+ return (page(VIEW2));
+
+ }
+
+ }
+
+
+
+ public Map doNext3(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ getLogger().debug("populating");
+
+ populate(objectModel, "form-feedback", SET_INSTALLATION );
+
+
+
+ Collection errors = validate(objectModel, "form-feedback",
SET_INSTALLATION );
+
+ if(errors != null) {
+
+ getLogger().debug("some constraints FAILED");
+
+ pass(objectModel,errors);
+
+ return (page(VIEW2));
+
+ }
+
+ else {
+
+ getLogger().debug("all constraints are ok");
+
+ return (page(VIEW3));
+
+ }
+
+ }
+
+
+
+ public Map doNext4(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ getLogger().debug("populating");
+
+ populate(objectModel, "form-feedback", SET_SYSTEM );
+
+
+
+ Collection errors = validate(objectModel, "form-feedback", SET_SYSTEM );
+
+ if(errors != null) {
+
+ getLogger().debug("some constraints FAILED");
+
+ pass(objectModel,errors);
+
+ return (page(VIEW3));
+
+ }
+
+ else {
+
+ getLogger().debug("all constraints are ok");
+
+ return (page(VIEW4));
+
+ }
+
+ }
+
+
+
+ public Map doSubmit(Redirector redirector, SourceResolver resolver, Map
objectModel, String src, Parameters par) throws Exception {
+
+ getLogger().debug("submitting");
+
+ Collection errors = validate(objectModel, "form-feedback");
+
+ if (errors != null) {
+
+ getLogger().debug("some constraints FAILED");
+
+ pass(objectModel,errors);
+
+ return (page(VIEW_ERROR));
+
+ }
+
+ else {
+
+ getLogger().debug("instance is valid - submitting");
+
+
+
+ /*
+
+ * do whatever you want with the instance data
+
+ */
+
+
+
+ return (page(VIEW_THANKS));
+
+ }
+
+ }
+
+}
+
1.4 +116 -58
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/AbstractPreceptor.java
Index: AbstractPreceptor.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/AbstractPreceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractPreceptor.java 26 Mar 2002 19:56:44 -0000 1.3
+++ AbstractPreceptor.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,70 +1,128 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept.preceptors;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.logger.AbstractLoggable;
-import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.logger.AbstractLoggable;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
import org.apache.cocoon.precept.Preceptor;
-/*
- * @version: Mar 18, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
+/*
+
+ * @version: Mar 18, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
*/
public abstract class AbstractPreceptor extends AbstractLoggable implements
Preceptor, Composable {
- protected ComponentManager manager;
-
+ protected ComponentManager manager;
+
+
+
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
1.3 +110 -55
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/PreceptorBuilder.java
Index: PreceptorBuilder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/PreceptorBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PreceptorBuilder.java 25 Mar 2002 23:23:54 -0000 1.2
+++ PreceptorBuilder.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,54 +1,105 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept.preceptors;
import org.apache.avalon.framework.component.Component;
@@ -56,10 +107,14 @@
import java.net.URL;
-/*
- * @version: Mar 20, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @version: Mar 20, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public interface PreceptorBuilder extends Component {
public String ROLE = "org.apache.cocoon.precept.PreceptorBuilder";
1.3 +230 -115
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/AbstractPreceptorNode.java
Index: AbstractPreceptorNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/AbstractPreceptorNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractPreceptorNode.java 25 Mar 2002 23:23:54 -0000 1.2
+++ AbstractPreceptorNode.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,115 +1,230 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax;
-
-import org.apache.cocoon.precept.Preceptor;
-import org.apache.cocoon.precept.Constraint;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/*
- * @version: Feb 22, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public abstract class AbstractPreceptorNode {
- protected String name;
- protected List constraints;
- protected ElementPreceptorNode parent;
- protected Preceptor preceptor;
-
-
- public String getName() {
- return(this.name);
- }
-
- public ElementPreceptorNode getParent() {
- return(this.parent);
- }
-
- public List validate(Object value) {
- if (constraints != null) {
- for (Iterator it = constraints.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- }
- return(null);
- }
- else {
- return(null);
- }
- }
-
- public List getConstraints() {
- return(constraints);
- }
-
- public AbstractPreceptorNode addConstraints(List constraints) {
- if (constraints != null) {
- if (this.constraints == null) {
- this.constraints = new ArrayList(constraints.size());
- }
- this.constraints.addAll(constraints);
- }
- return(this);
- }
-
- public AbstractPreceptorNode addConstraint(Constraint constraint) {
- if (constraint != null) {
- if (this.constraints == null){
- this.constraints = new ArrayList(1);
- }
- this.constraints.add(constraint);
- }
- return(this);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax;
+
+
+
+import org.apache.cocoon.precept.Preceptor;
+
+import org.apache.cocoon.precept.Constraint;
+
+
+
+import java.util.List;
+
+import java.util.ArrayList;
+
+import java.util.Iterator;
+
+
+
+/*
+
+ * @version: Feb 22, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public abstract class AbstractPreceptorNode {
+
+ protected String name;
+
+ protected List constraints;
+
+ protected ElementPreceptorNode parent;
+
+ protected Preceptor preceptor;
+
+
+
+
+
+ public String getName() {
+
+ return(this.name);
+
+ }
+
+
+
+ public ElementPreceptorNode getParent() {
+
+ return(this.parent);
+
+ }
+
+
+
+ public List validate(Object value) {
+
+ if (constraints != null) {
+
+ for (Iterator it = constraints.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ }
+
+ return(null);
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public List getConstraints() {
+
+ return(constraints);
+
+ }
+
+
+
+ public AbstractPreceptorNode addConstraints(List constraints) {
+
+ if (constraints != null) {
+
+ if (this.constraints == null) {
+
+ this.constraints = new ArrayList(constraints.size());
+
+ }
+
+ this.constraints.addAll(constraints);
+
+ }
+
+ return(this);
+
+ }
+
+
+
+ public AbstractPreceptorNode addConstraint(Constraint constraint) {
+
+ if (constraint != null) {
+
+ if (this.constraints == null){
+
+ this.constraints = new ArrayList(1);
+
+ }
+
+ this.constraints.add(constraint);
+
+ }
+
+ return(this);
+
+ }
+
+}
+
1.3 +216 -108
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/AttributePreceptorNode.java
Index: AttributePreceptorNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/AttributePreceptorNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AttributePreceptorNode.java 25 Mar 2002 23:23:54 -0000 1.2
+++ AttributePreceptorNode.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,108 +1,216 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax;
-
-import org.apache.cocoon.precept.Preceptor;
-import org.apache.cocoon.precept.Constraint;
-
-import java.util.List;
-import java.util.Iterator;
-
-/*
- * @version: Feb 22, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class AttributePreceptorNode extends AbstractPreceptorNode {
- private boolean required;
- //private StringBuffer valueObject;
-
- public AttributePreceptorNode( Preceptor preceptor, ElementPreceptorNode
parent, String name, boolean required ) {
- this.name = name;
- this.required = required;
- this.parent = parent;
- this.preceptor = preceptor;
- }
-
- public boolean isRequired() {
- return(required);
- }
-
- public void toStringBuffer( StringBuffer sb, int depth) {
- sb.append(" ").append(name).append("=");
-
- if (constraints != null) {
- for (Iterator it = constraints.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- sb.append("{").append(constraint.getType()).append("}");
- }
- }
-
- sb.append("[").append( (required)?"required":"optional" ).append("]");
- }
-
-/*
- public StringBuffer setValue( String value ) {
- if (valueObject == null){
- valueObject = new StringBuffer(value);
- }
- else {
- valueObject.setLength(0);
- valueObject.append(value);
- }
- return(valueObject);
- }
-
- public StringBuffer getValue() {
- return(valueObject);
- }
- */
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax;
+
+
+
+import org.apache.cocoon.precept.Preceptor;
+
+import org.apache.cocoon.precept.Constraint;
+
+
+
+import java.util.List;
+
+import java.util.Iterator;
+
+
+
+/*
+
+ * @version: Feb 22, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class AttributePreceptorNode extends AbstractPreceptorNode {
+
+ private boolean required;
+
+ //private StringBuffer valueObject;
+
+
+
+ public AttributePreceptorNode( Preceptor preceptor, ElementPreceptorNode
parent, String name, boolean required ) {
+
+ this.name = name;
+
+ this.required = required;
+
+ this.parent = parent;
+
+ this.preceptor = preceptor;
+
+ }
+
+
+
+ public boolean isRequired() {
+
+ return(required);
+
+ }
+
+
+
+ public void toStringBuffer( StringBuffer sb, int depth) {
+
+ sb.append(" ").append(name).append("=");
+
+
+
+ if (constraints != null) {
+
+ for (Iterator it = constraints.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ sb.append("{").append(constraint.getType()).append("}");
+
+ }
+
+ }
+
+
+
+ sb.append("[").append( (required)?"required":"optional" ).append("]");
+
+ }
+
+
+
+/*
+
+ public StringBuffer setValue( String value ) {
+
+ if (valueObject == null){
+
+ valueObject = new StringBuffer(value);
+
+ }
+
+ else {
+
+ valueObject.setLength(0);
+
+ valueObject.append(value);
+
+ }
+
+ return(valueObject);
+
+ }
+
+
+
+ public StringBuffer getValue() {
+
+ return(valueObject);
+
+ }
+
+ */
+
+}
+
1.3 +144 -72
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/ConstraintFactory.java
Index: ConstraintFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/ConstraintFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConstraintFactory.java 25 Mar 2002 23:23:54 -0000 1.2
+++ ConstraintFactory.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,72 +1,144 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax;
-
-import org.apache.cocoon.precept.Constraint;
-import
org.apache.cocoon.precept.preceptors.easyrelax.constraints.ChoiceConstraint;
-import
org.apache.cocoon.precept.preceptors.easyrelax.constraints.RegexprConstraint;
-import org.apache.avalon.framework.configuration.Configuration;
-
-/*
- * @version: Mar 21, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class ConstraintFactory {
- public Constraint createConstraintInstance(String type, String name,
Object context, Configuration conf) {
- if ("choice".equals(type)) {
- return(new ChoiceConstraint());
- }
- else {
- return(new RegexprConstraint());
- }
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax;
+
+
+
+import org.apache.cocoon.precept.Constraint;
+
+import
org.apache.cocoon.precept.preceptors.easyrelax.constraints.ChoiceConstraint;
+
+import
org.apache.cocoon.precept.preceptors.easyrelax.constraints.RegexprConstraint;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+
+
+/*
+
+ * @version: Mar 21, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class ConstraintFactory {
+
+ public Constraint createConstraintInstance(String type, String name,
Object context, Configuration conf) {
+
+ if ("choice".equals(type)) {
+
+ return(new ChoiceConstraint());
+
+ }
+
+ else {
+
+ return(new RegexprConstraint());
+
+ }
+
+ }
+
+}
+
1.3 +448 -224
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/ElementPreceptorNode.java
Index: ElementPreceptorNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/ElementPreceptorNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElementPreceptorNode.java 25 Mar 2002 23:23:54 -0000 1.2
+++ ElementPreceptorNode.java 6 Jun 2002 14:43:41 -0000 1.3
@@ -1,224 +1,448 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax;
-
-
-import org.apache.cocoon.precept.Preceptor;
-import org.apache.cocoon.precept.Constraint;
-
-import java.util.*;
-
-/*
- * @version: Feb 22, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class ElementPreceptorNode extends AbstractPreceptorNode {
- public final static int UNBOUND = -1;
-
- private Map childs;
- private Map attributes;
-// private List values;
- private int minOcc;
- private int maxOcc;
-
- public ElementPreceptorNode( Preceptor preceptor, ElementPreceptorNode
parent, String name, int minOcc, int maxOcc) {
- this.name = name;
- this.minOcc = minOcc;
- this.maxOcc = maxOcc;
- this.parent = parent;
- this.preceptor = preceptor;
-
- }
-
- public AttributePreceptorNode addAttribute( String name, boolean required,
List constraints ) {
- if (attributes == null) attributes = new HashMap();
- AttributePreceptorNode a = new AttributePreceptorNode( preceptor, this,
name, required );
- a.addConstraints(constraints);
- attributes.put(name,a);
- return(a);
- }
-
- public ElementPreceptorNode addElement( String name, int min, int max,
List constraints ) {
- if (childs == null) childs = new HashMap();
- ElementPreceptorNode e = new ElementPreceptorNode( preceptor, this,
name, min, max);
- e.addConstraints(constraints);
- childs.put(name,e);
- return(e);
- }
-
- public ElementPreceptorNode getChild( String name ) {
- if (childs != null) {
- return((ElementPreceptorNode)childs.get(name));
- }
- else {
- return(null);
- }
- }
-
- public Collection getChildElements() {
- if (childs != null) {
- return(childs.values());
- }
- else {
- return(null);
- }
- }
-
- public AttributePreceptorNode getAttribute( String name ) {
- if (attributes != null) {
- return((AttributePreceptorNode)attributes.get(name));
- }
- else {
- return(null);
- }
- }
-
- public Collection getAttributes() {
- if (attributes != null) {
- return(attributes.values());
- }
- else {
- return(null);
- }
- }
-
- public int getMinOcc() {
- return(this.minOcc);
- }
-
- public int getMaxOcc() {
- return(this.maxOcc);
- }
-
-/*
- public StringBuffer setValue(int i, String value) throws
PreceptorViolationException {
- if (values == null) values = new ArrayList(1);
-
- if (i <= values.size()) {
- // already there
- StringBuffer valueObject = (StringBuffer) values.get(i-1);
- valueObject.setLength(0);
- valueObject.append(value);
- return(valueObject);
- }
- else {
- // create a slot
- if (i > maxOcc) {
- // restricted
- throw new PreceptorViolationException( String.valueOf(name) + " is
out of bound");
- }
- else {
- StringBuffer valueObject = new StringBuffer(value);
- values.add(valueObject);
- return(valueObject);
- }
- }
- }
-
- public StringBuffer getValue(int i) {
- if (values != null && i <= values.size()) {
- // is there
- return((StringBuffer)values.get(i-1));
- }
- else {
- return(null);
- }
- }
-
- public int valueCount() {
- if (values != null) {
- return(values.size());
- }
- else {
- return(0);
- }
- }
- */
-
- public void toStringBuffer( StringBuffer sb, ElementPreceptorNode e, int
depth) {
- StringBuffer ident = new StringBuffer();
- for(int i=0;i<depth*3;i++) ident.append(" ");
-
- sb.append("\n").append(ident).append("<").append(e.getName());
-
sb.append("[").append(e.getMinOcc()).append(",").append(e.getMaxOcc()).append("]");
-
- Collection attributes = e.getAttributes();
- if (attributes != null) {
- for (Iterator it = attributes.iterator(); it.hasNext();) {
- AttributePreceptorNode attr = (AttributePreceptorNode) it.next();
- attr.toStringBuffer(sb,depth);
- }
- }
-
- sb.append(">");
-
- if (e.getConstraints() != null) {
- for (Iterator it = e.getConstraints().iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- sb.append("{").append(constraint.getType()).append("}");
- }
- }
- else {
- sb.append("{*}");
- }
-
- Collection childs = e.getChildElements();
- if (childs != null) {
- for (Iterator it = childs.iterator(); it.hasNext();) {
- ElementPreceptorNode child = (ElementPreceptorNode) it.next();
- toStringBuffer(sb, child, depth + 1);
- }
- }
- sb.append("</").append(e.getName()).append(">");
- }
-
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax;
+
+
+
+
+
+import org.apache.cocoon.precept.Preceptor;
+
+import org.apache.cocoon.precept.Constraint;
+
+
+
+import java.util.*;
+
+
+
+/*
+
+ * @version: Feb 22, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class ElementPreceptorNode extends AbstractPreceptorNode {
+
+ public final static int UNBOUND = -1;
+
+
+
+ private Map childs;
+
+ private Map attributes;
+
+// private List values;
+
+ private int minOcc;
+
+ private int maxOcc;
+
+
+
+ public ElementPreceptorNode( Preceptor preceptor, ElementPreceptorNode
parent, String name, int minOcc, int maxOcc) {
+
+ this.name = name;
+
+ this.minOcc = minOcc;
+
+ this.maxOcc = maxOcc;
+
+ this.parent = parent;
+
+ this.preceptor = preceptor;
+
+
+
+ }
+
+
+
+ public AttributePreceptorNode addAttribute( String name, boolean required,
List constraints ) {
+
+ if (attributes == null) attributes = new HashMap();
+
+ AttributePreceptorNode a = new AttributePreceptorNode( preceptor, this,
name, required );
+
+ a.addConstraints(constraints);
+
+ attributes.put(name,a);
+
+ return(a);
+
+ }
+
+
+
+ public ElementPreceptorNode addElement( String name, int min, int max,
List constraints ) {
+
+ if (childs == null) childs = new HashMap();
+
+ ElementPreceptorNode e = new ElementPreceptorNode( preceptor, this,
name, min, max);
+
+ e.addConstraints(constraints);
+
+ childs.put(name,e);
+
+ return(e);
+
+ }
+
+
+
+ public ElementPreceptorNode getChild( String name ) {
+
+ if (childs != null) {
+
+ return((ElementPreceptorNode)childs.get(name));
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public Collection getChildElements() {
+
+ if (childs != null) {
+
+ return(childs.values());
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public AttributePreceptorNode getAttribute( String name ) {
+
+ if (attributes != null) {
+
+ return((AttributePreceptorNode)attributes.get(name));
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public Collection getAttributes() {
+
+ if (attributes != null) {
+
+ return(attributes.values());
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public int getMinOcc() {
+
+ return(this.minOcc);
+
+ }
+
+
+
+ public int getMaxOcc() {
+
+ return(this.maxOcc);
+
+ }
+
+
+
+/*
+
+ public StringBuffer setValue(int i, String value) throws
PreceptorViolationException {
+
+ if (values == null) values = new ArrayList(1);
+
+
+
+ if (i <= values.size()) {
+
+ // already there
+
+ StringBuffer valueObject = (StringBuffer) values.get(i-1);
+
+ valueObject.setLength(0);
+
+ valueObject.append(value);
+
+ return(valueObject);
+
+ }
+
+ else {
+
+ // create a slot
+
+ if (i > maxOcc) {
+
+ // restricted
+
+ throw new PreceptorViolationException( String.valueOf(name) + " is
out of bound");
+
+ }
+
+ else {
+
+ StringBuffer valueObject = new StringBuffer(value);
+
+ values.add(valueObject);
+
+ return(valueObject);
+
+ }
+
+ }
+
+ }
+
+
+
+ public StringBuffer getValue(int i) {
+
+ if (values != null && i <= values.size()) {
+
+ // is there
+
+ return((StringBuffer)values.get(i-1));
+
+ }
+
+ else {
+
+ return(null);
+
+ }
+
+ }
+
+
+
+ public int valueCount() {
+
+ if (values != null) {
+
+ return(values.size());
+
+ }
+
+ else {
+
+ return(0);
+
+ }
+
+ }
+
+ */
+
+
+
+ public void toStringBuffer( StringBuffer sb, ElementPreceptorNode e, int
depth) {
+
+ StringBuffer ident = new StringBuffer();
+
+ for(int i=0;i<depth*3;i++) ident.append(" ");
+
+
+
+ sb.append("\n").append(ident).append("<").append(e.getName());
+
+
sb.append("[").append(e.getMinOcc()).append(",").append(e.getMaxOcc()).append("]");
+
+
+
+ Collection attributes = e.getAttributes();
+
+ if (attributes != null) {
+
+ for (Iterator it = attributes.iterator(); it.hasNext();) {
+
+ AttributePreceptorNode attr = (AttributePreceptorNode) it.next();
+
+ attr.toStringBuffer(sb,depth);
+
+ }
+
+ }
+
+
+
+ sb.append(">");
+
+
+
+ if (e.getConstraints() != null) {
+
+ for (Iterator it = e.getConstraints().iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ sb.append("{").append(constraint.getType()).append("}");
+
+ }
+
+ }
+
+ else {
+
+ sb.append("{*}");
+
+ }
+
+
+
+ Collection childs = e.getChildElements();
+
+ if (childs != null) {
+
+ for (Iterator it = childs.iterator(); it.hasNext();) {
+
+ ElementPreceptorNode child = (ElementPreceptorNode) it.next();
+
+ toStringBuffer(sb, child, depth + 1);
+
+ }
+
+ }
+
+ sb.append("</").append(e.getName()).append(">");
+
+ }
+
+
+
+}
+
1.4 +120 -60
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/PreceptorBuilderImpl.java
Index: PreceptorBuilderImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/PreceptorBuilderImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PreceptorBuilderImpl.java 26 Mar 2002 19:56:44 -0000 1.3
+++ PreceptorBuilderImpl.java 6 Jun 2002 14:43:41 -0000 1.4
@@ -1,54 +1,105 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
package org.apache.cocoon.precept.preceptors.easyrelax;
import org.apache.avalon.excalibur.pool.Poolable;
@@ -77,10 +128,14 @@
import java.util.*;
-/*
- * @version: Feb 23, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @version: Feb 23, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public class PreceptorBuilderImpl extends AbstractXMLConsumer implements
PreceptorBuilder, Composable, Disposable, Poolable {
//public final static String ROLE =
"org.apache.cocoon.precept.PreceptorBuilderImpl";
@@ -145,7 +200,8 @@
parser.parse(source);
}
catch (Exception e) {
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
+
getLogger().error("",e);
}
}
@@ -253,8 +309,10 @@
constraintName = attributes.getValue("name");
constraintContext = attributes.getValue("context");
- configurationHandler = new SAXConfigurationHandler();
-
+ configurationHandler = new SAXConfigurationHandler();
+
+
+
configurationHandler.startElement("", "constraint", "constraint",
new AttributesImpl(attributes));
redirect = configurationHandler;
}
@@ -351,8 +409,10 @@
try {
((Configurable)constraint).configure(configurationHandler.getConfiguration());
}
- catch(Throwable t) {
- getLogger().error("",t);
+ catch(Throwable t) {
+
+ getLogger().error("",t);
+
}
}
1.5 +456 -228
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/PreceptorImpl.java
Index: PreceptorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/PreceptorImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PreceptorImpl.java 4 Apr 2002 14:12:47 -0000 1.4
+++ PreceptorImpl.java 6 Jun 2002 14:43:42 -0000 1.5
@@ -1,228 +1,456 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax;
-
-import org.apache.cocoon.precept.*;
-import org.apache.cocoon.precept.preceptors.AbstractPreceptor;
-
-import java.util.*;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-
-public class PreceptorImpl extends AbstractPreceptor {
- HashMap index = new HashMap();
-
- public Collection validate(Instance instance, String xpath, Context
context) throws InvalidXPathSyntaxException, NoSuchNodeException {
- Collection violations = null;
- Collection constraints = (Collection) getConstraintsFor(xpath);
- if (constraints != null) {
- Object value = instance.getValue(xpath);
- for (Iterator it = constraints.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
- if (!constraint.isSatisfiedBy(value, context)) {
- if (violations == null) {
- violations = new HashSet();
- }
- violations.add(constraint);
- }
- }
- return (violations);
- }
- else {
- return (null);
- }
- }
-
- public Collection validate(Instance instance, Context context) throws
InvalidXPathSyntaxException {
- Collection allViolations = null;
- Collection xpaths = instance.getNodePaths();
- for (Iterator it = xpaths.iterator(); it.hasNext();) {
- String xpath = (String) it.next();
- try {
- Collection violations = validate(instance, xpath, context);
- if (violations != null) {
- if (allViolations == null) {
- allViolations = new HashSet();
- }
- allViolations.addAll(violations);
- }
- }
- catch (NoSuchNodeException e) {
- getLogger().error("hm.. the instance just told us about the nodes!");
- }
- }
- return (allViolations);
- }
-
- public Collection getConstraintsFor(String xpath) throws
NoSuchNodeException {
- AbstractPreceptorNode node = (AbstractPreceptorNode) index.get(xpath);
- if (node != null) {
- List constraints = node.getConstraints();
- if (constraints != null) {
- getLogger().debug(constraints.size() + " constraints for [" +
String.valueOf(xpath) + "]");
- return (constraints);
- }
- else {
- getLogger().debug("no constraints for [" + String.valueOf(xpath) +
"]");
- return (null);
- }
- }
- else {
- throw new NoSuchNodeException(xpath);
- }
- }
-
- public void buildInstance(Instance instance) {
- try {
- for (Iterator it = index.keySet().iterator(); it.hasNext();) {
- String xpath = (String) it.next();
- AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(xpath);
- if (node instanceof ElementPreceptorNode) {
- for (int i = 0; i < ((ElementPreceptorNode) node).getMinOcc();
i++) {
- String s = xpath;
- if (i != 0) {
- s += "[" + (i + 1) + "]";
- }
- getLogger().debug("building node [" + String.valueOf(s) + "]");
- instance.setValue(s, "");
- }
- }
- else {
- getLogger().debug("building node [" + String.valueOf(xpath) + "]");
- instance.setValue(xpath, "");
- }
- }
- }
- catch (InvalidXPathSyntaxException e) {
- getLogger().error("hm.. the preceptor should know how to build the
instance!");
- }
- catch (PreceptorViolationException e) {
- getLogger().error("hm.. the preceptor should know how to build the
instance!");
- }
- }
-
- public boolean isValidNode(String xpath) throws
InvalidXPathSyntaxException {
- StringBuffer currentPath = new StringBuffer();
- StringTokenizer tok = new StringTokenizer(xpath, "/", false);
- boolean first = true;
- while (tok.hasMoreTokens()) {
- String level = tok.nextToken();
- if (!first) {
- currentPath.append("/");
- }
- else {
- first = false;
- }
-
- if (level.startsWith("@")) {
- currentPath.append(level);
- AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(currentPath.toString());
- if (node != null) {
- getLogger().debug("found attribute node [" +
String.valueOf(currentPath) + "] in index");
- return (true);
- }
- else {
- getLogger().debug("could not find attribute [" +
String.valueOf(currentPath) + "] in index");
- return (false);
- }
- }
- else {
- String levelName;
- int levelInt = 1;
- int open = level.indexOf("[");
- if (open > 0) {
- int close = level.indexOf("]", open);
- if (close > 0) {
- try {
- levelInt = Integer.parseInt(level.substring(open + 1, close));
- levelName = level.substring(0, open);
- }
- catch (NumberFormatException e) {
- getLogger().debug("invalid syntax [" + String.valueOf(level) +
"]");
- throw new InvalidXPathSyntaxException(level);
- }
- }
- else {
- getLogger().debug("invalid syntax [" + String.valueOf(level) +
"]");
- throw new InvalidXPathSyntaxException(level);
- }
- }
- else {
- levelName = level;
- }
-
- currentPath.append(levelName);
- AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(currentPath.toString());
- if (node != null) {
- getLogger().debug("found node [" + String.valueOf(currentPath) +
"] in index");
-
- if (node instanceof ElementPreceptorNode) {
- if (((ElementPreceptorNode) node).getMaxOcc() !=
ElementPreceptorNode.UNBOUND && levelInt > ((ElementPreceptorNode)
node).getMaxOcc()) {
- getLogger().debug(String.valueOf(levelName) + "[" + levelInt +
"] exceeds maximal occurrences [" + ((ElementPreceptorNode) node).getMaxOcc() +
"]");
- return (false);
- }
- }
-
- if (!tok.hasMoreTokens()) return (true);
- }
- else {
- getLogger().debug("could not find [" + String.valueOf(currentPath)
+ "] in index");
- return (false);
- }
- }
- }
- return (false);
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax;
+
+
+
+import org.apache.cocoon.precept.*;
+
+import org.apache.cocoon.precept.preceptors.AbstractPreceptor;
+
+
+
+import java.util.*;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+
+
+public class PreceptorImpl extends AbstractPreceptor {
+
+ HashMap index = new HashMap();
+
+
+
+ public Collection validate(Instance instance, String xpath, Context
context) throws InvalidXPathSyntaxException, NoSuchNodeException {
+
+ Collection violations = null;
+
+ Collection constraints = (Collection) getConstraintsFor(xpath);
+
+ if (constraints != null) {
+
+ Object value = instance.getValue(xpath);
+
+ for (Iterator it = constraints.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+ if (!constraint.isSatisfiedBy(value, context)) {
+
+ if (violations == null) {
+
+ violations = new HashSet();
+
+ }
+
+ violations.add(constraint);
+
+ }
+
+ }
+
+ return (violations);
+
+ }
+
+ else {
+
+ return (null);
+
+ }
+
+ }
+
+
+
+ public Collection validate(Instance instance, Context context) throws
InvalidXPathSyntaxException {
+
+ Collection allViolations = null;
+
+ Collection xpaths = instance.getNodePaths();
+
+ for (Iterator it = xpaths.iterator(); it.hasNext();) {
+
+ String xpath = (String) it.next();
+
+ try {
+
+ Collection violations = validate(instance, xpath, context);
+
+ if (violations != null) {
+
+ if (allViolations == null) {
+
+ allViolations = new HashSet();
+
+ }
+
+ allViolations.addAll(violations);
+
+ }
+
+ }
+
+ catch (NoSuchNodeException e) {
+
+ getLogger().error("hm.. the instance just told us about the nodes!");
+
+ }
+
+ }
+
+ return (allViolations);
+
+ }
+
+
+
+ public Collection getConstraintsFor(String xpath) throws
NoSuchNodeException {
+
+ AbstractPreceptorNode node = (AbstractPreceptorNode) index.get(xpath);
+
+ if (node != null) {
+
+ List constraints = node.getConstraints();
+
+ if (constraints != null) {
+
+ getLogger().debug(constraints.size() + " constraints for [" +
String.valueOf(xpath) + "]");
+
+ return (constraints);
+
+ }
+
+ else {
+
+ getLogger().debug("no constraints for [" + String.valueOf(xpath) +
"]");
+
+ return (null);
+
+ }
+
+ }
+
+ else {
+
+ throw new NoSuchNodeException(xpath);
+
+ }
+
+ }
+
+
+
+ public void buildInstance(Instance instance) {
+
+ try {
+
+ for (Iterator it = index.keySet().iterator(); it.hasNext();) {
+
+ String xpath = (String) it.next();
+
+ AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(xpath);
+
+ if (node instanceof ElementPreceptorNode) {
+
+ for (int i = 0; i < ((ElementPreceptorNode) node).getMinOcc();
i++) {
+
+ String s = xpath;
+
+ if (i != 0) {
+
+ s += "[" + (i + 1) + "]";
+
+ }
+
+ getLogger().debug("building node [" + String.valueOf(s) + "]");
+
+ instance.setValue(s, "");
+
+ }
+
+ }
+
+ else {
+
+ getLogger().debug("building node [" + String.valueOf(xpath) + "]");
+
+ instance.setValue(xpath, "");
+
+ }
+
+ }
+
+ }
+
+ catch (InvalidXPathSyntaxException e) {
+
+ getLogger().error("hm.. the preceptor should know how to build the
instance!");
+
+ }
+
+ catch (PreceptorViolationException e) {
+
+ getLogger().error("hm.. the preceptor should know how to build the
instance!");
+
+ }
+
+ }
+
+
+
+ public boolean isValidNode(String xpath) throws
InvalidXPathSyntaxException {
+
+ StringBuffer currentPath = new StringBuffer();
+
+ StringTokenizer tok = new StringTokenizer(xpath, "/", false);
+
+ boolean first = true;
+
+ while (tok.hasMoreTokens()) {
+
+ String level = tok.nextToken();
+
+ if (!first) {
+
+ currentPath.append("/");
+
+ }
+
+ else {
+
+ first = false;
+
+ }
+
+
+
+ if (level.startsWith("@")) {
+
+ currentPath.append(level);
+
+ AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(currentPath.toString());
+
+ if (node != null) {
+
+ getLogger().debug("found attribute node [" +
String.valueOf(currentPath) + "] in index");
+
+ return (true);
+
+ }
+
+ else {
+
+ getLogger().debug("could not find attribute [" +
String.valueOf(currentPath) + "] in index");
+
+ return (false);
+
+ }
+
+ }
+
+ else {
+
+ String levelName;
+
+ int levelInt = 1;
+
+ int open = level.indexOf("[");
+
+ if (open > 0) {
+
+ int close = level.indexOf("]", open);
+
+ if (close > 0) {
+
+ try {
+
+ levelInt = Integer.parseInt(level.substring(open + 1, close));
+
+ levelName = level.substring(0, open);
+
+ }
+
+ catch (NumberFormatException e) {
+
+ getLogger().debug("invalid syntax [" + String.valueOf(level) +
"]");
+
+ throw new InvalidXPathSyntaxException(level);
+
+ }
+
+ }
+
+ else {
+
+ getLogger().debug("invalid syntax [" + String.valueOf(level) +
"]");
+
+ throw new InvalidXPathSyntaxException(level);
+
+ }
+
+ }
+
+ else {
+
+ levelName = level;
+
+ }
+
+
+
+ currentPath.append(levelName);
+
+ AbstractPreceptorNode node = (AbstractPreceptorNode)
index.get(currentPath.toString());
+
+ if (node != null) {
+
+ getLogger().debug("found node [" + String.valueOf(currentPath) +
"] in index");
+
+
+
+ if (node instanceof ElementPreceptorNode) {
+
+ if (((ElementPreceptorNode) node).getMaxOcc() !=
ElementPreceptorNode.UNBOUND && levelInt > ((ElementPreceptorNode)
node).getMaxOcc()) {
+
+ getLogger().debug(String.valueOf(levelName) + "[" + levelInt +
"] exceeds maximal occurrences [" + ((ElementPreceptorNode) node).getMaxOcc() +
"]");
+
+ return (false);
+
+ }
+
+ }
+
+
+
+ if (!tok.hasMoreTokens()) return (true);
+
+ }
+
+ else {
+
+ getLogger().debug("could not find [" + String.valueOf(currentPath)
+ "] in index");
+
+ return (false);
+
+ }
+
+ }
+
+ }
+
+ return (false);
+
+ }
+
+}
+
1.4 +128 -64
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/AbstractConstraint.java
Index: AbstractConstraint.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/AbstractConstraint.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractConstraint.java 26 Mar 2002 19:56:44 -0000 1.3
+++ AbstractConstraint.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,64 +1,128 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
-
-import org.apache.cocoon.precept.Constraint;
-import org.apache.avalon.framework.logger.AbstractLoggable;
-import org.apache.avalon.framework.component.Component;
-
-/*
- * @version: Mar 21, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public abstract class AbstractConstraint extends AbstractLoggable implements
Constraint, Component {
- protected String id = null;
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
+
+
+
+import org.apache.cocoon.precept.Constraint;
+
+import org.apache.avalon.framework.logger.AbstractLoggable;
+
+import org.apache.avalon.framework.component.Component;
+
+
+
+/*
+
+ * @version: Mar 21, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public abstract class AbstractConstraint extends AbstractLoggable implements
Constraint, Component {
+
+ protected String id = null;
+
+}
+
1.4 +266 -133
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/ChoiceConstraint.java
Index: ChoiceConstraint.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/ChoiceConstraint.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ChoiceConstraint.java 26 Mar 2002 19:56:44 -0000 1.3
+++ ChoiceConstraint.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,133 +1,266 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
-
-import org.apache.cocoon.precept.Context;
-import org.apache.cocoon.precept.ConfigurationHelper;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.SingleThreaded;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-import java.util.*;
-
-/*
- * @version: Mar 21, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class ChoiceConstraint extends AbstractConstraint implements
Configurable, SingleThreaded {
- public Collection validValues = new ArrayList();
- public Map validValuesDescription = new HashMap();
-
- public void configure(Configuration configuration) throws
ConfigurationException {
- id = configuration.getAttribute("name");
-
- getLogger().debug("configuring constraint [" + String.valueOf(id) + "]");
-
- if (validValues.size() == 0) {
- Configuration[] choices = configuration.getChildren("choice");
- for(int i=0;i<choices.length;i++) {
- Configuration choice = choices[i];
- String value = choice.getAttribute("value");
- String valueDescription = choice.getValue();
-
- getLogger().debug("registered choice [" + String.valueOf(value) + "]
= [" + String.valueOf(valueDescription) + "]");
-
- validValues.add(value);
- validValuesDescription.put(value,valueDescription);
- }
- }
- }
-
- public boolean isSatisfiedBy(Object value, Context context ) {
- boolean isValid = validValues.contains(value);
- System.out.println("checking choice [" + String.valueOf(value) + "]
contains [" + String.valueOf(validValues) + "] is " + isValid);
- getLogger().debug("checking choice [" + String.valueOf(value) + "]
contains [" + String.valueOf(validValues) + "] is " + isValid);
- return(isValid);
- }
-
- public String getId() {
- return(id);
- }
-
- public String getType() {
- return("choice");
- }
-
- public String toString() {
- return( String.valueOf(getType()) + "[" + String.valueOf(getId()) + "]
-> [" + String.valueOf(validValues) + "]");
- }
-
- public void toSAX(ContentHandler handler) throws SAXException {
- AttributesImpl attributes = new AttributesImpl();
- attributes.addAttribute("","type","type","CDATA",getType());
- attributes.addAttribute("","name","name","CDATA",id);
-
- handler.startElement("","constraint","constraint",attributes);
- for (Iterator it = validValues.iterator(); it.hasNext();) {
- String value = (String) it.next();
- String description = (String) validValuesDescription.get(value);
-
- AttributesImpl choiceAttributes = new AttributesImpl();
- choiceAttributes.addAttribute("","value","value","CDATA",value);
-
- handler.startElement("","choice","choice",choiceAttributes);
- handler.characters(description.toCharArray(),0,description.length());
- handler.endElement("","choice","choice");
- }
- handler.endElement("","constraint","constraint");
- }
-
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
+
+
+
+import org.apache.cocoon.precept.Context;
+
+import org.apache.cocoon.precept.ConfigurationHelper;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.apache.avalon.framework.configuration.Configurable;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.avalon.framework.thread.SingleThreaded;
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+import org.xml.sax.helpers.AttributesImpl;
+
+
+
+import java.util.*;
+
+
+
+/*
+
+ * @version: Mar 21, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class ChoiceConstraint extends AbstractConstraint implements
Configurable, SingleThreaded {
+
+ public Collection validValues = new ArrayList();
+
+ public Map validValuesDescription = new HashMap();
+
+
+
+ public void configure(Configuration configuration) throws
ConfigurationException {
+
+ id = configuration.getAttribute("name");
+
+
+
+ getLogger().debug("configuring constraint [" + String.valueOf(id) + "]");
+
+
+
+ if (validValues.size() == 0) {
+
+ Configuration[] choices = configuration.getChildren("choice");
+
+ for(int i=0;i<choices.length;i++) {
+
+ Configuration choice = choices[i];
+
+ String value = choice.getAttribute("value");
+
+ String valueDescription = choice.getValue();
+
+
+
+ getLogger().debug("registered choice [" + String.valueOf(value) + "]
= [" + String.valueOf(valueDescription) + "]");
+
+
+
+ validValues.add(value);
+
+ validValuesDescription.put(value,valueDescription);
+
+ }
+
+ }
+
+ }
+
+
+
+ public boolean isSatisfiedBy(Object value, Context context ) {
+
+ boolean isValid = validValues.contains(value);
+
+ System.out.println("checking choice [" + String.valueOf(value) + "]
contains [" + String.valueOf(validValues) + "] is " + isValid);
+
+ getLogger().debug("checking choice [" + String.valueOf(value) + "]
contains [" + String.valueOf(validValues) + "] is " + isValid);
+
+ return(isValid);
+
+ }
+
+
+
+ public String getId() {
+
+ return(id);
+
+ }
+
+
+
+ public String getType() {
+
+ return("choice");
+
+ }
+
+
+
+ public String toString() {
+
+ return( String.valueOf(getType()) + "[" + String.valueOf(getId()) + "]
-> [" + String.valueOf(validValues) + "]");
+
+ }
+
+
+
+ public void toSAX(ContentHandler handler) throws SAXException {
+
+ AttributesImpl attributes = new AttributesImpl();
+
+ attributes.addAttribute("","type","type","CDATA",getType());
+
+ attributes.addAttribute("","name","name","CDATA",id);
+
+
+
+ handler.startElement("","constraint","constraint",attributes);
+
+ for (Iterator it = validValues.iterator(); it.hasNext();) {
+
+ String value = (String) it.next();
+
+ String description = (String) validValuesDescription.get(value);
+
+
+
+ AttributesImpl choiceAttributes = new AttributesImpl();
+
+ choiceAttributes.addAttribute("","value","value","CDATA",value);
+
+
+
+ handler.startElement("","choice","choice",choiceAttributes);
+
+ handler.characters(description.toCharArray(),0,description.length());
+
+ handler.endElement("","choice","choice");
+
+ }
+
+ handler.endElement("","constraint","constraint");
+
+ }
+
+
+
+}
+
1.4 +220 -110
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/RegexprConstraint.java
Index: RegexprConstraint.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/preceptors/easyrelax/constraints/RegexprConstraint.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RegexprConstraint.java 26 Mar 2002 19:56:44 -0000 1.3
+++ RegexprConstraint.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,110 +1,220 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
-
-import org.apache.cocoon.precept.Context;
-import org.apache.cocoon.precept.ConfigurationHelper;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.SingleThreaded;
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-/*
- * @version: Mar 21, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class RegexprConstraint extends AbstractConstraint implements
Configurable, SingleThreaded {
-
- private String expressionString;
- private RE expression;
-
- public void configure(Configuration configuration) throws
ConfigurationException {
- id = configuration.getAttribute("name");
-
- expressionString = configuration.getValue();
-
- getLogger().debug("expression [" + String.valueOf(expressionString) +
"]");
-
- try {
- expression = new RE(expressionString);
- }
- catch (RESyntaxException e) {
- throw new ConfigurationException("",e);
- }
- }
-
- public boolean isSatisfiedBy(Object value, Context context ) {
- boolean isValid = expression.match(String.valueOf(value));
- System.out.println("checking regexpr [" + String.valueOf(value) + "]
matches [" + String.valueOf(expressionString) + "] is " + isValid);
- getLogger().debug("checking regexpr [" + String.valueOf(value) + "]
matches [" + String.valueOf(expressionString) + "] is " + isValid);
- return(isValid);
- }
-
- public String getId() {
- return(id);
- }
-
- public String getType() {
- return("regexpr");
- }
-
- public String toString() {
- return( String.valueOf(getType()) + "[" + String.valueOf(getId()) + "]
-> [" + String.valueOf(expressionString) + "]");
- }
-
- public void toSAX(ContentHandler handler) throws SAXException {
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.preceptors.easyrelax.constraints;
+
+
+
+import org.apache.cocoon.precept.Context;
+
+import org.apache.cocoon.precept.ConfigurationHelper;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.apache.avalon.framework.configuration.Configurable;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.avalon.framework.thread.SingleThreaded;
+
+import org.apache.regexp.RE;
+
+import org.apache.regexp.RESyntaxException;
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+
+
+/*
+
+ * @version: Mar 21, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class RegexprConstraint extends AbstractConstraint implements
Configurable, SingleThreaded {
+
+
+
+ private String expressionString;
+
+ private RE expression;
+
+
+
+ public void configure(Configuration configuration) throws
ConfigurationException {
+
+ id = configuration.getAttribute("name");
+
+
+
+ expressionString = configuration.getValue();
+
+
+
+ getLogger().debug("expression [" + String.valueOf(expressionString) +
"]");
+
+
+
+ try {
+
+ expression = new RE(expressionString);
+
+ }
+
+ catch (RESyntaxException e) {
+
+ throw new ConfigurationException("",e);
+
+ }
+
+ }
+
+
+
+ public boolean isSatisfiedBy(Object value, Context context ) {
+
+ boolean isValid = expression.match(String.valueOf(value));
+
+ System.out.println("checking regexpr [" + String.valueOf(value) + "]
matches [" + String.valueOf(expressionString) + "] is " + isValid);
+
+ getLogger().debug("checking regexpr [" + String.valueOf(value) + "]
matches [" + String.valueOf(expressionString) + "] is " + isValid);
+
+ return(isValid);
+
+ }
+
+
+
+ public String getId() {
+
+ return(id);
+
+ }
+
+
+
+ public String getType() {
+
+ return("regexpr");
+
+ }
+
+
+
+ public String toString() {
+
+ return( String.valueOf(getType()) + "[" + String.valueOf(getId()) + "]
-> [" + String.valueOf(expressionString) + "]");
+
+ }
+
+
+
+ public void toSAX(ContentHandler handler) throws SAXException {
+
+ }
+
+}
+
1.3 +170 -85
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/AbstractInstance.java
Index: AbstractInstance.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/AbstractInstance.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractInstance.java 25 Mar 2002 23:23:55 -0000 1.2
+++ AbstractInstance.java 6 Jun 2002 14:43:42 -0000 1.3
@@ -1,85 +1,170 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores;
-
-import org.apache.avalon.framework.logger.AbstractLoggable;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.cocoon.precept.Instance;
-
-import javax.servlet.http.HttpSessionBindingListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-
-/*
- * @version: Mar 18, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public abstract class AbstractInstance extends AbstractLoggable implements
Instance, Composable, Disposable, HttpSessionBindingListener {
- protected ComponentManager manager;
-
- public void compose(ComponentManager manager) throws ComponentException {
- this.manager = manager;
- }
-
- public void valueBound(HttpSessionBindingEvent event) {
- }
-
- public void valueUnbound(HttpSessionBindingEvent event) {
- getLogger().debug("releasing instance in session");
- manager.release(this);
- }
-
- public void dispose() {
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores;
+
+
+
+import org.apache.avalon.framework.logger.AbstractLoggable;
+
+import org.apache.avalon.framework.component.Composable;
+
+import org.apache.avalon.framework.component.ComponentManager;
+
+import org.apache.avalon.framework.component.ComponentException;
+
+import org.apache.avalon.framework.activity.Disposable;
+
+import org.apache.cocoon.precept.Instance;
+
+
+
+import javax.servlet.http.HttpSessionBindingListener;
+
+import javax.servlet.http.HttpSessionBindingEvent;
+
+
+
+/*
+
+ * @version: Mar 18, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public abstract class AbstractInstance extends AbstractLoggable implements
Instance, Composable, Disposable, HttpSessionBindingListener {
+
+ protected ComponentManager manager;
+
+
+
+ public void compose(ComponentManager manager) throws ComponentException {
+
+ this.manager = manager;
+
+ }
+
+
+
+ public void valueBound(HttpSessionBindingEvent event) {
+
+ }
+
+
+
+ public void valueUnbound(HttpSessionBindingEvent event) {
+
+ getLogger().debug("releasing instance in session");
+
+ manager.release(this);
+
+ }
+
+
+
+ public void dispose() {
+
+ }
+
+}
+
1.4 +374 -187
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/InstanceImpl.java
Index: InstanceImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/InstanceImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InstanceImpl.java 4 Apr 2002 14:12:47 -0000 1.3
+++ InstanceImpl.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,187 +1,374 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.bean;
-
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.cocoon.components.classloader.ClassLoaderManager;
-import org.apache.cocoon.xml.DocumentHandlerAdapter;
-import org.apache.commons.jxpath.JXPathContext;
-import org.exolab.castor.mapping.Mapping;
-import org.exolab.castor.mapping.MappingException;
-import org.exolab.castor.xml.MarshalException;
-import org.exolab.castor.xml.Marshaller;
-import org.exolab.castor.xml.ValidationException;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.apache.cocoon.precept.*;
-import org.apache.cocoon.precept.stores.AbstractInstance;
-
-import java.util.List;
-import java.util.Collection;
-
-/*
- * @version: Mar 15, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class InstanceImpl extends AbstractInstance implements Configurable {
- private Preceptor preceptor;
- private Mapping mapping;
- private Object bean;
- private JXPathContext beanContext;
-
- public void setBean(Object bean) {
- this.bean = bean;
- this.beanContext = JXPathContext.newContext(bean);
- }
-
- public void configure(Configuration configuration) throws
ConfigurationException {
- Configuration clazzConf = configuration.getChild("class");
- if (clazzConf != null) {
- ClassLoaderManager clazzLoader = null;
- try {
- String clazzName = clazzConf.getValue();
- String mappingURI = clazzConf.getAttribute("mapping");
-
- if (mappingURI != null) {
- mapping = new Mapping();
- // resolve
- //mapping.loadMapping(getFile(resolver,mappingURI));
- getLogger().debug("bean class = [" + String.valueOf(clazzName) +
"] mapping [" + String.valueOf(mappingURI) + "]");
- }
- else {
- getLogger().debug("bean class = [" + String.valueOf(clazzName) +
"] using default mapping");
- }
-
- clazzLoader = (ClassLoaderManager)
manager.lookup(ClassLoaderManager.ROLE);
- Class clazz = clazzLoader.loadClass(clazzName);
- setBean(clazz.newInstance());
- }
- catch (ComponentException e) {
- throw new ConfigurationException("", e);
- }
- catch (ClassNotFoundException e) {
- throw new ConfigurationException("", e);
- }
- catch (InstantiationException e) {
- throw new ConfigurationException("", e);
- }
- catch (IllegalAccessException e) {
- throw new ConfigurationException("", e);
- }
- finally {
- manager.release(clazzLoader);
- }
- }
- }
-
- public void setValue(String xpath, Object value) throws
PreceptorViolationException, InvalidXPathSyntaxException {
- setValue(xpath, value, null);
- }
-
- public void setValue(String xpath, Object value, Context context) throws
PreceptorViolationException, InvalidXPathSyntaxException {
- try {
- beanContext.setValue(xpath, value);
- }
- catch (Exception e) {
- throw new PreceptorViolationException(e);
- }
- }
-
- public Object getValue(String xpath) throws InvalidXPathSyntaxException {
- try {
- return (beanContext.getValue(xpath));
- }
- catch (Exception e) {
- throw new InvalidXPathSyntaxException(e);
- }
- }
-
- public void setPreceptor(Preceptor preceptor) {
- this.preceptor = preceptor;
- preceptor.buildInstance(this);
- }
-
- public Preceptor getPreceptor() {
- return (preceptor);
- }
-
- public long getLastModified() {
- //NYI
- return 0;
- }
-
- public void toSAX(ContentHandler handler, boolean withConstraints) throws
SAXException {
- try {
- Marshaller marshaller = new Marshaller(new
DocumentHandlerAdapter(handler));
- if (mapping != null) {
- marshaller.setMapping(mapping);
- }
- marshaller.marshal(bean);
- }
- catch (ValidationException e) {
- throw new SAXException(e);
- }
- catch (MappingException e) {
- throw new SAXException(e);
- }
- catch (MarshalException e) {
- throw new SAXException(e);
- }
- }
-
- public Collection getNodePaths() {
- return null;
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.bean;
+
+
+
+import org.apache.avalon.framework.component.ComponentException;
+
+import org.apache.avalon.framework.configuration.Configurable;
+
+import org.apache.avalon.framework.configuration.Configuration;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+import org.apache.cocoon.components.classloader.ClassLoaderManager;
+
+import org.apache.cocoon.xml.DocumentHandlerAdapter;
+
+import org.apache.commons.jxpath.JXPathContext;
+
+import org.exolab.castor.mapping.Mapping;
+
+import org.exolab.castor.mapping.MappingException;
+
+import org.exolab.castor.xml.MarshalException;
+
+import org.exolab.castor.xml.Marshaller;
+
+import org.exolab.castor.xml.ValidationException;
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+import org.apache.cocoon.precept.*;
+
+import org.apache.cocoon.precept.stores.AbstractInstance;
+
+
+
+import java.util.List;
+
+import java.util.Collection;
+
+
+
+/*
+
+ * @version: Mar 15, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class InstanceImpl extends AbstractInstance implements Configurable {
+
+ private Preceptor preceptor;
+
+ private Mapping mapping;
+
+ private Object bean;
+
+ private JXPathContext beanContext;
+
+
+
+ public void setBean(Object bean) {
+
+ this.bean = bean;
+
+ this.beanContext = JXPathContext.newContext(bean);
+
+ }
+
+
+
+ public void configure(Configuration configuration) throws
ConfigurationException {
+
+ Configuration clazzConf = configuration.getChild("class");
+
+ if (clazzConf != null) {
+
+ ClassLoaderManager clazzLoader = null;
+
+ try {
+
+ String clazzName = clazzConf.getValue();
+
+ String mappingURI = clazzConf.getAttribute("mapping");
+
+
+
+ if (mappingURI != null) {
+
+ mapping = new Mapping();
+
+ // resolve
+
+ //mapping.loadMapping(getFile(resolver,mappingURI));
+
+ getLogger().debug("bean class = [" + String.valueOf(clazzName) +
"] mapping [" + String.valueOf(mappingURI) + "]");
+
+ }
+
+ else {
+
+ getLogger().debug("bean class = [" + String.valueOf(clazzName) +
"] using default mapping");
+
+ }
+
+
+
+ clazzLoader = (ClassLoaderManager)
manager.lookup(ClassLoaderManager.ROLE);
+
+ Class clazz = clazzLoader.loadClass(clazzName);
+
+ setBean(clazz.newInstance());
+
+ }
+
+ catch (ComponentException e) {
+
+ throw new ConfigurationException("", e);
+
+ }
+
+ catch (ClassNotFoundException e) {
+
+ throw new ConfigurationException("", e);
+
+ }
+
+ catch (InstantiationException e) {
+
+ throw new ConfigurationException("", e);
+
+ }
+
+ catch (IllegalAccessException e) {
+
+ throw new ConfigurationException("", e);
+
+ }
+
+ finally {
+
+ manager.release(clazzLoader);
+
+ }
+
+ }
+
+ }
+
+
+
+ public void setValue(String xpath, Object value) throws
PreceptorViolationException, InvalidXPathSyntaxException {
+
+ setValue(xpath, value, null);
+
+ }
+
+
+
+ public void setValue(String xpath, Object value, Context context) throws
PreceptorViolationException, InvalidXPathSyntaxException {
+
+ try {
+
+ beanContext.setValue(xpath, value);
+
+ }
+
+ catch (Exception e) {
+
+ throw new PreceptorViolationException(e);
+
+ }
+
+ }
+
+
+
+ public Object getValue(String xpath) throws InvalidXPathSyntaxException {
+
+ try {
+
+ return (beanContext.getValue(xpath));
+
+ }
+
+ catch (Exception e) {
+
+ throw new InvalidXPathSyntaxException(e);
+
+ }
+
+ }
+
+
+
+ public void setPreceptor(Preceptor preceptor) {
+
+ this.preceptor = preceptor;
+
+ preceptor.buildInstance(this);
+
+ }
+
+
+
+ public Preceptor getPreceptor() {
+
+ return (preceptor);
+
+ }
+
+
+
+ public long getLastModified() {
+
+ //NYI
+
+ return 0;
+
+ }
+
+
+
+ public void toSAX(ContentHandler handler, boolean withConstraints) throws
SAXException {
+
+ try {
+
+ Marshaller marshaller = new Marshaller(new
DocumentHandlerAdapter(handler));
+
+ if (mapping != null) {
+
+ marshaller.setMapping(mapping);
+
+ }
+
+ marshaller.marshal(bean);
+
+ }
+
+ catch (ValidationException e) {
+
+ throw new SAXException(e);
+
+ }
+
+ catch (MappingException e) {
+
+ throw new SAXException(e);
+
+ }
+
+ catch (MarshalException e) {
+
+ throw new SAXException(e);
+
+ }
+
+ }
+
+
+
+ public Collection getNodePaths() {
+
+ return null;
+
+ }
+
+}
+
1.3 +220 -110
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/CocoonInstallationBean.java
Index: CocoonInstallationBean.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/CocoonInstallationBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CocoonInstallationBean.java 25 Mar 2002 23:23:55 -0000 1.2
+++ CocoonInstallationBean.java 6 Jun 2002 14:43:42 -0000 1.3
@@ -1,110 +1,220 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.bean.test;
-
-/*
- * @version: Mar 20, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class CocoonInstallationBean {
- private UserBean user;
- private SystemBean system;
- private int number;
- private String live_url;
- private boolean publish;
-
- public CocoonInstallationBean() {
- user = new UserBean();
- system = new SystemBean();
- }
-
- public UserBean getUser() {
- return user;
- }
-
- public void setUser(UserBean user) {
- this.user = user;
- }
-
- public SystemBean getSystem() {
- return system;
- }
-
- public void setSystem(SystemBean system) {
- this.system = system;
- }
-
- public int getNumber() {
- return number;
- }
-
- public void setNumber(int number) {
- this.number = number;
- }
-
- public String getLive_url() {
- return live_url;
- }
-
- public void setLive_url(String live_url) {
- this.live_url = live_url;
- }
-
- public boolean isPublish() {
- return publish;
- }
-
- public void setPublish(boolean publish) {
- this.publish = publish;
- }
-
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.bean.test;
+
+
+
+/*
+
+ * @version: Mar 20, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class CocoonInstallationBean {
+
+ private UserBean user;
+
+ private SystemBean system;
+
+ private int number;
+
+ private String live_url;
+
+ private boolean publish;
+
+
+
+ public CocoonInstallationBean() {
+
+ user = new UserBean();
+
+ system = new SystemBean();
+
+ }
+
+
+
+ public UserBean getUser() {
+
+ return user;
+
+ }
+
+
+
+ public void setUser(UserBean user) {
+
+ this.user = user;
+
+ }
+
+
+
+ public SystemBean getSystem() {
+
+ return system;
+
+ }
+
+
+
+ public void setSystem(SystemBean system) {
+
+ this.system = system;
+
+ }
+
+
+
+ public int getNumber() {
+
+ return number;
+
+ }
+
+
+
+ public void setNumber(int number) {
+
+ this.number = number;
+
+ }
+
+
+
+ public String getLive_url() {
+
+ return live_url;
+
+ }
+
+
+
+ public void setLive_url(String live_url) {
+
+ this.live_url = live_url;
+
+ }
+
+
+
+ public boolean isPublish() {
+
+ return publish;
+
+ }
+
+
+
+ public void setPublish(boolean publish) {
+
+ this.publish = publish;
+
+ }
+
+
+
+}
+
1.3 +214 -107
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/SystemBean.java
Index: SystemBean.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/SystemBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SystemBean.java 25 Mar 2002 23:23:55 -0000 1.2
+++ SystemBean.java 6 Jun 2002 14:43:42 -0000 1.3
@@ -1,107 +1,214 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.bean.test;
-
-/*
- * @version: Mar 20, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class SystemBean {
- private String os;
- private String processor;
- private int ram;
- private String servlet_engine;
- private String java_version;
-
- public SystemBean() {
- }
-
- public String getOs() {
- return os;
- }
-
- public void setOs(String os) {
- this.os = os;
- }
-
- public String getProcessor() {
- return processor;
- }
-
- public void setProcessor(String processor) {
- this.processor = processor;
- }
-
- public int getRam() {
- return ram;
- }
-
- public void setRam(int ram) {
- this.ram = ram;
- }
-
- public String getServlet_engine() {
- return servlet_engine;
- }
-
- public void setServlet_engine(String servlet_engine) {
- this.servlet_engine = servlet_engine;
- }
-
- public String getJava_version() {
- return java_version;
- }
-
- public void setJava_version(String java_version) {
- this.java_version = java_version;
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.bean.test;
+
+
+
+/*
+
+ * @version: Mar 20, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class SystemBean {
+
+ private String os;
+
+ private String processor;
+
+ private int ram;
+
+ private String servlet_engine;
+
+ private String java_version;
+
+
+
+ public SystemBean() {
+
+ }
+
+
+
+ public String getOs() {
+
+ return os;
+
+ }
+
+
+
+ public void setOs(String os) {
+
+ this.os = os;
+
+ }
+
+
+
+ public String getProcessor() {
+
+ return processor;
+
+ }
+
+
+
+ public void setProcessor(String processor) {
+
+ this.processor = processor;
+
+ }
+
+
+
+ public int getRam() {
+
+ return ram;
+
+ }
+
+
+
+ public void setRam(int ram) {
+
+ this.ram = ram;
+
+ }
+
+
+
+ public String getServlet_engine() {
+
+ return servlet_engine;
+
+ }
+
+
+
+ public void setServlet_engine(String servlet_engine) {
+
+ this.servlet_engine = servlet_engine;
+
+ }
+
+
+
+ public String getJava_version() {
+
+ return java_version;
+
+ }
+
+
+
+ public void setJava_version(String java_version) {
+
+ this.java_version = java_version;
+
+ }
+
+}
+
1.3 +178 -89
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/UserBean.java
Index: UserBean.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/bean/test/UserBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UserBean.java 25 Mar 2002 23:23:55 -0000 1.2
+++ UserBean.java 6 Jun 2002 14:43:42 -0000 1.3
@@ -1,89 +1,178 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.bean.test;
-
-/*
- * @version: Mar 20, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class UserBean {
- private String firstname;
- private String lastname;
- private String email;
-
- public UserBean() {
- }
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.bean.test;
+
+
+
+/*
+
+ * @version: Mar 20, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class UserBean {
+
+ private String firstname;
+
+ private String lastname;
+
+ private String email;
+
+
+
+ public UserBean() {
+
+ }
+
+
+
+ public String getFirstname() {
+
+ return firstname;
+
+ }
+
+
+
+ public void setFirstname(String firstname) {
+
+ this.firstname = firstname;
+
+ }
+
+
+
+ public String getLastname() {
+
+ return lastname;
+
+ }
+
+
+
+ public void setLastname(String lastname) {
+
+ this.lastname = lastname;
+
+ }
+
+
+
+ public String getEmail() {
+
+ return email;
+
+ }
+
+
+
+ public void setEmail(String email) {
+
+ this.email = email;
+
+ }
+
+}
+
1.4 +106 -53
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/AttributeNode.java
Index: AttributeNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/AttributeNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AttributeNode.java 4 Apr 2002 07:02:09 -0000 1.3
+++ AttributeNode.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,61 +1,114 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
package org.apache.cocoon.precept.stores.dom.simple;
import java.util.Iterator;
import java.util.Collection;
-/*
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+/*
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public class AttributeNode extends Node {
public AttributeNode( String name, Collection constraints) {
1.4 +310 -155
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/ElementNode.java
Index: ElementNode.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/ElementNode.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElementNode.java 4 Apr 2002 07:02:09 -0000 1.3
+++ ElementNode.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,166 +1,321 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.dom.simple;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-import org.apache.cocoon.precept.Constraint;
-
-import java.util.*;
-
-/*
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class ElementNode extends Node {
- private final static Attributes NOATTR = new AttributesImpl();
-
- private ArrayList childs;
- private ArrayList attributes;
- private HashMap attributeIndex;
-
-
- public ElementNode(String name, Collection constraints) {
- super(name, constraints);
- }
-
- public void addAttribute(Node node) {
- if (attributes == null) attributes = new ArrayList();
- if (attributeIndex == null) attributeIndex = new HashMap();
- attributes.add(node);
- attributeIndex.put(node.getValue(), node);
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.dom.simple;
+
+
+
+import org.xml.sax.Attributes;
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.cocoon.precept.Constraint;
+
+
+
+import java.util.*;
+
+
+
+/*
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class ElementNode extends Node {
+
+ private final static Attributes NOATTR = new AttributesImpl();
+
+
+
+ private ArrayList childs;
+
+ private ArrayList attributes;
+
+ private HashMap attributeIndex;
+
+
+
+
+
+ public ElementNode(String name, Collection constraints) {
+
+ super(name, constraints);
+
+ }
+
+
+
+ public void addAttribute(Node node) {
+
+ if (attributes == null) attributes = new ArrayList();
+
+ if (attributeIndex == null) attributeIndex = new HashMap();
+
+ attributes.add(node);
+
+ attributeIndex.put(node.getValue(), node);
+
}
//public Node getAttribute( String name ) {
//}
- public List getAttributes() {
- return (attributes);
- }
-
-
- public void addChild(Node node) {
- if (childs == null) childs = new ArrayList();
- childs.add(node);
- }
-
- public List getChilds() {
- return (childs);
+ public List getAttributes() {
+
+ return (attributes);
+
+ }
+
+
+
+
+
+ public void addChild(Node node) {
+
+ if (childs == null) childs = new ArrayList();
+
+ childs.add(node);
+
+ }
+
+
+
+ public List getChilds() {
+
+ return (childs);
+
}
//public List getChilds( String name ) {
//}
- public void toStringBuffer(StringBuffer sb, ElementNode e, int depth) {
- StringBuffer ident = new StringBuffer();
- for (int i = 0; i < depth * 3; i++) ident.append(" ");
-
- sb.append("\n").append(ident).append("<").append(e.getName());
-
-
- Collection attributes = e.getAttributes();
- if (attributes != null) {
- for (Iterator it = attributes.iterator(); it.hasNext();) {
- AttributeNode attr = (AttributeNode) it.next();
- attr.toStringBuffer(sb, depth);
- }
- }
-
- sb.append(">").append("\n").append(ident).append(" ");
-
- sb.append(String.valueOf(e.getValue()));
-
- Collection childs = e.getChilds();
- if (childs != null) {
- for (Iterator it = childs.iterator(); it.hasNext();) {
- ElementNode child = (ElementNode) it.next();
- toStringBuffer(sb, child, depth + 1);
- }
- }
- sb.append("\n").append(ident);
- sb.append("</").append(e.getName()).append(">");
- }
-
-
- public void toSAX(ContentHandler handler, ElementNode e, boolean
withConstraints) throws SAXException {
-
- handler.startElement("", e.getName(), e.getName(), NOATTR);
-
- if (e.getValue() != null)
handler.characters(e.getValue().toString().toCharArray(), 0,
e.getValue().length());
-
- if (withConstraints) {
- Collection constraints = e.getConstraints();
- if (constraints != null) {
- for (Iterator it = constraints.iterator(); it.hasNext();) {
- Constraint constraint = (Constraint) it.next();
-
- handler.startElement("", "constraint", "constraint", NOATTR);
- String s = String.valueOf(constraint.getId()) +
- " of type " + String.valueOf(constraint.getType()) +
- " is " + constraint.isSatisfiedBy(e.getValue(), null);
- handler.characters(s.toString().toCharArray(), 0, s.length());
- handler.endElement("", "constraint", "constraint");
- }
- }
- }
-
- Collection childs = e.getChilds();
- if (childs != null) {
- for (Iterator it = childs.iterator(); it.hasNext();) {
- ElementNode child = (ElementNode) it.next();
- toSAX(handler, child, withConstraints);
- }
- }
- handler.endElement("", getName(), e.getName());
- }
+ public void toStringBuffer(StringBuffer sb, ElementNode e, int depth) {
+
+ StringBuffer ident = new StringBuffer();
+
+ for (int i = 0; i < depth * 3; i++) ident.append(" ");
+
+
+
+ sb.append("\n").append(ident).append("<").append(e.getName());
+
+
+
+
+
+ Collection attributes = e.getAttributes();
+
+ if (attributes != null) {
+
+ for (Iterator it = attributes.iterator(); it.hasNext();) {
+
+ AttributeNode attr = (AttributeNode) it.next();
+
+ attr.toStringBuffer(sb, depth);
+
+ }
+
+ }
+
+
+
+ sb.append(">").append("\n").append(ident).append(" ");
+
+
+
+ sb.append(String.valueOf(e.getValue()));
+
+
+
+ Collection childs = e.getChilds();
+
+ if (childs != null) {
+
+ for (Iterator it = childs.iterator(); it.hasNext();) {
+
+ ElementNode child = (ElementNode) it.next();
+
+ toStringBuffer(sb, child, depth + 1);
+
+ }
+
+ }
+
+ sb.append("\n").append(ident);
+
+ sb.append("</").append(e.getName()).append(">");
+
+ }
+
+
+
+
+
+ public void toSAX(ContentHandler handler, ElementNode e, boolean
withConstraints) throws SAXException {
+
+
+
+ handler.startElement("", e.getName(), e.getName(), NOATTR);
+
+
+
+ if (e.getValue() != null)
handler.characters(e.getValue().toString().toCharArray(), 0,
e.getValue().length());
+
+
+
+ if (withConstraints) {
+
+ Collection constraints = e.getConstraints();
+
+ if (constraints != null) {
+
+ for (Iterator it = constraints.iterator(); it.hasNext();) {
+
+ Constraint constraint = (Constraint) it.next();
+
+
+
+ handler.startElement("", "constraint", "constraint", NOATTR);
+
+ String s = String.valueOf(constraint.getId()) +
+
+ " of type " + String.valueOf(constraint.getType()) +
+
+ " is " + constraint.isSatisfiedBy(e.getValue(), null);
+
+ handler.characters(s.toString().toCharArray(), 0, s.length());
+
+ handler.endElement("", "constraint", "constraint");
+
+ }
+
+ }
+
+ }
+
+
+
+ Collection childs = e.getChilds();
+
+ if (childs != null) {
+
+ for (Iterator it = childs.iterator(); it.hasNext();) {
+
+ ElementNode child = (ElementNode) it.next();
+
+ toSAX(handler, child, withConstraints);
+
+ }
+
+ }
+
+ handler.endElement("", getName(), e.getName());
+
+ }
+
}
1.5 +462 -231
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/InstanceImpl.java
Index: InstanceImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/InstanceImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InstanceImpl.java 4 Apr 2002 14:12:47 -0000 1.4
+++ InstanceImpl.java 6 Jun 2002 14:43:42 -0000 1.5
@@ -1,231 +1,462 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.dom.simple;
-
-
-import org.apache.cocoon.precept.*;
-import org.apache.cocoon.precept.Constraint;
-import org.apache.cocoon.precept.stores.dom.simple.Node;
-import org.apache.cocoon.precept.stores.AbstractInstance;
-
-import java.util.*;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.ComponentException;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
-public class InstanceImpl extends AbstractInstance {
- private HashMap index = new HashMap();
- private Preceptor preceptor;
- private ElementNode root;
-
- public void setPreceptor(Preceptor preceptor) {
- this.preceptor = preceptor;
- preceptor.buildInstance(this);
- }
-
- private Node createNode(String xpath) throws InvalidXPathSyntaxException {
- try {
- StringBuffer currentPath = new StringBuffer();
- StringTokenizer tok = new StringTokenizer(xpath, "/", false);
- Node currentParent = root;
- boolean first = true;
- while (tok.hasMoreTokens()) {
- String level = tok.nextToken();
- if (!first) {
- currentPath.append("/");
- }
- else {
- first = false;
- }
- if (level.endsWith("[1]")) {
- level = level.substring(0, level.length() - 3);
- }
- currentPath.append(level);
- Node node = (Node) index.get(currentPath.toString());
- if (node != null) {
- getLogger().debug("found node [" + String.valueOf(currentPath) +
"] in index");
- currentParent = node;
- }
- else {
- if (currentParent != null) {
- if (level.startsWith("@")) {
- if (level.indexOf("[") >= 0 || level.indexOf("]") >= 0) {
- throw new InvalidXPathSyntaxException(level);
- }
- if (preceptor != null) {
- node = new AttributeNode(level.substring(1),
preceptor.getConstraintsFor(currentPath.toString()));
- }
- else {
- node = new AttributeNode(level.substring(1), null);
- }
- getLogger().debug("creating attribute [" +
String.valueOf(currentPath) + "]");
- ((ElementNode) currentParent).addAttribute(node);
- index.put(currentPath.toString(), node);
- return (node);
- }
- else {
- if (preceptor != null) {
- node = new ElementNode(level,
preceptor.getConstraintsFor(currentPath.toString()));
- }
- else {
- node = new ElementNode(level, null);
- }
- getLogger().debug("creating node [" +
String.valueOf(currentPath) + "]");
- ((ElementNode) currentParent).addChild(node);
- index.put(currentPath.toString(), node);
- }
- }
- else {
- getLogger().debug("creating root node [" +
String.valueOf(currentPath) + "]");
- if (preceptor != null) {
- node = root = new ElementNode(level,
preceptor.getConstraintsFor(currentPath.toString()));
- }
- else {
- node = root = new ElementNode(level, null);
- }
- index.put(currentPath.toString(), node);
- }
- }
- currentParent = node;
- }
- return (currentParent);
- }
- catch (NoSuchNodeException e) {
- getLogger().error("hm.. this should not happen!");
- return (null);
- }
- }
-
- private Node lookupNode( String xpath ) {
- Node node = (Node) index.get(xpath);
- if (node == null) {
- node = (Node) index.get(xpath + "[1]");
- }
- return(node);
- }
-
- public void setValue(String xpath, Object value) throws
PreceptorViolationException, InvalidXPathSyntaxException {
- setValue(xpath, value, null);
- }
-
- public void setValue(String xpath, Object value, Context context) throws
PreceptorViolationException, InvalidXPathSyntaxException {
- Node node = lookupNode(xpath);
-
- if (node != null) {
- node.setValue((String) value);
- }
- else {
- if (preceptor != null) {
- getLogger().debug("checking preceptor for [" + String.valueOf(xpath)
+ "]");
- if (preceptor.isValidNode(xpath)) {
- node = createNode(xpath);
- node.setValue((String) value);
- }
- else {
- throw new PreceptorViolationException("[" + String.valueOf(xpath)
+ "] is prohibited by preceptor");
- }
- }
- else {
- getLogger().debug("no preceptor");
- node = createNode(xpath);
- node.setValue((String) value);
- }
- }
- }
-
- public Object getValue(String xpath) throws InvalidXPathSyntaxException,
NoSuchNodeException {
- Node node = lookupNode(xpath);
- if (node != null) {
- return (node.getValue());
- }
- else {
- throw new NoSuchNodeException(xpath);
- }
- }
-
- public Preceptor getPreceptor() {
- return (preceptor);
- }
-
- public long getLastModified() {
- //NYI
- return 0;
- }
-
- public void toSAX(ContentHandler handler, boolean constraints) throws
SAXException {
- if (root != null) {
- root.toSAX(handler, root, constraints);
- }
- }
-
- public String toString() {
- if (root != null) {
- StringBuffer sb = new StringBuffer();
- root.toStringBuffer(sb, root, 0);
- return (sb.toString());
- }
- else {
- return ("");
- }
- }
-
- public Collection getNodePaths() {
- return( Collections.unmodifiableCollection( index.keySet() ));
- }
-}
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.dom.simple;
+
+
+
+
+
+import org.apache.cocoon.precept.*;
+
+import org.apache.cocoon.precept.Constraint;
+
+import org.apache.cocoon.precept.stores.dom.simple.Node;
+
+import org.apache.cocoon.precept.stores.AbstractInstance;
+
+
+
+import java.util.*;
+
+
+
+import org.xml.sax.ContentHandler;
+
+import org.xml.sax.SAXException;
+
+import org.apache.avalon.framework.component.Composable;
+
+import org.apache.avalon.framework.component.ComponentManager;
+
+import org.apache.avalon.framework.component.ComponentException;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
+public class InstanceImpl extends AbstractInstance {
+
+ private HashMap index = new HashMap();
+
+ private Preceptor preceptor;
+
+ private ElementNode root;
+
+
+
+ public void setPreceptor(Preceptor preceptor) {
+
+ this.preceptor = preceptor;
+
+ preceptor.buildInstance(this);
+
+ }
+
+
+
+ private Node createNode(String xpath) throws InvalidXPathSyntaxException {
+
+ try {
+
+ StringBuffer currentPath = new StringBuffer();
+
+ StringTokenizer tok = new StringTokenizer(xpath, "/", false);
+
+ Node currentParent = root;
+
+ boolean first = true;
+
+ while (tok.hasMoreTokens()) {
+
+ String level = tok.nextToken();
+
+ if (!first) {
+
+ currentPath.append("/");
+
+ }
+
+ else {
+
+ first = false;
+
+ }
+
+ if (level.endsWith("[1]")) {
+
+ level = level.substring(0, level.length() - 3);
+
+ }
+
+ currentPath.append(level);
+
+ Node node = (Node) index.get(currentPath.toString());
+
+ if (node != null) {
+
+ getLogger().debug("found node [" + String.valueOf(currentPath) +
"] in index");
+
+ currentParent = node;
+
+ }
+
+ else {
+
+ if (currentParent != null) {
+
+ if (level.startsWith("@")) {
+
+ if (level.indexOf("[") >= 0 || level.indexOf("]") >= 0) {
+
+ throw new InvalidXPathSyntaxException(level);
+
+ }
+
+ if (preceptor != null) {
+
+ node = new AttributeNode(level.substring(1),
preceptor.getConstraintsFor(currentPath.toString()));
+
+ }
+
+ else {
+
+ node = new AttributeNode(level.substring(1), null);
+
+ }
+
+ getLogger().debug("creating attribute [" +
String.valueOf(currentPath) + "]");
+
+ ((ElementNode) currentParent).addAttribute(node);
+
+ index.put(currentPath.toString(), node);
+
+ return (node);
+
+ }
+
+ else {
+
+ if (preceptor != null) {
+
+ node = new ElementNode(level,
preceptor.getConstraintsFor(currentPath.toString()));
+
+ }
+
+ else {
+
+ node = new ElementNode(level, null);
+
+ }
+
+ getLogger().debug("creating node [" +
String.valueOf(currentPath) + "]");
+
+ ((ElementNode) currentParent).addChild(node);
+
+ index.put(currentPath.toString(), node);
+
+ }
+
+ }
+
+ else {
+
+ getLogger().debug("creating root node [" +
String.valueOf(currentPath) + "]");
+
+ if (preceptor != null) {
+
+ node = root = new ElementNode(level,
preceptor.getConstraintsFor(currentPath.toString()));
+
+ }
+
+ else {
+
+ node = root = new ElementNode(level, null);
+
+ }
+
+ index.put(currentPath.toString(), node);
+
+ }
+
+ }
+
+ currentParent = node;
+
+ }
+
+ return (currentParent);
+
+ }
+
+ catch (NoSuchNodeException e) {
+
+ getLogger().error("hm.. this should not happen!");
+
+ return (null);
+
+ }
+
+ }
+
+
+
+ private Node lookupNode( String xpath ) {
+
+ Node node = (Node) index.get(xpath);
+
+ if (node == null) {
+
+ node = (Node) index.get(xpath + "[1]");
+
+ }
+
+ return(node);
+
+ }
+
+
+
+ public void setValue(String xpath, Object value) throws
PreceptorViolationException, InvalidXPathSyntaxException {
+
+ setValue(xpath, value, null);
+
+ }
+
+
+
+ public void setValue(String xpath, Object value, Context context) throws
PreceptorViolationException, InvalidXPathSyntaxException {
+
+ Node node = lookupNode(xpath);
+
+
+
+ if (node != null) {
+
+ node.setValue((String) value);
+
+ }
+
+ else {
+
+ if (preceptor != null) {
+
+ getLogger().debug("checking preceptor for [" + String.valueOf(xpath)
+ "]");
+
+ if (preceptor.isValidNode(xpath)) {
+
+ node = createNode(xpath);
+
+ node.setValue((String) value);
+
+ }
+
+ else {
+
+ throw new PreceptorViolationException("[" + String.valueOf(xpath)
+ "] is prohibited by preceptor");
+
+ }
+
+ }
+
+ else {
+
+ getLogger().debug("no preceptor");
+
+ node = createNode(xpath);
+
+ node.setValue((String) value);
+
+ }
+
+ }
+
+ }
+
+
+
+ public Object getValue(String xpath) throws InvalidXPathSyntaxException,
NoSuchNodeException {
+
+ Node node = lookupNode(xpath);
+
+ if (node != null) {
+
+ return (node.getValue());
+
+ }
+
+ else {
+
+ throw new NoSuchNodeException(xpath);
+
+ }
+
+ }
+
+
+
+ public Preceptor getPreceptor() {
+
+ return (preceptor);
+
+ }
+
+
+
+ public long getLastModified() {
+
+ //NYI
+
+ return 0;
+
+ }
+
+
+
+ public void toSAX(ContentHandler handler, boolean constraints) throws
SAXException {
+
+ if (root != null) {
+
+ root.toSAX(handler, root, constraints);
+
+ }
+
+ }
+
+
+
+ public String toString() {
+
+ if (root != null) {
+
+ StringBuffer sb = new StringBuffer();
+
+ root.toStringBuffer(sb, root, 0);
+
+ return (sb.toString());
+
+ }
+
+ else {
+
+ return ("");
+
+ }
+
+ }
+
+
+
+ public Collection getNodePaths() {
+
+ return( Collections.unmodifiableCollection( index.keySet() ));
+
+ }
+
+}
+
1.4 +134 -67
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/Node.java
Index: Node.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/precept/stores/dom/simple/Node.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Node.java 4 Apr 2002 07:02:09 -0000 1.3
+++ Node.java 6 Jun 2002 14:43:42 -0000 1.4
@@ -1,72 +1,133 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- [EMAIL PROTECTED]
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.precept.stores.dom.simple;
-
+/*
+
+
+
+ ============================================================================
+
+ The Apache Software License, Version 1.1
+
+ ============================================================================
+
+
+
+ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
+
+
+
+ Redistribution and use in source and binary forms, with or without modifica-
+
+ tion, are permitted provided that the following conditions are met:
+
+
+
+ 1. Redistributions of source code must retain the above copyright notice,
+
+ this list of conditions and the following disclaimer.
+
+
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+
+ this list of conditions and the following disclaimer in the documentation
+
+ and/or other materials provided with the distribution.
+
+
+
+ 3. The end-user documentation included with the redistribution, if any, must
+
+ include the following acknowledgment: "This product includes software
+
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+
+ Alternately, this acknowledgment may appear in the software itself, if
+
+ and wherever such third-party acknowledgments normally appear.
+
+
+
+ 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
+
+ used to endorse or promote products derived from this software without
+
+ prior written permission. For written permission, please contact
+
+ [EMAIL PROTECTED]
+
+
+
+ 5. Products derived from this software may not be called "Apache", nor may
+
+ "Apache" appear in their name, without prior written permission of the
+
+ Apache Software Foundation.
+
+
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+ This software consists of voluntary contributions made by many individuals
+
+ on behalf of the Apache Software Foundation and was originally created by
+
+ Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
+
+ Software Foundation, please see <http://www.apache.org/>.
+
+
+
+*/
+
+
+
+package org.apache.cocoon.precept.stores.dom.simple;
+
+
+
import org.apache.cocoon.precept.Context;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Collection;
-
-/*
- * @version: Mar 14, 2002
- * @author: Torsten Curdt <[EMAIL PROTECTED]>
- */
+import java.util.HashMap;
+
+import java.util.Collection;
+
+
+
+/*
+
+ * @version: Mar 14, 2002
+
+ * @author Torsten Curdt <[EMAIL PROTECTED]>
+
+ */
+
public abstract class Node {
protected String name;
protected String value;
protected Collection constraints;
-
+
+
public Node( String name, Collection constraints) {
this.name = name;
this.constraints = constraints;
@@ -76,15 +137,21 @@
return(name);
}
- public String getValue() {
- return(value);
- }
+ public String getValue() {
+
+ return(value);
+
+ }
+
public void setValue( String value ) {
- this.value = value;
+ this.value = value;
+
}
public Collection getConstraints() {
return(constraints);
- }
-}
+ }
+
+}
+
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]