// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java
// public interface CDMProperty extends ReadableCDMProperty {
// 
// 	public void setName(String name);
// 	
// 	public void setCardinality(Cardinality cardinality);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java
// public interface ObjectResource {
// 	
// 	public Object getCanonicalObject();
// 	
// 	public void setCanonicalObject(Object obj);
// 
// 	public URI getURI();
// 	
// 	public void setURI(URI uri);
// 	
// 	public ObjectResourceDefinition getResourceDefinition();
// 	
// 	public void setResourceDefinition(ObjectResourceDefinition definition);
// 	
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java
// public interface ObjectResourceDefinition extends ResourceDefinition {
// 
// 	// write-once properties, should be passed in ctor
// 	public String getURITemplate();
// 
// 	/**
// 	 * @return the ResourceDataModel bound to this class of resources.
// 	 */
// 	public ResourceDataModel getResourceDataModel();
// 
// 	// read-writable properties
// 
// 	public String getName();
// 
// 	public void setName(String name);
// 
// 	public ObjectResourceDefinition withName(String name);
// 
// 	public void bindTemplateParameter(String parameter, CDMProperty property);
// 	
// 	public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property);
// 
// 	/**
// 	 * Factory method to create or retrieve an individual Resource bound to the
// 	 * canonicalObject. The canonicalObject must confirm to the
// 	 * ResourceDataModel. This method is responsible for populating the resource
// 	 * URI and any other required properties of the Resource.
// 	 * 
// 	 * @param canonicalObject
// 	 * @return
// 	 */
// 	public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java
// public interface RDMFactory {
// 
// 	public static RDMFactory INSTANCE = new NativeRDMFactory();
// 
// 	public RDMPrimitiveProperty createRDMPrimitiveProperty(
// 			CDMPrimitiveProperty cdmProperty);
// 
// 	public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty);
// 
// 	public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty);
// 
// 	public ResourceDataModel createResourceDataModel(CanonicalDataType cdt);
// 	
// 	public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm);
// 
// 	public ObjectResource createObjectResource(Object canonicalObject, URI uri,
// 			ObjectResourceDefinition ord);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java
// public interface ResourceDataModel {
// 
// 	public CanonicalDataType getCanonicalDataType();
// 
// 	public void setCanonicalDataType(CanonicalDataType type);
// 
// 	public ResourceDataModel withCanonicalDataType(CanonicalDataType type);
// 
// 	public Iterable<RDMProperty> getIncludedProperties();
// 
// 	// Add a list of CDM properties from the CanonicalDataType
// 	public ResourceDataModel includingProperties(CDMProperty... properties);
// 
// 	public ResourceDataModel includingProperties(String... properties);
// 
// 	// Add Primitive Property from CDM Property
// 	public RDMPrimitiveProperty addPrimitiveProperty(
// 			CDMPrimitiveProperty property);
// 
// 	// Add Primitive Property directly, chainable, builder style
// 	public ResourceDataModel withPrimitiveProperty(
// 			RDMPrimitiveProperty property);
// 
// 	// Add ReferenceLink from CDMReferenceProperty
// 	public ReferenceLink addReferenceLink(CDMReferenceProperty property);
// 
// 	// Add ReferenceLink Directly, chainable, builder style
// 	public ResourceDataModel withReferenceLink(ReferenceLink refLink);
// 
// 	// Add ReferenceEmbed from CDMReferenceProperty
// 	public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property);
// 
// 	// Add ReferenceEmbed Directly, chainable, builder style
// 	public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed);
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java
// public interface CanonicalObjectReader {
// 	
// 	public Object getPropertyValue(Object obj, CDMProperty prop);
// 	
// 	public Object getPropertyValue(Object obj, RDMProperty prop);
// 	
// 	public Object getPropertyValue(Object obj, String propName);
// }


