Posts

Showing posts from August, 2013

Spring Data JPA & Spring 3 Transactions Through JTA and Atomikos

In this article I will discuss about Spring Transactions with JTA. The underlying JTA implementation with Atomikos. The server platform is jBoss7. The XA-DataSource configured in jBoss AS7 is of the type Oracle 10g. The Underlyimg Persistence Provider in Hibernate 4. I have used the Hibernate Module already available with jBoass AS7, but during Startup of my application I faced some issues for which i have to Externally plug in the jar "hibernate-core-3.6.0.Final.jar", Tried to find out the reason behind but remain undone. Now before going into the discussion, I will first try note down the jars that I have used, as this portion has Given me Immense pain due to lack of proper Documentation. jar List --------------------------------- 1) hibernate-core-3.6.0.Final.jar 2) transactions-jta-3.6.4.jar 3) atomikos-util-3.6.4.jar 4) transactions-3.6.4.jar 5) transactions-api-3.6.4.jar 6) transactions-hibernate3-3.6.4.jar 7) transactions-jdbc-3.6.4

Memento Pattern with AspectJ

Hello Friends, This time i have implemented Memento Pattern with AspectJ. In Memento Pattern, there are two roles: 1) Originator & 2)Memento Originator is the Object or the Entity that we are working with. Memento is the artifact where we are going to save the state of the Originator, so that when required we can roll back the current state of the Originator with the state saved in the Memento. Here I have saved only the state of the Originator during Initialization. Multiple states of Originator as required can be saved in Memento and can be restored when required based on the requirement. Intersting Huh!!!! We are going to implement this feature with AspectJ public abstract aspect MyNewAspectMementoPattern { public interface Originator { public void setMemento(Memento memento); //public Originator getObject(); public Originator restoreState(); } public interface Memento { public void setState(Originator originator); public Originator getSt

State Pattern with Aspect

Today I am going discuss Implementation of State Pattern throgh AspectJ In state Pattern there are two roles to watch out for, The Context and the state. The Context Role contains state. Now when an operation is required to be carried out on context then the state is checked Now based on the state, the operation on the state is undertaken and if required the new state is set in context. The mentioned operation is carried out through the AspectJ. public abstract aspect MyNewAspectStatePattern { public interface Context { public void setState(State state); public State getState(); } public interface State { public void perform(); } public abstract pointcut interceptInitialState(Context context/*,com.aspectj.target.State state*/); } In the above aspect there are two states as mentioned, the Context and the State. The context has the state within itself and the State role has the perform method for performing operations. public aspect MyNewAspe