Search in sources :

Example 1 with IEcosCategory

use of org.talend.dataprofiler.ecos.model.IEcosCategory 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 IEcosCategory

use of org.talend.dataprofiler.ecos.model.IEcosCategory 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)

Example 3 with IEcosCategory

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

the class ExchangeFolderRepNode method buildRepositoryNode.

/**
 * DOC xqliu Comment method "buildRepositoryNode".
 *
 * @param result
 * @return
 */
private List<IRepositoryNode> buildRepositoryNode(Object[] result) {
    List<IRepositoryNode> list = new ArrayList<IRepositoryNode>();
    if (result != null && result.length > 0) {
        if (result[0] instanceof String) {
            for (Object obj : result) {
                ExchangeCategoryRepNode exchangeCategoryRepNode = new ExchangeCategoryRepNode(null, this, ENodeType.REPOSITORY_ELEMENT, getProject());
                exchangeCategoryRepNode.setFlag(false);
                exchangeCategoryRepNode.setMsg((String) obj);
                list.add(exchangeCategoryRepNode);
            }
        } else if (result[0] instanceof IEcosCategory) {
            for (Object obj : result) {
                // MOD klliu bug TDQ-3754: Hide the parser rules when in TOP 2011-10-24
                IEcosCategory category = (IEcosCategory) obj;
                String name = category.getName();
                ExchangeCategoryRepNode exchangeCategoryRepNode = new ExchangeCategoryRepNode(category, this, ENodeType.REPOSITORY_ELEMENT, getProject());
                exchangeCategoryRepNode.setFlag(true);
                // $NON-NLS-1$
                exchangeCategoryRepNode.setMsg("");
                if (!(name.equals("ParserRule") && PluginChecker.isOnlyTopLoaded())) {
                    // $NON-NLS-1$
                    list.add(exchangeCategoryRepNode);
                }
            }
        }
    }
    return list;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory)

Example 4 with IEcosCategory

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

the class ResourceViewContentProvider method hasChildren.

@Override
public boolean hasChildren(Object element) {
    try {
        if (element instanceof IRepositoryNode) {
            IRepositoryNode node = (IRepositoryNode) element;
            IRepositoryViewObject viewObject = node.getObject();
            if (viewObject instanceof MetadataColumnRepositoryObject) {
                return false;
            } else if (node instanceof ExchangeFolderRepNode || node instanceof ExchangeCategoryRepNode || node instanceof SysIndicatorFolderRepNode || element instanceof DBTableRepNode || element instanceof DBViewRepNode || element instanceof DBCatalogRepNode || element instanceof DBSchemaRepNode) {
                // ExchangeCategoryRepNode always have children
                return true;
            } else if (node instanceof ExchangeComponentRepNode) {
                // ExchangeComponentRepNode always don't have children
                return false;
            } else if (element instanceof DBTableFolderRepNode) {
                // MOD gdbu 2011-9-1 TDQ-3457
                if (DQRepositoryNode.isOnFilterring()) {
                    return true;
                }
                DBTableFolderRepNode dbTableFolder = (DBTableFolderRepNode) element;
                return dbTableFolder.hasChildren();
            } else if (element instanceof DBViewFolderRepNode) {
                if (DQRepositoryNode.isOnFilterring()) {
                    return true;
                }
                DBViewFolderRepNode dbViewFolder = (DBViewFolderRepNode) element;
                return dbViewFolder.hasChildren();
            // ~TDQ-3457
            }
        } else if (element instanceof IEcosCategory) {
            return true;
        }
    // // MOD qiongli feature 9486
    // if (element instanceof IFolder) {
    // // MOD yyi 2010-09-30 15271: svn project can't load exchange nodes
    // if (ResourceManager.isExchangeFolder((IFolder) element)) {
    // return true;
    // }
    // // ~15271
    // List<Object> obsLs = Arrays.asList(super.getChildren(element));
    // if (obsLs.size() == 1) {
    // Object obj = (Object) obsLs.get(0);
    // if (obj instanceof IFolder && ((IFolder) obj).getName().equals(PluginConstant.SVN_SUFFIX))
    // return false;
    // }
    // } else if (element instanceof DQRecycleBinNode) {
    // DQRecycleBinNode rbn = (DQRecycleBinNode) element;
    // Object obj = rbn.getObject();
    // if (obj instanceof IFolder) {
    // try {
    // return ((IFolder) obj).members().length > 0;
    // } catch (CoreException e) {
    // log.error(e);
    // }
    // }
    // return false;
    // }
    } catch (MissingDriverException e) {
        if (PluginChecker.isOnlyTopLoaded()) {
            MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
            DefaultMessagesImpl.getString("ResourceViewContentProvider.warining"), e.getErrorMessage());
        } else {
            log.error(e, e);
        }
        return false;
    }
    return super.hasChildren(element);
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ExchangeFolderRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) SysIndicatorFolderRepNode(org.talend.dq.nodes.SysIndicatorFolderRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) MissingDriverException(org.talend.utils.exceptions.MissingDriverException) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode)

Aggregations

IEcosCategory (org.talend.dataprofiler.ecos.model.IEcosCategory)4 ArrayList (java.util.ArrayList)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 EcosCategory (org.talend.dataprofiler.ecos.model.impl.EcosCategory)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 List (java.util.List)1 ExecutorService (java.util.concurrent.ExecutorService)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)1 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)1 ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)1 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)1 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)1 DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)1 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)1 DBViewFolderRepNode (org.talend.dq.nodes.DBViewFolderRepNode)1 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)1 SysIndicatorFolderRepNode (org.talend.dq.nodes.SysIndicatorFolderRepNode)1 MissingDriverException (org.talend.utils.exceptions.MissingDriverException)1