@Override public void prepareCall(ServiceInvocationContext context, IInvocationCall c, String componentName, Class<?> componentClass) { if ((c instanceof InvocationCall) && ((InvocationCall)c).getListeners() != null) remoteObservers.addAll(((InvocationCall)c).getListeners()); Context.create(this); // Initialize an empty data context DataContext.init(); }
public void run() { Map<Object, List<String>> initMap = new HashMap<Object, List<String>>(); synchronized (objectsInitializing) { for (int i = 0; i < objectsInitializing.size(); i++) { if (objectsInitializing.get(i)[0] != context) continue; List<String> propertyNames = initMap.get(objectsInitializing.get(i)[1]); if (propertyNames == null) { propertyNames = new ArrayList<String>(); propertyNames.add((String)objectsInitializing.get(i)[2]); initMap.put(objectsInitializing.get(i)[1], propertyNames); } else propertyNames.add((String)objectsInitializing.get(i)[2]); objectsInitializing.remove(i--); } } RemoteService rs = serverSession.getRemoteService(); for (Object entity : initMap.keySet()) { serverSession.checkWaitForLogout(); rs.newInvocation("initializeObject", entity, initMap.get(entity).toArray(), new InvocationCall()) .addListener(new InitializerListener(serverSession, entity)).invoke(); } } }
public void prepareCall(ServiceInvocationContext context, IInvocationCall c, String componentName, Class<?> componentClass) { InvocationCall call = (InvocationCall)c; List<String> listeners = call.getListeners(); List<ContextUpdate> updates = call.getUpdates(); Object[] results = call.getResults();
@Override public Future<T> invoke(ServerSession serverSession) { Object[] call = new Object[5]; call[0] = getComponent().getName(); String componentClassName = null; if (getComponent().getClass() != ComponentImpl.class) { RemoteAlias remoteAlias = getComponent().getClass().getAnnotation(RemoteAlias.class); componentClassName = remoteAlias != null ? remoteAlias.value() : getComponent().getClass().getName(); } call[1] = componentClassName; call[2] = getOperation(); call[3] = getArgs(); call[4] = new InvocationCall(); RemoteService ro = serverSession.getRemoteService(); ResponseMessageFuture rmf = ro.newInvocation("invokeComponent", call).addListener(this).invoke(); serverSession.checkWaitForLogout(); return new FutureResult<T>(rmf, this); }