Package java.lang.reflect

Examples of java.lang.reflect.Proxy$ClassFactory


         if( jndiEnv != null )
            ic = new InitialContext(jndiEnv);
         else
            ic = new InitialContext();

         Proxy proxy = (Proxy) ic.lookup(jndiName);

         // call findByPrimary on the target
         InvocationHandler ih = Proxy.getInvocationHandler(proxy);
         return (EJBObject) ih.invoke(proxy, GET_EJB_OBJECT, new Object[] {id});
      }
View Full Code Here


      Fake() {
        super(null);
      }
    }

    Proxy fake = new Proxy(new InvocationHandler() {
      public Object invoke(Object proxy, Method method, Object[] args)
          throws Throwable {
        return null;
      }
    }) {
    };

    assertTrue("Does not believe its a Proxy class ", Proxy
        .isProxyClass(proxy));
    assertTrue("Proxy subclasses do not count ", !Proxy
        .isProxyClass(Fake.class));
    assertTrue("Is not a runtime generated Proxy class ", !Proxy
        .isProxyClass(fake.getClass()));
  }
View Full Code Here

                    ObjectOutputStream oos = new ObjectOutputStream(baos);
                    oos.writeObject(proxy);
                    oos.close();
                    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                    ObjectInputStream ois = new ObjectInputStream(bais);
                    Proxy p = (Proxy)ois.readObject();
                    harness.check(p.getClass() == proxy.getClass());
                    harness.check(Proxy.getInvocationHandler(p).getClass() == Proxy.getInvocationHandler(proxy).getClass());
                } catch(Exception x) {
                    harness.debug(x);
                    harness.fail("Unexpected exception");
                }
View Full Code Here

     * is proxying.
     **/
    public static ObjectName getObjectName(Object proxy) {
        if (!(proxy instanceof Proxy))
            throw new IllegalArgumentException("not a "+Proxy.class.getName());
        final Proxy p = (Proxy) proxy;
        final InvocationHandler handler =
                Proxy.getInvocationHandler(proxy);
        if (handler instanceof MBeanServerInvocationHandler)
            return ((MBeanServerInvocationHandler)handler).getObjectName();
        throw new IllegalArgumentException("not a JMX Proxy");
View Full Code Here

        if (proxy instanceof NotificationEmitter)
            return proxy;
        if (proxy == null) return null;
        if (!(proxy instanceof Proxy))
            throw new IllegalArgumentException("not a "+Proxy.class.getName());
        final Proxy p = (Proxy) proxy;
        final InvocationHandler handler =
                Proxy.getInvocationHandler(proxy);
        if (!(handler instanceof MBeanServerInvocationHandler))
            throw new IllegalArgumentException("not a JMX Proxy");
        final MBeanServerInvocationHandler h =
View Full Code Here

  {
    String returnValue = null;

    if (Proxy.isProxyClass(component.getClass()))
    {
      Proxy proxy = (Proxy) component;
      Object o = ProxyObjectFactory.getObject(proxy);

      returnValue = o.getClass().getName();
    }
    else
View Full Code Here

    KeelContainer.defaultContainer().release(service);

    try
    {
      Proxy proxy = (Proxy) service;

      Proxy.getInvocationHandler(proxy).invoke(proxy, KeelServiceable.class.getMethod("releaseServices"),
              new Object[]
              {});
    }
View Full Code Here

    {
      releaseService(pf);

      try
      {
        Proxy proxy = (Proxy) pf;

        proxy.getInvocationHandler(proxy).invoke(proxy, KeelServiceable.class.getMethod("releaseServices"),
                new Object[]
                {});
      }
      catch (Throwable x)
      {
View Full Code Here

    {
      releaseService(pf);

      try
      {
        Proxy proxy = (Proxy) pf;

        proxy.getInvocationHandler(proxy).invoke(proxy, KeelServiceable.class.getMethod("releaseServices"),
                new Object[]
                {});
      }
      catch (Throwable x)
      {
View Full Code Here

  {
    String returnValue = null;

    if (Proxy.isProxyClass(component.getClass()))
    {
      Proxy proxy = (Proxy) component;
      Object o = ProxyObjectFactory.getObject(proxy);

      returnValue = o.getClass().getName();
    }
    else
View Full Code Here

TOP

Related Classes of java.lang.reflect.Proxy$ClassFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.