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 */ 017 018package org.apache.camel.model.remote; 019 020import javax.xml.bind.annotation.XmlAccessType; 021import javax.xml.bind.annotation.XmlAccessorType; 022import javax.xml.bind.annotation.XmlAttribute; 023import javax.xml.bind.annotation.XmlRootElement; 024import javax.xml.bind.annotation.XmlTransient; 025 026import org.apache.camel.spi.Metadata; 027import org.apache.camel.util.jsse.SSLContextParameters; 028 029/** 030 * Etcd remote service call configuration 031 */ 032@Metadata(label = "eip,routing,remote") 033@XmlRootElement(name = "etcdConfiguration") 034@XmlAccessorType(XmlAccessType.FIELD) 035public class EtcdConfigurationDefinition extends ServiceCallConfigurationDefinition { 036 @XmlAttribute 037 private String uris; 038 @XmlAttribute @Metadata(label = "security") 039 private String userName; 040 @XmlAttribute @Metadata(label = "security") 041 private String password; 042 @XmlAttribute 043 private Long timeout; 044 @XmlAttribute @Metadata(defaultValue = "/services/") 045 private String servicePath = "/services/"; 046 @XmlTransient 047 private SSLContextParameters sslContextParameters; 048 049 public EtcdConfigurationDefinition() { 050 } 051 052 public EtcdConfigurationDefinition(ServiceCallDefinition parent) { 053 super(parent); 054 } 055 056 // ------------------------------------------------------------------------- 057 // Getter/Setter 058 // ------------------------------------------------------------------------- 059 060 public String getUris() { 061 return uris; 062 } 063 064 public void setUris(String uris) { 065 this.uris = uris; 066 } 067 068 public String getUserName() { 069 return userName; 070 } 071 072 public void setUserName(String userName) { 073 this.userName = userName; 074 } 075 076 public String getPassword() { 077 return password; 078 } 079 080 public void setPassword(String password) { 081 this.password = password; 082 } 083 084 public Long getTimeout() { 085 return timeout; 086 } 087 088 public void setTimeout(Long timeout) { 089 this.timeout = timeout; 090 } 091 092 public String getServicePath() { 093 return servicePath; 094 } 095 096 public void setServicePath(String servicePath) { 097 this.servicePath = servicePath; 098 } 099 100 public SSLContextParameters getSslContextParameters() { 101 return sslContextParameters; 102 } 103 104 public void setSslContextParameters(SSLContextParameters sslContextParameters) { 105 this.sslContextParameters = sslContextParameters; 106 } 107 108 // ------------------------------------------------------------------------- 109 // Fluent API 110 // ------------------------------------------------------------------------- 111 112 /** 113 * The URIs the client can connect to. 114 */ 115 public EtcdConfigurationDefinition uris(String uris) { 116 setUris(uris); 117 return this; 118 } 119 120 /** 121 * The user name to use for basic authentication. 122 */ 123 public EtcdConfigurationDefinition userName(String userName) { 124 setUserName(userName); 125 return this; 126 } 127 128 /** 129 * The password to use for basic authentication. 130 */ 131 public EtcdConfigurationDefinition password(String password) { 132 setPassword(password); 133 return this; 134 } 135 136 /** 137 * To set the maximum time an action could take to complete. 138 */ 139 public EtcdConfigurationDefinition timeout(Long timeout) { 140 setTimeout(timeout); 141 return this; 142 } 143 144 /** 145 * The path to look for for service discovery 146 */ 147 public EtcdConfigurationDefinition servicePath(String servicePath) { 148 setServicePath(servicePath); 149 return this; 150 } 151 152 /** 153 * To configure security using SSLContextParameters. 154 */ 155 public EtcdConfigurationDefinition sslContextParameters(SSLContextParameters sslContextParameters) { 156 setSslContextParameters(sslContextParameters); 157 return this; 158 } 159}