use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by dbeaver.
the class DataTransferPageFinal method activatePage.
@Override
public void activatePage() {
resultTable.removeAll();
DataTransferSettings settings = getWizard().getSettings();
List<DataTransferPipe> dataPipes = settings.getDataPipes();
IDataTransferSettings consumerSettings = null, producerSettings = null;
for (int i = 0; i < dataPipes.size(); i++) {
DataTransferPipe pipe = dataPipes.get(i);
try {
pipe.initPipe(settings, i, dataPipes.size());
} catch (DBException e) {
DBWorkbench.getPlatformUI().showError(DTUIMessages.data_transfer_page_final_title_error_initializing_transfer_pipe, DTUIMessages.data_transfer_page_final_message_error_initializing_data_transfer_pipe, e);
continue;
}
IDataTransferConsumer consumer = pipe.getConsumer();
IDataTransferProducer producer = pipe.getProducer();
if (consumerSettings == null) {
consumerSettings = settings.getNodeSettings(settings.getConsumer());
}
if (producerSettings == null) {
producerSettings = settings.getNodeSettings(settings.getProducer());
}
DataTransferProcessorDescriptor processorDescriptor = settings.getProcessor();
TableItem item = new TableItem(resultTable, SWT.NONE);
{
item.setText(0, producer.getObjectContainerName());
if (producer.getObjectContainerIcon() != null) {
item.setImage(0, DBeaverIcons.getImage(producer.getObjectContainerIcon()));
}
item.setText(1, CommonUtils.notEmpty(producer.getObjectName()));
DBPImage producerObjectIcon = producer.getObjectIcon();
if (producerObjectIcon == null) {
producerObjectIcon = settings.getProducer().getIcon();
}
if (producerObjectIcon != null) {
item.setImage(1, DBeaverIcons.getImage(producerObjectIcon));
}
Color producerColor = getNodeColor(producer);
if (producerColor != null) {
item.setBackground(0, producerColor);
item.setBackground(1, producerColor);
}
}
{
item.setText(2, consumer.getObjectContainerName());
if (consumer.getObjectContainerIcon() != null) {
item.setImage(2, DBeaverIcons.getImage(consumer.getObjectContainerIcon()));
}
item.setText(3, consumer.getObjectName());
DBPImage consumerObjectIcon = consumer.getObjectIcon();
if (consumerObjectIcon == null && processorDescriptor != null) {
consumerObjectIcon = processorDescriptor.getIcon();
}
if (consumerObjectIcon == null && settings.getConsumer() != null) {
consumerObjectIcon = settings.getConsumer().getIcon();
}
if (consumerObjectIcon != null) {
item.setImage(3, DBeaverIcons.getImage(consumerObjectIcon));
}
Color consumerColor = getNodeColor(consumer);
if (consumerColor != null) {
item.setBackground(2, consumerColor);
item.setBackground(3, consumerColor);
}
}
}
printSummary(sourceSettingsText, settings.getProducer(), producerSettings, settings.isProducerProcessor() ? settings.getProcessor() : null);
printSummary(targetSettingsText, settings.getConsumer(), consumerSettings, settings.isProducerProcessor() ? null : settings.getProcessor());
activated = true;
int tableWidth = resultTable.getSize().x;
TableColumn[] columns = resultTable.getColumns();
for (TableColumn column : columns) {
column.setWidth(tableWidth / columns.length - 1);
}
updatePageCompletion();
getWizard().updateSaveTaskButtons();
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by dbeaver.
the class DataTransferPagePipes method loadConsumers.
private void loadConsumers() {
DataTransferSettings settings = getWizard().getSettings();
Collection<DBSObject> objects = settings.getSourceObjects();
List<TransferTarget> transferTargets = new ArrayList<>();
for (DataTransferNodeDescriptor consumer : DataTransferRegistry.getInstance().getAvailableConsumers(objects)) {
Collection<DataTransferProcessorDescriptor> processors = consumer.getAvailableProcessors(objects);
if (CommonUtils.isEmpty(processors)) {
transferTargets.add(new TransferTarget(consumer, null));
} else {
for (DataTransferProcessorDescriptor processor : processors) {
transferTargets.add(new TransferTarget(consumer, processor));
}
}
}
nodesTable.setInput(transferTargets);
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by dbeaver.
the class DataTransferPagePipes method activatePage.
@Override
public void activatePage() {
if (activated) {
// Second activation - we need to disable any selectors
if (getWizard().getSettings().isPipeChangeRestricted() || getWizard().isTaskEditor()) {
nodesTable.getTable().setEnabled(false);
}
return;
}
activated = true;
if (getWizard().getSettings().isConsumerOptional()) {
setTitle(DTMessages.data_transfer_wizard_init_title);
setDescription(DTMessages.data_transfer_wizard_init_description);
loadConsumers();
} else {
setTitle(DTMessages.data_transfer_wizard_producers_title);
setDescription(DTMessages.data_transfer_wizard_producers_description);
loadProducers();
}
DataTransferNodeDescriptor consumer = getWizard().getSettings().getConsumer();
DataTransferNodeDescriptor producer = getWizard().getSettings().getProducer();
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
if (consumer != null || producer != null) {
Collection<TransferTarget> targets = (Collection<TransferTarget>) nodesTable.getInput();
for (TransferTarget target : targets) {
if ((target.node == consumer || target.node == producer) && target.processor == processor) {
UIUtils.asyncExec(() -> {
nodesTable.setSelection(new StructuredSelection(target));
setSelectedSettings();
});
break;
}
}
}
inputsTable.setInput(getWizard().getSettings().getSourceObjects());
UIUtils.maxTableColumnsWidth(inputsTable.getTable());
UIUtils.maxTableColumnsWidth(nodesTable.getTable());
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by serge-rider.
the class StreamConsumerPageSettings method activatePage.
@Override
public void activatePage() {
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
propertySource = new PropertySourceCustom(processor.getProperties(), getWizard().getSettings().getProcessorProperties());
propsEditor.loadProperties(propertySource);
switch(settings.getLobExtractType()) {
case SKIP:
lobExtractType.select(EXTRACT_LOB_SKIP);
break;
case FILES:
lobExtractType.select(EXTRACT_LOB_FILES);
break;
case INLINE:
lobExtractType.select(EXTRACT_LOB_INLINE);
break;
}
switch(settings.getLobEncoding()) {
case BASE64:
lobEncodingCombo.select(LOB_ENCODING_BASE64);
break;
case HEX:
lobEncodingCombo.select(LOB_ENCODING_HEX);
break;
case BINARY:
lobEncodingCombo.select(LOB_ENCODING_BINARY);
break;
case NATIVE:
lobEncodingCombo.select(LOB_ENCODING_NATIVE);
break;
}
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor in project dbeaver by serge-rider.
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());
}
Aggregations