[asterisk-scf-commits] asterisk-scf/examples.git branch "decorator" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Jul 15 13:52:55 CDT 2011
branch "decorator" has been updated
via 819f1c6b8c26d5dae04fdad906eb24e765591eef (commit)
from a4f5f0557254d2959f1f2ff02d52e7c041f72152 (commit)
Summary of changes:
Session_Decorator.py | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
- Log -----------------------------------------------------------------
commit 819f1c6b8c26d5dae04fdad906eb24e765591eef
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Jul 15 13:23:21 2011 -0500
Make adjustments based on new slice definitions.
diff --git a/Session_Decorator.py b/Session_Decorator.py
index 070bd03..32d94c9 100755
--- a/Session_Decorator.py
+++ b/Session_Decorator.py
@@ -153,18 +153,19 @@ class SessionDecorator(AsteriskSCF.SessionCommunications.V1.Session, AsteriskSCF
self.adapter.remove(self.sessionPrxID)
self.file.close()
-class SessionDecoratorHook(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorHook):
+class SessionDecoratorHook(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionCreationHook):
def __init__(self, adapter):
self.adapter = adapter
- def decorateSession(self, realSession, realListeners, current = None):
- decorator = SessionDecorator(realSession, realListeners, self.adapter)
+ def decorateSession(self, originalData, current = None):
+ decorator = SessionDecorator(originalData.session, originalData.listeners, self.adapter)
objPrx = self.adapter.addWithUUID(decorator)
decoratorPrx = AsteriskSCF.SessionCommunications.V1.SessionPrx.uncheckedCast(objPrx)
decoratorListenerPrx = AsteriskSCF.SessionCommunications.V1.SessionListenerPrx.uncheckedCast(objPrx)
file = open(decoratorPrx.ice_getIdentity().name + ".txt", "w")
decorator.setProxyAndFile(decoratorPrx.ice_getIdentity(), file)
result = AsteriskSCF.System.Hook.V1.HookResult(AsteriskSCF.System.Hook.V1.HookStatus.Succeeded, "cool")
- return (result, decoratorPrx, decoratorListenerPrx)
+ replacementData = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionCreationHookData(decoratorPrx, [decoratorListenerPrx])
+ return (result, replacementData)
class DecoratorApp(Ice.Application):
def usage(self):
@@ -209,7 +210,7 @@ class DecoratorApp(Ice.Application):
adapter = self.communicator().createObjectAdapterWithEndpoints("ExampleDecorator", "default")
hookObjPrx = adapter.addWithUUID(SessionDecoratorHook(adapter))
- self.hookPrx = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorHookPrx.uncheckedCast(hookObjPrx)
+ self.hookPrx = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionCreationHookPrx.uncheckedCast(hookObjPrx)
print "Added decorator hook to our object adapter"
adapter.activate()
@@ -225,7 +226,7 @@ class DecoratorApp(Ice.Application):
self.extensionPoints = []
# XXX Once changes have been merged for Service discovery to use names without registering a custom
# comparator, we'll actually use the passed-in decoratorName here.
- params = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorLocatorCategory)
+ params = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams(AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionCreationHookLocatorCategory)
try:
extensionPointObjs = locator.locateAll(params)
except AsteriskSCF.Core.Discovery.V1.ServiceNotFound:
@@ -233,12 +234,12 @@ class DecoratorApp(Ice.Application):
return -1
for e in extensionPointObjs:
- extensionPoint = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionDecoratorExtensionPointPrx.checkedCast(e)
+ extensionPoint = AsteriskSCF.SessionCommunications.ExtensionPoints.V1.SessionCreationExtensionPointPrx.checkedCast(e)
if not extensionPoint:
print "Couldn't get the session decorator extension point interface"
return -1
else:
- extensionPoint.addDecorator(self.hookPrx)
+ extensionPoint.addSessionCreationHook(self.hookPrx)
self.extensionPoints.append(extensionPoint)
print "Added ourself as a session decorator"
@@ -261,7 +262,7 @@ class DecoratorApp(Ice.Application):
print "Removing ourself as a session decorator"
for e in self.extensionPoints:
try:
- e.removeDecorator(self.hookPrx)
+ e.removeSessionCreationHook(self.hookPrx)
except Ice.Exception as ex:
print "Error trying to remove decorator"
-----------------------------------------------------------------------
--
asterisk-scf/examples.git
More information about the asterisk-scf-commits
mailing list