예제 #1
0
    def importDomain(self, domainname, specpath):
        init(specpath, OsisConnection, PyModelOsisClient)

        domain = Domain()
        from osis import ROOTOBJECT_TYPES as types
        for type in types.itervalues():
            name = getattr(type, 'OSIS_TYPE_NAME', type.__name__.lower())
            setattr(domain, name, getattr(OsisConnection(None, None), name))
        setattr(self, domainname, domain)
예제 #2
0
 def __initialize(self):
     init(q.system.fs.joinPaths(q.dirs.baseDir, 'libexec','osis'))
     
     try:
         self.__connection = OsisConnection(XMLRPCTransport('http://localhost:8888', 'osis_service'), ThriftSerializer)
     except:
         q.logger.log("[DRPClient] Failed to initialize the OSIS application server service connection: the DRPClient won't work...", 1)
         return
     
     from osis import ROOTOBJECT_TYPES as types
     for type in types.itervalues():
         name = getattr(type, 'OSIS_TYPE_NAME', type.__name__.lower())
         setattr(self, name, getattr(self.__connection, name))
예제 #3
0
 def retreive(self):
     '''This function is used to retreive data from the database. First a transport is obtained to establish a client connection, and then data is \
     obtained from the database'''
     print '\n\033[1;34m Retreive the stored object from the Database.\n'
     try:
         transport = XMLRPCTransport('http://localhost:8888',
                                     'osis_service')
         client = OsisConnection(transport, ThriftSerializer)
         filter_ = client.company.getFilterObject()
         filter_.add('name', 'name', 'free')  # viewname, fieldname, value
         # Get a list of matching GUIDs
         client.company.find(filter_)
         # Returns a list containing the GUID of the 'Aserver' company
         # Get view information
     except Exception, e:
         print 'XML-RPC Port could be different\nCheck tasklet folder for save,get,saveview,getview tasklets'
예제 #4
0
    def test_serialize(self):
        transport = XMLRPCTransport('http://*****:*****@aserver.com')
        employee1.email_addresses.append('*****@*****.**')
        comp.employees.append(employee1)

        serialized = comp.serialize(self.serializer)

        deserialized = comp.__class__.deserialize(self.serializer, serialized)
        self.assertEqual(deserialized.employees[0].email_addresses[0],
                         '*****@*****.**')
예제 #5
0
    def __init__(self, address, service):
        init(q.system.fs.joinPaths(q.dirs.baseDir, 'libexec', 'osis'))

        try:
            #self.connection = OsisConnection(XMLRPCTransport(address, service), ThriftSerializer)
            transport = ConcurrenceOsisXMLRPCTransport(address, service)
            self.connection = OsisConnection(transport, ThriftSerializer)
        except:
            q.logger.log(
                "[DRPTask] Failed to initialize the OSIS application server service connection.",
                1)
            raise

        self.__tasklet = None

        self.__buffers = {}
        self.__buffer_tasklet = None
예제 #6
0
 def store(self):
     '''This function is used to store data in the database. First a transport is obtained to establish a client connection, and then data is fed\
     & saved in database'''
     print '\n\033[1;34mStores an object in the Database. \n\033[1;33m'
     try:
         transport = XMLRPCTransport('http://*****:*****@aserver.com')
         employee1.email_addresses.append('*****@*****.**')
         client.company.save(company)
     except Exception, e:
         print 'XML-RPC Port could be different\nCheck tasklet folder for save,get,saveview,getview tasklets'
예제 #7
0
    def retrieve(self):
        from osis import init
        init(self.params['model_path'])
        from osis.model.serializers import ThriftSerializer
        from osis.client.xmlrpc import XMLRPCTransport
        from osis.client import OsisConnection
        if self.params.has_key('login') and self.params['login']:
            transporturl = 'http://%s:%s@%s:%s/%s' % (
                self.params['login'], self.params['passwd'],
                self.params['server'], self.params['port'],
                self.params['path'])
        else:
            transporturl = 'http://%s:%s/%s' % (self.params['server'],
                                                self.params['port'],
                                                self.params['path'])
        transport = XMLRPCTransport(transporturl, self.params['service'])
        connection = OsisConnection(transport, ThriftSerializer)

        return connection
예제 #8
0
 def test_0030_instanciate_connection(self):
     '''Instanciate an OSIS connection'''
     self.test_0020_instanciate_transport()
     from osis.client import OsisConnection
     self.connection = OsisConnection(self.transport, self.serializer)