You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ts...@apache.org on 2005/04/25 22:09:27 UTC

svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java

Author: tschlabach
Date: Mon Apr 25 13:09:26 2005
New Revision: 164636

URL: http://svn.apache.org/viewcvs?rev=164636&view=rev
Log:
added a link to the RelaxNG schema to the Avalon service configuration

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java?rev=164636&r1=164635&r2=164636&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java Mon Apr 25 13:09:26 2005
@@ -66,6 +66,24 @@
         return this.name;
     }
 
+    private String schemaDefinition;
+    
+	/**
+	 * @return Returns the path to the RelaxNG schema file
+	 * for this resource type
+	 */
+	public String getSchemaDefinition() {
+		return schemaDefinition;
+	}
+	/**
+	 * @param schemaDefinition The path to the RelaxNG schema
+	 * definition file
+	 */
+	public void setSchemaDefinition(String schemaDefinition) {
+		this.schemaDefinition = schemaDefinition;
+	}
+    
+    
     private ParentChildCreatorInterface creator = null;
 
 	/**
@@ -162,6 +180,5 @@
     public String toString() {
         return getName();
     }
-
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java?rev=164636&r1=164635&r2=164636&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java Mon Apr 25 13:09:26 2005
@@ -81,6 +81,10 @@
      */
     public static final String TYPE_ATTRIBUTE = "type";
     /**
+     * <code>SCHEMA_ELEMENT</code> The RelaxNG schema element
+     */
+    public static final String SCHEMA_ELEMENT = "schema";
+    /**
      * <code>CREATOR_ELEMENT</code> The creator element
      */
     public static final String CREATOR_ELEMENT = "creator";
@@ -162,6 +166,13 @@
 
                 if (doctypeConf == null) {
                     throw new DocumentTypeBuildException("No definition found for doctype '" + name);
+                }
+
+                Configuration schemaConf = doctypeConf.getChild(SCHEMA_ELEMENT, false);
+
+                if (schemaConf != null) {
+                    String schemaFileName = schemaConf.getAttribute(SRC_ATTRIBUTE);
+                    type.setSchemaDefinition(schemaFileName);
                 }
 
                 ParentChildCreatorInterface creator;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 -

Posted by Torsten Schlabach <ts...@apache.org>.
Andreas,

>> Before defining some "schema format identifiers", I'd rather look
>> for existing approaches.

Agreed. Tell me where to find any. (This is meant serious!)

>> BTW, is it even possible to register source factories
>> for URNs? The o.a.e.source javadocs aren't very clear about
>> this issue:

Sure. I am currently about to do this. Compare:

http://wiki.apache.org/lenya/Sitemap2JavaApiContractProposal

Didn't we discuss this already on this list? Not sure.

What I am not sure about is (and this is general questions to Internet
standards, not to Avalon or Lenya):

a) Do URNs start with urn:? Which would be correct:

urn:isbn:0-743-45681-5

or just

isbn:0-743-45681-5

b) How do I specify further what I want from a resource? If I was to
implement an isbn source for example, would it return the content of the
book or the metadata (title, author, publisher, price) for example?

I see no reason why you couldn't have an Avalon source for URNs and it
makes a lot of sense to me. You can start some discussion about how the
URN will resolve to a URL at the end of the day, because it ultimately has
to if you want to read from it. It's hard to generate SAX events from an
abstract concept. But in some places it makes a lot of sense not to say
WHERE something should be but WHAT you want to reference.

Regards,
Torsten



> Michael Wechner wrote:
>> Torsten Schlabach wrote:
>>
>>> Andreas,
>>>
>>>
>>>
>>>> I agree that this functionality is useful. But IMO we can't restrict
>>>> it to RelaxNG (e.g., Xopus requires XSD AFAIK).
>>>>
>>>
>>>
>>> I have been thinking about this as well. I agree that we should not
>>> necessarily limit this to RelaxNG, but one method can only return one
>>> type
>>> of structure definition unless you do something like
>>>
>>> public String getSchemaDefinition(String format) {
>>> ...
>>> }
>>>
>>>
>>
>> is this causing a problem by specifying a format?
>
> I guess this was just an example of a "configurable" getSchemaDefinition()
> method. Before defining some "schema format identifiers", I'd rather look
> for existing approaches.
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.ja va /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBui lderImpl.java)

Posted by Andreas Hartmann <an...@apache.org>.
Michael Wechner wrote:
> Torsten Schlabach wrote:
> 
>> Andreas,
>>
>>  
>>
>>> I agree that this functionality is useful. But IMO we can't restrict
>>> it to RelaxNG (e.g., Xopus requires XSD AFAIK).
>>>   
>>
>>
>> I have been thinking about this as well. I agree that we should not
>> necessarily limit this to RelaxNG, but one method can only return one 
>> type
>> of structure definition unless you do something like
>>
>> public String getSchemaDefinition(String format) {
>> ...
>> }
>>  
>>
> 
> is this causing a problem by specifying a format?

