public boolean streamIndividualFactory() {
    ModelCompiler compiler = ModelCompilerFactory.newModelCompiler(ModelFactory.CompileTarget.XSDX);
    SemanticXSDModel xsdModel;

    xsdModel = (SemanticXSDModel) compiler.compile(model);
    boolean success = false;

    try {
      String classPath =
          getXjcDir().getPath()
              + File.separator
              + xsdModel.getDefaultPackage().replace(".", File.separator);
      File f = new File(classPath);
      if (!f.exists()) {
        f.mkdirs();
      }

      FileOutputStream fos =
          new FileOutputStream(classPath + File.separator + "IndividualFactory.java");
      success = xsdModel.streamIndividualFactory(fos);
      fos.flush();
      fos.close();

    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return success;
  }
  public boolean streamDRLDeclares() throws MojoExecutionException {
    ModelCompiler compiler = ModelCompilerFactory.newModelCompiler(ModelFactory.CompileTarget.DRL);
    boolean success;

    DRLModel drlModel = (DRLModel) compiler.compile(model);

    try {
      FileOutputStream fos =
          new FileOutputStream(
              getDrlDir().getPath() + File.separator + model.getName() + "_declare.drl");
      success = drlModel.stream(fos);
      fos.flush();
      fos.close();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
    return success;
  }
  public boolean streamJavaInterfaces(boolean includeJar) {
    ModelCompiler jcompiler = ModelCompilerFactory.newModelCompiler(ModelFactory.CompileTarget.JAR);
    JarModel jarModel = (JarModel) jcompiler.compile(model);

    boolean success = jarModel.save(getJavaDir().getPath());

    if (includeJar) {
      try {
        FileOutputStream fos =
            new FileOutputStream(getBinDir().getPath() + File.separator + model.getName() + ".jar");
        byte[] content = jarModel.buildJar().toByteArray();

        fos.write(content, 0, content.length);
        fos.flush();
        fos.close();
      } catch (IOException e) {
        e.printStackTrace();
        return false;
      }
    }
    return success;
  }
  public boolean streamXSDsWithBindings(boolean includePersistenceConfiguration) {
    SemanticXSDModelCompiler xcompiler =
        (SemanticXSDModelCompiler)
            ModelCompilerFactory.newModelCompiler(ModelFactory.CompileTarget.XSDX);
    SemanticXSDModel xmlModel = (SemanticXSDModel) xcompiler.compile(model);

    xmlModel.streamAll(System.err);

    boolean success = false;
    try {
      success = xmlModel.stream(getMetaInfDir());

      success = xmlModel.streamBindings(getMetaInfDir());

      if (includePersistenceConfiguration) {
        success = success && streamPersistenceConfigs(xcompiler, xmlModel);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return success;
  }