001: // ItemEC2R.java
002: package org.objectweb.jonas.stests.appli;
003:
004: import org.objectweb.jonas.common.Log;
005: import org.objectweb.util.monolog.api.Logger;
006: import org.objectweb.util.monolog.api.BasicLevel;
007:
008: /**
009: *
010: */
011: public abstract class ItemEC2R implements javax.ejb.EntityBean {
012:
013: static private Logger logger = null;
014: javax.ejb.EntityContext ejbContext;
015:
016: /**
017: * Creates an item bean
018: *
019: * @throws RemoteException if an RMI exception occurs
020: *
021: * @throws CreateException if the item cannot be created
022: *
023: * @param id an int which represents the item id
024: *
025: * @param name a String which represents the item name
026: *
027: * @param price a float which represents the item's price
028: *
029: * @param data a String which contains additional information about the item
030: */
031: public String ejbCreate(Integer id, String name, float price,
032: String data) throws javax.ejb.CreateException {
033: logger.log(BasicLevel.DEBUG, "");
034:
035: // Init here the bean fields
036: setItemID(id);
037: setItemName(name);
038: setItemPrice(price);
039: setItemInfo(data);
040: return null;
041: }
042:
043: public void ejbPostCreate(Integer id, String name, float price,
044: String data) {
045: logger.log(BasicLevel.DEBUG, "");
046: }
047:
048: // ------------------------------------------------------------------
049: // Persistent fields
050: //
051: // ------------------------------------------------------------------
052: public abstract Integer getItemID();
053:
054: public abstract void setItemID(Integer f1);
055:
056: public abstract String getItemName();
057:
058: public abstract void setItemName(String f2);
059:
060: public abstract float getItemPrice();
061:
062: public abstract void setItemPrice(float f2);
063:
064: public abstract String getItemInfo();
065:
066: public abstract void setItemInfo(String f3);
067:
068: // ------------------------------------------------------------------
069: // Standard call back methods
070: // ------------------------------------------------------------------
071:
072: public void setEntityContext(javax.ejb.EntityContext ctx) {
073: if (logger == null) {
074: logger = Log.getLogger("org.objectweb.jonas_tests");
075: }
076: logger.log(BasicLevel.DEBUG, "");
077: ejbContext = ctx;
078: }
079:
080: public void unsetEntityContext() {
081: logger.log(BasicLevel.DEBUG, "");
082: ejbContext = null;
083: }
084:
085: public void ejbRemove() throws javax.ejb.RemoveException {
086: logger.log(BasicLevel.DEBUG, "");
087: }
088:
089: public void ejbLoad() {
090: logger.log(BasicLevel.DEBUG, "");
091: }
092:
093: public void ejbStore() {
094: logger.log(BasicLevel.DEBUG, "");
095: }
096:
097: public void ejbPassivate() {
098: logger.log(BasicLevel.DEBUG, "");
099: }
100:
101: public void ejbActivate() {
102: logger.log(BasicLevel.DEBUG, "");
103: }
104:
105: }
|