#!/usr/bin/python from component.core import Repository, Factory repository = Repository() factory = Factory(repository) inotify = factory.create_Interface() inotify.name = 'INotify' notifier = factory.create_Component() notifier.name = 'Notifier' notifier.uses.append(inotify) observer = factory.create_Component() observer.name = 'Observer' observer.provides.append(inotify) op1 = factory.create_Operation() op1.name = 'Op1' op1.return_type = 'string' inotify.operations.append(op1) arg1 = factory.create_Argument() arg1.name = 'count' arg1.type = 'int' arg2 = factory.create_Argument() arg2.name = 'name' arg2.type = 'string' op1.arguments.append(arg1) op1.arguments.append(arg2) from component.dumper import Dumper Dumper().dump(repository, 'cobserver.xmi') for c in repository.Component: print 'Component', c.name for p in c.provides: print '\tprovides', p.name for p in c.uses: print '\tuses', p.name for i in repository.Interface: print 'Interface', i.name for o in i.operations: print '\tOperation', o.name