unico 2003/11/21 03:37:48
Modified:
src/blocks/repository/java/org/apache/cocoon/components/source/impl
XPathSourceInspector.java
SourceDescriptorManager.java
AbstractImageSourceInspector.java
src/blocks/repository/java/org/apache/cocoon/components/source
SourceInspector.java
Log:
add handlesProperty method
Revision Changes Path
1.5 +5 -2
cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/XPathSourceInspector.java
Index: XPathSourceInspector.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/XPathSourceInspector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathSourceInspector.java 31 Oct 2003 12:49:06 -0000 1.4
+++ XPathSourceInspector.java 21 Nov 2003 11:37:48 -0000 1.5
@@ -70,7 +70,7 @@
import org.xml.sax.SAXException;
/**
- * This source inspector inspects XML files with a xpath expression
+ * This source inspector inspects XML files with a xpath expression.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Unico Hommes</a>
@@ -170,6 +170,9 @@
return null;
}
+ public boolean handlesProperty(String namespace, String name) {
+ return this.propertynamespace.equals(namespace) &&
this.propertyname.equals(name);
+ }
}
1.6 +18 -2
cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/SourceDescriptorManager.java
Index: SourceDescriptorManager.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/SourceDescriptorManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SourceDescriptorManager.java 31 Oct 2003 12:49:06 -0000 1.5
+++ SourceDescriptorManager.java 21 Nov 2003 11:37:48 -0000 1.6
@@ -77,7 +77,7 @@
import org.apache.excalibur.source.impl.validity.AggregatedValidity;
/**
- * This source descriptor acts as container for a set of source inspectors.
+ * This source descriptor acts as container for a set of source
inspectors/descriptors.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Unico Hommes</a>
@@ -193,6 +193,22 @@
}
}
return (SourceProperty[]) result.toArray(new
SourceProperty[result.size()]);
+ }
+
+ /**
+ * Check if there is an inspector that handles properties of
+ * the given type.
+ */
+ public boolean handlesProperty(String namespace, String name) {
+ SourceInspector inspector;
+ final Iterator inspectors = m_inspectors.iterator();
+ while(inspectors.hasNext()) {
+ inspector = (SourceInspector) inspectors.next();
+ if (inspector.handlesProperty(namespace,name)) {
+ return true;
+ }
+ }
+ return false;
}
/**
1.2 +1 -1
cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/AbstractImageSourceInspector.java
Index: AbstractImageSourceInspector.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/impl/AbstractImageSourceInspector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractImageSourceInspector.java 27 Oct 2003 09:31:28 -0000 1.1
+++ AbstractImageSourceInspector.java 21 Nov 2003 11:37:48 -0000 1.2
@@ -124,7 +124,7 @@
/**
* Check whether this inspector handles properties of the given kind.
*/
- private final boolean handlesProperty(String namespace, String name) {
+ public final boolean handlesProperty(String namespace, String name) {
return namespace.equals(PROPERTY_NS) &&
(name.equals(IMAGE_WIDTH_PROPERTY_NAME) ||
name.equals(IMAGE_HEIGHT_PROPERTY_NAME));
1.4 +11 -2
cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceInspector.java
Index: SourceInspector.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/components/source/SourceInspector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SourceInspector.java 27 Oct 2003 09:30:07 -0000 1.3
+++ SourceInspector.java 21 Nov 2003 11:37:48 -0000 1.4
@@ -70,7 +70,7 @@
* by the requested namespace and name.
*
* @param source the source for which to compute the property
- * @param namespace the namespace uri of the property
+ * @param namespace the namespace of the property
* @param name the name of the property
* @return the SourceProperty associated with the Source,
<code>null</code>
* if the inspector does not provide this property.
@@ -89,5 +89,14 @@
*/
public SourceProperty[] getSourceProperties(Source source) throws
SourceException;
+ /**
+ * Check if this inspector handles the property of the given type.
+ *
+ * @param namespace the namespace of the property
+ * @param name the name of the property
+ * @return <code>true</code> if this inspector handles properties of
the given type
+ * else <code>false</code>.
+ */
+ public boolean handlesProperty(String namespace, String name);
}