Class TorqueModelOutput
- java.lang.Object
-
- org.intermine.objectstore.intermine.TorqueModelOutput
-
public class TorqueModelOutput extends java.lang.Object
Map InterMine metadata to a Torque database schema in InterMine format- Author:
- Andrew Varley, Matthew Wakeling
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
className
protected static java.lang.String
ENDL
protected java.io.File
file
static int
FORMAT_VERSION
The version number of the database formatprotected static java.lang.String
INDENT
protected java.util.Set<CollectionDescriptor>
indirections
protected DatabaseSchema
schema
-
Constructor Summary
Constructors Constructor Description TorqueModelOutput(DatabaseSchema schema, java.io.File file)
Constructor for this class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
generate()
Generate a string that contains the torque data for the given schema.protected java.lang.String
generate(ClassDescriptor cld)
Generate a string that describes the given ClassDescriptor.protected java.lang.String
generateIndirectionTable(CollectionDescriptor col)
Generate an indirection tablestatic java.lang.String
generateJdbcType(java.lang.String type)
Convert java primitive and object names to those compatible with torque.void
process()
Process the schema and put the output in the file.
-
-
-
Field Detail
-
FORMAT_VERSION
public static final int FORMAT_VERSION
The version number of the database format- See Also:
- Constant Field Values
-
INDENT
protected static final java.lang.String INDENT
- See Also:
- Constant Field Values
-
ENDL
protected static final java.lang.String ENDL
-
schema
protected DatabaseSchema schema
-
file
protected java.io.File file
-
indirections
protected java.util.Set<CollectionDescriptor> indirections
-
className
protected java.lang.String className
-
-
Constructor Detail
-
TorqueModelOutput
public TorqueModelOutput(DatabaseSchema schema, java.io.File file)
Constructor for this class- Parameters:
schema
- a DatabaseSchemafile
- the file to which the torque data should be written
-
-
Method Detail
-
process
public void process()
Process the schema and put the output in the file.
-
generate
protected java.lang.String generate() throws ObjectStoreException
Generate a string that contains the torque data for the given schema.- Returns:
- a String containing torque data
- Throws:
ObjectStoreException
- if the schema is invalid
-
generate
protected java.lang.String generate(ClassDescriptor cld) throws ObjectStoreException
Generate a string that describes the given ClassDescriptor.- Parameters:
cld
- the ClassDescriptor- Returns:
- a String
- Throws:
ObjectStoreException
- if the schema is invalid
-
generateIndirectionTable
protected java.lang.String generateIndirectionTable(CollectionDescriptor col)
Generate an indirection table- Parameters:
col
- the CollectionDescriptor to generate table for- Returns:
- a String representing the schema for the indirection table
-
generateJdbcType
public static java.lang.String generateJdbcType(java.lang.String type)
Convert java primitive and object names to those compatible with torque. Returns unaltered string if no conversion is required.- Parameters:
type
- the string to convert- Returns:
- torque compatible name
-
-