net.sf.farrago.catalog
Class FarragoReposImpl

java.lang.Object
  extended by net.sf.farrago.FarragoMetadataFactoryImpl
      extended by net.sf.farrago.catalog.FarragoReposImpl
All Implemented Interfaces:
FarragoRepos, FarragoMetadataFactory, FarragoAllocation, ClosableAllocation
Direct Known Subclasses:
FarragoMdrReposImpl

public abstract class FarragoReposImpl
extends FarragoMetadataFactoryImpl
implements FarragoRepos

Implementation of FarragoRepos using a MDR repository.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/catalog/FarragoReposImpl.java#31 $
Author:
John V. Sichi

Nested Class Summary
private static class FarragoReposImpl.ReposCache
           
 
Field Summary
protected  FarragoCompoundAllocation allocations
           
private  ThreadLocal<FarragoReposImpl.ReposCache> cache
           
private  Boolean exclusiveAccess
           
private  boolean isFennelEnabled
           
private  Map<String,String> localizedClassNames
           
private static int maxNameLength
          TODO: look this up from repository
private  JmiModelGraph modelGraph
           
private  JmiModelView modelView
           
private  List<ResourceBundle> resourceBundles
           
private  Map<String,FarragoSequenceAccessor> sequenceMap
           
private  ReentrantReadWriteLock sxLock
           
private static Logger tracer
           
 
Constructor Summary
FarragoReposImpl(FarragoAllocationOwner owner)
          Opens a Farrago repository.
 
Method Summary
 void addResourceBundles(List<ResourceBundle> bundles)
          Defines localization for this repository.
<T extends RefObject>
Collection<T>
allOfClass(Class<T> clazz)
          Returns a collection of all instances of a given class.
<T extends RefObject>
Collection<T>
allOfType(Class<T> clazz)
          Returns a collection of all instances of a given type.
 void beginExclusiveAccess()
          Puts the repository in exclusive access mode.
 void beginReposSession()
          Begins a session on the metadata repository.
 void endExclusiveAccess()
          Ends exclusive access mode for the repository.
 void endReposSession()
          Ends a session on the metadata repository.
 String expandProperties(String value)
          Returns the input string with property values substituted for variables of the form ${VARNAME}, such as that done by FarragoProperties.expandProperties(String)..
private  RefClass findRefClass(Class<? extends RefObject> clazz)
           
 CwmCatalog getCatalog(String catalogName)
          Looks up a catalog by name.
 String getDefaultCharsetName()
           
 String getDefaultCollationName()
           
protected  FemFarragoConfig getDefaultConfig()
           
 EnkiMDRepository getEnkiMdrRepos()
          Returns an EnkiMDRepository storing this Farrago repository.
 int getIdentifierPrecision()
           
protected static String getLocalizedClassKey(RefClass refClass)
           
 String getLocalizedClassName(RefClass refClass)
          Looks up the localized name for a class of metadata.
 String getLocalizedObjectName(CwmModelElement modelElement)
          Formats the fully-qualified localized name for an existing object, including its type.
 String getLocalizedObjectName(CwmModelElement modelElement, RefClass refClass)
          Formats the fully-qualified localized name for an existing object.
 String getLocalizedObjectName(String name)
          Formats the localized name for an unqualified typeless object.
 String getLocalizedObjectName(String qualifierName, String objectName, RefClass refClass)
          Formats the fully-qualified localized name for an object that may not exist yet.
 Object getMetadataFactory(String prefix)
          Returns the metadata factory for a particular plugin.
 JmiModelGraph getModelGraph()
           
 FarragoModelLoader getModelLoader()
          Returns the FarragoModelLoader for this repos.
 JmiModelView getModelView()
           
 CwmCatalog getSelfAsCatalog()
           
 FarragoSequenceAccessor getSequenceAccessor(String mofId)
          Returns the an accessor for a sequence stored in the repository
 CwmTaggedValue getTag(CwmModelElement element, String tagName)
          Gets an element's tag.
 FemTagAnnotation getTagAnnotation(FemAnnotatedElement element, String tagName)
          Gets an element's annotation tag.
 String getTagAnnotationValue(FemAnnotatedElement element, String tagName)
          Gets a value tagged to an annotated element.
 String getTagValue(CwmModelElement element, String tagName)
          Gets a value tagged to an element.
