本文整理汇总了Java中org.drools.logger.KnowledgeRuntimeLoggerFactory类的典型用法代码示例。如果您正苦于以下问题:Java KnowledgeRuntimeLoggerFactory类的具体用法?Java KnowledgeRuntimeLoggerFactory怎么用?Java KnowledgeRuntimeLoggerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KnowledgeRuntimeLoggerFactory类属于org.drools.logger包,在下文中一共展示了KnowledgeRuntimeLoggerFactory类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
PI pi = new PI();
pi.setIterStrategy(PI.IterStrategySetting.ballardMethod.getStrategy());
ksession.insert(pi);
ksession.fireAllRules();
System.out.println("PI: " + pi.getPi());
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:shuqin,项目名称:ALLIN,代码行数:20,代码来源:CalcPI.java
示例2: main
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
Employ emp = new Employ();
emp.setEduInfo("master");
emp.setResume("tech");
emp.setAnnualExam("good");
emp.setAwardPunish("award");
ksession.insert(emp);
ksession.startProcess("myrules.salary");
ksession.fireAllRules();
System.out.println("Basic Salary: " + emp.getBasicSalary());
System.out.println("Duty Salary: " + emp.getDutySalary());
System.out.println("Bonus : " + emp.getBonus());
System.out.println("rate : " + emp.getPercent());
System.out.printf("Total Salary: %.0f" , emp.getTotalSalary());
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:shuqin,项目名称:ALLIN,代码行数:28,代码来源:EmployTest.java
示例3: main
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
ksession.fireAllRules();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:18,代码来源:DroolsTest.java
示例4: getStatefulKnowledgeSession
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static StatefulKnowledgeSession getStatefulKnowledgeSession(String path) {
KnowledgeBase kbase;
StatefulKnowledgeSession ksession;
KnowledgeRuntimeLogger logger;
try {
kbase = readKnowledgeBase(path);
ksession = kbase.newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
logger.close();
if(ksession != null) {
return ksession;
} else { return null; }
} catch(Throwable t) {
System.out.println("X:\tErr in DroolsTools: cannot read knowlegde base\n\t"+t.getMessage());
//t.printStackTrace();
return null;
}
}
开发者ID:xladde,项目名称:hsw,代码行数:19,代码来源:DroolsTools.java
示例5: main
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
Employ emp = new Employ();
emp.setEduInfo("master");
emp.setResume("tech");
emp.setAnnualExam("good");
emp.setAwardPunish("award");
ksession.insert(emp);
ksession.startProcess("ruleflow.salary");
ksession.fireAllRules();
System.out.println("Basic Salary: " + emp.getBasicSalary());
System.out.println("Duty Salary: " + emp.getDutySalary());
System.out.println("Bonus : " + emp.getBonus());
System.out.println("rate : " + emp.getPercent());
System.out.printf("Total Salary: %.0f" , emp.getTotalSalary());
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:shuqin,项目名称:ALLIN,代码行数:28,代码来源:EmployTest2.java
示例6: main
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
public static final void main(String[] args) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
ksession.fireAllRules();
logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
}
开发者ID:mescam,项目名称:carMechanic,代码行数:14,代码来源:DroolsTest.java
示例7: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the extended service periods to calculate their
* interests.
* </p>
*
* @param request
* that contains the extended service periods and the date to
* calculated to.
*
* @return the response of the extended service periods with calculated
* interests.
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public InterestCalculationResponse execute(InterestCalculationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(InterestCalculationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Set global variables
ksession.setGlobal(INTEREST_CALCULATED_TO_DATE, request.getInterestCalculatedToDate());
// Populate facts
for (ExtendedServicePeriod esp : request.getExtendedServicePeriods()) {
ksession.insert(esp);
}
// start ruleflow process
ksession.startProcess("Interest");
// Fire all rules
ksession.fireAllRules();
// populate the final result
InterestCalculationResponse response = new InterestCalculationResponse();
response.setExtendedServicePeriods(request.getExtendedServicePeriods());
ksession.dispose();
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:80,代码来源:InterestCalculationRuleServiceImpl.java
示例8: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the service periods to validate service periods.
* </p>
*
* @param request
* that contains the service periods to validate.
*
* @return the response
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public DeductionValidationResponse execute(DeductionValidationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(DeductionValidationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
// validate the parameters
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ServicePeriod sp : request.getServicePeriods()) {
ksession.insert(sp);
}
// Fire all rules
ksession.fireAllRules();
// populate the final result
DeductionValidationResponse response = new DeductionValidationResponse();
response.setServicePeriods(request.getServicePeriods());
//ksession.dispose();
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:71,代码来源:DeductionValidationRuleServiceImpl.java
示例9: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the extended service periods to calculate their
* interests.
* </p>
*
* @param request
* that contains the extended service periods and the date to
* calculated to.
*
* @return the response of the extended service periods with calculated
* interests.
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public InterestCalculationResponse execute(InterestCalculationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(InterestCalculationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ExtendedServicePeriod esp : request.getExtendedServicePeriods()) {
ksession.insert(esp);
}
// Set global variables
ksession.setGlobal(INTEREST_CALCULATED_TO_DATE, request.getInterestCalculatedToDate());
// start ruleflow process
ksession.startProcess("Interest");
// Fire all rules
ksession.fireAllRules();
// populate the final result
InterestCalculationResponse response = new InterestCalculationResponse();
response.setExtendedServicePeriods(request.getExtendedServicePeriods());
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:76,代码来源:InterestCalculationRuleServiceImpl.java
示例10: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the service periods to calculate their
* deductions. This methods also merges the service period to extended service period.
* </p>
*
* @param request
* that contains the service periods to calculate.
*
* @return the response of the extended service periods with calculated
* deductions (and also earnings, mid-point etc.).
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public DeductionCalculationResponse execute(DeductionCalculationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(DeductionCalculationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
// validate the parameters
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ServicePeriod sp : request.getServicePeriods()) {
ksession.insert(sp);
}
// Set global variables
List<ExtendedServicePeriod> esps = new ArrayList<ExtendedServicePeriod>();
ksession.setGlobal(EXTENDED_SERVICE_PERIODS, esps);
ksession.setGlobal(SERVICE_PERIOD_SPLIT_DATES,
servicePeriodSplitDates == null ? Collections.EMPTY_LIST : servicePeriodSplitDates);
// Start deduction process
ksession.startProcess("Deduction");
// Fire all rules
ksession.fireAllRules();
// populate the final result
DeductionCalculationResponse response = new DeductionCalculationResponse();
response.setExtendedServicePeriods(esps);
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:80,代码来源:DeductionCalculationRuleServiceImpl.java
示例11: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the service periods to validate service periods.
* </p>
*
* @param request
* that contains the service periods to validate.
*
* @return the response
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public DeductionValidationResponse execute(DeductionValidationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(DeductionValidationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
// validate the parameters
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ServicePeriod sp : request.getServicePeriods()) {
ksession.insert(sp);
}
// Fire all rules
ksession.fireAllRules();
// populate the final result
DeductionValidationResponse response = new DeductionValidationResponse();
response.setServicePeriods(request.getServicePeriods());
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:69,代码来源:DeductionValidationRuleServiceImpl.java
示例12: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the extended service periods to calculate their
* interests.
* </p>
*
* @param request
* that contains the extended service periods and the date to
* calculated to.
*
* @return the response of the extended service periods with calculated
* interests.
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public InterestCalculationResponse execute(InterestCalculationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(InterestCalculationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ExtendedServicePeriod esp : request.getExtendedServicePeriods()) {
ksession.insert(esp);
}
// Set global variables
ksession.setGlobal(INTEREST_CALCULATED_TO_DATE, request.getInterestCalculatedToDate());
// Fire all rules
ksession.fireAllRules();
// populate the final result
InterestCalculationResponse response = new InterestCalculationResponse();
response.setExtendedServicePeriods(request.getExtendedServicePeriods());
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:73,代码来源:InterestCalculationRuleServiceImpl.java
示例13: execute
import org.drools.logger.KnowledgeRuntimeLoggerFactory; //导入依赖的package包/类
/**
* <p>
* Executes the rules to the service periods to calculate their
* deductions. This methods also merges the service period to extended service period.
* </p>
*
* @param request
* that contains the service periods to calculate.
*
* @return the response of the extended service periods with calculated
* deductions (and also earnings, mid-point etc.).
*
* @throws IllegalArgumentException if the request is null.
* @throws RuleServiceException
* if any error occurs when executing the rule.
*/
@Override
public DeductionCalculationResponse execute(DeductionCalculationRequest request)
throws RuleServiceException {
// log the entrance
String signature = CLASS_NAME + "#execute(DeductionCalculationRequest request)";
LoggingHelper.logEntrance(getLogger(), signature,
new String[] {"request"}, new Object[] {request});
// validate the parameters
ServiceHelper.checkNull(request, "request");
StatefulKnowledgeSession ksession = null;
KnowledgeRuntimeLogger logger = null;
try {
// start new session and the file logger
ksession = getKnowledgeBase().newStatefulKnowledgeSession();
logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, getKnowledgeLogFileName());
// Populate facts
for (ServicePeriod sp : request.getServicePeriods()) {
ksession.insert(sp);
}
// Set global variables
List<ExtendedServicePeriod> esps = new ArrayList<ExtendedServicePeriod>();
ksession.setGlobal(EXTENDED_SERVICE_PERIODS, esps);
// Fire all rules
ksession.fireAllRules();
// populate the final result
DeductionCalculationResponse response = new DeductionCalculationResponse();
response.setExtendedServicePeriods(esps);
// log and return
LoggingHelper.logExit(getLogger(), signature, new Object[] {response});
return response;
} catch (RuntimeException e) {
// log the exception and wrap it to RuleServiceException
throw LoggingHelper.logException(getLogger(), signature,
new RuleServiceException("Unable to complete rule execution.", e));
} finally {
// closes the resources
if (logger != null) {
logger.close();
}
if (ksession != null) {
ksession.dispose();
}
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:75,代码来源:DeductionCalculationRuleServiceImpl.java
注:本文中的org.drools.logger.KnowledgeRuntimeLoggerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论