use of org.talend.core.ui.export.ArchiveFileExportOperationFullPath in project tdi-studio-se by Talend.
the class GenerateDocAsHTMLWizardPage method finish.
/**
* The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false
* is returned then the wizard will not close.
*
* @returns boolean
*/
@Override
public boolean finish() {
String topFolder = getRootFolderName();
String destinationFilename = getDestinationValue();
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
File file = new File(destinationFilename);
if (file.exists()) {
Boolean open = //$NON-NLS-1$
MessageDialog.openConfirm(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("GenerateDocAsHTMLWizardPage.Warning"), //$NON-NLS-1$
Messages.getString("GenerateDocAsHTMLWizardPage.OverWrite"));
if (open) {
file.delete();
} else {
return false;
}
}
List<ExportFileResource> resourcesToExport = getExportResources();
setTopFolder(resourcesToExport, topFolder);
ArchiveFileExportOperationFullPath runnable = new ArchiveFileExportOperationFullPath(resourcesToExport, destinationFilename);
// output everything
//$NON-NLS-1$
runnable.setRegEx("*");
boolean ok = executeExportOperation(runnable);
// add for bug TDI-21815
saveLastDirectoryName(runnable);
manager.deleteTempFiles();
return ok;
}
use of org.talend.core.ui.export.ArchiveFileExportOperationFullPath in project tdi-studio-se by Talend.
the class JobExportAction method doArchiveExport.
/**
* DOC ggu Comment method "doArchiveExport".
*
* @param monitor
* @param resourcesToExport
*/
protected void doArchiveExport(IProgressMonitor monitor, List<ExportFileResource> resourcesToExport) {
ArchiveFileExportOperationFullPath exporterOperation = new ArchiveFileExportOperationFullPath(resourcesToExport, getTempDestinationValue());
executeExportOperation(exporterOperation, monitor);
}
use of org.talend.core.ui.export.ArchiveFileExportOperationFullPath in project tdi-studio-se by Talend.
the class PublishOnSpagoExportWizardPage method finish.
/**
* The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false
* is returned then the wizard will not close.
*
* @returns boolean
*/
public boolean finish() {
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap();
boolean canExport = false;
for (ExportChoice choice : ExportChoice.values()) {
if (exportChoiceMap.get(choice) != null && exportChoiceMap.get(choice) instanceof Boolean && (Boolean) exportChoiceMap.get(choice)) {
canExport = true;
break;
}
}
if (!canExport) {
MessageDialog.openInformation(getContainer().getShell(), //$NON-NLS-1$
Messages.getString("PublishOnSpagoExportWizardPage.publishResourceError"), //$NON-NLS-1$
Messages.getString("PublishOnSpagoExportWizardPage.chooseResource"));
return false;
}
if (!ensureTargetIsValid()) {
return false;
}
String topFolder = getRootFolderName();
manager = new //$NON-NLS-1$
JobJavaScriptsManager(//$NON-NLS-1$
exportChoiceMap, //$NON-NLS-1$
contextCombo.getText(), //$NON-NLS-1$
"all", //$NON-NLS-1$
IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
List<ExportFileResource> resourcesToExport = null;
try {
resourcesToExport = getExportResources();
} catch (ProcessorException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
setTopFolder(resourcesToExport, topFolder);
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
// boolean ok = executeExportOperation(new ArchiveFileExportOperationFullPath(process));
ArchiveFileExportOperationFullPath exporterOperation = getExporterOperation(resourcesToExport);
boolean ok = executeExportOperation(exporterOperation);
// path can like name/name
manager.deleteTempFiles();
ProcessorUtilities.resetExportConfig();
for (int i = 0; i < process.length; i++) {
ProcessItem processItem = (ProcessItem) process[i].getItem();
try {
ProcessorUtilities.generateCode(processItem, processItem.getProcess().getDefaultContext(), false, false);
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
}
// cantoine : connection to SpagoBiEngineClient to publish Job.
try {
Project project = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject();
// retrieve user, password, host, port from selected SpagoBiServer
String selectedSpagoBiEngineName = serverSpagoBi.getItem(serverSpagoBi.getSelectionIndex());
SpagoBiServer spagoBiServer = null;
List<SpagoBiServer> listServerSapgo = null;
// ProxyRepositoryFactory proxyRepositoryFactory = ProxyRepositoryFactory.getInstance();
// try {
listServerSapgo = SpagoBiServerHelper.parse(new SpagoBiPreferencePage().getPreferenceStore().getString(SpagoBiServer.SPAGOBI_SERVER));
if (listServerSapgo != null && !listServerSapgo.isEmpty()) {
Iterator<SpagoBiServer> iterator = listServerSapgo.iterator();
while (iterator.hasNext()) {
spagoBiServer = iterator.next();
if (spagoBiServer.getEngineName().equals(selectedSpagoBiEngineName)) {
break;
}
}
}
// } catch (PersistenceException e) {
// displayErrorDialog(e.getMessage());
// }
// "biadmin";
String user = spagoBiServer.getLogin();
// "biadmin";
String password = spagoBiServer.getPassword();
String host = spagoBiServer.getHost();
String port = spagoBiServer.getPort();
// create the client
//$NON-NLS-1$
ISpagoBITalendEngineClient client = new SpagoBITalendEngineClient(user, password, host, port, "SpagoBITalendEngine");
// get some informations about the engine instance referenced by the client
//$NON-NLS-1$
System.out.println("Engine version: " + client.getEngineVersion());
//$NON-NLS-1$
System.out.println("Engine fullname: " + client.getEngineName());
// prepare parameters used during deployment
JobDeploymentDescriptor jobDeploymentDescriptor = new JobDeploymentDescriptor(project.getLabel(), project.getLanguage().getName());
File zipFile = new File(getDestinationValue());
// deploy job on engine runtime
boolean result = client.deployJob(jobDeploymentDescriptor, zipFile);
if (result)
//$NON-NLS-1$
System.out.println("Jobs deployed succesfully");
else
//$NON-NLS-1$
System.out.println("Jobs not deployed");
} catch (EngineUnavailableException e) {
//$NON-NLS-1$
System.err.println("ERROR: " + e.getMessage());
} catch (AuthenticationFailedException e) {
//$NON-NLS-1$
System.err.println("ERROR: " + e.getMessage());
} catch (UnsupportedEngineVersionException e) {
//$NON-NLS-1$
System.err.println("ERROR: Unsupported engine version");
System.err.println(//$NON-NLS-1$
"You are using TalendEngineClientAPI version " + SpagoBITalendEngineClient.CLIENTAPI_VERSION_NUMBER + //$NON-NLS-1$
". " + //$NON-NLS-1$
"The TalendEngine instance you are trying to connect to require TalendEngineClientAPI version " + e.getComplianceVersion() + //$NON-NLS-1$
" or grater.");
} catch (ServiceInvocationFailedException e) {
//$NON-NLS-1$
System.err.println("ERROR: " + e.getMessage());
//$NON-NLS-1$ //$NON-NLS-2$
System.err.println("StatusLine: " + e.getStatusLine() + "responseBody: " + e.getResponseBody());
}
return ok;
// return true;
}
use of org.talend.core.ui.export.ArchiveFileExportOperationFullPath in project tdi-studio-se by Talend.
the class SpagicDeployWizardPage method finish.
/**
* The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false
* is returned then the wizard will not close.
*
* @returns boolean
*/
@Override
public boolean finish() {
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap();
boolean canExport = false;
for (ExportChoice choice : ExportChoice.values()) {
if (exportChoiceMap.get(choice) != null && exportChoiceMap.get(choice) instanceof Boolean && (Boolean) exportChoiceMap.get(choice)) {
canExport = true;
break;
}
}
if (!canExport) {
MessageDialog.openInformation(getContainer().getShell(), //$NON-NLS-1$
Messages.getString("SpagicDeployWizardPage.exportResourceError"), //$NON-NLS-1$
Messages.getString("SpagicDeployWizardPage.chooseResource"));
return false;
}
if (!ensureTargetIsValid()) {
return false;
}
manager = new //$NON-NLS-1$
SpagicJavaDeployManager(//$NON-NLS-1$
exportChoiceMap, //$NON-NLS-1$
contextCombo.getText(), //$NON-NLS-1$
"all", //$NON-NLS-1$
IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
String topFolder = getRootFolderName();
List<ExportFileResource> resourcesToExport = null;
try {
resourcesToExport = getExportResources();
} catch (ProcessorException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
setTopFolder(resourcesToExport, topFolder);
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
// boolean ok =executeExportOperation(new ArchiveFileExportOperationFullPath(process));
// File file = createSapgicProperty();
ArchiveFileExportOperationFullPath exporterOperation = getExporterOperation(resourcesToExport);
// exportResource(topFolder, "", "", 1);
boolean ok = executeExportOperation(exporterOperation);
// path can like name/name
manager.deleteTempFiles();
ProcessorUtilities.resetExportConfig();
String projectName = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLabel();
List<JobResource> jobResources = new ArrayList<JobResource>();
for (ExportFileResource proces : process) {
try {
proces.setProcess((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(proces.getItem().getProperty()).getItem());
} catch (PersistenceException e) {
e.printStackTrace();
}
ProcessItem processItem = (ProcessItem) proces.getItem();
JobInfo jobInfo = new JobInfo(processItem, processItem.getProcess().getDefaultContext());
jobResources.add(new JobResource(projectName, jobInfo));
Set<JobInfo> jobInfos = ProcessorUtilities.getChildrenJobInfo(processItem);
for (JobInfo subjobInfo : jobInfos) {
jobResources.add(new JobResource(projectName, subjobInfo));
}
}
JobResourceManager reManager = JobResourceManager.getInstance();
for (JobResource r : jobResources) {
if (reManager.isProtected(r)) {
try {
ProcessorUtilities.generateCode(r.getJobInfo().getJobId(), r.getJobInfo().getContextName(), r.getJobInfo().getJobVersion(), false, false);
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
} else {
reManager.deleteResource(r);
}
}
return ok;
}
use of org.talend.core.ui.export.ArchiveFileExportOperationFullPath in project tesb-studio-se by Talend.
the class ExportServiceWithMavenAction method addMavenFilesToExport.
private void addMavenFilesToExport(IProgressMonitor monitor) throws Throwable {
manager.setDestinationPath(serviceManager.getDestinationPath());
String tempDestinationPath = getTempDestinationValue();
List<ExportFileResource> resourcesToExport = manager.getExportResources(// $NON-NLS-1$
new ExportFileResource[] { new ExportFileResource(serviceItem, "") });
ArchiveFileExportOperationFullPath exporterOperation = new ArchiveFileExportOperationFullPath(resourcesToExport, tempDestinationPath);
manager.setTopFolder(resourcesToExport);
executeExportOperation(exporterOperation, monitor);
ZipToFile.unZipFile(tempDestinationPath, tempFolder);
FilesUtils.removeFile(new File(tempDestinationPath));
}
Aggregations