use of org.talend.core.model.general.ILibrariesService in project tdi-studio-se by Talend.
the class SubjobContainerPart method showModules.
private void showModules(Node node) {
ILibrariesService moduleService = CorePlugin.getDefault().getLibrariesService();
if (moduleService == null) {
return;
}
List<Problem> problems = moduleService.getProblems(node, node);
List<Problem> mproblems = new ArrayList<Problem>();
List<String> modulesName = new ArrayList<String>();
String componentName = null;
String moduleStr = "Module_";
for (Problem pro : problems) {
if (pro.getStatus() == ProblemStatus.ERROR && pro.getKey() != null && pro.getKey().startsWith(moduleStr)) {
mproblems.add(pro);
}
}
if (mproblems.isEmpty()) {
return;
}
for (Problem pro : mproblems) {
if (componentName == null) {
componentName = pro.getComponentName();
}
String key = pro.getKey();
if (key.contains(moduleStr)) {
int first = key.indexOf(moduleStr);
String keydes = key.substring(first + moduleStr.length());
modulesName.add(keydes);
}
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
try {
IViewPart view = page.showView("org.talend.designer.codegen.perlmodule.ModulesView");
if (view instanceof ModulesView) {
((ModulesView) view).selectUninstalledItem(componentName, modulesName);
}
} catch (PartInitException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.general.ILibrariesService in project tesb-studio-se by Talend.
the class SyncNexusButtonController method deploy.
private void deploy(File file, String version) {
try {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
service.deployLibrary(file.toURI().toURL(), version);
}
} catch (IOException ee) {
ExceptionHandler.process(ee);
}
}
use of org.talend.core.model.general.ILibrariesService in project tdi-studio-se by Talend.
the class ImportItemUtil method deployJarToDes.
@SuppressWarnings("unchecked")
private void deployJarToDes(final ResourcesManager manager, Set<String> extRoutines) {
File file = null;
if (extRoutines.isEmpty()) {
return;
}
Set<URL> jarsToDeploy = new HashSet<URL>();
for (Object element : manager.getPaths()) {
String value = element.toString();
file = new File(value);
if (extRoutines.contains(file.getName())) {
try {
jarsToDeploy.add(file.toURL());
} catch (MalformedURLException e) {
ExceptionHandler.process(e);
}
}
}
if (jarsToDeploy.size() > 0) {
ILibrariesService libService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
try {
libService.deployLibrarys(jarsToDeploy.toArray(new URL[0]));
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.core.model.general.ILibrariesService in project tesb-studio-se by Talend.
the class CamelTalendEditor method doSave.
@Override
public void doSave(IProgressMonitor monitor) {
super.doSave(monitor);
if (!PluginChecker.isTIS()) {
return;
}
NexusServerBean nexusServerBean = TalendLibsServerManager.getInstance().getCustomNexusServer();
if (nexusServerBean == null) {
return;
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
ILibrariesService service = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
List<? extends INode> graphicalNodes = this.getProcess().getGraphicalNodes();
for (INode node : graphicalNodes) {
if (node.getComponent().getName().equals("cConfig")) {
List<Map<String, String>> jars = (List) node.getElementParameter("DRIVER_JAR").getValue();
for (Map<String, String> o : jars) {
String jn = TalendQuoteUtils.removeQuotes(o.get("JAR_NAME"));
String jnv = TalendQuoteUtils.removeQuotes(o.get("JAR_NEXUS_VERSION"));
String jv = String.valueOf(o.get("JAR_PATH"));
String a = jn.replaceFirst("[.][^.]+$", "");
if (StringUtils.isNotBlank(jv)) {
File jarFile = new File(jv);
if (jarFile.exists()) {
try {
service.deployLibrary(jarFile.toURI().toURL(), "mvn:org.talend.libraries/" + a + "/" + jnv + "/jar");
} catch (Exception e) {
e.printStackTrace();
}
cConfigStoredInfo.put(jn, jnv);
o.put("JAR_PATH", "");
}
}
if (cConfigStoredInfo.get(jn) == null) {
cConfigStoredInfo.put(jn, jnv);
continue;
}
if (cConfigStoredInfo.get(jn).equals(jnv)) {
continue;
} else {
MavenArtifact ma = new MavenArtifact();
ma.setArtifactId(a);
ma.setGroupId("org.talend.libraries");
ma.setVersion(cConfigStoredInfo.get(jn));
ma.setType("jar");
String p = PomUtil.getAbsArtifactPath(ma);
if (p != null) {
File file = new File(p);
try {
if (file.exists()) {
File tmp = new File(ExportJobUtil.getTmpFolder() + File.separator + jn);
FilesUtils.copyFile(file, tmp);
service.deployLibrary(tmp.toURI().toURL(), "mvn:org.talend.libraries/" + a + "/" + jnv + "/jar");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
Aggregations