@Override
  public void deploy(VFSDeploymentUnit unit, RackApplicationMetaData metaData)
      throws DeploymentException {
    String beanName = AttachmentUtils.beanName(unit, RackApplicationPool.class);
    BeanMetaDataBuilder builder =
        BeanMetaDataBuilder.createBuilder(beanName, RackApplicationPoolImpl.class.getName());

    metaData.setRackApplicationPoolName(beanName);

    String appfactoryBeanName = metaData.getRackApplicationFactoryName();
    if (appfactoryBeanName == null) {
      appfactoryBeanName = AttachmentUtils.beanName(unit, RackApplicationFactory.class);
    }

    String runtimePoolBeanName = metaData.getRubyRuntimePoolName();
    if (runtimePoolBeanName == null) {
      runtimePoolBeanName = AttachmentUtils.beanName(unit, RubyRuntimePool.class, POOL_NAME);
      metaData.setRubyRuntimePoolName(runtimePoolBeanName);
    }

    ValueMetaData runtimePoolInjection = builder.createInject(runtimePoolBeanName);
    ValueMetaData appFactoryInjection = builder.createInject(appfactoryBeanName);

    builder.addConstructorParameter(RubyRuntimePool.class.getName(), runtimePoolInjection);
    builder.addConstructorParameter(RackApplicationFactory.class.getName(), appFactoryInjection);

    AttachmentUtils.attach(unit, builder.getBeanMetaData());
    if (null == AttachmentUtils.getAttachment(unit, POOL_NAME, PoolMetaData.class)) {
      AttachmentUtils.multipleAttach(unit, new PoolMetaData(POOL_NAME), POOL_NAME);
    }
  }
  public void deploy(DeploymentUnit unit) throws DeploymentException {
    Set<? extends RubyEndpointMetaData> allMetaData =
        unit.getAllMetaData(RubyEndpointMetaData.class);

    if (allMetaData.size() == 0) {
      return;
    }

    log.debug("deploying for: " + unit);

    BeanMetaData busMetaData =
        unit.getAttachment(BeanMetaData.class + "$cxf.bus", BeanMetaData.class);

    RubyDynamicClassLoader classLoader = unit.getAttachment(RubyDynamicClassLoader.class);

    for (RubyEndpointMetaData endpointMetaData : allMetaData) {
      String beanName = getBeanName(unit, endpointMetaData.getName());
      BeanMetaDataBuilder builder =
          BeanMetaDataBuilder.createBuilder(beanName, RubyTypeSpace.class.getName());

      builder.addPropertyMetaData("rubyPath", "jboss/databinding/" + endpointMetaData.getName());
      builder.addPropertyMetaData("wsdlLocation", endpointMetaData.getWsdlLocation());
      builder.addPropertyMetaData("rubyDynamicClassLoader", classLoader);

      ValueMetaData busInjection = builder.createInject(busMetaData.getName());
      builder.addPropertyMetaData("bus", busInjection);

      BeanMetaData beanMetaData = builder.getBeanMetaData();
      unit.addAttachment(
          BeanMetaData.class.getName() + "$databinding." + endpointMetaData.getName(),
          beanMetaData,
          BeanMetaData.class);
    }
  }
  @Override
  protected void internalDeploy(DeploymentUnit unit) throws DeploymentException {
    if (!isJavaEEModule(unit)) return;

    // appName is either the name of the JavaEE application or null for a stand-alone JavaEE module
    String appName = informer.getApplicationName(unit);
    String moduleName = informer.getModuleName(unit);

    // create JavaEEModule bean
    String name = "jboss.naming:";
    if (appName != null) name += "application=" + appName + ",";
    name += "module=" + moduleName;
    BeanMetaDataBuilder builder =
        BeanMetaDataBuilderFactory.createBuilder(name, MCJavaEEModule.class.getName())
            //         .addAnnotation(annotation(DeploymentScope.class, moduleName))
            .addConstructorParameter(String.class.getName(), moduleName)
        //         .addAlias("java:module")
        ;
    if (appName != null) {
      //         builder.addAnnotation(annotation(ApplicationScope.class, appName));
      //         AbstractInjectionValueMetaData javaApp = new
      // AbstractInjectionValueMetaData("java:app");
      //         javaApp.setSearch(new ParentsLookupStrategy());
      AbstractInjectionValueMetaData javaApp =
          new AbstractInjectionValueMetaData("jboss.naming:application=" + appName);
      builder.addConstructorParameter(JavaEEApplication.class.getName(), javaApp);
    } else builder.addConstructorParameter(JavaEEApplication.class.getName(), (Object) null);
    builder.addPropertyMetaData("nameSpaces", builder.createInject("NameSpaces"));

    unit.addAttachment(BeanMetaData.class + "." + name, builder.getBeanMetaData());
  }
Пример #4
0
  @Override
  protected void internalDeploy(DeploymentUnit unit) throws DeploymentException {
    JBossEnterpriseBeanMetaData beanMetaData =
        unit.getAttachment(JBossEnterpriseBeanMetaData.class);
    if (beanMetaData == null) return;

    if (!beanMetaData.isSession()) return;

    JBossSessionBeanMetaData sessionBeanMetaData = (JBossSessionBeanMetaData) beanMetaData;

    String appName = getApplicationName(unit);
    String moduleName = getModuleName(unit);
    String componentName = getComponentName(unit);

    String javaCompName = "jboss.naming:";
    if (appName != null) javaCompName += "application=" + appName + ",";
    javaCompName += "module=" + moduleName + ",component=" + componentName;

    String sessionBeanTypeName = "jboss.ejb3:";
    if (appName != null) sessionBeanTypeName += "application=" + appName + ",";
    sessionBeanTypeName +=
        "module="
            + moduleName
            + ",component="
            + componentName
            + ",service="
            + SessionBeanTypeWrapper.class.getSimpleName();
    {
      BeanMetaDataBuilder builder =
          BeanMetaDataBuilderFactory.createBuilder(
              sessionBeanTypeName, SessionBeanTypeWrapper.class.getName());
      builder.addConstructorParameter(
          JBossSessionBeanMetaData.class.getName(), sessionBeanMetaData);
      builder.addConstructorParameter(ClassLoader.class.getName(), unit.getClassLoader());
      builder.addConstructorParameter(
          JavaEEComponent.class.getName(), builder.createInject(javaCompName));

      unit.getParent().addAttachment(sessionBeanTypeName, builder.getBeanMetaData());
    }

    String beanInstanceName = "jboss.ejb3:";
    if (appName != null) beanInstanceName += "application=" + appName + ",";
    beanInstanceName +=
        "module="
            + moduleName
            + ",component="
            + componentName
            + ",service="
            + EJBBinder.class.getSimpleName();
    BeanMetaDataBuilder builder =
        BeanMetaDataBuilderFactory.createBuilder(beanInstanceName, EJBBinder.class.getName());
    builder.addConstructorParameter(
        SessionBeanType.class.getName(), builder.createInject(sessionBeanTypeName));
    builder.addPropertyMetaData(
        "globalContext", builder.createInject("NameSpaces", "globalContext"));
    builder.addPropertyMetaData("proxyFactory", sessionBeanMetaData.isStateless() ? lazy : legacy);
    builder.setStart("bind");
    builder.setStop("unbind");

    for (DependencyBuilder db : builders) db.buildDependency(unit, builder);

    unit.getParent().addAttachment(beanInstanceName, builder.getBeanMetaData());
  }