protected  void initGraph()
          Initializes the model graph.
protected  void initGraphOnly()
           
 boolean isFennelEnabled()
           
 void lockRepos(int lockLevel)
          Places either a shared or exclusive lock on the repository.
 FarragoReposTxnContext newTxnContext()
          Returns an instance of FarragoReposTxnContext for use in executing transactions against this repository without automatic repository session management.
 FarragoReposTxnContext newTxnContext(boolean manageReposSession)
          Returns an instance of FarragoReposTxnContext for use in executing transactions against this repository.
 void setTagAnnotationValue(FemAnnotatedElement element, String tagName, String tagValue)
          Tags an annotated element.
 void setTagValue(CwmModelElement element, String tagName, String tagValue)
          Tags an element.
 void unlockRepos(int lockLevel)
          Releases either a shared or exclusive lock on the repository that was previously acquired (caller must ensure consistency).
 List<FarragoReposIntegrityErr> verifyIntegrity(RefObject refObj)
          Verifies the integrity of the repository.
private  List<FarragoReposIntegrityErr> verifyIntegrityAll()
           
 
Methods inherited from class net.sf.farrago.FarragoMetadataFactoryImpl
getBehavioralPackage, getCompiledModelTimestamp, getConfigPackage, getCorePackage, getCwmPackage, getDataTypesPackage, getEnumerationsPackage, getFarragoPackage, getFemPackage, getFennelPackage, getInstancePackage, getKeysIndexesPackage, getMedPackage, getPrimitiveTypesPackage, getRelationalPackage, getRootPackage, getSecurityPackage, getSql2003Package, newCwmArgument, newCwmAttribute, newCwmBooleanExpression, newCwmCallAction, newCwmCatalog, newCwmCheckConstraint, newCwmClass, newCwmColumn, newCwmColumnSet, newCwmColumnValue, newCwmConstraint, newCwmDataType, newCwmDataValue, newCwmDependency, newCwmEnumeration, newCwmEnumerationLiteral, newCwmEvent, newCwmExpression, newCwmExtent, newCwmForeignKey, newCwmIndex, newCwmIndexedFeature, newCwmInterface, newCwmKeyRelationship, newCwmMethod, newCwmModel, newCwmMultiplicity, newCwmMultiplicityRange, newCwmNamedColumnSet, newCwmObject, newCwmOperation, newCwmPackage, newCwmParameter, newCwmPrimaryKey, newCwmProcedure, newCwmProcedureExpression, newCwmQueryColumnSet, newCwmQueryExpression, newCwmRow, newCwmRowSet, newCwmSchema, newCwmSlot, newCwmSqldistinctType, newCwmSqlindex, newCwmSqlindexColumn, newCwmSqlparameter, newCwmSqlsimpleType, newCwmSqlstructuredType, newCwmStereotype, newCwmSubsystem, newCwmTable, newCwmTaggedValue, newCwmTrigger, newCwmTypeAlias, newCwmUnion, newCwmUnionMember, newCwmUniqueConstraint, newCwmUniqueKey, newCwmView, newFemAggInvocation, newFemAggStreamDef, newFemBarrierStreamDef, newFemBeginTxnCmd, newFemBernoulliSamplingStreamDef, newFemBufferingTupleStreamDef, newFemBufferReaderStreamDef, newFemBufferWriterStreamDef, newFemCalcTupleStreamDef, newFemCartesianProductStreamDef, newFemCmdAbandonBackup, newFemCmdAlterSystemDeallocate, newFemCmdBeginTxn, newFemCmdBeginTxnWithCsn, newFemCmdCheckpoint, newFemCmdCloseDatabase, newFemCmdCommit, newFemCmdCompleteBackup, newFemCmdCreateExecutionStreamGraph, newFemCmdCreateIndex, newFemCmdCreateStreamHandle, newFemCmdDropIndex, newFemCmdGetLastCommittedTxnId, newFemCmdGetTxnCsn, newFemCmdInitiateBackup, newFemCmdOpenDatabase, newFemCmdPrepareExecutionStreamGraph, newFemCmdRestoreFromBackup, newFemCmdRollback, newFemCmdSavepoint, newFemCmdSetParam, newFemCmdTruncateIndex, newFemCmdVerifyIndex, newFemCmdVersionIndexRoot, newFemCollectTupleStreamDef, newFemColumnHistogram, newFemColumnHistogramBar, newFemColumnListRoutineParameter, newFemColumnName, newFemCorrelation, newFemCorrelationJoinStreamDef, newFemCsnHandle, newFemCsnHandleReturningCmd, newFemDatabaseParam, newFemDataServer, newFemDataWrapper, newFemDbHandle, newFemDynamicParameter, newFemDynamicParamUse, newFemElementWithStorageOptions, newFemExecStreamDataFlow, newFemFarragoConfig, newFemFennelConfig, newFemFlatFileTupleStreamDef, newFemForeignTable, newFemGenericStreamDef, newFemGrant, newFemIndexLoaderDef, newFemIndexScanDef, newFemIndexSearchDef, newFemIndexStatistics, newFemIndexWriterDef, newFemJar, newFemJavaSinkStreamDef, newFemJavaTransformStreamDef, newFemKeyComponent, newFemLabel, newFemLbmBitOpStreamDef, newFemLbmChopperStreamDef, newFemLbmGeneratorStreamDef, newFemLbmIntersectStreamDef, newFemLbmMinusStreamDef, newFemLbmNormalizerStreamDef, newFemLbmSearchStreamDef, newFemLbmSortedAggStreamDef, newFemLbmSplicerStreamDef, newFemLbmUnionStreamDef, newFemLcsClusterAppendStreamDef, newFemLcsClusterReplaceStreamDef, newFemLcsClusterScanDef, newFemLcsRowScanStreamDef, newFemLhxAggStreamDef, newFemLhxJoinStreamDef, newFemLocalCatalog, newFemLocalIndex, newFemLocalIndexColumn, newFemLocalSchema, newFemLocalTable, newFemLocalView, newFemMergeStreamDef, newFemMockTupleStreamDef, newFemMultiUseBufferingStreamDef, newFemNestedLoopJoinStreamDef, newFemPrimaryKeyConstraint, newFemRecoveryReference, newFemReshapeParameter, newFemReshapeStreamDef, newFemRole, newFemRoutine, newFemRoutineParameter, newFemRowCountStatistics, newFemSampleDataset, newFemSequenceGenerator, newFemSortedAggStreamDef, newFemSortingStreamDef, newFemSplicerIndexAccessorDef, newFemSplitterStreamDef, newFemSqlarrayType, newFemSqldistinguishedType, newFemSqlmultisetType, newFemSqlobjectType, newFemSqlpathElement, newFemSqlrowType, newFemSqltypeAttribute, newFemStorageOption, newFemStoredColumn, newFemStreamGraphHandle, newFemStreamHandle, newFemSvptHandle, newFemSystemBackup, newFemTableDeleterDef, newFemTableInserterDef, newFemTableUpdaterDef, newFemTagAnnotation, newFemTimestamp, newFemTupleAccessor, newFemTupleAttrAccessor, newFemTupleAttrDescriptor, newFemTupleAttrProjection, newFemTupleDescriptor, newFemTupleProjection, newFemTxnHandle, newFemUncollectTupleStreamDef, newFemUniqueKeyConstraint, newFemUser, newFemUserDefinedOrdering, newFemUserDefinedType, newFemValuesStreamDef, newFemViewColumn, newFemWindowDef, newFemWindowPartitionDef, newFemWindowStreamDef, setRootPackage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.farrago.catalog.FarragoRepos
beginReposTxn, endReposTxn, getCurrentConfig, getMdrRepos, getTransientFarragoPackage
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 
Methods inherited from interface net.sf.farrago.FarragoMetadataFactory
getBehavioralPackage, getCompiledModelTimestamp, getConfigPackage, getCorePackage, getCwmPackage, getDataTypesPackage, getEnumerationsPackage, getFarragoPackage, getFemPackage, getFennelPackage, getInstancePackage, getKeysIndexesPackage, getMedPackage, getPrimitiveTypesPackage, getRelationalPackage, getRootPackage, getSecurityPackage, getSql2003Package, newCwmArgument, newCwmAttribute, newCwmBooleanExpression, newCwmCallAction, newCwmCatalog, newCwmCheckConstraint, newCwmClass, newCwmColumn, newCwmColumnSet, newCwmColumnValue, newCwmConstraint, newCwmDataType, newCwmDataValue, newCwmDependency, newCwmEnumeration, newCwmEnumerationLiteral, newCwmEvent, newCwmExpression, newCwmExtent, newCwmForeignKey, newCwmIndex, newCwmIndexedFeature, newCwmInterface, newCwmKeyRelationship, newCwmMethod, newCwmModel, newCwmMultiplicity, newCwmMultiplicityRange, newCwmNamedColumnSet, newCwmObject, newCwmOperation, newCwmPackage, newCwmParameter, newCwmPrimaryKey, newCwmProcedure, newCwmProcedureExpression, newCwmQueryColumnSet, newCwmQueryExpression, newCwmRow, newCwmRowSet, newCwmSchema, newCwmSlot, newCwmSqldistinctType, newCwmSqlindex, newCwmSqlindexColumn, newCwmSqlparameter, newCwmSqlsimpleType, newCwmSqlstructuredType, newCwmStereotype, newCwmSubsystem, newCwmTable, newCwmTaggedValue, newCwmTrigger, newCwmTypeAlias, newCwmUnion, newCwmUnionMember, newCwmUniqueConstraint, newCwmUniqueKey, newCwmView, newFemAggInvocation, newFemAggStreamDef, newFemBarrierStreamDef, newFemBeginTxnCmd, newFemBernoulliSamplingStreamDef, newFemBufferingTupleStreamDef, newFemBufferReaderStreamDef, newFemBufferWriterStreamDef, newFemCalcTupleStreamDef, newFemCartesianProductStreamDef, newFemCmdAbandonBackup, newFemCmdAlterSystemDeallocate, newFemCmdBeginTxn, newFemCmdBeginTxnWithCsn, newFemCmdCheckpoint, newFemCmdCloseDatabase, newFemCmdCommit, newFemCmdCompleteBackup, newFemCmdCreateExecutionStreamGraph, newFemCmdCreateIndex, newFemCmdCreateStreamHandle, newFemCmdDropIndex, newFemCmdGetLastCommittedTxnId, newFemCmdGetTxnCsn, newFemCmdInitiateBackup, newFemCmdOpenDatabase, newFemCmdPrepareExecutionStreamGraph, newFemCmdRestoreFromBackup, newFemCmdRollback, newFemCmdSavepoint, newFemCmdSetParam, newFemCmdTruncateIndex, newFemCmdVerifyIndex, newFemCmdVersionIndexRoot, newFemCollectTupleStreamDef, newFemColumnHistogram, newFemColumnHistogramBar, newFemColumnListRoutineParameter, newFemColumnName, newFemCorrelation, newFemCorrelationJoinStreamDef, newFemCsnHandle, newFemCsnHandleReturningCmd, newFemDatabaseParam, newFemDataServer, newFemDataWrapper, newFemDbHandle, newFemDynamicParameter, newFemDynamicParamUse, newFemElementWithStorageOptions, newFemExecStreamDataFlow, newFemFarragoConfig, newFemFennelConfig, newFemFlatFileTupleStreamDef, newFemForeignTable, newFemGenericStreamDef, newFemGrant, newFemIndexLoaderDef, newFemIndexScanDef, newFemIndexSearchDef, newFemIndexStatistics, newFemIndexWriterDef, newFemJar, newFemJavaSinkStreamDef, newFemJavaTransformStreamDef, newFemKeyComponent, newFemLabel, newFemLbmBitOpStreamDef, newFemLbmChopperStreamDef, newFemLbmGeneratorStreamDef, newFemLbmIntersectStreamDef, newFemLbmMinusStreamDef, newFemLbmNormalizerStreamDef, newFemLbmSearchStreamDef, newFemLbmSortedAggStreamDef, newFemLbmSplicerStreamDef, newFemLbmUnionStreamDef, newFemLcsClusterAppendStreamDef, newFemLcsClusterReplaceStreamDef, newFemLcsClusterScanDef, newFemLcsRowScanStreamDef, newFemLhxAggStreamDef, newFemLhxJoinStreamDef, newFemLocalCatalog, newFemLocalIndex, newFemLocalIndexColumn, newFemLocalSchema, newFemLocalTable, newFemLocalView, newFemMergeStreamDef, newFemMockTupleStreamDef, newFemMultiUseBufferingStreamDef, newFemNestedLoopJoinStreamDef, newFemPrimaryKeyConstraint, newFemRecoveryReference, newFemReshapeParameter, newFemReshapeStreamDef, newFemRole, newFemRoutine, newFemRoutineParameter, newFemRowCountStatistics, newFemSampleDataset, newFemSequenceGenerator, newFemSortedAggStreamDef, newFemSortingStreamDef, newFemSplicerIndexAccessorDef, newFemSplitterStreamDef, newFemSqlarrayType, newFemSqldistinguishedType, newFemSqlmultisetType, newFemSqlobjectType, newFemSqlpathElement, newFemSqlrowType, newFemSqltypeAttribute, newFemStorageOption, newFemStoredColumn, newFemStreamGraphHandle, newFemStreamHandle, newFemSvptHandle, newFemSystemBackup, newFemTableDeleterDef, newFemTableInserterDef, newFemTableUpdaterDef, newFemTagAnnotation, newFemTimestamp, newFemTupleAccessor, newFemTupleAttrAccessor, newFemTupleAttrDescriptor, newFemTupleAttrProjection, newFemTupleDescriptor, newFemTupleProjection, newFemTxnHandle, newFemUncollectTupleStreamDef, newFemUniqueKeyConstraint, newFemUser, newFemUserDefinedOrdering, newFemUserDefinedType, newFemValuesStreamDef, newFemViewColumn, newFemWindowDef, newFemWindowPartitionDef, newFemWindowStreamDef, setRootPackage
 

