from pyGridWare.generated.services.mathservice.MathService import MathServiceWSRF class MathService(MathServiceWSRF): def wsa_add(self, ps, address, **kw): request,response = MathServiceWSRF.wsa_add(self, ps, address)ctx = self.GetResourceContext(ps, address)
ctx.properties.Value += request
ctx.properties.LastOp = "ADDITION"
return request,response def wsa_subtract(self, ps, address, **kw): request,response = MathServiceWSRF.wsa_subtract(self, ps, address) ctx = self.GetResourceContext(ps, address) ctx.properties.Value -= request ctx.properties.LastOp = "SUBTRACT" return request,response def wsa_getValueRP(self, ps, address, **kw): request,response = MathServiceWSRF.wsa_getValueRP(self, ps, address) ctx = self.GetResourceContext(ps, address) ctx.properties.LastOp = "GETVALUE" return request,response.__class__(ctx.properties.Value) # # The Factory Method for our Finished MathService # def wsa_createResource(self, ps, address, **kw): # Get request and response request,response = MathServiceWSRF.wsa_createResource(self, ps, address, **kw) # Create Resource Context from pyGridWare.utility.http import GetURLFromRequest ctx = self.NewResourceContextMathPort(\
GetURLFromRequest(kw['request'])
) # Initialize Value to 0 counter = ctx.properties counter.Value = 0
# Create EndPointReference and set in response from pyGridWare.addressing.AddressingUtils import AddressingUtils epr = AddressingUtils.createEndpointReference(ctx)
response._EndpointReference = epr
return request,response