1
2
3
4
5 package org.neo.swarm.services.binding;
6
7 import java.lang.reflect.Method;
8
9 import org.neo.swarm.ApplicationContext;
10 import org.neo.swarm.DefaultSwarmContainer;
11 import org.neo.swarm.SwarmContainer;
12 import org.neo.swarm.core.aop.silc.comp.AspectInvocation;
13 import org.neo.swarm.core.aop.silc.comp.Invocation;
14 import org.neo.swarm.core.aop.silc.comp.MethodInterceptor;
15
16 /***
17 * Used to bootstrap a remote AC - it fakes an invocation to the remote obect
18 * to retrieve the AC->RemoteAspect set.
19 *
20 * @author navery
21 */
22 public final class RemoteACProxyFactory {
23
24 /***
25 * Returns an hand-rolled invocation for the root container to insert a given (remote version) of an application context;
26 * @throws NoSuchMethodException
27 * @throws SecurityException
28 */
29 public Invocation createRegisterAppContextInvocation(String rootContainerName, String acURI, ApplicationContext remoteACPerspectve) throws SecurityException, NoSuchMethodException {
30
31 Method methodToInvoke = SwarmContainer.class.getMethod("registerAppContext", new Class[] { String.class, ApplicationContext.class });
32 AspectInvocation invocation = new AspectInvocation(null, rootContainerName, new DefaultSwarmContainer(null, null), methodToInvoke , new Object[] { acURI, remoteACPerspectve}, new MethodInterceptor[0] );
33 return invocation;
34 }
35
36 }