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