[rules-users] Use Knowledge Agent

esteban.aliverti at gmail.com esteban.aliverti at gmail.com
Thu Oct 28 08:19:15 EDT 2010


You need to create a change-set containing basic authentication parameters.
This change-set could then point to the change-set hosted in guvnor (or any
of its resources). Here is an example of a change-set using basic
authentication pointing to a package resource:

<change-set>
    <add>
        <resource source='
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST
'
type='PKG' *basicAuthentication="enabled" username="admin" password="admin"
*
/>
    </add>
</change-set>

Best,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2010/10/27 developer researcher <java.developer.researcher at gmail.com>

>      Hello,
>
>      I am trying of follow the instructions of: 1.4.8.1. The Knowledge
> Agent in '
> http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-guvnor/html_single/index.html
> '
>
>      I see that after of create the snapshots are generated several URLs:
>
> - URL for package documentation
> - URL for package source
> - URL for package binary
> - URL for running tests
> - Change Set: '
> http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples/ChangeSet.xml
> '
>
>      I need consume a rule from a java application. I can download the file
> 'ChangeSet.xml' using the credentials (user="admin" and password="") but I
> get a HTTP 401 error even when I use the same credentials in my code. I
> attached the code and the exception.
>
>  Thanks and regards,
>
> 2010/10/26 developer researcher <java.developer.researcher at gmail.com>
>
>      Hi all,
>>
>> I am using Drools Guvnor as follows:
>>
>> 1º Security configuration:
>>
>> <security:identity
>> authenticate-method="#{defaultAuthenticator.authenticate}"/>
>> <security:role-based-permission-resolver
>> enable-role-based-authorization="true"/>
>>
>> 2º User permission: an user as administrator with permissions of:
>> - Analyst for 'category=examples'
>> - package.developer for 'package=org.examples'
>>
>> What additional configuration is needed to consume a rules from an
>> application using a 'Knowledge Agent'?
>>
>> Someone has an example or tutorial to use of 'Knowledge Agent'?
>>
>> I hope someone can help me in this issue that is critical to use drools in
>> a real project. I attached the related files.
>>
>> Thanks and regards,
>>
>> 2010/10/22 developer researcher <java.developer.researcher at gmail.com>
>>
>> Hello Michael,
>>>
>>> I included the code for authentication but occurs a new exception. I
>>> think that is by configuration of Guvnor.
>>>
>>> I attached the exception and the log of guvnor. I hope you can help me.
>>>
>>> Thanks and regards,
>>>
>>> 2010/10/21 Michael Anstis <michael.anstis at gmail.com>
>>>
>>> Hi,
>>>>
>>>> #2
>>>>
>>>> You could try setting the basicAuthentication, Username and Password
>>>> properties on UrlResource before adding it to the builder:-
>>>>
>>>> <snip>
>>>>     builder.add(ResourceFactory.newUrlResource(url), ResourceType.PKG);
>>>> </snip>
>>>>
>>>> <snip>
>>>>     UrlResource urlResource = ResourceFactory.newUrlResource(url);
>>>>     urlResource.setBasicAuthentication("enabled");
>>>>     urlResource.setUsername("Smurf");
>>>>     urlResource.setPassword("Smurfy");
>>>>     builder.add(urlResource, ResourceType.PKG);
>>>> </snip>
>>>>
>>>> When you shift to using change-sets you should be able to embed the
>>>> basic authentication in the change-set.xml file (as per my previous link) -
>>>> your example code isn't using KnowledgeAgent yet; simply a URL resource.
>>>>
>>>>
>>>> 2010/10/21 developer researcher <java.developer.researcher at gmail.com>
>>>>
>>>> Hello Michael and Subhas, thanks for your answers.
>>>>>
>>>>> Apparently the problem is due to permission. I am using the next
>>>>> configuration:
>>>>>
>>>>> <security:identity
>>>>> authenticate-method="#{defaultAuthenticator.authenticate}"/>
>>>>> <security:role-based-permission-resolver
>>>>> enable-role-based-authorization="true"/>
>>>>>
>>>>> I attached the class that use for my test, in this code not included
>>>>> code for authenticate. In that sense I have new questions:
>>>>>
>>>>> 1º What is the minimal configuration of Guvnor for use the Knowledge
>>>>> Agent?
>>>>>
>>>>> 2º What code should be included for authentication?
>>>>>
>>>>> Thanks and regards,
>>>>>
>>>>> 2010/10/20 Subhas <subhas.sing at gmail.com>
>>>>>
>>>>> Give some more details like code and jars in build path. I use
>>>>>> KnowledgeBase and working fine for me.
>>>>>>
>>>>>> Thanks,
>>>>>> Subhas
>>>>>>
>>>>>>
>>>>>> On Wed, Oct 20, 2010 at 12:54 PM, java.developer.researcher <
>>>>>> java.developer.researcher at gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am trying of integrate Drools Guvnor with an java web application.
>>>>>>> I am
>>>>>>> using KnowledgeAgent, but occurs the next exception when execute the
>>>>>>> code:
>>>>>>>
>>>>>>> java.lang.RuntimeException: java.io.IOException: Server returned HTTP
>>>>>>> response code: 401 for URL:
>>>>>>>
>>>>>>> http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples
>>>>>>>        at
>>>>>>>
>>>>>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
>>>>>>>        at
>>>>>>>
>>>>>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>>>>>>>        at
>>>>>>>
>>>>>>> org.examples.test.TestKnowledgeAgent.getKnowledgeBase(TestKnowledgeAgent.java:63)
>>>>>>>        at
>>>>>>> org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:28)
>>>>>>> Caused by: java.io.IOException: Server returned HTTP response code:
>>>>>>> 401 for
>>>>>>> URL:
>>>>>>>
>>>>>>> http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples
>>>>>>>        at
>>>>>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
>>>>>>> Source)
>>>>>>>        at
>>>>>>> org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:76)
>>>>>>>        at
>>>>>>>
>>>>>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:512)
>>>>>>>        ... 3 more
>>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>>>        at
>>>>>>> org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:37)
>>>>>>>
>>>>>>>     What is the cause of this exception? How can I solved it?
>>>>>>>
>>>>>>> Any help is welcome.
>>>>>>>
>>>>>>> Regards,
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://drools-java-rules-engine.46999.n3.nabble.com/Use-Knowledge-Agent-tp1741354p1741354.html
>>>>>>> Sent from the Drools - User mailing list archive at Nabble.com.
>>>>>>> _______________________________________________
>>>>>>> rules-users mailing list
>>>>>>> rules-users at lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing list
>>>>>> rules-users at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101028/e329ec5f/attachment.html 


More information about the rules-users mailing list