Package javax.ejb

Examples of javax.ejb.EJBMetaData


    Object ref = agent.getEJBHome();
    TravelAgentHomeRemote home = (TravelAgentHomeRemote)
      PortableRemoteObject.narrow(ref,TravelAgentHomeRemote.class);

    // Do something useful with the home interface
    EJBMetaData meta = home.getEJBMetaData();
    System.out.println(meta.getHomeInterfaceClass().getName());
    System.out.println(meta.getRemoteInterfaceClass().getName());
    System.out.println(meta.isSession());
        //System.exit(0);

  }
View Full Code Here


      Object ref = jndiContext.lookup("CabinHome");
      CabinHomeRemote c_home = (CabinHomeRemote)
        PortableRemoteObject.narrow(ref, CabinHomeRemote.class);

      EJBMetaData meta = c_home.getEJBMetaData();

      System.out.println(meta.getHomeInterfaceClass().getName());
      System.out.println(meta.getRemoteInterfaceClass().getName());
      System.out.println(meta.getPrimaryKeyClass().getName());
      System.out.println(meta.isSession());

      Class primKeyType = meta.getPrimaryKeyClass();
      if (primKeyType.getName().equals("java.lang.Integer")) {
        Integer pk = new Integer(1);
        Object ref2 = meta.getEJBHome();
        CabinHomeRemote c_home2 = (CabinHomeRemote)
          PortableRemoteObject.narrow(ref2,CabinHomeRemote.class);
        CabinRemote cabin = c_home2.findByPrimaryKey(pk);
        System.out.println(cabin.getName());
      }
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+"- "+"Calling businessMethodB on it...");
      getLog().debug(statelessSession2.callBusinessMethodB());
      getLog().debug(++test+"- "+"They should be identical..."+statelessSession.isIdentical(statelessSession2));
      getLog().debug("***Testing the various local EJBHome class calls");
      getLog().debug(++test+"- "+"Getting the metaData...");
      EJBMetaData statelessMetaData = statelessSessionHome.getEJBMetaData();
      assertTrue("statelessMetaData != null", statelessMetaData != null);
      getLog().debug("OK");
      getLog().debug(++test+"- "+"Is stateless Session? "+statelessMetaData.isStatelessSession());
      getLog().debug(++test+"- "+"The remote class is "+statelessMetaData.getRemoteInterfaceClass());

      getLog().debug("");
      getLog().debug(++test+"- "+"Calling StatelessSession.remove()...");
      statelessSession.remove();
      getLog().debug("ok");
View Full Code Here

      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");

      getLog().debug(++test+"- "+"Calling findByPrimaryKey on AllTypesHome with name seb...");

      AllTypes allTypes = null;
View Full Code Here

         CtsBmpHome anotherHome = (CtsBmpHome)homeHan.getEJBHome();
         assertTrue(anotherHome != null);
         getLog().debug("OK");

         getLog().debug("Get the Meta-data object...");
         EJBMetaData md = anotherHome.getEJBMetaData();
         assertTrue(md != null);
         getLog().debug("OK");

         getLog().debug("Probe the Meta-data object:");
         String homeInterface = md.getHomeInterfaceClass().getName();
         String primaryKey = md.getPrimaryKeyClass().getName();
         String remoteInterface = md.getRemoteInterfaceClass().getName();
         getLog().debug("  Home Interface  : " + homeInterface);
         getLog().debug("  PrimaryKey      : " + primaryKey);
         getLog().debug("  Remote Interface: " + remoteInterface);
         assertTrue(homeInterface.equals("org.jboss.test.cts.interfaces.CtsBmpHome"));
         assertTrue(primaryKey.equals("org.jboss.test.cts.keys.AccountPK"));
         assertTrue(remoteInterface.equals("org.jboss.test.cts.interfaces.CtsBmp"));
         getLog().debug("Meta-data OK");

         getLog().debug("Check isSession()==false ...");
         assertTrue(!md.isSession());
         getLog().debug("OK");

         getLog().debug("Check isStatelessSession()==false ...");
         assertTrue(!md.isStatelessSession());
         getLog().debug("OK");

         getLog().debug("Test EJBHome.remove(PrimaryKey)");
         anotherHome.remove(pk);
         getLog().debug("OK");
View Full Code Here

        InitialContext jndiContext = new InitialContext();

        StatefulSession30Home home = (StatefulSession30Home) jndiContext.lookup("java:module/StatefulSession30!" + StatefulSession30Home.class.getName());
        Assert.assertNotNull(home);

        EJBMetaData metadata = home.getEJBMetaData();
        Assert.assertNotNull(metadata);
        Assert.assertEquals(StatefulSession30.class, metadata.getRemoteInterfaceClass());

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

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

        StatefulSession30 session = (StatefulSession30) home.create();
        Assert.assertNotNull(session);
        ejbHome = session.getEJBHome();
        Assert.assertNotNull(ejbHome);
View Full Code Here

        InitialContext jndiContext = new InitialContext();

        Session30Home home = (Session30Home) jndiContext.lookup("java:module/Session30!" + Session30Home.class.getName());
        Assert.assertNotNull(home);

        EJBMetaData metadata = home.getEJBMetaData();
        Assert.assertNotNull(metadata);
        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);
        ejbHome = session.getEJBHome();
        Assert.assertNotNull(ejbHome);
View Full Code Here

    //===============================
    // Test ejb home methods
    //
    public void test01_getEJBMetaData(){
        try{
        final EJBMetaData ejbMetaData = ejbHome.getEJBMetaData();
        assertNotNull( "The EJBMetaData is null", ejbMetaData );
        } catch (final Exception e){
            fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
        }
    }
View Full Code Here

    public EJBMetaData returnEJBMetaData(final EJBMetaData data) {
        return data;
    }

    public EJBMetaData returnEJBMetaData() throws javax.ejb.EJBException {
        EJBMetaData data = null;

        try {
            final InitialContext ctx = new InitialContext();

            final EncCmpHome home = (EncCmpHome) ctx.lookup("java:comp/env/cmp/rmi-iiop/home");
View Full Code Here

TOP

Related Classes of javax.ejb.EJBMetaData

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.