Package jmri

Interface CatalogTreeManager

  • All Superinterfaces:
    Manager<CatalogTree>, PropertyChangeProvider, SilenceablePropertyChangeProvider, VetoableChangeProvider
    All Known Implementing Classes:
    DefaultCatalogTreeManager

    public interface CatalogTreeManager
    extends Manager<CatalogTree>
    Locate a CatalogTree object representing some specific information.

    CatalogTree objects are obtained from a CatalogTreeManager, which in turn is generally located from the InstanceManager.

    Much of the book-keeping is implemented in the AbstractCatalogTreeManager class, which can form the basis for a system-specific implementation.


    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • getCatalogTree

        @CheckForNull
        CatalogTree getCatalogTree​(@Nonnull
                                   java.lang.String name)
        Locate via user name, then system name if needed. If that fails, return null
        Parameters:
        name - CatalogTree object to locate
        Returns:
        null if no match found
      • newCatalogTree

        @Nonnull
        CatalogTree newCatalogTree​(@Nonnull
                                   java.lang.String systemName,
                                   java.lang.String userName)
                            throws java.lang.IllegalArgumentException
        Get a CatalogTree instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one CatalogTree object representing a given physical CatalogTree and therefore only one with a specific system or user name.

        This will always return a valid object reference; a new object will be created if necessary. In that case:

        • If a null reference is given for user name, no user name will be associated with the CatalogTree object created; a valid system name must be provided
        • If both names are provided, the system name defines the hardware access of the desired CatalogTree, and the user address is associated with it. The system name must be valid.
        Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating CatalogTree objects when you should be looking them up.
        Parameters:
        systemName - system name for new CatalogTree
        userName - user name for new CatalogTree
        Returns:
        requested CatalogTree object (never null)
        Throws:
        java.lang.IllegalArgumentException - if unable to create.