Package org.omg.CORBA

Examples of org.omg.CORBA.Repository


      // If there is an interface repository, then get
      // the homeInterfaceDef from the IR
      InterfaceDef homeInterfaceDef = null;
      if (iri != null) {
            Repository ir = iri.getReference();
            homeInterfaceDef =
               InterfaceDefHelper.narrow(ir.lookup_id(homeRepositoryIds[0]));
      }

      // Instantiate home servant, bind it to the servant registry, and
      // create CORBA reference to the EJBHome.
      homeServantRegistry =
            servantRegistries.getServantRegistry(registryWithPersistentPOA);


      String homeServantLoggerName =
         EjbHomeCorbaServant.class.getName() + '.'+ jndiName;

      ServantWithMBeanServer homeServant =
         new EjbHomeCorbaServant(container.getJmxName(),
                                 container.getClassLoader(),
                                 homeMethodMap,
                                 homeRepositoryIds,
                                 homeInterfaceDef,
                                 Logger.getLogger(homeServantLoggerName));

      homeReferenceFactory = homeServantRegistry.bind(homeServantName(jndiName), homeServant, policies);

      org.omg.CORBA.Object corbaRef =
         homeReferenceFactory.createReference(homeRepositoryIds[0]);
      ejbHome = (EJBHome)PortableRemoteObject.narrow(corbaRef, EJBHome.class);
      ((EjbHomeCorbaServant)homeServant).setHomeHandle(
                                             new HomeHandleImplIIOP(ejbHome));

      // Initialize beanPOA and create metadata depending on the kind of bean
      if (container.getBeanMetaData() instanceof EntityMetaData) {

         // This is an entity bean (lifespan: persistent)
         beanServantRegistry =
            servantRegistries.getServantRegistry(registryWithPersistentPOA);

         Class pkClass;
         EntityMetaData metaData = (EntityMetaData)container.getBeanMetaData();
         String pkClassName = metaData.getPrimaryKeyClass();
         try {
            if (pkClassName != null)
               pkClass = container.getClassLoader().loadClass(pkClassName);
            else
               pkClass = container.getClassLoader().loadClass(
                     metaData.getEjbClass()).getField(
                           metaData.getPrimKeyField()).getClass();
         }
         catch (NoSuchFieldException e) {
            logger.error("Unable to identify Bean's Primary Key class! "
                         + "Did you specify a primary key class and/or field? "
                         + "Does that field exist?");
            throw new Exception("Primary Key Problem");
         }
         catch (NullPointerException e) {
            logger.error("Unable to identify Bean's Primary Key class! "
                         + "Did you specify a primary key class and/or field? "
                         + "Does that field exist?");
            throw new Exception("Primary Key Problem");
         }

         ejbMetaData = new EJBMetaDataImplIIOP(
               ((EJBProxyFactoryContainer)container).getRemoteClass(),
               ((EJBProxyFactoryContainer)container).getHomeClass(),
               pkClass,
               false, // Session
               false, // Stateless
               ejbHome);
      }
      else {

         // This is a session bean (lifespan: transient)
         beanServantRegistry =
            servantRegistries.getServantRegistry(registryWithTransientPOA);

         if (((SessionMetaData)container.getBeanMetaData()).isStateless()) {

            // Stateless session bean
            ejbMetaData = new EJBMetaDataImplIIOP(
                  ((EJBProxyFactoryContainer)container).getRemoteClass(),
                  ((EJBProxyFactoryContainer)container).getHomeClass(),
                  null, // No PK
                  true, // Session
                  true, // Stateless
                  ejbHome);

         }
         else {

            // Stateful session bean
            ejbMetaData = new EJBMetaDataImplIIOP(
                  ((EJBProxyFactoryContainer)container).getRemoteClass(),
                  ((EJBProxyFactoryContainer)container).getHomeClass(),
                  null,  // No PK
                  true,  // Session
                  false, // Stateless
                  ejbHome);
         }
      }

      // If there is an interface repository, then get
      // the beanInterfaceDef from the IR
      InterfaceDef beanInterfaceDef = null;
      if (iri != null) {
            Repository ir = iri.getReference();
            beanInterfaceDef =
               InterfaceDefHelper.narrow(ir.lookup_id(beanRepositoryIds[0]));
      }

      String beanServantLoggerName =
         EjbObjectCorbaServant.class.getName() + '.'+ jndiName;
