View Javadoc
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.store;
21  
22  
23  import java.util.HashSet;
24  import java.util.Set;
25  
26  import org.apache.directory.server.dns.DnsException;
27  import org.apache.directory.server.dns.messages.QuestionRecord;
28  import org.apache.directory.server.dns.messages.RecordClass;
29  import org.apache.directory.server.dns.messages.RecordType;
30  import org.apache.directory.server.dns.messages.ResourceRecord;
31  import org.apache.directory.server.dns.messages.ResourceRecordModifier;
32  
33  
34  /**
35   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
36   */
37  public class RecordStoreStub implements RecordStore
38  {
39      //This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
40      @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
41      public Set<ResourceRecord> getRecords( QuestionRecord question ) throws DnsException
42      {
43          Set<ResourceRecord> set = new HashSet<>();
44  
45          ResourceRecordModifierssages/ResourceRecordModifier.html#ResourceRecordModifier">ResourceRecordModifier rm = new ResourceRecordModifier();
46          rm.setDnsClass( RecordClass.IN );
47          rm.setDnsName( "ldap.example.com" );
48          rm.setDnsTtl( 100 );
49          rm.setDnsType( RecordType.A );
50          rm.put( DnsAttribute.IP_ADDRESS, "10.0.0.2" );
51  
52          set.add( rm.getEntry() );
53  
54          ResourceRecordModifiersages/ResourceRecordModifier.html#ResourceRecordModifier">ResourceRecordModifier rm2 = new ResourceRecordModifier();
55          rm2.setDnsClass( RecordClass.IN );
56          rm2.setDnsName( "www.example.com" );
57          rm2.setDnsTtl( 100 );
58          rm2.setDnsType( RecordType.A );
59          rm2.put( DnsAttribute.IP_ADDRESS, "10.0.0.3" );
60  
61          set.add( rm2.getEntry() );
62  
63          return set;
64      }
65  }