Field Detail

tracer

private static final Logger tracer

maxNameLength

private static final int maxNameLength
TODO: look this up from repository

See Also:
Constant Field Values

isFennelEnabled

private boolean isFennelEnabled

allocations

protected final FarragoCompoundAllocation allocations

localizedClassNames

private final Map<String,String> localizedClassNames

resourceBundles

private final List<ResourceBundle> resourceBundles

modelGraph

private JmiModelGraph modelGraph

modelView

private JmiModelView modelView

sequenceMap

private final Map<String,FarragoSequenceAccessor> sequenceMap

sxLock

private final ReentrantReadWriteLock sxLock

cache

private ThreadLocal<FarragoReposImpl.ReposCache> cache

exclusiveAccess

private Boolean exclusiveAccess
Constructor Detail

FarragoReposImpl

public FarragoReposImpl(FarragoAllocationOwner owner)
Opens a Farrago repository.

Parameters:
owner - Allocation owner
Method Detail

initGraph

protected void initGraph()
Initializes the model graph. The constructor of a concrete subclass must call this after the repository has been initialized, and FarragoMetadataFactoryImpl.getRootPackage() is available.


initGraphOnly

protected void initGraphOnly()

getDefaultConfig

protected FemFarragoConfig getDefaultConfig()

getLocalizedClassKey

