Skip to content

Commit b982298

Browse files
committed
Restored OSGI/module build.
1 parent 41008a5 commit b982298

File tree

12 files changed

+276
-76
lines changed

12 files changed

+276
-76
lines changed

calc/pom.xml

+19-8
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
<packaging>jar</packaging>
3131
<!-- Try to find workaround for problem attaching sources to bundle, as
3232
of now manually switching to "jar" works -->
33-
<properties>
34-
<jdkVersion>1.8</jdkVersion>
35-
<maven.compile.targetLevel>${jdkVersion}</maven.compile.targetLevel>
36-
<maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel>
37-
</properties>
3833
<build>
3934
<plugins>
4035
<plugin>
@@ -57,7 +52,7 @@
5752
<source>9</source>
5853
<target>9</target>
5954
<excludes>
60-
<exclude>org.javamoney.calc/module-info.java</exclude>
55+
<exclude>module-info.java</exclude>
6156
</excludes>
6257
</configuration>
6358
<executions>
@@ -79,14 +74,30 @@
7974
</goals>
8075
<!-- recompile everything for target VM except the module-info.java -->
8176
<configuration>
77+
<source>${maven.compile.sourceLevel}</source>
78+
<target>${maven.compile.targetLevel}</target>
8279
<excludes>
83-
<exclude>javax.money/module-info.java</exclude>
80+
<exclude>org/javamoney/calc/module-info.java</exclude>
8481
</excludes>
8582
</configuration>
8683
</execution>
8784
</executions>
88-
8985
</plugin>
9086
</plugins>
9187
</build>
88+
89+
<dependencies>
90+
<dependency>
91+
<groupId>javax.money</groupId>
92+
<artifactId>money-api</artifactId>
93+
</dependency>
94+
<!--<dependency>-->
95+
<!--<groupId>org.javamoney.moneta</groupId>-->
96+
<!--<artifactId>moneta-core</artifactId>-->
97+
<!--</dependency>-->
98+
<dependency>
99+
<groupId>javax.annotation</groupId>
100+
<artifactId>javax.annotation-api</artifactId>
101+
</dependency>
102+
</dependencies>
92103
</project>

exchange/exchange-rate-frb/pom.xml

+52-16
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.javamoney.lib</groupId>
2424
<artifactId>javamoney-exchange</artifactId>
25-
<version>0.2-SNAPSHOT</version>
25+
<version>1.0</version>
2626
</parent>
2727
<artifactId>javamoney-exchange-rate-frb</artifactId>
2828
<packaging>jar</packaging>
@@ -40,50 +40,86 @@
4040
<outputDirectory>src/main/resources/java-money/defaults/FRB</outputDirectory>
4141
<outputFile>H10_H10.XML</outputFile>
4242
</configuration>
43-
<!--<executions>-->
44-
<!--<execution>-->
45-
<!--<id>get-fallback-resource</id>-->
46-
<!--<phase>process-resources</phase>-->
47-
<!--<goals>-->
48-
<!--<goal>wget</goal>-->
49-
<!--</goals>-->
50-
<!--</execution>-->
51-
<!--</executions>-->
5243
</plugin>
53-
</plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-compiler-plugin</artifactId>
47+
<version>3.7.0</version>
48+
<configuration>
49+
<source>9</source>
50+
<target>9</target>
51+
</configuration>
52+
<executions>
53+
<execution>
54+
<id>default-compile</id>
55+
<configuration>
56+
<!-- compile everything to ensure module-info contains right entries -->
57+
<!-- required when JAVA_HOME is JDK 8 or below -->
58+
<jdkToolchain>
59+
<version>9</version>
60+
</jdkToolchain>
61+
<release>9</release>
62+
</configuration>
63+
</execution>
64+
<execution>
65+
<id>base-compile</id>
66+
<goals>
67+
<goal>compile</goal>
68+
</goals>
69+
<!-- recompile everything for target VM except the module-info.java -->
70+
<configuration>
71+
<source>${maven.compile.sourceLevel}</source>
72+
<target>${maven.compile.targetLevel}</target>
73+
<excludes>
74+
<exclude>module-info.java</exclude>
75+
</excludes>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
</plugins>
5481
</build>
5582

