Package org.apache.directory.server.dns.messages

Examples of org.apache.directory.server.dns.messages.ResourceRecordModifier


{
    public Set<ResourceRecord> getRecords( QuestionRecord question ) throws DnsException
    {
        Set<ResourceRecord> set = new HashSet<ResourceRecord>();

        ResourceRecordModifier rm = new ResourceRecordModifier();
        rm.setDnsClass( RecordClass.IN );
        rm.setDnsName( "ldap.example.com" );
        rm.setDnsTtl( 100 );
        rm.setDnsType( RecordType.A );
        rm.put( DnsAttribute.IP_ADDRESS, "10.0.0.2" );

        set.add( rm.getEntry() );

        ResourceRecordModifier rm2 = new ResourceRecordModifier();
        rm2.setDnsClass( RecordClass.IN );
        rm2.setDnsName( "www.example.com" );
        rm2.setDnsTtl( 100 );
        rm2.setDnsType( RecordType.A );
        rm2.put( DnsAttribute.IP_ADDRESS, "10.0.0.3" );

        set.add( rm2.getEntry() );

        return set;
    }
View Full Code Here


    protected List<ResourceRecord> getTestMxAnswerRecords()
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsName( "apache.org" );
        modifier.setDnsType( RecordType.MX );
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsTtl( 267 );
        modifier.put( DnsAttribute.MX_PREFERENCE, "10" );
        modifier.put( DnsAttribute.DOMAIN_NAME, "herse.apache.org" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsName( "apache.org" );
        modifier.setDnsType( RecordType.MX );
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsTtl( 267 );
        modifier.put( DnsAttribute.MX_PREFERENCE, "20" );
        modifier.put( DnsAttribute.DOMAIN_NAME, "mail.apache.org" );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

    protected List<ResourceRecord> getTestMxAuthorityRecords()
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns.hyperreal.org" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns1.eu.bitnames.com" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns1.us.bitnames.com" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns2.surfnet.nl" );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

    protected List<ResourceRecord> getTestMxAdditionalRecords() throws UnknownHostException
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "herse.apache.org" );
        modifier.setDnsTtl( 3313 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "140.211.11.133" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "mail.apache.org" );
        modifier.setDnsTtl( 3313 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "140.211.11.2" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns1.eu.bitnames.com" );
        modifier.setDnsTtl( 156234 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "82.195.149.118" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns1.us.bitnames.com" );
        modifier.setDnsTtl( 156236 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "216.52.237.236" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns2.surfnet.nl" );
        modifier.setDnsTtl( 77100 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "192.87.36.2" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns2.surfnet.nl" );
        modifier.setDnsTtl( 77100 );
        modifier.setDnsType( RecordType.AAAA );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "2001:610:3:200a:192:87:36:2" ).toString() );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

     * @return the entry for the question
     * @throws NamingException if there are any access problems
     */
    private ResourceRecord getRecord( Attributes attrs ) throws NamingException
    {
        ResourceRecordModifier modifier = new ResourceRecordModifier();

        Attribute attr;

        String dnsName = ( attr = attrs.get( DnsAttribute.NAME ) ) != null ? ( String ) attr.get() : null;
        String dnsType = ( attr = attrs.get( DnsAttribute.TYPE ) ) != null ? ( String ) attr.get() : null;
        String dnsClass = ( attr = attrs.get( DnsAttribute.CLASS ) ) != null ? ( String ) attr.get() : null;
        String dnsTtl = ( attr = attrs.get( DnsAttribute.TTL ) ) != null ? ( String ) attr.get() : null;

        modifier.setDnsName( dnsName );
        modifier.setDnsType( RecordType.valueOf( dnsType ) );
        modifier.setDnsClass( RecordClass.valueOf( dnsClass ) );
        modifier.setDnsTtl( Integer.parseInt( dnsTtl ) );

        NamingEnumeration<String> ids = attrs.getIDs();

        while ( ids.hasMore() )
        {
            String id = ids.next();
            modifier.put( id, ( String ) attrs.get( id ).get() );
        }

        return modifier.getEntry();
    }
View Full Code Here

    private ResourceRecord getRecord( Attributes attrs, Name relative ) throws NamingException
    {
        String SOA_MINIMUM = "86400";
        String SOA_CLASS = "IN";

        ResourceRecordModifier modifier = new ResourceRecordModifier();

        Attribute attr;

        // if no name, transform rdn
        attr = attrs.get( DnsAttribute.NAME );

        if ( attr != null )
        {
            modifier.setDnsName( ( String ) attr.get() );
        }
        else
        {
            relative = getDomainComponents( relative );

            String dnsName;
            dnsName = transformDistinguishedName( relative.toString() );
            modifier.setDnsName( dnsName );
        }

        // type is implicit in objectclass
        attr = attrs.get( DnsAttribute.TYPE );

        if ( attr != null )
        {
            modifier.setDnsType( RecordType.valueOf( ( String ) attr.get() ) );
        }
        else
        {
            modifier.setDnsType( getType( attrs.get( SchemaConstants.OBJECT_CLASS_AT ) ) );
        }

        // class defaults to SOA CLASS
        String dnsClass = ( attr = attrs.get( DnsAttribute.CLASS ) ) != null ? ( String ) attr.get() : SOA_CLASS;
        modifier.setDnsClass( RecordClass.valueOf( dnsClass ) );

        // ttl defaults to SOA MINIMUM
        String dnsTtl = ( attr = attrs.get( DnsAttribute.TTL ) ) != null ? ( String ) attr.get() : SOA_MINIMUM;
        modifier.setDnsTtl( Integer.parseInt( dnsTtl ) );

        NamingEnumeration<String> ids = attrs.getIDs();

        while ( ids.hasMore() )
        {
            String id = ids.next();
            modifier.put( id, ( String ) attrs.get( id ).get() );
        }

        return modifier.getEntry();
    }
View Full Code Here

    private ResourceRecord getRecord( Attributes attrs, Name relative ) throws NamingException
    {
        String SOA_MINIMUM = "86400";
        String SOA_CLASS = "IN";

        ResourceRecordModifier modifier = new ResourceRecordModifier();

        Attribute attr;

        // if no name, transform rdn
        attr = attrs.get( DnsAttribute.NAME );

        if ( attr != null )
        {
            modifier.setDnsName( ( String ) attr.get() );
        }
        else
        {
            relative = getDomainComponents( relative );

            String dnsName;
            dnsName = transformDistinguishedName( relative.toString() );
            modifier.setDnsName( dnsName );
        }

        // type is implicit in objectclass
        attr = attrs.get( DnsAttribute.TYPE );

        if ( attr != null )
        {
            modifier.setDnsType( RecordType.valueOf( ( String ) attr.get() ) );
        }
        else
        {
            modifier.setDnsType( getType( attrs.get( SchemaConstants.OBJECT_CLASS_AT ) ) );
        }

        // class defaults to SOA CLASS
        String dnsClass = ( attr = attrs.get( DnsAttribute.CLASS ) ) != null ? ( String ) attr.get() : SOA_CLASS;
        modifier.setDnsClass( RecordClass.valueOf( dnsClass ) );

        // ttl defaults to SOA MINIMUM
        String dnsTtl = ( attr = attrs.get( DnsAttribute.TTL ) ) != null ? ( String ) attr.get() : SOA_MINIMUM;
        modifier.setDnsTtl( Integer.parseInt( dnsTtl ) );

        NamingEnumeration<String> ids = attrs.getIDs();

        while ( ids.hasMore() )
        {
            String id = ids.next();
            modifier.put( id, ( String ) attrs.get( id ).get() );
        }

        return modifier.getEntry();
    }
View Full Code Here

    protected List<ResourceRecord> getTestMxAnswerRecords()
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsName( "apache.org" );
        modifier.setDnsType( RecordType.MX );
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsTtl( 267 );
        modifier.put( DnsAttribute.MX_PREFERENCE, "10" );
        modifier.put( DnsAttribute.DOMAIN_NAME, "herse.apache.org" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsName( "apache.org" );
        modifier.setDnsType( RecordType.MX );
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsTtl( 267 );
        modifier.put( DnsAttribute.MX_PREFERENCE, "20" );
        modifier.put( DnsAttribute.DOMAIN_NAME, "mail.apache.org" );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

    protected List<ResourceRecord> getTestMxAuthorityRecords()
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns.hyperreal.org" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns1.eu.bitnames.com" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns1.us.bitnames.com" );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "apache.org" );
        modifier.setDnsTtl( 1932 );
        modifier.setDnsType( RecordType.NS );
        modifier.put( DnsAttribute.DOMAIN_NAME, "ns2.surfnet.nl" );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

    protected List<ResourceRecord> getTestMxAdditionalRecords() throws UnknownHostException
    {
        List<ResourceRecord> records = new ArrayList<ResourceRecord>();

        ResourceRecordModifier modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "herse.apache.org" );
        modifier.setDnsTtl( 3313 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "140.211.11.133" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "mail.apache.org" );
        modifier.setDnsTtl( 3313 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "140.211.11.2" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns1.eu.bitnames.com" );
        modifier.setDnsTtl( 156234 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "82.195.149.118" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns1.us.bitnames.com" );
        modifier.setDnsTtl( 156236 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "216.52.237.236" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns2.surfnet.nl" );
        modifier.setDnsTtl( 77100 );
        modifier.setDnsType( RecordType.A );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "192.87.36.2" ).toString() );
        records.add( modifier.getEntry() );

        modifier = new ResourceRecordModifier();
        modifier.setDnsClass( RecordClass.IN );
        modifier.setDnsName( "ns2.surfnet.nl" );
        modifier.setDnsTtl( 77100 );
        modifier.setDnsType( RecordType.AAAA );
        modifier.put( DnsAttribute.IP_ADDRESS, InetAddress.getByName( "2001:610:3:200a:192:87:36:2" ).toString() );
        records.add( modifier.getEntry() );

        return records;
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.dns.messages.ResourceRecordModifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.