private File createBmxFrameworkParameterFile(JAXBSource source,DMFramework framework,File workingDir){
  Transformer transformer;
  try {
    TransformerFactory tf=TransformerFactory.newInstance(XSLT2_TRANSFORMER_IMPLEMENTATION,null);
    InputStream transformationStream=ResourceHelper.getResourceInputStream(BMX_PARAMETERS_TRANSFORMATION);
    if (transformationStream == null) {
      throw new FileNotFoundException(String.format("Metadata.xml to BMX transformation file is absent: %s",BMX_PARAMETERS_TRANSFORMATION));
    }
    StreamSource xslt=new StreamSource(transformationStream);
    transformer=tf.newTransformer(xslt);
    transformer.setParameter(BMX_FRAMEWORK_PARAM,framework.value());
  }
 catch (  TransformerException|IOException e) {
    throw new RuntimeException(e);
  }
  File result=new File(workingDir,framework.value + ".txt");
  try (Writer writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(result),"UTF-8"))){
    StreamResult streamResult=new StreamResult(writer);
    transformer.transform(source,streamResult);
    writer.flush();
    return result;
  }
 catch (  TransformerException|IOException e) {
    throw new RuntimeException(e);
  }
}

private File createBmxFrameworkParameterFile ( JAXBSource source , DMFramework framework , File workingDir ) { Transformer transformer ; try { TransformerFactory tf = TransformerFactory . newInstance ( XSLT2_TRANSFORMER_IMPLEMENTATION , null ) ; InputStream transformationStream = ResourceHelper . getResourceInputStream ( BMX_PARAMETERS_TRANSFORMATION ) ; if ( transformationStream == null ) { throw new FileNotFoundException ( String . format ( "Metadata.xml to BMX transformation file is absent: %s" , BMX_PARAMETERS_TRANSFORMATION ) ) ; } StreamSource xslt = new StreamSource ( transformationStream ) ; transformer = tf . newTransformer ( xslt ) ; transformer . setParameter ( BMX_FRAMEWORK_PARAM , framework . value ( ) ) ; } catch ( TransformerException | IOException e ) { throw new RuntimeException ( e ) ; } File result = new File ( workingDir , framework . value + ".txt" ) ; try ( Writer writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( result ) , "UTF-8" ) ) ) { StreamResult streamResult = new StreamResult ( writer ) ; transformer . transform ( source , streamResult ) ; writer . flush ( ) ; return result ; } catch ( TransformerException | IOException e ) { throw new RuntimeException ( e ) ; } }
transforms metadata . xml into a set of parameters for particular mxf framework .
