|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.farrago.FarragoMetadataFactoryImpl
net.sf.farrago.catalog.FarragoReposImpl
public abstract class FarragoReposImpl
Implementation of FarragoRepos using a MDR repository.
| 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. |
|
|
allOfClass(Class<T> clazz)
Returns a collection of all instances of a given class. |
|
|
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 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 |
| Field Detail |
|---|
private static final Logger tracer
private static final int maxNameLength
private boolean isFennelEnabled
protected final FarragoCompoundAllocation allocations
private final Map<String,String> localizedClassNames
private final List<ResourceBundle> resourceBundles
private JmiModelGraph modelGraph
private JmiModelView modelView
private final Map<String,FarragoSequenceAccessor> sequenceMap
private final ReentrantReadWriteLock sxLock
private ThreadLocal<FarragoReposImpl.ReposCache> cache
private Boolean exclusiveAccess
| Constructor Detail |
|---|
public FarragoReposImpl(FarragoAllocationOwner owner)
owner - Allocation owner| Method Detail |
|---|
protected void initGraph()
FarragoMetadataFactoryImpl.getRootPackage() is available.
protected void initGraphOnly()
protected FemFarragoConfig getDefaultConfig()
protected static String getLocalizedClassKey(RefClass refClass)
public JmiModelGraph getModelGraph()
getModelGraph in interface FarragoRepospublic JmiModelView getModelView()
getModelView in interface FarragoRepospublic CwmCatalog getSelfAsCatalog()
getSelfAsCatalog in interface FarragoRepospublic int getIdentifierPrecision()
getIdentifierPrecision in interface FarragoRepospublic String getDefaultCharsetName()
getDefaultCharsetName in interface FarragoReposCharset for this
repositorypublic String getDefaultCollationName()
getDefaultCollationName in interface FarragoReposSqlParserUtil.parseCollation(String). The
default is "ISO-8859-1$en_US".public boolean isFennelEnabled()
isFennelEnabled in interface FarragoRepospublic String getLocalizedObjectName(CwmModelElement modelElement)
FarragoReposCalling getLocalizedObjectName(e) is identical to calling
getLocalizedObjectName(e, e.refClass()).
getLocalizedObjectName in interface FarragoReposmodelElement - catalog object
public String getLocalizedObjectName(String name)
FarragoRepos
getLocalizedObjectName in interface FarragoReposname - object name
public String getLocalizedObjectName(CwmModelElement modelElement,
RefClass refClass)
FarragoRepos
getLocalizedObjectName in interface FarragoReposmodelElement - catalog objectrefClass - 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")
public String getLocalizedObjectName(String qualifierName,
String objectName,
RefClass refClass)
FarragoRepos
getLocalizedObjectName in interface FarragoReposqualifierName - name of containing object, or null for unqualified
nameobjectName - name of objectrefClass - if non-null, the object type to use in the name; if null,
no type is prepended
public String getLocalizedClassName(RefClass refClass)
FarragoRepos
getLocalizedClassName in interface FarragoReposrefClass - class of metadata, e.g. CwmTableClass
public CwmCatalog getCatalog(String catalogName)
FarragoRepos
getCatalog in interface FarragoReposcatalogName - name of catalog to find
public FemTagAnnotation getTagAnnotation(FemAnnotatedElement element,
String tagName)
FarragoRepos
getTagAnnotation in interface FarragoReposelement - the tagged elementtagName - name of tag to find
public void setTagAnnotationValue(FemAnnotatedElement element,
String tagName,
String tagValue)
FarragoRepos
setTagAnnotationValue in interface FarragoReposelement - the element to tagtagName - name of tag to create; if a tag with this name already
exists, it will be updatedtagValue - value to set
public String getTagAnnotationValue(FemAnnotatedElement element,
String tagName)
FarragoRepos
getTagAnnotationValue in interface FarragoReposelement - the tagged elementtagName - name of tag to find
public CwmTaggedValue getTag(CwmModelElement element,
String tagName)
FarragoRepos
getTag in interface FarragoReposelement - the tagged elementtagName - name of tag to find
public void setTagValue(CwmModelElement element,
String tagName,
String tagValue)
FarragoRepos
setTagValue in interface FarragoReposelement - the element to tagtagName - name of tag to create; if a tag with this name already
exists, it will be updatedtagValue - value to set
public String getTagValue(CwmModelElement element,
String tagName)
FarragoRepos
getTagValue in interface FarragoReposelement - the tagged elementtagName - name of tag to find
public List<FarragoReposIntegrityErr> verifyIntegrity(RefObject refObj)
FarragoRepos
verifyIntegrity in interface FarragoReposrefObj - a single object to check (independent of related objects)
or null to check the entire repository
private List<FarragoReposIntegrityErr> verifyIntegrityAll()
public void addResourceBundles(List<ResourceBundle> bundles)
FarragoRepos
addResourceBundles in interface FarragoReposbundles - list of ResourceBundle instances to add
forpublic Object getMetadataFactory(String prefix)
FarragoReposgetMetadataFactory("Fem") returns this.
getMetadataFactory in interface FarragoReposprefix - The name of the prefix which identifies the metadata
factorypublic FarragoSequenceAccessor getSequenceAccessor(String mofId)
FarragoRepos
getSequenceAccessor in interface FarragoReposmofId - the identifier for the sequencepublic String expandProperties(String value)
FarragoRepos${VARNAME}, such as that done by FarragoProperties.expandProperties(String)..
expandProperties in interface FarragoReposvalue - String we want to expand
private RefClass findRefClass(Class<? extends RefObject> clazz)
public <T extends RefObject> Collection<T> allOfClass(Class<T> clazz)
FarragoReposThis method has the same effect as RefClass.refAllOfClass(),
but is preferable because it returns a typed collection.
allOfClass in interface FarragoRepospublic <T extends RefObject> Collection<T> allOfType(Class<T> clazz)
FarragoReposThis method has the same effect as RefClass.refAllOfType(),
but is preferable because it returns a typed collection.
allOfType in interface FarragoRepospublic FarragoModelLoader getModelLoader()
FarragoRepos
getModelLoader in interface FarragoRepospublic FarragoReposTxnContext newTxnContext()
FarragoReposnewTxnContext(false).
newTxnContext in interface FarragoRepospublic FarragoReposTxnContext newTxnContext(boolean manageReposSession)
FarragoReposFarragoReposTxnContext is responsible for
managing repository sessions. Otherwise the caller is responsible for
managing the repository session.
newTxnContext in interface FarragoReposmanageReposSession - if true, the FarragoReposTxnContext manages the
repository session
public void lockRepos(int lockLevel)
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.
lockLevel - 1 for a shared lock, 2 for an exclusive lockpublic void unlockRepos(int lockLevel)
lockLevel - 1 for a shared lock, 2 for an exclusive lockpublic EnkiMDRepository getEnkiMdrRepos()
FarragoReposFarragoRepos.getMdrRepos().
getEnkiMdrRepos in interface FarragoRepospublic void beginReposSession()
FarragoRepos
beginReposSession in interface FarragoReposFarragoRepos.newTxnContext(boolean)public void endReposSession()
FarragoRepos
endReposSession in interface FarragoReposFarragoRepos.newTxnContext(boolean)public void beginExclusiveAccess()
public void endExclusiveAccess()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||