if(className != null) {
// Load the implementation description, create component instance and put it
// into it's place in the pipe
//PipeComponentImplementation impl = pers.loadComponentImplementation(className);
PipeComponentIF impl = Persister.getInstance(className);
if(impl != null) {
//PipeComponentIF newComponent = impl.getInstance();
PipeComponentIF newComponent = Persister.getInstance(className);
PipeComponentData pcdata;
pcdata = new PipeComponentData();
pcdata.setAttributes(new HashMap());
//Long dataId;
switch(componentType) {
case PipeComponentIF.TYPE_SOURCE:
pipe.setSource((SourceIF) newComponent);
pipe.setSourceID(newComponent.getID());
pcdata = new PipeComponentData();
pipe.setSourceData(pcdata);
newComponent.setData(pcdata);
pers.save(pcdata);
//dataId = pcdata.getId();
break;
case PipeComponentIF.TYPE_DESTINATION:
pipe.setDestination((DestinationIF) newComponent);
pipe.setDestinationID(newComponent.getID());
pcdata = new PipeComponentData();
pipe.setDestinationData(pcdata);
newComponent.setData(pcdata);
pers.save(pcdata);
//dataId = pcdata.getId();
break;
case PipeComponentIF.TYPE_CONVERTER:
pcdata = new PipeComponentData();
ConverterListItem cl = pipe.addConverter(
(ConverterIF) newComponent,
pcdata);
pers.save(cl);
pers.save(pipe);
//dataId = pcdata.getId();
/*System.out.println("Created new Converter (" + newComponent.getID() + ", " +
className + "), dataId: " + dataId);*/
converterField = converterFieldInfo.getField(pipe, labels, req);
break;
}
}
}
}
// ------
// Delete
// ------
if(parameters.wasGiven(DELETE_COMPONENT_OF_TYPE)
&& parameters.getInt(DELETE_COMPONENT_OF_TYPE) != -1) {
switch(parameters.getInt(DELETE_COMPONENT_OF_TYPE)) {
case PipeComponentIF.TYPE_SOURCE:
PipeComponentIF source = pipe.getCurrentSource();
String sourceID = pipe.getSourceID();
if(sourceID != null) {
PipeComponentData sourceData = this.pipe.getSourceData();
// We need to remove references to Source component's PipeComponentData before deleting it
if(source != null) {
source.setData(null);
}
pipe.setSourceData(null);
// Delete the Source component's PipeComponentData
pers.delete(sourceData);
// Clear Source component instance and ID
pipe.setSource(null);
pipe.setSourceID(null);
}
break;
case PipeComponentIF.TYPE_DESTINATION:
PipeComponentIF destination = pipe.getCurrentDestination();
String destinationID = pipe.getDestinationID();
if(destinationID != null) {
PipeComponentData destinationData = this.pipe.getDestinationData();
// We need to remove references to Destination component's PipeComponentData before deleting it
if(destination != null) {
destination.setData(null);
}
pipe.setDestinationData(null);
// Delete the Destination component's PipeComponentData