5683
<dependencies>
5784
<dependency>
58-
<groupId>org.testng</groupId>
59-
<artifactId>testng</artifactId>
60-
<scope>test</scope>
85+
<groupId>javax.money</groupId>
86+
<artifactId>money-api</artifactId>
6187
</dependency>
6288
<dependency>
6389
<groupId>org.javamoney.moneta</groupId>
6490
<artifactId>moneta-core</artifactId>
65-
<version>${ri.version}</version>
6691
</dependency>
6792
<dependency>
6893
<groupId>org.javamoney.moneta</groupId>
6994
<artifactId>moneta-convert</artifactId>
70-
<version>${ri.version}</version>
7195
</dependency>
7296
<!-- OSGI support -->
7397
<dependency>
7498
<groupId>org.osgi</groupId>
7599
<artifactId>org.osgi.annotation</artifactId>
100+
<scope>provided</scope>
101+
<version>${osgi.annotation.version}</version>
76102
<optional>true</optional>
77103
</dependency>
78104
<dependency>
79105
<groupId>org.osgi</groupId>
80106
<artifactId>org.osgi.compendium</artifactId>
107+
<scope>provided</scope>
108+
<version>${osgi.compendium.version}</version>
81109
<optional>true</optional>
82110
</dependency>
83111
<dependency>
84112
<groupId>org.osgi</groupId>
85113
<artifactId>org.osgi.core</artifactId>
114+
<version>${osgi.version}</version>
115+
<scope>provided</scope>
86116
<optional>true</optional>
87117
</dependency>
118+
<!-- testing -->
119+
<dependency>
120+
<groupId>org.testng</groupId>
121+
<artifactId>testng</artifactId>
122+
<scope>test</scope>
123+
</dependency>
88124
</dependencies>
89125
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import org.javamoney.moneta.convert.internal.frb.USFederalReserveRateProvider;
2+
3+
/*
4+
* CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE CONDITION THAT YOU
5+
* ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT. PLEASE READ THE TERMS AND CONDITIONS OF THIS
6+
* AGREEMENT CAREFULLY. BY DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF
7+
* THE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE" BUTTON AT THE
8+
* BOTTOM OF THIS PAGE. Specification: JSR-354 Money and Currency API ("Specification") Copyright
9+
* (c) 2012-2013, Credit Suisse All rights reserved.
10+
*/
11+
module org.javamoney.moneta.convert.frb {
12+
requires java.xml;
13+
requires java.xml.bind;
14+
requires org.javamoney.moneta;
15+
requires org.javamoney.moneta.convert;
16+
requires static org.osgi.core;
17+
requires static org.osgi.compendium;
18+
requires static org.osgi.annotation;
19+
provides javax.money.convert.ExchangeRateProvider with
20+
USFederalReserveRateProvider;
21+
uses org.javamoney.moneta.spi.LoaderService;
22+
uses org.javamoney.moneta.spi.MonetaryAmountProducer;
23+
}

