Skip to content

Commit 714af48

Browse files
committed
14: Deploy lib to maven repository
Task-Url: http://github.com/JavaMoney/javamoney-lib/issues/issue/14
1 parent 5537063 commit 714af48

File tree

8 files changed

+46
-25
lines changed

8 files changed

+46
-25
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ and interfaces for interoperation this library adds additional powerful APIs and
1010
development as a proof of concept:
1111

1212
* [**Calculation**](javamoney-calc) provides a set of monetary calculations and formulas. The idea here is to provide a comprehensive set of algorithms and tools to perform complex financial mathematics.
13-
* [**Bundles**](bundles) provides easy to use bundles for depend upon:
14-
* [**javamoney-all**](bundles/java-money-all) provides a pom that imports everything you need (API, RI and the released JavaMoney libraries).
1513
* [**Integration**](integration) provides bootstraping extensions that change the JavaMoney runtime capabilities:
1614
* [**javamoney-cdi**](integration/javamoney-cdi) Integrates JavaMoney with CDI, so SPIs can as well be loaded from CDI.
1715

18-
Currently the following modules are retired (not actively maintained or released):
19-
20-
* [**Formatting**](format) provides an extendable formatting library that allows to define complex formatters, that can be configured in arbitrary ways using `LocalizationStyle` instances.
16+
Currently the following modules are retired (or archived, not actively maintained):
17+
* [**Bundles**](bundles) provides easy to use bundles to depend upon:
18+
* [**javamoney-all**](bundles/java-money-all) provides a pom that imports everything you need (API, RI and the released JavaMoney libraries).
19+
* [**Formatting**](format) provides an extendble formatting library that allows to define complex formatters, that can be configured in arbitrary ways using `LocalizationStyle` instances.
2120
Also available is a flexible Builder for creating arbitrary complex formatters and parsers based on an ordered set of arbitrary tokens.
2221
* [**Region API**](regions) provides a forest (a set of trees) of regions. This allows to model regional hierarchies in a more flexible and intuitive way, than adding all functionalities into `java.util.Locale`.
2322
By default the Unicode CLDR region tree, well as ISO countries defined by the 2- or 3-letter country code are available.

integration/javamoney-cdi/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<parent>
55
<groupId>org.javamoney.integration</groupId>
66
<artifactId>javamoney-integration</artifactId>
7-
<version>0.6</version>
7+
<version>0.8-SNAPSHOT</version>
88
</parent>
99
<artifactId>javamoney-cdi</artifactId>
10-
<name>JavaMoney - CDI Integration</name>
10+
<name>Money and Currency - JavaMoney CDI Integration</name>
1111
<description>Implementation of JSR 354 Bootstrap mechanism that uses CDI in additiona to the ServiceLoader for
1212
locating components.
1313
</description>

integration/javamoney-cdi/src/main/java/org/javamoney/cdi/bootstrap/CDISEServiceProvider.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2013, Werner Keil, Credit Suisse (Anatole Tresch).
2+
* Copyright (c) 2012, 2015, Werner Keil, Credit Suisse (Anatole Tresch).
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -15,9 +15,12 @@
1515
*
1616
*
1717
* Contributors: Anatole Tresch - initial version.
18+
* Werner Keil - adjusted to 1.0.
1819
*/
1920
package org.javamoney.cdi.bootstrap;
2021

22+
import static org.javamoney.cdi.bootstrap.Constants.PRIO;
23+
2124
import java.util.*;
2225

