org.apache.openjpa.meta
Class SequenceMetaData

java.lang.Object
  extended by org.apache.openjpa.meta.SequenceMetaData
All Implemented Interfaces:
Serializable, SourceTracker, Closeable, Commentable, MetaDataContext
Direct Known Subclasses:
SequenceMapping

public class SequenceMetaData
extends Object
implements SourceTracker, MetaDataContext, Closeable, Commentable, Serializable

Metadata about a named sequence.

Since:
0.4.0
Author:
Abe White
See Also:
Serialized Form

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 String IMPL_NATIVE
          Default plugin alias name; every back end should have some 'native' sequence implementation.
static String IMPL_TIME
          Time-based sequence values.
static 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(String name, MetaDataRepository repos)
          Constructor; supply sequence name.
 
Method Summary
protected  void addStandardProperties(StringBuffer props)
          Add standard properties to the given properties buffer.
protected  void appendProperty(StringBuffer props, String name, int val)
          Add an int property to the buffer.
protected  void appendProperty(StringBuffer props, String name, 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.
 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(ClassLoader envLoader)
          Return the initialized sequence instance.
 String getName()
          The sequence name.
 MetaDataRepository getRepository()
          The owning repository.
 String getResourceName()
          Return the domain-meaningful name of the resource that was loaded from this source.
 String getSequence()
          Native sequence name.
 SequenceMetaData.SequenceFactory getSequenceFactory()
          A factory to transform spec sequences produced by user factories into the OpenJPA sequence type.
 String getSequencePlugin()
          Plugin string describing the Seq.
 File getSourceFile()
          Return the file from which this instance was parsed.
 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(ClassLoader envLoader)
          Create a new uninitialized instance of this sequence.
protected  PluginValue newPluginValue(String property)
          Create a new plugin value for sequences.
 void setAllocate(int allocate)
          Sequence values to allocate, or -1 for default.
 void setComments(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 setSequence(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(String plugin)
          Plugin string describing the Seq.
 void setSource(File file, Object scope, int srcType)
           
 void setType(int type)
          The sequence type.
 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 String NAME_SYSTEM
Sequence name that means to use the system default sequence.

See Also:
Constant Field Values

IMPL_NATIVE

public static final 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 String IMPL_TIME
Time-based sequence values.

See Also:
Constant Field Values
Constructor Detail

SequenceMetaData

public SequenceMetaData(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 String getName()
The sequence name.


getSourceFile

public File getSourceFile()
Description copied from interface: SourceTracker
Return the file from which this instance was parsed.

Specified by:
getSourceFile in interface SourceTracker

getSourceScope

public Object getSourceScope()
Description copied from interface: SourceTracker
Return the domain-dependent scope of this instance within its file.

Specified by:
getSourceScope in interface SourceTracker

getSourceType

public int getSourceType()
Description copied from interface: SourceTracker
Return the type of source.

Specified by:
getSourceType in interface SourceTracker

setSource

public void setSource(File file,
                      Object scope,
                      int srcType)

getResourceName

public 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 interface SourceTracker

getType

public int getType()
The sequence type.


setType

public void setType(int type)
The sequence type.


getSequence

public String getSequence()
Native sequence name.


setSequence

public void setSequence(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 String getSequencePlugin()
Plugin string describing the Seq.


setSequencePlugin

public void setSequencePlugin(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(ClassLoader envLoader)
Return the initialized sequence instance.


instantiate

protected Seq instantiate(ClassLoader envLoader)
Create a new uninitialized instance of this sequence.


newPluginValue

protected PluginValue newPluginValue(String property)
Create a new plugin value for sequences. Returns a standard SeqValue by default.


addStandardProperties

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


appendProperty

protected void appendProperty(StringBuffer props,
                              String name,
                              String val)
Add a string property to the buffer. Nothing will be added if value is null or empty string.


appendProperty

protected void appendProperty(StringBuffer props,
                              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 Closeable

toString

public String toString()
Overrides:
toString in class Object

getComments

public String[] getComments()
Description copied from interface: Commentable
Return comments, or empty array if none.

Specified by:
getComments in interface Commentable

setComments

public void setComments(String[] comments)
Description copied from interface: Commentable
Set comments.

Specified by:
setComments in interface Commentable


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.