protected static String getLocalizedClassKey(RefClass refClass)

getModelGraph

public JmiModelGraph getModelGraph()
Specified by:
getModelGraph in interface FarragoRepos
Returns:
model graph for repository metamodel

getModelView

public JmiModelView getModelView()
Specified by:
getModelView in interface FarragoRepos
Returns:
model view for repository metamodel

getSelfAsCatalog

public CwmCatalog getSelfAsCatalog()
Specified by:
getSelfAsCatalog in interface FarragoRepos
Returns:
CwmCatalog representing this FarragoRepos

getIdentifierPrecision

public int getIdentifierPrecision()
Specified by:
getIdentifierPrecision in interface FarragoRepos
Returns:
maximum identifier length in characters

getDefaultCharsetName

public String getDefaultCharsetName()
Specified by:
getDefaultCharsetName in interface FarragoRepos
Returns:
the name of the default Charset for this repository

getDefaultCollationName

public String getDefaultCollationName()
Specified by:
getDefaultCollationName in interface FarragoRepos
Returns:
the name of the default collation name for this repository. The value is of the form charset$locale$strength, as per SqlParserUtil.parseCollation(String). The default is "ISO-8859-1$en_US".

isFennelEnabled

public boolean isFennelEnabled()
Specified by:
isFennelEnabled in interface FarragoRepos
Returns:
true iff Fennel support should be used

