private void buildOthers() {
   try {
     for (Map.Entry<ResourceType, List<ResourceDescr>> entry : resourcesByType.entrySet()) {
       for (ResourceDescr resourceDescr : entry.getValue()) {
         pkgBuilder.setAssetFilter(resourceDescr.getFilter());
         pkgBuilder.addPackageForExternalType(
             resourceDescr.resource, entry.getKey(), resourceDescr.configuration);
         pkgBuilder.setAssetFilter(null);
       }
     }
   } catch (RuntimeException e) {
     throw e;
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
 private void registerDSL() {
   List<ResourceDescr> resourcesByType = this.resourcesByType.remove(ResourceType.DSL);
   if (resourcesByType != null) {
     for (ResourceDescr resourceDescr : resourcesByType) {
       try {
         pkgBuilder.setAssetFilter(resourceDescr.getFilter());
         pkgBuilder.addDsl(resourceDescr.resource);
         pkgBuilder.setAssetFilter(null);
       } catch (RuntimeException e) {
         if (buildException == null) {
           buildException = e;
         }
       } catch (Exception e) {
         if (buildException == null) {
           buildException = new RuntimeException(e);
         }
       }
     }
   }
 }
 private void buildResourceType(ResourceBuilder resourceBuilder, ResourceType resourceType) {
   List<ResourceDescr> resourcesByType = this.resourcesByType.remove(resourceType);
   if (resourcesByType != null) {
     for (ResourceDescr resourceDescr : resourcesByType) {
       try {
         kBuilder.setAssetFilter(resourceDescr.getFilter());
         resourceBuilder.build(kBuilder, resourceDescr);
       } catch (RuntimeException e) {
         if (buildException == null) {
           buildException = e;
         }
       } catch (Exception e) {
         if (buildException == null) {
           buildException = new RuntimeException(e);
         }
       } finally {
         kBuilder.setAssetFilter(null);
       }
     }
   }
 }
 private void registerPackageDescr(
     ResourceDescr resourceDescr,
     Map<String, CompositePackageDescr> packages,
     Resource resource,
     PackageDescr packageDescr) {
   if (packageDescr != null) {
     CompositePackageDescr compositePackageDescr = packages.get(packageDescr.getNamespace());
     if (compositePackageDescr == null) {
       compositePackageDescr = new CompositePackageDescr(resource, packageDescr);
       packages.put(packageDescr.getNamespace(), compositePackageDescr);
     } else {
       compositePackageDescr.addPackageDescr(resource, packageDescr);
     }
     compositePackageDescr.addFilter(resourceDescr.getFilter());
   }
 }
  private void buildResources() {
    List<ResourceDescr> resourcesByType = this.resourcesByType.remove(ResourceType.DRF);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addProcessFromXml(resourceDescr.resource);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }

    resourcesByType = this.resourcesByType.remove(ResourceType.BPMN2);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          BPMN2ProcessFactory.configurePackageBuilder(pkgBuilder);
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addProcessFromXml(resourceDescr.resource);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }

    resourcesByType = this.resourcesByType.remove(ResourceType.PKG);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addPackageFromInputStream(resourceDescr.resource);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }

    resourcesByType = this.resourcesByType.remove(ResourceType.CHANGE_SET);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addPackageFromChangeSet(resourceDescr.resource);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }

    resourcesByType = this.resourcesByType.remove(ResourceType.XSD);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addPackageFromXSD(
              resourceDescr.resource, (JaxbConfigurationImpl) resourceDescr.configuration);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }

    resourcesByType = this.resourcesByType.remove(ResourceType.PMML);
    if (resourcesByType != null) {
      for (ResourceDescr resourceDescr : resourcesByType) {
        try {
          pkgBuilder.setAssetFilter(resourceDescr.getFilter());
          pkgBuilder.addPackageFromPMML(
              resourceDescr.resource, ResourceType.PMML, resourceDescr.configuration);
        } catch (RuntimeException e) {
          if (buildException == null) {
            buildException = e;
          }
        } catch (Exception e) {
          if (buildException == null) {
            buildException = new RuntimeException(e);
          }
        } finally {
          pkgBuilder.setAssetFilter(null);
        }
      }
    }
  }