Skip to content

Commit 7689557

Browse files
author
Greg Meyer
authored
Merge pull request #4 from DirectProjectJavaRI/develop
Releasing 6.0.1
2 parents 5f7caf4 + 51ab8d2 commit 7689557

File tree

4 files changed

+83
-11
lines changed

4 files changed

+83
-11
lines changed

pom.xml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nhind</groupId>
55
<artifactId>config-manager</artifactId>
6-
<version>6.0</version>
6+
<version>6.0.1</version>
77
<packaging>jar</packaging>
88
<name>NHIN Direct Java configuration manager</name>
99
<description>NHIN Direct Java configuration manager</description>
1010
<url>https://github.com/DirectProjectJavaRI/config-manager</url>
1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>2.1.2.RELEASE</version>
14+
<version>2.1.6.RELEASE</version>
1515
<relativePath />
1616
</parent>
1717
<scm>
@@ -38,7 +38,7 @@
3838
</licenses>
3939
<properties>
4040
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41-
<spring-cloud-dependencies.version>Greenwich.RELEASE</spring-cloud-dependencies.version>
41+
<spring-cloud-dependencies.version>Greenwich.SR1</spring-cloud-dependencies.version>
4242
</properties>
4343
<dependencyManagement>
4444
<dependencies>
@@ -60,12 +60,12 @@
6060
<dependency>
6161
<groupId>org.nhind</groupId>
6262
<artifactId>direct-common</artifactId>
63-
<version>6.0</version>
63+
<version>6.0.1</version>
6464
</dependency>
6565
<dependency>
6666
<groupId>org.nhind</groupId>
6767
<artifactId>agent</artifactId>
68-
<version>6.0</version>
68+
<version>6.0.2</version>
6969
</dependency>
7070
</dependencies>
7171
<build>
@@ -88,7 +88,7 @@
8888
<plugin>
8989
<groupId>org.apache.maven.plugins</groupId>
9090
<artifactId>maven-javadoc-plugin</artifactId>
91-
<version>2.6.1</version>
91+
<version>2.9.1</version>
9292
<configuration>
9393
<additionalparam>-Xdoclint:none</additionalparam>
9494
<charset>UTF-8</charset>
@@ -108,8 +108,7 @@
108108
</goals>
109109
</execution>
110110
</executions>
111-
</plugin>
112-
<!-- for releases only
111+
</plugin>
113112
<plugin>
114113
<groupId>org.apache.maven.plugins</groupId>
115114
<artifactId>maven-gpg-plugin</artifactId>
@@ -122,8 +121,7 @@
122121
</goals>
123122
</execution>
124123
</executions>
125-
</plugin>
126-
-->
124+
</plugin>
127125
</plugins>
128126
</build>
129127
<reporting>
@@ -136,7 +134,7 @@
136134
<plugin>
137135
<groupId>org.apache.maven.plugins</groupId>
138136
<artifactId>maven-javadoc-plugin</artifactId>
139-
<version>2.6.1</version>
137+
<version>2.9.1</version>
140138
<configuration>
141139
<additionalparam>-Xdoclint:none</additionalparam>
142140
<charset>UTF-8</charset>

src/main/java/org/nhindirect/config/manager/DNSRecordCommands.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ public class DNSRecordCommands
118118
private static final String GET_ALL_USAGE = "Gets all records in the DNS store.";
119119

120120
private static final String GET_SOA_CONTACTS = "Gets a list of all the different SOA contacts.";
121+
122+
private static final String ADD_SRV_USAGE = "Add a new SRV dns record." +
123+
"\r\n" + DNSRecordParser.PARSE_SRV_USAGE;
124+
125+
private static final String ENSURE_SRV_USAGE = "Adds a new SRV dns record if an identical one does't already exist. " +
126+
"\r\n" + DNSRecordParser.PARSE_SRV_USAGE;
121127

122128
private DNSRecordPrinter printer;
123129
private DNSRecordParser parser;
@@ -749,6 +755,39 @@ private DNSRecord find(DNSRecord record)
749755
return null;
750756
}
751757

