Exemplo n.º 1
0
    def __init__(self, id = None, name = '', ksdl = '', ksdlversion = '', ksdldate = None):
        """
        Initialises the member instance.
        
        Parameters are assigned to local variables. If no ID is provided (or None is given)
        one will ge generated.

        @param id: Inique ID for the Member
        @type id: C{String}
        @param name: Name for the Member
        @type name: C{String}
        @param ksdl: knowledge service description in XML 
        @type ksdl: C{String}
        @param ksdlversion: Version for the XML knowledge service description
        @type ksdlversion: C{String}
        @param ksdldate: Date for the version of the XML knowledge service description
        @type ksdldate: C{String}
        """
        self._id = id
        self._name = name
        self._ksdl = ksdl
        self._ksdlversion = ksdlversion
        self._ksdldate = ksdldate
        
        self._communities = []
        self._members = []
        self._authorities = []
        
        if self._id == None:
            self._id = tools.generateId(tools.TYPE_SERVICE)
Exemplo n.º 2
0
 def __init__(self, id = None, memberId = None, communityId = None, protocolId = None,
         address = None, credentialId = None, init = 0):
     """
     Initalises the Protocol and assigns the parameters to the local variables.
     
     @param id: Unique id for the protocol
     @type id: C{String}
     @param memberId: ID of the member providing this endpoint
     @type memberId: C{String}
     @param communityId: ID of the community the given member uses for this endpoint
     @type communityId: C{String}
     @param protocolId: ID of the protocol used for this endpoint (SOAP, HTTP, ...)
     @type protocolId: C{String}
     @param address: Protocol specific address of the endpoint. (Like URL for SOAP, IP for SSH, ...)
     @type address: C{String}
     @param credentialId: ID of the credential connected to the endpoint
     @type credentialId: C{String}
     @param init: Indidates, whether this instance is created during initialises process (of the container).
     @type init: C{Boolean}
     """
     self._id = id
     self._memberId = memberId
     self._communityId = communityId
     self._protocolId = protocolId
     self._address = address
     self._credentialId = credentialId
     
     if self._id == None:
         self._id = tools.generateId(tools.TYPE_ENDPOINT)
Exemplo n.º 3
0
    def __init__(self, id = None, name = None, mdl = None, mdlversion = None, mdldate = None):
        """
        Initialises the member instance.
        
        Parameters are assigned to local variables. If no ID is provided (or None is given)
        one will ge generated.

        @param id: Inique ID for the Member
        @type id: C{String}
        @param name: Name for the Member
        @type name: C{String}
        @param mdl: Member description in XML 
        @type mdl: C{String}
        @param mdlversion: Version for the XML member description
        @type mdlversion: C{String}
        @param mdldate: Date for the version of the XML member description
        @type mdldate: C{String}
        """
        self._id = id
        self._name = name
        self._mdl = mdl
        self._mdlversion = mdlversion
        self._mdldate = mdldate
        
        self._communities = []
        self._gateways = []
        self._authorizedComunities = []
        
        if self._id == None:
            self._id = tools.generateId(tools.TYPE_MEMBER)
Exemplo n.º 4
0
 def __init__(self, id = None, name = None, algorithmid = None, privateKey = None, publicKey = None, username = None, init = 0):
     """
     Initalises the Personal Credential and assigns the parameters to the local variables.
     
     @param id: Unique id for the personal credential
     @type id: C{String}
     @param name: Name for the personal credential
     @type name: C{String}
     @param username: User name to be used
     @type username: C{String}
     @param algorithmid: ID of the algorithm, this credential is valid for and was created for
     @type algorithmid: C{String}
     @param privateKey: String represenation of the Private Key
     @type privateKey: C{String}
     @param publicKey: String representation of the Public Key
     @type publicKey: C{String}
     @param init: Indidates, whether this instance is created during initialises process (of the container).
     @type init: C{Boolean}
     """
     self._id = id
     self._name = name
     self._username = username
     self._algorithmid = algorithmid
     self._privateKey = privateKey
     self._publicKey = publicKey
     
     if self._id == None:
         self._id = tools.generateId(tools.TYPE_PERSONALCREDENTIAL)
