// Path: src/org/restsql/core/Request.java
// public enum Type {
// 	DELETE, INSERT, SELECT, UPDATE;
// 
// 	public static Type fromHttpMethod(final String method) {
// 		Type type;
// 		if (method.equals("DELETE")) {
// 			type = Type.DELETE;
// 		} else if (method.equals("GET")) {
// 			type = Type.SELECT;
// 		} else if (method.equals("POST")) {
// 			type = Type.INSERT;
// 		} else { // method.equals("PUT")
// 			type = Type.UPDATE;
// 		}
// 		return type;
// 	}
// }
// 
// Path: src/org/restsql/core/sqlresource/SqlResourceDefinition.java
// @XmlRootElement(name = "sqlResource", namespace = "http://restsql.org/schema")
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "SqlResource", propOrder = {
//     "query",
//     "metadata",
//     "validatedAttribute",
//     "http",
//     "documentation"
// })
// public class SqlResourceDefinition {
// 
//     @XmlElement(required = true)
//     protected Query query;
//     @XmlElement(required = true)
//     protected MetaData metadata;
//     protected List<ValidatedAttribute> validatedAttribute;
//     protected HttpConfig http;
//     protected Documentation documentation;
// 
//     /**
//      * Gets the value of the query property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link Query }
//      *     
//      */
//     public Query getQuery() {
//         return query;
//     }
// 
//     /**
//      * Sets the value of the query property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link Query }
//      *     
//      */
//     public void setQuery(Query value) {
//         this.query = value;
//     }
// 
//     /**
//      * Gets the value of the metadata property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link MetaData }
//      *     
//      */
//     public MetaData getMetadata() {
//         return metadata;
//     }
// 
//     /**
//      * Sets the value of the metadata property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link MetaData }
//      *     
//      */
//     public void setMetadata(MetaData value) {
//         this.metadata = value;
//     }
// 
//     /**
//      * Gets the value of the validatedAttribute property.
//      * 
//      * <p>
//      * This accessor method returns a reference to the live list,
//      * not a snapshot. Therefore any modification you make to the
//      * returned list will be present inside the JAXB object.
//      * This is why there is not a <CODE>set</CODE> method for the validatedAttribute property.
//      * 
//      * <p>
//      * For example, to add a new item, do as follows:
//      * <pre>
//      *    getValidatedAttribute().add(newItem);
//      * </pre>
//      * 
//      * 
//      * <p>
//      * Objects of the following type(s) are allowed in the list
//      * {@link ValidatedAttribute }
//      * 
//      * 
//      */
//     public List<ValidatedAttribute> getValidatedAttribute() {
//         if (validatedAttribute == null) {
//             validatedAttribute = new ArrayList<ValidatedAttribute>();
//         }
//         return this.validatedAttribute;
//     }
// 
//     /**
//      * Gets the value of the http property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link HttpConfig }
//      *     
//      */
//     public HttpConfig getHttp() {
//         return http;
//     }
// 
//     /**
//      * Sets the value of the http property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link HttpConfig }
//      *     
//      */
//     public void setHttp(HttpConfig value) {
//         this.http = value;
//     }
// 
//     /**
//      * Gets the value of the documentation property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link Documentation }
//      *     
//      */
//     public Documentation getDocumentation() {
//         return documentation;
//     }
// 
//     /**
//      * Sets the value of the documentation property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link Documentation }
//      *     
//      */
//     public void setDocumentation(Documentation value) {
//         this.documentation = value;
//     }
// 
// }


import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import org.restsql.core.Request.Type;
import org.restsql.core.sqlresource.SqlResourceDefinition;
	 * 
	 * @param resName resource name
	 * @return SQLResource object
	 * @throws SqlResourceFactoryException if the definition could not be marshalled
	 * @throws SqlResourceException if a database error occurs while collecting metadata
	 */
	public static SqlResource getSqlResource(final String resName) throws SqlResourceFactoryException,
			SqlResourceException {
		final SqlResourceFactory sqlResourceFactory = (SqlResourceFactory) getInstance(
				Config.KEY_SQL_RESOURCE_FACTORY, Config.DEFAULT_SQL_RESOURCE_FACTORY);
		return sqlResourceFactory.getSqlResource(resName);
	}

	/**
	 * Returns definition content as input stream. Configurable implementation class.
	 */
	public static InputStream getSqlResourceDefinition(final String resName)
			throws SqlResourceFactoryException {
		final SqlResourceFactory sqlResourceFactory = (SqlResourceFactory) getInstance(
				Config.KEY_SQL_RESOURCE_FACTORY, Config.DEFAULT_SQL_RESOURCE_FACTORY);
		return sqlResourceFactory.getSqlResourceDefinition(resName);
	}

	/**
	 * Returns meta data object for definition. Configurable implementation class.
	 * @param sqlBuilder db-specific SQL builder
	 * 
	 * @throws SqlResourceException if a database access error occurs
	 */
	public static SqlResourceMetaData getSqlResourceMetaData(final String resName,
// Path: src/org/restsql/core/Request.java
// public enum Type {
// 	DELETE, INSERT, SELECT, UPDATE;
// 
// 	public static Type fromHttpMethod(final String method) {
// 		Type type;
// 		if (method.equals("DELETE")) {
// 			type = Type.DELETE;
// 		} else if (method.equals("GET")) {
// 			type = Type.SELECT;
// 		} else if (method.equals("POST")) {
// 			type = Type.INSERT;
// 		} else { // method.equals("PUT")
// 			type = Type.UPDATE;
// 		}
// 		return type;
// 	}
// }
// 
// Path: src/org/restsql/core/sqlresource/SqlResourceDefinition.java
// @XmlRootElement(name = "sqlResource", namespace = "http://restsql.org/schema")
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "SqlResource", propOrder = {
//     "query",
//     "metadata",
//     "validatedAttribute",
//     "http",
//     "documentation"
// })
// public class SqlResourceDefinition {
// 
//     @XmlElement(required = true)
//     protected Query query;
//     @XmlElement(required = true)
//     protected MetaData metadata;
//     protected List<ValidatedAttribute> validatedAttribute;
//     protected HttpConfig http;
//     protected Documentation documentation;
// 
//     /**
//      * Gets the value of the query property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link Query }
//      *     
//      */
//     public Query getQuery() {
//         return query;
//     }
// 
//     /**
//      * Sets the value of the query property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link Query }
//      *     
//      */
//     public void setQuery(Query value) {
//         this.query = value;
//     }
// 
//     /**
//      * Gets the value of the metadata property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link MetaData }
//      *     
//      */
//     public MetaData getMetadata() {
//         return metadata;
//     }
// 
//     /**
//      * Sets the value of the metadata property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link MetaData }
//      *     
//      */
//     public void setMetadata(MetaData value) {
//         this.metadata = value;
//     }
// 
//     /**
//      * Gets the value of the validatedAttribute property.
//      * 
//      * <p>
//      * This accessor method returns a reference to the live list,
//      * not a snapshot. Therefore any modification you make to the
//      * returned list will be present inside the JAXB object.
//      * This is why there is not a <CODE>set</CODE> method for the validatedAttribute property.
//      * 
//      * <p>
//      * For example, to add a new item, do as follows:
//      * <pre>
//      *    getValidatedAttribute().add(newItem);
//      * </pre>
//      * 
//      * 
//      * <p>
//      * Objects of the following type(s) are allowed in the list
//      * {@link ValidatedAttribute }
//      * 
//      * 
//      */
//     public List<ValidatedAttribute> getValidatedAttribute() {
//         if (validatedAttribute == null) {
//             validatedAttribute = new ArrayList<ValidatedAttribute>();
//         }
//         return this.validatedAttribute;
//     }
// 
//     /**
//      * Gets the value of the http property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link HttpConfig }
//      *     
//      */
//     public HttpConfig getHttp() {
//         return http;
//     }
// 
//     /**
//      * Sets the value of the http property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link HttpConfig }
//      *     
//      */
//     public void setHttp(HttpConfig value) {
//         this.http = value;
//     }
// 
//     /**
//      * Gets the value of the documentation property.
//      * 
//      * @return
//      *     possible object is
//      *     {@link Documentation }
//      *     
//      */
//     public Documentation getDocumentation() {
//         return documentation;
//     }
// 
//     /**
//      * Sets the value of the documentation property.
//      * 
//      * @param value
//      *     allowed object is
//      *     {@link Documentation }
//      *     
//      */
//     public void setDocumentation(Documentation value) {
//         this.documentation = value;
//     }
// 
// }


// Path: src/org/restsql/core/Factory.java
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import org.restsql.core.Request.Type;
import org.restsql.core.sqlresource.SqlResourceDefinition;

	 * 
	 * @param resName resource name
	 * @return SQLResource object
	 * @throws SqlResourceFactoryException if the definition could not be marshalled
	 * @throws SqlResourceException if a database error occurs while collecting metadata
	 */
	public static SqlResource getSqlResource(final String resName) throws SqlResourceFactoryException,
			SqlResourceException {
		final SqlResourceFactory sqlResourceFactory = (SqlResourceFactory) getInstance(
				Config.KEY_SQL_RESOURCE_FACTORY, Config.DEFAULT_SQL_RESOURCE_FACTORY);
		return sqlResourceFactory.getSqlResource(resName);
	}

	/**
	 * Returns definition content as input stream. Configurable implementation class.
	 */
	public static InputStream getSqlResourceDefinition(final String resName)
			throws SqlResourceFactoryException {
		final SqlResourceFactory sqlResourceFactory = (SqlResourceFactory) getInstance(
				Config.KEY_SQL_RESOURCE_FACTORY, Config.DEFAULT_SQL_RESOURCE_FACTORY);
		return sqlResourceFactory.getSqlResourceDefinition(resName);
	}

	/**
	 * Returns meta data object for definition. Configurable implementation class.
	 * @param sqlBuilder db-specific SQL builder
	 * 
	 * @throws SqlResourceException if a database access error occurs
	 */
	public static SqlResourceMetaData getSqlResourceMetaData(final String resName,
			final SqlResourceDefinition definition, SqlBuilder sqlBuilder) throws SqlResourceException {