Java 类org.apache.camel.catalog.CamelCatalog 实例源码

项目:django    文件:EditConnectorOptionsStep.java   
public EditConnectorOptionsStep(ProjectFactory projectFactory,
                                CamelCatalog camelCatalog,
                                String connectorName, String camelComponentName, String group,
                                List<InputComponent> allInputs,
                                List<InputComponent> inputs,
                                boolean last, int index, int total) {
    this.projectFactory = projectFactory;
    this.camelCatalog = camelCatalog;
    this.connectorName = connectorName;
    this.camelComponentName = camelComponentName;
    this.group = group;
    this.allInputs = allInputs;
    this.inputs = inputs;
    this.last = last;
    // we want to 1-based
    this.index = index + 1;
    this.total = total;
}
项目:camel-language-server    文件:CamelOptionSchemaCompletionsFuture.java   
@Override
public List<CompletionItem> apply(CamelCatalog catalog) {
    Stream<EndpointOptionModel> endpointOptions = ModelHelper.generateComponentModel(catalog.componentJSonSchema(camelComponentName), true).getEndpointOptions().stream();
    return endpointOptions
            .filter(endpoint -> "parameter".equals(endpoint.getKind()))
            .filter(endpoint -> {
                String group = endpoint.getGroup();
                if (isProducer) {
                    return !"consumer".equals(group);
                } else {
                    return !"producer".equals(group);
                }
            })
            .map(parameter -> {
                CompletionItem completionItem = new CompletionItem(parameter.getName());
                String insertText = parameter.getName() + "=";
                if(parameter.getDefaultValue() != null) {
                    insertText += parameter.getDefaultValue();
                }
                completionItem.setInsertText(insertText);
                return completionItem;
            })
            .collect(Collectors.toList());
}
项目:fabric8-forge    文件:ConfigureComponentPropertiesStep.java   
public ConfigureComponentPropertiesStep(ProjectFactory projectFactory,
                                        DependencyInstaller dependencyInstaller,
                                        CamelCatalog camelCatalog,
                                        String componentName, String group,
                                        List<InputComponent> allInputs,
                                        List<InputComponent> inputs,
                                        boolean last, int index, int total) {
    this.projectFactory = projectFactory;
    this.dependencyInstaller = dependencyInstaller;
    this.camelCatalog = camelCatalog;
    this.componentName = componentName;
    this.group = group;
    this.allInputs = allInputs;
    this.inputs = inputs;
    this.last = last;
    // we want to 1-based
    this.index = index + 1;
    this.total = total;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static Set<String> componentsFromArtifact(CamelCatalog camelCatalog, String artifactId) {
    Set<String> answer = new TreeSet<String>();

    // use the camel catalog to find what components the artifact has
    for (String name : camelCatalog.findComponentNames()) {
        String json = camelCatalog.componentJSonSchema(name);
        if (json != null) {
            List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
            String scheme = null;
            String artifact = null;
            for (Map<String, String> row : data) {
                if (row.get("artifactId") != null) {
                    artifact = row.get("artifactId");
                }
                if (row.get("scheme") != null) {
                    scheme = row.get("scheme");
                }
            }
            if (artifactId.equals(artifact) && scheme != null) {
                answer.add(scheme);
            }
        }
    }

    return answer;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static Set<String> dataFormatsFromArtifact(CamelCatalog camelCatalog, String artifactId) {
    Set<String> answer = new TreeSet<String>();

    // use the camel catalog to find what components the artifact has
    for (String name : camelCatalog.findDataFormatNames()) {
        String json = camelCatalog.dataFormatJSonSchema(name);
        if (json != null) {
            List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("dataformat", json, false);
            String df = null;
            String artifact = null;
            for (Map<String, String> row : data) {
                if (row.get("artifactId") != null) {
                    artifact = row.get("artifactId");
                }
                if (row.get("name") != null) {
                    df = row.get("name");
                }
            }
            if (artifactId.equals(artifact) && df != null) {
                answer.add(df);
            }
        }
    }

    return answer;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static Set<String> languagesFromArtifact(CamelCatalog camelCatalog, String artifactId) {
    Set<String> answer = new TreeSet<String>();

    // use the camel catalog to find what components the artifact has
    for (String name : camelCatalog.findLanguageNames()) {
        String json = camelCatalog.languageJSonSchema(name);
        if (json != null) {
            List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("language", json, false);
            String lan = null;
            String artifact = null;
            for (Map<String, String> row : data) {
                if (row.get("artifactId") != null) {
                    artifact = row.get("artifactId");
                }
                if (row.get("name") != null) {
                    lan = row.get("name");
                }
            }
            if (artifactId.equals(artifact) && lan != null) {
                answer.add(lan);
            }
        }
    }

    return answer;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value is matching the default value from the given component.
 *
 * @param scheme the component name
 * @param key    the option key
 * @param value  the option value
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isDefaultValue(CamelCatalog camelCatalog, String scheme, String key, String value) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String defaultValue = propertyMap.get("defaultValue");
            if (key.equals(name)) {
                return value.equalsIgnoreCase(defaultValue);
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value is matching the default value from the given component.
 *
 * @param scheme the component name
 * @param key    the option key
 * @param value  the option value
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isDefaultValueComponent(CamelCatalog camelCatalog, String scheme, String key, String value) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String defaultValue = propertyMap.get("defaultValue");
            if (key.equals(name)) {
                return value.equalsIgnoreCase(defaultValue);
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given key is a multi valued option
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
 */
public static boolean isMultiValue(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String multiValue = propertyMap.get("multiValue");
            if (key.equals(name)) {
                return "true".equals(multiValue);
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given key is a multi valued option
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
 */
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String prefix = propertyMap.get("prefix");
            if (key.equals(name)) {
                return prefix;
            }
        }
    }
    return null;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value corresponds to a dummy none placeholder for an enum type
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isNonePlaceholderEnumValue(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String enums = propertyMap.get("enum");
            if (key.equals(name) && enums != null) {
                if (!enums.contains("none")) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value corresponds to a dummy none placeholder for an enum type
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isNonePlaceholderEnumValueComponent(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String enums = propertyMap.get("enum");
            if (key.equals(name) && enums != null) {
                if (!enums.contains("none")) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Get's the java type for the given option if its enum based, otherwise it returns null
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static String getEnumJavaTypeComponent(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String javaType = propertyMap.get("javaType");
            String name = propertyMap.get("name");
            String enums = propertyMap.get("enum");
            if (key.equals(name) && enums != null) {
                return javaType;
            }
        }
    }
    return null;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value is matching the default value from the given model.
 *
 * @param modelName the model name
 * @param key    the option key
 * @param value  the option value
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isModelDefaultValue(CamelCatalog camelCatalog, String modelName, String key, String value) {
    // use the camel catalog
    String json = camelCatalog.modelJSonSchema(modelName);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String defaultValue = propertyMap.get("defaultValue");
            if (key.equals(name)) {
                return value.equalsIgnoreCase(defaultValue);
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given key is an expression kind
 *
 * @param modelName the model name
 * @param key    the option key
 * @return <tt>true</tt> if the key is an expression type, <tt>false</tt> otherwise
 */
public static boolean isModelExpressionKind(CamelCatalog camelCatalog, String modelName, String key) {
    // use the camel catalog
    String json = camelCatalog.modelJSonSchema(modelName);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            if (key.equals(name)) {
                return "expression".equals(propertyMap.get("kind"));
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Gets the java type of the given model
 *
 * @param modelName the model name
 * @return the java type
 */
public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) {
    // use the camel catalog
    String json = camelCatalog.modelJSonSchema(modelName);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String javaType = propertyMap.get("javaType");
            if (javaType != null) {
                return javaType;
            }
        }
    }
    return null;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Whether the EIP supports outputs
 *
 * @param modelName the model name
 * @return <tt>true</tt> if output supported, <tt>false</tt> otherwise
 */
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) {
    // use the camel catalog
    String json = camelCatalog.modelJSonSchema(modelName);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String output = propertyMap.get("output");
            if (output != null) {
                return "true".equals(output);
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Whether the component is consumer only
 */
public static boolean isComponentConsumerOnly(CamelCatalog camelCatalog, String scheme) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        return false;
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String consumerOnly = propertyMap.get("consumerOnly");
            if (consumerOnly != null) {
                return true;
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
/**
 * Whether the component is consumer only
 */
public static boolean isComponentProducerOnly(CamelCatalog camelCatalog, String scheme) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        return false;
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String consumerOnly = propertyMap.get("producerOnly");
            if (consumerOnly != null) {
                return true;
            }
        }
    }
    return false;
}
项目:fabric8-forge    文件:CamelXmlHelper.java   
protected static List<ContextDto> parseCamelContexts(CamelCatalog camelCatalog, File xmlFile) throws Exception {
    List<ContextDto> camelContexts = new ArrayList<>();

    RouteXml routeXml = new RouteXml();
    XmlModel xmlModel = routeXml.unmarshal(xmlFile);

    // TODO we don't handle multiple contexts inside an XML file!
    CamelContextFactoryBean contextElement = xmlModel.getContextElement();
    String name = contextElement.getId();
    List<RouteDefinition> routeDefs = contextElement.getRoutes();
    ContextDto context = new ContextDto(name);
    camelContexts.add(context);
    String key = name;
    if (Strings.isNullOrBlank(key)) {
        key = "_camelContext" + camelContexts.size();
    }
    context.setKey(key);
    List<NodeDto> routes = createRouteDtos(camelCatalog, routeDefs, context);
    context.setChildren(routes);
    return camelContexts;
}
项目:fabric8-forge    文件:CamelXmlHelper.java   
protected static List<NodeDto> createRouteDtos(CamelCatalog camelCatalog, List<RouteDefinition> routeDefs, ContextDto context) {
    List<NodeDto> answer = new ArrayList<>();
    Map<String, Integer> nodeCounts = new HashMap<>();
    for (RouteDefinition def : routeDefs) {
        RouteDto route = new RouteDto();
        route.setId(def.getId());
        route.setLabel(CamelModelHelper.getDisplayText(def));
        route.setDescription(CamelModelHelper.getDescription(def));
        answer.add(route);
        route.defaultKey(context, nodeCounts);

        addInputs(camelCatalog, route, def.getInputs());
        addOutputs(camelCatalog, route, def.getOutputs());
    }
    return answer;
}
项目:fabric8-forge    文件:ConfigureEndpointPropertiesStep.java   
public ConfigureEndpointPropertiesStep(ProjectFactory projectFactory,
                                       DependencyInstaller dependencyInstaller,
                                       CamelCatalog camelCatalog,
                                       String componentName, String group,
                                       List<InputComponent> allInputs,
                                       List<InputComponent> inputs,
                                       boolean last, int index, int total) {
    this.projectFactory = projectFactory;
    this.dependencyInstaller = dependencyInstaller;
    this.camelCatalog = camelCatalog;
    this.componentName = componentName;
    this.group = group;
    this.allInputs = allInputs;
    this.inputs = inputs;
    this.last = last;
    // we want to 1-based
    this.index = index + 1;
    this.total = total;
}
项目:fabric8-forge    文件:ConfigureEipPropertiesStep.java   
public ConfigureEipPropertiesStep(ProjectFactory projectFactory,
                                  CamelCatalog camelCatalog,
                                  String eipName, String group,
                                  List<InputComponent> allInputs,
                                  List<InputComponent> inputs,
                                  boolean last, int index, int total) {
    this.projectFactory = projectFactory;
    this.camelCatalog = camelCatalog;
    this.eipName = eipName;
    this.group = group;
    this.allInputs = allInputs;
    this.inputs = inputs;
    this.last = last;
    // we want to 1-based
    this.index = index + 1;
    this.total = total;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given key is a multi valued option
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
 */
public static boolean isMultiValue(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String multiValue = propertyMap.get("multiValue");
            if (key.equals(name)) {
                return "true".equals(multiValue);
            }
        }
    }
    return false;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given key is a multi valued option
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
 */
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String prefix = propertyMap.get("prefix");
            if (key.equals(name)) {
                return prefix;
            }
        }
    }
    return null;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value is matching the default value from the given component.
 *
 * @param scheme the component name
 * @param key    the option key
 * @param value  the option value
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isDefaultValue(CamelCatalog camelCatalog, String scheme, String key, String value) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String defaultValue = propertyMap.get("defaultValue");
            if (key.equals(name)) {
                return value.equalsIgnoreCase(defaultValue);
            }
        }
    }
    return false;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Checks whether the given value corresponds to a dummy none placeholder for an enum type
 *
 * @param scheme the component name
 * @param key    the option key
 * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise
 */
public static boolean isNonePlaceholderEnumValue(CamelCatalog camelCatalog, String scheme, String key) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme);
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String name = propertyMap.get("name");
            String enums = propertyMap.get("enum");
            if (key.equals(name) && enums != null) {
                if (!enums.contains("none")) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
    return false;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Whether the component is consumer only
 */
public static boolean isComponentConsumerOnly(CamelCatalog camelCatalog, String scheme) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        return false;
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String consumerOnly = propertyMap.get("consumerOnly");
            if (consumerOnly != null) {
                return true;
            }
        }
    }
    return false;
}
项目:django    文件:CamelCatalogHelper.java   
/**
 * Whether the component is consumer only
 */
public static boolean isComponentProducerOnly(CamelCatalog camelCatalog, String scheme) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        return false;
    }

    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
    if (data != null) {
        for (Map<String, String> propertyMap : data) {
            String consumerOnly = propertyMap.get("producerOnly");
            if (consumerOnly != null) {
                return true;
            }
        }
    }
    return false;
}
项目:django    文件:EditComponentOptionsStep.java   
public EditComponentOptionsStep(ProjectFactory projectFactory,
                                CamelCatalog camelCatalog,
                                String connectorName, String camelComponentName, String group,
                                List<InputComponent> allInputs,
                                List<InputComponent> inputs,
                                boolean last, int index, int total) {
    this.projectFactory = projectFactory;
    this.camelCatalog = camelCatalog;
    this.connectorName = connectorName;
    this.camelComponentName = camelComponentName;
    this.group = group;
    this.allInputs = allInputs;
    this.inputs = inputs;
    this.last = last;
    // we want to 1-based
    this.index = index + 1;
    this.total = total;
}
项目:syndesis    文件:ComponentDefinition.java   
@JsonIgnore
static ComponentDefinition forScheme(CamelCatalog catalog, String scheme) throws IOException {
    final String json = catalog.componentJSonSchema(scheme);

    return new ObjectMapper()
        .registerModule(new Jdk8Module())
        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
        .readValue(json, ComponentDefinition.class);
}
项目:camel-language-server    文件:CamelURIInstance.java   
@Override
public CompletableFuture<List<CompletionItem>> getCompletions(CompletableFuture<CamelCatalog> camelCatalog, int positionInCamelUri) {
    if(getStartPosition() <= positionInCamelUri && positionInCamelUri <= getEndPosition()) {
        return camelCatalog.thenApply(new CamelComponentSchemaCompletionsFuture());
    } else {
        return CompletableFuture.completedFuture(Collections.emptyList());
    }
}
项目:camel-language-server    文件:PathParamURIInstance.java   
@Override
public CompletableFuture<List<CompletionItem>> getCompletions(CompletableFuture<CamelCatalog> camelCatalog, int positionInCamelUri) {
    if(getStartPosition() <= positionInCamelUri && positionInCamelUri <= getEndPosition()) {
        return camelCatalog.thenApply(new CamelComponentSchemaCompletionsFuture());
    } else {
        return CompletableFuture.completedFuture(Collections.emptyList());
    }
}
项目:camel-language-server    文件:CamelComponentSchemaCompletionsFuture.java   
@Override
public List<CompletionItem> apply(CamelCatalog catalog) {
    return catalog.findComponentNames().stream()
            .map(componentName -> ModelHelper.generateComponentModel(catalog.componentJSonSchema(componentName), true))
            .map(componentModel -> {
                CompletionItem completionItem = new CompletionItem(componentModel.getSyntax());
                completionItem.setDocumentation(componentModel.getDescription());
                return completionItem;
            }).collect(Collectors.toList());
}
项目:camel-language-server    文件:CamelOptionValuesCompletionsFuture.java   
@Override
public List<CompletionItem> apply(CamelCatalog camelCatalog) {
    Optional<EndpointOptionModel> endpointModel = retrieveEndpointOptionModel(camelCatalog);
    if(endpointModel.isPresent()) {
        EndpointOptionModel endpointOptionModel = endpointModel.get();
        String enums = endpointOptionModel.getEnums();
        if (enums != null && !enums.isEmpty()) {
            return computeCompletionForEnums(enums);
        } else if(BOOLEAN_TYPE.equals(endpointOptionModel.getType())) {
            return Arrays.asList(new CompletionItem(Boolean.TRUE.toString()), new CompletionItem(Boolean.FALSE.toString()));
        }
    }
    return Collections.emptyList();
}
项目:camel-language-server    文件:CamelOptionValuesCompletionsFuture.java   
private Optional<EndpointOptionModel> retrieveEndpointOptionModel(CamelCatalog camelCatalog) {
    String componentName = optionParamValueURIInstance.getOptionParamURIInstance().getComponentName();
    String keyName = optionParamValueURIInstance.getOptionParamURIInstance().getKey().getKeyName();
    List<EndpointOptionModel> endpointOptions = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentName), true).getEndpointOptions();
    return endpointOptions.stream()
            .filter(endpoint -> keyName.equals(endpoint.getName()))
            .findAny();
}
项目:camel-language-server    文件:HoverFuture.java   
@Override
public Hover apply(CamelCatalog camelCatalog) {
    Hover hover = new Hover();
    ComponentModel componentModel = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentName), true);
    hover.setContents(Collections.singletonList((Either.forLeft(componentModel.getDescription()))));
    return hover;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static ComponentDto createComponentDto(CamelCatalog camelCatalog, String scheme) {
    // use the camel catalog
    String json = camelCatalog.componentJSonSchema(scheme);
    if (json == null) {
        return null;
    }

    ComponentDto dto = new ComponentDto();
    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false);
    for (Map<String, String> row : data) {
        if (row.get("scheme") != null) {
            dto.setScheme(row.get("scheme"));
        } else if (row.get("syntax") != null) {
            dto.setSyntax(row.get("syntax"));
        } else if (row.get("title") != null) {
            dto.setTitle(row.get("title"));
        } else if (row.get("description") != null) {
            dto.setDescription(row.get("description"));
        } else if (row.get("label") != null) {
            String labelText = row.get("label");
            if (Strings.isNotBlank(labelText)) {
                dto.setTags(labelText.split(","));
            }
        } else if (row.get("consumerOnly") != null) {
            dto.setConsumerOnly("true".equals(row.get("consumerOnly")));
        } else if (row.get("producerOnly") != null) {
            dto.setProducerOnly("true".equals(row.get("producerOnly")));
        } else if (row.get("javaType") != null) {
            dto.setJavaType(row.get("javaType"));
        } else if (row.get("groupId") != null) {
            dto.setGroupId(row.get("groupId"));
        } else if (row.get("artifactId") != null) {
            dto.setArtifactId(row.get("artifactId"));
        } else if (row.get("version") != null) {
            dto.setVersion(row.get("version"));
        }
    }
    return dto;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static EipDto createEipDto(CamelCatalog camelCatalog, String modelName) {
    // use the camel catalog
    String json = camelCatalog.modelJSonSchema(modelName);
    if (json == null) {
        return null;
    }

    EipDto dto = new EipDto();
    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
    for (Map<String, String> row : data) {
        if (row.get("name") != null) {
            dto.setName(row.get("name"));
        } else if (row.get("title") != null) {
            dto.setTitle(row.get("title"));
        } else if (row.get("description") != null) {
            dto.setDescription(row.get("description"));
        } else if (row.get("label") != null) {
            String labelText = row.get("label");
            if (Strings.isNotBlank(labelText)) {
                dto.setTags(labelText.split(","));
            }
        } else if (row.get("javaType") != null) {
            dto.setJavaType(row.get("javaType"));
        }
    }
    return dto;
}
项目:fabric8-forge    文件:CamelCatalogHelper.java   
public static DataFormatDto createDataFormatDto(CamelCatalog camelCatalog, String name) {
    // use the camel catalog
    String json = camelCatalog.dataFormatJSonSchema(name);
    if (json == null) {
        return null;
    }

    DataFormatDto dto = new DataFormatDto();
    List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("dataformat", json, false);
    for (Map<String, String> row : data) {
        if (row.get("name") != null) {
            dto.setName(row.get("name"));
        } else if (row.get("modelName") != null) {
            dto.setModelName(row.get("modelName"));
        } else if (row.get("title") != null) {
            dto.setTitle(row.get("title"));
        } else if (row.get("description") != null) {
            dto.setDescription(row.get("description"));
        } else if (row.get("label") != null) {
            String labelText = row.get("label");
            if (Strings.isNotBlank(labelText)) {
                dto.setTags(labelText.split(","));
            }
        } else if (row.get("javaType") != null) {
            dto.setJavaType(row.get("javaType"));
        } else if (row.get("modelJavaType") != null) {
            dto.setModelJavaType(row.get("modelJavaType"));
        } else if (row.get("groupId") != null) {
            dto.setGroupId(row.get("groupId"));
        } else if (row.get("artifactId") != null) {
            dto.setArtifactId(row.get("artifactId"));
        } else if (row.get("version") != null) {
            dto.setVersion(row.get("version"));
        }
    }
    return dto;
}