[jboss-dev-forums] [Design of POJO Server] - Re: ManagedOperation aspects for the ProfileService.Manageme

alesj do-not-reply at jboss.com
Thu Sep 20 09:56:43 EDT 2007


I've added the following code to KernelBus:

  |    public Object invoke(Object name, KernelRegistryEntryJoinpoint joinPoint) throws Throwable
  |    {
  |       KernelRegistryEntry entry = registry.getEntry(name);
  |       if (joinPoint.applyEntry(entry) == false)
  |          throw new IllegalArgumentException("Cannot apply joinpoint " + joinPoint + " to entry " + entry);
  |       return joinPoint.dispatch();
  |    }
  | 

And the 2 impls:

  | public class InvokeKernelRegistryEntryJoinpoint extends JBossObject implements KernelRegistryEntryJoinpoint
  | {
  |    private String methodName;
  |    private Object[] args;
  |    private String[] signature;
  |    private InvokeDispatchContext context;
  | 
  |    public InvokeKernelRegistryEntryJoinpoint(String methodName, Object[] args, String[] signature)
  |    {
  |       this.methodName = methodName;
  |       this.args = args;
  |       this.signature = signature;
  |    }
  | 
  |    public boolean applyEntry(KernelRegistryEntry entry)
  |    {
  |       if (entry instanceof InvokeDispatchContext)
  |       {
  |          context = (InvokeDispatchContext)entry;
  |          return true;
  |       }
  |       return false;
  |    }
  | 
  |    public Object dispatch() throws Throwable
  |    {
  |       if (context == null)
  |          throw new IllegalArgumentException("Cannot dispatch null context.");
  |       return context.invoke(methodName, args, signature);
  |    }
  | 
  |    public String toHumanReadableString()
  |    {
  |       return methodName + "," + context;
  |    }
  | }
  | 
  | public class AttributeKernelRegistryEntryJoinpoint extends JBossObject implements KernelRegistryEntryJoinpoint
  | {
  |    private String getterName;
  |    private AttributeDispatchContext context;
  | 
  |    public AttributeKernelRegistryEntryJoinpoint(String getterName)
  |    {
  |       this.getterName = getterName;
  |    }
  | 
  |    public boolean applyEntry(KernelRegistryEntry entry)
  |    {
  |       if (entry instanceof AttributeDispatchContext)
  |       {
  |          context = (AttributeDispatchContext)entry;
  |          return true;
  |       }
  |       return false;
  |    }
  | 
  |    public Object dispatch() throws Throwable
  |    {
  |       if (context == null)
  |          throw new IllegalArgumentException("Cannot dispatch null context.");
  |       return context.get(getterName);
  |    }
  | 
  |    public String toHumanReadableString()
  |    {
  |       return getterName + "," + context;
  |    }
  | }
  | 
  | 

I'll change the ManagementView invocation later this evening with the KernelBus invocation.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4086693#4086693

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4086693



More information about the jboss-dev-forums mailing list