Search in sources :

Example 1 with IRepositoryTypeProcessor

use of org.talend.core.model.repository.IRepositoryTypeProcessor in project tdi-studio-se by Talend.

the class DatabaseTypeFilter method getHadoopSubMultiRepTypeProcessor.

private IRepositoryTypeProcessor getHadoopSubMultiRepTypeProcessor(String[] repTypes) {
    IHadoopClusterService hadoopClusterService = HadoopRepositoryUtil.getHadoopClusterService();
    if (hadoopClusterService != null) {
        List<String> repTypeList = new ArrayList<String>();
        Map<String, Object> attributes = new HashMap<String, Object>();
        for (String repType : repTypes) {
            Map<String, Object> attr = parseAttributes(repType);
            if (attr == null) {
                repTypeList.add(repType);
            } else {
                attributes.putAll(attr);
            }
        }
        IRepositoryTypeProcessor processor = hadoopClusterService.getHadoopSubMultiRepTypeProcessor(repTypeList.toArray(new String[0]));
        processor.setAttributes(attributes);
        return processor;
    }
    return null;
}
Also used : IHadoopClusterService(org.talend.core.hadoop.IHadoopClusterService) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryTypeProcessor(org.talend.core.model.repository.IRepositoryTypeProcessor)

Example 2 with IRepositoryTypeProcessor

use of org.talend.core.model.repository.IRepositoryTypeProcessor in project tdi-studio-se by Talend.

the class DatabaseTypeFilter method createTypeProcessor.

/**
     * bqian create the correct TypeProcessor according to the type.
     * 
     * @return
     */
private IRepositoryTypeProcessor createTypeProcessor() {
    for (IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
        IRepositoryTypeProcessor processor = handler.getRepositoryTypeProcessor(repositoryType);
        if (processor != null) {
            return processor;
        }
    }
    if (repositoryType != null && repositoryType.contains("|")) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        String[] repTypes = repositoryType.split("\\|");
        IRepositoryTypeProcessor hadoopTypeProcessor = getHadoopSubMultiRepTypeProcessor(repTypes);
        if (hadoopTypeProcessor != null) {
            return hadoopTypeProcessor;
        }
    }
    if (type == null && repositoryTypes != null) {
        return new MetadataMultiTypeProcessor(repositoryTypes);
    }
    if (type == ERepositoryObjectType.PROCESS) {
        return new JobTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA) {
        return new RepositoryTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
        return new SchemaTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA_CON_QUERY) {
        return new QueryTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA_SAP_FUNCTION) {
        return new SAPFunctionProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.CONTEXT) {
        return new ContextTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA_HEADER_FOOTER) {
        return new HeaderFooterTypeProcessor(repositoryType);
    }
    if (type == ERepositoryObjectType.METADATA_VALIDATION_RULES) {
        return new ValidationRuleTypeProcessor(repositoryType, elem);
    }
    //$NON-NLS-1$
    throw new IllegalArgumentException(Messages.getString("RepositoryReviewDialog.0", type));
}
Also used : IRepositoryTypeProcessor(org.talend.core.model.repository.IRepositoryTypeProcessor) RepositoryTypeProcessor(org.talend.repository.ui.processor.RepositoryTypeProcessor) SchemaTypeProcessor(org.talend.repository.ui.processor.SchemaTypeProcessor) IRepositoryContentHandler(org.talend.core.model.repository.IRepositoryContentHandler) MetadataMultiTypeProcessor(org.talend.repository.ui.processor.MetadataMultiTypeProcessor) HeaderFooterTypeProcessor(org.talend.repository.ui.processor.HeaderFooterTypeProcessor) ValidationRuleTypeProcessor(org.talend.repository.ui.processor.ValidationRuleTypeProcessor) JobTypeProcessor(org.talend.repository.ui.processor.JobTypeProcessor) SAPFunctionProcessor(org.talend.repository.ui.processor.SAPFunctionProcessor) IRepositoryTypeProcessor(org.talend.core.model.repository.IRepositoryTypeProcessor) ContextTypeProcessor(org.talend.repository.ui.processor.ContextTypeProcessor) QueryTypeProcessor(org.talend.repository.ui.processor.QueryTypeProcessor)

Aggregations

IRepositoryTypeProcessor (org.talend.core.model.repository.IRepositoryTypeProcessor)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IHadoopClusterService (org.talend.core.hadoop.IHadoopClusterService)1 IRepositoryContentHandler (org.talend.core.model.repository.IRepositoryContentHandler)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 ContextTypeProcessor (org.talend.repository.ui.processor.ContextTypeProcessor)1 HeaderFooterTypeProcessor (org.talend.repository.ui.processor.HeaderFooterTypeProcessor)1 JobTypeProcessor (org.talend.repository.ui.processor.JobTypeProcessor)1 MetadataMultiTypeProcessor (org.talend.repository.ui.processor.MetadataMultiTypeProcessor)1 QueryTypeProcessor (org.talend.repository.ui.processor.QueryTypeProcessor)1 RepositoryTypeProcessor (org.talend.repository.ui.processor.RepositoryTypeProcessor)1 SAPFunctionProcessor (org.talend.repository.ui.processor.SAPFunctionProcessor)1 SchemaTypeProcessor (org.talend.repository.ui.processor.SchemaTypeProcessor)1 ValidationRuleTypeProcessor (org.talend.repository.ui.processor.ValidationRuleTypeProcessor)1