758+
/**
759+
* Adds an SRV record to the configuration service.
760+
* @param args Contains the SRV record attributes.
761+
*
762+
* @since 1.0
763+
*/
764+
@Command(name = "Dns_SRV_Add", usage = ADD_SRV_USAGE)
765+
public void addSRV(String[] args)
766+
{
767+
DNSRecord record = fromRecord(parser.parseSRV(args));
768+
769+
addDNS(record);
770+
}
771+
772+
/**
773+
* Adds an SRV record to the configuration service only if the record does not exist.
774+
* @param args Contains the SRV record attributes.
775+
*
776+
* @since 1.0
777+
*/
778+
@Command(name = "Dns_SRV_Ensure", usage = ENSURE_SRV_USAGE)
779+
public void ensureSRV(String[] args)
780+
{
781+
DNSRecord record = fromRecord(parser.parseSRV(args));
782+
if (!verifyIsUnique(record, false))
783+
{
784+
return;
785+
}
786+
787+
788+
addDNS(record);
789+
}
790+
752791
/*
753792
* prints the contents of an array of records
754793
*/

src/main/java/org/nhindirect/config/manager/DNSRecordParser.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3131
import org.xbill.DNS.NSRecord;
3232
import org.xbill.DNS.Name;
3333
import org.xbill.DNS.SOARecord;
34+
import org.xbill.DNS.SRVRecord;
3435
import org.xbill.DNS.TXTRecord;
3536

3637
/**
@@ -77,6 +78,14 @@ public class DNSRecordParser
7778
"\r\n\t alias: the text value of the record" +
7879
"\r\n\t ttl: time to live in seconds";
7980

81+
public static final String PARSE_SRV_USAGE = " name target port priority weight ttl" +
82+
"\r\n\t name: the name of the SRV entry" +
83+
"\r\n\t target: the server that hosts the service of the SRV entry" +
84+
"\r\n\t port: the IP port to use when conneting to the target" +
85+
"\r\n\t priority: the priority the record compared to other SRV records of the same name" +
86+
"\r\n\t weight: the weight the record compared to other SRV records of the same name and priority" +
87+
"\r\n\t ttl: time to live in seconds";
88+
8089
/**
8190
* Default empty constructor
8291
*
@@ -230,4 +239,23 @@ public NSRecord parseNS(String[] args)
230239

231240
return new NSRecord(nameFromString(domainName), DClass.IN, ttl, nameFromString(target));
232241
}
242+
243+
/**
244+
* Converts SRV record configuration information to an SRVRecord
245+
* @param args The NS record configuration parameters.
246+
* @return A DNS NSRecord.
247+
*
248+
* @since 6.0.1
249+
*/
250+
public SRVRecord parseSRV(String[] args)
251+
{
252+
String name = StringArrayUtil.getRequiredValue(args, 0);
253+
String target = StringArrayUtil.getRequiredValue(args, 1);
254+
int port = Integer.parseInt(StringArrayUtil.getRequiredValue(args, 2));
255+
int priority = Integer.parseInt(StringArrayUtil.getRequiredValue(args, 3));
256+
int weight = Integer.parseInt(StringArrayUtil.getRequiredValue(args, 4));
257+
int ttl = Integer.parseInt(StringArrayUtil.getRequiredValue(args, 5));
258+
259+
return new SRVRecord(nameFromString(name), DClass.IN, ttl, priority, weight, port, nameFromString(target));
260+
}
233261
}

src/main/java/org/nhindirect/config/manager/printers/DefaultDNSRecordPrinter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ private String typeToString(int type)
9999
case Type.NS:
100100
return "NS";
101101

102+
case Type.CNAME:
103+
return "CNAME";
104+
105+
case Type.TXT:
106+
return "TXT";
107+
102108
default:
103109
return "Unknown";
104110
}
@@ -151,6 +157,7 @@ public void print(DNSRecord record)
151157
case Type.NS:
152158
print((NSRecord)toRecord(record));
153159
break;
160+
154161
}
155162

156163
writer.flush();

0 commit comments

Comments
 (0)