In Guvnor you have to create a Model also in your specific packages and select "import from global area". Then you have to go to the configuration of the package and add the classes you want to use in your package.

Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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


On Thu, Dec 22, 2011 at 5:05 AM, srinivasasanda <srinivasasanda@gmail.com> wrote:
Hi Salaboy,
       I have a problem please give me some solution..


packagelisturl=http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/webdav/packages
               (which show the list of package ==>
                                                       Contents of this
Folder:
                                                       defaultPackage
                                                       mortgages
                                                       sample
                                                       demo

               Storeing the result in buffered reader, and manuplateing the
eachline and adding all the package to the kbuilder()

packageurl=http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/


...............................................................................................................

System.out.println(GlobalConfig.getConfigParameterValue("packagelisturl"));
               URL packages = new
URL(GlobalConfig.getConfigParameterValue("packagelisturl"));
               URLConnection yc = packages.openConnection();
               BufferedReader in = new BufferedReader(new
InputStreamReader(yc.getInputStream()));
               String inputLine;
               inputLine = in.readLine();
               System.out.print("inputLine"+inputLine);
               while ((inputLine = in.readLine()) != null)
                        {
                               System.out.print("inputLine"+inputLine);
                               String
urlstr=GlobalConfig.getConfigParameterValue("packageurl")+""+inputLine+"/LATEST";
                               URL url = new URL(urlstr);
                               UrlResource urlResource =
(UrlResource)ResourceFactory.newUrlResource(url);

urlResource.setBasicAuthentication("enabled");
                               urlResource.setUsername("admin");
                               urlResource.setPassword("admin");
                               _kbuilder.add(urlResource,
ResourceType.PKG);
                               System.out.println("added pacakges into
_kbuilder"+urlstr);
                        }
               in.close();
 ......................................................... some other code
to fire rules.....

                   This code works fine with simple java application and
geting the result.

                   but when i try to use this in some web application , the
packages are not adding to kbuilder  and it shows the following error


2011-12-21 20:31:01,819 INFO  [STDOUT] (http-127.0.0.1-8080-5) after
creating kbuilder
2011-12-21 20:31:01,819 INFO  [STDOUT] (http-127.0.0.1-8080-5)
http://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/webdav/packages
2011-12-21
20:31:01,819 INFO  [STDOUT] (http-127.0.0.1-8080-4) INFO  21-12
20:31:01,819 (NilAuthenticator.java:authenticate:35) All users are guests.
2011-12-21 20:31:01,819 INFO  [STDOUT] (http-127.0.0.1-8080-4) INFO  21-12
20:31:01,819 (RepositoryServlet.java:allowUser:114) null authenticated for
rest api
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5)
inputLineContents of this Folder:
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5)
inputLinedefaultPackage
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) added
pacakges into
_kbuilderhttp://localhost:8080/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) Provider
org.drools.io.impl.ResourceProviderImpl could not be set.
2011-12-21 20:31:01,835 ERROR [org.in.treetech.bss.common.cache]
(http-127.0.0.1-8080-5)  RuleEngine  234  Provider
org.drools.io.impl.ResourceProviderImpl could not be set.
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) After adding
packages
2011-12-21 20:31:01,835 ERROR [org.in.treetech.bss.common.cache]
(http-127.0.0.1-8080-5)  RuleEngine  173  Provider
org.drools.impl.KnowledgeBaseProviderImpl could not be set.
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) After
creation of Kbase
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) FactName
issample-person
2011-12-21 20:31:01,835 ERROR [org.in.treetech.bss.common.cache]
(http-127.0.0.1-8080-5)  RuleEngine  390  null
2011-12-21 20:31:01,835 INFO  [STDOUT] (http-127.0.0.1-8080-5) Rule engine
ended


So for helped  a lot Thanks , Thank u very much,

Regards & Thanks
Srinivasaprasad


--
View this message in context: http://drools.46999.n3.nabble.com/How-to-make-available-declarative-model-to-all-packages-tp3605644p3605810.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users