예제 #1
0
 private void loadDSLFiles() {
   // now we load up the DSL files
   builder.setDSLFiles(
       BRMSPackageBuilder.getDSLMappingFiles(
           pkg,
           new BRMSPackageBuilder.DSLErrorEvent() {
             public void recordError(AssetItem asset, String message) {
               errors.add(new ContentAssemblyError(asset, message));
             }
           }));
 }
예제 #2
0
  public String getDRL() {
    StringBuffer src = new StringBuffer();
    src.append("package " + this.pkg.getName() + "\n");
    src.append(ServiceImplementation.getDroolsHeader(this.pkg) + "\n\n");

    // now we load up the DSL files
    builder.setDSLFiles(
        BRMSPackageBuilder.getDSLMappingFiles(
            pkg,
            new BRMSPackageBuilder.DSLErrorEvent() {
              public void recordError(AssetItem asset, String message) {
                errors.add(new ContentAssemblyError(asset, message));
              }
            }));

    // do the functions and declared types.
    AssetItemIterator it =
        this.pkg.listAssetsByFormat(new String[] {AssetFormats.FUNCTION, AssetFormats.DRL_MODEL});
    while (it.hasNext()) {
      AssetItem func = (AssetItem) it.next();
      if (!func.isArchived()) {
        src.append(func.getContent() + "\n\n");
      }
    }

    // now the rules
    Iterator iter = pkg.getAssets();
    while (iter.hasNext()) {
      AssetItem asset = (AssetItem) iter.next();
      if (!asset.isArchived()) {

        ContentHandler h = ContentManager.getHandler(asset.getFormat());
        if (h instanceof IRuleAsset) {
          IRuleAsset ruleAsset = (IRuleAsset) h;
          ruleAsset.assembleDRL(builder, asset, src);
        }

        src.append("\n\n");
      }
    }

    return src.toString();
  }