You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Vlatko Davidovski <vd...@gmail.com> on 2009/10/13 01:44:48 UTC

Re: Strange iPojo problems with DB4O [Resolved]

Resolved.
It was a db4o caching issue.

On Oct 13, 2009, at 1:00 AM, Vlatko Davidovski wrote:

> OHi
>
> I experienced a bigger problem when using iPojo in combination with  
> db4o.
>
> Simply, I create an DB4O ObjectContainer and try to store an entity  
> (see attached classes):
> container.store(entity);
>
> It throws me the following exception:
> 2009.10.13 00:51:28 ERROR - Bundle:ch.ethz.inf.vs.aparat.aparat- 
> registry - [ERROR]  
> ch 
> .ethz 
> .inf.vs.aparat.registry.osgi.services.DeviceRegistryServiceImpl :  
> [ch 
> .ethz 
> .inf.vs.aparat.registry.osgi.services.DeviceRegistryServiceImpl-0]  
> The callback method start has thrown an exception :  
> ch.ethz.inf.vs.aparat.core.entity.Entity -  
> java.lang.ClassCastException: ch.ethz.inf.vs.aparat.core.entity.Entity
>
> This does not make much sense to me, as this is a simple code that  
> runs in a regular POJO or regular OSGi bundles.
> Any ideas how to resolve this?
>
> Thanks!
> Vlatko
>
> ------------------------------------------
> public class Entity {
> 	
> 	/**
> 	 * The name of the entity. This parameter is desired to be unique.
> 	 * However, as this cannot be always guaranteed, the parameter
> 	 * guaranteeing uniqueness arre the {@link UUID}.
> 	 */
> 	protected String name;
> 	
> 	/**
> 	 * Represents the list of universally unique IDs an entity is
> 	 * associated with. This list of IDs is used as a unique identifier
> 	 * by the gateway to differentiate between entities.
> 	 *
> 	 * One entity (device, publisher, subscriber, etc.) can have mutliple
> 	 * UUIDs as different types can be used for identification EPC, MAC  
> address, etc.
> 	 * For more information see {@link DeviceUUID}.
> 	 */
> 	protected List<UUID> uuids;
> 		
> 	/**
> 	 * Creates a new entity with its name and the list of {@link UUID}  
> it is
> 	 * associated with.
> 	 *
> 	 * @param name the name of the entity
> 	 * @param uuids the UUID to add to its UUIDs list
> 	 */
> 	public Entity(String name, List<UUID> uuids) {
> 		this.name = name;
> 		this.uuids = uuids;
> 	}
>
> 	/**
> 	 * Gets the name of the {@link Entity}
> 	 *
> 	 * @return the name
> 	 */
> 	public String getName() {
> 		return name;
> 	}
>
> 	/**
> 	 * Sets the name of the {@link Entity}
> 	 *
> 	 * @param name the name to set
> 	 */
> 	public void setName(String name) {
> 		this.name = name;
> 	}
>
> 	/**
> 	 * Gets the list of {@link UUID} associated with the
> 	 * {@link Entity}
> 	 *
> 	 * @return the uuids
> 	 */
> 	public List<UUID> getUuids() {
> 		return uuids;
> 	}
>
> 	/**
> 	 * Sets the list of {@link UUID} associated with the
> 	 * {@link Entity}
> 	 *
> 	 * @param uuids the uuids to set
> 	 */
> 	public void setUuid(List<UUID> uuids) {
> 		this.uuids = uuids;
> 	}
> 	
> 	/**
> 	 * Adds a single {@link UUID} to the list of UUIDs associated
> 	 * with the {@link Entity}
> 	 *
> 	 * @param uuid the UUID to add
> 	 */
> 	public void addUuid(UUID uuid) {
> 		if(uuids == null)
> 			uuids = new ArrayList<UUID>();
> 		
> 		uuids.add(uuid);
> 	}
>
> }
>
>
> public class UUID {
> 	/**
> 	 * MAC address UUID type.
> 	 */
> 	public static final String UUID_TYPE_MAC_ADDRESS = "mac";
> 	
> 	/**
> 	 * EPC (Electronic Product Code) address UUID type.
> 	 */
> 	public static final String UUID_TYPE_EPC = "epc";
> 	
> 	/**
> 	 * Represents the type of the UUID.
> 	 */
> 	protected String type;
> 	
> 	/**
> 	 * Represents the value of the UUID for a given type.
> 	 */
> 	protected String value;
>
> 	/**
> 	 * Default empty constructor.
> 	 */
> 	public UUID() {
> 	}
> 	
> 	/**
> 	 * Creates a new UUID for given UUID type and value.
> 	 *
> 	 * @param type the type of the UUID
> 	 * @param value the value of the UUID
> 	 */
> 	public UUID(String type, String value) {
> 		this.type = type;
> 		this.value = value;
> 	}
>
> 	/**
> 	 * Gets the type of the UUID.
> 	 *
> 	 * @return the type
> 	 */
> 	public String getType() {
> 		return type;
> 	}
>
> 	/**
> 	 * Sets the type of the UUID.
> 	 * <b>Important notice:</b> the UUID type is always
> 	 * saved in lower case.
> 	 *
> 	 * @param type the type to set
> 	 */
> 	public void setType(String type) {
> 		this.type = type.toLowerCase();
> 	}
>
> 	/**
> 	 * Gets the value of the UUID.
> 	 *
> 	 * @return the value
> 	 */
> 	public String getValue() {
> 		return value;
> 	}
>
> 	/**
> 	 * Sets the value of the UUID.
> 	 * <b>Important notice:</b> the UUID value is always
> 	 * saved in lower case.
> 	 *
> 	 * @param value the value to set
> 	 */
> 	public void setValue(String value) {
> 		this.value = value.toLowerCase();
> 	}
> }
>