getLocalizedObjectName

public String getLocalizedObjectName(CwmModelElement modelElement)
Description copied from interface: FarragoRepos
Formats the fully-qualified localized name for an existing object, including its type.

Calling getLocalizedObjectName(e) is identical to calling getLocalizedObjectName(e, e.refClass()).

Specified by:
getLocalizedObjectName in interface FarragoRepos
Parameters:
modelElement - catalog object
Returns:
localized name

getLocalizedObjectName

public String getLocalizedObjectName(String name)
Description copied from interface: FarragoRepos
Formats the localized name for an unqualified typeless object.

Specified by:
getLocalizedObjectName in interface FarragoRepos
Parameters:
name - object name
Returns:
localized name

getLocalizedObjectName

public String getLocalizedObjectName(CwmModelElement modelElement,
                                     RefClass refClass)
Description copied from interface: FarragoRepos
Formats the fully-qualified localized name for an existing object.

Specified by:
getLocalizedObjectName in interface FarragoRepos
Parameters:
modelElement - catalog object
refClass - if non-null, use this as the type of the object, e.g. "table SCHEMA.TABLE"; if null, don't include type (e.g. just "SCHEMA.TABLE")
Returns:
localized name

getLocalizedObjectName

public String getLocalizedObjectName(String qualifierName,
                                     String objectName,
                                     RefClass refClass)
