(TransExecutionConfiguration) executionConfiguration.clone(); TransConfiguration transConfiguration = new TransConfiguration( slaveTrans, slaveTransExecutionConfiguration ); slaves[ index ].sendXML( transConfiguration.getXML(), RegisterTransServlet.CONTEXT_PATH + "/?xml=Y" ); WebResult webResult = WebResult.fromXMLString( slaveReply ); if ( !webResult.getResult().equalsIgnoreCase( WebResult.STRING_OK ) ) {
TransConfiguration transConfiguration; try { transConfiguration = TransConfiguration.fromXML( xml.toString() ); TransMeta transMeta = transConfiguration.getTransMeta(); TransExecutionConfiguration transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration(); transMeta.setLogLevel( transExecutionConfiguration.getLogLevel() ); LogChannelInterface log = CarteSingleton.getInstance().getLog(); TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration(); final Repository repository = transConfiguration.getTransExecutionConfiguration().getRepository();
masterServer = transSplitter.getMasterServer(); if ( executionConfiguration.isClusterPosting() ) { TransConfiguration transConfiguration = new TransConfiguration( master, executionConfiguration ); Map<String, String> variables = transConfiguration.getTransExecutionConfiguration().getVariables(); variables.put( Const.INTERNAL_VARIABLE_CLUSTER_SIZE, Integer.toString( slaves.length ) ); variables.put( Const.INTERNAL_VARIABLE_CLUSTER_MASTER, "Y" ); Map<String, String> params = transConfiguration.getTransExecutionConfiguration().getParams(); TransMeta ot = transSplitter.getOriginalTransformation(); for ( String param : ot.listParameters() ) { masterServer.sendXML( transConfiguration.getXML(), RegisterTransServlet.CONTEXT_PATH + "/?xml=Y" ); WebResult webResult = WebResult.fromXMLString( masterReply ); if ( !webResult.getResult().equalsIgnoreCase( WebResult.STRING_OK ) ) {
LogLevel logLevel = LogLevel.getLogLevelForCode( levelOption ); transExecutionConfiguration.setLogLevel( logLevel ); TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration ); trans.injectVariables( transConfiguration.getTransExecutionConfiguration().getVariables() );
protected Trans createTrans( TransConfiguration transConfiguration ) throws UnknownParamException { TransMeta transMeta = transConfiguration.getTransMeta(); TransExecutionConfiguration transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration(); transMeta.setLogLevel( transExecutionConfiguration.getLogLevel() ); transMeta.injectVariables( transExecutionConfiguration.getVariables() );
public static final TransConfiguration fromXML( String xml ) throws KettleException { Document document = XMLHandler.loadXMLString( xml ); Node configNode = XMLHandler.getSubNode( document, XML_TAG ); return new TransConfiguration( configNode ); }
when( mockTransformationMap.getTransformation( any( CarteObjectEntry.class ) ) ).thenReturn( mockTrans ); when( mockTransformationMap.getConfiguration( any( CarteObjectEntry.class ) ) ).thenReturn( mockTransConf ); when( mockTransConf.getTransExecutionConfiguration() ).thenReturn( mockTransExecutionConf ); when( mockTrans.getLogChannel() ).thenReturn( mockChannelInterface ); when( mockTrans.getTransMeta() ).thenReturn( mockTransMeta );
@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() ); }
private String convert( Optional<TransConfiguration> transConfiguration ) { try { if ( transConfiguration.isPresent() ) { return transConfiguration.get().getXML(); } else { return null; } } catch ( KettleException | IOException e ) { throw new RuntimeException( "Unable to convert object to string.", e ); } }
private void deleteLogging( Optional<TransConfiguration> transConfiguration ) { if ( !transConfiguration.isPresent() ) { return; } TransMeta meta = transConfiguration.get().getTransMeta(); if ( meta == null ) { return; } BaseLogTable table = meta.getStepLogTable(); table.setConnectionName( null ); meta.setStepLogTable( (StepLogTable) table ); table = meta.getMetricsLogTable(); table.setConnectionName( null ); meta.setMetricsLogTable( (MetricsLogTable) table ); table = meta.getPerformanceLogTable(); table.setConnectionName( null ); meta.setPerformanceLogTable( (PerformanceLogTable) table ); table = meta.getTransLogTable(); table.setConnectionName( null ); meta.setTransLogTable( (TransLogTable) table ); table = meta.getChannelLogTable(); table.setConnectionName( null ); meta.setChannelLogTable( (ChannelLogTable) table ); }
@Override public synchronized void transformationDelegationStarted( Trans delegatedTrans, TransExecutionConfiguration transExecutionConfiguration ) { TransConfiguration tc = new TransConfiguration( delegatedTrans.getTransMeta(), transExecutionConfiguration ); transformationMap.registerTransformation( delegatedTrans, tc ); delegatedTrans.addDelegationListener( this ); }
TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration();
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 ); } }
TransConfiguration transConfiguration = TransConfiguration.fromXML( xml.toString() ); TransMeta transMeta = transConfiguration.getTransMeta(); transExecutionConfiguration = transConfiguration.getTransExecutionConfiguration(); transMeta.setLogLevel( transExecutionConfiguration.getLogLevel() ); if ( log.isDetailed() ) {
String xml = new TransConfiguration( transMeta, executionConfiguration ).getXML(); String reply = slaveServer.sendXML( xml, RegisterTransServlet.CONTEXT_PATH + "/?xml=Y" ); WebResult webResult = WebResult.fromXMLString( reply );
TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );
@GET @Path( "/prepare/{id : .+}" ) @Produces( { MediaType.APPLICATION_JSON } ) public TransformationStatus prepareTransformation( @PathParam( "id" ) String id ) { Trans trans = CarteResource.getTransformation( id ); try { CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id ); TransConfiguration transConfiguration = CarteSingleton.getInstance().getTransformationMap().getConfiguration( entry ); TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration(); // Set the appropriate logging, variables, arguments, replay date, ... // etc. trans.setArguments( executionConfiguration.getArgumentStrings() ); trans.setReplayDate( executionConfiguration.getReplayDate() ); trans.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() ); trans.setGatheringMetrics( executionConfiguration.isGatheringMetrics() ); trans.injectVariables( executionConfiguration.getVariables() ); trans.setPreviousResult( executionConfiguration.getPreviousResult() ); trans.prepareExecution( null ); } catch ( KettleException e ) { e.printStackTrace(); } return getTransformationStatus( id ); }
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 ); }
public static String buildTransConfig( String transname ) throws Exception { String xml = null; KettleEnvironment.init(); TransMeta tm = new TransMeta( transname ); TransConfiguration tc = new TransConfiguration( tm, new TransExecutionConfiguration() ); xml = tc.getXML(); return xml; }
LogLevel logLevel = LogLevel.getLogLevelForCode( levelOption ); transExecutionConfiguration.setLogLevel( logLevel ); TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );