|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.resource.Resource
public class Resource
A container of scientific and hardware specifications for an observation of of an astronomical source.
Version Info:
$Revision: 2234 $ |
$Date: 2009-04-23 14:16:36 -0600 (Thu, 23 Apr 2009) $ |
$Author: dharland $ (last person to modify) |
Field Summary |
---|
Fields inherited from interface edu.nrao.sss.util.Identifiable |
---|
UNIDENTIFIED |
Constructor Summary | |
---|---|
Resource()
Creates a new instance. |
|
Resource(String name)
Creates a new instance with the given name. |
Method Summary | |
---|---|
void |
clearId()
Resets the identifier of this resource to a value that represents the unidentified state. |
Resource |
clone()
Returns a resource that is a copy of this one. |
boolean |
equals(Object o)
Returns true if o is equal to this resource. |
static Resource |
fromXml(Reader reader)
Creates a new resource based on the XML data read from reader . |
static Resource |
fromXml(String xmlFile)
Creates a new resource from the XML data in the given file. |
AntennaElectronics |
getAntennaElectronics()
Returns antenna electronics that are configured to match this resource. |
TelescopeBackend |
getBackend(CorrelatorName backendType)
Returns the backend of the given type held by this resource. |
List<TelescopeBackend> |
getBackends()
Returns a list of the backends currently held by this resource. |
Long |
getCreatedBy()
|
Date |
getCreatedOn()
|
Long |
getId()
|
Long |
getLastUpdatedBy()
|
Date |
getLastUpdatedOn()
|
String |
getName()
Returns the name of this resource. |
List<String> |
getNotes()
Returns a list of notes about this resource. |
ResourceSpecification |
getScienceSpecification()
Returns the scientific specification for this resource. |
TelescopeType |
getTelescope()
Returns the telescope whose setup is described by this specification. |
int |
hashCode()
Returns a hash code value for this resource. |
boolean |
hasScienceSpecification()
Returns true if this resource has a non-empty scientific specification. |
TelescopeBackend |
removeBackend(CorrelatorName backendType)
Removes from this resource the backend of the given type. |
List<TelescopeBackend> |
removeBackends()
Removes all backends from this resource. |
void |
reset()
Resets this resource to its initial state. |
void |
setCreatedBy(Long userId)
|
void |
setCreatedOn(Date d)
|
void |
setLastUpdatedBy(Long userId)
|
void |
setLastUpdatedOn(Date d)
|
void |
setName(String newName)
Sets the name of this resource. |
void |
setScienceSpecification(ResourceSpecification newSpec)
Sets the scientific specification for this resource. |
void |
setTelescope(TelescopeType newTelescope)
Sets the telescope whose setup is described by this specification. |
String |
toXml()
Returns an XML representation of this resource. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this resource to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Resource()
public Resource(String name)
Method Detail |
---|
public void reset()
public Long getId()
getId
in interface Identifiable
public void clearId()
This method is useful for preparing a resource for storage in a database. The ID property (as of now, though this may change in the future) is used by our persistence mechanism to identify objects. If you are persisting this object for the first time, you may need to call this method before performing a save. This is especially true if you have created this object from XML, as the XML unmarshalling brings along the ID property.
public void setName(String newName)
If newName
is null or the empty string
(""), the request to change the name will be
denied and the current name will remain in place.
setName
in interface Nameable
newName
- the new name of this resource.public String getName()
getName
in interface Nameable
public void setCreatedBy(Long userId)
public void setCreatedOn(Date d)
public void setLastUpdatedBy(Long userId)
public void setLastUpdatedOn(Date d)
public Long getCreatedBy()
public Date getCreatedOn()
public Long getLastUpdatedBy()
public Date getLastUpdatedOn()
public void setScienceSpecification(ResourceSpecification newSpec)
newSpec
- the scientific specification for this resource. If this value is
null it will be replaced by a new empty specification.public ResourceSpecification getScienceSpecification()
public boolean hasScienceSpecification()
public void setTelescope(TelescopeType newTelescope)
SIDE EFFECTS: changing the telescope type also changes the
antenna electronics
held by this
resource, and may change the backend as well.
newTelescope
- the telescope whose setup is described by this
specification. If this value is null
a default telescope will be used instead.public TelescopeType getTelescope()
public AntennaElectronics getAntennaElectronics()
public TelescopeBackend getBackend(CorrelatorName backendType)
The returned backend is the one held directly by this resource, so changes made to it will be reflected herein.
backendType
- the type of backend desired.
IllegalArgumentException
- if backendType
is not a valid backend for this resource's
telescope.setTelescope(TelescopeType)
,
TelescopeType.getBackendTypes()
public List<TelescopeBackend> getBackends()
getBackend(CorrelatorName)
public TelescopeBackend removeBackend(CorrelatorName backendType)
backendType
- the type of backend to remove from this resource.
public List<TelescopeBackend> removeBackends()
public List<String> getNotes()
This method returns the list actually held by this Resource
, so
any list manipulations may be performed by first fetching the list and
then operating on it.
public String toXml() throws JAXBException
JAXBException
- if anything goes wrong during the conversion to XML.public void writeAsXmlTo(Writer writer) throws JAXBException
writer
.
writer
- the device to which XML is written.
JAXBException
- if anything goes wrong during the conversion to XML.public static Resource fromXml(String xmlFile) throws JAXBException, XMLStreamException, FileNotFoundException
xmlFile
- the name of an XML file. This method will attempt to locate
the file by using Class.getResource(String)
.
FileNotFoundException
- if the XML file cannot be found.
JAXBException
- if the schema file used (if any) is malformed, if
the XML file cannot be read, or if the XML file is not
schema-valid.
XMLStreamException
- if there is a problem opening the XML file,
if the XML is not well-formed, or for some other
"unexpected processing conditions".public static Resource fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the source of the XML data.
If this value is null, null is returned.
reader
.
XMLStreamException
- if the XML is not well-formed,
or for some other "unexpected processing conditions".
JAXBException
- if anything else goes wrong during the
transformation.public Resource clone()
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in interface CatalogItem<Resource>
clone
in class Object
public boolean equals(Object o)
o
is equal to this resource.
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |