public class MetaDataFramework
extends java.lang.Object
implements java.io.Serializable
MetaDataFramework instances are configured from a framework configuration
file, and registered in a FrameworkRegistry
.
Major components include:
SchemaHelper
instanceFieldInfoMap
for information
such as best practices and definitionsSchemaPathMap
FrameworkConfigReader
that
provides information from the framework configuration fileConstructor and Description |
---|
MetaDataFramework(java.io.File configFile,
java.lang.String docRoot)
Constructor for the MetaDataFramework object
|
MetaDataFramework(FrameworkConfigReader configReader)
Constructor for the MetaDataFramework object
|
MetaDataFramework(FrameworkConfigReader configReader,
java.lang.String docRoot)
Constructor for the MetaDataFramework object
|
MetaDataFramework(java.lang.String configFilePath,
java.lang.String docRoot)
Constructor for the MetaDataFramework object given the path to a config
file for the particular framework (e.g., "adn").
|
Modifier and Type | Method and Description |
---|---|
org.dom4j.Document |
copyRecord(java.lang.String xml,
java.lang.String id,
CollectionConfig collectionConfig,
User user)
Copy the given xml record, inserting new values as specified by the
Collection configuration.
|
void |
destroy()
Description of the Method
|
java.lang.String |
getAutoFormDir()
Gets the directory to which metadata editor pages are written.
|
int |
getBaseRenderLevel()
Gets the baseRenderLevel attribute of the MetaDataFramework object.
|
java.lang.String |
getBestPracticesLabel()
Gets the bestPracticesLabel attribute of the MetaDataFramework object
|
FrameworkConfigReader |
getConfigReader()
Gets the configReader attribute of the MetaDataFramework object
|
java.lang.String |
getDateCreatedPath()
Gets the dateCreatedPath attribute of the MetaDataFramework object
|
java.lang.String |
getDiscussionURL()
Gets the discussionURL attribute of the MetaDataFramework object.
|
java.lang.String |
getDocRoot()
Gets the docRoot attribute of the MetaDataFramework object
|
org.dom4j.Document |
getEditableDocument(java.io.File file)
Gets a localized Document (with ampersands expanded) that is suitable for
editing.
|
org.dom4j.Document |
getEditableDocument(java.lang.String filePath)
Gets a localized Document (with ampersands expanded) that is suitable for
editing.
|
FieldInfoReader |
getFieldInfo(java.lang.String xpath)
Gets the FieldInfo for the given xpath
|
FieldInfoMap |
getFieldInfoMap()
Gets the fieldInfoMap attribute of the MetaDataFramework object
|
java.lang.String |
getIdPath()
Gets the idPath attribute of the MetaDataFramework object
|
java.lang.String |
getInitialFieldCollapse(java.lang.String xpath)
Return configured value for initialFieldCollapse for this xpath
|
java.util.List |
getMuiGroups()
Gets the muiGroups attribute of the MetaDataFramework object
|
java.lang.String |
getName()
Gets the name attribute of the MetaDataFramework.
|
SchemaPath |
getNamedSchemaPath(java.lang.String pathName)
Gets the namedSchemaPath attribute of the MetaDataFramework object
|
java.lang.String |
getNamedSchemaPathXpath(java.lang.String pathName)
Gets the namedSchemaPath attribute of the MetaDataFramework object
|
PageList |
getPageList()
Gets the pageList attribute of the MetaDataFramework object
|
boolean |
getRebuildOnStart()
Gets the rebuildOnStart attribute of the MetaDataFramework object
|
java.lang.String |
getRecordsDir()
Gets the recordsDir attribute of the MetaDataFramework object
|
java.lang.String |
getRecordUrl(org.dom4j.Document itemRecord)
Extracts the URL from the provided record using the "urlPath" configured
SchemaPath for this framework.
|
java.lang.String |
getRenderer()
Gets the renderer that will create the editor for records of this
framework.
|
java.lang.String |
getRootElementName()
Gets the rootElementName attribute of the MetaDataFramework.
|
SchemaHelper |
getSchemaHelper()
Gets the schemaHelper attribute of the MetaDataFramework object
|
SchemaPathMap |
getSchemaPathMap()
Gets the schemaPathMap for this framework.
|
java.lang.String |
getSchemaURI()
Gets the schemaFile attribute of the MetaDataFramework object
|
StandardsManager |
getStandardsManager()
Gets the standardsManager attribute of the MetaDataFramework object
|
java.lang.String |
getUniqueUrlPath()
Gets the uniqueUrlPath attribute of the MetaDataFramework object
|
java.lang.String |
getUrlPath()
Gets the urlPath attribute of the MetaDataFramework object
|
java.util.List |
getUrlPaths()
Returns normalized xpaths specified in framework configuration as "url
paths".
|
UserInfo |
getUserInfo()
Gets the userInfo been for this framework, which specifies xpaths that can
be populated with attributes from the SessionUser object, such as name,
institution, and email.
|
XMLValidator |
getValidator()
Gets the validator attribute of the MetaDataFramework object
|
java.lang.String |
getVersion()
Gets the version attribute of the MetaDataFramework object
|
VocabLayoutConfig |
getVocabLayouts()
Gets the vocabLayouts attribute of the MetaDataFramework object
|
java.lang.String |
getWorkingRenderer()
Gets the workingRenderer attribute of the MetaDataFramework object
|
java.lang.String |
getWorkingSchemaURI()
Gets the workingSchemaURI attribute (pointing to the location of the last
successfully loaded schema) of the MetaDataFramework object.
|
org.dom4j.Document |
getWritableRecord(org.dom4j.Document doc)
Converts a editable Document into an xml record that can be written to
disk.
|
java.lang.String |
getWritableRecordXml(org.dom4j.Document doc)
Gets the writableRecordXml attribute of the MetaDataFramework object
|
java.lang.String |
getXmlFormat()
Gets the xmlFormat attribute of the MetaDataFramework object
|
void |
init()
Description of the Method
|
boolean |
isInitialized()
Gets the initialized attribute of the MetaDataFramework object
|
void |
loadSchemaHelper()
Load a SchemaHelper instance for this framework.
|
org.dom4j.Document |
makeMinimalRecord(java.lang.String id)
Returns an instance document containing only required nodes, with the "id"
field populated with provided id
|
org.dom4j.Document |
makeMinimalRecord(java.lang.String id,
CollectionConfig collectionConfig)
Returns an instance document containing only required nodes, with the "id"
field populated with provided id
|
org.dom4j.Document |
makeMinimalRecord(java.lang.String id,
CollectionConfig collectionConfig,
User user)
Returns an instance document containing only required nodes, with the "id"
field populated with provided id and collectionConfig fields populated if
collectionConfig is provided.
|
DocMap |
preprocessEditableDocument(DocMap docMap)
NOT YET DOCUMENTED
|
org.dom4j.Document |
preprocessEditableDocument(org.dom4j.Document doc)
NOT YET DOCUMENTED
|
void |
processOrderedElements(org.dom4j.Document doc)
Orders elements as specified by the framework configuration.
|
void |
refresh()
NOT YET DOCUMENTED
|
void |
renderEditorPages()
Generate the pages of the editor for records of this MetaDataFramework.
|
void |
resetValidator()
NOT YET DOCUMENTED
|
void |
setBaseRenderLevel(int level)
Sets the baseRenderLevel attribute of the MetaDataFramework object
|
void |
setBestPracticesLabel(java.lang.String r)
Sets the bestPracticesLabel attribute of the MetaDataFramework object
|
static void |
setDebug(boolean bool)
Sets the debug attribute of the MetaDataFramework class
|
void |
setDiscussionURL(java.lang.String s)
Sets the discussionURL attribute of the MetaDataFramework object
|
void |
setDocRoot(java.lang.String docRoot)
used by stand-alone AutoForm to explicitly set docRoot
|
void |
setMuiGroups(MetadataVocab vocab,
java.lang.String audience,
java.lang.String language)
Returns a list of xpaths for which MUI Groups files exist for this
framework.
|
void |
setRebuildOnStart(boolean bool)
Sets the rebuildOnStart attribute of the MetaDataFramework object
|
void |
setRecordsDir(java.io.File dir)
Sets the recordsDir attribute of the MetaDataFramework object
|
void |
setRecordsDir(java.lang.String dir)
Sets the recordsDir attribute of the MetaDataFramework object
|
void |
setRenderer(java.lang.String r)
Sets the renderer that will create the editor for records of this
framework.
|
void |
setRootElementName(java.lang.String name)
Sets the rootElementName attribute of the MetaDataFramework object
|
void |
setSchemaHelper(SchemaHelper schemaHelper)
Sets the schemaHelper attribute of the MetaDataFramework object
|
void |
setSchemaURI(java.lang.String uri)
Sets the schemaURI attribute of the MetaDataFramework object
|
void |
setStandardsManager(StandardsManager standardsManager)
Sets the standardsManager attribute of the MetaDataFramework object (called
by loadSchemaHelper)
|
void |
setWorkingRenderer(java.lang.String renderer)
Sets the workingRenderer attribute of the MetaDataFramework object
|
void |
setWorkingSchemaURI(java.lang.String uri)
Sets the workingSchemaURI attribute of the MetaDataFramework object
|
java.lang.String |
toString()
String representation for debugging
|
java.util.List |
validateFieldInfoPaths()
check the fieldInfo paths to make sure they are legal schema paths ...
|
java.lang.String |
validateRecord(java.lang.Object record)
NOT YET DOCUMENTED
|
java.util.List |
validateVocabLayoutPaths()
check the vocabLayoutConfig paths to make sure they are legal schema paths ...
|
void |
writeEditableDocument(org.dom4j.Document doc,
java.io.File file)
Converts an editable Document into a writable xmlRecord (string) via
getWritableRecordXml and writes it to
disk. |
void |
writeProps()
update config file with current values
|
public MetaDataFramework(java.lang.String configFilePath, java.lang.String docRoot)
configFilePath
- Description of the ParameterdocRoot
- The context document root as obtainied by calling
getServletContext().getRealPath("/");public MetaDataFramework(java.io.File configFile, java.lang.String docRoot)
configFile
- Description of the ParameterdocRoot
- path to the application contextpublic MetaDataFramework(FrameworkConfigReader configReader)
configReader
- Description of the Parameterpublic MetaDataFramework(FrameworkConfigReader configReader, java.lang.String docRoot)
configReader
- Description of the ParameterdocRoot
- Description of the Parameterpublic void init()
public java.util.List validateVocabLayoutPaths()
public java.util.List validateFieldInfoPaths()
public void refresh()
public boolean isInitialized()
public VocabLayoutConfig getVocabLayouts()
public FrameworkConfigReader getConfigReader()
public void writeProps() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic java.lang.String getDocRoot()
public void setDocRoot(java.lang.String docRoot)
docRoot
- The new docRoot valuepublic PageList getPageList()
public FieldInfoMap getFieldInfoMap()
public FieldInfoReader getFieldInfo(java.lang.String xpath)
xpath
- Description of the Parameterpublic java.lang.String getInitialFieldCollapse(java.lang.String xpath)
xpath
- NOT YET DOCUMENTEDpublic SchemaPathMap getSchemaPathMap()
public UserInfo getUserInfo()
public void setMuiGroups(MetadataVocab vocab, java.lang.String audience, java.lang.String language)
vocab
- The new muiGroups valueaudience
- The new muiGroups valuelanguage
- The new muiGroups valuepublic java.util.List getMuiGroups()
public StandardsManager getStandardsManager()
public void setStandardsManager(StandardsManager standardsManager)
standardsManager
- The new standardsManager valuepublic java.lang.String getRenderer()
public void setRenderer(java.lang.String r)
r
- The new renderer valuepublic java.lang.String getBestPracticesLabel()
public void setBestPracticesLabel(java.lang.String r)
r
- The new bestPracticesLabel valuepublic java.lang.String getWorkingSchemaURI()
public void setWorkingSchemaURI(java.lang.String uri)
uri
- The new workingSchemaURI valuepublic java.lang.String getWorkingRenderer()
public void setWorkingRenderer(java.lang.String renderer)
renderer
- The new workingRenderer valuepublic java.lang.String getRecordsDir()
public void setRecordsDir(java.io.File dir)
dir
- The new recordsDir valuepublic void setRecordsDir(java.lang.String dir)
dir
- The new recordsDir valuepublic SchemaHelper getSchemaHelper()
public void setSchemaHelper(SchemaHelper schemaHelper)
schemaHelper
- The new schemaHelper valuepublic void loadSchemaHelper() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic java.lang.String getRootElementName()
public void setRootElementName(java.lang.String name)
name
- The new rootElementName valuepublic java.lang.String getSchemaURI()
public XMLValidator getValidator()
public void resetValidator()
public java.lang.String validateRecord(java.lang.Object record)
record
- NOT YET DOCUMENTEDpublic java.lang.String getUniqueUrlPath()
public java.lang.String getNamedSchemaPathXpath(java.lang.String pathName)
pathName
- Description of the Parameterpublic SchemaPath getNamedSchemaPath(java.lang.String pathName)
pathName
- Description of the Parameterpublic java.util.List getUrlPaths()
public java.lang.String getIdPath()
public java.lang.String getDateCreatedPath()
public java.lang.String getUrlPath()
public java.lang.String getRecordUrl(org.dom4j.Document itemRecord) throws java.lang.Exception
itemRecord
- NOT YET DOCUMENTEDjava.lang.Exception
- NOT YET DOCUMENTEDpublic void setSchemaURI(java.lang.String uri)
uri
- The new schemaURI valuepublic java.lang.String getAutoFormDir()
E.g., for "adn" format, the autoFormDir would be ${docRoot}/editor/adn.
public java.lang.String getXmlFormat()
public java.lang.String getVersion()
public java.lang.String getName()
public int getBaseRenderLevel()
public void setBaseRenderLevel(int level)
level
- The new baseRenderLevel valuepublic java.lang.String getDiscussionURL()
public void setDiscussionURL(java.lang.String s)
s
- The new discussionURL valuepublic boolean getRebuildOnStart()
public void setRebuildOnStart(boolean bool)
bool
- The new rebuildOnStart valuepublic org.dom4j.Document copyRecord(java.lang.String xml, java.lang.String id, CollectionConfig collectionConfig, User user) throws java.lang.Exception
xml
- xml record to be copiedid
- id for new recordcollectionConfig
- the collection configurationuser
- the current user (from which to populate user
fields if so configured)java.lang.Exception
- Description of the Exceptionpublic org.dom4j.Document makeMinimalRecord(java.lang.String id) throws java.lang.Exception
id
- id value to be inserted into the id field for created
recordjava.lang.Exception
public org.dom4j.Document makeMinimalRecord(java.lang.String id, CollectionConfig collectionConfig) throws java.lang.Exception
id
- id value to be inserted into the id field for
created recordcollectionConfig
- NOT YET DOCUMENTEDjava.lang.Exception
public org.dom4j.Document makeMinimalRecord(java.lang.String id, CollectionConfig collectionConfig, User user) throws java.lang.Exception
id
- id value to be inserted into the id field for
created recordcollectionConfig
- Description of the Parameteruser
- NOT YET DOCUMENTEDjava.lang.Exception
- Description of the Exceptionpublic void renderEditorPages() throws java.lang.Exception
java.lang.Exception
- Description of the Exceptionpublic org.dom4j.Document getEditableDocument(java.io.File file) throws org.dom4j.DocumentException
file
- file containing xml Recordorg.dom4j.DocumentException
- Description of the Exceptionpublic org.dom4j.Document getEditableDocument(java.lang.String filePath) throws org.dom4j.DocumentException
filePath
- path to file containing xml record.org.dom4j.DocumentException
- Description of the Exceptionpublic java.lang.String getWritableRecordXml(org.dom4j.Document doc) throws org.dom4j.DocumentException
doc
- NOT YET DOCUMENTEDorg.dom4j.DocumentException
- NOT YET DOCUMENTEDpublic org.dom4j.Document getWritableRecord(org.dom4j.Document doc) throws org.dom4j.DocumentException
The xml record returned is delocalized (namespace info added) and the ampersands are contracted.
doc
- an editable Documentorg.dom4j.DocumentException
- Description of the Exceptionpublic void processOrderedElements(org.dom4j.Document doc)
doc
- instanceDocument containing elements to be orderedpublic void writeEditableDocument(org.dom4j.Document doc, java.io.File file) throws org.dom4j.DocumentException
getWritableRecordXml
and writes it to
disk.doc
- an editable Documentfile
- destination file for write operation.org.dom4j.DocumentException
- Description of the Exceptionpublic static void setDebug(boolean bool)
bool
- The new debug valuepublic java.lang.String toString()
toString
in class java.lang.Object
public DocMap preprocessEditableDocument(DocMap docMap)
docMap
- NOT YET DOCUMENTEDpublic org.dom4j.Document preprocessEditableDocument(org.dom4j.Document doc)
doc
- NOT YET DOCUMENTEDpublic void destroy()