org.apache.camel.impl
Class ComponentConfigurationSupport

java.lang.Object
  extended by org.apache.camel.impl.ComponentConfigurationSupport
All Implemented Interfaces:
ComponentConfiguration
Direct Known Subclasses:
DefaultComponentConfiguration, UriComponentConfiguration

public abstract class ComponentConfigurationSupport
extends Object
implements ComponentConfiguration

Useful base class for implementations of ComponentConfiguration


Field Summary
protected  Component component
           
 
Constructor Summary
ComponentConfigurationSupport(Component component)
           
 
Method Summary
 List<String> completeEndpointPath(String completionText)
          A helper method for tools such as CLIs, IDEs or web tools that provides a completion list for Endpoint Paths rather like bash tab completion or Karaf attribute or option completion handers.
 void configureEndpoint(Endpoint endpoint)
          Configures the properties on the given endpoint
 Endpoint createEndpoint()
          Converts the configuration into a URI and then looks up the endpoint in the CamelContext which typically results in a new Endpoint instance being created.
 String createParameterJsonSchema()
          Creates a JSON schema representation of the configuration parameters for this endpoint and the types and validation rules.
 String getBaseUri()
          Returns the base URI without any scheme or URI query parameters (property values)
 Object getParameter(String name)
          Returns the parameter value for the given name
 ParameterConfiguration getParameterConfiguration(String name)
          Returns the URI query parameter configuration for the given parameter name or null if it does not exist
 Map<String,Object> getParameters()
          Returns the current parameters of the configuration (usually encoded as ?foo=bar&whatnot=something URI query parameters)
 String getUriString()
          Returns the URI string (without schema) with query parameters for the current configuration which can then be used to create an Endpoint
 void setBaseUri(String baseUri)
          Sets the base URI without any query parameters added
 void setParameter(String name, Object value)
          Sets the parameter value of the given name
 void setParameters(Map<String,Object> newValues)
          Sets the parameter values of this configuration
 void setUriString(String uri)
          Sets the URI string (without schema but with optional query parameters) which will update the ComponentConfiguration.getBaseUri() and the ComponentConfiguration.getParameters() values
protected  void validatePropertyName(String name)
          Allow implementations to validate whether a property name is valid and either throw an exception or log a warning of an unknown property being used
protected  Object validatePropertyValue(String name, Object value)
          Allow implementations to validate whether a property name is valid and either throw an exception or log a warning of an unknown property being used and to convert the given value to the correct type before updating the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.camel.ComponentConfiguration
getEndpointParameter, getParameterConfigurationMap, setEndpointParameter
 

Field Detail

component

protected final Component component
Constructor Detail

ComponentConfigurationSupport

public ComponentConfigurationSupport(Component component)
Method Detail

getParameters

public Map<String,Object> getParameters()
Description copied from interface: ComponentConfiguration
Returns the current parameters of the configuration (usually encoded as ?foo=bar&whatnot=something URI query parameters)

Specified by:
getParameters in interface ComponentConfiguration

setParameters

public void setParameters(Map<String,Object> newValues)
Description copied from interface: ComponentConfiguration
Sets the parameter values of this configuration

Specified by:
setParameters in interface ComponentConfiguration

getParameter

public Object getParameter(String name)
Description copied from interface: ComponentConfiguration
Returns the parameter value for the given name

Specified by:
getParameter in interface ComponentConfiguration
Parameters:
name - the name of the URI query parameter to get
Returns:
the value of the parameter

setParameter

public void setParameter(String name,
                         Object value)
Description copied from interface: ComponentConfiguration
Sets the parameter value of the given name

Specified by:
setParameter in interface ComponentConfiguration
Parameters:
name - the name of the URI query parameter
value - the new value of the parameter

getBaseUri

public String getBaseUri()
Returns the base URI without any scheme or URI query parameters (property values)

Specified by:
getBaseUri in interface ComponentConfiguration

setBaseUri

public void setBaseUri(String baseUri)
Description copied from interface: ComponentConfiguration
Sets the base URI without any query parameters added

Specified by:
setBaseUri in interface ComponentConfiguration

createEndpoint

public Endpoint createEndpoint()
                        throws Exception
Description copied from interface: ComponentConfiguration
Converts the configuration into a URI and then looks up the endpoint in the CamelContext which typically results in a new Endpoint instance being created.

Specified by:
createEndpoint in interface ComponentConfiguration
Throws:
Exception

configureEndpoint

public void configureEndpoint(Endpoint endpoint)
Configures the properties on the given endpoint

Specified by:
configureEndpoint in interface ComponentConfiguration

getUriString

public String getUriString()
Description copied from interface: ComponentConfiguration
Returns the URI string (without schema) with query parameters for the current configuration which can then be used to create an Endpoint

Specified by:
getUriString in interface ComponentConfiguration

setUriString

public void setUriString(String uri)
                  throws URISyntaxException
Description copied from interface: ComponentConfiguration
Sets the URI string (without schema but with optional query parameters) which will update the ComponentConfiguration.getBaseUri() and the ComponentConfiguration.getParameters() values

Specified by:
setUriString in interface ComponentConfiguration
Parameters:
uri - the new URI string with query arguments
Throws:
URISyntaxException

getParameterConfiguration

public ParameterConfiguration getParameterConfiguration(String name)
Description copied from interface: ComponentConfiguration
Returns the URI query parameter configuration for the given parameter name or null if it does not exist

Specified by:
getParameterConfiguration in interface ComponentConfiguration

completeEndpointPath

public List<String> completeEndpointPath(String completionText)
Description copied from interface: ComponentConfiguration
A helper method for tools such as CLIs, IDEs or web tools that provides a completion list for Endpoint Paths rather like bash tab completion or Karaf attribute or option completion handers. So given the current configuration data, return a list of completions given the specified text. e.g. return the files in a directory, the matching queues in a message broker, the database tables in a database component etc

Specified by:
completeEndpointPath in interface ComponentConfiguration
Parameters:
completionText - the prefix text used to complete on (usually a matching bit of text)
Returns:
a list of matches

createParameterJsonSchema

public String createParameterJsonSchema()
Description copied from interface: ComponentConfiguration
Creates a JSON schema representation of the configuration parameters for this endpoint and the types and validation rules.

Specified by:
createParameterJsonSchema in interface ComponentConfiguration
Returns:
a JSON string which represents the JSON schema for this endpoints configuration parameters.

validatePropertyName

protected void validatePropertyName(String name)
Allow implementations to validate whether a property name is valid and either throw an exception or log a warning of an unknown property being used


validatePropertyValue

protected Object validatePropertyValue(String name,
                                       Object value)
Allow implementations to validate whether a property name is valid and either throw an exception or log a warning of an unknown property being used and to convert the given value to the correct type before updating the value.



Apache Camel