View Full Code Here


            Policy[] policies = policyList.toArray(new Policy[policyList.size()]);

            // If there is an interface repository, then get the homeInterfaceDef from the IR
            InterfaceDef homeInterfaceDef = null;
            if (iri != null) {
                Repository ir = iri.getReference();
                homeInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(homeRepositoryIds[0]));
            }

            // Get the POACurrent object
            Current poaCurrent = CurrentHelper.narrow(orb.resolve_initial_references("POACurrent"));

            // Instantiate home servant, bind it to the servant registry, and create CORBA reference to the EJBHome.
            final EjbCorbaServant homeServant = new EjbCorbaServant(poaCurrent, homeMethodMap, homeRepositoryIds, homeInterfaceDef,
                    orb, homeView.getValue(), factory, configuration, component.getTransactionManager(), module.getClassLoader(), true, securityDomain);

            homeServantRegistry = poaRegistry.getValue().getRegistryWithPersistentPOAPerServant();
            ReferenceFactory homeReferenceFactory = homeServantRegistry.bind(homeServantName(name), homeServant, policies);

            final org.omg.CORBA.Object corbaRef = homeReferenceFactory.createReference(homeRepositoryIds[0]);

            //we do this twice to force eager dynamic stub creation
            ejbHome = (EJBHome) PortableRemoteObject.narrow(corbaRef, EJBHome.class);

            final HomeHandleImplIIOP homeHandle = new HomeHandleImplIIOP(orb.object_to_string(corbaRef));
            homeServant.setHomeHandle(homeHandle);

            // Initialize beanPOA and create metadata depending on the kind of bean
            if (component instanceof EntityBeanComponent) {

                // This is an entity bean (lifespan: persistent)
                beanServantRegistry = poaRegistry.getValue().getRegistryWithPersistentPOAPerServant();
                final EntityBeanComponent entityBeanComponent = (EntityBeanComponent) component;
                final Class pkClass = entityBeanComponent.getPrimaryKeyClass();
                ejbMetaData = new EJBMetaDataImplIIOP(entityBeanComponent.getRemoteClass(), entityBeanComponent.getHomeClass(), pkClass, false, false, homeHandle);
            } else {
                // This is a session bean (lifespan: transient)
                beanServantRegistry = poaRegistry.getValue().getRegistryWithTransientPOAPerServant();
                if (component instanceof StatelessSessionComponent) {
                    // Stateless session bean
                    ejbMetaData = new EJBMetaDataImplIIOP(remoteView.getValue().getViewClass(), homeView.getValue().getViewClass(), null, true, true, homeHandle);
                } else {
                    // Stateful session bean
                    ejbMetaData = new EJBMetaDataImplIIOP(remoteView.getValue().getViewClass(), homeView.getValue().getViewClass(), null, true, false, homeHandle);
                }
            }
            homeServant.setEjbMetaData(ejbMetaData);

            // If there is an interface repository, then get the beanInterfaceDef from the IR
            InterfaceDef beanInterfaceDef = null;
            if (iri != null) {
                final Repository ir = iri.getReference();
                beanInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(beanRepositoryIds[0]));
            }

            // Instantiate the ejb object servant and bind it to the servant registry.
            final EjbCorbaServant beanServant = new EjbCorbaServant(poaCurrent, beanMethodMap, beanRepositoryIds,
                    beanInterfaceDef, orb, remoteView.getValue(), factory, configuration, component.getTransactionManager(),
View Full Code Here

    {
        try
        {
            ORB orb = (ORB) container.getComponentInstance(ORB.class);

            Repository repository = RepositoryHelper.narrow(orb.resolve_initial_references("InterfaceRepository"));

            return repository;
        }
        catch (InvalidName e)
        {
View Full Code Here

            Policy[] policies = policyList.toArray(new Policy[policyList.size()]);

            // If there is an interface repository, then get the homeInterfaceDef from the IR
            InterfaceDef homeInterfaceDef = null;
            if (iri != null) {
                Repository ir = iri.getReference();
                homeInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(homeRepositoryIds[0]));
            }

            // Get the POACurrent object
            Current poaCurrent = CurrentHelper.narrow(orb.resolve_initial_references("POACurrent"));

            // Instantiate home servant, bind it to the servant registry, and create CORBA reference to the EJBHome.
            final EjbCorbaServant homeServant = new EjbCorbaServant(poaCurrent, homeMethodMap, homeRepositoryIds, homeInterfaceDef,
                    orb, homeView.getValue(), factory, configuration, component.getTransactionManager(), module.getClassLoader(), true, securityDomain);

            homeServantRegistry = poaRegistry.getValue().getRegistryWithPersistentPOAPerServant();
            ReferenceFactory homeReferenceFactory = homeServantRegistry.bind(homeServantName(name), homeServant, policies);

            final org.omg.CORBA.Object corbaRef = homeReferenceFactory.createReference(homeRepositoryIds[0]);

            //we do this twice to force eager dynamic stub creation
            ejbHome = (EJBHome) PortableRemoteObject.narrow(corbaRef, EJBHome.class);

            final HomeHandleImplIIOP homeHandle = new HomeHandleImplIIOP(orb.object_to_string(corbaRef));
            homeServant.setHomeHandle(homeHandle);

            // Initialize beanPOA and create metadata depending on the kind of bean
            if (component instanceof EntityBeanComponent) {

                // This is an entity bean (lifespan: persistent)
                beanServantRegistry = poaRegistry.getValue().getRegistryWithPersistentPOAPerServant();
                final EntityBeanComponent entityBeanComponent = (EntityBeanComponent) component;
                final Class pkClass = entityBeanComponent.getPrimaryKeyClass();
                ejbMetaData = new EJBMetaDataImplIIOP(entityBeanComponent.getRemoteClass(), entityBeanComponent.getHomeClass(), pkClass, false, false, homeHandle);
            } else {
                // This is a session bean (lifespan: transient)
                beanServantRegistry = poaRegistry.getValue().getRegistryWithTransientPOAPerServant();
                if (component instanceof StatelessSessionComponent) {
                    // Stateless session bean
                    ejbMetaData = new EJBMetaDataImplIIOP(remoteView.getValue().getViewClass(), homeView.getValue().getViewClass(), null, true, true, homeHandle);
                } else {
                    // Stateful session bean
                    ejbMetaData = new EJBMetaDataImplIIOP(remoteView.getValue().getViewClass(), homeView.getValue().getViewClass(), null, true, false, homeHandle);
                }
            }
            homeServant.setEjbMetaData(ejbMetaData);

            // If there is an interface repository, then get the beanInterfaceDef from the IR
            InterfaceDef beanInterfaceDef = null;
            if (iri != null) {
                final Repository ir = iri.getReference();
                beanInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(beanRepositoryIds[0]));
            }

            // Instantiate the ejb object servant and bind it to the servant registry.
            final EjbCorbaServant beanServant = new EjbCorbaServant(poaCurrent, beanMethodMap, beanRepositoryIds,
                    beanInterfaceDef, orb, remoteView.getValue(), factory, configuration, component.getTransactionManager(),
View Full Code Here

/*     */     }
/*     */     ServantRegistryKind registryWithPersistentPOA;
/*     */     ServantRegistryKind registryWithTransientPOA;
/* 465 */     InterfaceDef homeInterfaceDef = null;
/* 466 */     if (this.iri != null) {
/* 467 */       Repository ir = this.iri.getReference();
/* 468 */       homeInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(this.homeRepositoryIds[0]));
/*     */     }
/*     */
/* 474 */     this.homeServantRegistry = this.servantRegistries.getServantRegistry(registryWithPersistentPOA);
/*     */
/* 478 */     String homeServantLoggerName = EjbHomeCorbaServant.class.getName() + '.' + this.jndiName;
/*     */
/* 481 */     ServantWithMBeanServer homeServant = new EjbHomeCorbaServant(this.container.getJmxName(), this.container.getClassLoader(), this.homeMethodMap, this.homeRepositoryIds, homeInterfaceDef, Logger.getLogger(homeServantLoggerName));
/*     */
/* 489 */     this.homeReferenceFactory = this.homeServantRegistry.bind(homeServantName(this.jndiName), homeServant, policies);
/*     */
/* 491 */     org.omg.CORBA.Object corbaRef = this.homeReferenceFactory.createReference(this.homeRepositoryIds[0]);
/*     */
/* 493 */     this.ejbHome = ((EJBHome)PortableRemoteObject.narrow(corbaRef, EJBHome.class));
/* 494 */     ((EjbHomeCorbaServant)homeServant).setHomeHandle(new HomeHandleImplIIOP(this.ejbHome));
/*     */
/* 498 */     if ((this.container.getBeanMetaData() instanceof EntityMetaData))
/*     */     {
/* 501 */       this.beanServantRegistry = this.servantRegistries.getServantRegistry(registryWithPersistentPOA);
/*     */
/* 505 */       EntityMetaData metaData = (EntityMetaData)this.container.getBeanMetaData();
/* 506 */       String pkClassName = metaData.getPrimaryKeyClass();
/*     */       Class pkClass;
/*     */       try
/*     */       {
/*     */         Class pkClass;
/* 508 */         if (pkClassName != null)
/* 509 */           pkClass = this.container.getClassLoader().loadClass(pkClassName);
/*     */         else {
/* 511 */           pkClass = this.container.getClassLoader().loadClass(metaData.getEjbClass()).getField(metaData.getPrimKeyField()).getClass();
/*     */         }
/*     */       }
/*     */       catch (NoSuchFieldException e)
/*     */       {
/* 516 */         this.logger.error("Unable to identify Bean's Primary Key class! Did you specify a primary key class and/or field? Does that field exist?");
/*     */
/* 519 */         throw new Exception("Primary Key Problem");
/*     */       }
/*     */       catch (NullPointerException e) {
/* 522 */         this.logger.error("Unable to identify Bean's Primary Key class! Did you specify a primary key class and/or field? Does that field exist?");
/*     */
/* 525 */         throw new Exception("Primary Key Problem");
/*     */       }
/*     */
/* 528 */       this.ejbMetaData = new EJBMetaDataImplIIOP(((EJBProxyFactoryContainer)this.container).getRemoteClass(), ((EJBProxyFactoryContainer)this.container).getHomeClass(), pkClass, false, false, this.ejbHome);
/*     */     }
/*     */     else
/*     */     {
/* 539 */       this.beanServantRegistry = this.servantRegistries.getServantRegistry(registryWithTransientPOA);
/*     */
/* 542 */       if (((SessionMetaData)this.container.getBeanMetaData()).isStateless())
/*     */       {
/* 545 */         this.ejbMetaData = new EJBMetaDataImplIIOP(((EJBProxyFactoryContainer)this.container).getRemoteClass(), ((EJBProxyFactoryContainer)this.container).getHomeClass(), null, true, true, this.ejbHome);
/*     */       }
/*     */       else
/*     */       {
/* 557 */         this.ejbMetaData = new EJBMetaDataImplIIOP(((EJBProxyFactoryContainer)this.container).getRemoteClass(), ((EJBProxyFactoryContainer)this.container).getHomeClass(), null, true, false, this.ejbHome);
/*     */       }
/*     */
/*     */     }
/*     */
/* 569 */     InterfaceDef beanInterfaceDef = null;
/* 570 */     if (this.iri != null) {
/* 571 */       Repository ir = this.iri.getReference();
/* 572 */       beanInterfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(this.beanRepositoryIds[0]));
/*     */     }
/*     */
/* 576 */     String beanServantLoggerName = EjbObjectCorbaServant.class.getName() + '.' + this.jndiName;
/*     */
/* 579 */     ServantWithMBeanServer beanServant = new EjbObjectCorbaServant(this.container.getJmxName(), this.container.getClassLoader(), this.poaCurrent, this.beanMethodMap, this.beanRepositoryIds, beanInterfaceDef, Logger.getLogger(beanServantLoggerName));
View Full Code Here