Exemplo n.º 5
0
 def __init__(self, id = None, algorithmid = None, username = None, key = None, ownerid = None, init = 0):
     """
     Initalises the Algorithm and assigns the parameters to the local variables.
     
     @param id: Unique id for the algorithm (if None is given, one will be generated using the key generator in tools)
     @type id: C{String}
     @param algorithmid: ID of the algorithm, this credential can be used with (and was created for)
     @type algorithmid: C{String}
     @param username: Username for this credential (optional)
     @type username: C{String}
     @param key: Public key
     @type key: C{String}
     @param ownerid: ID of the owner of this key (Member, Community, ...)
     @type ownerid: C{String}
     @param init: Indidates, whether this instance is created during initialises process (of the container).
     @type init: C{Boolean}
     """
     self._id = id
     self._algorithmid = algorithmid
     self._username = username
     self._key = key
     self._ownerid = ownerid
     
     if self._id == None:
         self._id = tools.generateId(tools.TYPE_CREDENTIAL)
Exemplo n.º 6
0
 def __init__(self, id, source_tc, destination_tc, gw_member_id, gw_community_id, costs):
     """
     Assigns the parameters to instance variables.
     
     If id is C{None}, one will be generated using the tools module.
     """
     if id == None:
         from tools import generateId, TYPE_ROUTINGTABLEENTRY
         id = generateId(TYPE_ROUTINGTABLEENTRY)
     self._id = id
     self._source_tc = source_tc
     self._destination_tc = destination_tc
     self._gw_member_id = gw_member_id
     self._gw_community_id = gw_community_id
     self._costs = int(costs)
Exemplo n.º 7
0
 def __init__(self, id = None, name = None, init = 0):
     """
     Initalises the Protocol and assigns the parameters to the local variables.
     
     @param id: Unique id for the protocol
     @type id: C{String}
     @param name: Name for the protocol
     @type name: C{String}
     @param init: Indidates, whether this instance is created during initialises process (of the container).
     @type init: C{Boolean}
     """
     self._id = id
     self._name = name
     
     if self._id == None:
         self._id = tools.generateId(tools.TYPE_PROTOCOL)
Exemplo n.º 8
0
    def __init__(self, id = None, name = None, description = None, tcdl = None, tcdlversion = None, tcdldate = None):
        """
        Initialises a Community instance
        
        Assigns the parameters to the instance variables. If no id is given (or is C{None}), one
        will be calculated.

        @param id: Unique ID for the Community
        @type id: C{String}
        @param name: Name of the Community
        @type name: C{String}
        @param description: Community Description
        @type description: C{String}
        @param tcdl: Community Description in XML format
        @type tcdl: C{String}
        @param tcdlversion: Version of the current XML Community Description
        @type tcdlversion: C{String}
        @param tcdldate: Date of the current version of the XML Community Description
        @type tcdldate: C{String}
        """
        self._id = id
        self._name = name
        self._description = description
        self._tcdl = tcdl
        self._tcdlversion = tcdlversion
        self._tcdldate = tcdldate
        
        self._members = []
        self._authorities = []
        
        self._sourceGateways = []
        self._destinationGateways = []
        
        self._protocols = []
        self._algorithms = []
        
        if self._id == None:
            self._id = tools.generateId(tools.TYPE_COMMUNITY)
Exemplo n.º 9
0
    def sendG4dsMessage(self, endpointid, message, refid = None):
        """
        Send a message using the given protocol.
        
        The message is encyrpted first of all using the algorithm with the requested id. (In fact, for this
        matter the message is passed to the private function L{_handleSigningAndEncryption}, which will thereupon
        pass the request to the SecurityController and return the result. The encrypted result is wrapped into
        a valid G4DS message using the L{messagewrapper.MessageWrapper.wrapG4dsMessage} function.
        Finally, the result is passed to the routing engine, which will send it off using the requested
        protocol.
        
        @param endpointid: Id of the endpoint for this message. 
        @type endpointid: C{String}
        @param message: Message to be send via G4DS. Should "actually" be a service or control message
        @type message: C{String} (XML)
        @param refid: An id of a previous message which shall be referenced here
        @type refid: C{String}
        @return: ID of the message
        @rtype: C{String}
        """
        from communicationmanager import getEndpointManager
        endpoint = getEndpointManager().getEndpoint(endpointid)

        from tools import generateId, TYPE_MESSAGE
        mid = generateId(TYPE_MESSAGE)
        from config import memberid
        message, doc = getMessageWrapper().wrapG4dsPlain(message, mid, memberid, refid)
        
        message, tree, rootnode = self._handleSigningAndEncryption(message, endpoint)
        xmltext, domtree = getMessageWrapper().wrapG4dsMessage(rootnode)
        
        from routingcontroller import getRoutingEngine
##        import thread
##        thread.start_new_thread(getRoutingEngine().sendMessage, (xmltext, endpoint))
    
        getRoutingEngine().sendMessage(xmltext, endpoint)
        return mid