2326
import javax.annotation.Priority;
@@ -30,8 +33,9 @@
3033
* where possible. Additionally ServiceLoader based service are loaded and are returned
3134
* ONLY, when not the same service is loaded as well in CDI.
3235
*/
33-
@Priority(100)
36+
@Priority(PRIO)
3437
public class CDISEServiceProvider implements ServiceProvider {
38+
3539
/**
3640
* Default provider, using ServiceLoader.
3741
*/
@@ -55,7 +59,6 @@ public <T> List<T> getServices(Class<T> serviceType) {
5559
return instances;
5660
}
5761

58-
@Override
5962
public <T> List<T> getServices(Class<T> serviceType, List<T> defaultList) {
6063
List<T> services = getServices(serviceType);
6164
if (services.isEmpty()) {
@@ -70,4 +73,9 @@ public String toString() {
7073
"defaultServiceProvider=" + defaultServiceProvider +
7174
'}';
7275
}
76+
77+
@Override
78+
public int getPriority() {
79+
return PRIO;
80+
}
7381
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.javamoney.cdi.bootstrap;
2+
3+
abstract class Constants {
4+
static final int PRIO = 100;
5+
}

integration/javamoney-cdi/src/main/java/org/javamoney/cdi/bootstrap/DefaultServiceProvider.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.javamoney.cdi.bootstrap;
2020

2121
import javax.money.spi.ServiceProvider;
22+
2223
import java.util.ArrayList;
2324
import java.util.Collections;
2425
import java.util.List;
@@ -44,7 +45,6 @@ public class DefaultServiceProvider implements ServiceProvider {
4445
* @param defaultList the list of items returned, if no services were found.
4546
* @return the items found, never {@code null}.
4647
*/
47-
@Override
4848
public <T> List<T> getServices(final Class<T> serviceType, final List<T> defaultList) {
4949
@SuppressWarnings("unchecked")
5050
List<T> found = (List<T>) servicesLoaded.get(serviceType);
@@ -82,4 +82,15 @@ private <T> List<T> loadServices(final Class<T> serviceType, final List<T> defau
8282
}
8383
}
8484

85+
@Override
86+
public int getPriority() {
87+
return 0;
88+
}
89+
90+
@Override
91+
public <T> List<T> getServices(Class<T> serviceType) {
92+
// TODO Auto-generated method stub
93+
return null;
94+
}
95+
8596
}

integration/javamoney-cdi/src/test/java/org/javamoney/cdi/SmokeTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2014, Werner Keil, Credit Suisse (Anatole Tresch).
2+
* Copyright (c) 2012, 2015, Werner Keil, Credit Suisse (Anatole Tresch).
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -26,8 +26,7 @@
2626

2727
import javax.money.CurrencyUnit;
2828
import javax.money.MonetaryAmount;
29-
import javax.money.MonetaryAmounts;
30-
import javax.money.MonetaryCurrencies;
29+
import javax.money.Monetary;
3130
import javax.money.convert.*;
3231
import javax.money.format.MonetaryAmountFormat;
3332
import javax.money.format.MonetaryFormats;
@@ -54,7 +53,7 @@ public static final void startContainer() {
5453
@Test
5554
public void testCreateAmounts() {
5655
// Creating one
57-
CurrencyUnit currency = MonetaryCurrencies.getCurrency("CHF");
56+
CurrencyUnit currency = Monetary.getCurrency("CHF");
5857
Money amount1 = Money.of(1.0d, currency);
5958
Money amount2 = Money.of(1.0d, currency);
6059
Money amount3 = amount1.add(amount2);
@@ -81,13 +80,13 @@ public void testExchange() {
8180
ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider("ECB");
8281
assertNotNull(prov);
8382
ExchangeRate rate1 =
84-
prov.getExchangeRate(MonetaryCurrencies.getCurrency("CHF"), MonetaryCurrencies.getCurrency("EUR"));
83+
prov.getExchangeRate(Monetary.getCurrency("CHF"), Monetary.getCurrency("EUR"));
8584
ExchangeRate rate2 =
86-
prov.getExchangeRate(MonetaryCurrencies.getCurrency("EUR"), MonetaryCurrencies.getCurrency("CHF"));
85+
prov.getExchangeRate(Monetary.getCurrency("EUR"), Monetary.getCurrency("CHF"));
8786
ExchangeRate rate3 =
88-
prov.getExchangeRate(MonetaryCurrencies.getCurrency("CHF"), MonetaryCurrencies.getCurrency("USD"));
87+
prov.getExchangeRate(Monetary.getCurrency("CHF"), Monetary.getCurrency("USD"));
8988
ExchangeRate rate4 =
90-
prov.getExchangeRate(MonetaryCurrencies.getCurrency("USD"), MonetaryCurrencies.getCurrency("CHF"));
89+
prov.getExchangeRate(Monetary.getCurrency("USD"), Monetary.getCurrency("CHF"));
9190
System.out.println(rate1);
9291
System.out.println(rate2);
9392
System.out.println(rate3);
@@ -100,7 +99,7 @@ public void testAmountFormatRoundTrip() throws ParseException {
10099
// Using parsers
101100
MonetaryAmountFormat format = MonetaryFormats.getAmountFormat(Locale.GERMANY);
102101
assertNotNull(format);
103-
MonetaryAmount amount = MonetaryAmounts.getDefaultAmountFactory().setCurrency("CHF").setNumber(10.50).create();
102+
MonetaryAmount amount = Monetary.getDefaultAmountFactory().setCurrency("CHF").setNumber(10.50).create();
104103
String formatted = format.format(amount);
105104
assertNotNull(formatted);
106105
MonetaryAmount parsed = format.parse(formatted);
@@ -111,9 +110,9 @@ public void testAmountFormatRoundTrip() throws ParseException {
111110
@Test
112111
public void testCurrencyAccess() {
113112
// Creating one
114-
CurrencyUnit currency = MonetaryCurrencies.getCurrency("INR");
113+
CurrencyUnit currency = Monetary.getCurrency("INR");
115114
assertNotNull(currency);
116-
currency = MonetaryCurrencies.getCurrency("CDITest");
115+
currency = Monetary.getCurrency("CDITest");
117116
assertNotNull(currency);
118117
}
119118

integration/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.javamoney.lib</groupId>
66
<artifactId>javamoney-lib</artifactId>
7-
<version>0.6</version>
7+
<version>0.8-SNAPSHOT</version>
88
</parent>
99

1010
<groupId>org.javamoney.integration</groupId>

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
<modules>
2929
<module>calc</module>
3030
<!-- module>bundles</module -->
31-
<!-- module>integration</module> -->
32-
<module>incubator</module>
31+
<module>integration</module>
3332
</modules>
3433

3534
<repositories>

0 commit comments

Comments
 (0)