DomainNames.java (eucalyptus-4.4.1) | : | DomainNames.java (eucalyptus-4.4.2) | ||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
* REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO | * REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO | |||
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT | * IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT | |||
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS. | * NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS. | |||
************************************************************************/ | ************************************************************************/ | |||
package com.eucalyptus.util.dns; | package com.eucalyptus.util.dns; | |||
import java.util.List; | import java.util.List; | |||
import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | |||
import java.util.Set; | import java.util.Set; | |||
import java.util.function.Predicate; | ||||
import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | |||
import org.xbill.DNS.DClass; | import org.xbill.DNS.DClass; | |||
import org.xbill.DNS.NSRecord; | import org.xbill.DNS.NSRecord; | |||
import org.xbill.DNS.Name; | import org.xbill.DNS.Name; | |||
import org.xbill.DNS.NameTooLongException; | import org.xbill.DNS.NameTooLongException; | |||
import org.xbill.DNS.TextParseException; | import org.xbill.DNS.TextParseException; | |||
import com.eucalyptus.component.ComponentId; | import com.eucalyptus.component.ComponentId; | |||
import com.eucalyptus.component.ComponentIds; | import com.eucalyptus.component.ComponentIds; | |||
skipping to change at line 256 | skipping to change at line 257 | |||
final Set<Name> names = Sets.newLinkedHashSet( ); | final Set<Name> names = Sets.newLinkedHashSet( ); | |||
final ComponentId componentId = ComponentIds.lookup( input ); | final ComponentId componentId = ComponentIds.lookup( input ); | |||
final Name domain = get( ); | final Name domain = get( ); | |||
for ( final String name : componentId.getAllServiceNames( ) ) { | for ( final String name : componentId.getAllServiceNames( ) ) { | |||
names.add( absolute( Name.fromConstantString( name ), domain ) ); | names.add( absolute( Name.fromConstantString( name ), domain ) ); | |||
} | } | |||
return names; | return names; | |||
} | } | |||
public List<NSRecord> getNameServers( ) { | public List<NSRecord> getNameServers( ) { | |||
List<NSRecord> nsRecs = Lists.newArrayList( ); | final Predicate<ServiceConfiguration> nsServerUsable = DomainNameRecords.a | |||
ctiveNameserverPredicate( ); | ||||
final List<NSRecord> nsRecs = Lists.newArrayList( ); | ||||
int idx = 1; | int idx = 1; | |||
for ( ServiceConfiguration conf : Components.lookup( Dns.class ).services( ) ) { | for ( ServiceConfiguration conf : Components.lookup( Dns.class ).services( ) ) { | |||
nsRecs.add( new NSRecord( this.get( ), | final int offset = idx++; | |||
DClass.IN, | if ( nsServerUsable.test( conf ) ) { | |||
60, | nsRecs.add( new NSRecord( | |||
Name.fromConstantString( "ns" + idx++ + "." + | this.get( ), | |||
this.get( ).toString( ) ) ) ); | DClass.IN, | |||
60, | ||||
Name.fromConstantString( "ns" + offset + "." + this.get( ).toStrin | ||||
g( ) ) | ||||
) ); | ||||
} | ||||
} | } | |||
return nsRecs; | return nsRecs; | |||
} | } | |||
public static SystemSubdomain lookup( Name name ) { | public static SystemSubdomain lookup( Name name ) { | |||
for ( SystemSubdomain s : SystemSubdomain.values( ) ) { | for ( SystemSubdomain s : SystemSubdomain.values( ) ) { | |||
if ( name.subdomain( s.get( ) ) ) { | if ( name.subdomain( s.get( ) ) ) { | |||
return s; | return s; | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 14 lines changed or added |