Package org.jboss.weld.environment.se

Examples of org.jboss.weld.environment.se.Weld


               initLogging();

               boolean restarting = restartRequested;
               restartRequested = false;

               Weld weld = new ModularWeld();
               BeanManager manager = null;

               // FIXME this plugin loading scheme causes classloading issues w/weld because weld cannot load classes
               // from its own classloaders before plugins are loaded and pollute the classpath.
               // We can work around it by loading weld before we load plugins, then restarting weld, but this is SLOW.
               try
               {
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
                  weld.shutdown();
               }
               catch (Exception e)
               {
               }

               try
               {
                  // TODO verify plugin API versions. only activate compatible plugins.
                  loadPlugins();
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
               }
               catch (Throwable e)
               {
                  // Boot up with external plugins disabled.
                  System.out
                           .println("Plugin system disabled due to failure while loading one or more plugins; try removing offending plugins with \"forge remove-plugin <TAB>\".");
                  e.printStackTrace();

                  Thread.currentThread().setContextClassLoader(mainClassLoader);

                  initLogging();
                  WeldContainer container = weld.initialize();
                  manager = container.getBeanManager();
               }
               try
               {
                  manager.fireEvent(new PreStartup());
               }
               catch (Throwable t)
               {
                  System.out.println("Error during PreStartup event");
                  t.printStackTrace();
               }
               try
               {
                  manager.fireEvent(new Startup(workingDir, restarting));
               }
               catch (Throwable t)
               {
                  System.out.println("Error during Startup event");
                  t.printStackTrace();
               }
               try
               {

                  manager.fireEvent(new PostStartup());
               }
               catch (Throwable t)
               {
                  System.out.println("Error during PostStartup event");
                  t.printStackTrace();
               }
               try
               {
                  manager.fireEvent(new AcceptUserInput());
               }
               catch (Throwable t)
               {
                  System.out.println("Error during AcceptUserInput event");
                  t.printStackTrace();
               }
               weld.shutdown();
            }
         });

         currentShell.start();
         try
View Full Code Here


    }

    @Test
    public void testCDI() {
        // DROOLS-34
        Weld w = new Weld();
        WeldContainer wc = w.initialize();

        CDIBean bean = wc.instance().select(CDIBean.class).get();
        bean.test(env);

        w.shutdown();
    }
View Full Code Here

        ksession.insert(new Message("Dave", "Hello, HAL. Do you read me, HAL?"));
        ksession.fireAllRules();
    }

    public static void main(String[] args) {
        Weld w = new Weld();

        WeldContainer wc = w.initialize();
        CDIInstanceExample bean = wc.instance().select(CDIInstanceExample.class).get();
        bean.go(System.out);

        w.shutdown();
    }
View Full Code Here

  private CarServiceApp app;

  @Before
  public void setup() {
    // Start Weld - this initiates the CDI container
    weld = new Weld();
    WeldContainer container = weld.initialize();
    app = container.instance().select(CarServiceApp.class).get();
  }
View Full Code Here


    @Override
    public synchronized void boot()
    {
        weld = new Weld();
        weldContainer = weld.initialize();
    }
View Full Code Here


    private WeldContainer getWeldContainer() {
        if (weldContainer == null) {
            try {
                weldContainer = (new Weld()).initialize();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return weldContainer;
View Full Code Here

        LogManager.initLogging(config.getLogLevel());
        logger.log(Level.INFO, "--------------------------------------------");
        logger.log(Level.INFO, "Starting " + ApplicationInfo.APPLICATION_NAME);

        // Init Weld CDI
        weld = new Weld();

        // Get the command line parameters
        logger.log(Level.CONFIG, "Parsing command line options...");
        CliManager cli = new CliManager();
        List<String> params = new ArrayList<>();
View Full Code Here

    @Before
    public void before() {
        TestConsumer.resetCount();
        // Initializes the weld container
        WeldContainer container = new Weld().initialize();
        Instance<Object> instancePool = container.instance();
        eventBinder = instancePool.select(TestEventBinder.class).get();
    }
View Full Code Here

    @Before
    public void before() {
        TestConsumer.resetCount();
        // Initializes the weld container
        WeldContainer container = new Weld().initialize();
        instancePool = container.instance();
    }
View Full Code Here

                TestSetup.TEST_QUEUE_ONE, TestSetup.TEST_EXCHANGE_ONE, TestSetup.TEST_ROUTING_KEY_ONE);
        brokerSetup.declareAndBindQueue(
                TestSetup.TEST_QUEUE_TWO, TestSetup.TEST_EXCHANGE_TWO, TestSetup.TEST_ROUTING_KEY_TWO);
        brokerAssert = new BrokerAssert();
        // Initializes the weld container
        WeldContainer container = new Weld().initialize();
        Instance<Object> instancePool = container.instance();
        eventControl = container.event();
        eventBinder = instancePool.select(TestEventBinder.class).get();
        ConnectionFactory connectionFactory = instancePool.select(ConnectionFactory.class).get();
        connectionFactory.setHost(brokerSetup.getHost());
View Full Code Here

TOP

Related Classes of org.jboss.weld.environment.se.Weld

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.