Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Buckminster » proper matcher syntax?
proper matcher syntax? [message #647113] Tue, 04 January 2011 16:25 Go to next message
Eric Gwin is currently offline Eric GwinFriend
Messages: 10
Registered: July 2009
Junior Member
I've got a base URL that points to a directory that contains OSGi bundles and jars my project needs to compile. I'm having difficulty writing a URL reader rule that works.
If I use a static URI format, I can use buckminster.component to get part of the filename, but cannot find a way to represent the rest of the filename.

Using a matcher as outlined in the manual is giving me:
What is the ERROR   [0001] : org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:matcher'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":property, "http://www.eclipse.org/buckminster/RMap-1.0":propertyElement, "http://www.eclipse.org/buckminster/RMap-1.0":documentation, "http://www.eclipse.org/buckminster/RMap-1.0":digest, "http://www.eclipse.org/buckminster/RMap-1.0":versionConverter}' is expected.: http://download.eclipse.org/rt/eclipselink/bucktest/eclipselink.rmap at line: 16 column: 97
Errors and Warnings
E [0001] : org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:matcher'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":property, "http://www.eclipse.org/buckminster/RMap-1.0":propertyElement, "http://www.eclipse.org/buckminster/RMap-1.0":documentation, "http://www.eclipse.org/buckminster/RMap-1.0":digest, "http://www.eclipse.org/buckminster/RMap-1.0":versionConverter}' is expected.: http://download.eclipse.org/rt/eclipselink/bucktest/eclipselink.rmap at line: 16 column: 97: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:matcher'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":property, "http://www.eclipse.org/buckminster/RMap-1.0":propertyElement, "http://www.eclipse.org/buckminster/RMap-1.0":documentation, "http://www.eclipse.org/buckminster/RMap-1.0":digest, "http://www.eclipse.org/buckminster/RMap-1.0":versionConverter}' is expected.


On the assumtion that I need a property, propertyElement, documentation, or versionConverter sibling defined, I added a versionConverter sibling. It generates:
ERROR   [0001] : org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:versionConverter'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":matcher, "http://www.eclipse.org/buckminster/RMap-1.0":uri}' is expected.: http://download.eclipse.org/rt/eclipselink/bucktest/eclipselink.rmap at line: 15 column: 37
Errors and Warnings
E [0001] : org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:versionConverter'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":matcher, "http://www.eclipse.org/buckminster/RMap-1.0":uri}' is expected.: http://download.eclipse.org/rt/eclipselink/bucktest/eclipselink.rmap at line: 15 column: 37: cvc-complex-type.2.4.a: Invalid content was found starting with element 'rm:versionConverter'. One of '{"http://www.eclipse.org/buckminster/RMap-1.0":matcher, "http://www.eclipse.org/buckminster/RMap-1.0":uri}' is expected.


I must be missing something basic (and probably obvious) but I'm at a lost how to proceed. Buckminster is not yet even complaining about the probably ridiculously malformed values I've got inserted.

Provider section of rmap is below:
    <rm:provider componentTypes="osgi.bundle,jar" readerType="url" source="false" mutable="false" resolutionFilter="">
      <rm:versionConverter type=""/>
      <rm:uri format="${matchedURL}"/>
      <rm:matcher base="http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/bmpc/plugins">
        <rm:match name="matchedURL" pattern="[a-zA-Z0-9_\.\-]+" prefix="http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/bmpc/plugins/"/>
        <rm:name name="" pattern="${buckminster.component}_[a-zA-Z0-9_\.\-]+" prefix="http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/bmpc/plugins"/>
      </rm:matcher>
    </rm:provider>


Any help would be appreciated.
P.S. The manual is very helpful, but more examples are needed.

-Eric
Re: proper matcher syntax? [message #647186 is a reply to message #647113] Tue, 04 January 2011 21:45 Go to previous messageGo to next message
Alan Underwood is currently offline Alan UnderwoodFriend
Messages: 37
Registered: October 2010
Member
Eric

I found this a real problem too. The only way I found around it was to place the <matcher> element before the <uri> element.

Even then I had to set the uri format to something dodgey that would return null - pretty sure that's a bug!

Alan
Re: proper matcher syntax? [message #647297 is a reply to message #647186] Wed, 05 January 2011 15:38 Go to previous messageGo to next message
Eric Gwin is currently offline Eric GwinFriend
Messages: 10
Registered: July 2009
Junior Member
Thanks Alan! Just as you said, moving the URI after the matcher removed the syntax errors. It seems like a bug to me as well, since it was the editor that put them in the original order. I'm just not certain where the bug lies, in matcher code, or in the editor.

Can anyone confirm that
a) there is a bug here?
b) whether it has been filed?

My matcher is still not working however, and I'm running into a conceptual block again as far as the matcher section of the bucky book is concerned (pgs 45-46).
Either the URL reader needs a single URL that specifically points to a single jar, and the metadata extracting elements are only used to parse details about the jar from the URL string (ie. you need a reader specific to every jar/URL you may need) - this seems wrong, but is how I'm interpreting the manual, or
the URL reader can magikly parse through multiple URLs - this is also unlikely, given the errors below:
ERROR   [0001] : java.lang.IllegalArgumentException: can't parse argument number matchedURL
Errors and Warnings
E [0001] : java.lang.IllegalArgumentException: can't parse argument number matchedURL: can't parse argument number matchedURL

When the rmap reader looks like:
    <rm:provider componentTypes="osgi.bundle" readerType="url" source="false" mutable="false">
      <rm:matcher base="http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/bmpc/plugins">
        <rm:match name="matchedURL" pattern="(.+)?"/>
      </rm:matcher>
      <rm:uri format="${matchedURL}"/>
    </rm:provider>

or the URL reader needs a single URL that will match the component requirements, and the metadata extracting elements act both to set metadata, and to select a single URL. However, without a way to link the component name and version range being searched for with the regular expression matching I'm led back to conclusion 1 that a URL reader is needed for every possible URL based component because I cannot seem to use property substitution in name children of the matcher.

can anyone post an example of a matcher that works?

Thanks.

-Eric
Re: proper matcher syntax? [message #647308 is a reply to message #647297] Wed, 05 January 2011 16:08 Go to previous messageGo to next message
Matthew Webber is currently offline Matthew WebberFriend
Messages: 198
Registered: December 2010
Senior Member
There are a number of outstanding problems where the rmap editor does not follow the schema. The only solution I am aware of is, as you have discovered, to fix up the generated XML by hand.

Could you please update https://bugs.eclipse.org/bugs/show_bug.cgi?id=330498 with any new examples of this problem that you find.

Matthew
Re: proper matcher syntax? [message #647311 is a reply to message #647113] Wed, 05 January 2011 16:14 Go to previous message
Alan Underwood is currently offline Alan UnderwoodFriend
Messages: 37
Registered: October 2010
Member
Eric

My rmap is a bit like this

    <rm:provider componentTypes="osgi.bundle" readerType="url" source="false" mutable="false">
      <rm:matcher base="http://my.hudson/project1/artifacts/outputjars/">
        <rm:group name="matched.url">
          <rm:name pattern="com\.au\.\w+" prefix="http://my.hudson/project1/artifacts/outputjars/" suffix=""/>
          <rm:version pattern="\d+\.\d+\.\d+" prefix="_" suffix=".jar"/>
        </rm:group>
      </rm:matcher>
      <rm:uri format="{0}">
        <bc.propertyRef key="matched.url"/>
      </rm:uri>
    </rm:provider>


Note the <rm:uri> element is buggy. I get null exceptions but it works...
HTH

Alan
Previous Topic:list of internal properties?
Next Topic:Understanding uptodatepolicy
Goto Forum:
  


Current Time: Wed Apr 24 20:20:07 GMT 2024

Powered by FUDForum. Page generated in 0.02648 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top