public class Factory extends AbstractFactory
Modifier and Type | Class and Description |
---|---|
static interface |
Factory.ConnectionFactory
Creates JDBC connection objects.
|
static interface |
Factory.RequestDeserializerFactory
Creates RequestDeserializer objects.
|
static interface |
Factory.RequestFactory
Creates Request objects.
|
static interface |
Factory.ResponseSerializerFactory
Creates ResponseSerializer objects.
|
static interface |
Factory.SqlResourceFactory
Creates SQLResource objects.
|
static class |
Factory.SqlResourceFactoryException
Indicates an error in creating a SQL Resource object from a definition.
|
AbstractFactory.FactoryHelper
Constructor and Description |
---|
Factory() |
Modifier and Type | Method and Description |
---|---|
static Request |
getChildRequest(Request parentRequest)
Creates request for child row with blank params.
|
static ColumnMetaData |
getColumnMetaData()
Creates new column meta data object.
|
static Connection |
getConnection(String defaultDatabase)
Returns connection.
|
static Factory.ConnectionFactory |
getConnectionFactory()
Return connection factory.
|
static HttpRequestAttributes |
getHttpRequestAttributes(String client,
String method,
String uri,
String requestBody,
String requestContentType,
String responseContentType)
Creates HTTP request attributes.
|
static Request |
getRequest(HttpRequestAttributes httpAttributes)
Builds request from URI.
|
static Request |
getRequest(HttpRequestAttributes httpAttributes,
Request.Type type,
String sqlResource,
List<RequestValue> resIds,
List<RequestValue> params,
List<List<RequestValue>> childrenParams,
RequestLogger requestLogger)
Returns request object with pre-parsed data from the URI.
|
static Request |
getRequest(Request.Type type,
String sqlResource,
List<RequestValue> resIds,
List<RequestValue> params,
List<List<RequestValue>> childrenParams,
RequestLogger requestLogger)
Returns request object with pre-parsed data from the URI.
|
static RequestDeserializer |
getRequestDeserializer(String mediaType)
Returns request deserializer.
|
static RequestLogger |
getRequestLogger()
Returns request logger.
|
static ResponseSerializer |
getResponseSerializer(String mediaType)
Returns response serializer for media type.
|
static SequenceManager |
getSequenceManager()
Returns singleton SequenceManager.
|
static SqlBuilder |
getSqlBuilder()
Returns existing singleton SqlBuilder.
|
static SqlResource |
getSqlResource(String resName)
Returns SQL Resource for named resource.
|
static InputStream |
getSqlResourceDefinition(String resName)
Returns definition content as input stream.
|
static SqlResourceMetaData |
getSqlResourceMetaData(String resName,
SqlResourceDefinition definition,
SqlBuilder sqlBuilder)
Returns meta data object for definition.
|
static List<String> |
getSqlResourceNames()
Returns available SQL Resource names using configured SqlResourceFactory.
|
static String |
getSqlResourcesDir()
Returns SQL resources directory using configured SqlResourceFactory.
|
static TableMetaData |
getTableMetaData()
Creates new table meta data object.
|
static void |
reloadSqlResource(String resName)
Reloads definition from the source using configured SqlResourceFactory.
|
getInstance, newInstance
public static Request getChildRequest(Request parentRequest)
public static ColumnMetaData getColumnMetaData()
public static Connection getConnection(String defaultDatabase) throws SQLException
SQLException
public static Factory.ConnectionFactory getConnectionFactory()
public static HttpRequestAttributes getHttpRequestAttributes(String client, String method, String uri, String requestBody, String requestContentType, String responseContentType)
client
- IP or host namemethod
- HTTP methoduri
- request URIrequestBody
- request body, e.g. XML or JSONpublic static Request getRequest(Request.Type type, String sqlResource, List<RequestValue> resIds, List<RequestValue> params, List<List<RequestValue>> childrenParams, RequestLogger requestLogger) throws InvalidRequestException
InvalidRequestException
public static Request getRequest(HttpRequestAttributes httpAttributes, Request.Type type, String sqlResource, List<RequestValue> resIds, List<RequestValue> params, List<List<RequestValue>> childrenParams, RequestLogger requestLogger) throws InvalidRequestException
InvalidRequestException
public static Request getRequest(HttpRequestAttributes httpAttributes) throws InvalidRequestException, Factory.SqlResourceFactoryException, SqlResourceException
res/{resourceName}/{resId1}/{resId2}?{param1}={value1}&{param2}={value2}
. Used by the test harness,
Java API clients and perhaps a straight servlet implementation. Configurable implementation class.public static RequestLogger getRequestLogger()
public static RequestDeserializer getRequestDeserializer(String mediaType) throws SqlResourceException
SqlResourceException
- if deserializer not found for media typepublic static ResponseSerializer getResponseSerializer(String mediaType) throws SqlResourceException
SqlResourceException
- if serializer not found for media typepublic static SequenceManager getSequenceManager()
public static SqlBuilder getSqlBuilder()
public static SqlResource getSqlResource(String resName) throws Factory.SqlResourceFactoryException, SqlResourceException
resName
- resource nameFactory.SqlResourceFactoryException
- if the definition could not be marshalledSqlResourceException
- if a database error occurs while collecting metadatapublic static InputStream getSqlResourceDefinition(String resName) throws Factory.SqlResourceFactoryException
public static SqlResourceMetaData getSqlResourceMetaData(String resName, SqlResourceDefinition definition, SqlBuilder sqlBuilder) throws SqlResourceException
sqlBuilder
- db-specific SQL builderSqlResourceException
- if a database access error occurspublic static String getSqlResourcesDir()
public static List<String> getSqlResourceNames() throws Factory.SqlResourceFactoryException
Factory.SqlResourceFactoryException
- if the configured directory does not existpublic static TableMetaData getTableMetaData()
public static void reloadSqlResource(String resName) throws Factory.SqlResourceFactoryException, SqlResourceException
resName
- resource nameFactory.SqlResourceFactoryException
- if the definition could not be marshalledSqlResourceException
- if a database error occurs while collecting metadataCopyright © 2011-2018 restSQL Project Contributors