import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.beanutils.PropertyUtils;
import com.modelsolv.kaboom.model.canonical.CDMProperty;
import com.modelsolv.kaboom.model.resource.ObjectResource;
import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition;
import com.modelsolv.kaboom.model.resource.RDMFactory;
import com.modelsolv.kaboom.model.resource.ResourceDataModel;
import com.modelsolv.kaboom.object.CanonicalObjectReader;
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public ObjectResourceDefinition withName(String name) {
		setName(name);
		return this;
	}

	@Override
	public void bindTemplateParameter(String parameter, CDMProperty property) {
		if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) {
			throw new IllegalArgumentException(
					"Parameter must be bound to a property of the canonical data type.");
		}
		parameterBindings.put(parameter, property);
	}

	@Override
	public ObjectResourceDefinition withTemplateParameter(String parameter,
			CDMProperty property) {
		bindTemplateParameter(parameter, property);
		return this;
	}

	@Override
	public ObjectResource getResource(Object canonicalObject,
			CanonicalObjectReader reader) {
		URI uri = bindParameters(canonicalObject, reader);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java
// public interface CDMProperty extends ReadableCDMProperty {
// 
// 	public void setName(String name);
// 	
// 	public void setCardinality(Cardinality cardinality);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java
// public interface ObjectResource {
// 	
// 	public Object getCanonicalObject();
// 	
// 	public void setCanonicalObject(Object obj);
// 
// 	public URI getURI();
// 	
// 	public void setURI(URI uri);
// 	
// 	public ObjectResourceDefinition getResourceDefinition();
// 	
// 	public void setResourceDefinition(ObjectResourceDefinition definition);
// 	
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java
// public interface ObjectResourceDefinition extends ResourceDefinition {
// 
// 	// write-once properties, should be passed in ctor
// 	public String getURITemplate();
// 
// 	/**
// 	 * @return the ResourceDataModel bound to this class of resources.
// 	 */
// 	public ResourceDataModel getResourceDataModel();
// 
// 	// read-writable properties
// 
// 	public String getName();
// 
// 	public void setName(String name);
// 
// 	public ObjectResourceDefinition withName(String name);
// 
// 	public void bindTemplateParameter(String parameter, CDMProperty property);
// 	
// 	public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property);
// 
// 	/**
// 	 * Factory method to create or retrieve an individual Resource bound to the
// 	 * canonicalObject. The canonicalObject must confirm to the
// 	 * ResourceDataModel. This method is responsible for populating the resource
// 	 * URI and any other required properties of the Resource.
// 	 * 
// 	 * @param canonicalObject
// 	 * @return
// 	 */
// 	public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java
// public interface RDMFactory {
// 
// 	public static RDMFactory INSTANCE = new NativeRDMFactory();
// 
// 	public RDMPrimitiveProperty createRDMPrimitiveProperty(
// 			CDMPrimitiveProperty cdmProperty);
// 
// 	public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty);
// 
// 	public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty);
// 
// 	public ResourceDataModel createResourceDataModel(CanonicalDataType cdt);
// 	
// 	public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm);
// 
// 	public ObjectResource createObjectResource(Object canonicalObject, URI uri,
// 			ObjectResourceDefinition ord);
// 
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java
// public interface ResourceDataModel {
// 
// 	public CanonicalDataType getCanonicalDataType();
// 
// 	public void setCanonicalDataType(CanonicalDataType type);
// 
// 	public ResourceDataModel withCanonicalDataType(CanonicalDataType type);
// 
// 	public Iterable<RDMProperty> getIncludedProperties();
// 
// 	// Add a list of CDM properties from the CanonicalDataType
// 	public ResourceDataModel includingProperties(CDMProperty... properties);
// 
// 	public ResourceDataModel includingProperties(String... properties);
// 
// 	// Add Primitive Property from CDM Property
// 	public RDMPrimitiveProperty addPrimitiveProperty(
// 			CDMPrimitiveProperty property);
// 
// 	// Add Primitive Property directly, chainable, builder style
// 	public ResourceDataModel withPrimitiveProperty(
// 			RDMPrimitiveProperty property);
// 
// 	// Add ReferenceLink from CDMReferenceProperty
// 	public ReferenceLink addReferenceLink(CDMReferenceProperty property);
// 
// 	// Add ReferenceLink Directly, chainable, builder style
// 	public ResourceDataModel withReferenceLink(ReferenceLink refLink);
// 
// 	// Add ReferenceEmbed from CDMReferenceProperty
// 	public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property);
// 
// 	// Add ReferenceEmbed Directly, chainable, builder style
// 	public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed);
// }
// 
// Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java
// public interface CanonicalObjectReader {
// 	
// 	public Object getPropertyValue(Object obj, CDMProperty prop);
// 	
// 	public Object getPropertyValue(Object obj, RDMProperty prop);
// 	
// 	public Object getPropertyValue(Object obj, String propName);
// }


// Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.beanutils.PropertyUtils;
import com.modelsolv.kaboom.model.canonical.CDMProperty;
import com.modelsolv.kaboom.model.resource.ObjectResource;
import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition;
import com.modelsolv.kaboom.model.resource.RDMFactory;
import com.modelsolv.kaboom.model.resource.ResourceDataModel;
import com.modelsolv.kaboom.object.CanonicalObjectReader;

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public ObjectResourceDefinition withName(String name) {
		setName(name);
		return this;
	}

	@Override
	public void bindTemplateParameter(String parameter, CDMProperty property) {
		if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) {
			throw new IllegalArgumentException(
					"Parameter must be bound to a property of the canonical data type.");
		}
		parameterBindings.put(parameter, property);
	}

	@Override
	public ObjectResourceDefinition withTemplateParameter(String parameter,
			CDMProperty property) {
		bindTemplateParameter(parameter, property);
		return this;
	}

	@Override
	public ObjectResource getResource(Object canonicalObject,
			CanonicalObjectReader reader) {
		URI uri = bindParameters(canonicalObject, reader);
		return RDMFactory.INSTANCE.createObjectResource(canonicalObject, uri,