[jboss-dev-forums] [Deployers on JBoss (Deployers/JBoss)] - Re: jee module's alt-dd

alex.loubyansky@jboss.com do-not-reply at jboss.com
Fri Apr 11 09:03:30 EDT 2008


A bit more generalized, how does this look? The change that is in this example in the EjbParsingDeployer could probably be in the SchemaResolverDeployer?

Index: org/jboss/deployment/AppParsingDeployer.java
  | +   protected EarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EarMetaData root) throws Exception
  | +   {
  | +      EarMetaData ear = super.parse(unit,file, root);
  | +      List<DeploymentUnit> children = unit.getChildren();
  | +      if(children != null)
  | +      {
  | +         for(DeploymentUnit child : children)
  | +         {
  | +            String moduleName = child.getSimpleName();
  | +            ModuleMetaData module = ear.getModules().get(moduleName);
  | +            if(module != null && module.getAlternativeDD() != null)
  | +            {
  | +               VirtualFile altDDFile = unit.getRoot().getChild(module.getAlternativeDD());
  | +               if(altDDFile == null)
  | +                  throw new IllegalStateException("Failed to locate alternative DD '" + module.getAlternativeDD() + "' in " + unit.getRoot().getPathName());
  | +               child.addAttachment(child.getSimpleName() + ".altDD", altDDFile);
  | +               log.info("attached alt-dd " + altDDFile + " for " + child.getSimpleName());
  | +            }
  | +         }
  | +      }
  | +      
  | +      return ear;
  | +   }
  |  }
  | Index: org/jboss/deployment/EjbParsingDeployer.java
  |     @Override
  | -   protected void init(VFSDeploymentUnit unit, EjbJarMetaData metaData, VirtualFile file) throws Exception
  | +   protected EjbJarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EjbJarMetaData root) throws Exception
  |     {
  | -      super.init(unit, metaData, file);
  | +      VirtualFile altDDFile = (VirtualFile) unit.getAttachment(unit.getSimpleName() + ".altDD");
  | +      if(altDDFile != null)
  | +      {
  | +         log.info("using alt-dd: " + altDDFile);
  | +         file = altDDFile;
  | +      }
  | +      return super.parse(unit, file, root);
  |     }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143431#4143431

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143431



More information about the jboss-dev-forums mailing list