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.model.dataformat;
018    
019    import javax.xml.bind.annotation.XmlAccessType;
020    import javax.xml.bind.annotation.XmlAccessorType;
021    import javax.xml.bind.annotation.XmlAttribute;
022    import javax.xml.bind.annotation.XmlRootElement;
023    
024    import org.apache.camel.CamelContext;
025    import org.apache.camel.model.DataFormatDefinition;
026    import org.apache.camel.spi.DataFormat;
027    
028    /**
029     * Represents a <a href="http://camel.apache.org/crypto.html">pgp</a>
030     * {@link org.apache.camel.spi.DataFormat}.
031     */
032    @XmlRootElement(name = "pgp")
033    @XmlAccessorType(XmlAccessType.FIELD)
034    public class PGPDataFormat extends DataFormatDefinition {
035        @XmlAttribute
036        private String keyUserid;
037        @XmlAttribute
038        private String password;
039        @XmlAttribute
040        private String keyFileName;
041        @XmlAttribute
042        private Boolean armored;
043        @XmlAttribute
044        private Boolean integrity;
045        @XmlAttribute
046        private String provider;
047    
048        public PGPDataFormat() {
049            super("pgp");
050        }
051    
052        @Override
053        protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
054            if (keyUserid != null) {
055                setProperty(camelContext, dataFormat, "keyUserid", keyUserid);
056            }
057            if (password != null) {
058                setProperty(camelContext, dataFormat, "password", password);
059            }
060            if (keyFileName != null) {
061                setProperty(camelContext, dataFormat, "keyFileName", keyFileName);
062            }
063            if (armored != null) {
064                setProperty(camelContext, dataFormat, "armored", armored);
065            }
066            if (integrity != null) {
067                setProperty(camelContext, dataFormat, "integrity", integrity);
068            }
069            if (provider != null) {
070                setProperty(camelContext, dataFormat, "provider", provider);
071            }
072        }
073    
074        public Boolean getArmored() {
075            return armored;
076        }
077    
078        public void setArmored(Boolean armored) {
079            this.armored = armored;
080        }
081    
082        public Boolean getIntegrity() {
083            return integrity;
084        }
085    
086        public void setIntegrity(Boolean integrity) {
087            this.integrity = integrity;
088        }
089    
090        public String getKeyFileName() {
091            return keyFileName;
092        }
093    
094        public void setKeyFileName(String keyFileName) {
095            this.keyFileName = keyFileName;
096        }
097    
098        public String getKeyUserid() {
099            return keyUserid;
100        }
101    
102        public void setKeyUserid(String keyUserid) {
103            this.keyUserid = keyUserid;
104        }
105    
106        public String getPassword() {
107            return password;
108        }
109    
110        public void setPassword(String password) {
111            this.password = password;
112        }
113    
114        public String getProvider() {
115            return provider;
116        }
117    
118        public void setProvider(String provider) {
119            this.provider = provider;
120        }
121    }