Friday, 29 February 2008
Setup and Dependencies of jServiceRules
The setup process is very easy, just download, unzip the tar file and depending of the environment you are working with (standalone or Web) the jars must be added either to the classpath of the application or to the WEB-INF\lib directory.
The only issue could be getting the right dependencies. If you have downloaded the no dependencies package you can get it in a separate file.
For further information a documentation guide is available.
The only issue could be getting the right dependencies. If you have downloaded the no dependencies package you can get it in a separate file.
For further information a documentation guide is available.
Thursday, 28 February 2008
Transforming Pojo / Web / Enterprise Services into Semantic Services / Agents using jSemanticService
Let's suppose that you have an existing service (pojo in this case) in a Spring context, (or that you need to write a new service) that needs to use semantics.
How would you do that? Well, in just three steps:
First Step
Writing a SemanticServiceFactory bean (and it's collaborators if needed) in the Spring Context file.
Second Step.
Either inject a reference to the SemanticServiceFactory directly in the service or extend the SemanticServiceSupport abstract class.
public class EvenService {
private SemanticSessionFactory semanticSessionFactory = null;
public Collection check(Collection numbers) {
SemanticSession session = semanticSessionFactory.getInstance();
Collection results = session.execute(numbers);
session.dispose();
session = null;
return results;
}
public void semanticSessionFactory(SemanticSessionFactory semanticSessionFactory){
this.semanticSessionFactory = semanticSessionFactory:
}
}
Now a method that uses the new added semantics functionality can be written. For that matter there is a method in the base class: getInstance(). This method returns a Semantic Session instance that is bound to the current thread. If we dispose the session then we'll get a new one. If not, the same session will be reused.
Third Step
Inject the Semantic Session Factory in the service bean.
And that's all, now the Semantic Service is ready to roll!.
Read the complete article in:
http://code.google.com/p/jservicerules/wiki/TransformServicesIntoSemantics
How would you do that? Well, in just three steps:
First Step
Writing a SemanticServiceFactory bean (and it's collaborators if needed) in the Spring Context file.
Second Step.
Either inject a reference to the SemanticServiceFactory directly in the service or extend the SemanticServiceSupport abstract class.
public class EvenService {
private SemanticSessionFactory semanticSessionFactory = null;
public Collection check(Collection numbers) {
SemanticSession session = semanticSessionFactory.getInstance();
Collection results = session.execute(numbers);
session.dispose();
session = null;
return results;
}
public void semanticSessionFactory(SemanticSessionFactory semanticSessionFactory){
this.semanticSessionFactory = semanticSessionFactory:
}
}
Now a method that uses the new added semantics functionality can be written. For that matter there is a method in the base class: getInstance(). This method returns a Semantic Session instance that is bound to the current thread. If we dispose the session then we'll get a new one. If not, the same session will be reused.
Third Step
Inject the Semantic Session Factory in the service bean.
And that's all, now the Semantic Service is ready to roll!.
Read the complete article in:
http://code.google.com/p/jservicerules/wiki/TransformServicesIntoSemantics
Tuesday, 26 February 2008
Why to use Semantics and Rules in your Services.
The question is why should I use Semantics and rules and when?
Well, using semantics or rules should be another tool in you toolset. And it's a very useful one, even though is very underrated maybe because it´s never been easy to use. Or because semantic or functional programming has never been that popular.
That is changing nowaydays because of SOA and BPM's, that rely heavily upon on Business Rules, specially sSOA.
With the jServiceRules / jSemanticService frameworks I tried to cover up some of that gaps:
Well, using semantics or rules should be another tool in you toolset. And it's a very useful one, even though is very underrated maybe because it´s never been easy to use. Or because semantic or functional programming has never been that popular.
That is changing nowaydays because of SOA and BPM's, that rely heavily upon on Business Rules, specially sSOA.
With the jServiceRules / jSemanticService frameworks I tried to cover up some of that gaps:
# Adapting the BRE to Services and Java environments.
# Integration with another third party frameworks.
When to use Semantics or Rules
# If you have a complex model you could write a semantic model to process it.
# Business rules that would change over the time.
# Business rules that you'd like to isolate from the code.
# Different types of events or objects you'd want to recognize and process.
Sunday, 24 February 2008
About the jServiceRules alpha working release.
Well, after some months of development (well, not really that much but as I do it in my spare time, clocks that long) I've finally been able to release an alpha working version.
Even though it's functional and I've tested it in different enviroments (windows, linux, mac os) using unit and stress testing, still some bugs could appear. Also I'm still improving it, so minor changes could be found in the next version. But that's the reason it's an alpha release :) .
This release includes the dist binaries, dependencies (if you choose so), API docs, and two examples.
In fact, it´s a stripped down version compared what I had in mind, but it's more focused (service oriented) and it can be used as a base for future developments.
Even though it's functional and I've tested it in different enviroments (windows, linux, mac os) using unit and stress testing, still some bugs could appear. Also I'm still improving it, so minor changes could be found in the next version. But that's the reason it's an alpha release :) .
About the release.
This release includes the dist binaries, dependencies (if you choose so), API docs, and two examples.
It does not include the support package therefore there is no Spring (and the rest of the bunch) integration yet, so the only option to use and configure the framework is through code (see examples and further posts). I'll release it at the end of this week or early next.
About the examples.
The even numbers example is simple, just a service that returns if a number is even or not. Two simpe rules are produced to do that. The objective of this example is to show how to use the basic features.
The Energy example is a more complex one producing the energy invoice of a customer, giving his personal data and energy readings. In this case, a number of rules are produced to generate the Tariffs available.
Subscribe to:
Posts (Atom)