use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by serge-rider.
the class DataTransferPagePipes method loadProducers.
private void loadProducers() {
DataTransferSettings settings = getWizard().getSettings();
Collection<DBSObject> objects = settings.getSourceObjects();
List<TransferTarget> transferTargets = new ArrayList<>();
for (DataTransferNodeDescriptor producer : DataTransferRegistry.getInstance().getAvailableProducers(objects)) {
Collection<DataTransferProcessorDescriptor> processors = producer.getAvailableProcessors(objects);
if (CommonUtils.isEmpty(processors)) {
transferTargets.add(new TransferTarget(producer, null));
} else {
for (DataTransferProcessorDescriptor processor : processors) {
transferTargets.add(new TransferTarget(producer, processor));
}
}
}
nodesTable.setInput(transferTargets);
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by serge-rider.
the class ResultSetHandlerOpenWith method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IResultSetController resultSet = ResultSetHandlerMain.getActiveResultSet(HandlerUtil.getActivePart(event));
if (resultSet == null) {
return null;
}
DataTransferProcessorDescriptor processor = getActiveProcessor(event.getParameter(PARAM_PROCESSOR_ID));
if (processor == null) {
return null;
}
switch(event.getCommand().getId()) {
case CMD_OPEN_WITH:
openResultsWith(resultSet, processor);
break;
}
return null;
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by serge-rider.
the class ResultSetHandlerCopyAs method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IResultSetController resultSet = ResultSetHandlerMain.getActiveResultSet(HandlerUtil.getActivePart(event));
if (resultSet == null) {
return null;
}
DataTransferProcessorDescriptor processor = getActiveProcessor(event.getParameter(PARAM_PROCESSOR_ID));
if (processor == null) {
return null;
}
switch(event.getCommand().getId()) {
case CMD_COPY_AS:
openResultsWith(resultSet, processor);
break;
}
return null;
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by dbeaver.
the class DataTransferPipe method initPipe.
public void initPipe(DataTransferSettings settings, int pipeIndex, int totalPipes) throws DBException {
if (consumer == null || producer == null) {
throw new DBException("Empty pipe");
}
IDataTransferSettings consumerSettings = settings.getNodeSettings(settings.getConsumer());
DataTransferProcessorDescriptor processorDescriptor = settings.getProcessor();
IDataTransferProcessor processor = processorDescriptor == null ? null : processorDescriptor.getInstance();
IDataTransferConsumer.TransferParameters parameters = new IDataTransferConsumer.TransferParameters(processorDescriptor != null && processorDescriptor.isBinaryFormat(), processorDescriptor != null && processorDescriptor.isHTMLFormat());
parameters.orderNumber = pipeIndex;
parameters.totalConsumers = totalPipes;
parameters.startTimestamp = new Date();
consumer.initTransfer(producer.getDatabaseObject(), consumerSettings, parameters, processor, processor == null ? null : settings.getProcessorProperties());
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by dbeaver.
the class DataTransferSettings method setDataPipes.
public void setDataPipes(List<DataTransferPipe> dataPipes, boolean isExport) {
this.dataPipes = dataPipes;
// Now determine main producer and consumer and processor
DataTransferRegistry registry = DataTransferRegistry.getInstance();
this.consumerOptional = isExport;
this.producerOptional = !isExport;
// Don't update producer and consumer if it's not required (#9687)
if (!nodeUpdateRestricted) {
this.producer = null;
this.consumer = null;
if (!dataPipes.isEmpty()) {
DataTransferPipe pipe = dataPipes.get(0);
this.producer = pipe.getProducer() == null ? null : registry.getNodeByType(pipe.getProducer().getClass());
this.consumer = pipe.getConsumer() == null ? null : registry.getNodeByType(pipe.getConsumer().getClass());
}
}
DataTransferProcessorDescriptor savedProcessor = this.processor;
if (this.consumerOptional && this.consumer != null) {
this.selectConsumer(this.consumer, savedProcessor, false);
}
if (this.producerOptional && this.producer != null) {
this.selectProducer(this.producer, savedProcessor, false);
}
// Collect objects
initObjects.clear();
for (DataTransferPipe pipe : dataPipes) {
DBSObject object = isExport ? pipe.getProducer().getDatabaseObject() : pipe.getConsumer().getDatabaseObject();
if (object != null) {
initObjects.add(object);
}
}
}
Aggregations