KnowledgeBaseEvent on KnowledgeAgent
                                
                                
                                
                                    
                                        by Mohamed BEN AYED
                                    
                                
                                
                                        
Hi,
I have 2 questions:
1) I used KnowledgeAgent as following
 KnowledgeBase kbase=KnowledgeBaseFactory.newKnowledgeBase();
KnowledgeAgent  agent =
KnowledgeAgentFactory.newKnowledgeAgent("myagent",kbase,aconf);
when I do, StatefulKnowledgeSession session
=kbase.newStatefulKnowledgeSession();
               session.firAllRules();
nothing is happening! ==> so I should add kbase=agent.getKnowledgeBAse();
what's the meaning of "kbase" in KnowledgeAgent parameters??
2) I am trying to use KnowledgeBaseEventListener. I add this line,
kbase.addKnwledgeBaseEventListener(new .....) but I didn't have any result
why?
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeBaseEvent-on...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        StatelessKnowledgeSessionImpl.execute does not call dispose() method
                                
                                
                                
                                    
                                        by Σάββας Τριανταφύλλου
                                    
                                
                                
                                        Hi, 
I have noticed that StatelessKnowledgeSessionImpl.execute (5.1.0.M1) methods do not call dispose() 
method in contrary to the documentation (http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht...)
3.3.7. StatelessKnowledgeSession
The StatelessKnowledgeSession wraps the StatefulKnowledgeSession, instead of extending it. Its main focus is on decision service type scenarios. It avoids the need to call dispose(). Stateless sessions do not support iterative insertions and the method call fireAllRules() from Java code; the act of calling execute() is a single-shot method that will internally instantiate a StatefulKnowledgeSession, add all the user data and execute user commands, call fireAllRules(), and then call dispose().
Is this a bug or has something  changed between version 5.0.1 and 5.1.0 ?
BR, 
Savvas Triantafyllou
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Re: [rules-dev] Append the Logs For the events Fired
                                
                                
                                
                                    
                                        by mamadou.ensi
                                    
                                
                                
                                        
public class LogDrools(){
public Logger mylogger = Logger.getLogger("file.log");
public void logInfo(String message, Object[] object){
String m ="";
m.append(message);
for(int i=0;i<object.size();i++){
m.append(":--:",objeci[i].toString());
}
mylogger.info(m);
}
/*you have mylogger.error, ...*/
}
public class AgendaListenerImpl implements AgendaEventListener{
LogDrools log =new LogDrools();
@Override
public void afterActivationFired(AfterActivationFiredEvent arg0) {
	log.logInfo("After Activation fired event", new
Object[]{arg0.getActivation().getRule().getPackageName();});
}
/*same thing for other methods
*/
}
I am ready to give you more details if you need
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Append-the-Logs-For-t...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Re: [rules-dev] Append the Logs For the events Fired
                                
                                
                                
                                    
                                        by mamadou.ensi
                                    
                                
                                
                                        
I didn't work with WorkingMemoryFileLogger because it's incomplete class
I imlement all interfaces (AgendaEventListener,
WorkingMemoryEventListener,...) and I used log4j to log all events (it's
more clear)
and everytime I have a session to create I add all listener:
exemple
public class AgendaEventListenerImpl implements AgendaEventListener{
/*I initialize a log4j and implement all methods*/
}
in main class:
session.addEventListener(new AgendaEventListenerImpl());
session.fireAllRules();
keep me in informed
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Append-the-Logs-For-t...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Guvnor on Weblogic 11g AS
                                
                                
                                
                                    
                                        by mamadou.ensi
                                    
                                
                                
                                        
Hi,
Today, I will explain how to get Guvnor worked on Weblogic application
server
Lets start
1/ Install Weblogic AS
2/ create a new domain (quick start)
http://n3.nabble.com/file/n831111/image1.png 
3/ click "Getting started with Weblogic ..."
http://n3.nabble.com/file/n831111/image2.png 
4/ Click next -> next -> and give the domain name as guvnor
http://n3.nabble.com/file/n831111/image3.png 
5/ click next -> next-> and finally create
6/go to start menu -> Oracle Weblogic -> User Projects -> guvnor -> start
admin server for weblogic server domain
7/ open http://localhost:7001/console
http://n3.nabble.com/file/n831111/image4.png 
8/ give the password that you had specified on the domain creation
9/ click  "Deployments" (on the left)
10/ click "Install"
http://n3.nabble.com/file/n831111/image6.png 
11/ give the path of drools-guvnor directory (extract drools-guvnor on a
directory)
12/ click next->next->...->finish
13/ now choose save
14/ click "Deployments" yand you will see drools-guvnor
http://n3.nabble.com/file/n831111/image7.png 
15/ click "Start" -> "Servicing all requests"
but you will see some problem and the service couldn't be started :(
don't worry, we will fixe this in a moment
16/ Stop the server
17 go to %WEBLOGIC_HOME%\user_projects\domains\guvnor\lib and add the
following JARs
  - commons-beanutils-1.7.0.jar
  - commons-codec-1.3.jar
  - commons-collections-3.2.jar
  - commons-digester-1.8.jar
  - commons-discovery-0.4.jar
  - commons-logging-1.1.1.jar
  - myfaces-api-1.2.8.jar
  - myfaces-impl-1.2.8.jar