/* 333 */     Policy[] policies = { codebasePolicy, csiv2Policy };
/*     */
/* 335 */     InterfaceDef interfaceDef = null;
/* 336 */     if (this.iri != null)
/*     */     {
/* 338 */       Repository ir = this.iri.getReference();
/* 339 */       interfaceDef = InterfaceDefHelper.narrow(ir.lookup_id(this.beanRepositoryIds[0]));
/*     */     }
/*     */
/* 342 */     Current poaCurrent = CurrentHelper.narrow(this.orb.resolve_initial_references("POACurrent"));
/*     */
/* 344 */     NamingContextExt ctx = getNamingContextExt();
View Full Code Here

        }

        Servant servant =  new RepositoryPOATie( this );
        ifrPOA.activate_object_with_id("IfR".getBytes(), servant);

        Repository myRef =
            RepositoryHelper.narrow(
                    ifrPOA.servant_to_reference( servant ) );

        for( int i = 0; strtok.hasMoreTokens(); i++ )
        {
View Full Code Here

    {
        try
        {
            ORB orb = (ORB) container.getComponentInstance(ORB.class);

            Repository repository = RepositoryHelper.narrow(orb.resolve_initial_references("InterfaceRepository"));

            return repository;
        }
        catch (InvalidName e)
        {
View Full Code Here

     * This method was created by a SmartGuide.
     * @param args java.lang.String[]
     */
    public static void main(String args[]) {
        try {
            Repository rep    = RepositoryHelper.narrow( orb.resolve_initial_references("InterfaceRepository"));
            PrimitiveDef prim  = rep.get_primitive(PrimitiveKind.pk_short);

            InterfaceDef intf = InterfaceDefHelper.narrow( prim._get_interface_def());
            ObjectRepresentant objr = ObjectRepresentantFactory.create(prim,RemoteTypeSystem.createTypeSystemNode(intf),null);
            ModelBuilder.getSingleton().buildTreeModelAsync(objr);
        }
View Full Code Here

TOP

Related Classes of org.omg.CORBA.Repository

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.