Where is MinaTaskClient ?
by Gustavo Tenrreiro
Hi,
I am trying to connect to the mina server using the MinaTaskClient
referred in the documentation; however the class does not seem to
exist.
I got the latest Drools 5.1 download.
In any case how can I connect to the server in order to retrieve the tasks ?
I see the TaskClient has the methods I need, but I am not sure how to
create one, and everything I ve tried fails to retrieve a working
TaskClient.
I appreciate your help.
Thanks
14 years, 3 months
A truly sibylline method
by Wolfgang Laun
Ancient Sibyls, such as the famous Pythia, frequently responded to
supplicants' questions in a dark and mysterious way. (Croesus, for instance,
was told that attacking the Persians would "destroy a great empire"; that
this could also mean his own did not occur to him.)
I was reminded of this by looking at the Javadoc for the
org.drools.time.SessionClock method getCurrentTime, which is documented to
return a long value, albeit explicitly stating that the semantics of this
value is not defined and that an implementation of this interface may do as
it pleases.
All that's needed to clear this oracular obfuscation is another method,
giving the number of nanoseconds per unit of the getCurrentTime return
value. Why ever has this not been added?
-W
14 years, 3 months
Temporal operator "after"
by Wolfgang Laun
According to the Fusion manual, "after" is used like this:
$eventA : Foo(...)
$eventB : Bar( this after[0ms,1h] $eventA )
provided Foo and Bar have @role(event).
This works.
But, given a class Wrapper( Foo foo ), the pattern combination
Wrapper( $eventA : foo )
$eventB : Bar( this after[0ms,1h] $eventA )
results in a class cast exception at runtime, telling me that a Foo cannot
be cast to a org.drools.common.EventFactHandle.
Working around this by doing
Wrapper( $foo: foo )
$eventA : Foo( this == $foo )
$eventB : Bar( this after[0ms,1h] $eventA )
solves the problem, but is this really necessary and intentional? (The
documentation doesn't even hint at such a restriction.)
-W
14 years, 3 months
generate an image of the instance the process
by Eugenio Abello
hi, I working with drools flow 5.1, and i want generate an image of the
instance the process, in the same way the gwt-console. I revice
org.drools.integration.console.graph.GraphViewerPluginImpl, but I can not
see how do..... there is some code of sample?
thanks
14 years, 3 months
fireUntilHalt() and OSGi - CPU load
by Georg Maier
Hi,
I am using Drools 5.1 (final) in an OSGi environment. When invoking
fireUntilHalt() for my StatefulKnowledgeSession, CPU load rises to 25%
(meaning one complete core on the quad-core machine). Needless to say, when
two sessions are used in different components at the same time I'm reaching
about 50%.
When creating an "ordinary" Drools project and using a
StatefulKnowledgeSession with fireUntilHalt() I do not experience this
problem.
Anyone experienced something similar or has some advice for me?
Any help would be highly appreciated :-)
Thanks in advance!
Cheers,
Georg
14 years, 3 months
[planner] curriculum course timetable modeling questions
by Joshua Daniel
Hi,
I am a newbie and am currently in the process of evaluating the drools
solver module for generating a timetable. I have couple of questions in this
regard...
1. I have two curriculums (Grade 1 - A, Grade 1 - B) and would like to
allocate a single room for all courses under a curriculum. How do I specify
this constraint?
2. Currently the rules are specified for a single week (i.e. period / time
slot list). How do I specify this for an entire year, does it mean I have to
create additional period / time slot lists for the entire year.
3. There are 5 days and 3 periods per day (i.e. 15 sessions per week) and we
have 6 common subjects and a separate course (German, French) specific to
the curriculum, assuming we equally distribute the load (i.e. if I want all
the courses to be atleast twice a week and just the separate courses
(German, French) to be thrice a week, what should be the lesson size.
Env: I have installed drools-5.0-solver and verifying the above attached XML
via the curriculumcourse sample data.
-jd
14 years, 3 months
Design of Rule Engine
by Manav
Hi,
I am using the 5.x version of Drools and currently new. I am currently
evaluating Drools for an internal
project .
The product's impressive and the support is absolutely superb.
To design a new Rule Engine using Drools as the base are there any
suggested design patters that i can take a look at ? If there are any best
practices that should be followed and gotchas to be avoided it would be
great if i could read about them.
For example if i am writing rules where two files contain a common set of rules,
is it possible to abstract out the common set of rules to a seperate DRL and
have that DRL referenced in other DRL's ?
These and other similar questions are what i am seeking answers to .
Regards,
Manav
14 years, 3 months
Firing Mulitple packages
by Vignesh
Hi,
We tried with a properties file with url of the set of package names in the
applicaiton and by iterating this file and fired the rules with out any
issues, but I want to know whether there is any way to fire all the rules in
multiple packages present in a Guvnor application using any built-in
methods?
Thanks in advance.
Regards,
Vignesh
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Mulitple-packa...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months
persisting a stateful session
by chris
Hi there,
I apologize in advance if this seems like a trivial question, but I can't
seem to figure out what the issue is. i am trying to serialize a stateful
session to file in a very simple test program. So I am using the code from
Michael Bali's book to define a stateful drools session:
//
package sertest;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import org.drools.KnowledgeBase;
import org.drools.common.DroolsObjectInputStream;
import org.drools.common.DroolsObjectOutputStream;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.marshalling.Marshaller;
import org.drools.marshalling.MarshallerFactory;
import org.drools.marshalling.ObjectMarshallingStrategy;
import org.drools.marshalling.ObjectMarshallingStrategyAcceptor;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.FactHandle;
/**
*
*
*/
public class DroolsService implements Serializable
{
private static final long serialVersionUID = 3L;
private transient KnowledgeBase knowledgeBase;
private transient StatefulKnowledgeSession statefulSession;
public DroolsService( KnowledgeBase knowledgeBase )
{
this.knowledgeBase = knowledgeBase;
statefulSession = createKnowledgeSession();
}
private StatefulKnowledgeSession createKnowledgeSession()
{
StatefulKnowledgeSession session =
knowledgeBase.newStatefulKnowledgeSession();
return session;
}
public void insertOrUpdate( Object fact )
{
if( fact == null )
{
return;
}
FactHandle factHandle = statefulSession.getFactHandle( fact );
if( factHandle == null )
{
statefulSession.insert( fact );
}
else
{
statefulSession.update( factHandle, fact );
}
}
public void executeRules()
{
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newFileLogger(statefulSession,
"accessPackageLog");
statefulSession.fireAllRules();
logger.close();
}
public void terminate()
{
statefulSession.dispose();
}
private void writeObject( ObjectOutputStream out ) throws IOException
{
out.defaultWriteObject();
DroolsObjectOutputStream droolsOut = new DroolsObjectOutputStream(
(OutputStream) out );
droolsOut.writeObject( knowledgeBase );
Marshaller marshaller = createSerializableMarshaller( knowledgeBase
);
marshaller.marshall( droolsOut, statefulSession );
}
private void readObject( ObjectInputStream in ) throws IOException,
ClassNotFoundException
{
in.defaultReadObject();
DroolsObjectInputStream droolsIn = new DroolsObjectInputStream(
(InputStream) in );
this.knowledgeBase = (KnowledgeBase) droolsIn.readObject();
Marshaller marshaller = createSerializableMarshaller( knowledgeBase
);
statefulSession = marshaller.unmarshall( droolsIn );
}
private Marshaller createSerializableMarshaller( KnowledgeBase
knowledgeBase )
{
ObjectMarshallingStrategyAcceptor acceptor =
MarshallerFactory.newClassFilterAcceptor(
new String[]
{
"*.*"
} );
ObjectMarshallingStrategy strategy =
MarshallerFactory.newSerializeMarshallingStrategy( acceptor );
Marshaller marshaller = MarshallerFactory.newMarshaller(
knowledgeBase,
new ObjectMarshallingStrategy[]
{
strategy
} );
return marshaller;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In the test client I just do the following:
//
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
DroolsService droolsService = new DroolsService( kbase );
File file = new File("out.ser");
ObjectOutputStream oos = new ObjectOutputStream(
new FileOutputStream(file));
oos.writeObject(droolsService);
oos.close();
///////////////////////////////////////////////////////////////////
The code then trows an exception:
Exception in thread "main" java.io.IOException: Write error
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:260)
at
java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1838)
at
java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1747)
at
java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1249)
at
java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1203)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1538)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329)
at sertest.Main.main(Main.java:30)
If I take out the last 2 lines in the writeObject method above (i.e. don't
use a marshaller to write out the stateful session) then there is no
exception.
Any ideas what might be causing this??
Kind regards,
Chris
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/persisting-a-stateful...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 3 months