Package org.apache.openjpa.meta
Class SequenceMetaData
- java.lang.Object
-
- org.apache.openjpa.meta.SequenceMetaData
-
- All Implemented Interfaces:
java.io.Serializable
,SourceTracker
,Closeable
,Commentable
,MetaDataContext
- Direct Known Subclasses:
SequenceMapping
public class SequenceMetaData extends java.lang.Object implements SourceTracker, MetaDataContext, Closeable, Commentable, java.io.Serializable
Metadata about a named sequence.- Since:
- 0.4.0
- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SequenceMetaData.SequenceFactory
Allow facades to supply adapters from a spec sequence type to the OpenJPA sequence type.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IMPL_NATIVE
Default plugin alias name; every back end should have some 'native' sequence implementation.static java.lang.String
IMPL_TIME
Time-based sequence values.static java.lang.String
NAME_SYSTEM
Sequence name that means to use the system default sequence.-
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
-
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
-
Constructor Summary
Constructors Constructor Description SequenceMetaData(java.lang.String name, MetaDataRepository repos)
Constructor; supply sequence name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addStandardProperties(java.lang.StringBuilder props)
Add standard properties to the given properties buffer.protected void
appendProperty(java.lang.StringBuilder props, java.lang.String name, int val)
Add an int property to the buffer.protected void
appendProperty(java.lang.StringBuilder props, java.lang.String name, java.lang.String val)
Add a string property to the buffer.void
close()
Close user sequence instance.int
getAllocate()
Sequence values to allocate, or -1 for default.java.lang.String
getCatalog()
int
getColNumber()
Return the column number in the line of the file at which this instance was parsed.java.lang.String[]
getComments()
Return comments, or empty array if none.int
getIncrement()
Sequence increment, or -1 for default.int
getInitialValue()
Initial sequence value, or -1 for default.Seq
getInstance(java.lang.ClassLoader envLoader)
Return the initialized sequence instance.int
getLineNumber()
Return the line number of the file at which this instance was parsed.java.lang.String
getName()
The sequence name.MetaDataRepository
getRepository()
The owning repository.java.lang.String
getResourceName()
Return the domain-meaningful name of the resource that was loaded from this source.java.lang.String
getSchema()
java.lang.String
getSequence()
Native sequence name.SequenceMetaData.SequenceFactory
getSequenceFactory()
A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.java.lang.String
getSequencePlugin()
Plugin string describing theSeq
.java.io.File
getSourceFile()
Return the file from which this instance was parsed.java.lang.Object
getSourceScope()
Return the domain-dependent scope of this instance within its file.int
getSourceType()
Return the type of source.int
getType()
The sequence type.protected Seq
instantiate(java.lang.ClassLoader envLoader)
Create a new uninitialized instance of this sequence.protected PluginValue
newPluginValue(java.lang.String property)
Create a new plugin value for sequences.void
setAllocate(int allocate)
Sequence values to allocate, or -1 for default.void
setCatalog(java.lang.String catalog)
void
setColNumber(int colNum)
void
setComments(java.lang.String[] comments)
Set comments.void
setIncrement(int increment)
Sequence increment, or -1 for default.void
setInitialValue(int initial)
Initial sequence value, or -1 for default.void
setLineNumber(int lineNum)
void
setSchema(java.lang.String schema)
void
setSequence(java.lang.String sequence)
Native sequence name.void
setSequenceFactory(SequenceMetaData.SequenceFactory factory)
A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.void
setSequencePlugin(java.lang.String plugin)
Plugin string describing theSeq
.void
setSource(java.io.File file, java.lang.Object scope, int srcType)
void
setType(int type)
The sequence type.java.lang.String
toString()
protected java.lang.String
wrapValue(java.lang.String value)
Wraps property values that may contain spaces or other special characters in double quotes so they are processed as a single valued argument.
-
-
-
Field Detail
-
NAME_SYSTEM
public static final java.lang.String NAME_SYSTEM
Sequence name that means to use the system default sequence.- See Also:
- Constant Field Values
-
IMPL_NATIVE
public static final java.lang.String IMPL_NATIVE
Default plugin alias name; every back end should have some 'native' sequence implementation.- See Also:
- Constant Field Values
-
IMPL_TIME
public static final java.lang.String IMPL_TIME
Time-based sequence values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SequenceMetaData
public SequenceMetaData(java.lang.String name, MetaDataRepository repos)
Constructor; supply sequence name.
-
-
Method Detail
-
getRepository
public MetaDataRepository getRepository()
The owning repository.- Specified by:
getRepository
in interfaceMetaDataContext
-
getName
public java.lang.String getName()
The sequence name.
-
getSourceFile
public java.io.File getSourceFile()
Description copied from interface:SourceTracker
Return the file from which this instance was parsed.- Specified by:
getSourceFile
in interfaceSourceTracker
-
getSourceScope
public java.lang.Object getSourceScope()
Description copied from interface:SourceTracker
Return the domain-dependent scope of this instance within its file.- Specified by:
getSourceScope
in interfaceSourceTracker
-
getSourceType
public int getSourceType()
Description copied from interface:SourceTracker
Return the type of source.- Specified by:
getSourceType
in interfaceSourceTracker
-
setSource
public void setSource(java.io.File file, java.lang.Object scope, int srcType)
-
getLineNumber
public int getLineNumber()
Description copied from interface:SourceTracker
Return the line number of the file at which this instance was parsed.- Specified by:
getLineNumber
in interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum)
-
getColNumber
public int getColNumber()
Description copied from interface:SourceTracker
Return the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumber
in interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum)
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:SourceTracker
Return the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceName
in interfaceSourceTracker
-
getType
public int getType()
The sequence type.
-
setType
public void setType(int type)
The sequence type.
-
getSequence
public java.lang.String getSequence()
Native sequence name.
-
setSequence
public void setSequence(java.lang.String sequence)
Native sequence name.
-
getIncrement
public int getIncrement()
Sequence increment, or -1 for default.
-
setIncrement
public void setIncrement(int increment)
Sequence increment, or -1 for default.
-
getAllocate
public int getAllocate()
Sequence values to allocate, or -1 for default.
-
setAllocate
public void setAllocate(int allocate)
Sequence values to allocate, or -1 for default.
-
getInitialValue
public int getInitialValue()
Initial sequence value, or -1 for default.
-
setInitialValue
public void setInitialValue(int initial)
Initial sequence value, or -1 for default.
-
getSequencePlugin
public java.lang.String getSequencePlugin()
Plugin string describing theSeq
.
-
setSequencePlugin
public void setSequencePlugin(java.lang.String plugin)
Plugin string describing theSeq
.
-
getSequenceFactory
public SequenceMetaData.SequenceFactory getSequenceFactory()
A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.
-
setSequenceFactory
public void setSequenceFactory(SequenceMetaData.SequenceFactory factory)
A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.
-
getInstance
public Seq getInstance(java.lang.ClassLoader envLoader)
Return the initialized sequence instance.
-
instantiate
protected Seq instantiate(java.lang.ClassLoader envLoader)
Create a new uninitialized instance of this sequence.
-
setSchema
public void setSchema(java.lang.String schema)
-
getSchema
public java.lang.String getSchema()
-
setCatalog
public void setCatalog(java.lang.String catalog)
-
getCatalog
public java.lang.String getCatalog()
-
newPluginValue
protected PluginValue newPluginValue(java.lang.String property)
Create a new plugin value for sequences. Returns a standardSeqValue
by default.
-
addStandardProperties
protected void addStandardProperties(java.lang.StringBuilder props)
Add standard properties to the given properties buffer.
-
wrapValue
protected java.lang.String wrapValue(java.lang.String value)
Wraps property values that may contain spaces or other special characters in double quotes so they are processed as a single valued argument.
-
appendProperty
protected void appendProperty(java.lang.StringBuilder props, java.lang.String name, java.lang.String val)
Add a string property to the buffer. Nothing will be added if value is null or empty string.
-
appendProperty
protected void appendProperty(java.lang.StringBuilder props, java.lang.String name, int val)
Add an int property to the buffer. Nothing will be added if value is -1.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getComments
public java.lang.String[] getComments()
Description copied from interface:Commentable
Return comments, or empty array if none.- Specified by:
getComments
in interfaceCommentable
-
setComments
public void setComments(java.lang.String[] comments)
Description copied from interface:Commentable
Set comments.- Specified by:
setComments
in interfaceCommentable
-
-