public class XMLDataManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
XMLDataManager.MissingUrlForGroup
Exception thrown when a URL has not been specified for the given group and an attempt is made to read or write the group.
|
Constructor and Description |
---|
XMLDataManager(java.lang.String urlPath)
Primary Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
absoluteUrlSpec(java.lang.String urlSpec)
Get absolute URL specifications given a URL spec relative to the main URL
|
static Accelerator |
acceleratorWithPath(java.lang.String filePath)
Read the accelerator from the data source at the file path.
|
static Accelerator |
acceleratorWithPath(java.lang.String filePath,
boolean isValidating)
Read the accelerator from the data source at the file path and using DTD validation if
if the user specifies.
|
static Accelerator |
acceleratorWithUrlSpec(java.lang.String urlPath)
Read the accelerator from the data source at the URL path.
|
static java.lang.String |
defaultPath()
Get the path to the default main data source specified in the user's preferences.
|
Accelerator |
getAccelerator()
Parse the accelerator from the optics URL without DTD validation and
also populate the dynamic data.
|
Accelerator |
getAccelerator(boolean isValidating)
Parse the accelerator from the optics URL with the specified DTD
validation flag and also populate the dynamic data.
|
static XMLDataManager |
getDefaultInstance()
Get the default XMLDataManager based on the user's preferred path to the Main data source
|
java.lang.String |
getHardwareStatusURLSpec()
Get the URL spec for the hardware status
|
static XMLDataManager |
getInstance(java.net.URL url)
factory method given a URL to the main optics source
|
java.util.Collection<java.lang.String> |
getTableGroups()
Get the table groups (names) read from the edit context of the accelerator data source.
|
TimingCenter |
getTimingCenter()
Read the timing center from the timing URL.
|
static Accelerator |
loadDefaultAccelerator()
Load the accelerator corresponding to the default accelerator data source specified in the user's preferences.
|
java.net.URL |
mainUrl()
Get the URL to the accelerator data source which includes pointers to the optics
and other supporting data such as the edit context and optics corrections.
|
java.lang.String |
mainUrlSpec()
Get the URL spec to the accelerator data source which includes pointers to the optics
and other supporting data such as the edit context and optics corrections.
|
static XMLDataManager |
managerWithFilePath(java.lang.String filePath)
Create and return a new XMLDataManager with its source given by the specified file path.
|
java.lang.String |
opticsDtdUrlSpec()
Get the URL spec of the DTD file used in the optics XML file.
|
java.lang.String |
opticsUrlSpec()
Get the URL spec to the accelerator optics.
|
void |
readTableGroup(EditContext editContext,
java.lang.String group)
Reads the tables of the table group into the editContext getting its
data from the URL associated with the group.
|
static void |
readTableGroupFromUrl(EditContext editContext,
java.lang.String group,
java.lang.String urlSpec)
Reads the tables of the table group into the editContext getting its
data from the specified URL.
|
static void |
setDefaultPath(java.lang.String path)
Set the path to the default main data source and store it in the user's preferences.
|
void |
setMainPath(java.lang.String filePath)
Set the file path to use as the accelerator data source which includes pointers to the
optics and other supporting data such as the edit context and optics corrections.
|
void |
setMainUrlSpec(java.lang.String urlSpec)
Set the URL spec to use as the accelerator data source which includes pointers to the
optics and other supporting data such as the edit context and optics corrections.
|
void |
setOpticsDtdUrlSpec(java.lang.String urlSpec)
Set the URL spec of the DTD file to use in the optics XML file.
|
void |
setOpticsUrlSpec(java.lang.String urlSpec)
Set the URL spec to the accelerator optics.
|
void |
setUrlSpecForTableGroup(java.lang.String urlSpec,
java.lang.String tableGroup)
Set the URL spec of the data source for the specified table group.
|
void |
updateOptics(Accelerator accelerator,
boolean isValidating)
update the accelerator with data from the optics URL with a
DTD validation flag
|
java.lang.String |
urlSpecForTableGroup(java.lang.String tableGroup)
Get the URL spec of the data source of the specified table group.
|
void |
writeAccelerator(Accelerator accelerator)
Write the entire accelerator including the optics to the optics file, edit context to the appropriate
files for the table groups and the main file which references these sources.
|
void |
writeEditContext(EditContext editContext) |
void |
writeMain()
Write the main file which lists the pointers to the optics, edit context and extra optics files.
|
void |
writeOptics(Accelerator accelerator)
Write the optics part of the accelerator to an optics file using the location set in this data manager.
|
void |
writeTableGroup(EditContext editContext,
java.lang.String groupName) |
static void |
writeTableGroupToUrl(EditContext editContext,
java.lang.String tableGroup,
java.lang.String urlSpec) |
public XMLDataManager(java.lang.String urlPath)
public static XMLDataManager getInstance(java.net.URL url)
public static XMLDataManager managerWithFilePath(java.lang.String filePath) throws URLUtil.FilePathException
filePath
- The file path of the accelerator data source.URLUtil.FilePathException
public static XMLDataManager getDefaultInstance()
public TimingCenter getTimingCenter() throws XmlDataAdaptor.ParseException
XmlDataAdaptor.ParseException
- if the TimingCenter cannot be generatedpublic static Accelerator acceleratorWithUrlSpec(java.lang.String urlPath)
urlPath
- The URL spec of the data source.public static Accelerator acceleratorWithPath(java.lang.String filePath) throws URLUtil.FilePathException
filePath
- The file path of the data source.URLUtil.FilePathException
public static Accelerator acceleratorWithPath(java.lang.String filePath, boolean isValidating) throws URLUtil.FilePathException
filePath
- The file path of the data source.isValidating
- enable DTD validation if true and disable DTD validation if falseURLUtil.FilePathException
public static Accelerator loadDefaultAccelerator()
public static java.lang.String defaultPath()
public static void setDefaultPath(java.lang.String path)
path
- the new file path to the default accelerator data sourcepublic java.net.URL mainUrl()
public java.lang.String mainUrlSpec()
public void setMainUrlSpec(java.lang.String urlSpec)
urlSpec
- The new URL spec to the accelerator data source.public void setMainPath(java.lang.String filePath) throws URLUtil.FilePathException
filePath
- The new file path to the accelerator data source.URLUtil.FilePathException
public java.lang.String absoluteUrlSpec(java.lang.String urlSpec)
public java.lang.String opticsUrlSpec()
public void setOpticsUrlSpec(java.lang.String urlSpec)
urlSpec
- The new URL spec to the accelerator optics.public java.lang.String opticsDtdUrlSpec()
public void setOpticsDtdUrlSpec(java.lang.String urlSpec)
urlSpec
- the URL spec of the DTD file to use in the optics XML file.public java.lang.String getHardwareStatusURLSpec()
public java.util.Collection<java.lang.String> getTableGroups()
EditContext
public java.lang.String urlSpecForTableGroup(java.lang.String tableGroup)
tableGroup
- The table group namepublic void setUrlSpecForTableGroup(java.lang.String urlSpec, java.lang.String tableGroup)
urlSpec
- The URL spec of the file where the table group resides.tableGroup
- The table group namepublic Accelerator getAccelerator() throws XmlDataAdaptor.ParseException
XmlDataAdaptor.ParseException
public Accelerator getAccelerator(boolean isValidating) throws XmlDataAdaptor.ParseException
isValidating
- use DTD validation if true and don't validate if it is valseXmlDataAdaptor.ParseException
public void updateOptics(Accelerator accelerator, boolean isValidating) throws XmlDataAdaptor.ParseException
accelerator
- The accelerato to update with data from the sourcesisValidating
- use DTD validation if true and don't validate if falseXmlDataAdaptor.ParseException
public void readTableGroup(EditContext editContext, java.lang.String group)
editContext
- The edit context into which to place the tables which are readgroup
- The table group to read from its associated URlpublic static void readTableGroupFromUrl(EditContext editContext, java.lang.String group, java.lang.String urlSpec)
editContext
- The edit context into which to place the tables which are readgroup
- The table group to read from the specified URLurlSpec
- The URL spec of the table group sourcepublic void writeMain()
public void writeAccelerator(Accelerator accelerator)
accelerator
- The accelerator which holds the optics and the edit context.public void writeOptics(Accelerator accelerator)
accelerator
- The accelerator to store in the optics file.public void writeEditContext(EditContext editContext)
public static void writeTableGroupToUrl(EditContext editContext, java.lang.String tableGroup, java.lang.String urlSpec)
public void writeTableGroup(EditContext editContext, java.lang.String groupName)