[rules-users] How to read XML using XMLPackageReader-Drools-compiler.5.2.1.final?

2011-11-17 Thread Praveen
Hi,

I am using Drools-compiler.5.2.1.final.
I am trying to convert an drl to xml and vice versa using DrlParser,
DrlDumper, XMLPackageReader and XML Dumper.
Drl to XML conversion works fine but XML to Drl throws NPE.
I have placed the XML file under a folder called sample.
NPE is thrown at line 5..
Also attached is the exception.
Please suggest.
TIA.

Reader source = new InputStreamReader(

DroolsConversionHelper.class.getResourceAsStream(xmlFileName));
  
PackageBuilderConfiguration conf = new 
PackageBuilderConfiguration();
XmlPackageReader reader = new
XmlPackageReader(conf.getSemanticModules());
DrlDumper dumper = new DrlDumper();
//line 5reader.read(source);
PackageDescr descr = reader.getPackageDescr();
String test = dumper.dump(descr);
System.out.println(test);



java.lang.NullPointerException
at
org.drools.xml.ExtensibleXmlParser.resolveSchema(ExtensibleXmlParser.java:696)
at
org.drools.xml.ExtensibleXmlParser.resolveEntity(ExtensibleXmlParser.java:622)
at
com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntity(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.resolveDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)



Regards,
Praveen.


--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-read-XML-using-XMLPackageReader-Drools-compiler-5-2-1-final-tp3515778p3515778.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


[rules-users] How to use RepositorySessionUtil.getRepository()?

2011-11-14 Thread Praveen
Hi All,

I am using below piece of code from a standalone system to access the Rules
repository.

RulesRepository repository = RepositorySessionUtil.getRepository();

But we are getting RulesRepository Exception as below:

org.drools.repository.RulesRepositoryException
at
org.drools.repository.RepositorySessionUtil.getRepository(RepositorySessionUtil.java:69)
at TestSample.main(TestSample.java:45)

Do we need to initialise something before using the above piece of code?
Please suggest, TIA.

Regards,
Praveen.





 

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-use-RepositorySessionUtil-getRepository-tp3506714p3506714.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


[rules-users] Help needed - Repository not getting initialised?

2011-11-13 Thread Praveen
Hi,

Repository is not getting initialised, throws NPE.
Please advise.
TIA.

public static Repository repository;

public static Session getSession() throws Exception {
return getSession(true);
}

public static synchronized Session getSession(boolean erase) {
try {
if (repository == null) {

if (erase) {
File repoDir = new File(repository);
System.out.println(DELETE test repo dir: 
+ repoDir.getAbsolutePath());
RepositorySessionUtil.deleteDir(repoDir);
System.out.println(TEST repo dir deleted.);
}

JCRRepositoryConfigurator config = new
JackrabbitRepositoryConfigurator();
String home = System
.getProperty(guvnor.repository.dir);
  
repository = config.getJCRRepository(home);

Session testSession = repository
.login(new SimpleCredentials(alan_parsons,
password.toCharArray()));

RulesRepositoryAdministrator admin = new
RulesRepositoryAdministrator(
testSession);
if (erase  admin.isRepositoryInitialized()) {

admin.clearRulesRepository();
}
config.setupRulesRepository(testSession);
return testSession;
} else {
return repository.login(new SimpleCredentials(
alan_parsons, password.toCharArray()));
}
} catch (RepositoryException e) {
throw new IllegalStateException(e);
}

}

public static void main(String [] args) throws Exception{
getSession();
}


Below is the exception..

DELETE test repo dir: D:\drools\TestRepository\repository
TEST repo dir deleted.
Exception in thread main java.lang.NullPointerException: dispatcher
at
org.apache.jackrabbit.core.observation.ObservationManagerImpl.init(ObservationManagerImpl.java:97)
at
org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager(WorkspaceImpl.java:748)
at
org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners(SessionImpl.java:1193)
at org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:1222)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2194)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2149)
at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1175)
at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1127)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:544)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:366)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:231)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:279)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:375)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
at Hello.getSession(Hello.java:50)
at Hello.getSession(Hello.java:27)
at Hello.main(Hello.java:72)


Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-Repository-not-getting-initialised-tp3506064p3506064.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


