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