コード例 #1
0
  protected static void createXslFile(String fileName, MappingScript script) throws IOException {
    File xsltDir =
        ConfigSingleton.getRepoxContextUtil()
            .getRepoxManager()
            .getMetadataTransformationManager()
            .getXsltDir();
    if (!xsltDir.exists()) xsltDir.mkdirs();

    File xslFile = new File(xsltDir, fileName.toLowerCase() + XSL_END);
    StreamResult tmpResult = new StreamResult(new FileOutputStream(xslFile));
    XsltStylesheet xslt =
        new XSLTCompiler(new ToolsetManagerImpl<XsltFunction>(XsltToolsetLibrary.getToolsets()))
            .compile(script);

    new XsltWriter().write(xslt, tmpResult);
    tmpResult.getOutputStream().close();

    /* DUMMY FILE CREATION CODE
    File xsltDir = ConfigSingleton.getRepoxContextUtil().getRepoxManager().getMetadataTransformationManager().getXsltDir();
    if(!xsltDir.exists())
        xsltDir.mkdirs();

    tmpFile = new File(xsltDir, fileName.toLowerCase()+XSL_END);
    FileWriter fstream = new FileWriter(tmpFile);
    BufferedWriter outFile = new BufferedWriter(fstream);
    outFile.write("<This is a dummy xslt>");
    outFile.close();*/

    // System.out.println("SERVER - XSL created");
  }
コード例 #2
0
  protected static void createXmapFile(String fileName, MappingScript script) throws IOException {
    File xmapDir =
        ConfigSingleton.getRepoxContextUtil()
            .getRepoxManager()
            .getMetadataTransformationManager()
            .getXmapDir();
    if (!xmapDir.exists()) xmapDir.mkdirs();

    File xmapFile = new File(xmapDir, fileName.toLowerCase() + XMAP_END);
    StreamResult tmpResult = new StreamResult(new FileOutputStream(xmapFile));

    new XMLMappingWriter().write(script, tmpResult);
    tmpResult.getOutputStream().close();
    // System.out.println("SERVER - XMAP created");
  }