I guess this was just an example of a "configurable" getSchemaDefinition()
method. Before defining some "schema format identifiers", I'd rather look
for existing approaches.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 -

Posted by Michael Wechner <mi...@wyona.com>.
Torsten Schlabach wrote:

>Michi,
>
>  
>
>>>is this causing a problem by specifying a format?
>>>      
>>>
>
>I don't understand the question.
>  
>

I seemed to me that you are hesitant about specifying a format and
was curious what the reason for this. No harm meant ;-)

Apart from how we actually want to do it I think it's very important that
we allow more than one "schema definition".

Michi


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 -

Posted by Torsten Schlabach <ts...@apache.org>.
Michi,

>> is this causing a problem by specifying a format?

I don't understand the question.

Regards,
Torsten


> Torsten Schlabach wrote:
>
>>Andreas,
>>
>>
>>
>>>I agree that this functionality is useful. But IMO we can't restrict
>>>it to RelaxNG (e.g., Xopus requires XSD AFAIK).
>>>
>>>
>>
>>I have been thinking about this as well. I agree that we should not
>>necessarily limit this to RelaxNG, but one method can only return one
>> type
>>of structure definition unless you do something like
>>
>>public String getSchemaDefinition(String format) {
>>...
>>}
>>
>>
>
> is this causing a problem by specifying a format?
>
> Michi
>
>
> --
> Michael Wechner
> Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
> http://www.wyona.com                      http://lenya.apache.org
> michael.wechner@wyona.com                        michi@apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.ja va /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBui lderImpl.java)

Posted by Michael Wechner <mi...@wyona.com>.
Torsten Schlabach wrote:

>Andreas,
>
>  
>
>>I agree that this functionality is useful. But IMO we can't restrict
>>it to RelaxNG (e.g., Xopus requires XSD AFAIK).
>>    
>>
>
>I have been thinking about this as well. I agree that we should not
>necessarily limit this to RelaxNG, but one method can only return one type
>of structure definition unless you do something like
>
>public String getSchemaDefinition(String format) {
>...
>}
>  
>

is this causing a problem by specifying a format?

Michi


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema (was Re: svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.ja va /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBui lderImpl.java)

Posted by Andreas Hartmann <an...@apache.org>.
Torsten Schlabach wrote:

[...]

> But I need to think through if it shouldn't be
> 
> 
>>Furthermore, we're moving away from files. Could this be replaced by
>>
>> > +	/**
>> > +	 * @return Returns the URL of the RelaxNG schema
>> > +	 * for this resource type
>> > +	 */
>> > +	public String getSchemaURL() {
>> > +		return schemaUrl;
>> > +	}
> 
> 
> Note the one letter that makes the difference.

Yes, this will probably be more appropriate. I generally use
URI because of the compatibility to the SourceResolver's method
signatures. BTW, is it even possible to register source factories
for URNs? The o.a.e.source javadocs aren't very clear about
this issue:

"Source factories are used to extend the source resolving mechanism with
new URI schemes. A new source factory is added in order to handle a
specific prototol."

They're talking about URIs and about schemes/protocols, which would
restrict them to URLs IIUC. Is there more documentation about this
topic apart from http://excalibur.apache.org/sourceresolve/index.html?

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Torsten Schlabach wrote:
>>>it's called JARV

> But IIUC in the case of BXE it would be BXE that would have to be changed
> to use this, not Lenya. But it might come in handy in places where it is
> left to Lenya to validate a document.
> 
> But in BXE (and probably also for other editors) the role of the schema is
> not only to validate but also to instruct the editor on possible moves,
> i.e. what elements are valid as children of a given element, for example.

right. which is why i think we need both JARV validation and a facility 
to return a schema

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema

Posted by Torsten Schlabach <ts...@apache.org>.
>> it's called JARV

>> http://issues.apache.org/bugzilla/show_bug.cgi?id=33587

>> a common API for document validation which we should use for all
>> situations where we validate.

Thanks for the reference.

But IIUC in the case of BXE it would be BXE that would have to be changed
to use this, not Lenya. But it might come in handy in places where it is
left to Lenya to validate a document.

But in BXE (and probably also for other editors) the role of the schema is
not only to validate but also to instruct the editor on possible moves,
i.e. what elements are valid as children of a given element, for example.

Regards,
Torsten


> Torsten Schlabach wrote:
>
>>>Is there a generic
>>>description for document structure definitions? IIRC Gregor mentioned
>>>something like that recently.
>
> it's called JARV
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=33587
>
> a common API for document validation which we should use for all
> situations where we validate.
>
>> If that's the case please post it again.
>>
>> I am not happy at all with the current implementation for several
>> reasons:
>>
>> - I was thinking of maybe converting between structure definitions on
>> demand
>> - I don't like files as well. I would envision more of an intelligent
>> structure defintions registry.
>> - etc.
>>
>> At this point in time I needed the method because I am still working on
>> BXE 2.0 integration and I wanted to establish a clear contract how an
>> editor fetches the schema definiton from the API. My idea was that the
>> API
>> could be changed (enhanced) at any time later on.
>
> BXE calls that URL to get a stream of the schema, so maybe we might just
> return the schema as a byte stream?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: How the editor get's a schema

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Torsten Schlabach wrote:

