Package org.jboss.ejb3.entity.hibernate

Examples of org.jboss.ejb3.entity.hibernate.TransactionScopedSessionInvocationHandler


      // Create the EJB Container
      final Map<String, String> ejbContainerProps = new HashMap<String, String>();
      ejbContainerProps.put(EJBContainer.MODULES, ""); // Deploy no modules and do no scanning by default
      final JBossEJBContainerProvider ejbContainer = (JBossEJBContainerProvider) EJBContainer
            .createEJBContainer(ejbContainerProps);
      final ShrinkWrapEJBContainer shrinkwrapEjbContainer = new ShrinkWrapEJBContainerImpl(ejbContainer);

      // Define the EJB JAR
      final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "outputSlsb.jar").addClasses(OutputBean.class,
            OutputLocalBusiness.class);

      // Deploy the JAR
      shrinkwrapEjbContainer.deploy(archive);

      // Look up the EJB
      final Context context = ejbContainer.getContext();
      final OutputLocalBusiness bean;
      try
      {
         bean = (OutputLocalBusiness) context.lookup(OutputLocalBusiness.JNDI_NAME);
      }
      catch (final NamingException e)
      {
         throw new RuntimeException("Could not find bean proxy at " + OutputLocalBusiness.JNDI_NAME, e);
      }

      // Invoke
      final String value = bean.getOutput();

      // Undeploy
      shrinkwrapEjbContainer.undeploy(archive);

      // Shut down EJBContainer
      ejbContainer.close();

      // Write out
View Full Code Here


      response.setContentType(CONTENT_TYPE_TEXT_PLAIN);

      // Create the EJB Container
      final Map<String, String> ejbContainerProps = new HashMap<String, String>();
      ejbContainerProps.put(EJBContainer.MODULES, ""); // Deploy no modules and do no scanning by default
      final JBossEJBContainerProvider ejbContainer = (JBossEJBContainerProvider) EJBContainer
            .createEJBContainer(ejbContainerProps);
      final ShrinkWrapEJBContainer shrinkwrapEjbContainer = new ShrinkWrapEJBContainerImpl(ejbContainer);

      // Define the EJB JAR
      final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "outputSlsb.jar").addClasses(OutputBean.class,
            OutputLocalBusiness.class);

      // Deploy the JAR
      shrinkwrapEjbContainer.deploy(archive);

      // Look up the EJB
      final Context context = ejbContainer.getContext();
      final OutputLocalBusiness bean;
      try
      {
         bean = (OutputLocalBusiness) context.lookup(OutputLocalBusiness.JNDI_NAME);
      }
      catch (final NamingException e)
      {
         throw new RuntimeException("Could not find bean proxy at " + OutputLocalBusiness.JNDI_NAME, e);
      }

      // Invoke
      final String value = bean.getOutput();

      // Undeploy
      shrinkwrapEjbContainer.undeploy(archive);

      // Shut down EJBContainer
      ejbContainer.close();

      // Write out
      log.info("Got value from EJB: " + value);
      response.getWriter().write(value);
   }
View Full Code Here

         boolean isEar = unit != unit.getTopLevel();
         this.deploymentScope = new JBoss5DeploymentScope(unit.getParent(), isEar);
      }

      ejbResolver = new ClientEjbResolver(deploymentScope, unit.getSimpleName());
      messageDestinationResolver = new MessageDestinationResolver(deploymentScope, xml.getMessageDestinations());

      String on = Ejb3Module.BASE_EJB3_JMX_NAME + createScopeKernelName(unit, deploymentScope) + ",name=" + applicationClientName;
      try
      {
         this.objectName = new ObjectName(on);
View Full Code Here

      @Deprecated
      Ejb3Registrar registrar = Ejb3RegistrarLocator.locateRegistrar();

      // Get the resolver
      EndpointResolver resolver = registrar.lookup(MC_BIND_NAME_ENDPOINT_RESOLVER, EndpointResolver.class);
      this.ejbClassName = descriptor.getBeanClass().getSimpleName();
      endpointMcBindName = resolver.resolve(deploymentUnit, ejbClassName);
      this.stateful = descriptor.isStateful();
   }
View Full Code Here

         {
            entityManager = new TransactionScopedEntityManager(factory);
         }
         else
         {
            TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
            entityManager = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

         {
            entityManager = new TransactionScopedEntityManager(factory);
         }
         else
         {
            TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
            entityManager = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

         {
            entityManager = new TransactionScopedEntityManager(factory);
         }
         else
         {
            TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
            entityManager = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

         {
            entityManager = new TransactionScopedEntityManager(factory);
         }
         else
         {
            TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
            entityManager = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

         {
            entityManager = new TransactionScopedEntityManager(factory);
         }
         else
         {
            TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
            entityManager = Proxy.newProxyInstance(
                  Session.class.getClassLoader(), //use the Hibernate classloader so the proxy has the same scope as Hibernate
                  SESS_PROXY_INTERFACES,
                  handler
            );
View Full Code Here

/*    */       {
/* 122 */         entityManager = new TransactionScopedEntityManager(factory);
/*    */       }
/*    */       else
/*    */       {
/* 126 */         TransactionScopedSessionInvocationHandler handler = new TransactionScopedSessionInvocationHandler(factory);
/* 127 */         entityManager = Proxy.newProxyInstance(org.hibernate.Session.class.getClassLoader(), SESS_PROXY_INTERFACES, handler);
/*    */       }
/*    */
/*    */       try
/*    */       {
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.entity.hibernate.TransactionScopedSessionInvocationHandler

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.