[Bio] / CatalogServices / CatalogEntryBase.py Repository:
ViewVC logotype

View of /CatalogServices/CatalogEntryBase.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (download) (as text) (annotate)
Fri Jul 9 15:32:55 2004 UTC (15 years, 11 months ago) by sheradon
Branch: MAIN
CVS Tags: V00-00-01, sc2004-4, sc2004-3, sc2004-2, sc2004-1, sc2004-0, forRick-14Jul04-1, forRick-14Jul04-0, before-dynamics-persistence, lwc, post-st-migration2, mass-spec-01, mass-spec-03, mass-spec-02, treatman-lastDay-0, preTreatmanDyn, post-st-migration, sc04-finalDay, HEAD
Changes since 1.2: +7 -3 lines

put try block around adding toplevel catalog from a datafractory to
entries list.  motivated by case where, in modeleditor, a bssFactory
is added that can not reach its datafactory, e.g., running on machine
w/o database locally....just want to add proxy....so why die at startup?

#-----------------------------------------------------------------------------
# Name:        CatalogEntryBase.py
# Purpose:     See doc string below
#
# History:
#              02Feb04 efrank      First version
#
# Bugs:
#
# RCS-ID:      $Id: CatalogEntryBase.py,v 1.3 2004/07/09 15:32:55 sheradon Exp $
# Copyright:   (c) 2004
# Licence:     See COPYING.TXT
#-----------------------------------------------------------------------------
"""
"""
__revision__ = "$Id: CatalogEntryBase.py,v 1.3 2004/07/09 15:32:55 sheradon Exp $"
__docformat__ = "restructuredtext en"


# there is a python import loop that forces us to do the following:
#import CatalogServices.Catalog
from CatalogServices.Catalog import Catalog


#------------------------------------------------------------------
class CatalogEntryBase:
#------------------------------------------------------------------
    """
    CatalogEntryBase has the minimum set of functions needed from
    Catalog.py to do its thing.  You should not inherit from this
    to make support new datafactories.  Most of the interface is
    defined in the derivative, CatalogEntry.  Inherit from that.
    We factored these two because of a dependency loop that was
    upsetting imports.    
    """

    #------------------------------------------------------------------
    def __init__(self, path, name, isTerminal):
    #------------------------------------------------------------------
        """
            @type path          :   string.  full path, including node name
            @type name          :   string
            @type isTerminal    :    0 (is not terminal) or 1 (is terminal)

            this is dumb..should pull name off the end of path!
        """

        self.__path          = path
        self.__name          = name
        self.__isTerminal    = isTerminal

        if ( isTerminal != 0 and isTerminal != 1):
            raise Exception, "CatalogEntry: isTerminal must be 0 or 1"

        return

    #------------------------------------------------------------------
    def name(self):
    #------------------------------------------------------------------
        """ @rtype: string """

        return self.__name

    #------------------------------------------------------------------
    def path(self):
    #------------------------------------------------------------------
        """ @rtype: string """
        return self.__path

    #------------------------------------------------------------------
    def isTerminal(self):
    #------------------------------------------------------------------
        """
        
        is this terminal (a node. may have associated modeling data)
        or is it non-terminal (a directory.  used to organize the catalog).

        @rtype : 1 or 0
        """
        
        return self.__isTerminal

    #------------------------------------------------------------------
    def entries(self):
    #------------------------------------------------------------------
        """ 
        See comment in CatalogEntry.entries().
        @rtype: List of DataFactories 
        """

        result = []
        #for f in CatalogServices.Catalog.Catalog.instance().getFactories():
        for f in Catalog.instance().getFactories():
            try:
                top= f.getCatalogTop()
                result.append( top )
            except:
                continue

        return result


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3