001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel; 018 019import java.net.URI; 020 021/** 022 * Holds an {@link Endpoint} configuration as a pojo that can be manipulated and validated. 023 * Camel endpoint configuration is strongly related to URIs. 024 */ 025public interface EndpointConfiguration { 026 027 String URI_SCHEME = "scheme"; 028 String URI_SCHEME_SPECIFIC_PART = "schemeSpecificPart"; 029 String URI_AUTHORITY = "authority"; 030 String URI_USER_INFO = "userInfo"; 031 String URI_HOST = "host"; 032 String URI_PORT = "port"; 033 String URI_PATH = "path"; 034 String URI_QUERY = "query"; 035 String URI_FRAGMENT = "fragment"; 036 037 /** 038 * {@link org.apache.camel.spi.DataFormat} operations. 039 */ 040 public enum UriFormat { 041 Canonical, Provider, Consumer, Complete 042 } 043 044 /** 045 * Returns the URI configuration of an {@link Endpoint}. 046 * 047 * @return the configuration URI. 048 */ 049 URI getURI(); 050 051 /** 052 * Gets the value of a particular parameter. 053 * 054 * @param name the parameter name 055 * @return the configuration URI. 056 * @throws RuntimeCamelException is thrown if error getting the parameter 057 */ 058 <T> T getParameter(String name) throws RuntimeCamelException; 059 060 /** 061 * Sets the value of a particular parameter. 062 * 063 * @param name the parameter name 064 * @param value the parameter value 065 * @throws RuntimeCamelException is thrown if error setting the parameter 066 */ 067 <T> void setParameter(String name, T value) throws RuntimeCamelException; 068 069 /** 070 * Returns the formatted configuration string of an {@link Endpoint}. 071 * 072 * @param format the format 073 * @return the configuration URI in String format. 074 */ 075 String toUriString(UriFormat format); 076}