Search in sources :

Example 1 with EcosCategory

use of org.talend.dataprofiler.ecos.model.impl.EcosCategory in project tdq-studio-se by Talend.

the class ObtainEcosComponentJob method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
     */
@Override
protected IStatus run(IProgressMonitor monitor) {
    // $NON-NLS-1$
    monitor.beginTask(DefaultMessagesImpl.getString("ObtainEcosComponentJob.searchComponents"), IProgressMonitor.UNKNOWN);
    // run in another thread, make it possible to stop the remote procedure call when user press cancel
    // button
    ExecutorService executor = Executors.newSingleThreadExecutor();
    Future<List<IEcosComponent>> task = executor.submit(new Callable<List<IEcosComponent>>() {

        public List<IEcosComponent> call() throws Exception {
            EcosystemService.getVersionList();
            IEcosCategory ecosCategory = new EcosCategory(category);
            return ComponentSearcher.getAvailableComponentExtensions(version, ecosCategory);
        }
    });
    while (true) {
        try {
            if (monitor.isCanceled()) {
                // stop the web service call
                task.cancel(true);
                return Status.CANCEL_STATUS;
            } else if (task.isDone()) {
                // web service call complete
                fAvailableComponents = task.get();
                break;
            }
        } catch (Exception e) {
            return Status.CANCEL_STATUS;
        } finally {
            executor.shutdown();
        }
    }
    monitor.done();
    return Status.OK_STATUS;
}
Also used : EcosCategory(org.talend.dataprofiler.ecos.model.impl.EcosCategory) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory) ExecutorService(java.util.concurrent.ExecutorService) List(java.util.List) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory)

Example 2 with EcosCategory

use of org.talend.dataprofiler.ecos.model.impl.EcosCategory in project tdq-studio-se by Talend.

the class EcosystemService method getCategoryList.

public static List<IEcosCategory> getCategoryList(String version) throws Exception {
    String jsonContent = sendGetRequest(CATEGORY_LIST_URL);
    List<EcosCategory> categorys = parseJsonObject(jsonContent, EcosCategory.class);
    if (categorys != null) {
        for (EcosCategory category : categorys) {
            category.setVersion(version);
        }
    } else {
        categorys = Collections.emptyList();
    }
    // MOD yyi 2010-11-29 15271: svn project can't load exchange nodes
    List<IEcosCategory> iCategorys = new ArrayList<IEcosCategory>();
    for (EcosCategory ecosCategory : categorys) {
        iCategorys.add(ecosCategory);
    }
    // ~15271
    return iCategorys;
}
Also used : EcosCategory(org.talend.dataprofiler.ecos.model.impl.EcosCategory) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory) ArrayList(java.util.ArrayList) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory)

Aggregations

IEcosCategory (org.talend.dataprofiler.ecos.model.IEcosCategory)2 EcosCategory (org.talend.dataprofiler.ecos.model.impl.EcosCategory)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ExecutorService (java.util.concurrent.ExecutorService)1