Package com.caucho.config.inject

Examples of com.caucho.config.inject.InjectManager$InjectBean


    Class<?> beanClass = getBeanSkelClass();
    ArrayList<Class<?>> localApiList = getLocalApiList();
    ArrayList<Class<?>> remoteApiList = getRemoteApiList();

    if (beanClass != null && (localApiList != null || remoteApiList != null)) {
      InjectManager beanManager = InjectManager.create();

      Named named = (Named) beanClass.getAnnotation(Named.class);

      if (named != null) {
      }

      ManagedBeanImpl<T> mBean = beanManager.createManagedBean(getAnnotatedType());

      Class<?> baseApi = beanClass;

      if (localApiList != null) {
        for (Class<?> api : localApiList) {
          baseApi = api;
        }
      }

      if (remoteApiList != null) {
        for (Class<?> api : remoteApiList) {
          baseApi = api;
        }
      }

      _bean = createBean(mBean, baseApi);

      beanManager.addBean(_bean);

      /*
       * if (remoteApiList != null) { for (Class api : remoteApiList) {
       * factory.type(api); } }
       */
 
View Full Code Here


      if (_servletContext instanceof WebApp)
        ((WebApp) _servletContext).createJsp().setLoadTldOnInit(true);
    }

    InjectManager beanManager = InjectManager.create();
    beanManager.addConfiguredBean(servletClassName);
  }
View Full Code Here

      } catch (NamingException e) {
        throw new ServletException(e);
      }
    }

    InjectManager webBeans = InjectManager.create();

    if (_var != null) {
      validateClass(true);

      Object servlet = createServlet(false);

      BeanFactory factory = webBeans.createBeanFactory(servlet.getClass());
      factory.name(_var);

      webBeans.addBean(factory.singleton(servlet));
    }
  }
View Full Code Here

        throw new ServletException(L.l("'{0}' is a missing JSP file.",
                                       _jspFile));
    }

    else if (servletClass != null) {
      InjectManager inject = InjectManager.create();

      _comp = inject.createInjectionTarget(servletClass);

      CreationalContext env = CreationalContextImpl.create();
     
      // server/1b40
      servlet = _comp.produce(env);
View Full Code Here

      throw new ConfigException(L.l("<login> class '{0}' must implement com.caucho.server.security.LoginFilter"));
  }

  public AbstractLogin getLoginObject()
  {
    InjectManager manager = InjectManager.create();

    Bean bean = getComponentFactory();
    CreationalContext env = manager.createCreationalContext(bean);

    return (AbstractLogin) manager.getReference(bean, AbstractLogin.class, env);
  }
