public List<DeploymentUnit> getChildren() { return delegate.getChildren(); }
private static <T> void getAllAttachments(DeploymentUnit unit, Class<T> type, ArrayList<T> attachments) { T attachment = unit.getAttachment(type); if(attachment != null) attachments.add(attachment); List<DeploymentUnit> children = unit.getChildren(); if(children != null) for(DeploymentUnit child : children) getAllAttachments(child, type, attachments); }
private static <T> void getAllAttachments(DeploymentUnit unit, Class<T> type, ArrayList<T> attachments) { T attachment = unit.getAttachment(type); if(attachment != null) attachments.add(attachment); List<DeploymentUnit> children = unit.getChildren(); if(children != null) for(DeploymentUnit child : children) getAllAttachments(child, type, attachments); }
private static DeploymentUnit findLinkPath(DeploymentUnit top, String path) { List<DeploymentUnit> children = top.getChildren(); DeploymentUnit targetUnit = null; if(children != null) { for(DeploymentUnit child : children) { String childPath = child.getRelativePath(); if(childPath.endsWith(path)) { targetUnit = child; } } } if (targetUnit == null) { return null; } if (log.isTraceEnabled()) { log.trace("Found appropriate DeploymentUnit: " + targetUnit); } return targetUnit; }
private void fill(Collection<ArchiveInfo> archiveInfos, DeploymentUnit unit) { ArchiveInfo archiveInfo = unit.getAttachment(ArchiveInfo.class); if (archiveInfo != null) { archiveInfos.add(archiveInfo); } for (DeploymentUnit child: unit.getChildren()) { fill(archiveInfos, child); } } }
private static String findWithinApplication(DeploymentUnit unit, String name) { String jndiName = findWithinModule(unit, name); if(jndiName != null) return jndiName; for(DeploymentUnit child : unit.getChildren()) { jndiName = findWithinApplication(child, name); if(jndiName != null) return jndiName; } return null; }
/** * Find all anotation environments recursively. * * @param unit the current deployment unit * @param list the holder list */ protected void findAllAnnotationEnvironments(DeploymentUnit unit, List<AnnotationEnvironment> list) { applyAnnotationEnvironment(unit, list); List<DeploymentUnit> children = unit.getChildren(); if (children != null && children.isEmpty() == false) { for (DeploymentUnit child : children) { findAllAnnotationEnvironments(child, list); } } }
private void getEjbDeploymentPaths(DeploymentUnit unit, ArrayList<String> paths) { if(unit.isAttachmentPresent(JBossMetaData.class)) paths.add(unit.getRelativePath()); // Process children List<DeploymentUnit> children = unit.getChildren(); if(children != null) { for(DeploymentUnit child : children) getEjbDeploymentPaths(child, paths); } }
private List<org.jboss.deployers.structure.spi.DeploymentUnit> getChildrenRecursively(final org.jboss.deployers.structure.spi.DeploymentUnit deploymentUnit) { List<org.jboss.deployers.structure.spi.DeploymentUnit> allChildren = new ArrayList<org.jboss.deployers.structure.spi.DeploymentUnit>(); List<org.jboss.deployers.structure.spi.DeploymentUnit> children = deploymentUnit.getChildren(); if (children != null && !children.isEmpty()) { allChildren.addAll(children); // find child DU of each child for (org.jboss.deployers.structure.spi.DeploymentUnit child : children) { if (child == null) { continue; } allChildren.addAll(this.getChildrenRecursively(child)); } } // check component DUs too final List<org.jboss.deployers.structure.spi.DeploymentUnit> componentDUs = deploymentUnit.getComponents(); if (componentDUs != null && !componentDUs.isEmpty()) { allChildren.addAll(componentDUs); // find child DU of each component DU for (org.jboss.deployers.structure.spi.DeploymentUnit componentDU : componentDUs) { if (componentDU == null) { continue; } allChildren.addAll(this.getChildrenRecursively(componentDU)); } } return allChildren; }
/** * Search deployment hierarchy for beans.xml files. * * @param unit the deployment unit * @param includeChildren whether children should be searched as well * @return true if beans.xml files exist, false otherwise */ public static boolean checkForWeldFiles(DeploymentUnit unit, boolean includeChildren) { Collection files = unit.getAttachment(WELD_FILES, Collection.class); if (files != null && files.isEmpty() == false) return true; if (includeChildren) { List<DeploymentUnit> children = unit.getChildren(); if (children != null && children.isEmpty() == false) { for (DeploymentUnit child : children) { boolean result = checkForWeldFiles(child, true); if (result) return true; } } } return false; } }
private static DeploymentUnit getDeploymentUnit(DeploymentUnit current, String path) { if(path.startsWith("/")) return getDeploymentUnit(current.getTopLevel(), path.substring(1)); if(path.startsWith("./")) return getDeploymentUnit(current, path.substring(2)); if(path.startsWith("../")) return getDeploymentUnit(current.getParent(), path.substring(3)); int i = path.indexOf('/'); String name; if(i == -1) name = path; else name = path.substring(0, i); for(DeploymentUnit child : current.getChildren()) { if(child.getSimpleName().equals(name)) return child; } throw new IllegalArgumentException("Can't find a deployment unit named " + name + " at " + current); }
private void recurse(DeploymentUnit current, ScanningPlugin<T, U> plugin, Set<U> handles, boolean allowModule) { // do not recurse into sub-deployments that have their own Module if (allowModule == false && current.isAttachmentPresent(Module.class)) return; U handle = current.getAttachment(plugin.getAttachmentKey(), plugin.getHandleInterface()); if (handle != null) handles.add(handle); for (DeploymentUnit child : current.getChildren()) { recurse(child, plugin, handles, false); } } }
List<DeploymentUnit> children = unit.getChildren(); if (children != null && children.isEmpty() == false)
Iterator<DeploymentUnit> it = unit.getChildren().iterator(); while (it.hasNext())
return jndiName; List<DeploymentUnit> children = du.getChildren(); if(children != null)
public static Collection<String> getVisibleEJbNames(DeploymentUnit du) { // Ensure it's an EJB3 DU (by looking for the processed metadata) List<String> ejbNames = new ArrayList<String>(); if (du.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && du.getAttachment(JBossMetaData.class).isEJB3x()) { JBossMetaData jBossMetaData = du.getAttachment(JBossMetaData.class); for (JBossEnterpriseBeanMetaData enterpriseBeanMetaData : jBossMetaData.getEnterpriseBeans()) { ejbNames.add(enterpriseBeanMetaData.getEjbName()); } } List<DeploymentUnit> children = du.getChildren(); if (children != null && children.isEmpty() == false) { //scan children, but exclude wars for (DeploymentUnit childDu : children) { if (childDu.getAttachment(JBossWebMetaData.class) == null) { ejbNames.addAll(getVisibleEJbNames(childDu)); } } } return ejbNames; } }
return deploymentUnit; for(DeploymentUnit child : deploymentUnit.getChildren())
private static String getPersistenceUnitSupplier(DeploymentUnit deploymentUnit, PersistenceUnitDependencyResolver persistenceUnitDependencyResolver, String persistenceUnitName) { if ((deploymentUnit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && deploymentUnit.getAttachment(JBossMetaData.class).isEJB3x()) || (deploymentUnit.getAttachment(JBossWebMetaData.class) != null)) { try { return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName); } catch (IllegalArgumentException e) { // No-op, means we can't find the PU in this DU } } for (DeploymentUnit child : deploymentUnit.getChildren()) { String beanName = getPersistenceUnitSupplier(child, persistenceUnitDependencyResolver, persistenceUnitName); if (beanName != null) { return beanName; } } return null; } }
private static String getPersistenceUnitSupplier(DeploymentUnit deploymentUnit, PersistenceUnitDependencyResolver persistenceUnitDependencyResolver, String persistenceUnitName) { if ((deploymentUnit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class) != null && deploymentUnit.getAttachment(JBossMetaData.class).isEJB3x()) || (deploymentUnit.getAttachment(JBossWebMetaData.class) != null)) { try { return persistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName); } catch (IllegalArgumentException e) { // No-op, means we can't find the PU in this DU } } for (DeploymentUnit child : deploymentUnit.getChildren()) { String beanName = getPersistenceUnitSupplier(child, persistenceUnitDependencyResolver, persistenceUnitName); if (beanName != null) { return beanName; } } return null; }
List<DeploymentUnit> children = unit.getChildren(); if(children != null)