Class XtceDb

java.lang.Object
org.yamcs.xtce.XtceDb
All Implemented Interfaces:
Serializable

public class XtceDb extends Object implements Serializable
XtceDB database It contains a SpaceSystem as defined in the Xtce schema and has lots of hashes to help find things quickly
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getSequenceContainer

      public SequenceContainer getSequenceContainer(String qualifiedName)
    • getSequenceContainer

      public SequenceContainer getSequenceContainer(String namespace, String name)
    • getSequenceContainer

      public SequenceContainer getSequenceContainer(Yamcs.NamedObjectId id)
    • getParameter

      public Parameter getParameter(String qualifiedName)
    • toNamedObjectId

      public static Yamcs.NamedObjectId toNamedObjectId(String qualifiedName)
    • getParameter

      public Parameter getParameter(String namespace, String name)
    • getParameter

      public Parameter getParameter(Yamcs.NamedObjectId id)
    • getParameterType

      public ParameterType getParameterType(String qualifiedName)
    • getParameterType

      public ParameterType getParameterType(String namespace, String name)
    • getParameterType

      public ParameterType getParameterType(Yamcs.NamedObjectId id)
    • getRootSequenceContainer

      public SequenceContainer getRootSequenceContainer()
    • setRootSequenceContainer

      public void setRootSequenceContainer(SequenceContainer sc)
    • getAlgorithm

      public Algorithm getAlgorithm(String qualifiedName)
    • getAlgorithm

      public Algorithm getAlgorithm(String namespace, String name)
    • getAlgorithm

      public Algorithm getAlgorithm(Yamcs.NamedObjectId id)
    • getAlgorithms

      public Collection<Algorithm> getAlgorithms()
    • getParameters

      public Collection<Parameter> getParameters()
    • getParameterTypes

      public Collection<ParameterType> getParameterTypes()
    • containsNamespace

      public boolean containsNamespace(String namespace)
    • getNamespaces

      public Set<String> getNamespaces()
    • getMetaCommand

      public MetaCommand getMetaCommand(String qualifiedName)
      Returns a meta command by fully qualified name.
      Parameters:
      qualifiedName - - fully qualified name of the command to be returned.
      Returns:
      the meta command having the given qualified name. If no such command exists, null is returned.
    • getMetaCommand

      public MetaCommand getMetaCommand(String namespace, String name)
      Returns a command based on a name in a namespace
      Parameters:
      namespace -
      name -
      Returns:
      the meta command having the given name in the given namespace. If no such meta command exists, null is returned.
    • getMetaCommand

      public MetaCommand getMetaCommand(Yamcs.NamedObjectId id)
    • getMetaCommands

      public Collection<MetaCommand> getMetaCommands()
      Returns the list of MetaCommmands in the XTCE database
      Returns:
    • getRootSpaceSystem

      public SpaceSystem getRootSpaceSystem()
    • getSpaceSystem

      public SpaceSystem getSpaceSystem(String qualifiedName)
    • getSpaceSystem

      public SpaceSystem getSpaceSystem(String namespace, String name)
    • getSpaceSystem

      public SpaceSystem getSpaceSystem(Yamcs.NamedObjectId id)
    • getSequenceContainers

      public Collection<SequenceContainer> getSequenceContainers()
    • getParameterEntries

      public List<ParameterEntry> getParameterEntries(Parameter p)
      Returns:
      list of ParameterEntry corresponding to a given parameter or null if no such entry exists.
    • getContainerEntries

      public List<ContainerEntry> getContainerEntries(SequenceContainer sc)
      Returns:
      list of ContainerEntry corresponding to a given sequence container or null if no such entry exists.
    • getParameterNames

      public Collection<String> getParameterNames()
    • getNonStandardDataOfType

      public <T extends NonStandardData<T>> T getNonStandardDataOfType(Class<T> clazz)
    • getNonStandardData

      public Collection<NonStandardData> getNonStandardData()
    • buildIndexMaps

      public void buildIndexMaps()
      Called after the database has been populated to build the maps for quickly finding things
    • getInheritingContainers

      public List<SequenceContainer> getInheritingContainers(SequenceContainer container)
      Get the list of containers inheriting from the given container
      Parameters:
      container -
      Returns:
    • addParameter

      public void addParameter(Parameter p, boolean createSpaceSystem)
      Adds a new parameter to the XTCE db. If the SpaceSystem where this parameter belongs does not exist, and createSpaceSystem is false, throws an IllegalArgumentException If the SpaceSystem where this parameter belongs exists and already contains an parameter by this name, throws and IllegalArgumentException If the SpaceSystem where this parameter belongs does not exist, and createSpaceSystem is true, the whole SpaceSystem hierarchy is created. Note that this method is used to create parameters on the fly. The parameters are not saved anywhere and they will not be available when this object is created by the XtceDbFactory.
      Parameters:
      p -
      createSpaceSystem - - if true, create all the necessary space systems
    • addParameterType

      public void addParameterType(ParameterType ptype, boolean createSpaceSystem)
      Adds a new parameter type to the XTCE db.

      If the SpaceSystem where this parameter type does not exist, and createSpaceSystem is false, throws an IllegalArgumentException.

      If the SpaceSystem where this parameter belongs exists and already contains an parameter type by this name, throws and IllegalArgumentException

      If the SpaceSystem where this parameter belongs does not exist, and createSpaceSystem is true, the whole SpaceSystem hierarchy is created.

      Parameters:
      ptype - - the parameter type to be added
      createSpaceSystem - - if true, create all the necessary space systems
    • createSystemParameter

      public SystemParameter createSystemParameter(String parameterQualifiedNamed, ParameterType ptype, String shortDescription)
      Creates and returns a system parameter with the given qualified name. If the parameter already exists it is returned.
      Parameters:
      parameterQualifiedNamed - - the name of the parmaeter to be created. It must start with YAMCS_SPACESYSTEM_NAME
      ptype -
      Returns:
      the parameter created or already existing.
      Throws:
      IllegalArgumentException - if the parameterQualifiedNamed does not start with YAMCS_SPACESYSTEM_NAME
    • addSystemParameterType

      public ParameterType addSystemParameterType(ParameterType ptype)
      Adds a parameter type to the MDB. The type has to have the qualified name set and start with YAMCS_SPACESYSTEM_NAME.

      If a type with the same name already exists, it is returned instead. No check is performed that the existing type and the new type are the same or even compatible.

      Parameters:
      ptype -
      Returns:
    • addMetaCommand

      public void addMetaCommand(MetaCommand c)
      Adds a new command definition to the XTCE db.

      Note that this method is used to create commands on the fly.
      The commands are not saved anywhere and they will not be available when this object is created with the XtceDbFactory.

    • addSpaceSystem

      public void addSpaceSystem(SpaceSystem system)
      Adds a new SpaceSystem to the XTCE database. It throws an IllegalArgumentException in the following circumstances: This method also sets the parent of the passed spacesystem to its parent object. Note that this method is used to create SpaceSystems on the fly. The SpaceSystems are not saved anywhere and they will not be available when this object is created by the XtceDbFactory.
      Parameters:
      system - - the space system to be added.
    • isSystemParameter

      public static boolean isSystemParameter(Yamcs.NamedObjectId id)
      Checks if the named object refers to a system parameter:
      Parameters:
      id -
      Returns:
    • isSystemParameter

      public static boolean isSystemParameter(String fqn)
      Checks if a fully qualified name is the name of a system parameter. That is if fqn starts with YAMCS_SPACESYSTEM_NAME
      Parameters:
      fqn -
      Returns:
    • getSpaceSystems

      public Collection<SpaceSystem> getSpaceSystems()
      Returns a collection of all the SpaceSystem objects in the XTCE database.
      Returns:
      the collection of space systems.
    • getIndirectParameterRefEntries

      public Collection<IndirectParameterRefEntry> getIndirectParameterRefEntries(String namespace)
      Retrieve the list of IndirectParameterRefEntry for a given alias namespace.
      Parameters:
      namespace - - the namespace for which the indirect parameter reference entries should be retrieved. Can be null to return the entries without a namespace.
      Returns:
      the list of indirect parameter reference entries whose alias namespace is equal to the given namespace. If no such entry exists, null is returned.
    • print

      public void print(PrintStream out)