<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 2011/5/6 2:33, Vincent LEGENDRE wrote:
    <blockquote
cite="mid:1987860130.10886.1304620421028.JavaMail.root@confiance.eurodecision.fr"
      type="cite">
      <style type="text/css">p { margin: 0; }</style>
      <div style="font-family: Times New Roman; font-size: 12pt; color:
        rgb(0, 0, 0);">
        <div style="margin-left: 40px;"><span style="font-style:
            italic;">I am not sure if I understand you correctly. You
            want to return a compiled package binary based on certain
            criteria or you want to return individual assets based on
            certain criteria? </span><br>
        </div>
        The main objective is the first one : get compiled package
        including filtred assert on certain criteria<br>
        But if I can do the second (get all assets having certain
        criteria), I can compile it myself.<br>
        <br>
        <div style="margin-left: 40px;"> <span style="font-style:
            italic;">If its the former, you can do this through Guvnor
            REST API (to be precise, it is the new JAX-RS based REST
            api). In this case, you dont provide filters through the
            URL. When you hit the REST URL for example </span><a
            moz-do-not-send="true" style="font-style: italic;"
            class="moz-txt-link-freetext"
            href="http://localhost:8080/drools-guvnor/rest/packages/mortgage"
            target="_blank">http://localhost:8080/drools-guvnor/rest/packages/mortgage</a><span
            style="font-style: italic;">, the REST service will first
            check if this package's binary is up-to-date. If not, it
            will build the package first, then return compiled binary.
            It is the Guvnor selector in charge of which assets get into
            the build. At the moment, we dont have a REST API to control
            which selector is taking effect during the build, but if
            this is what you need, I am sure we can figure this out.</span><br>
        </div>
        It is exactly that : be able to choose the filter used to
        compile the package.<br>
        <br>
        <br>
        <div style="margin-left: 40px;"><span style="font-style:
            italic;">If what you want is to return individual assets,
            you can send a HTTP GET request to URL </span><a
            moz-do-not-send="true" style="font-style: italic;"
            class="jive-link-wiki-small"
            href="http://community.jboss.org/docs/DOC-16217"
            target="_blank">http://host:portnumber/drools-guvnor/rest/packages/mortgage/assets</a><span
            style="font-style: italic;"> with
            Accept="application/atom+xml", this returns a list of assets
            under the mortgage package in Atom feed format. </span><br
            style="font-style: italic;">
          <em>...</em><br style="font-style: italic;">
          <span style="font-style: italic;">For example a GET request to
          </span><a moz-do-not-send="true" style="font-style: italic;"
            class="jive-link-wiki-small"
            href="http://community.jboss.org/docs/DOC-16217"
            target="_blank">http://host:portnumber/</a><a
            moz-do-not-send="true" style="font-style: italic;"
            class="jive-link-external-small"
            href="http://localhost:9080/repository/packages/testPackage1/assets"
            target="_blank">drools-guvnor/rest</a><a
            moz-do-not-send="true" style="font-style: italic;"
            class="jive-link-external-small"
