Class XtceDb

java.lang.Object
org.yamcs.xtce.XtceDb
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Mdb

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)
      returns the parameter with the given qualified name or null if it does not exist
    • 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)
    • getArgumentType

      public ArgumentType getArgumentType(String qualifiedName)
      Returns an argument type with the given qualified name or null if it does not exist

      Note that not all argument types have qualified names, some are used only locally in the command definitions and are never registered at the global level

    • 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:
    • doAddParameter

      protected void doAddParameter(Parameter p, boolean addSpaceSystem, boolean addParameterType)
    • doAddParameters

      protected void doAddParameters(List<Parameter> newparams, boolean addSpaceSystems, boolean addParameterTypes)
      Adds a list of new parameters to the XTCE db. If createSpaceSystem is true, also create the Space Systems where these parameters belong.

      Throws a IllegalArgumentException if:

      - createSpaceSystem is false and the Space Systems do not exist.

      - the parameter with the given qualified name already exist

      Parameters:
      newparams - - the list of parameters to be added
      addParameterTypes - - if true, add also the parameter types (if not already in the database)
      addSpaceSystems - - if true, create all the necessary space systems
    • doAddParameterType

      protected void doAddParameterType(List<ParameterType> ptypeList, boolean createSpaceSystem)
      Adds new parameter types 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:
      ptypeList - - the parameter types to be added
      createSpaceSystem - - if true, create all the necessary space systems
    • doAddArgumentType

      protected void doAddArgumentType(List<ArgumentType> atypeList, boolean createSpaceSystem)
      Adds new argument types to the XTCE db.

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

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

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

      Parameters:
      atypeList - - the argument types to be added
      createSpaceSystem - - if true, create all the necessary space systems
    • addMetaCommand

      public void addMetaCommand(MetaCommand c)
    • addMetaCommand

      public void addMetaCommand(MetaCommand c, boolean addSpacesystem)
      Adds a new command definition to the XTCE db.
    • 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)