View Full Code Here

   */
  @Override
  protected void configureInstanceVariables(WebApp webApp)
    throws Throwable
  {
    InjectManager beanManager = InjectManager.create();
    BeanFactory factory = beanManager.createBeanFactory(WebApp.class);
    factory.type(WebApp.class);
    factory.type(ServletContext.class);
    // factory.stereotype(CauchoDeploymentLiteral.create());

    beanManager.addBean(factory.singleton(webApp));

    Config.setProperty("webApp", getVar());
    Config.setProperty("app", getVar());

    webApp.setRegexp(_regexpValues);
View Full Code Here

  {
    if (getProtocol() != null) {

    }
    else if (_protocolClass != null) {
      InjectManager webBeans = InjectManager.create();

      /*
      Protocol protocol
        = (Protocol) webBeans.createTransientObjectNoInit(_protocolClass);
      */
      InjectionTarget target = webBeans.createManagedBean(_protocolClass);
      CreationalContext env = webBeans.createCreationalContext(null);

      AbstractProtocol protocol = (AbstractProtocol) target.produce(env);
      target.inject(protocol, env);

      if (_init != null)
View Full Code Here

    if (getInit() != null)
      bean.setInit(getInit());

    String loc = getInstanceClass().getName() + ": ";
    InjectManager webBeans = InjectManager.create();

    bean.setMessageConsumerMax(_messageConsumerMax);

    if (_destination != null) {
      bean.setDestinationValue((Destination) _destination);
    }
    else if (_activationSpec != null) {
      bean.setActivationSpec(_activationSpec);
    }
    else {
      Class destinationType = _destinationType;

      if (_destinationType == null)
        destinationType = Destination.class;

      Set<Bean<?>> beanSet;

      if (_destinationName != null)
        beanSet = webBeans.getBeans(_destinationName);
      else
        beanSet = webBeans.getBeans(destinationType);

      Object destComp = null;

      if (beanSet.size() > 0) {
        Bean destBean = webBeans.resolve(beanSet);
        CreationalContext env = webBeans.createCreationalContext(destBean);

        destComp
          = webBeans.getReference(destBean, destBean.getBeanClass(), env);
      }

      if (destComp == null)
        throw new ConfigException(L.l("{0}: '{1}' is an unknown destination type '{2}'",
                                      loc,
                                      _destinationName,
                                      _destinationType.getName()));

      bean.setDestinationValue((Destination) destComp);

      beanSet = webBeans.getBeans(ConnectionFactory.class);

      Bean factoryBean = webBeans.resolve(beanSet);
      CreationalContext env = webBeans.createCreationalContext(factoryBean);

      Object comp = webBeans.getReference(factoryBean);

      if (comp == null)
        throw new ConfigException(L.l("ejb-message-bean requires a configured JMS ConnectionFactory"));
      bean.setConnectionFactoryValue((ConnectionFactory) comp);
    }
View Full Code Here

    ResinELContext elContext = _args.getELContext();

    // XXX: needs to be config

    InjectManager webBeans = InjectManager.create();

    Config.setProperty("resinHome", elContext.getResinHome());
    Config.setProperty("resin", elContext.getResinVar());
    Config.setProperty("server", elContext.getServerVar());
    Config.setProperty("java", elContext.getJavaVar());
    Config.setProperty("system", System.getProperties());
    Config.setProperty("getenv", System.getenv());

    ResinConfigLibrary.configure(webBeans);

    _watchdogPort = _args.getWatchdogPort();

    readConfig(_args);

    WatchdogChild server = null;

    if (_args.isDynamicServer()) {
      String serverId = _args.getDynamicAddress() + "-"
                        + _args.getDynamicPort();
      server = _watchdogMap.get(serverId);
    }
    else
      server = _watchdogMap.get(_args.getServerId());

    if (server == null)
      throw new IllegalStateException(L().l("'{0}' is an unknown server",
                                            _args.getServerId()));
   
    JniBoot boot = new JniBoot();
    Path logDirectory = getLogDirectory();

    if (boot.isValid()) {
      if (! isLogDirectoryExists) {
        logDirectory.mkdirs();

        boot.chown(logDirectory, server.getUserName(), server.getGroupName());
      }
    }


    server.getConfig().logInit(logStream);

    Resin resin = Resin.createWatchdog();

    resin.preConfigureInit();
    resin.setConfigFile(_args.getResinConf().getNativePath());

    Thread thread = Thread.currentThread();
    thread.setContextClassLoader(resin.getClassLoader());

    Cluster cluster = resin.createCluster();
    ClusterServer clusterServer = cluster.createServer();
    // cluster.addServer(clusterServer);

    clusterServer.setId("");
    clusterServer.setPort(0);

    // clusterServer.addHttp(http);

    cluster.addServer(clusterServer);

    resin.addCluster(cluster);

    _server = resin.createServer();
   
    thread.setContextClassLoader(_server.getClassLoader());
   
    _httpPort = _server.createHttp();
    if (_watchdogPort > 0)
      _httpPort.setPort(_watchdogPort);
    else
      _httpPort.setPort(server.getWatchdogPort());

    _httpPort.setAddress(server.getWatchdogAddress());

    _httpPort.setAcceptThreadMin(1);
    _httpPort.setAcceptThreadMax(2);

    _httpPort.init();
   
   
    _server.bindPorts();
   
    ClassLoader oldLoader = thread.getContextClassLoader();

    try {
      thread.setContextClassLoader(_server.getClassLoader());

      webBeans = InjectManager.create();
      AdminAuthenticator auth = null;

      if (_management != null)
        auth = _management.getAdminAuthenticator();

      if (auth != null) {
        BeanFactory<Authenticator> factory = webBeans.createBeanFactory(Authenticator.class);

        factory.type(Authenticator.class);
        factory.type(AdminAuthenticator.class);
        factory.binding(CurrentLiteral.CURRENT);

        webBeans.addBean(factory.singleton(auth));
      }

      DependencyCheckInterval depend = new DependencyCheckInterval();
      depend.setValue(new Period(-1));
      depend.init();
View Full Code Here

      if (raClass == null)
        throw error(L.l("resource-adapter class does not exist for activation-spec '{0}'.  Make sure the .rar file for the driver is properly installed.",
                        raClass.getName()));

      InjectManager webBeans = InjectManager.create();

      ResourceAdapter ra
        = (ResourceAdapter) webBeans.getReference(raClass);

      if (ra == null) {
        throw error(L.l("resource-adapter '{0}' must be configured in a <connector> tag.",
                        raClass.getName()));
      }
View Full Code Here

TOP

Related Classes of com.caucho.config.inject.InjectManager$InjectBean

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.