001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.entity.ejb;
023:
024: import javax.ejb.CreateException;
025: import javax.ejb.EntityBean;
026: import javax.ejb.EntityContext;
027: import javax.ejb.RemoveException;
028:
029: import org.jboss.test.entity.interfaces.Pathological;
030: import org.jboss.test.entity.interfaces.PathologicalEntityHome;
031: import org.jboss.test.entity.interfaces.PathologicalEntity;
032:
033: /**
034: * A Bad entity.
035: *
036: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>
037: * @version $Revision: 57211 $
038: */
039: public class PathologicalEntityBean implements EntityBean {
040: private EntityContext entityContext;
041:
042: private String name;
043:
044: public String getName() {
045: pathological();
046: return name;
047: }
048:
049: public String getSomething() {
050: pathological();
051: return "Something";
052: }
053:
054: public void setSomething(String value) {
055: pathological();
056: }
057:
058: public String ejbCreate(String name) throws CreateException {
059: pathological();
060: this .name = name;
061: return name;
062: }
063:
064: public void ejbPostCreate(String name) throws CreateException {
065: }
066:
067: public String ejbFindByPrimaryKey(String name) {
068: pathological();
069: return name;
070: }
071:
072: public void ejbActivate() {
073: pathological();
074: }
075:
076: public void ejbLoad() {
077: pathological();
078: }
079:
080: public void ejbPassivate() {
081: pathological();
082: }
083:
084: public void ejbRemove() throws RemoveException {
085: pathological();
086: }
087:
088: public void ejbStore() {
089: pathological();
090: }
091:
092: public void setEntityContext(EntityContext context) {
093: pathological();
094: entityContext = context;
095: }
096:
097: public void unsetEntityContext() {
098: pathological();
099: entityContext = null;
100: }
101:
102: private void pathological() {
103: if (Pathological.isPathological())
104: throw new Error("Handle this correctly please");
105: }
106: }
|