[rules-users] NPE while creating Session using SimpleCredentials

2011-11-10 Thread Praveen
Hi,

I am getting NPE at line 3, I doubt if SimpleCredentials is an issue over
here.
Please provide inputs if someone has faced the same.


try {
Repository repository = configurator.getJCRRepository(
repositoryHomeDirectory );
Credentials credentials = new SimpleCredentials(admin,
admin.toCharArray());
//line 3  Session session = repository.login(credentials,
production);
Node node = session.getRootNode();
System.out.println(root node path:  + node.getPath());
} catch (Exception e) {
e.printStackTrace();
}

TIA.

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/NPE-while-creating-Session-using-SimpleCredentials-tp3496768p3496768.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


[rules-users] RulesRepository usage - jar incompatibility issue

2011-11-09 Thread Praveen
Hi,

I am trying to use RulesRepository to create a package and copy required
assets (by using their uuid) into the created package.

Below is the code snippet and the corresponding stack trace of the run-time
exception being thrown.
I would like to know the appropriate lucene-core jar to be used to get rid
of the below exception.
I have tried lucene-core 2.3, 2.4, 2.9 and 3.4 till now, none solved this.

static Repository repository;
/**
 * @param args
 * @throws RepositoryException 
 * @throws LoginException 
 */
public static void main(String[] args) throws LoginException,
RepositoryException {

repository=getRepositoryHandle();
Session session=repository.login();
RulesRepository rulesRepository=new RulesRepository(session);   
PackageItem 
packageItem=rulesRepository.createPackage(newPackage,
newPackageDescription);
String
hello=rulesRepository.copyAsset(f51858e0-b9b2-44c7-863c-44e5680bb1b3,
newPackage, newPackage);
System.out.println(packageItem);
System.out.println(hello);

}

private static Repository getRepositoryHandle(){
if (repository == null)
repository = new
TransientRepository(classpath:repository.xml,praveen/repository);
return repository;  
}



Exception in thread main java.lang.NoClassDefFoundError:
org/apache/lucene/search/SortComparatorSource
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
org.apache.jackrabbit.core.config.BeanConfig.newInstance(BeanConfig.java:177)
at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(RepositoryConfigurationParser.java:631)
at
org.apache.jackrabbit.core.config.RepositoryConfig.getQueryHandler(RepositoryConfig.java:1032)
at 
org.apache.jackrabbit.core.SearchManager.init(SearchManager.java:174)
at
org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(RepositoryImpl.java:630)
at
org.apache.jackrabbit.core.RepositoryImpl.access$100(RepositoryImpl.java:124)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(RepositoryImpl.java:1860)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize(RepositoryImpl.java:2095)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:2000)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:533)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:342)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:605)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:232)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:111)
at TestRepository.main(TestRepository.java:22)

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Where-in-DB-does-Guvnor-store-description-of-rules-tp3489816p3495831.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


[rules-users] Where in DB does Guvnor store description of rules?

2011-11-08 Thread Praveen
Hi,

Our application expects rule name and its description to be displayed in the
UI and both of
these are to be retrieved from DB.
We are aware that Guvnor stores rules in DB, not sure of the description
part.
If someone could throw light on how to get description/comments (that was
entered through Guvnor)
in UI would be great.

Initially we had the idea of parsing comments in drl.
However we saw that the description entered through Guvnor while writing  a
rule does not show up in the generated source code.

TIA.

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Where-in-DB-does-Guvnor-store-description-of-rules-tp3489816p3489816.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


Re: [rules-users] Where in DB does Guvnor store description of rules?