Description copied from interface: FarragoRepos
Formats the fully-qualified localized name for an object that may not exist yet.

Specified by:
getLocalizedObjectName in interface FarragoRepos
Parameters:
qualifierName - name of containing object, or null for unqualified name
objectName - name of object
refClass - if non-null, the object type to use in the name; if null, no type is prepended
Returns:
localized name

getLocalizedClassName

public String getLocalizedClassName(RefClass refClass)
Description copied from interface: FarragoRepos
Looks up the localized name for a class of metadata.

Specified by:
getLocalizedClassName in interface FarragoRepos
Parameters:
refClass - class of metadata, e.g. CwmTableClass
Returns:
localized name, e.g. "table"

getCatalog

public CwmCatalog getCatalog(String catalogName)
Description copied from interface: FarragoRepos
Looks up a catalog by name.

Specified by:
getCatalog in interface FarragoRepos
Parameters:
catalogName - name of catalog to find
Returns:
catalog definition, or null if not found

getTagAnnotation

public FemTagAnnotation getTagAnnotation(FemAnnotatedElement element,
                                         String tagName)
Description copied from interface: FarragoRepos
Gets an element's annotation tag.

Specified by:
getTagAnnotation in interface FarragoRepos
Parameters:
element - the tagged element
tagName - name of tag to find
Returns:
tag, or null if not found

