Commits

Anonymous committed 271b6d6

Moved existing source to new layout.

git-svn-id: http://svn.opensymphony.com/svn/propertyset/branches/maven_build@217bf3cbcdd-1c1a-0410-9a68-d6f521e3fa7b

Comments (0)

Files changed (28)

providers/ejb2/src/com/opensymphony/ejb/AbstractEntityAdapter.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.ejb;
-
-import com.opensymphony.module.propertyset.PropertySet;
-import com.opensymphony.module.propertyset.PropertySetManager;
-import com.opensymphony.module.sequence.SequenceGeneratorHome;
-
-import com.opensymphony.util.EJBUtils;
-import com.opensymphony.util.GUID;
-
-import java.rmi.RemoteException;
-
-import java.util.HashMap;
-
-import javax.ejb.CreateException;
-import javax.ejb.EntityContext;
-
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class AbstractEntityAdapter {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    /**
-     * Reference to EntityContext.
-     */
-    protected EntityContext context;
-
-    /**
-     * Name of the auto-generating sequence.
-     */
-    protected String sequenceName;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-     * Sets the context - should be used only by direct subclasses
-     * Also, attempts to determine the <code>sequenceName</code>.
-     */
-    protected void setContext(EntityContext context) {
-        this.context = context;
-
-        try {
-            sequenceName = (String) EJBUtils.lookup("sequenceName", String.class);
-        } catch (Exception e) {
-            sequenceName = "";
-        }
-    }
-
-    /**
-     * Generate random GUID.
-     *
-     * @see com.opensymphony.util.GUID
-     */
-    protected String generateGUID() {
-        return GUID.generateGUID();
-    }
-
-    /**
-     * Locate PropertySet using PropertyStore for this sequenceName/sequenceId mapping.
-     */
-    protected PropertySet locatePropertySet(long id) throws RemoteException {
-        HashMap args = new HashMap(2);
-        args.put("entityId", new Long(id));
-        args.put("entityName", sequenceName);
-
-        return PropertySetManager.getInstance("ejb", args);
-    }
-
-    /**
-     * @deprecated Use {@link #nextInt()} or {@link #nextLong()} instead.
-     */
-    protected int nextId() throws CreateException, RemoteException {
-        return nextInt();
-    }
-
-    /**
-     * Return int unique id key from a unique instance key generator.
-     */
-    protected int nextInt() throws CreateException, RemoteException {
-        try {
-            return (int) nextLong();
-        } catch (ClassCastException e) {
-            throw new CreateException("Cannot generate id: Sequence cannot be downcasted to long.");
-        } catch (NullPointerException e) {
-            throw new CreateException("Cannot generate id: Sequence returning null.");
-        }
-    }
-
-    /**
-     * Return long unique id key from a unique instance key generator.
-     */
-    protected long nextLong() throws CreateException, RemoteException {
-        try {
-            SequenceGeneratorHome sgHome;
-
-            try {
-                if (sequenceName == null) {
-                    sequenceName = (String) EJBUtils.lookup("sequenceName", String.class);
-                }
-
-                sgHome = (SequenceGeneratorHome) EJBUtils.lookup("ejb/SequenceGenerator", SequenceGeneratorHome.class);
-            } catch (NameNotFoundException e) {
-                sgHome = (SequenceGeneratorHome) EJBUtils.lookup("SequenceGenerator", SequenceGeneratorHome.class);
-            }
-
-            return sgHome.create().getCount(sequenceName);
-        } catch (NamingException e) {
-            throw new CreateException("Cannot generate id: " + e.toString());
-        }
-    }
-}

providers/ejb2/src/com/opensymphony/ejb/EntityAdapter.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.ejb;
-
-import java.rmi.RemoteException;
-
-/* ====================================================================
- * The OpenSymphony Software License, Version 1.1
- *
- * (this license is derived and fully compatible with the Apache Software
- * License - see http://www.apache.org/LICENSE.txt)
- *
- * Copyright (c) 2001 The OpenSymphony Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        OpenSymphony Group (http://www.opensymphony.com/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "OpenSymphony" and "The OpenSymphony Group"
- *    must not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact license@opensymphony.com .
- *
- * 5. Products derived from this software may not be called "OpenSymphony"
- *    or "OSCore", nor may "OpenSymphony" or "OSCore" appear in their
- *    name, without prior written permission of the OpenSymphony Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- */
-import javax.ejb.*;
-
-
-/**
- * <p>
- *   Abstract base adapter class to be extended by EJB EntityBeans. <br>
- *   Contains default implementations for all require methods to implement EntityBean.
- * </p>
- * <p>
- *   To create an implementation of an Entity, extend this class and add appropriate ejbCreate(),
- *   ejbPostCreate() and getter/setter methods.
- * </p>
- * <p>
- *   If an auto-generated primary key (<code>long</code>/<code>int</code>) is to be used,
- * </p>
- *
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- */
-public abstract class EntityAdapter extends AbstractEntityAdapter implements EntityBean {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-     * Required to implement EntityBean. Sets the EntityContext.
-     * Also, attempts to detemine the <code>sequenceName</code>.
-     */
-    public void setEntityContext(EntityContext context) throws EJBException, RemoteException {
-        this.setContext(context);
-    }
-
-    /**
-     * Required to implement EntityBean. Not implemented.
-     */
-    public void ejbActivate() throws EJBException, RemoteException {
-    }
-
-    /**
-     * Required to implement EntityBean. Not implemented.
-     */
-    public void ejbLoad() throws EJBException, RemoteException {
-    }
-
-    /**
-     * Required to implement EntityBean. Not implemented.
-     */
-    public void ejbPassivate() throws EJBException, RemoteException {
-    }
-
-    /**
-     * Required to implement EntityBean. Not implemented.
-     */
-    public void ejbRemove() throws RemoveException, EJBException, RemoteException {
-    }
-
-    /**
-     * Required to implement EntityBean. Not implemented.
-     */
-    public void ejbStore() throws EJBException, RemoteException {
-    }
-
-    /**
-     * Required to implement EntityBean. Sets the EntityContext to null.
-     */
-    public void unsetEntityContext() throws EJBException, RemoteException {
-        context = null;
-    }
-
-    /**
-     * Return EntityContext. To be used by classes extending this.
-     */
-    protected EntityContext getEntityContext() {
-        return context;
-    }
-}

