001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: Paper2EC2.java 9157 2006-07-12 12:16:25Z coqp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.beans.folder;
027:
028: import java.rmi.RemoteException;
029: import javax.ejb.CreateException;
030: import javax.ejb.EntityBean;
031: import javax.ejb.EntityContext;
032: import javax.ejb.RemoveException;
033:
034: import org.objectweb.jonas.common.Log;
035: import org.objectweb.util.monolog.api.BasicLevel;
036: import org.objectweb.util.monolog.api.Logger;
037:
038: /**
039: * This is an entity bean with "container managed persistence version 2.x".
040: * The state of an instance is stored into a relational database.
041: * The following table should exist :
042: * jt2_paper2
043: * c_id varchar(30) primarey key
044: * c_valeur integer
045: * c_statut integer
046: *
047: * @author Philippe Coq
048: */
049:
050: public abstract class Paper2EC2 implements EntityBean {
051:
052: static protected Logger logger = null;
053:
054: protected EntityContext entityContext;
055:
056: // Get and Set accessor methods of the bean's abstract schema
057: // cmp-field
058: public abstract String getId();
059:
060: public abstract void setId(String id);
061:
062: public abstract int getValeur();
063:
064: public abstract void setValeur(int val);
065:
066: public abstract String getStatut();
067:
068: public abstract void setStatut(String val);
069:
070: // cmr-field
071: public abstract Paper3Local getPaper3();
072:
073: public abstract void setPaper3(Paper3Local p);
074:
075: public void ejbActivate() {
076: logger.log(BasicLevel.DEBUG, "");
077: }
078:
079: public void ejbPassivate() {
080: logger.log(BasicLevel.DEBUG, "");
081: }
082:
083: public void ejbLoad() {
084: logger.log(BasicLevel.DEBUG, "");
085: }
086:
087: public void ejbStore() {
088: logger.log(BasicLevel.DEBUG, "");
089: }
090:
091: public void ejbRemove() throws RemoveException {
092: logger.log(BasicLevel.DEBUG, "");
093: }
094:
095: public void setEntityContext(EntityContext ctx) {
096: if (logger == null)
097: logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
098: logger.log(BasicLevel.DEBUG, "");
099: entityContext = ctx;
100:
101: }
102:
103: public void unsetEntityContext() {
104: logger.log(BasicLevel.DEBUG, "");
105: }
106:
107: public String ejbCreate(String id) throws CreateException {
108: logger.log(BasicLevel.DEBUG, "");
109: setId(id);
110: setValeur(0);
111: setStatut("0");
112: return null; // In CMP, should return null.
113: }
114:
115: public void ejbPostCreate(String id) {
116: logger.log(BasicLevel.DEBUG, "");
117: }
118:
119: public abstract int ejbSelectGetSumOfValeurs()
120: throws javax.ejb.FinderException;
121:
122: public int ejbHomeGetSumOfValeurs()
123: throws javax.ejb.FinderException {
124: int sum = this.ejbSelectGetSumOfValeurs();
125: return sum;
126: }
127: }
|