@Override WebResult generateBody( HttpServletRequest request, HttpServletResponse response, boolean useXML ) throws IOException, KettleException { final String xml = IOUtils.toString( request.getInputStream() ); // Parse the XML, create a transformation configuration TransConfiguration transConfiguration = TransConfiguration.fromXML( xml ); Trans trans = createTrans( transConfiguration ); String message = "Transformation '" + trans.getName() + "' was added to Carte with id " + trans.getContainerObjectId(); return new WebResult( WebResult.STRING_OK, message, trans.getContainerObjectId() ); }
TransConfiguration transConfiguration = TransConfiguration.fromXML( xml.toString() ); TransMeta transMeta = transConfiguration.getTransMeta(); transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration();
TransConfiguration transConfiguration; try { transConfiguration = TransConfiguration.fromXML( xml.toString() ); TransMeta transMeta = transConfiguration.getTransMeta(); TransExecutionConfiguration transExecutionConfiguration =
private Optional<TransConfiguration> convert( String xmlString ) { try { if ( xmlString == null ) { return Optional.empty(); } TransConfiguration transConfiguration = TransConfiguration.fromXML( xmlString ); return Optional.of( transConfiguration ); } catch ( KettleException e ) { throw new RuntimeException( "Unable to convert string to object", e ); } }
public static Trans getTrans( final Configuration conf, final String transXml, boolean singleThreaded ) throws KettleException { initKettleEnvironment( conf ); TransConfiguration transConfiguration = TransConfiguration.fromXML( transXml ); TransMeta transMeta = transConfiguration.getTransMeta(); String carteObjectId = UUID.randomUUID().toString(); SimpleLoggingObject servletLoggingObject = new SimpleLoggingObject( "HADOOP_MAPPER", LoggingObjectType.CARTE, null ); //$NON-NLS-1$ servletLoggingObject.setContainerObjectId( carteObjectId ); TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration(); servletLoggingObject.setLogLevel( executionConfiguration.getLogLevel() ); if ( singleThreaded ) { // Set the type to single threaded in case the user forgot... // transMeta.setTransformationType( TransformationType.SingleThreaded ); // Disable thread priority management as it will slow things down needlessly. // The single threaded engine doesn't use threads and doesn't need row locking. // transMeta.setUsingThreadPriorityManagment( false ); } else { transMeta.setTransformationType( TransformationType.Normal ); } return new Trans( transMeta, servletLoggingObject ); }