========================================= Integrating objects from external systems ========================================= Integration of external sources. ($Id$) Accessing Objects on a Remote BSCW Repository ============================================= In fact we do not access a remote repository but just a dummy (fake) repository for testing purposes. >>> from cybertools.integrator.tests.bscw import BSCWServer, sampleObjects >>> from cybertools.integrator.bscw import standardAttributes >>> server = BSCWServer(sampleObjects) >>> server.get_attributes('4', standardAttributes + ['containers'], 1, True) [{...'name': 'public'...}, [{...'name': 'Introduction'...}]] Access via read container and item/file proxies ----------------------------------------------- Let's first register the proxy factory utilities. >>> from zope import component >>> from cybertools.integrator.bscw import ContainerFactory, ItemFactory, FileFactory >>> component.provideUtility(ContainerFactory(), name='bscw') >>> component.provideUtility(ItemFactory(), name='bscw') >>> component.provideUtility(FileFactory(), name='bscw') We can now access the root object of the BSCW repository >>> from cybertools.integrator.interfaces import IContainerFactory >>> root = component.getUtility(IContainerFactory, name='bscw')('4', server=server, ... baseUrl='http://localhost/bscw.cgi/') >>> sorted(root.items()) [('bs_5', <...ReadContainer object...>)] >>> root.address '4' >>> root.internalPath '' >>> root.icon 'folder' >>> root.properties {...'name': 'public'...} >>> root.title 'public' >>> root.description 'Public Repository' >>> str(root.externalUrlInfo) 'http://localhost/bscw.cgi/4' Let's also have a look at the item contained in the root object. >>> bs_5 = root['bs_5'] >>> data = server.get_attributes('bs_5', ... ['__class__', 'type', 'id', 'name', 'descr', 'url_link'], 1, True) >>> bs_5.items() [] >>> bs_5.address 'bs_5' >>> bs_5.internalPath 'bs_5' >>> bs_5.icon 'folder' >>> bs_5.properties {...'name': 'Introduction'...} >>> str(bs_5.externalUrlInfo) 'http://localhost/bscw.cgi/5'