Is it possible to get the “root” service name that was invoked, at runtime?
E.g. to get “common.utils:fooService”.
Example:
If a have tree services; serviceA, serviceB & serviceC.
serviceA is first invoked and serviceB is then called from serviceA and serviceC is then called from serviceB.
Can I from serviceC somehow find out that serviceA was the first service that was invoked in the execution chain?
// Note that we allocated one less than what the stack has
// to omit this service from being in the list
String[] serviceStack = new String[callStack.size()-1];
for(int j=0,i=serviceStack.length; --i>=0;j++)
serviceStack[j] = ((com.wm.lang.ns.NSService)callStack.elementAt(i)).toString();
IDataUtil.put(idc, "serviceStack", serviceStack);
idc.destroy();
}[/highlight]
This reverses the order of the stack. Depending on your preference, you might want to change the for loop to keep the order as returned by getCallStack.