1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.server.dns.messages; 21 22 23 import java.util.HashMap; 24 import java.util.Map; 25 26 27 /** 28 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 29 * @version $Rev: 552764 $, $Date: 2007-07-03 11:38:20 +0200 (Di, 03 Jul 2007) $ 30 */ 31 public class ResourceRecordModifier 32 { 33 private String dnsName; 34 private RecordType dnsType; 35 private RecordClass dnsClass; 36 private int dnsTtl; 37 38 private Map<String, Object> attributes = new HashMap<String, Object>(); 39 40 41 /** 42 * Returns the {@link ResourceRecord} built by this {@link ResourceRecordModifier}. 43 * 44 * @return The {@link ResourceRecord}. 45 */ 46 public ResourceRecord getEntry() 47 { 48 return new ResourceRecordImpl( dnsName, dnsType, dnsClass, dnsTtl, attributes ); 49 } 50 51 52 /** 53 * @param dnsName The dnsName to set. 54 */ 55 public void setDnsName( String dnsName ) 56 { 57 this.dnsName = dnsName; 58 } 59 60 61 /** 62 * @param dnsType The dnsType to set. 63 */ 64 public void setDnsType( RecordType dnsType ) 65 { 66 this.dnsType = dnsType; 67 } 68 69 70 /** 71 * @param dnsClass The dnsClass to set. 72 */ 73 public void setDnsClass( RecordClass dnsClass ) 74 { 75 this.dnsClass = dnsClass; 76 } 77 78 79 /** 80 * @param dnsTtl The dnsTtl to set. 81 */ 82 public void setDnsTtl( int dnsTtl ) 83 { 84 this.dnsTtl = dnsTtl; 85 } 86 87 88 /** 89 * @param id The id to set 90 * @param value The value to set 91 */ 92 public void put( String id, String value ) 93 { 94 attributes.put( id.toLowerCase(), value ); 95 } 96 }