Skip to content

Commit

Permalink
14: Deploy lib to maven repository
Browse files Browse the repository at this point in the history
  • Loading branch information
keilw committed May 30, 2015
1 parent 5537063 commit 714af48
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 25 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ and interfaces for interoperation this library adds additional powerful APIs and
development as a proof of concept:

* [**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.
* [**Bundles**](bundles) provides easy to use bundles for depend upon:
* [**javamoney-all**](bundles/java-money-all) provides a pom that imports everything you need (API, RI and the released JavaMoney libraries).
* [**Integration**](integration) provides bootstraping extensions that change the JavaMoney runtime capabilities:
* [**javamoney-cdi**](integration/javamoney-cdi) Integrates JavaMoney with CDI, so SPIs can as well be loaded from CDI.

Currently the following modules are retired (not actively maintained or released):

* [**Formatting**](format) provides an extendable formatting library that allows to define complex formatters, that can be configured in arbitrary ways using `LocalizationStyle` instances.
Currently the following modules are retired (or archived, not actively maintained):
* [**Bundles**](bundles) provides easy to use bundles to depend upon:
* [**javamoney-all**](bundles/java-money-all) provides a pom that imports everything you need (API, RI and the released JavaMoney libraries).
* [**Formatting**](format) provides an extendble formatting library that allows to define complex formatters, that can be configured in arbitrary ways using `LocalizationStyle` instances.
Also available is a flexible Builder for creating arbitrary complex formatters and parsers based on an ordered set of arbitrary tokens.
* [**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`.
By default the Unicode CLDR region tree, well as ISO countries defined by the 2- or 3-letter country code are available.
Expand Down
4 changes: 2 additions & 2 deletions integration/javamoney-cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<parent>
<groupId>org.javamoney.integration</groupId>
<artifactId>javamoney-integration</artifactId>
<version>0.6</version>
<version>0.8-SNAPSHOT</version>
</parent>
<artifactId>javamoney-cdi</artifactId>
<name>JavaMoney - CDI Integration</name>
<name>Money and Currency - JavaMoney CDI Integration</name>
<description>Implementation of JSR 354 Bootstrap mechanism that uses CDI in additiona to the ServiceLoader for
locating components.
</description>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Werner Keil, Credit Suisse (Anatole Tresch).
* Copyright (c) 2012, 2015, Werner Keil, Credit Suisse (Anatole Tresch).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand All @@ -15,9 +15,12 @@
*
*
* Contributors: Anatole Tresch - initial version.
* Werner Keil - adjusted to 1.0.
*/
package org.javamoney.cdi.bootstrap;

import static org.javamoney.cdi.bootstrap.Constants.PRIO;

import java.util.*;

import javax.annotation.Priority;
Expand All @@ -30,8 +33,9 @@
* where possible. Additionally ServiceLoader based service are loaded and are returned
* ONLY, when not the same service is loaded as well in CDI.
*/
@Priority(100)
@Priority(PRIO)
public class CDISEServiceProvider implements ServiceProvider {

/**
* Default provider, using ServiceLoader.
*/
Expand All @@ -55,7 +59,6 @@ public <T> List<T> getServices(Class<T> serviceType) {
return instances;
}

@Override
public <T> List<T> getServices(Class<T> serviceType, List<T> defaultList) {
List<T> services = getServices(serviceType);
if (services.isEmpty()) {
Expand All @@ -70,4 +73,9 @@ public String toString() {
"defaultServiceProvider=" + defaultServiceProvider +
'}';
}

@Override
public int getPriority() {
return PRIO;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.javamoney.cdi.bootstrap;

abstract class Constants {
static final int PRIO = 100;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.javamoney.cdi.bootstrap;

import javax.money.spi.ServiceProvider;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand All @@ -44,7 +45,6 @@ public class DefaultServiceProvider implements ServiceProvider {
* @param defaultList the list of items returned, if no services were found.
* @return the items found, never {@code null}.
*/
@Override
public <T> List<T> getServices(final Class<T> serviceType, final List<T> defaultList) {
@SuppressWarnings("unchecked")
List<T> found = (List<T>) servicesLoaded.get(serviceType);
Expand Down Expand Up @@ -82,4 +82,15 @@ private <T> List<T> loadServices(final Class<T> serviceType, final List<T> defau
}
}

@Override
public int getPriority() {
return 0;
}

@Override
public <T> List<T> getServices(Class<T> serviceType) {
// TODO Auto-generated method stub
return null;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Werner Keil, Credit Suisse (Anatole Tresch).
* Copyright (c) 2012, 2015, Werner Keil, Credit Suisse (Anatole Tresch).
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand All @@ -26,8 +26,7 @@

import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount;
import javax.money.MonetaryAmounts;
import javax.money.MonetaryCurrencies;
import javax.money.Monetary;
import javax.money.convert.*;
import javax.money.format.MonetaryAmountFormat;
import javax.money.format.MonetaryFormats;
Expand All @@ -54,7 +53,7 @@ public static final void startContainer() {
@Test
public void testCreateAmounts() {
// Creating one
CurrencyUnit currency = MonetaryCurrencies.getCurrency("CHF");
CurrencyUnit currency = Monetary.getCurrency("CHF");
Money amount1 = Money.of(1.0d, currency);
Money amount2 = Money.of(1.0d, currency);
Money amount3 = amount1.add(amount2);
Expand All @@ -81,13 +80,13 @@ public void testExchange() {
ExchangeRateProvider prov = MonetaryConversions.getExchangeRateProvider("ECB");
assertNotNull(prov);
ExchangeRate rate1 =
prov.getExchangeRate(MonetaryCurrencies.getCurrency("CHF"), MonetaryCurrencies.getCurrency("EUR"));
prov.getExchangeRate(Monetary.getCurrency("CHF"), Monetary.getCurrency("EUR"));
ExchangeRate rate2 =
prov.getExchangeRate(MonetaryCurrencies.getCurrency("EUR"), MonetaryCurrencies.getCurrency("CHF"));
prov.getExchangeRate(Monetary.getCurrency("EUR"), Monetary.getCurrency("CHF"));
ExchangeRate rate3 =
prov.getExchangeRate(MonetaryCurrencies.getCurrency("CHF"), MonetaryCurrencies.getCurrency("USD"));
prov.getExchangeRate(Monetary.getCurrency("CHF"), Monetary.getCurrency("USD"));
ExchangeRate rate4 =
prov.getExchangeRate(MonetaryCurrencies.getCurrency("USD"), MonetaryCurrencies.getCurrency("CHF"));
prov.getExchangeRate(Monetary.getCurrency("USD"), Monetary.getCurrency("CHF"));
System.out.println(rate1);
System.out.println(rate2);
System.out.println(rate3);
Expand All @@ -100,7 +99,7 @@ public void testAmountFormatRoundTrip() throws ParseException {
// Using parsers
MonetaryAmountFormat format = MonetaryFormats.getAmountFormat(Locale.GERMANY);
assertNotNull(format);
MonetaryAmount amount = MonetaryAmounts.getDefaultAmountFactory().setCurrency("CHF").setNumber(10.50).create();
MonetaryAmount amount = Monetary.getDefaultAmountFactory().setCurrency("CHF").setNumber(10.50).create();
String formatted = format.format(amount);
assertNotNull(formatted);
MonetaryAmount parsed = format.parse(formatted);
Expand All @@ -111,9 +110,9 @@ public void testAmountFormatRoundTrip() throws ParseException {
@Test
public void testCurrencyAccess() {
// Creating one
CurrencyUnit currency = MonetaryCurrencies.getCurrency("INR");
CurrencyUnit currency = Monetary.getCurrency("INR");
assertNotNull(currency);
currency = MonetaryCurrencies.getCurrency("CDITest");
currency = Monetary.getCurrency("CDITest");
assertNotNull(currency);
}

Expand Down
2 changes: 1 addition & 1 deletion integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.javamoney.lib</groupId>
<artifactId>javamoney-lib</artifactId>
<version>0.6</version>
<version>0.8-SNAPSHOT</version>
</parent>

<groupId>org.javamoney.integration</groupId>
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
<modules>
<module>calc</module>
<!-- module>bundles</module -->
<!-- module>integration</module> -->
<module>incubator</module>
<module>integration</module>
</modules>

<repositories>
Expand Down

0 comments on commit 714af48

Please sign in to comment.