-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Component.java
101 lines (92 loc) · 3.62 KB
/
Component.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import org.apache.camel.component.extension.ComponentExtension;
/**
* A <a href="http://camel.apache.org/component.html">component</a> is
* a factory of {@link Endpoint} objects.
*
* @version
*/
public interface Component extends CamelContextAware {
/**
* Attempt to resolve an endpoint for the given URI if the component is
* capable of handling the URI.
* <p/>
* See {@link #useRawUri()} for controlling whether the passed in uri
* should be as-is (raw), or encoded (default).
*
* @param uri the URI to create; either raw or encoded (default)
* @return a newly created {@link Endpoint} or null if this component cannot create
* {@link Endpoint} instances using the given uri
* @throws Exception is thrown if error creating the endpoint
* @see #useRawUri()
*/
Endpoint createEndpoint(String uri) throws Exception;
/**
* Whether to use raw or encoded uri, when creating endpoints.
* <p/>
* <b>Notice:</b> When using raw uris, then the parameter values is raw as well.
*
* @return <tt>true</tt> to use raw uris, <tt>false</tt> to use encoded uris (default).
*
* @since Camel 2.11.0
*/
boolean useRawUri();
/**
* Attempt to create a configuration object from the given uri
*
* @param uri the configuration URI
* @return a newly created {@link EndpointConfiguration}
* @throws Exception is thrown if the configuration URI is invalid
*
* @since Camel 2.9.0
*/
@Deprecated
EndpointConfiguration createConfiguration(String uri) throws Exception;
/**
* Creates a configuration helper object for a component that lets you configure the various
* URI and parameter values; then create the full URI for it, create a new Endpoint from it
* or configure an existing Endpoint from the values.
*
* This method is intended to be used in cases where there is not yet a full URI to
* configure an endpoint yet; but rather there are a number of parameters to configure
* to then build up a new URI or directly create an Endpoint from the parameter values.
*/
@Deprecated
ComponentConfiguration createComponentConfiguration();
/**
* Gets a list of supported extensions.
*
* @return the list of extensions.
*/
default Collection<Class<? extends ComponentExtension>> getSupportedExtensions() {
return Collections.emptyList();
}
/**
* Gets the extension of the given type.
*
* @param extensionType tye type of the extensions
* @return an optional extension
*/
default <T extends ComponentExtension> Optional<T> getExtension(Class<T> extensionType) {
return Optional.empty();
}
}