Index: topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBHome.java diff -u /dev/null topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBHome.java:1.1 --- /dev/null Tue Sep 28 12:10:21 2004 +++ topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBHome.java Tue Sep 28 12:10:16 2004 @@ -0,0 +1,43 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSBHome.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/28 12:10:16 $ + * by : $Author: keurvet $ + */ + +package org.codelutin.topia.persistence.ejb; + +import javax.ejb.EJBHome; + +/** + * + */ +public interface PersistenceHelperSBHome extends EJBHome { + + PersistenceHelperSB create() throws javax.ejb.CreateException,java.rmi.RemoteException; + +} Index: topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBBean.java diff -u /dev/null topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBBean.java:1.1 --- /dev/null Tue Sep 28 12:10:21 2004 +++ topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSBBean.java Tue Sep 28 12:10:16 2004 @@ -0,0 +1,82 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSBBean.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/28 12:10:16 $ + * by : $Author: keurvet $ + */ + +package org.codelutin.topia.persistence.ejb; + +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.codelutin.topia.TopiaArgument; +import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaContextFactory; +import org.codelutin.topia.TopiaException; + +/** + * + */ +public class PersistenceHelperSBBean implements SessionBean { + + protected SessionContext sessionContext; + + protected TopiaContext topiaContext; + + public void setSessionContext(SessionContext sessionContext) { + this.sessionContext = sessionContext; + } + + public void ejbCreate() throws NamingException, TopiaException { + // Obtain the topia context file name from the + // enterprise bean's environment naming context. + Context ctx = new InitialContext(); + String topiaContextFileName = ctx.lookup( + "java:/comp/env/topia.context.filename").toString(); + topiaContext = TopiaContextFactory.getContext(topiaContextFileName); + } + + public void ejbRemove() { + } + + public void ejbActivate() { + } + + public void ejbPassivate() { + } + + public Object call(Class service, String methodName, TopiaArgument args) + throws TopiaException { + return topiaContext.getDistributionHelper().call(service, methodName, + args); + } + +} \ No newline at end of file Index: topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSB.java diff -u /dev/null topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSB.java:1.1 --- /dev/null Tue Sep 28 12:10:21 2004 +++ topia/src/java/org/codelutin/topia/persistence/ejb/PersistenceHelperSB.java Tue Sep 28 12:10:16 2004 @@ -0,0 +1,45 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSB.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/28 12:10:16 $ + * by : $Author: keurvet $ + */ + +package org.codelutin.topia.persistence.ejb; + +import javax.ejb.EJBObject; + +import org.codelutin.topia.TopiaArgument; +import org.codelutin.topia.TopiaException; + +/** + * + */ +public interface PersistenceHelperSB extends EJBObject { + + public Object call(Class service, String methodName, TopiaArgument args) throws TopiaException; +}