2011-11-08 Thread Praveen
Thanks Mike and Patel.

We also intend to provide the flexibility of choosing some rules and use
them to build a drl/XML.

Let me explain the scenario.
The UI would be displaying all the rules, say 10.
The app user may select any number of rules(random) as appropriate to
his/her project, now we would like to pick only these selected rules from DB
and pack it into a drl/XML.

Any help in this regard would be great.
TIA.

Regards,
Praveen.


 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Where-in-DB-does-Guvnor-store-description-of-rules-tp3489816p3492668.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


[rules-users] How to parse comments in drl file using DrlParser?

2011-11-04 Thread Praveen
Hi,

The system we are building requires rulenames and rule
description(comments) to be displayed in the UI(built using JQuery).
I am using DrlParser to convert the drl(generated using Guvnor) to XML so
that it could be used to display in the UI.
However, the comments written in drl are not visible in the converted XML.
Please let me know how to parse comments using DrlParser so that I can use
it to display as rule description.

Thanks  Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-parse-comments-in-drl-file-using-DrlParser-tp3479895p3479895.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


[rules-users] How can Drools Planner consume Guvnor generated drl file?

2011-10-31 Thread Praveen
Hi,

We are trying to build a system where drools planner consumes drl from the
Guvnor.
The planner doesnot use Knowledgebase built on ChangeSet.xml which is a
conventional way 
of using drl from Guvnor in Java apps.

Please let us know the details of how we can achieve this .
Also how can we get rid of the Config xml that we use in the planner.

Thanks  Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-can-Drools-Planner-consume-Guvnor-generated-drl-file-tp3467722p3467722.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


Re: [rules-users] Accumulate and Collect issue - Guvnor 5.2 Final

2011-10-28 Thread Praveen Kumar
Thanks Mike! It works.

Regards,
Praveen.

2011/10/28 Michael Anstis michael.ans...@gmail.com

 I assume you have not tried adding the import?

 Select the package, edit the package, add an import for java.util.List.


 On 28 October 2011 10:55, Michael Anstis michael.ans...@gmail.com wrote:



 -- Forwarded message --
 From: praveen.sa...@gmail.com
 Date: 28 October 2011 10:48
 Subject: Accumulate and Collect issue - Guvnor 5.2 Final



 Hi,

 We gave a try with 5.2 Final version, and see that all collect clauses
 appears in grey and are not editable (such conditions are also not
 deletable). Everything was OK with the M2 version (rules were edited with
 this version).

 It is quite strange because all the collect condition is greyed, just
 like a disabled field, and seems to be done by purpose. Is collect
 deprecated ?


 http://drools.46999.n3.nabble.com/rules-users-Guvnor-5-2-CR1-problem-with-collect-in-guided-editor-td3062287.html
 Above Forum link says to import what is required into the package
 definition.

 Could you please provide a detailed step-by-step procedure to get this
 accomplished. Our intention is to get all the Collection types in the Guvnor
 UI.

 Thanks  Regards,
 Praveen.



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
praveen kumar
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-20 Thread Praveen
Hello,

Anyone out there who has come across the above issue?

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3437459.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


[rules-users] Help needed - how to get Number and intValue in Guvnor

2011-10-18 Thread Praveen
Hello,

I am new to Drools and trying to write rules using Guvnor GUI.
I have uploaded POJO's that are required for my rules.
I am facing issue trying to get Number()(the one in Bold-Italics) and
intValue in the Guvnor GUI.
Below is the rule for reference, its taken from one of the examples provided
in Drools Planner.


// Accumulate hard constraints
rule hardConstraintsBroken
salience -1 // Do the other rules first (optional, for performance)
when
$hardTotal : */Number(/)* from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight) // Vote for
http://jira.jboss.com/jira/browse/JBRULES-1075
)
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-how-to-get-Number-and-intValue-in-Guvnor-tp3430730p3430730.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