-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApplicationWithConfigurationFromProperties.java
46 lines (38 loc) · 1.57 KB
/
ApplicationWithConfigurationFromProperties.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package software.xdev;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.xdev.bzst.dip.client.BzstDipClient;
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfigurationBuilder;
import software.xdev.bzst.dip.client.model.configuration.PropertiesSupplier;
import software.xdev.bzst.dip.client.model.message.dac7.BzstDipCompleteResult;
@SuppressWarnings("checkstyle:MagicNumber")
public final class ApplicationWithConfigurationFromProperties
{
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationWithConfigurationFromProperties.class);
public static void main(final String[] args)
throws InterruptedException, IOException
{
final BzstDipConfiguration configuration = createConfigurationFromProperties();
final BzstDipClient bzstDipClient = new BzstDipClient(configuration);
final BzstDipCompleteResult bzstDipCompleteResult =
bzstDipClient.sendDipAndQueryResult(ApplicationWithDac7.createMessage());
LOGGER.info(
"Sending dip message with transfer number {} {}",
bzstDipCompleteResult.dataTransferNumber(),
bzstDipCompleteResult.isSuccessful() ? "was successful." : "has failed!"
);
}
public static BzstDipConfiguration createConfigurationFromProperties()
{
return new BzstDipConfigurationBuilder(
new PropertiesSupplier(
ClassLoader.getSystemClassLoader().getResourceAsStream("app.properties")
))
.buildAndValidate();
}
private ApplicationWithConfigurationFromProperties()
{
}
}