setTagAnnotationValue

public void setTagAnnotationValue(FemAnnotatedElement element,
                                  String tagName,
                                  String tagValue)
Description copied from interface: FarragoRepos
Tags an annotated element.

Specified by:
setTagAnnotationValue in interface FarragoRepos
Parameters:
element - the element to tag
tagName - name of tag to create; if a tag with this name already exists, it will be updated
tagValue - value to set

getTagAnnotationValue

public String getTagAnnotationValue(FemAnnotatedElement element,
                                    String tagName)
Description copied from interface: FarragoRepos
Gets a value tagged to an annotated element.

Specified by:
getTagAnnotationValue in interface FarragoRepos
Parameters:
element - the tagged element
tagName - name of tag to find
Returns:
tag value, or null if not found

getTag

public CwmTaggedValue getTag(CwmModelElement element,
                             String tagName)
Description copied from interface: FarragoRepos
Gets an element's tag.

Specified by:
getTag in interface FarragoRepos
Parameters:
element - the tagged element
tagName - name of tag to find
Returns:
tag, or null if not found

setTagValue

public void setTagValue(CwmModelElement element,
                        String tagName,
                        String tagValue)
Description copied from interface: FarragoRepos
Tags an element.

Specified by:
setTagValue in interface FarragoRepos
Parameters:
element - the element to tag
tagName - name of tag to create; if a tag with this name already exists, it will be updated
tagValue - value to set

getTagValue

public String getTagValue(CwmModelElement element,
                          String tagName)
Description copied from interface: FarragoRepos
Gets a value tagged to an element.

Specified by:
getTagValue in interface FarragoRepos
Parameters:
element - the tagged element
tagName - name of tag to find
Returns:
tag value, or null if not found

verifyIntegrity

public List<FarragoReposIntegrityErr> verifyIntegrity(RefObject refObj)
Description copied from interface: FarragoRepos
Verifies the integrity of the repository.

Specified by:
verifyIntegrity in interface FarragoRepos
Parameters:
refObj - a single object to check (independent of related objects) or null to check the entire repository
Returns:
list of violations (empty list indicates integrity check passed)

verifyIntegrityAll

private List<FarragoReposIntegrityErr> verifyIntegrityAll()

addResourceBundles

public void addResourceBundles(List<ResourceBundle> bundles)
Description copied from interface: FarragoRepos
Defines localization for this repository.

Specified by:
addResourceBundles in interface FarragoRepos
Parameters:
bundles - list of ResourceBundle instances to add for

getMetadataFactory

public Object getMetadataFactory(String prefix)
Description copied from interface: FarragoRepos
Returns the metadata factory for a particular plugin. In particular, getMetadataFactory("Fem") returns this.

Specified by:
getMetadataFactory in interface FarragoRepos
Parameters:
prefix - The name of the prefix which identifies the metadata factory

getSequenceAccessor

public FarragoSequenceAccessor getSequenceAccessor(String mofId)
Description copied from interface: FarragoRepos
Returns the an accessor for a sequence stored in the repository

Specified by:
getSequenceAccessor in interface FarragoRepos
Parameters:
mofId - the identifier for the sequence

expandProperties

public String expandProperties(String value)
Description copied from interface: FarragoRepos
Returns the input string with property values substituted for variables of the form ${VARNAME}, such as that done by FarragoProperties.expandProperties(String)..

Specified by:
expandProperties in interface FarragoRepos
Parameters:
value - String we want to expand
Returns:
expanded string, if value(s) were known

findRefClass

private RefClass findRefClass(Class<? extends RefObject> clazz)

allOfClass

public <T extends RefObject> Collection<T> allOfClass(Class<T> clazz)
Description copied from interface: FarragoRepos
Returns a collection of all instances of a given class.

