Commits

Anonymous committed f4328c8

Renamed ofbiz 2 module with plans to support the current version 9. And if necessary version 4.

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

Comments (0)

Files changed (22)

providers/ofbiz/pom.xml

-<project xmlns="http://maven.apache.org/POM/4.0.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>com.opensymphony.propertyset.providers</groupId>
-	    <artifactId>parent</artifactId>
-		<version>1.5.0-SNAPSHOT</version>
-	</parent>
-	<groupId>com.opensymphony.propertyset.providers</groupId>
-	<artifactId>ofbiz</artifactId>
-	<packaging>jar</packaging>
-
-	<name>PropertySet -> Providers -> OFBiz</name>
-	<description></description>
-
-	<dependencies>
-		<dependency>
-			<groupId>com.opensymphony.propertyset</groupId>
-			<artifactId>api</artifactId>
-			<version>${project.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-logging</groupId>
-			<artifactId>commons-logging</artifactId>
-			<version>1.1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>org.ofbiz.ofbcore</groupId>
-			<artifactId>ofbcore-share</artifactId>
-			<version>2.1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>org.ofbiz.ofbcore</groupId>
-			<artifactId>ofbcore-entity</artifactId>
-			<version>2.1.1</version>
-		</dependency>
-</dependencies>
-
-
-</project>

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/DataPropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-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;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public class DataPropertyHandler implements PropertyHandler {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    // Attributes ----------------------------------------------------
-    private static final byte[] NULL_DATA = "hello world".getBytes();
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Static --------------------------------------------------------
-    // Constructors --------------------------------------------------
-    // Public --------------------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException {
-        byte[] value = (byte[]) input;
-
-        switch (type) {
-        case PropertySet.TEXT:
-            return new String(value);
-
-        case PropertySet.OBJECT:
-            return readObject(value);
-
-        case PropertySet.XML:
-            return readXML(value);
-
-        case PropertySet.DATA:
-            return new Data(value);
-
-        case PropertySet.PROPERTIES:
-            return readProperties(value);
-
-        default:
-            throw new PropertyImplementationException("Cannot retrieve this type of property.");
-        }
-    }
-
-    public Object processSet(int type, Object input) throws PropertyException {
-        if (input == null) {
-            return (NULL_DATA);
-        }
-
-        try {
-            switch (type) {
-            case PropertySet.TEXT:
-                return (((String) input).getBytes());
-
-            case PropertySet.OBJECT:
-
-                if (!(input instanceof Serializable)) {
-                    throw new IllegalPropertyException("Object not serializable.");
-                }
-
-                return (writeObject(input));
-
-            case PropertySet.XML:
-                return (writeXML((Document) input));
-
-            case PropertySet.DATA:
-
-                if (input instanceof Data) {
-                    return (((Data) input).getBytes());
-                } else if (input instanceof byte[]) {
-                    return (byte[]) input;
-                } else {
-                    throw new IllegalPropertyException("DATA is not an instance of Data or byte[].");
-                }
-
-            case PropertySet.PROPERTIES:
-                return (writeProperties((Properties) input));
-
-            default:
-                throw new PropertyImplementationException("Cannot store this type of property.");
-            }
-        } catch (ClassCastException ce) {
-            throw new IllegalPropertyException("Cannot cast value to appropriate type for persistence.");
-        }
-    }
-
-    /**
-     * 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);
-        }
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-
-    /**
-     * 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);
-        }
-    }
-
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/DatePropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.*;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public class DatePropertyHandler implements PropertyHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Attributes ----------------------------------------------------
-    // Static --------------------------------------------------------
-    // Constructors --------------------------------------------------
-    // Public --------------------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException {
-        if (type == PropertySet.DATE) {
-            return input;
-        }
-
-        throw new InvalidPropertyTypeException("Could not recognize date type");
-    }
-
-    public Object processSet(int type, Object input) throws PropertyException {
-        if (type == PropertySet.DATE) {
-            if (input instanceof java.util.Date) {
-                return new java.sql.Timestamp(((java.util.Date) input).getTime());
-            } else if (input instanceof java.sql.Date) {
-                return new java.sql.Timestamp(((java.sql.Date) input).getTime());
-            } else if (input instanceof java.sql.Timestamp) {
-                return input;
-            }
-        }
-
-        throw new InvalidPropertyTypeException("Cannot set a date type of " + type + " for input: " + input);
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/DecimalPropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.*;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public class DecimalPropertyHandler implements PropertyHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Attributes ----------------------------------------------------
-    // Static --------------------------------------------------------
-    // Constructors --------------------------------------------------
-    // Public --------------------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException {
-        if (type == PropertySet.DOUBLE) {
-            return input;
-        }
-
-        throw new InvalidPropertyTypeException();
-    }
-
-    public Object processSet(int type, Object input) throws PropertyException {
-        if (type == PropertySet.DOUBLE) {
-            return input;
-        }
-
-        throw new InvalidPropertyTypeException();
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/NumberPropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.*;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public class NumberPropertyHandler implements PropertyHandler {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    // Attributes ----------------------------------------------------
-    // Static --------------------------------------------------------
-    private static final Long ZERO = new Long(0);
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Constructors --------------------------------------------------
-    // Public --------------------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException {
-        if (input instanceof Long) {
-            Long value = (Long) input;
-
-            switch (type) {
-            case PropertySet.BOOLEAN:
-                return value.equals(ZERO) ? Boolean.FALSE : Boolean.TRUE;
-
-            case PropertySet.INT:
-                return new Integer(value.intValue());
-
-            case PropertySet.LONG:
-                return value;
-
-            default:
-                throw new PropertyImplementationException("Cannot retrieve this type of property");
-            }
-        }
-
-        throw new PropertyImplementationException("Unexepected type of property");
-    }
-
-    public Object processSet(int type, Object input) throws PropertyException {
-        if (input == null) {
-            return new Long(0);
-        }
-
-        try {
-            switch (type) {
-            case PropertySet.BOOLEAN:
-                return new Long((((Boolean) input).booleanValue() ? 1L : 0L));
-
-            case PropertySet.INT:
-            case PropertySet.LONG:
-                return new Long(((Number) input).longValue());
-
-            default:
-                throw new PropertyImplementationException("Cannot store this type of property");
-            }
-        } catch (ClassCastException e) {
-            throw new IllegalPropertyException("Cannot cast value to appropiate type");
-        }
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/OFBizPropertySet.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.*;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.ofbiz.core.entity.*;
-import org.ofbiz.core.util.UtilMisc;
-
-import java.io.Serializable;
-
-import java.util.*;
-
-
-/**
- * This is the property set implementation for storing properties in the OFBiz Entity Engine.
- * <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>delegator.name</b> - the name of the Ofbiz delegator, defaults to "default"</li>
- * </ul>
- *
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * @author <a href="mailto:mike@atlassian.com">Mike Cannon-Brookes</a>
- * $Revision$
- */
-public class OFBizPropertySet extends AbstractPropertySet implements Serializable {
-    //~ Static fields/initializers /////////////////////////////////////////////
-
-    private static final Log log = LogFactory.getLog(OFBizPropertySet.class);
-
-    // Attributes ----------------------------------------------------
-    static Map entityTypeMap;
-
-    static {
-        PropertyHandler stringHandler = new StringPropertyHandler();
-        PropertyHandler textHandler = new StringPropertyHandler();
-        PropertyHandler dateHandler = new DatePropertyHandler();
-        PropertyHandler dataHandler = new DataPropertyHandler();
-        PropertyHandler numberHandler = new NumberPropertyHandler();
-        PropertyHandler decimalHandler = new DecimalPropertyHandler();
-
-        entityTypeMap = new HashMap();
-        entityTypeMap.put(new Integer(PropertySet.BOOLEAN), new TypeMap("OSPropertyNumber", numberHandler));
-        entityTypeMap.put(new Integer(PropertySet.INT), new TypeMap("OSPropertyNumber", numberHandler));
-        entityTypeMap.put(new Integer(PropertySet.LONG), new TypeMap("OSPropertyNumber", numberHandler));
-        entityTypeMap.put(new Integer(PropertySet.DOUBLE), new TypeMap("OSPropertyDecimal", decimalHandler));
-        entityTypeMap.put(new Integer(PropertySet.STRING), new TypeMap("OSPropertyString", stringHandler));
-        entityTypeMap.put(new Integer(PropertySet.TEXT), new TypeMap("OSPropertyText", textHandler));
-        entityTypeMap.put(new Integer(PropertySet.DATE), new TypeMap("OSPropertyDate", dateHandler));
-        entityTypeMap.put(new Integer(PropertySet.OBJECT), new TypeMap("OSPropertyData", dataHandler));
-        entityTypeMap.put(new Integer(PropertySet.XML), new TypeMap("OSPropertyData", dataHandler));
-        entityTypeMap.put(new Integer(PropertySet.DATA), new TypeMap("OSPropertyData", dataHandler));
-        entityTypeMap.put(new Integer(PropertySet.PROPERTIES), new TypeMap("OSPropertyData", dataHandler));
-    }
-
-    //~ Instance fields ////////////////////////////////////////////////////////
-
-    Long entityId;
-    String delegatorName;
-    String entityName;
-
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    public Collection getKeys() throws PropertyException {
-        List results = new ArrayList();
-
-        try {
-            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
-
-            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
-                GenericValue value = (GenericValue) iterator.next();
-                String propertyKey = value.getString("propertyKey");
-
-                if (propertyKey != null) {
-                    results.add(propertyKey);
-                }
-            }
-
-            Collections.sort(results);
-        } catch (GenericEntityException e) {
-            throw new PropertyImplementationException(e);
-        }
-
-        return results;
-    }
-
-    public Collection getKeys(String prefix) throws PropertyException {
-        List results = new ArrayList();
-
-        try {
-            // chowda hack
-            if (prefix == null) {
-                prefix = "";
-            }
-
-            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
-
-            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
-                GenericValue value = (GenericValue) iterator.next();
-                String propertyKey = value.getString("propertyKey");
-
-                if ((propertyKey != null) && propertyKey.startsWith(prefix)) {
-                    results.add(propertyKey);
-                }
-            }
-
-            Collections.sort(results);
-        } catch (GenericEntityException e) {
-            throw new PropertyImplementationException(e);
-        }
-
-        return results;
-    }
-
-    public Collection getKeys(String prefix, int type) throws PropertyException {
-        List results = new ArrayList();
-
-        try {
-            // chowda hack
-            if (prefix == null) {
-                prefix = "";
-            }
-
-            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
-
-            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
-                GenericValue value = (GenericValue) iterator.next();
-                String propertyKey = value.getString("propertyKey");
-                Integer entryType = value.getInteger("type");
-
-                if (((propertyKey != null) && propertyKey.startsWith(prefix)) && (entryType.intValue() == type)) {
-                    results.add(propertyKey);
-                }
-            }
-
-            Collections.sort(results);
-        } catch (GenericEntityException e) {
-            throw new PropertyImplementationException(e);
-        }
-
-        return results;
-    }
-
-    public int getType(String key) throws PropertyException {
-        GenericValue v = findPropertyEntry(key);
-
-        if (v == null) {
-            throw new PropertyImplementationException("Property '" + key + "' not found");
-        }
-
-        return v.getInteger("type").intValue();
-    }
-
-    // Public --------------------------------------------------------
-    public boolean exists(String key) throws PropertyException {
-        if (findPropertyEntry(key) != null) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    // Constructors --------------------------------------------------
-    public void init(Map config, Map args) {
-        delegatorName = (String) config.get("delegator.name");
-
-        if (delegatorName == null) {
-            delegatorName = "default";
-        }
-
-        entityId = (Long) args.get("entityId");
-        entityName = (String) args.get("entityName");
-    }
-
-    public void remove() throws PropertyException {
-        //hani: todo this needs to be optimised rather badly, but I have no idea how
-        Collection keys = getKeys();
-        Iterator iter = keys.iterator();
-
-        while (iter.hasNext()) {
-            String key = (String) iter.next();
-            remove(key);
-        }
-    }
-
-    public void remove(String key) throws PropertyException {
-        try {
-            // remove actual property
-            int type = this.getType(key);
-            GenericValue v = findPropertyEntry(key);
-
-            if (v != null) {
-                Integer t = v.getInteger("type");
-                Long id = v.getLong("id");
-
-                if (type != t.intValue()) {
-                    throw new InvalidPropertyTypeException();
-                }
-
-                TypeMap tm = (TypeMap) entityTypeMap.get(t);
-                getDelegator().removeByAnd(tm.getEntity(), UtilMisc.toMap("id", id));
-            }
-
-            // now remove the property entry
-            getDelegator().removeByAnd("OSPropertyEntry", makePropertyEntryFields(key));
-        } catch (GenericEntityException e) {
-            log.error("Error removing value from PropertySet", e);
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    public boolean supportsType(int type) {
-        switch (type) {
-        case DATA:
-        case OBJECT:
-        case PROPERTIES:
-        case XML:
-            return false;
-        }
-
-        return true;
-    }
-
-    protected void setImpl(int type, String key, Object obj) throws PropertyException {
-        try {
-            Long id;
-
-            GenericValue propertyEntry = findPropertyEntry(key);
-
-            if (propertyEntry == null) {
-                id = getDelegator().getNextSeqId("OSPropertyEntry");
-                propertyEntry = getDelegator().makeValue("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "id", id, "entityName", entityName, "type", new Integer(type), "propertyKey", key));
-            } else {
-                id = propertyEntry.getLong("id");
-            }
-
-            TypeMap tm = (TypeMap) entityTypeMap.get(new Integer(type));
-            GenericValue propertyTypeEntry = getDelegator().makeValue(tm.getEntity(), UtilMisc.toMap("id", id, "value", processSet(type, obj)));
-
-            List entities = new ArrayList();
-            entities.add(propertyEntry);
-            entities.add(propertyTypeEntry);
-            getDelegator().storeAll(entities);
-        } catch (GenericEntityException e) {
-            log.error("Error setting value in PropertySet", e);
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    protected Object get(int type, String key) throws PropertyException {
-        try {
-            GenericValue v = findPropertyEntry(key);
-
-            if (v != null) {
-                Integer t = v.getInteger("type");
-                Long id = v.getLong("id");
-
-                if (type != t.intValue()) {
-                    throw new InvalidPropertyTypeException();
-                }
-
-                TypeMap tm = (TypeMap) entityTypeMap.get(t);
-                GenericValue property = (GenericValue) getDelegator().findByPrimaryKey(tm.getEntity(), UtilMisc.toMap("id", id));
-
-                if (property == null) {
-                    return null;
-                }
-
-                return processGet(type, property.get("value"));
-            }
-        } catch (GenericEntityException e) {
-            throw new PropertyImplementationException(e);
-        }
-
-        return null;
-    }
-
-    private GenericDelegator getDelegator() {
-        return GenericDelegator.getGenericDelegator(delegatorName);
-    }
-
-    private GenericValue findPropertyEntry(String key) throws PropertyException {
-        try {
-            Collection c = getDelegator().findByAnd("OSPropertyEntry", makePropertyEntryFields(key));
-
-            if ((c == null) || (c.size() == 0)) {
-                return null;
-            }
-
-            return (GenericValue) c.iterator().next();
-        } catch (GenericEntityException e) {
-            throw new PropertyImplementationException(e);
-        }
-    }
-
-    private Map makePropertyEntryFields(String key) {
-        return UtilMisc.toMap("propertyKey", key, "entityName", entityName, "entityId", entityId);
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-    // @todo implement processRemove
-    private Object processGet(int type, Object input) throws PropertyException {
-        if (input == null) {
-            return null;
-        }
-
-        TypeMap typeMap = (TypeMap) entityTypeMap.get(new Integer(type));
-        PropertyHandler handler = typeMap.getHandler();
-
-        return handler.processGet(type, input);
-    }
-
-    private Object processSet(int type, Object input) throws PropertyException {
-        if (input == null) {
-            return null;
-        }
-
-        TypeMap typeMap = (TypeMap) entityTypeMap.get(new Integer(type));
-        PropertyHandler handler = typeMap.getHandler();
-
-        return handler.processSet(type, input);
-    }
-
-    //~ Inner Classes //////////////////////////////////////////////////////////
-
-    // Static --------------------------------------------------------
-    static class TypeMap {
-        PropertyHandler handler;
-        String entity;
-
-        public TypeMap(String entity, PropertyHandler handler) {
-            this.entity = entity;
-            this.handler = handler;
-        }
-
-        public String getEntity() {
-            return entity;
-        }
-
-        public PropertyHandler getHandler() {
-            return handler;
-        }
-    }
-
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/PropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.PropertyException;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public interface PropertyHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Public Interfaces ---------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException;
-
-    public Object processSet(int type, Object input) throws PropertyException;
-}

providers/ofbiz/src/main/java/com/opensymphony/module/propertyset/ofbiz/StringPropertyHandler.java

-/*
- * Copyright (c) 2002-2003 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.module.propertyset.ofbiz;
-
-import com.opensymphony.module.propertyset.*;
-
-
-/**
- * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
- * $Revision$
- */
-public class StringPropertyHandler implements PropertyHandler {
-    //~ Methods ////////////////////////////////////////////////////////////////
-
-    // Attributes ----------------------------------------------------
-    // Static --------------------------------------------------------
-    // Constructors --------------------------------------------------
-    // Public --------------------------------------------------------
-    public Object processGet(int type, Object input) throws PropertyException {
-        if (((type == PropertySet.STRING) || (type == PropertySet.TEXT)) && input instanceof String) {
-            return (String) input;
-        } else {
-            throw new InvalidPropertyTypeException();
-        }
-    }
-
-    /**
-     * Note: the error when setting a string > 255 chars is handled in AbstractPropertySet
-     */
-    public Object processSet(int type, Object input) throws PropertyException {
-        if (((type == PropertySet.STRING) || (type == PropertySet.TEXT)) && input instanceof String) {
-            return (String) input;
-        } else {
-            throw new InvalidPropertyTypeException();
-        }
-    }
-
-    // Package protected ---------------------------------------------
-    // Protected -----------------------------------------------------
-    // Private -------------------------------------------------------
-    // Inner classes -------------------------------------------------
-}

providers/ofbiz/src/main/resources/maven/ofbcore-deploy.txt

-HOW TO INSTALL THE OFBIZ CORE CLASSES
-
-If you don't already have the entity and share JARs you can download them from 
-the following location:
-
-    https://maven.atlassian.com/content/groups/m1/ofbcore/jars/
-
-To deploy the the JAR files to your own shared/team repository copy the jar 
-into this directory and run the following command:
-
-    mvn deploy:deploy-file
-        -DpomFile=ofbcore-entity.pom
-        -Dfile=ofbcore-entity-2.1.1-atlassian.jar
-        -DrepositoryId=YOUR_REPO_ID
-        -Durl=YOUR_REPO_URL
-
-    mvn deploy:deploy-file
-        -DpomFile=ofbcore-share.pom
-        -Dfile=ofbcoire-share-2.1.1.jar
-        -DrepositoryId=YOUR_REPO_ID
-        -Durl=YOUR_REPO_URL
-
-To install the ejb.jar file to your local repository copy the jar into this 
-directory and run the following command:
-
-    mvn install:install-file
-        -DpomFile=ofbcore-entity.pom
-        -Dfile=ofbcore-entity-2.1.1-atlassian.jar
-
-    mvn install:install-file
-        -DpomFile=ofbcore-share.pom
-        -Dfile=ofbcoire-share-2.1.1.jar

providers/ofbiz/src/main/resources/maven/ofbcore-entity.pom

-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-	<modelVersion>4.0.0</modelVersion>
-
-	<groupId>org.ofbiz.ofbcore</groupId>
-	<artifactId>ofbcore-entity</artifactId>
-	<version>2.1.1</version>
-
-	<name>OFBiz Core - Entity</name>
-	<description>
-		This came from the Maven 1 public Atlassian repository: http://maven.atlassian.com/content/groups/m1/. This file
-		could not be found anywhere on the offical site nor any project source repository. 
-	</description>
-
-	<organization>
-		<name>Apache Open For Business</name>
-		<url>http://ofbiz.apache.org</url>
-	</organization>
-        
-	<distributionManagement>
-		<downloadUrl>https://maven.atlassian.com/content/groups/m1/ofbcore/jars/</downloadUrl>
-	</distributionManagement>
-</project>

providers/ofbiz/src/main/resources/maven/ofbcore-share.pom

-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-	<modelVersion>4.0.0</modelVersion>
-
-	<groupId>org.ofbiz.ofbcore</groupId>
-	<artifactId>ofbcore-share</artifactId>
-	<version>2.1.1</version>
-
-	<name>OFBiz Core - Share</name>
-	<description>
-		This came from the Maven 1 public Atlassian repository: http://maven.atlassian.com/content/groups/m1/. This file
-		could not be found anywhere on the offical site nor any project source repository. 
-	</description>
-
-	<organization>
-		<name>Apache Open For Business</name>
-		<url>http://ofbiz.apache.org</url>
-	</organization>
-        
-	<distributionManagement>
-		<downloadUrl>https://maven.atlassian.com/content/groups/m1/ofbcore/jars/</downloadUrl>
-	</distributionManagement>
-</project>

providers/ofbiz2/pom.xml

+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>com.opensymphony.propertyset.providers</groupId>
+	    <artifactId>parent</artifactId>
+		<version>1.5.0-SNAPSHOT</version>
+	</parent>
+	<groupId>com.opensymphony.propertyset.providers</groupId>
+	<artifactId>ofbiz</artifactId>
+	<packaging>jar</packaging>
+
+	<name>PropertySet -> Providers -> OFBiz</name>
+	<description></description>
+
+	<dependencies>
+		<dependency>
+			<groupId>com.opensymphony.propertyset</groupId>
+			<artifactId>api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging</artifactId>
+			<version>1.1.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.ofbiz.ofbcore</groupId>
+			<artifactId>ofbcore-share</artifactId>
+			<version>2.1.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.ofbiz.ofbcore</groupId>
+			<artifactId>ofbcore-entity</artifactId>
+			<version>2.1.1</version>
+		</dependency>
+</dependencies>
+
+
+</project>

providers/ofbiz2/src/main/java/com/opensymphony/module/propertyset/ofbiz/DataPropertyHandler.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.module.propertyset.ofbiz;
+
+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;
+
+
+/**
+ * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
+ * $Revision$
+ */
+public class DataPropertyHandler implements PropertyHandler {
+    //~ Static fields/initializers /////////////////////////////////////////////
+
+    // Attributes ----------------------------------------------------
+    private static final byte[] NULL_DATA = "hello world".getBytes();
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    // Static --------------------------------------------------------
+    // Constructors --------------------------------------------------
+    // Public --------------------------------------------------------
+    public Object processGet(int type, Object input) throws PropertyException {
+        byte[] value = (byte[]) input;
+
+        switch (type) {
+        case PropertySet.TEXT:
+            return new String(value);
+
+        case PropertySet.OBJECT:
+            return readObject(value);
+
+        case PropertySet.XML:
+            return readXML(value);
+
+        case PropertySet.DATA:
+            return new Data(value);
+
+        case PropertySet.PROPERTIES:
+            return readProperties(value);
+
+        default:
+            throw new PropertyImplementationException("Cannot retrieve this type of property.");
+        }
+    }
+
+    public Object processSet(int type, Object input) throws PropertyException {
+        if (input == null) {
+            return (NULL_DATA);
+        }
+
+        try {
+            switch (type) {
+            case PropertySet.TEXT:
+                return (((String) input).getBytes());
+
+            case PropertySet.OBJECT:
+
+                if (!(input instanceof Serializable)) {
+                    throw new IllegalPropertyException("Object not serializable.");
+                }
+
+                return (writeObject(input));
+
+            case PropertySet.XML:
+                return (writeXML((Document) input));
+
+            case PropertySet.DATA:
+
+                if (input instanceof Data) {
+                    return (((Data) input).getBytes());
+                } else if (input instanceof byte[]) {
+                    return (byte[]) input;
+                } else {
+                    throw new IllegalPropertyException("DATA is not an instance of Data or byte[].");
+                }
+
+            case PropertySet.PROPERTIES:
+                return (writeProperties((Properties) input));
+
+            default:
+                throw new PropertyImplementationException("Cannot store this type of property.");
+            }
+        } catch (ClassCastException ce) {
+            throw new IllegalPropertyException("Cannot cast value to appropriate type for persistence.");
+        }
+    }
+
+    /**
+     * 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);
+        }
+    }
+
+    // Package protected ---------------------------------------------
+    // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
+
+    /**
+     * 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);
+        }
+    }
+
+    // Inner classes -------------------------------------------------
+}

providers/ofbiz2/src/main/java/com/opensymphony/module/propertyset/ofbiz/DatePropertyHandler.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.module.propertyset.ofbiz;
+
+import com.opensymphony.module.propertyset.*;
+
+
+/**
+ * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
+ * $Revision$
+ */
+public class DatePropertyHandler implements PropertyHandler {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    // Attributes ----------------------------------------------------
+    // Static --------------------------------------------------------
+    // Constructors --------------------------------------------------
+    // Public --------------------------------------------------------
+    public Object processGet(int type, Object input) throws PropertyException {
+        if (type == PropertySet.DATE) {
+            return input;
+        }
+
+        throw new InvalidPropertyTypeException("Could not recognize date type");
+    }
+
+    public Object processSet(int type, Object input) throws PropertyException {
+        if (type == PropertySet.DATE) {
+            if (input instanceof java.util.Date) {
+                return new java.sql.Timestamp(((java.util.Date) input).getTime());
+            } else if (input instanceof java.sql.Date) {
+                return new java.sql.Timestamp(((java.sql.Date) input).getTime());
+            } else if (input instanceof java.sql.Timestamp) {
+                return input;
+            }
+        }
+
+        throw new InvalidPropertyTypeException("Cannot set a date type of " + type + " for input: " + input);
+    }
+
+    // Package protected ---------------------------------------------
+    // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
+    // Inner classes -------------------------------------------------
+}

providers/ofbiz2/src/main/java/com/opensymphony/module/propertyset/ofbiz/DecimalPropertyHandler.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.module.propertyset.ofbiz;
+
+import com.opensymphony.module.propertyset.*;
+
+
+/**
+ * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
+ * $Revision$
+ */
+public class DecimalPropertyHandler implements PropertyHandler {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    // Attributes ----------------------------------------------------
+    // Static --------------------------------------------------------
+    // Constructors --------------------------------------------------
+    // Public --------------------------------------------------------
+    public Object processGet(int type, Object input) throws PropertyException {
+        if (type == PropertySet.DOUBLE) {
+            return input;
+        }
+
+        throw new InvalidPropertyTypeException();
+    }
+
+    public Object processSet(int type, Object input) throws PropertyException {
+        if (type == PropertySet.DOUBLE) {
+            return input;
+        }
+
+        throw new InvalidPropertyTypeException();
+    }
+
+    // Package protected ---------------------------------------------
+    // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
+    // Inner classes -------------------------------------------------
+}

providers/ofbiz2/src/main/java/com/opensymphony/module/propertyset/ofbiz/NumberPropertyHandler.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.module.propertyset.ofbiz;
+
+import com.opensymphony.module.propertyset.*;
+
+
+/**
+ * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
+ * $Revision$
+ */
+public class NumberPropertyHandler implements PropertyHandler {
+    //~ Static fields/initializers /////////////////////////////////////////////
+
+    // Attributes ----------------------------------------------------
+    // Static --------------------------------------------------------
+    private static final Long ZERO = new Long(0);
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    // Constructors --------------------------------------------------
+    // Public --------------------------------------------------------
+    public Object processGet(int type, Object input) throws PropertyException {
+        if (input instanceof Long) {
+            Long value = (Long) input;
+
+            switch (type) {
+            case PropertySet.BOOLEAN:
+                return value.equals(ZERO) ? Boolean.FALSE : Boolean.TRUE;
+
+            case PropertySet.INT:
+                return new Integer(value.intValue());
+
+            case PropertySet.LONG:
+                return value;
+
+            default:
+                throw new PropertyImplementationException("Cannot retrieve this type of property");
+            }
+        }
+
+        throw new PropertyImplementationException("Unexepected type of property");
+    }
+
+    public Object processSet(int type, Object input) throws PropertyException {
+        if (input == null) {
+            return new Long(0);
+        }
+
+        try {
+            switch (type) {
+            case PropertySet.BOOLEAN:
+                return new Long((((Boolean) input).booleanValue() ? 1L : 0L));
+
+            case PropertySet.INT:
+            case PropertySet.LONG:
+                return new Long(((Number) input).longValue());
+
+            default:
+                throw new PropertyImplementationException("Cannot store this type of property");
+            }
+        } catch (ClassCastException e) {
+            throw new IllegalPropertyException("Cannot cast value to appropiate type");
+        }
+    }
+
+    // Package protected ---------------------------------------------
+    // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
+    // Inner classes -------------------------------------------------
+}

providers/ofbiz2/src/main/java/com/opensymphony/module/propertyset/ofbiz/OFBizPropertySet.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.module.propertyset.ofbiz;
+
+import com.opensymphony.module.propertyset.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.ofbiz.core.entity.*;
+import org.ofbiz.core.util.UtilMisc;
+
+import java.io.Serializable;
+
+import java.util.*;
+
+
+/**
+ * This is the property set implementation for storing properties in the OFBiz Entity Engine.
+ * <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>delegator.name</b> - the name of the Ofbiz delegator, defaults to "default"</li>
+ * </ul>
+ *
+ * @author <a href="mailto:salaman@qoretech.com">Victor Salaman</a>
+ * @author <a href="mailto:mike@atlassian.com">Mike Cannon-Brookes</a>
+ * $Revision$
+ */
+public class OFBizPropertySet extends AbstractPropertySet implements Serializable {
+    //~ Static fields/initializers /////////////////////////////////////////////
+
+    private static final Log log = LogFactory.getLog(OFBizPropertySet.class);
+
+    // Attributes ----------------------------------------------------
+    static Map entityTypeMap;
+
+    static {
+        PropertyHandler stringHandler = new StringPropertyHandler();
+        PropertyHandler textHandler = new StringPropertyHandler();
+        PropertyHandler dateHandler = new DatePropertyHandler();
+        PropertyHandler dataHandler = new DataPropertyHandler();
+        PropertyHandler numberHandler = new NumberPropertyHandler();
+        PropertyHandler decimalHandler = new DecimalPropertyHandler();
+
+        entityTypeMap = new HashMap();
+        entityTypeMap.put(new Integer(PropertySet.BOOLEAN), new TypeMap("OSPropertyNumber", numberHandler));
+        entityTypeMap.put(new Integer(PropertySet.INT), new TypeMap("OSPropertyNumber", numberHandler));
+        entityTypeMap.put(new Integer(PropertySet.LONG), new TypeMap("OSPropertyNumber", numberHandler));
+        entityTypeMap.put(new Integer(PropertySet.DOUBLE), new TypeMap("OSPropertyDecimal", decimalHandler));
+        entityTypeMap.put(new Integer(PropertySet.STRING), new TypeMap("OSPropertyString", stringHandler));
+        entityTypeMap.put(new Integer(PropertySet.TEXT), new TypeMap("OSPropertyText", textHandler));
+        entityTypeMap.put(new Integer(PropertySet.DATE), new TypeMap("OSPropertyDate", dateHandler));
+        entityTypeMap.put(new Integer(PropertySet.OBJECT), new TypeMap("OSPropertyData", dataHandler));
+        entityTypeMap.put(new Integer(PropertySet.XML), new TypeMap("OSPropertyData", dataHandler));
+        entityTypeMap.put(new Integer(PropertySet.DATA), new TypeMap("OSPropertyData", dataHandler));
+        entityTypeMap.put(new Integer(PropertySet.PROPERTIES), new TypeMap("OSPropertyData", dataHandler));
+    }
+
+    //~ Instance fields ////////////////////////////////////////////////////////
+
+    Long entityId;
+    String delegatorName;
+    String entityName;
+
+    //~ Methods ////////////////////////////////////////////////////////////////
+
+    public Collection getKeys() throws PropertyException {
+        List results = new ArrayList();
+
+        try {
+            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
+
+            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
+                GenericValue value = (GenericValue) iterator.next();
+                String propertyKey = value.getString("propertyKey");
+
+                if (propertyKey != null) {
+                    results.add(propertyKey);
+                }
+            }
+
+            Collections.sort(results);
+        } catch (GenericEntityException e) {
+            throw new PropertyImplementationException(e);
+        }
+
+        return results;
+    }
+
+    public Collection getKeys(String prefix) throws PropertyException {
+        List results = new ArrayList();
+
+        try {
+            // chowda hack
+            if (prefix == null) {
+                prefix = "";
+            }
+
+            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
+
+            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
+                GenericValue value = (GenericValue) iterator.next();
+                String propertyKey = value.getString("propertyKey");
+
+                if ((propertyKey != null) && propertyKey.startsWith(prefix)) {
+                    results.add(propertyKey);
+                }
+            }
+
+            Collections.sort(results);
+        } catch (GenericEntityException e) {
+            throw new PropertyImplementationException(e);
+        }
+
+        return results;
+    }
+
+    public Collection getKeys(String prefix, int type) throws PropertyException {
+        List results = new ArrayList();
+
+        try {
+            // chowda hack
+            if (prefix == null) {
+                prefix = "";
+            }
+
+            Collection c = getDelegator().findByAnd("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "entityName", entityName));
+
+            for (Iterator iterator = c.iterator(); iterator.hasNext();) {
+                GenericValue value = (GenericValue) iterator.next();
+                String propertyKey = value.getString("propertyKey");
+                Integer entryType = value.getInteger("type");
+
+                if (((propertyKey != null) && propertyKey.startsWith(prefix)) && (entryType.intValue() == type)) {
+                    results.add(propertyKey);
+                }
+            }
+
+            Collections.sort(results);
+        } catch (GenericEntityException e) {
+            throw new PropertyImplementationException(e);
+        }
+
+        return results;
+    }
+
+    public int getType(String key) throws PropertyException {
+        GenericValue v = findPropertyEntry(key);
+
+        if (v == null) {
+            throw new PropertyImplementationException("Property '" + key + "' not found");
+        }
+
+        return v.getInteger("type").intValue();
+    }
+
+    // Public --------------------------------------------------------
+    public boolean exists(String key) throws PropertyException {
+        if (findPropertyEntry(key) != null) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    // Constructors --------------------------------------------------
+    public void init(Map config, Map args) {
+        delegatorName = (String) config.get("delegator.name");
+
+        if (delegatorName == null) {
+            delegatorName = "default";
+        }
+
+        entityId = (Long) args.get("entityId");
+        entityName = (String) args.get("entityName");
+    }
+
+    public void remove() throws PropertyException {
+        //hani: todo this needs to be optimised rather badly, but I have no idea how
+        Collection keys = getKeys();
+        Iterator iter = keys.iterator();
+
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            remove(key);
+        }
+    }
+
+    public void remove(String key) throws PropertyException {
+        try {
+            // remove actual property
+            int type = this.getType(key);
+            GenericValue v = findPropertyEntry(key);
+
+            if (v != null) {
+                Integer t = v.getInteger("type");
+                Long id = v.getLong("id");
+
+                if (type != t.intValue()) {
+                    throw new InvalidPropertyTypeException();
+                }
+
+                TypeMap tm = (TypeMap) entityTypeMap.get(t);
+                getDelegator().removeByAnd(tm.getEntity(), UtilMisc.toMap("id", id));
+            }
+
+            // now remove the property entry
+            getDelegator().removeByAnd("OSPropertyEntry", makePropertyEntryFields(key));
+        } catch (GenericEntityException e) {
+            log.error("Error removing value from PropertySet", e);
+            throw new PropertyImplementationException(e);
+        }
+    }
+
+    public boolean supportsType(int type) {
+        switch (type) {
+        case DATA:
+        case OBJECT:
+        case PROPERTIES:
+        case XML:
+            return false;
+        }
+
+        return true;
+    }
+
+    protected void setImpl(int type, String key, Object obj) throws PropertyException {
+        try {
+            Long id;
+
+            GenericValue propertyEntry = findPropertyEntry(key);
+
+            if (propertyEntry == null) {
+                id = getDelegator().getNextSeqId("OSPropertyEntry");
+                propertyEntry = getDelegator().makeValue("OSPropertyEntry", UtilMisc.toMap("entityId", entityId, "id", id, "entityName", entityName, "type", new Integer(type), "propertyKey", key));
+            } else {
+                id = propertyEntry.getLong("id");
+            }
+
+            TypeMap tm = (TypeMap) entityTypeMap.get(new Integer(type));
+            GenericValue propertyTypeEntry = getDelegator().makeValue(tm.getEntity(), UtilMisc.toMap("id", id, "value", processSet(type, obj)));
+
+            List entities = new ArrayList();
+            entities.add(propertyEntry);
+            entities.add(propertyTypeEntry);
+            getDelegator().storeAll(entities);
+        } catch (GenericEntityException e) {
+            log.error("Error setting value in PropertySet", e);
+            throw new PropertyImplementationException(e);
+        }
+    }
+
+    protected Object get(int type, String key) throws PropertyException {
+        try {
+            GenericValue v = findPropertyEntry(key);
+
+            if (v != null) {
+                Integer t = v.getInteger("type");
+                Long id = v.getLong("id");
+
+                if (type != t.intValue()) {
+                    throw new InvalidPropertyTypeException();
+                }
+
+                TypeMap tm = (TypeMap) entityTypeMap.get(t);
+                GenericValue property = (GenericValue) getDelegator().findByPrimaryKey(tm.getEntity(), UtilMisc.toMap("id", id));
+
+                if (property == null) {
+                    return null;
+                }
+
+                return processGet(type, property.get("value"));
+            }
+        } catch (GenericEntityException e) {
+            throw new PropertyImplementationException(e);
+        }
+
+        return null;
+    }
+
+    private GenericDelegator getDelegator() {
+        return GenericDelegator.getGenericDelegator(delegatorName);
+    }
+
+    private GenericValue findPropertyEntry(String key) throws PropertyException {
+        try {
+            Collection c = getDelegator().findByAnd("OSPropertyEntry", makePropertyEntryFields(key));
+
+            if ((c == null) || (c.size() == 0)) {
+                return null;
+            }
+
+            return (GenericValue) c.iterator().next();
+        } catch (GenericEntityException e) {
+            throw new PropertyImplementationException(e);
+        }
+    }
+
+    private Map makePropertyEntryFields(String key) {
+        return UtilMisc.toMap("propertyKey", key, "entityName", entityName, "entityId", entityId);
+    }
+
+    // Package protected ---------------------------------------------
+    // Protected -----------------------------------------------------
+    // Private -------------------------------------------------------
+    // @todo implement processRemove
+    private Object processGet(int type, Object input) throws PropertyException {
+        if (input == null) {
+            return null;
+        }
+
+        TypeMap typeMap = (TypeMap) entityTypeMap.get(new Integer(type));
+        PropertyHandler handler = typeMap.getHandler();
+
+        return handler.processGet(type, input);
+    }
+
+    private Object processSet(int type, Object input) throws PropertyException {
+        if (input == null) {
+            return null;
+        }