@Override
  public void syncLibraries(IProgressMonitor... monitorWrap) {
    // TODO system routine libraries seems no use ,need to check more...
    // deploy system routine libraries
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
      ILibraryManagerUIService libUiService =
          (ILibraryManagerUIService)
              GlobalServiceRegister.getDefault().getService(ILibraryManagerUIService.class);
      libUiService.initializeSystemLibs();
    }

    if (TalendCacheUtils.cleanComponentCache()) {
      repositoryBundleService.clearCache();
    }
    // Add a new system file, if exists, means all components libs are already setup, so no need to
    // do again.
    // if clean the component cache, it will automatically recheck all libs still.
    if (!repositoryBundleService.isInitialized()) {
      // 2. Components libraries
      if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
        repositoryBundleService.deployComponentsLibs(monitorWrap);
        repositoryBundleService.setInitialized();
      }
    }

    checkInstalledLibraries();

    // clean the temp library of job needed in .java\lib
    cleanLibs();

    log.debug(Messages.getString("JavaLibrariesService.synchronization")); // $NON-NLS-1$
    isLibSynchronized = true;
  }
Ejemplo n.º 2
0
 public static void saveResource() {
   if (isModified()) {
     String installLocation =
         new Path(Platform.getConfigurationLocation().getURL().getPath())
             .toFile()
             .getAbsolutePath();
     try {
       Resource resource = createComponentCacheResource(installLocation);
       resource.getContents().add(cache);
       EmfHelper.saveResource(cache.eResource());
     } catch (PersistenceException e1) {
       ExceptionHandler.process(e1);
     }
     ILibraryManagerService repositoryBundleService =
         (ILibraryManagerService)
             GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
     repositoryBundleService.clearCache();
     if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
       ILibrariesService libService =
           (ILibrariesService)
               GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
       if (libService != null) {
         libService.syncLibraries();
       }
     }
     setModified(false);
   }
 }