protected String[] listRulesInPackage(String packageName) throws SerializationException {
    // load package
    PackageItem item = rulesRepository.loadPackage(packageName);

    PackageDRLAssembler assembler = createPackageDRLAssembler(item);

    List<String> result = new ArrayList<String>();
    try {

      String drl = assembler.getDRL();
      if (drl == null || "".equals(drl)) {
        return new String[0];
      } else {
        parseRulesToPackageList(assembler, result);
      }

      return result.toArray(new String[result.size()]);
    } catch (DroolsParserException e) {
      log.error("Unable to list rules in package", e);
      return new String[0];
    }
  }
 void parseRulesToPackageList(PackageDRLAssembler asm, List<String> result)
     throws DroolsParserException {
   int count = 0;
   StringTokenizer stringTokenizer = new StringTokenizer(asm.getDRL(), "\n\r");
   while (stringTokenizer.hasMoreTokens()) {
     String line = stringTokenizer.nextToken().trim();
     if (line.startsWith("rule ")) {
       String name = getRuleName(line);
       result.add(name);
       count++;
       if (count == MAX_RULES_TO_SHOW_IN_PACKAGE_LIST) {
         result.add("More then " + MAX_RULES_TO_SHOW_IN_PACKAGE_LIST + " rules.");
         break;
       }
     }
   }
 }
  protected String buildPackageSource(String packageUUID) throws SerializationException {

    PackageItem item = rulesRepository.loadPackageByUUID(packageUUID);
    PackageDRLAssembler asm = new PackageDRLAssembler(item);
    return asm.getDRL();
  }