[Bio] / BioSimScratch / buildNewBssCatalog.py Repository:
ViewVC logotype

View of /BioSimScratch/buildNewBssCatalog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Fri Nov 19 23:22:48 2004 UTC (14 years, 11 months ago) by efrank
Branch: MAIN
CVS Tags: post-st-migration2, post-st-migration, HEAD
Changes since 1.4: +1 -1 lines
migrate FoundryId to FoundryInfo.

rewrite base object model classes in KahOM and FoundryId to use SchemaTools
   for their data nuggets.

code runs package level test for these two packages successfully.

everything else is now broken.....

we'r ready for the migration.

#########################################################################
# This is a program that transforms the old style BSS catalog to
# the new style.  It exercises a few things in the catalog code, but
# is probably NOT a good example of how to code:  it drills into
# various things that ought to be encapsulated.  This is needed to effect
# the migration.
#########################################################################


from FaST.BssFactory import  BssFactory
from CatalogServices.Catalog import Catalog
from FoundryInfo.FoundryItemKey import FoundryItemKey

b=BssFactory("biosimscratch/bss@db02", "oracle")

oldEntryDict = {}
oldEntryList = b.getLsCat()
print "Old Style Catalog Entries:"
for o in oldEntryList:
    print o
    oldEntryDict[ o[0] ] = o[1]
print ""



bssTop=b.getCatalogTop()
print "Previously Existing New Style Entries:"
for be in bssTop.entries():
    print "\t", (be.name())
print

print "Adding new style entries"
for o in oldEntryList:
    try:
        newItem = bssTop.mkItem( o[0] )
        print "\tAdded new item with name ", newItem.name()
    except Exception, e:
        print "FAILed to add  new item with name ", o[0]
        print "Exception raised is", e

    

#
# tack on the actual reconstructions
#

bssTop=b.getCatalogTop()
print
print "New state of New Styple Catalog:"
for be in bssTop.entries():
    print "\t", (be.name())
    procId = oldEntryDict[ be.name() ]
    k = FoundryItemKey( b.getFoundryId(), [procId], [] )
    print "\thas versions: ", be.versions()
    try:
        be.setFoundryItem( k )
    except:
       print "Could not add foundry item for ", be.name()

    print "\thas versions: ", be.versions()


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3