Package javax.ejb

Examples of javax.ejb.EJBHome


        this.beanContext = beanContext;
        keyGenerator = beanContext.getKeyGenerator();

        remoteInterface = beanContext.getRemoteInterface();
        if (remoteInterface != null) {
            EJBHome homeProxy = beanContext.getEJBHome();
            remoteHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy);
        } else {
            remoteHandler = null;
        }
View Full Code Here


  if (jndiName.startsWith ("java:comp/")) {
      Object objref = lookupJNDIEntry (jndiName);
      return (EJBHome)PortableRemoteObject.narrow (objref, ejbClass);
  }
  synchronized (homeCache) {
      EJBHome ejbHome = (EJBHome)homeCache.get (jndiName);
      if (ejbHome == null) {
    ejbHome = (EJBHome)PortableRemoteObject.narrow
        (lookupJNDIEntry (jndiName), ejbClass);
    homeCache.put (jndiName, ejbHome);
      }
View Full Code Here

     * should be temporary.
     */
    public static Object createSession (Class ejbClass, String jndiName)
  throws IllegalArgumentException, ResourceNotAvailableException {
  if (EJBHome.class.isAssignableFrom (ejbClass)) {
      EJBHome home = retrieveEJBHome (ejbClass, jndiName);
      return createSession (home);
  } else {
      EJBLocalHome home = retrieveEJBLocalHome (ejbClass, jndiName);
      return createSession (home);
  }
View Full Code Here

     */
    private Object callEJB(String jndiName, Class homeClass, String method,
            Class[] sig, Object[] args) throws NamingException, RemoteException,
            IllegalArgumentException, IllegalAccessException,
            InvocationTargetException, NoSuchMethodException {
        EJBHome home = EJBUtil.lookupEJBHome(homeClass, jndiName);
        EJBMetaData md = home.getEJBMetaData();
        EJBObject remote = (EJBObject)
        invoke(homeClass, home, "create", null, null);
        Class remoteClass = md.getRemoteInterfaceClass();

        return invoke(remoteClass, remote, method, sig, args);
View Full Code Here

      getLog().debug(++test+"- "+"Getting the home handle...");
      HomeHandle homeHandle = allTypesHome.getHomeHandle();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting the home back from the handle...");
      EJBHome aHome = homeHandle.getEJBHome();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting metadata from home...");
      EJBMetaData aMetaData = aHome.getEJBMetaData();
      getLog().debug("OK");

      getLog().debug(++test+"- "+"Getting home from metadata...");
      aHome = aMetaData.getEJBHome();
      getLog().debug("OK");
View Full Code Here

    }

    public void testRemoteInterface() throws Exception {

        InitialContext ctx = new InitialContext();
        EJBHome home = (EJBHome) ctx.lookup("WidgetBeanRemoteHome");
        assertNotNull("home", home);
        assertTrue("home should be an instance of WidgetHome", home instanceof WidgetHome);
        CrossClassLoaderProxyTestObject.widgetHome = (WidgetHome) home;
        CrossClassLoaderProxyTestObject proxyTestObject = new CrossClassLoaderProxyTestObject();
        proxyTestObject.testRemoteInterface();
View Full Code Here

            assertFalse(WidgetRemote.class.equals(widgetRemoteClass));

            Object testObject = testObjectClass.newInstance();

            InitialContext ctx = new InitialContext();
            EJBHome rawHome = (EJBHome) ctx.lookup("WidgetBeanRemoteHome");
           
            EJBHome home = (EJBHome) copy(rawHome);
            assertNotNull("home", home);
            assertEquals(widgetHomeClass.getClassLoader(), home.getClass().getClassLoader());
            assertTrue(widgetHomeClass.isAssignableFrom(home.getClass()));

            testObjectClass.getField("widgetHome").set(testObject, home);

            testObjectClass.getMethod("testRemoteInterface").invoke(testObject);
        } finally {
View Full Code Here

    /**
     * A method to test retrieving the EJBHome interface of a session bean using its EJBObject reference.
     */
    public void test01_getEjbHome() {
        try {
            EJBHome home = ejbObject.getEJBHome();
            assertNotNull("The EJBHome is null", home);
        } catch (Exception e) {
            fail("Received Exception " + e.getClass() + " : " + e.getMessage());
        }
    }
View Full Code Here

        Assert.assertEquals(Session30.class.getName(), metadata.getRemoteInterfaceClass().getName());

        HomeHandle homeHandle = home.getHomeHandle();
        Assert.assertNotNull(homeHandle);

        EJBHome ejbHome = homeHandle.getEJBHome();
        Assert.assertNotNull(ejbHome);
        metadata = ejbHome.getEJBMetaData();
        Assert.assertNotNull(metadata);
        Assert.assertEquals(Session30.class.getName(), metadata.getRemoteInterfaceClass().getName());

        Session30 session = (Session30) home.create();
        Assert.assertNotNull(session);
View Full Code Here

        Class[] proxyInterfaces = (Class [])
            proxyInterfacesSet.toArray(new Class[proxyInterfacesSet.size()]);

        try {
            EJBHome ejbHomeProxy = (EJBHome) Proxy.newProxyInstance(loader, proxyInterfaces, handler);
            handler.setProxy(ejbHomeProxy);
        } catch (ClassCastException e) {
            String msg = localStrings.getLocalString("ejb.basecontainer_invalid_home_interface",
                    "Home interface [{0}] is invalid since it does not extend javax.ejb.EJBHome.", homeIntf);
            throw new IllegalArgumentException(msg, e);
View Full Code Here

TOP

Related Classes of javax.ejb.EJBHome

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.