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 package org.apache.camel.util.blueprint;
018
019 import javax.xml.bind.annotation.XmlRootElement;
020 import javax.xml.bind.annotation.XmlTransient;
021 import javax.xml.bind.annotation.XmlType;
022
023 import org.apache.camel.CamelContext;
024 import org.apache.camel.core.xml.util.jsse.AbstractSSLContextParametersFactoryBean;
025 import org.osgi.service.blueprint.container.BlueprintContainer;
026
027 @XmlRootElement(name = "sslContextParameters")
028 @XmlType(propOrder = {})
029 public class SSLContextParametersFactoryBean extends AbstractSSLContextParametersFactoryBean {
030
031 private KeyManagersParametersFactoryBean keyManagers;
032
033 private TrustManagersParametersFactoryBean trustManagers;
034
035 private SecureRandomParametersFactoryBean secureRandom;
036
037 private SSLContextClientParametersFactoryBean clientParameters;
038
039 private SSLContextServerParametersFactoryBean serverParameters;
040
041 @XmlTransient
042 private BlueprintContainer blueprintContainer;
043
044 @Override
045 public KeyManagersParametersFactoryBean getKeyManagers() {
046 return keyManagers;
047 }
048
049 public void setKeyManagers(KeyManagersParametersFactoryBean keyManagers) {
050 this.keyManagers = keyManagers;
051 }
052
053 @Override
054 public TrustManagersParametersFactoryBean getTrustManagers() {
055 return trustManagers;
056 }
057
058 public void setTrustManagers(TrustManagersParametersFactoryBean trustManagers) {
059 this.trustManagers = trustManagers;
060 }
061
062 @Override
063 public SecureRandomParametersFactoryBean getSecureRandom() {
064 return secureRandom;
065 }
066
067 public void setSecureRandom(SecureRandomParametersFactoryBean secureRandom) {
068 this.secureRandom = secureRandom;
069 }
070
071 @Override
072 public SSLContextClientParametersFactoryBean getClientParameters() {
073 return clientParameters;
074 }
075
076 public void setClientParameters(SSLContextClientParametersFactoryBean clientParameters) {
077 this.clientParameters = clientParameters;
078 }
079
080 @Override
081 public SSLContextServerParametersFactoryBean getServerParameters() {
082 return serverParameters;
083 }
084
085 public void setServerParameters(SSLContextServerParametersFactoryBean serverParameters) {
086 this.serverParameters = serverParameters;
087 }
088
089 public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
090 this.blueprintContainer = blueprintContainer;
091 }
092
093 @Override
094 protected CamelContext getCamelContextWithId(String camelContextId) {
095 if (blueprintContainer != null) {
096 return (CamelContext) blueprintContainer.getComponentInstance(camelContextId);
097 }
098 return null;
099 }
100
101 }