/** * Parse the file, initialize the result if exists. * * @param unit the deployment unit * @param file the file * @param root the root * @return parsed result * @throws Exception for any error */ protected T parseAndInit(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception { return parseAndInit(unit, file, root, false); }
@Override protected T parse(DeploymentUnit unit, String name, T root) throws Exception { if (ignoreName(unit, name)) return null; // Try to find the metadata VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit; VirtualFile file = getMetadataFile(vfsDeploymentUnit, getOutput(), name, true); return (file != null && ignoreFile(vfsDeploymentUnit, file) == false) ? parseAndInit(vfsDeploymentUnit, file, root) : null; }
@Override protected T parse(DeploymentUnit unit, String name, String suffix, T root) throws Exception { // Should we include the deployment // The infrastructure will only check leafs anyway so no need to check here if (name == null && isIncludeDeploymentFile()) name = unit.getName(); // Try to find the metadata VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit; // let's check altDD first VirtualFile file = getMetadataFile(vfsDeploymentUnit, getOutput(), name, false); if (file != null) return parseAndInit(vfsDeploymentUnit, file, root, true); // try all name+suffix matches List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix, getMetaDataTypeFilter(unit)); switch (files.size()) { case 0 : return null; case 1 : return parseAndInit(vfsDeploymentUnit, files.get(0), root, true); default : return handleMultipleFiles(vfsDeploymentUnit, root, files); } }