@Test public void testLoadStepAttributes_closeInputStream() throws Exception { BaseStepMeta meta = new BaseStepMeta(); meta.loadStepAttributes(); RandomAccessFile fos = null; try { File file = new File( getClass().getResource( BaseStepMeta.STEP_ATTRIBUTES_FILE ).getPath() ); if ( file.exists() ) { fos = new RandomAccessFile( file, "rw" ); } } catch ( FileNotFoundException | SecurityException e ) { fail( "the file with properties should be unallocated" ); } finally { if ( fos != null ) { fos.close(); } } }
protected void loadStepAttributes() throws KettleException { try ( InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE ) ) { if ( inputStream != null ) { Document document = XMLHandler.loadXMLFile( inputStream ); Node attrsNode = XMLHandler.getSubNode( document, "attributes" ); List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" ); attributes = new ArrayList<KettleAttributeInterface>(); for ( Node node : nodes ) { String key = XMLHandler.getTagAttribute( node, "id" ); String xmlCode = XMLHandler.getTagValue( node, "xmlcode" ); String repCode = XMLHandler.getTagValue( node, "repcode" ); String description = XMLHandler.getTagValue( node, "description" ); String tooltip = XMLHandler.getTagValue( node, "tooltip" ); int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) ); String parentId = XMLHandler.getTagValue( node, "parentid" ); KettleAttribute attribute = new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent( attributes, parentId ) ); attributes.add( attribute ); } } } catch ( Exception e ) { throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e ); } }
BaseStepMeta implements Cloneable, StepAttributesInterface { protected void loadStepAttributes() throws KettleException { try ( InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE ) ) { if ( inputStream != null ) { Document document = XMLHandler.loadXMLFile( inputStream ); Node attrsNode = XMLHandler.getSubNode( document, "attributes" ); List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" ); attributes = new ArrayList<KettleAttributeInterface>(); for ( Node node : nodes ) { String key = XMLHandler.getTagAttribute( node, "id" ); String xmlCode = XMLHandler.getTagValue( node, "xmlcode" ); String repCode = XMLHandler.getTagValue( node, "repcode" ); String description = XMLHandler.getTagValue( node, "description" ); String tooltip = XMLHandler.getTagValue( node, "tooltip" ); int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) ); String parentId = XMLHandler.getTagValue( node, "parentid" ); KettleAttribute attribute = new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent( attributes, parentId ) ); attributes.add( attribute ); } } } catch ( Exception e ) { throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e ); } } }
BaseStepMeta implements Cloneable, StepAttributesInterface { protected void loadStepAttributes() throws KettleException { try ( InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE ) ) { if ( inputStream != null ) { Document document = XMLHandler.loadXMLFile( inputStream ); Node attrsNode = XMLHandler.getSubNode( document, "attributes" ); List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" ); attributes = new ArrayList<KettleAttributeInterface>(); for ( Node node : nodes ) { String key = XMLHandler.getTagAttribute( node, "id" ); String xmlCode = XMLHandler.getTagValue( node, "xmlcode" ); String repCode = XMLHandler.getTagValue( node, "repcode" ); String description = XMLHandler.getTagValue( node, "description" ); String tooltip = XMLHandler.getTagValue( node, "tooltip" ); int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) ); String parentId = XMLHandler.getTagValue( node, "parentid" ); KettleAttribute attribute = new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent( attributes, parentId ) ); attributes.add( attribute ); } } } catch ( Exception e ) { throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e ); } } BaseStepMeta(); }
BaseStepMeta implements Cloneable, StepAttributesInterface { protected void loadStepAttributes() throws KettleException { try ( InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE ) ) { if ( inputStream != null ) { Document document = XMLHandler.loadXMLFile( inputStream ); Node attrsNode = XMLHandler.getSubNode( document, "attributes" ); List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" ); attributes = new ArrayList<KettleAttributeInterface>(); for ( Node node : nodes ) { String key = XMLHandler.getTagAttribute( node, "id" ); String xmlCode = XMLHandler.getTagValue( node, "xmlcode" ); String repCode = XMLHandler.getTagValue( node, "repcode" ); String description = XMLHandler.getTagValue( node, "description" ); String tooltip = XMLHandler.getTagValue( node, "tooltip" ); int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) ); String parentId = XMLHandler.getTagValue( node, "parentid" ); KettleAttribute attribute = new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent( attributes, parentId ) ); attributes.add( attribute ); } } } catch ( Exception e ) { throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e ); } } BaseStepMeta(); @Override Object clone(); void setChanged( boolean ch ); void setChanged(); boolean hasChanged(); RowMetaInterface getTableFields(); String getXML(); @Deprecated void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space ); void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info ); void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ); @Deprecated SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
    Repository repository, IMetaStore metaStore ); void cancelQueries(); Map<String, String> getUsedArguments(); @Deprecated RowMetaInterface getRequiredFields(); RowMetaInterface getRequiredFields( VariableSpace space ); DatabaseMeta[] getUsedDatabaseConnections(); String[] getUsedLibraries(); boolean supportsErrorHandling(); boolean excludeFromRowLayoutVerification(); boolean excludeFromCopyDistributeVerification(); List<ResourceReference> getResourceDependencies( TransMeta transMeta, StepMeta stepInfo ); @Deprecated String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
    ResourceNamingInterface resourceNamingInterface, Repository repository ); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
    ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); @Deprecated String getDialogClassName(); StepMeta getParentStepMeta(); void setParentStepMeta( StepMeta parentStepMeta ); LogChannelInterface getLog(); boolean isBasic(); boolean isDetailed(); boolean isDebug(); boolean isRowLevel(); void logMinimal( String message ); void logMinimal( String message, Object... arguments ); void logBasic( String message ); void logBasic( String message, Object... arguments ); void logDetailed( String message ); void logDetailed( String message, Object... arguments ); void logDebug( String message ); void logDebug( String message, Object... arguments ); void logRowlevel( String message ); void logRowlevel( String message, Object... arguments ); void logError( String message ); void logError( String message, Throwable e ); void logError( String message, Object... arguments ); String getLogChannelId(); String getName(); String getObjectCopy(); ObjectId getObjectId(); ObjectRevision getObjectRevision(); LoggingObjectType getObjectType(); LoggingObjectInterface getParent(); RepositoryDirectory getRepositoryDirectory(); StepIOMetaInterface getStepIOMeta(); List<StreamInterface> getOptionalStreams(); void handleStreamSelection( StreamInterface stream ); void resetStepIoMeta(); void searchInfoAndTargetSteps( List<StepMeta> steps ); StepMetaInjectionInterface getStepMetaInjectionInterface(); List<StepInjectionMetaEntry> extractStepMetadataEntries(); List<StepInjectionMetaEntry> getStepInjectionMetadataEntries( Class<?> PKG ); @Override KettleAttributeInterface findParent( List<KettleAttributeInterface> attributes, String parentId ); @Override KettleAttributeInterface findAttribute( String key ); @Override String getXmlCode( String attributeKey ); @Override String getRepCode( String attributeKey ); @Override String getDescription( String attributeKey ); @Override String getTooltip( String attributeKey ); TransformationType[] getSupportedTransformationTypes(); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); String[] getReferencedObjectDescriptions(); boolean[] isReferencedObjectEnabled(); String getActiveReferencedObjectDescription(); @Deprecated Object loadReferencedObject( int index, Repository rep, VariableSpace space ); Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ); @Deprecated void readRep( Repository rep, ObjectId idStep, List<DatabaseMeta> databases ); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Deprecated void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases,
    Map<String, Counter> counters ); @Deprecated void loadXML( Node stepnode, List<DatabaseMeta> databases ); @Deprecated void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Deprecated void saveRep( Repository rep, ObjectId id_transformation, ObjectId id_step ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Deprecated void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info ); @Deprecated void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); }
BaseStepMeta implements Cloneable, StepAttributesInterface { protected void loadStepAttributes() throws KettleException { try ( InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE ) ) { if ( inputStream != null ) { Document document = XMLHandler.loadXMLFile( inputStream ); Node attrsNode = XMLHandler.getSubNode( document, "attributes" ); List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" ); attributes = new ArrayList<KettleAttributeInterface>(); for ( Node node : nodes ) { String key = XMLHandler.getTagAttribute( node, "id" ); String xmlCode = XMLHandler.getTagValue( node, "xmlcode" ); String repCode = XMLHandler.getTagValue( node, "repcode" ); String description = XMLHandler.getTagValue( node, "description" ); String tooltip = XMLHandler.getTagValue( node, "tooltip" ); int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) ); String parentId = XMLHandler.getTagValue( node, "parentid" ); KettleAttribute attribute = new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent( attributes, parentId ) ); attributes.add( attribute ); } } } catch ( Exception e ) { throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e ); } } BaseStepMeta(); @Override Object clone(); void setChanged( boolean ch ); void setChanged(); boolean hasChanged(); RowMetaInterface getTableFields(); String getXML(); @Deprecated void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space ); void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info ); void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ); @Deprecated SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev ); SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
    Repository repository, IMetaStore metaStore ); void cancelQueries(); Map<String, String> getUsedArguments(); @Deprecated RowMetaInterface getRequiredFields(); RowMetaInterface getRequiredFields( VariableSpace space ); DatabaseMeta[] getUsedDatabaseConnections(); String[] getUsedLibraries(); boolean supportsErrorHandling(); boolean excludeFromRowLayoutVerification(); boolean excludeFromCopyDistributeVerification(); List<ResourceReference> getResourceDependencies( TransMeta transMeta, StepMeta stepInfo ); @Deprecated String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
    ResourceNamingInterface resourceNamingInterface, Repository repository ); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
    ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); @Deprecated String getDialogClassName(); StepMeta getParentStepMeta(); void setParentStepMeta( StepMeta parentStepMeta ); LogChannelInterface getLog(); boolean isBasic(); boolean isDetailed(); boolean isDebug(); boolean isRowLevel(); void logMinimal( String message ); void logMinimal( String message, Object... arguments ); void logBasic( String message ); void logBasic( String message, Object... arguments ); void logDetailed( String message ); void logDetailed( String message, Object... arguments ); void logDebug( String message ); void logDebug( String message, Object... arguments ); void logRowlevel( String message ); void logRowlevel( String message, Object... arguments ); void logError( String message ); void logError( String message, Throwable e ); void logError( String message, Object... arguments ); String getLogChannelId(); String getName(); String getObjectCopy(); ObjectId getObjectId(); ObjectRevision getObjectRevision(); LoggingObjectType getObjectType(); LoggingObjectInterface getParent(); RepositoryDirectory getRepositoryDirectory(); StepIOMetaInterface getStepIOMeta(); List<StreamInterface> getOptionalStreams(); void handleStreamSelection( StreamInterface stream ); void resetStepIoMeta(); void searchInfoAndTargetSteps( List<StepMeta> steps ); StepMetaInjectionInterface getStepMetaInjectionInterface(); List<StepInjectionMetaEntry> extractStepMetadataEntries(); List<StepInjectionMetaEntry> getStepInjectionMetadataEntries( Class<?> PKG ); @Override KettleAttributeInterface findParent( List<KettleAttributeInterface> attributes, String parentId ); @Override KettleAttributeInterface findAttribute( String key ); @Override String getXmlCode( String attributeKey ); @Override String getRepCode( String attributeKey ); @Override String getDescription( String attributeKey ); @Override String getTooltip( String attributeKey ); TransformationType[] getSupportedTransformationTypes(); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); String[] getReferencedObjectDescriptions(); boolean[] isReferencedObjectEnabled(); String getActiveReferencedObjectDescription(); @Deprecated Object loadReferencedObject( int index, Repository rep, VariableSpace space ); Object loadReferencedObject( int index, Repository rep, IMetaStore metaStore, VariableSpace space ); @Deprecated void readRep( Repository rep, ObjectId idStep, List<DatabaseMeta> databases ); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Deprecated void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases,
    Map<String, Counter> counters ); @Deprecated void loadXML( Node stepnode, List<DatabaseMeta> databases ); @Deprecated void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Deprecated void saveRep( Repository rep, ObjectId id_transformation, ObjectId id_step ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Deprecated void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info ); @Deprecated void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); static final LoggingObjectInterface loggingObject; static final String STEP_ATTRIBUTES_FILE; }