exchange/exchange-rate-frb/src/main/java/org/javamoney/moneta/convert/internal/frb/OSGIServiceHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public JDKUtilServiceFactory(Class<?> serviceClass) {
110110
public Object getService(Bundle bundle, ServiceRegistration registration) {
111111
try {
112112
LOG.fine("Creating Service...:" + serviceClass.getName());
113-
return serviceClass.newInstance();
113+
return serviceClass.getConstructor().newInstance();
114114
} catch (Exception ex) {
115115
ex.printStackTrace();
116116
throw new IllegalStateException("Failed to create service: " + serviceClass.getName(), ex);

exchange/exchange-rate-frb/src/main/java/org/javamoney/moneta/convert/internal/frb/USFederalReserveRateReadingHandler.java

-9
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@
4848

4949
/**
5050
* SAX Event Handler that reads the quotes.
51-
* <p>
52-
* RDF format: <item rdf:about="http://www.federalreserve.gov/releases/H10#16"> <title>US: H10 0.7100 2015-08-31 FRB
53-
* Australia Dollar (USD per AUD)</title> <link>http://www.federalreserve.gov/releases/H10#16</link>
54-
* <description>Australia Dollar (USD per AUD)</description> <dc:date>2015-08-31T12:00:00-05:00</dc:date>
55-
* <dc:language>en</dc:language> <dc:creator>FRB</dc:creator> <cb:statistics> <cb:country>US</cb:country>
56-
* <cb:institutionAbbrev>FRB</cb:institutionAbbrev> <cb:otherStatistic> <cb:value decimals="4" unit_mult="1"
57-
* units="Currency:_Per_AUD">0.7100</cb:value> <cb:topic>H10</cb:topic> <cb:coverage>Australia Dollar (USD per
58-
* AUD)</cb:coverage> <cb:observationPeriod frequency="business">2015-08-31</cb:observationPeriod> <cb:dataType/>
59-
* </cb:otherStatistic> </cb:statistics> </item>
6051
*/
6152
class USFederalReserveRateReadingHandler extends DefaultHandler {
6253
private LocalDate localDate;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2012, 2018, Werner Keil, Anatole Tresch and others.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*
16+
* Contributors: @atsticks, @keilw
17+
*/
18+
19+
/**
20+
* US Federal Reserve based Conversion provider.
21+
*/
22+
package org.javamoney.moneta.convert.internal.frb;

exchange/exchange-rate-yahoo/pom.xml

+54-16
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.javamoney.lib</groupId>
2424
<artifactId>javamoney-exchange</artifactId>
25-
<version>0.2-SNAPSHOT</version>
25+
<version>1.0</version>
2626
</parent>
2727
<artifactId>javamoney-exchange-rate-yahoo</artifactId>
2828
<packaging>jar</packaging>
@@ -40,50 +40,88 @@
4040
<outputDirectory>src/main/resources/java-money/defaults/YAHOO</outputDirectory>
4141
<outputFileName>finance.xml</outputFileName>
4242
</configuration>
43-
<!--<executions>-->
44-
<!--<execution>-->
45-
<!--<id>get-fallback-resource</id>-->
46-
<!--<phase>process-resources</phase>-->
47-
<!--<goals>-->
48-
<!--<goal>wget</goal>-->
49-
<!--</goals>-->
50-
<!--</execution>-->
51-
<!--</executions>-->
5243
</plugin>
53-
</plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-compiler-plugin</artifactId>
47+
<version>3.7.0</version>
48+
<configuration>
49+
<source>9</source>
50+
<target>9</target>
51+
</configuration>
52+
<executions>
53+
<execution>
54+
<id>default-compile</id>
55+
<configuration>
56+
<!-- compile everything to ensure module-info contains right entries -->
57+
<!-- required when JAVA_HOME is JDK 8 or below -->
58+
<jdkToolchain>
59+
<version>9</version>
60+
</jdkToolchain>
61+
<release>9</release>
62+
</configuration>
63+
</execution>
64+
<execution>
65+
<id>base-compile</id>
66+
<goals>
67+
<goal>compile</goal>
68+
</goals>
69+
<!-- recompile everything for target VM except the module-info.java -->
70+
<configuration>
71+
<source>${maven.compile.sourceLevel}</source>
72+
<target>${maven.compile.targetLevel}</target>
73+
<excludes>
74+
<exclude>module-info.java</exclude>
75+
</excludes>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
</plugins>
5481
</build>
5582

5683
<dependencies>
84+
<!-- API and RI -->
5785
<dependency>
58-
<groupId>org.testng</groupId>
59-
<artifactId>testng</artifactId>
60-
<scope>test</scope>
86+
<groupId>javax.money</groupId>
87+
<artifactId>money-api</artifactId>
6188
</dependency>
6289
<dependency>
6390
<groupId>org.javamoney.moneta</groupId>
6491
<artifactId>moneta-core</artifactId>
65-
<version>${ri.version}</version>
6692
</dependency>
6793
<dependency>
6894
<groupId>org.javamoney.moneta</groupId>
6995
<artifactId>moneta-convert</artifactId>
70-
<version>${ri.version}</version>
7196
</dependency>
97+
7298
<!-- OSGI support -->
7399
<dependency>
74100
<groupId>org.osgi</groupId>
75101
<artifactId>org.osgi.annotation</artifactId>
102+
<scope>provided</scope>
103+
<version>${osgi.annotation.version}</version>
76104
<optional>true</optional>
77105
</dependency>
78106
<dependency>
79107
<groupId>org.osgi</groupId>
80108
<artifactId>org.osgi.compendium</artifactId>
109+
<scope>provided</scope>
110+
<version>${osgi.version}</version>
81111
<optional>true</optional>
82112
</dependency>
83113
<dependency>
84114
<groupId>org.osgi</groupId>
85115
<artifactId>org.osgi.core</artifactId>
116+
<version>${osgi.version}</version>
117+
<scope>provided</scope>
86118
<optional>true</optional>
87119
</dependency>
120+
<!-- Testing -->
121+
<dependency>
122+
<groupId>org.testng</groupId>
123+
<artifactId>testng</artifactId>
124+
<scope>test</scope>
125+
</dependency>
88126
</dependencies>
89127
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import org.javamoney.moneta.convert.internal.yahoo.YahooRateProvider;
2+
3+
/*
4+
* CREDIT SUISSE IS WILLING TO LICENSE THIS SPECIFICATION TO YOU ONLY UPON THE CONDITION THAT YOU
5+
* ACCEPT ALL OF THE TERMS CONTAINED IN THIS AGREEMENT. PLEASE READ THE TERMS AND CONDITIONS OF THIS
6+
* AGREEMENT CAREFULLY. BY DOWNLOADING THIS SPECIFICATION, YOU ACCEPT THE TERMS AND CONDITIONS OF
7+
* THE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY IT, SELECT THE "DECLINE" BUTTON AT THE
8+
* BOTTOM OF THIS PAGE. Specification: JSR-354 Money and Currency API ("Specification") Copyright
9+
* (c) 2012-2013, Credit Suisse All rights reserved.
10+
*/
11+
module org.javamoney.moneta.convert.yahoo {
12+
requires java.xml;
13+
requires java.xml.bind;
14+
requires org.javamoney.moneta;
15+
requires org.javamoney.moneta.convert;
16+
requires static org.osgi.core;
17+
requires static org.osgi.compendium;
18+
requires static org.osgi.annotation;
19+
provides javax.money.convert.ExchangeRateProvider with
20+
YahooRateProvider;
21+
uses org.javamoney.moneta.spi.LoaderService;
22+
uses org.javamoney.moneta.spi.MonetaryAmountProducer;
23+
24+
}

exchange/exchange-rate-yahoo/src/main/java/org/javamoney/moneta/convert/internal/yahoo/OSGIServiceHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public JDKUtilServiceFactory(Class<?> serviceClass) {
110110
public Object getService(Bundle bundle, ServiceRegistration registration) {
111111
try {
112112
LOG.fine("Creating Service...:" + serviceClass.getName());
113-
return serviceClass.newInstance();
113+
return serviceClass.getConstructor().newInstance();
114114
} catch (Exception ex) {
115115
ex.printStackTrace();
116116
throw new IllegalStateException("Failed to create service: " + serviceClass.getName(), ex);

0 commit comments

Comments
 (0)