providers/ejb2/src/com/opensymphony/ejb/ExceptionlessEntityAdapter.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.ejb;
-
-import javax.ejb.*;
-
-
-/**
- * <p>
- *   Abstract base adapter class to be extended by EJB EntityBeans. <br>
- *   Contains default implementations for all require methods to implement EntityBean.
- * </p>
- * <p>
- *   To create an implementation of an Entity, extend this class and add appropriate ejbCreate(),
- *   ejbPostCreate() and getter/setter methods.
- * </p>
- * <p>
- *   If an auto-generated primary key (<code>long</code>/<code>int</code>) is to be used,
- * </p>
- * <p>
- *  <b>This is an identical class in terms of functionality to EntityAdapter, it just does
- * not throw as many exceptions. This sometimes works much nicer with other tools such as
- * XDoclet.</b>
- * </p>
- *
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @author <a href="mailto:mike@atlassian.com">Mike Cannon-Brookes</a>
- * @version $Revision$
- */
-public abstract class ExceptionlessEntityAdapter extends AbstractEntityAdapter implements EntityBean {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * Required to implement EntityBean. Sets the EntityContext.
-    * Also, attempts to detemine the <code>sequenceName</code>.
-    */
-    public void setEntityContext(EntityContext context) {
-        this.setContext(context);
-    }
-
-    /**
-    * Required to implement EntityBean. Not implemented.
-    */
-    public void ejbActivate() {
-    }
-
-    /**
-    * Required to implement EntityBean. Not implemented.
-    */
-    public void ejbLoad() {
-    }
-
-    /**
-    * Required to implement EntityBean. Not implemented.
-    */
-    public void ejbPassivate() {
-    }
-
-    /**
-    * Required to implement EntityBean. Not implemented.
-    */
-    public void ejbRemove() throws RemoveException {
-    }
-
-    /**
-    * Required to implement EntityBean. Not implemented.
-    */
-    public void ejbStore() {
-    }
-
-    /**
-    * Required to implement EntityBean. Sets the EntityContext to null.
-    */
-    public void unsetEntityContext() {
-        context = null;
-    }
-
-    /**
-    * Return EntityContext. To be used by classes extending this.
-    */
-    protected EntityContext getEntityContext() {
-        return context;
-    }
-}

