feat(TUP-29651): initial implement

This commit is contained in:
bhe-talendbj
2020-12-25 18:53:31 +08:00
parent e6a9513d45
commit c8ef10ccc6
3 changed files with 36 additions and 19 deletions

View File

@@ -78,6 +78,7 @@ import org.talend.core.AbstractDQModelService;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
import org.talend.core.IESBService;
import org.talend.core.ILibraryManagerService;
import org.talend.core.ITDQRepositoryService;
import org.talend.core.PluginChecker;
import org.talend.core.context.CommandLineContext;
@@ -2094,6 +2095,27 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
*/
public void logOnProject(Project project, IProgressMonitor monitor) throws LoginException, PersistenceException {
try {
Thread initilizeT = new Thread(new Runnable() {
@Override
public void run() {
log.info("initilizeT stated ...");
// IComponentsService service = null;
// if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
// service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
// }
// service.getComponentsFactory().readComponents();
// log.info("readComponents done");
ILibraryManagerService repositoryBundleService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
repositoryBundleService.createModulesIndexFromComponentAndExtension();
log.info("createModulesIndexFromComponentAndExtension done");
repositoryBundleService.setInitialized();
log.info("setInitialized done");
}
});
initilizeT.setName("ILibraryManagerService");
initilizeT.start();
TimeMeasurePerformance.begin("logOnProject", "logon project name '" + project.getLabel()+"'"); //$NON-NLS-1$ //$NON-NLS-2$
try {
/**

View File

@@ -32,7 +32,7 @@ import org.talend.core.model.general.ILibrariesService;
*/
public class ComponentManager {
private static ComponentsCache cache;
private static ComponentsCache cache = ComponentCacheFactory.eINSTANCE.createComponentsCache();
private static final String TALEND_COMPONENT_CACHE = "ComponentsCache.";
@@ -41,9 +41,6 @@ public class ComponentManager {
private static boolean modified = false;
public static ComponentsCache getComponentCache() {
if (cache == null) {
cache = ComponentCacheFactory.eINSTANCE.createComponentsCache();
}
return cache;
}
@@ -57,16 +54,6 @@ public class ComponentManager {
} 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);
}
}

View File

@@ -199,12 +199,20 @@ public class JavaLibrariesService extends AbstractLibrariesService {
}
// 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 and libraries from extension
repositoryBundleService.createModulesIndexFromComponentAndExtension(monitorWrap);
repositoryBundleService.setInitialized();
}
// if (!repositoryBundleService.isInitialized()) {
// // 2. Components libraries and libraries from extension
// repositoryBundleService.createModulesIndexFromComponentAndExtension(monitorWrap);
// repositoryBundleService.setInitialized();
// }
while (!repositoryBundleService.isInitialized()) {
try {
Thread.sleep(2);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
repositoryBundleService.installModules(ModulesNeededProvider.getSystemRunningModules(), null);
// clean the temp library of job needed in .java\lib