// 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;
/*******************************************************************************
 * Copyright (c) 2014 ModelSolv, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     ModelSolv, Inc. - initial API and implementation.
 *******************************************************************************/
package com.modelsolv.kaboom.model.resource.nativeImpl;




public class ObjectResourceDefinitionImpl implements ObjectResourceDefinition {

	private ResourceDataModel resourceDataModel;
	private String name;
	private String uriTemplate;
	private Map<String, CDMProperty> parameterBindings = new HashMap<String, CDMProperty>();

	public ObjectResourceDefinitionImpl(String uriTemplate,
			ResourceDataModel rdm) {
		this.resourceDataModel = rdm;
		this.uriTemplate = uriTemplate;
	}

	@Override
	public ResourceDataModel getResourceDataModel() {
		return resourceDataModel;
	}

	@Override
	public String getURITemplate() {
		return uriTemplate;
	}

	@Override
	public String getName() {
		return this.name;
	}

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

	@Override
	public ObjectResourceDefinition withName(String name) {
// 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;

/*******************************************************************************
 * Copyright (c) 2014 ModelSolv, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     ModelSolv, Inc. - initial API and implementation.
 *******************************************************************************/
package com.modelsolv.kaboom.model.resource.nativeImpl;




public class ObjectResourceDefinitionImpl implements ObjectResourceDefinition {

	private ResourceDataModel resourceDataModel;
	private String name;
	private String uriTemplate;
	private Map<String, CDMProperty> parameterBindings = new HashMap<String, CDMProperty>();

	public ObjectResourceDefinitionImpl(String uriTemplate,
			ResourceDataModel rdm) {
		this.resourceDataModel = rdm;
		this.uriTemplate = uriTemplate;
	}

	@Override
	public ResourceDataModel getResourceDataModel() {
		return resourceDataModel;
	}

	@Override
	public String getURITemplate() {
		return uriTemplate;
	}

	@Override
	public String getName() {
		return this.name;
	}

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

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