providers/ejb2/src/com/opensymphony/ejb/SessionAdapter.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.ejb;
-
-import java.rmi.RemoteException;
-
-/* ====================================================================
- * The OpenSymphony Software License, Version 1.1
- *
- * (this license is derived and fully compatible with the Apache Software
- * License - see http://www.apache.org/LICENSE.txt)
- *
- * Copyright (c) 2001 The OpenSymphony Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        OpenSymphony Group (http://www.opensymphony.com/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "OpenSymphony" and "The OpenSymphony Group"
- *    must not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact license@opensymphony.com .
- *
- * 5. Products derived from this software may not be called "OpenSymphony"
- *    or "OSCore", nor may "OpenSymphony" or "OSCore" appear in their
- *    name, without prior written permission of the OpenSymphony Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- */
-import javax.ejb.*;
-
-
-/**
- * <p>
- *   Abstract base adapter class to be extended by EJB SessionBeans. <br>
- *   Contains default implementations for all require methods to implement SessionBean.
- * </p>
- * <p>
- *   To create an implementation of an Session, extend this class and add appropriate ejbCreate()
- *   and getter/setter methods.
- * </p>
- *
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- */
-public abstract class SessionAdapter implements SessionBean {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    /** Reference to SessionContext. */
-    protected SessionContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /** Required to implement SessionBean. Sets the SessionContext. */
-    public void setSessionContext(SessionContext context) throws RemoteException {
-        this.context = context;
-    }
-
-    /** Required to implement SessionBean. Not implemented. */
-    public void ejbActivate() throws EJBException, RemoteException {
-    }
-
-    /** Required to implement SessionBean. Not implemented. */
-    public void ejbPassivate() throws EJBException, RemoteException {
-    }
-
-    /** Required to implement SessionBean. Not implemented. */
-    public void ejbRemove() throws EJBException, RemoteException {
-    }
-
-    /** Return SessionContext. To be used by classes extending this. */
-    protected SessionContext getSessionContext() throws EJBException, RemoteException {
-        return context;
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/.cvsignore

-PropertyStore.java
-*Home*.java

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/EJBPropertySet.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb;
-
-import com.opensymphony.module.propertyset.*;
-
-import com.opensymphony.util.DataUtil;
-import com.opensymphony.util.EJBUtils;
-
-import java.io.Serializable;
-
-import java.rmi.RemoteException;
-
-import java.util.Collection;
-import java.util.Map;
-
-import javax.ejb.CreateException;
-
-import javax.naming.NamingException;
-
-
-/**
- * The EJBPropertySet is an implementation of
- * {@link com.opensymphony.module.propertyset.PropertySet} that
- * uses Enterprise JavaBeans to store and retrieve Properties.
- *
- * <p>This class is a proxy to the
- * {@link com.opensymphony.module.propertyset.ejb.PropertyStore}
- * Session Bean that handles the PropertySet and behind the scenes
- * delegates to various Entity Beans to persist the data in an
- * efficient way.</p>
- *
- * <p>Each method in the proxy will catch any thrown
- * {@link java.rmi.RemoteException} and rethrow it wrapped in a
- * {@link com.opensymphony.module.propertyset.PropertyImplementationException} .</p>
- *
- * <h3>Usage</h3>
- *
- * <p>In order to use an EJBPropertySet, a PropertyStore Session Bean
- * must first be retrieved that represents the PropertySet data. This
- * is typically either returned by another EJB, or looked up using
- * an JNDI location for PropertyStoreHome and an int ID for the actual
- * PropertySet used.</p>
- *
- * <b>Required Args</b>
- * <ul>
- *  <li><b>entityId</b> - Long that holds the ID of this entity</li>
- *  <li><b>entityName</b> - String that holds the name of this entity type</li>
- * </ul>
- * <p>
- *
- * <b>Optional Configuration</b>
- * <ul>
- *  <li><b>storeLocation</b> - the JNDI name for the PropertyStore EJB lookup (defaults to os.PropertyStore)</li>
- * </ul>
- *
- * @author <a href="mailto:joe@wirestation.co.uk">
- * @author <a href="mailto:plightbo@hotmail.com">Pat Lightbody</a>
- * @version $Revision$
- *
- * @see com.opensymphony.module.propertyset.PropertySet
- * @see com.opensymphony.module.propertyset.ejb.PropertyStore
- * @see com.opensymphony.module.propertyset.ejb.PropertyStoreHome
- */
-public class EJBPropertySet extends AbstractPropertySet implements Serializable {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private PropertyStore store;
-    private String entityName;
-    private long entityId;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-    * Proxy to {@link com.opensymphony.module.propertyset.ejb.PropertyStore#getKeys(java.lang.String,long,java.lang.String,int)}
-    */
-    public Collection getKeys(String prefix, int type) throws PropertyException {
-        try {
-            return store.getKeys(entityName, entityId, prefix, type);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    /**
-    * Proxy to {@link com.opensymphony.module.propertyset.ejb.PropertyStore#getType(java.lang.String,long,java.lang.String)}
-    */
-    public int getType(String key) throws PropertyException {
-        try {
-            return store.getType(entityName, entityId, key);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    /**
-    * Proxy to {@link com.opensymphony.module.propertyset.ejb.PropertyStore#exists(java.lang.String,long,java.lang.String)}
-    */
-    public boolean exists(String key) throws PropertyException {
-        try {
-            return store.exists(entityName, entityId, key);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    public void init(Map config, Map args) {
-        entityId = DataUtil.getLong((Long) args.get("entityId"));
-        entityName = (String) args.get("entityName");
-
-        String storeLocation = (String) config.get("storeLocation");
-
-        if (storeLocation == null) {
-            storeLocation = "PropertyStore";
-        }
-
-        try {
-            PropertyStoreHome home = (PropertyStoreHome) EJBUtils.lookup(storeLocation, PropertyStoreHome.class);
-            store = home.create();
-        } catch (NamingException e) {
-            e.printStackTrace();
-        } catch (RemoteException e) {
-            e.printStackTrace();
-        } catch (CreateException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Proxy to {@link PropertyStore#removeEntry(String, long, String)}
-     */
-    public void remove() throws PropertyException {
-        try {
-            store.removeEntry(entityName, entityId);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    /**
-    * Proxy to {@link PropertyStore#removeEntry(String, long, String)}
-    */
-    public void remove(String key) throws PropertyException {
-        try {
-            store.removeEntry(entityName, entityId, key);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    /**
-    * Proxy to {@link com.opensymphony.module.propertyset.ejb.PropertyStore#set(java.lang.String,long,int,java.lang.String,java.io.Serializable)}
-    */
-    protected void setImpl(int type, String key, Object value) throws PropertyException {
-        try {
-            store.set(entityName, entityId, type, key, (Serializable) value);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-
-    /**
-    * Proxy to {@link com.opensymphony.module.propertyset.ejb.PropertyStore#get(java.lang.String,long,int,java.lang.String)}
-    */
-    protected Object get(int type, String key) throws PropertyException {
-        try {
-            return store.get(entityName, entityId, type, key);
-        } catch (RemoteException re) {
-            throw new PropertyImplementationException(re);
-        }
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/PropertyStoreEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb;
-
-import com.opensymphony.module.propertyset.*;
-import com.opensymphony.module.propertyset.ejb.types.PropertyEntryHomeFactory;
-import com.opensymphony.module.propertyset.ejb.types.PropertyEntryLocal;
-import com.opensymphony.module.propertyset.ejb.types.PropertyEntryLocalHome;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.Serializable;
-
-import java.util.*;
-
-import javax.ejb.*;
-
-import javax.naming.NamingException;
-
-
-/**
- * Session bean implementation of PropertyStore.
- *
- * <p>Makes use of ValueEntityDelegator to determine which entity beans to use for
- * appropriate types.</p>
- *
- * @ejb.bean
- *  type="Stateless"
- *  name="PropertyStore"
- *  view-type="remote"
- *  transaction-type="Container"
- *
- * @ejb.ejb-ref
- *  ejb-name="PropertyEntry"
- *  view-type="local"
- *
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
- * @version $Revision$
- *
- * @see com.opensymphony.module.propertyset.ejb.PropertyStore
- * @see com.opensymphony.module.propertyset.ejb.PropertyStoreHome
- */
-public class PropertyStoreEJB implements SessionBean {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    private static final Log logger = LogFactory.getLog(PropertyStoreEJB.class);
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private PropertyEntryLocalHome entryHome;
-
-    /*public void ejbPostCreate() throws CreateException {}*/
-    private SessionContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    /**
-     * @ejb.interface-method
-     */
-    public Collection getKeys(String entityName, long entityId, String prefix, int type) {
-        try {
-            if (logger.isDebugEnabled()) {
-                logger.debug("getKeys(" + entityName + "," + entityId + ")");
-            }
-
-            List results = new ArrayList();
-            Iterator entries = entryHome.findByNameAndId(entityName, entityId).iterator();
-
-            while (entries.hasNext()) {
-                PropertyEntryLocal entry = (PropertyEntryLocal) entries.next();
-                String key = entry.getKey();
-
-                if (((prefix == null) || key.startsWith(prefix)) && ((type == 0) || (type == entry.getType()))) {
-                    results.add(key);
-                }
-            }
-
-            Collections.sort(results);
-
-            return results;
-        } catch (FinderException e) {
-            logger.error("Could not find keys.", e);
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    public void setSessionContext(SessionContext ctx) {
-        try {
-            entryHome = PropertyEntryHomeFactory.getLocalHome();
-        } catch (NamingException e) {
-            logger.fatal("Could not lookup PropertyEntryHome.", e);
-            throw new EJBException(e);
-        }
-
-        this.context = ctx;
-    }
-
-    /**
-     * @ejb.interface-method
-     */
-    public int getType(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("getType(" + entityName + "," + entityId + ",\"" + key + "\")");
-        }
-
-        try {
-            return entryHome.findByEntity(entityName, entityId, key).getType();
-        } catch (ObjectNotFoundException e) {
-            return 0;
-        } catch (FinderException e) {
-            logger.error("Could not find type.", e);
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    public void ejbActivate() {
-    }
-
-    /**
-     * @ejb.create-method
-     */
-    public void ejbCreate() throws CreateException {
-    }
-
-    public void ejbPassivate() {
-    }
-
-    public void ejbRemove() {
-    }
-
-    /**
-     * @ejb.interface-method
-     */
-    public boolean exists(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("exists(" + entityName + "," + entityId + ",\"" + key + "\")");
-        }
-
-        return getType(entityName, entityId, key) != 0;
-    }
-
-    /**
-     * @ejb.interface-method
-     */
-    public Serializable get(String entityName, long entityId, int type, String key) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("get(" + entityName + "," + entityId + "," + type + ",\"" + key + "\")");
-        }
-
-        try {
-            PropertyEntryLocal entry = entryHome.findByEntity(entityName, entityId, key);
-
-            if (type != entry.getType()) {
-                // type does not match
-                if (logger.isDebugEnabled()) {
-                    logger.debug("wrong property type");
-                }
-
-                throw new InvalidPropertyTypeException();
-            }
-
-            return entry.getValue(); // found it
-        } catch (ObjectNotFoundException e) {
-            // Property does not exist.
-            if (logger.isDebugEnabled()) {
-                logger.debug("no property found");
-            }
-
-            return null;
-        } catch (PropertyException e) {
-            throw e;
-        } catch (Exception e) {
-            logger.error("Could not retrieve value.", e);
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    /**
-     * @ejb.interface-method
-     * @ejb.transaction type="Required"
-     */
-    public void removeEntry(String entityName, long entityId) {
-        try {
-            Collection items = entryHome.findByNameAndId(entityName, entityId);
-            Iterator iter = items.iterator();
-
-            while (iter.hasNext()) {
-                PropertyEntryLocal entry = (PropertyEntryLocal) iter.next();
-                entry.remove();
-            }
-        } catch (FinderException e) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Value did not exist anyway.");
-            }
-        } catch (PropertyException e) {
-            throw e;
-        } catch (Exception e) {
-            logger.error("Could not remove value.", e);
-            throw new PropertyImplementationException("Could not remove value.", e);
-        }
-    }
-
-    /**
-     * @ejb.interface-method
-     */
-    public void removeEntry(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("remove(" + entityName + "," + entityId + ",\"" + key + "\")");
-        }
-
-        try {
-            entryHome.findByEntity(entityName, entityId, key).remove();
-        } catch (ObjectNotFoundException e) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Value did not exist anyway.");
-            }
-        } catch (PropertyException e) {
-            throw e;
-        } catch (Exception e) {
-            logger.error("Could not remove value.", e);
-            throw new PropertyImplementationException("Could not remove value.", e);
-        }
-    }
-
-    /**
-     * @ejb.interface-method
-     */
-    public void set(String entityName, long entityId, int type, String key, Serializable value) {
-        if (logger.isDebugEnabled()) {
-            logger.debug("set(" + entityName + "," + entityId + "," + type + ",\"" + key + "\", [" + value + "] )");
-        }
-
-        // If null, remove value.
-        if (value == null) {
-            removeEntry(entityName, entityId, key);
-
-            return;
-        }
-
-        PropertyEntryLocal entry;
-
-        try {
-            entry = entryHome.findByEntity(entityName, entityId, key);
-
-            // if we get here, then a property with that key already exists
-            if (entry.getType() != type) { // verify existing property is of same type
-
-                if (logger.isWarnEnabled()) {
-                    logger.warn("property is of different type");
-                }
-
-                throw new DuplicatePropertyKeyException();
-            }
-        } catch (ObjectNotFoundException e) {
-            // property with that key does not yet exist
-            try {
-                entry = entryHome.create(entityName, entityId, type, key);
-            } catch (CreateException ce) {
-                logger.error("Could not create new property.", ce);
-                throw new PropertyImplementationException("Could not create new property.", ce);
-            }
-        } catch (PropertyException e) {
-            throw e;
-        } catch (Exception e) {
-            logger.error("Could not set property.", e);
-            throw new PropertyImplementationException("Could not set property.", e);
-        }
-
-        entry.setValue(value);
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/.cvsignore

-*CMP.java
-*HomeFactory.java
-*Local*.java

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/DataEntityEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb.types;
-
-import com.opensymphony.module.propertyset.*;
-
-import com.opensymphony.util.Data;
-import com.opensymphony.util.XMLUtils;
-
-import org.w3c.dom.Document;
-
-import java.io.*;
-
-import java.util.Properties;
-
-import javax.ejb.*;
-
-
-/**
- * AbstractValueEntityEJB concrete implementation optimized for storing binary data.
- * This can be used to store TEXT, OBJECT, DATA, XML, PROPERTIES or anything else
- * that cannot be stored elsewhere.
- *
- * @ejb.bean
- *  type="CMP"
- *  name="PropertyData"
- *  view-type="local"
- *  reentrant="False"
- *  primkey-field="id"
- *
- * @ejb.pk class="java.lang.Long" extends="java.lang.Object"
- *
- * @ejb.persistence table-name="OS_PROPERTYDATA"
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
- * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- *
- */
-public abstract class DataEntityEJB implements EntityBean {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    /**
-     * Flag to signify no value in a property. Some db's can't store nulls or 0 length fields in LOBs properly.
-     */
-    private static final byte[] NULL_DATA = "hello world".getBytes();
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private EntityContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public abstract void setBytes(byte[] data);
-
-    /**
-     * @ejb.persistence column-name="value"
-     */
-    public abstract byte[] getBytes();
-
-    public abstract void setId(Long id);
-
-    /**
-     * @ejb.pk-field
-     * @ejb.interface-method
-     * @ejb.persistence column-name="id"
-     */
-    public abstract Long getId();
-
-    public void setEntityContext(EntityContext context) {
-        this.context = context;
-    }
-
-    /**
-     * Set the value. Depending on the type, different casting serializing will occur.
-     *
-     * <p>For TEXT, value must be java.lang.String.<br>
-     * For OBJECT, value must be Serializable object.<br>
-     * For XML, value must be org.w3c.dom.Document.<br>
-     * For DATA, value must be com.opensymphony.util.Data<br>
-     * For PROPERTIES, value must be java.util.Properties<br>
-     *
-     * @ejb.interface-method
-     */
-    public void setValue(int type, Serializable value) {
-        if (value == null) {
-            setBytes(NULL_DATA);
-
-            return;
-        }
-
-        try {
-            switch (type) {
-            case PropertySet.TEXT:
-                setBytes(((String) value).getBytes());
-
-                break;
-
-            case PropertySet.OBJECT:
-
-                if (!(value instanceof Serializable)) {
-                    throw new IllegalPropertyException("Object not serializable.");
-                }
-
-                setBytes(writeObject(value));
-
-                break;
-
-            case PropertySet.XML:
-                setBytes(writeXML((Document) value));
-
-                break;
-
-            case PropertySet.DATA:
-                setBytes(((Data) value).getBytes());
-
-                break;
-
-            case PropertySet.PROPERTIES:
-                setBytes(writeProperties((Properties) value));
-
-                break;
-
-            default:
-
-                // this should never happen.
-                throw new PropertyImplementationException("Cannot store this type of property.");
-            }
-
-            if (getBytes().length == 0) {
-                setBytes(NULL_DATA); // some db's have problems storing nothing
-            }
-        } catch (ClassCastException ce) {
-            throw new IllegalPropertyException("Cannot cast value to appropriate type for persistence.");
-        }
-    }
-
-    /**
-     * Create appropriate wrapper object around value (String, Object, Document, Data, Properties).
-     *
-     * @ejb.interface-method
-     */
-    public Serializable getValue(int type) {
-        byte[] value = getBytes();
-
-        switch (type) {
-        case PropertySet.TEXT:
-            return new String(value);
-
-        case PropertySet.OBJECT:
-            return (Serializable) readObject(value);
-
-        case PropertySet.XML:
-            return (Serializable) readXML(value);
-
-        case PropertySet.DATA:
-            return new Data(value);
-
-        case PropertySet.PROPERTIES:
-            return readProperties(value);
-
-        default:
-
-            // this should never happen.
-            throw new PropertyImplementationException("Cannot retrieve this type of property.");
-        }
-    }
-
-    public void ejbActivate() {
-    }
-
-    /**
-     * @ejb.create-method
-     */
-    public Long ejbCreate(int type, long id) throws CreateException {
-        setId(new Long(id));
-
-        // the concrete setValue() method shall set value to default (not null).
-        setValue(type, null);
-
-        return null;
-    }
-
-    public void ejbLoad() {
-    }
-
-    public void ejbPassivate() {
-    }
-
-    public void ejbPostCreate(int type, long id) throws CreateException {
-    }
-
-    public void ejbRemove() throws RemoveException {
-    }
-
-    public void ejbStore() {
-    }
-
-    public void unsetEntityContext() {
-        context = null;
-    }
-
-    /**
-     * Returns { PropertySet.TEXT, PropertySet.OBJECT, PropertySet.XML, PropertySet.DATA, PropertySet.PROPERTIES }
-     */
-    protected int[] allowedTypes() {
-        return new int[] {
-            PropertySet.TEXT, PropertySet.OBJECT, PropertySet.XML,
-            PropertySet.DATA, PropertySet.PROPERTIES
-        };
-    }
-
-    /**
-     * DeSerialize an Object from byte array.
-     */
-    private Object readObject(byte[] data) {
-        try {
-            ByteArrayInputStream bytes = new ByteArrayInputStream(data);
-            ObjectInputStream stream = new ObjectInputStream(bytes);
-            Object result = stream.readObject();
-            stream.close();
-
-            return result;
-        } catch (IOException e) {
-            throw new PropertyImplementationException("Cannot deserialize Object", e);
-        } catch (ClassNotFoundException e) {
-            throw new PropertyImplementationException("Class not found for Object", e);
-        }
-    }
-
-    /**
-     * Load java.util.Properties from byte array.
-     */
-    private Properties readProperties(byte[] data) {
-        try {
-            ByteArrayInputStream bytes = new ByteArrayInputStream(data);
-            Properties result = new Properties();
-            result.load(bytes);
-
-            return result;
-        } catch (Exception e) {
-            throw new PropertyImplementationException("Cannot load Properties.", e);
-        }
-    }
-
-    /**
-     * Parse XML document from String in byte array.
-     */
-    private Document readXML(byte[] data) {
-        try {
-            ByteArrayInputStream bytes = new ByteArrayInputStream(data);
-
-            return XMLUtils.parse(bytes);
-        } catch (Exception e) {
-            throw new PropertyImplementationException("Cannot parse XML data.", e);
-        }
-    }
-
-    /**
-     * Serialize an Object to byte array.
-     */
-    private byte[] writeObject(Object o) {
-        try {
-            ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-            ObjectOutputStream stream = new ObjectOutputStream(bytes);
-            stream.writeObject(o);
-            stream.close();
-            bytes.flush();
-
-            return bytes.toByteArray();
-        } catch (IOException e) {
-            throw new PropertyImplementationException("Cannot serialize Object", e);
-        }
-    }
-
-    /**
-     * Store java.util.Properties to byte array.
-     */
-    private byte[] writeProperties(Properties p) {
-        try {
-            ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-            p.store(bytes, null);
-            bytes.flush();
-
-            return bytes.toByteArray();
-        } catch (IOException e) {
-            throw new PropertyImplementationException("Cannot store Properties.", e);
-        }
-    }
-
-    /**
-     * Serialize (print) XML document to byte array (as String).
-     */
-    private byte[] writeXML(Document doc) {
-        try {
-            ByteArrayOutputStream bytes = new ByteArrayOutputStream();
-            XMLUtils.print(doc, bytes);
-            bytes.flush();
-
-            return bytes.toByteArray();
-        } catch (IOException e) {
-            throw new PropertyImplementationException("Cannot serialize XML", e);
-        }
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/DateEntityEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb.types;
-
-import com.opensymphony.module.propertyset.PropertyImplementationException;
-import com.opensymphony.module.propertyset.PropertySet;
-
-import java.sql.Timestamp;
-
-import javax.ejb.*;
-
-
-/**
- * AbstractValueEntityEJB concrete implementation optimized for storing Dates.
- *
- * @ejb.bean
- *  type="CMP"
- *  view-type="local"
- *  name="PropertyDate"
- *  schema="PropertyDate"
- *  reentrant="False"
- *  primkey-field="id"
- *
- * @ejb.pk class="java.lang.Long" extends="java.lang.Object"
- *
- * @ejb.persistence table-name="OS_PROPERTYDATE"
- *
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- *
- * @see com.opensymphony.module.propertyset.ejb.PropertyStoreEJB
- */
-public abstract class DateEntityEJB implements EntityBean {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private EntityContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public abstract void setDate(Timestamp date);
-
-    /**
-     * @ejb.persistence column-name="value"
-     */
-    public abstract Timestamp getDate();
-
-    public abstract void setId(Long id);
-
-    /**
-     * @ejb.pk-field
-     * @ejb.interface-method
-     * @ejb.persistence column-name="id"
-     */
-    public abstract Long getId();
-
-    public void setEntityContext(EntityContext context) {
-        this.context = context;
-    }
-
-    /**
-     * Set the value. Only java.util.Timestamp can be supplied.
-     *
-     * @ejb.interface-method
-     */
-    public void setValue(int type, Timestamp value) {
-        if (value == null) {
-            setDate(new Timestamp(0L));
-
-            return;
-        }
-
-        if (type == PropertySet.DATE) {
-            setDate(value);
-
-            return;
-        } else {
-            throw new PropertyImplementationException("Cannot store this type of property.");
-        }
-    }
-
-    /**
-     * Return Date
-     *
-     * @ejb.interface-method
-     */
-    public Timestamp getValue(int type) {
-        switch (type) {
-        case PropertySet.DATE:
-            return getDate();
-
-        default:
-
-            // this should never happen.
-            throw new PropertyImplementationException("Cannot retrieve this type of property.");
-        }
-    }
-
-    public void ejbActivate() {
-    }
-
-    /**
-     * @ejb.create-method
-     */
-    public Long ejbCreate(int type, long id) throws CreateException {
-        setId(new Long(id));
-
-        // the concrete setValue() method shall set value to default (not null).
-        setValue(type, null);
-
-        return null;
-    }
-
-    public void ejbLoad() {
-    }
-
-    public void ejbPassivate() {
-    }
-
-    public void ejbPostCreate(int type, long id) throws CreateException {
-    }
-
-    public void ejbRemove() throws RemoveException {
-    }
-
-    public void ejbStore() {
-    }
-
-    public void unsetEntityContext() {
-        context = null;
-    }
-
-    /**
-     * Returns { PropertySet.DATE }
-     */
-    protected int[] allowedTypes() {
-        return new int[] {PropertySet.DATE};
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/DecimalEntityEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb.types;
-
-import com.opensymphony.module.propertyset.PropertyImplementationException;
-import com.opensymphony.module.propertyset.PropertySet;
-
-import javax.ejb.*;
-
-
-/**
- * AbstractValueEntityEJB concrete implementation optimized for storing decimal numbers.
- * This can be used to store DOUBLE.
- *
- * @ejb.bean
- *  type="CMP"
- *  name="PropertyDecimal"
- *  schema="PropertyDecimal"
- *  view-type="local"
- *  reentrant="False"
- *  primkey-field="id"
- *
- * @ejb.pk class="java.lang.Long" extends="java.lang.Object"
- *
- * @ejb.persistence table-name="OS_PROPERTYDECIMAL"
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
- * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- *
- * @see com.opensymphony.module.propertyset.ejb.PropertyStoreEJB
- */
-public abstract class DecimalEntityEJB implements EntityBean {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private EntityContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public abstract void setDecimal(double date);
-
-    /**
-     * @ejb.persistence column-name="value"
-     */
-    public abstract double getDecimal();
-
-    public abstract void setId(Long id);
-
-    /**
-     * @ejb.pk-field
-     * @ejb.interface-method
-     * @ejb.persistence column-name="id"
-     */
-    public abstract Long getId();
-
-    public void setEntityContext(EntityContext context) {
-        this.context = context;
-    }
-
-    /**
-     * Set the value. Only java.lang.Number can be supplied.
-     *
-     * @ejb.interface-method
-     */
-    public void setValue(int type, Double value) {
-        if (value == null) {
-            setDecimal(0.0);
-
-            return;
-        }
-
-        if (type == PropertySet.DOUBLE) {
-            setDecimal(value.doubleValue());
-        } else {
-            throw new PropertyImplementationException("Cannot store this type of property.");
-        }
-    }
-
-    /**
-     * Create appropriate wrapper object around value (Double).
-     *
-     * @ejb.interface-method
-     */
-    public Double getValue(int type) {
-        if (type == PropertySet.DOUBLE) {
-            return new Double(getDecimal());
-        } else {
-            throw new PropertyImplementationException("Cannot retrieve this type of property.");
-        }
-    }
-
-    public void ejbActivate() {
-    }
-
-    /**
-     * @ejb.create-method
-     */
-    public Long ejbCreate(int type, long id) throws CreateException {
-        setId(new Long(id));
-
-        // the concrete setValue() method shall set value to default (not null).
-        setValue(type, null);
-
-        return null;
-    }
-
-    public void ejbLoad() {
-    }
-
-    public void ejbPassivate() {
-    }
-
-    public void ejbPostCreate(int type, long id) throws CreateException {
-    }
-
-    public void ejbRemove() throws RemoveException {
-    }
-
-    public void ejbStore() {
-    }
-
-    public void unsetEntityContext() {
-        context = null;
-    }
-
-    /**
-     * Returns { PropertySet.DOUBLE }
-     */
-    protected int[] allowedTypes() {
-        return new int[] {PropertySet.DOUBLE};
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/NumberEntityEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb.types;
-
-import com.opensymphony.module.propertyset.*;
-
-import java.io.Serializable;
-
-import javax.ejb.*;
-
-
-/**
- * AbstractValueEntityEJB concrete implementation optimized for storing numbers.
- *  This can be used to store BOOLEAN, INT and LONG.
- *
- * @ejb.bean
- *  type="CMP"
- *  name="PropertyNumber"
- *  schema="PropertyNumber"
- *  view-type="local"
- *  reentrant="False"
- *  primkey-field="id"
- *
- * @ejb.pk class="java.lang.Long" extends="java.lang.Object"
- *
- * @ejb.persistence table-name="OS_PROPERTYNUMBER"
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
- * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
- * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
- * @version $Revision$
- *
- * @see com.opensymphony.module.propertyset.ejb.PropertyStoreEJB
- */
-public abstract class NumberEntityEJB implements EntityBean {
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    private EntityContext context;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public abstract void setId(Long id);
-
-    /**
-     * @ejb.pk-field
-     * @ejb.interface-method
-     * @ejb.persistence column-name="id"
-     */
-    public abstract Long getId();
-
-    public abstract void setNumber(long date);
-
-    /**
-     * @ejb.persistence column-name="value"
-     */
-    public abstract long getNumber();
-
-    public void setEntityContext(EntityContext context) {
-        this.context = context;
-    }
-
-    /**
-     * Set the value. Only java.lang.Number, java.lang.Boolean or java.util.Date can be supplied.
-     *
-     * @ejb.interface-method
-     */
-    public void setValue(int type, Serializable value) {
-        if (value == null) {
-            setNumber(0L);
-
-            return;
-        }
-
-        try {
-            switch (type) {
-            case PropertySet.BOOLEAN:
-                setNumber(((Boolean) value).booleanValue() ? 1L : 0L);
-
-                return;
-
-            case PropertySet.INT:
-            case PropertySet.LONG:
-                setNumber(((Number) value).longValue());
-
-                return;
-
-            default:
-
-                // this should never happen.
-                throw new PropertyImplementationException("Cannot store this type of property.");
-            }
-        } catch (ClassCastException ce) {
-            throw new IllegalPropertyException("Cannot cast value to appropriate type for persistence.");
-        }
-    }
-
-    /**
-     * Create appropriate wrapper object around value (Boolean, Integer, Long).
-     *
-     * @ejb.interface-method
-     */
-    public Serializable getValue(int type) {
-        long value = getNumber();
-
-        switch (type) {
-        case PropertySet.BOOLEAN:
-            return (value == 0L) ? Boolean.FALSE : Boolean.TRUE;
-
-        case PropertySet.INT:
-            return new Integer((int) value);
-
-        case PropertySet.LONG:
-            return new Long(value);
-
-        default:
-
-            // this should never happen.
-            throw new PropertyImplementationException("Cannot retrieve this type of property.");
-        }
-    }
-
-    public void ejbActivate() {
-    }
-
-    /**
-     * @ejb.create-method
-     */
-    public Long ejbCreate(int type, long id) throws CreateException {
-        setId(new Long(id));
-
-        // the concrete setValue() method shall set value to default (not null).
-        setValue(type, null);
-
-        return null;
-    }
-
-    public void ejbLoad() {
-    }
-
-    public void ejbPassivate() {
-    }
-
-    public void ejbPostCreate(int type, long id) throws CreateException {
-    }
-
-    public void ejbRemove() throws RemoveException {
-    }
-
-    public void ejbStore() {
-    }
-
-    public void unsetEntityContext() {
-        context = null;
-    }
-
-    /**
-     * Returns { PropertySet.BOOLEAN, PropertySet.INT, PropertySet.LONG }
-     */
-    protected int[] allowedTypes() {
-        return new int[] {PropertySet.BOOLEAN, PropertySet.INT, PropertySet.LONG};
-    }
-}

providers/ejb2/src/com/opensymphony/module/propertyset/ejb/types/PropertyEntryEJB.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ejb.types;
-
-import com.opensymphony.module.propertyset.PropertySet;
-import com.opensymphony.module.sequence.SequenceGenerator;
-import com.opensymphony.module.sequence.SequenceGeneratorHome;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.Serializable;
-
-import java.sql.Timestamp;
-
-import javax.ejb.*;
-
-import javax.naming.InitialContext;
-
-import javax.rmi.PortableRemoteObject;
-
-
-/**
- * @ejb.bean
- *  type="CMP"
- *  view-type="local"
- *  name="PropertyEntry"
- *  reentrant="False"
- *  schema="PropertyEntry"
- *  primkey-field="id"
- *
- * @ejb.pk class="java.lang.Long" extends="java.lang.Object"
- *
- * @ejb.persistence table-name="OS_PROPERTYENTRY"
- *
- * @ejb.ejb-ref
- *  ejb-name="PropertyNumber"
- *  view-type="local"
- * @ejb.ejb-ref
- *  ejb-name="PropertyDate"
- *  view-type="local"
- * @ejb.ejb-ref
- *  ejb-name="PropertyData"
- *  view-type="local"
- * @ejb.ejb-ref
- *  ejb-name="PropertyString"