[JBoss AOP Users] - Re: PLEASE answer me I really need your help
by souma
example I want to translate the pattern memnto (from aspectj) to jboss aop
package MEMENTO;
|
| public class Initiateur {
|
| protected int valeur = 0;
|
| public void incrementation() {
| valeur++;
| }
|
| public void affichage() {
| System.out.println("La valeur courante est : " + valeur);
| }
|
|
| public void setMemento(InitiateurI o, Memento m){}
| }
package MEMENTO;
|
| public class Initiateur1Memento implements InitiateurI{
|
|
|
| public Initiateur1Memento (){
|
| }
|
| public Memento createMementoFor(InitiateurI o) {
| if (o instanceof Initiateur) {
| Memento m = new Memento() {
| private Integer state;
|
| public void setetat(Integer state) {
| this.state = (Integer) state;
| }
|
| public int getState(){
| return state;
| }
| };
| m.setetat(new Integer(((Initiateur)o).valeur));
| return m;
| }
| else {
| throw new MementoException("Initialisateur invalide");
| }
| }
|
| public void setMemento(InitiateurI o, Memento m) {
| if (o instanceof Initiateur) {
| Integer integer = (Integer) m.getState();
| ((Initiateur)o).valeur = integer.intValue();
| } else {
| throw new MementoException("Initialisateur invalide");
| }
| }
| }
|
package MEMENTO;
|
| public interface InitiateurI {
| public Memento createMementoFor(InitiateurI o);
|
| public void setMemento(InitiateurI o, Memento m);
| }
package MEMENTO;
|
| public interface Memento {
| public void setetat(Integer state);
| public int getState();
| }
public class Main {
|
|
| public static void main(String[] args) {
|
| Memento memento1 = null;
| Initiateur initiateur = new Initiateur();
|
| for (int i=1; i<=5; i++) {
| if (i==1){memento1= Initiateur1Memento.createMementoFor(initiateur);}
| else {memento1.setetat(initiateur.valeur);}
|
| initiateur.incrementation();
| initiateur.affichage();
|
| }
| System.out.println("");
| System.out.println(" <- annuler");
| Initiateur1Memento.setMemento(initiateur, memento1);
| initiateur.affichage();
|
|
| }
|
|
| }
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| <aop>
|
|
| <introduction expr="has(* *->incrementation())">
| <mixin>
| <interfaces>
| MEMENTO.InitiateurI
| </interfaces>
| <class>MEMENTO.Initiateur1Memento</class>
| <construction>new MEMENTO.Initiateur1Memento(this)</construction>
| </mixin>
| </introduction>
|
| </aop>
eclipse tells me 2 error in the Main
line 14 "The method createMementoFor(InitiateurI) in the type Initiateur1Memento is not applicable for the arguments (Initiateur)"
line23 "The method setMemento(InitiateurI, Memento) in the type Initiateur1Memento is not applicable for the arguments (Initiateur, Memento)"
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258278#4258278
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258278
15 years, 3 months
[jBPM Users] - Re: Awesome job with jBPM 4.1
by lperea
thanks for the fast reply, I've modified my configuration files, but i have a problem
When I set up the first SessionFactory (for Jbpm) it works fine, but when I set up the second SessionFactory (for the second datasource) it throw this error:
| exception while executing command org.jbpm.pvm.internal.jobexecutor.AcquireJobsCmd@1f7e273
| org.jbpm.pvm.internal.wire.WireException: couldn't find hibernate-session-factory by type to open a hibernate-session
| at org.jbpm.pvm.internal.wire.descriptor.HibernateSessionDescriptor.construct(HibernateSessionDescriptor.java:66)
| at org.jbpm.pvm.internal.wire.WireContext.construct(WireContext.java:473)
| at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:452)
| at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:441)
| at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:421)
| at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:331)
(I'm not using JPA)
any idea?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258267#4258267
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258267
15 years, 3 months