>>Is there a generic
>>description for document structure definitions? IIRC Gregor mentioned
>>something like that recently.

it's called JARV

http://issues.apache.org/bugzilla/show_bug.cgi?id=33587

a common API for document validation which we should use for all 
situations where we validate.

> If that's the case please post it again.
> 
> I am not happy at all with the current implementation for several reasons:
> 
> - I was thinking of maybe converting between structure definitions on demand
> - I don't like files as well. I would envision more of an intelligent
> structure defintions registry.
> - etc.
> 
> At this point in time I needed the method because I am still working on
> BXE 2.0 integration and I wanted to establish a clear contract how an
> editor fetches the schema definiton from the API. My idea was that the API
> could be changed (enhanced) at any time later on.

BXE calls that URL to get a stream of the schema, so maybe we might just 
return the schema as a byte stream?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


How the editor get's a schema (was Re: svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.ja va /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBui lderImpl.java)

Posted by Torsten Schlabach <ts...@apache.org>.
Andreas,

> I agree that this functionality is useful. But IMO we can't restrict
> it to RelaxNG (e.g., Xopus requires XSD AFAIK).

I have been thinking about this as well. I agree that we should not
necessarily limit this to RelaxNG, but one method can only return one type
of structure definition unless you do something like

public String getSchemaDefinition(String format) {
...
}

> Is there a generic
> description for document structure definitions? IIRC Gregor mentioned
> something like that recently.

If that's the case please post it again.

I am not happy at all with the current implementation for several reasons:

- I was thinking of maybe converting between structure definitions on demand
- I don't like files as well. I would envision more of an intelligent
structure defintions registry.
- etc.

At this point in time I needed the method because I am still working on
BXE 2.0 integration and I wanted to establish a clear contract how an
editor fetches the schema definiton from the API. My idea was that the API
could be changed (enhanced) at any time later on.

> Furthermore, we're moving away from files. Could this be replaced by
>
>  > +	/**
>  > +	 * @return Returns the URI of the RelaxNG schema source
>  > +	 * for this resource type
>  > +	 */
>  > +	public String getSchemaURI() {
>  > +		return schemaUri;
>  > +	}

ACK.

Probably.

But I need to think through if it shouldn't be

> Furthermore, we're moving away from files. Could this be replaced by
>
>  > +	/**
>  > +	 * @return Returns the URL of the RelaxNG schema
>  > +	 * for this resource type
>  > +	 */
>  > +	public String getSchemaURL() {
>  > +		return schemaUrl;
>  > +	}

Note the one letter that makes the difference.

Regards,
Torsten


> tschlabach@apache.org wrote:
>
> [...]
>
>> +	/**
>> +	 * @return Returns the path to the RelaxNG schema file
>> +	 * for this resource type
>> +	 */
>> +	public String getSchemaDefinition() {
>> +		return schemaDefinition;
>> +	}
>
> I agree that this functionality is useful. But IMO we can't restrict
> it to RelaxNG (e.g., Xopus requires XSD AFAIK). Is there a generic
> description for document structure definitions? IIRC Gregor mentioned
> something like that recently.
>
> Another remark:
>
> IMO the notion "path to ..." is not really suitable for a method
> signature. We have this for instance in the revision controller,
> you never know where the path is supposed to start.
> Furthermore, we're moving away from files. Could this be replaced by
>
>  > +	/**
>  > +	 * @return Returns the URI of the RelaxNG schema source
>  > +	 * for this resource type
>  > +	 */
>  > +	public String getSchemaURI() {
>  > +		return schemaUri;
>  > +	}
>
> where schemaUri might be something like
>
>      context://lenya/pubs/<pub-id>/config/doctypes/schemas/foo.rng
>
> ?
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: svn commit: r164636 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentType.java /lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentTypeBuilderImpl.java

Posted by Andreas Hartmann <an...@apache.org>.
tschlabach@apache.org wrote:

[...]

> +	/**
> +	 * @return Returns the path to the RelaxNG schema file
> +	 * for this resource type
> +	 */
> +	public String getSchemaDefinition() {
> +		return schemaDefinition;
> +	}

I agree that this functionality is useful. But IMO we can't restrict
it to RelaxNG (e.g., Xopus requires XSD AFAIK). Is there a generic
description for document structure definitions? IIRC Gregor mentioned
something like that recently.

Another remark:

IMO the notion "path to ..." is not really suitable for a method
signature. We have this for instance in the revision controller,
you never know where the path is supposed to start.
Furthermore, we're moving away from files. Could this be replaced by

 > +	/**
 > +	 * @return Returns the URI of the RelaxNG schema source
 > +	 * for this resource type
 > +	 */
 > +	public String getSchemaURI() {
 > +		return schemaUri;
 > +	}

where schemaUri might be something like

     context://lenya/pubs/<pub-id>/config/doctypes/schemas/foo.rng

?

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org