18/ open drools-guvnor\WEB-INF/lib and add the followin JARs
  - asm.jar
  - cglib.jar
  - commons-logging-1.1.1.jar
  - hibernate3.jar
  - hibernate-annotations.jar
  - hibernate-commons-annotations-3.1.0.GA.jar
  - hibernate-entitymanager.jar
  - log4j.jar
19/ open the file drools-guvnor\WEB-INF \components.xml and replace
<core:init transaction-management-enabled="false"/>
<transaction:no-transaction/>
with : <core:init debug="true" jndi-pattern="\#{ejbName}/local" />
20/ In  <component name="repositoryConfiguration"> add:
  <property name="homeDirectory">E:/GuvnorRepo/</property>
don't forget to create a "GuvnorRepo" directory on E:\
21/ start the server and enjoy with Guvnor on http//localhost
:7001/drools-guvnor/
I hope I was clear
for any information please contact me
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-on-Weblogic-11...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Guvnor JAAS authentification with Tomcat
                                
                                
                                
                                    
                                        by mamadou.ensi
                                    
                                
                                
                                        
Hi,
I will explain how to configure JAAS authentification for Guvnor using
Tomcat 
Lets start,
1/ We should have a JAAS LoginModule implemented that connect to a database
and test if the user exists in the database.
for example:
public class JaasGuvnor implements LoginModule {
public String userName;
public String password;
public boolean login(){
return true if user exist and false if not
}
/*other methods to implement*/
}
2/ open %TOMCAT_HOME%/conf/context.xml and you should configure your
database, here I use Oracle
<Resource name="jdbc/URDroolsDS"
            auth="Container"
            type="javax.sql.DataSource"
            driverClassName="oracle.jdbc.OracleDriver"
            url="jdbc:oracle:thin:@mamadou:1522:guvnor"
            username="drools"
            password="drools"
            maxActive="20"
            maxIdle="10"
            maxWait="-1"/>
    <Realm  className="org.apache.catalina.realm.JAASRealm"                
        appName="drools-guvnor"      
        userClassNames="com.test.User"      
        roleClassNames="com.test.Role"
        useContextClassLoader="false"/>
3/ add a file jaas.config on %TOMCAT_HOME%/conf
drools-guvnor{
  com.test.JaasGuvnor required debug=true;
};
4/ Before lunching Tomcat we add “set JAVA_OPTS=-Xmx256m
-Djava.security.auth.login.config=%CATALINA_HOME%/conf/jaas.config” 
For more information contact me: mohamed.ensi(a)gmail.com
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Guvnor-JAAS-authentif...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Re: [rules-dev] Append the Logs For the events Fired
                                
                                
                                
                                    
                                        by mamadou.ensi
                                    
                                
                                
                                        
Hi,
You have different way to do this,
example:
you add a new class
public class DroolsLogger {
public static KnowledgeRuntimeLogger fileLogger =null;
public static void verifyLogger (StatefulKnowledgeSession ksession){
if(fileLogger==null)
fileLogger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession,
"drools/logs");
}
public static void closeLogger(){
if(fileLogger!=null)
fileLogger.close();
}
}
In your main class:
DroolsLogger.verifyLogger(session)
session.fireAllRules();
DroolsLogger.closeLogger();
I hope I was clear 
Regards
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Append-the-Logs-For-t...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Drools 5.0 webservice via glassfish
                                
                                
                                
                                    
                                        by Philip de Lang
                                    
                                
                                
                                        
I am investigating how to expose a drools application via a webservice. I
already managed to convert the java classes into an xsd, so I can send an
xml message, run the drools app and receive an xml back. When I try to
deploy the drools application to a glassfish server, it does not work, I
appears, I cannot get the drools system libraries to work with glassfish.
Does anyone have any experience with this or with deploying drools apps as
webservices in common? 
Thanks in advance, 
Philip. 
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-0-webservice...
Sent from the Drools - Dev mailing list archive at Nabble.com.
                                
                         
                        
                                
                                15 years, 5 months