{
if (producer instanceof KettleTransFromRepositoryProducer == false) {
throw new BundleWriterException
("Invalid object type registered for handler of " + KettleTransFromRepositoryProducer.class.getSimpleName());
}
KettleTransFromRepositoryProducer repositoryProducer = (KettleTransFromRepositoryProducer) producer;
final AttributeList coreAttrs = new AttributeList();
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "name", queryName);
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "repository", repositoryProducer.getRepositoryName());
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "directory", repositoryProducer.getDirectoryName());
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "transformation", repositoryProducer.getTransformationName());
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "step", repositoryProducer.getStepName());
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "username", repositoryProducer.getUsername());
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "password",
PasswordEncryptionService.getInstance().encrypt(repositoryProducer.getPassword()));
coreAttrs.setAttribute(KettleDataFactoryModule.NAMESPACE, "stop-on-error",
String.valueOf(repositoryProducer.isStopOnError()));
final String[] definedArgumentNames = repositoryProducer.getDefinedArgumentNames();
final ParameterMapping[] parameterMappings = repositoryProducer.getDefinedVariableNames();
if (definedArgumentNames.length == 0 && parameterMappings.length == 0)
{
xmlWriter.writeTag(KettleDataFactoryModule.NAMESPACE, "query-repository", coreAttrs, XmlWriter.CLOSE);
return;
}