001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.server.dns.messages;
021    
022    
023    import java.util.HashMap;
024    import java.util.Map;
025    
026    
027    /**
028     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029     * @version $Rev: 552764 $, $Date: 2007-07-03 11:38:20 +0200 (Tue, 03 Jul 2007) $
030     */
031    public class ResourceRecordModifier
032    {
033        private String dnsName;
034        private RecordType dnsType;
035        private RecordClass dnsClass;
036        private int dnsTtl;
037    
038        private Map<String, Object> attributes = new HashMap<String, Object>();
039    
040    
041        /**
042         * Returns the {@link ResourceRecord} built by this {@link ResourceRecordModifier}.
043         *
044         * @return The {@link ResourceRecord}.
045         */
046        public ResourceRecord getEntry()
047        {
048            return new ResourceRecordImpl( dnsName, dnsType, dnsClass, dnsTtl, attributes );
049        }
050    
051    
052        /**
053         * @param dnsName The dnsName to set.
054         */
055        public void setDnsName( String dnsName )
056        {
057            this.dnsName = dnsName;
058        }
059    
060    
061        /**
062         * @param dnsType The dnsType to set.
063         */
064        public void setDnsType( RecordType dnsType )
065        {
066            this.dnsType = dnsType;
067        }
068    
069    
070        /**
071         * @param dnsClass The dnsClass to set.
072         */
073        public void setDnsClass( RecordClass dnsClass )
074        {
075            this.dnsClass = dnsClass;
076        }
077    
078    
079        /**
080         * @param dnsTtl The dnsTtl to set.
081         */
082        public void setDnsTtl( int dnsTtl )
083        {
084            this.dnsTtl = dnsTtl;
085        }
086    
087    
088        /**
089         * @param id The id to set
090         * @param value The value to set 
091         */
092        public void put( String id, String value )
093        {
094            attributes.put( id.toLowerCase(), value );
095        }
096    }