href="http://localhost:9080/repository/packages/packageName/asset/testAsset2"
            target="_blank">/packages/mortgage/assets</a><a
            moz-do-not-send="true" style="font-style: italic;"
            class="jive-link-wiki-small"
            href="http://community.jboss.org/docs/DOC-16217"
            target="_blank">/testAsset1</a><span style="font-style:
            italic;"> with Accept="application/atom+xml" returns an atom
            entry which is the meta data info of that asset. </span><br>
        </div>
        The links you provide and these sample seems really great to
        access some internal values of repository, and even do updates
        to programmatically ... but ... I can't get it work ... may be I
        hit my limits on web-base things here ... So lots of questions :<br>
          - I don't understand when you say "with
        Accept="application/atom+xml" : what is "with" ? URL parameters
        like  <a moz-do-not-send="true" class="jive-link-wiki-small"
          href="http://community.jboss.org/docs/DOC-16217"
          target="_blank">http://host:portnumber/drools-guvnor/rest/packages/mortgage/assets</a>?Accept="application/atom+xml"   
        ? Guess not according to what you say after. So what is "with",
        how do you provide these args to the URL ?<br>
      </div>
    </blockquote>
    <big><big>This is an example code of how you set up HTTP headers on
        your client side:<br>
        <br>
                URL url = new URL(</big></big><a moz-do-not-send="true"
      style="font-style: italic;" class="moz-txt-link-freetext"
      href="http://localhost:8080/drools-guvnor/rest/packages/mortgage"
      target="_blank"><big><big>"</big></big>http://localhost:8080/drools-guvnor/rest/packages/mortgage</a><span
      style="font-style: italic;"></span><big><big>");<br>
                HttpURLConnection connection =
        (HttpURLConnection)url.openConnection();<br>
                connection.setRequestMethod("GET");<br>
                connection.setRequestProperty("Accept",
        MediaType.APPLICATION_ATOM_XML);<br>
                connection.connect();<br>
                assertEquals (200, connection.getResponseCode());<br>
                assertEquals(MediaType.APPLICATION_ATOM_XML,
        connection.getContentType());<br>
      </big></big><br>
    <blockquote
cite="mid:1987860130.10886.1304620421028.JavaMail.root@confiance.eurodecision.fr"
      type="cite">
      <div style="font-family: Times New Roman; font-size: 12pt; color:
        rgb(0, 0, 0);">  - when I try the URL given "as this" ( <a
          moz-do-not-send="true" class="jive-link-wiki-small"
          href="http://community.jboss.org/docs/DOC-16217"
          target="_blank">http://host:portnumber/drools-guvnor/rest/packages/mortgage/assets</a>
        ) tomcat replies that there is no service. I get something to
        work with this URL <a moz-do-not-send="true" href="">http://localhost:8080/drools-5.2.0.M1-guvnor/org.drools.guvnor.Guvnor/api/packages/mortgages</a> 
        , ie adding "org.drools.guvnor.Guvnor", with "api" instead of
        "rest", and without "assets" (which tells me that the "assets"
        is not a valid path). Does this mean that I am not running the
        correct version ? Need to deploy something else ? Need to
        configure something ?<br>
        <br>
      </div>
    </blockquote>
    In your case the URL should be <a moz-do-not-send="true"
      href="about:blank">http://localhost:8080/drools-5.2.0.M1-guvnor/rest/packages/mortgages/assets</a><br>
    The new JAX-Rs based REST interface is available from 5.2.0.M1. The
    URL starts with <a moz-do-not-send="true" href="about:blank">http://localhost:8080/drools-5.2.0.M1-guvnor/org.drools.guvnor.Guvnor/api/</a>
    etc is the old non-Jax-RS based implementation and will be
    deprecated later. <br>
    <br>
    <a moz-do-not-send="true" href="about:blank"></a>
    <blockquote
cite="mid:1987860130.10886.1304620421028.JavaMail.root@confiance.eurodecision.fr"
      type="cite">
      <div style="font-family: Times New Roman; font-size: 12pt; color:
        rgb(0, 0, 0);">   - with my URL form, I can get the content of a
        package (raw text, one resource by line) like this :<br>
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">drools.package=2008-09-30T03:36:29,1</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">MortgageModel.model.drl=2008-10-22T22:01:14,6</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">Underage.brl=2008-10-01T04:54:34,2</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">...</span><br>
        <br>
           - or one rule
        (<a class="moz-txt-link-freetext" href="http://localhost:8080/drools-5.2.0.M1-guvnor/org.drools.guvnor.Guvnor/api/packages/mortgages/RegexDslRule.brl">http://localhost:8080/drools-5.2.0.M1-guvnor/org.drools.guvnor.Guvnor/api/packages/mortgages/RegexDslRule.brl</a>)
        :<br>
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">&lt;rule&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;"> 
          &lt;name&gt;RegexDslRule&lt;/name&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;"> 
          &lt;modelVersion&gt;1.0&lt;/modelVersion&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;"> 
          &lt;attributes/&gt;</span><br style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;"> 
          &lt;metadataList/&gt;</span><br style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">  &lt;lhs&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">   
          &lt;dslSentence&gt;</span><br style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">     
          &lt;sentence&gt;When the ages is less than 
          {57:1?[0-9]?[0-9]}&lt;/sentence&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">   
          &lt;/dslSentence&gt;</span><br style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">  &lt;/lhs&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">  &lt;rhs/&gt;</span><br
          style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">
        <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">&lt;/rule&gt;</span><br>
        I noticed a  <span style="font-family: Courier
          New,courier,monaco,monospace,sans-serif;">metadataList </span>there,
        but empty ... and I explicitely set some metadata in that rule
        in guvnor before query it. What should go there ? Annotations ?<br>
        <br>
        <div style="margin-left: 40px; font-style: italic;">JAX-RS does
          support query using URL like <a moz-do-not-send="true"
            class="jive-link-wiki-small"
            href="http://community.jboss.org/docs/DOC-16217"
            target="_blank">http://host:portnumber/drools-guvnor/rest/packages/mortgage/assets</a>?category=foo&amp;category=bar&amp;status=prod

          (and several other query mechanisms). But we have not
          implemented query in Guvnor yet. Of course you will be very
          welcome if you want to help ;-)<br>
        </div>
        Yep why not ... if you don't find my previous questions too
        stupid :)<br>
        For now we will try to make the business user arrange their
        rules directly in different packages and then query the package
        "as usual" for each rule app we have<br>
        But it is quite sure that this won't fit their needs in a real
        living application where rules numbers will grow .... as for
        rule apps<br>
        <br>
        Thanks a lot for you time anyway</div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>