This method has the same effect as RefClass.refAllOfClass(), but is preferable because it returns a typed collection.

Specified by:
allOfClass in interface FarragoRepos

allOfType

public <T extends RefObject> Collection<T> allOfType(Class<T> clazz)
Description copied from interface: FarragoRepos
Returns a collection of all instances of a given type.

This method has the same effect as RefClass.refAllOfType(), but is preferable because it returns a typed collection.

Specified by:
allOfType in interface FarragoRepos

getModelLoader

public FarragoModelLoader getModelLoader()
Description copied from interface: FarragoRepos
Returns the FarragoModelLoader for this repos. May return null if not supported by implementation.

Specified by:
getModelLoader in interface FarragoRepos

newTxnContext

public FarragoReposTxnContext newTxnContext()
Description copied from interface: FarragoRepos
Returns an instance of FarragoReposTxnContext for use in executing transactions against this repository without automatic repository session management. Equivalent to newTxnContext(false).

Specified by:
newTxnContext in interface FarragoRepos
Returns:
an instance of FarragoReposTxnContext for use in executing transactions against this repository

newTxnContext

public FarragoReposTxnContext newTxnContext(boolean manageReposSession)
Description copied from interface: FarragoRepos
Returns an instance of FarragoReposTxnContext for use in executing transactions against this repository. If the manageReposSession parameter is true, the returned FarragoReposTxnContext is responsible for managing repository sessions. Otherwise the caller is responsible for managing the repository session.

Specified by:
newTxnContext in interface FarragoRepos
Parameters:
manageReposSession - if true, the FarragoReposTxnContext manages the repository session
Returns:
an instance of FarragoReposTxnContext for use in executing transactions against this repository

lockRepos

public void lockRepos(int lockLevel)
Places either a shared or exclusive lock on the repository. Multiple shared locks are allowed from different threads when no thread holds an exclusive lock, but only one thread can hold an exclusive lock at a time, preventing shared locks from other threads. If a conflicting lock is requested, that requester will wait until the requested lock is available. Locks are reentrant: a thread can take the same lock more than once, but must make a matching number of calls to unlockRepos(int) in order to release the lock. Upgrade and downgrade are not supported.

This lock is independent of MDR transaction state (i.e. it can be held even when no MDR transaction is in progress; an MDR transaction can be started without taking this lock; and an exclusive lock can be taken even for a read-only MDR transaction). Currently, its only public exposure is via FarragoReposTxnContext, which matches shared with read and exclusive with write.

Parameters:
lockLevel - 1 for a shared lock, 2 for an exclusive lock

unlockRepos

public void unlockRepos(int lockLevel)
Releases either a shared or exclusive lock on the repository that was previously acquired (caller must ensure consistency).

Parameters:
lockLevel - 1 for a shared lock, 2 for an exclusive lock

getEnkiMdrRepos

public EnkiMDRepository getEnkiMdrRepos()
Description copied from interface: FarragoRepos
Returns an EnkiMDRepository storing this Farrago repository. This method returns the same instance of FarragoRepos.getMdrRepos().

Specified by:
getEnkiMdrRepos in interface FarragoRepos
Returns:
EnkiMDRepository storing this Farrago repository

beginReposSession

public void beginReposSession()
Description copied from interface: FarragoRepos
Begins a session on the metadata repository.

Specified by:
beginReposSession in interface FarragoRepos
See Also:
FarragoRepos.newTxnContext(boolean)

endReposSession

public void endReposSession()
Description copied from interface: FarragoRepos
Ends a session on the metadata repository.

Specified by:
endReposSession in interface FarragoRepos
See Also:
FarragoRepos.newTxnContext(boolean)

beginExclusiveAccess

public void beginExclusiveAccess()
Puts the repository in exclusive access mode. When in this mode, subsequent attempts to lock the repository will return an exception immediately rather than wait for a required repository lock to become available.


endExclusiveAccess

public void endExclusiveAccess()
Ends exclusive access mode for the repository.