org.apache.openjpa.meta
Class SequenceMetaData

java.lang.Object
  extended by org.apache.openjpa.meta.SequenceMetaData
All Implemented Interfaces:
org.apache.openjpa.lib.meta.SourceTracker, org.apache.openjpa.lib.util.Closeable, org.apache.openjpa.lib.xml.Commentable, MetaDataContext

public class SequenceMetaData
extends java.lang.Object
implements org.apache.openjpa.lib.meta.SourceTracker, MetaDataContext, org.apache.openjpa.lib.util.Closeable, org.apache.openjpa.lib.xml.Commentable

Metadata about a named sequence.

Since:
4.0
Author:
Abe White

Nested Class Summary
static interface SequenceMetaData.SequenceFactory
          Allow facades to supply adapters from a spec sequence type to the OpenJPA sequence type.
 
Field Summary
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.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
 
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
 
Constructor Summary
SequenceMetaData(java.lang.String name, MetaDataRepository repos)
          Constructor; supply sequence name.
 
Method Summary
protected  void addStandardProperties(java.lang.StringBuffer props)
          Add standard properties to the given properties buffer.
protected  void appendProperty(java.lang.StringBuffer props, java.lang.String name, int val)
          Add an int property to the buffer.
protected  void appendProperty(java.lang.StringBuffer 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[] getComments()
           
 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.
 java.lang.String getName()
          The sequence name.
 MetaDataRepository getRepository()
          The owning repository.
 java.lang.String getResourceName()
           
 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 the Seq.
 java.io.File getSourceFile()
           
 java.lang.Object getSourceScope()
           
 int getSourceType()
           
 int getType()
          The sequence type.
protected  Seq instantiate(java.lang.ClassLoader envLoader)
          Create a new uninitialized instance of this sequence.
protected  org.apache.openjpa.lib.conf.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 setComments(java.lang.String[] comments)
           
 void setIncrement(int increment)
          Sequence increment, or -1 for default.
 void setInitialValue(int initial)
          Initial sequence value, or -1 for default.
 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 the Seq.
 void setSource(java.io.File file, java.lang.Object scope, int srcType)
           
 void setType(int type)
          The sequence type.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 interface MetaDataContext

getName

public java.lang.String getName()
The sequence name.


getSourceFile

public java.io.File getSourceFile()
Specified by:
getSourceFile in interface org.apache.openjpa.lib.meta.SourceTracker

getSourceScope

public java.lang.Object getSourceScope()
Specified by:
getSourceScope in interface org.apache.openjpa.lib.meta.SourceTracker

getSourceType

public int getSourceType()
Specified by:
getSourceType in interface org.apache.openjpa.lib.meta.SourceTracker

setSource

public void setSource(java.io.File file,
                      java.lang.Object scope,
                      int srcType)

getResourceName

public java.lang.String getResourceName()
Specified by:
getResourceName in interface org.apache.openjpa.lib.meta.SourceTracker

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 the Seq.


setSequencePlugin

public void setSequencePlugin(java.lang.String plugin)
Plugin string describing the Seq.


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.


newPluginValue

protected org.apache.openjpa.lib.conf.PluginValue newPluginValue(java.lang.String property)
Create a new plugin value for sequences. Returns a standard SeqValue by default.


addStandardProperties

protected void addStandardProperties(java.lang.StringBuffer props)
Add standard properties to the given properties buffer.


appendProperty

protected void appendProperty(java.lang.StringBuffer 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.StringBuffer props,
                              java.lang.String name,
                              int val)
Add an int property to the buffer. Nothing will be added if value is -1.


close

public void close()
Close user sequence instance.

Specified by:
close in interface org.apache.openjpa.lib.util.Closeable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getComments

public java.lang.String[] getComments()
Specified by:
getComments in interface org.apache.openjpa.lib.xml.Commentable

setComments

public void setComments(java.lang.String[] comments)
Specified by:
setComments in interface org.apache.openjpa.lib.xml.Commentable


Copyright © 2006 Apache Software Foundation. All Rights Reserved.