Package javax.naming

Examples of javax.naming.Context.bind()


        String unit = persistenceUnitGBean.getPersistenceUnitName();
        String rootUrl = persistenceUnitGBean.getPersistenceUnitRoot();
        String id = unit + " " + rootUrl.hashCode();
        Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
        try {
            context.bind("java:openejb/PersistenceUnit/" + id, persistenceUnitGBean.getEntityManagerFactory());
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
View Full Code Here


    private CamelContext configure(StatefulKnowledgeSession session) throws Exception {
        GridImpl grid = new GridImpl(new HashMap<String, Object>());       
        GridNode node = grid.createGridNode("testnode");

        Context context = new JndiContext();
        context.bind("testnode", node);
        node.set("ksession", session);

        CamelContext camelContext = new DefaultCamelContext(context);
        camelContext.addRoutes(new RouteBuilder() {
            @Override
View Full Code Here

     */
    private CamelContext configure(StatefulKnowledgeSession session) throws Exception {
        GridImpl grid = new GridImpl(new HashMap());
        GridNode node = grid.createGridNode("testnode");
        Context context = new JndiContext();
        context.bind("testnode", node);
        node.set("ksession", session);
       
        CamelContext camelContext = new DefaultCamelContext(context);
        camelContext.addRoutes(new RouteBuilder() {
            @Override
View Full Code Here

        node.set( "ksession1",
                  this.exec );
       
      
       
        context.bind( "node",
                      node );
        return context;
    }

    @Override
View Full Code Here

        GridImpl grid = new GridImpl( new HashMap() );
        node = grid.createGridNode( "node" );
        node.set( "ksession1",
                  this.exec );
        context.bind( "node",
                      node );
        return context;
    }

    public void setExec(CommandExecutor exec) {
View Full Code Here

        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());
View Full Code Here

        properties.setProperty("ProtectedDatasource.JtaManaged", "true");

        // start the context and makes junit test injections
        EJBContainer container = EJBContainer.createEJBContainer(properties);
        Context context = container.getContext();
        context.bind("inject", this);

        // test the datasource
        assertNotNull(dataSource);
        assertNotNull(dataSource.getConnection());
View Full Code Here

        InitialContext context = new InitialContext();

        Context javaContext = (Context) context.lookup("java:");

        javaContext.bind("java:TransactionManager", new JndiUrlReference("java:comp/TransactionManager"));
        javaContext.bind("java:TransactionManagerLink", new LinkRef("java:comp/TransactionManager"));

        assertTrue(context.lookup("java:TransactionManager") instanceof TransactionManager);
        assertTrue(context.lookup("java:TransactionManagerLink") instanceof TransactionManager);
View Full Code Here

        InitialContext context = new InitialContext();

        Context javaContext = (Context) context.lookup("java:");

        javaContext.bind("java:TransactionManager", new JndiUrlReference("java:comp/TransactionManager"));
        javaContext.bind("java:TransactionManagerLink", new LinkRef("java:comp/TransactionManager"));

        assertTrue(context.lookup("java:TransactionManager") instanceof TransactionManager);
        assertTrue(context.lookup("java:TransactionManagerLink") instanceof TransactionManager);

        new InitialContext().bind("java:foo", new LinkRef("java:comp/TransactionManager"));
View Full Code Here

                Map.Entry entry = (Map.Entry) iterator.next();
                String name = (String) entry.getKey();
                Object value = entry.getValue();
                if (value == null) continue;
                try {
                    context.bind(name, value);
                } catch (NamingException e) {
                    throw new org.apache.openejb.SystemException("Unable to bind '" + name + "' into bean's enc.", e);
                }
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.