Esempio n. 1
0
import sys, signal, copy, os
import logging

from ossie.cf import CF, CF__POA #@UnusedImport
from ossie.service import start_service
from omniORB import CORBA, URI, PortableServer

from ossie.cf import CF
from ossie.cf import CF__POA
import bulkio

class svc_a(CF__POA.PortSupplier):

    def __init__(self, name="svc_a", execparams={}):
        self.name = name
        self._log = logging.getLogger(self.name)
        self.port_dataFloat = bulkio.OutFloatPort("dataFloat")

    def terminateService(self):
        pass

    def getPort(self, name):
        if name == 'dataFloat':
            return self.port_dataFloat._this()
        raise CF.PortSupplier.UnknownPort()


if __name__ == '__main__':
    start_service(svc_a, thread_policy=PortableServer.SINGLE_THREAD_MODEL)
        pass

    def stop(self):
        # TODO
        pass

    def _get_log_level(self):
        # TODO
        pass

    def _set_log_level(self, data):
        # TODO
        pass

    def _get_identifier(self):
        # TODO
        pass

    def _get_started(self):
        # TODO
        pass

    def _get_softwareProfile(self):
        # TODO
        pass


if __name__ == '__main__':
    start_service(AllPropertyTypesService,
                  thread_policy=PortableServer.SINGLE_THREAD_MODEL)
import sys, signal, copy, os
import logging

from ossie.cf import CF, CF__POA #@UnusedImport
from ossie.service import start_service
from omniORB import CORBA, URI, PortableServer

from ossie.cf import CF
from ossie.cf import CF__POA

class ServiceNoPorts(CF__POA.LifeCycle):

    def __init__(self, name="ServiceNoPorts", execparams={}):
        self.name = name
        self._log = logging.getLogger(self.name)

    def terminateService(self):
        pass

    def initialize(self):
        # TODO
        pass

    def releaseObject(self):
        # TODO
        pass


if __name__ == '__main__':
    start_service(ServiceNoPorts, thread_policy=PortableServer.SINGLE_THREAD_MODEL)
Esempio n. 4
0
    def listAllocations(self, allocScope, how_many):
        alloclist = []
        #allociter = iterators.get_list_iterator(self.allocation_list, allociterator, 0.2)
        allociter = allociterator.get_list_iterator(self.allocation_list, 0.2)
        if allociter == None:
            return [], None
        alloclist = allociter.next_n(how_many)[1]
        return alloclist, allociter

    def _get_allDevices(self):
        # TODO
        pass

    def _get_authorizedDevices(self):
        # TODO
        pass

    def _get_localDevices(self):
        # TODO
        pass

    def _get_domainMgr(self):
        # TODO
        pass


if __name__ == '__main__':
    start_service(allocmgr_svc,
                  thread_policy=PortableServer.SINGLE_THREAD_MODEL)
# Source: SlowLaunchService.spd.xml

import sys, signal, copy, os
import logging

from ossie.cf import CF, CF__POA #@UnusedImport
from ossie.service import start_service
from omniORB import CORBA, URI, PortableServer

from ossie.cf import CF
from ossie.cf import CF__POA
import time

class SlowLaunchService(CF__POA.PortSupplier):

    def __init__(self, name="SlowLaunchService", execparams={}):
        self.name = name
        self._log = logging.getLogger(self.name)

    def terminateService(self):
        pass

    def getPort(self, name):
        # TODO
        pass


if __name__ == '__main__':
    time.sleep(15)
    start_service(SlowLaunchService, thread_policy=PortableServer.SINGLE_THREAD_MODEL)
# Source: py_svc_exec_params.spd.xml

import sys, signal, copy, os
import logging

from ossie.cf import CF, CF__POA #@UnusedImport
from ossie.service import start_service
from omniORB import CORBA, URI, PortableServer
from ossie import properties
from ossie.properties import simple_property


from ossie.cf import CF
from ossie.cf import CF__POA

class py_svc_exec_params(CF__POA.TestableObject):

    def __init__(self, name="py_svc_exec_params", execparams={}):
        self.name = name
        self._log = logging.getLogger(self.name)

    def terminateService(self):
        pass

    def runTest(self, testid, testValues):
	pass


if __name__ == '__main__':
    start_service(py_svc_exec_params, thread_policy=PortableServer.SINGLE_THREAD_MODEL)
    def configure(self, configProperties):
        for prop in configProperties:
            self.execparam[prop.id] = any.from_any(prop.value)

    def query(self, configProperties):
        # If the list is empty, get all props
        if configProperties == []:
            return [
                CF.DataType(id=i, value=any.to_any(v))
                for i, v in self.params.items()
            ]
        else:
            result = []
            for p in configProperties:
                result.append(
                    CF.DataType(id=p.id, value=any.to_any(self.params[p.id])))
            return result


if __name__ == "__main__":
    # THESE ARE FOR UNITTESTING, REGULAR SERVICES SHOULD NOT USE THEM
    if not "SERVICE_NAME" in sys.argv:
        raise StandardError, "Missing SERVICE_NAME"
    if not "DEVICE_MGR_IOR" in sys.argv:
        raise StandardError, "Missing DEVICE_MGR_IOR"

    # THIS IS THE ONLY CODE THAT A REGULAR SERVICE SHOULD HAVE IN IT'S MAIN
    from omniORB import PortableServer
    start_service(BasicService,
                  thread_policy=PortableServer.SINGLE_THREAD_MODEL)
        self.params = params
        # Convert to the types specified in
        self.params['PARAM2'] = int(self.params['PARAM2'])
        self.params['PARAM3'] = float(self.params['PARAM3'])
        self.params['PARAM4'] = (self.params['PARAM4'].lower() == "true")

    def configure(self, configProperties):
        for prop in configProperties:
            self.execparam[prop.id] = any.from_any(prop.value)

    def query(self, configProperties):
        # If the list is empty, get all props
        if configProperties == []:
            return [CF.DataType(id=i, value=any.to_any(v)) for i,v in self.params.items()]
        else:
            result = []
            for p in configProperties:
                result.append(CF.DataType(id=p.id, value=any.to_any(self.parms[p.id])))
            return result

if __name__ == "__main__":
    # THESE ARE FOR UNITTESTING, REGULAR SERVICES SHOULD NOT USE THEM
    if not "SERVICE_NAME" in sys.argv:
        raise StandardError, "Missing SERVICE_NAME"
    if not "DEVICE_MGR_IOR" in sys.argv:
        raise StandardError, "Missing DEVICE_MGR_IOR"

    # THIS IS THE ONLY CODE THAT A REGULAR SERVICE SHOULD HAVE IN IT'S MAIN
    from omniORB import PortableServer
    start_service(BasicService, thread_policy=PortableServer.SINGLE_THREAD_MODEL)