Merge pull request #1 from iluwatar/master

Update my local repository
This commit is contained in:
Thomas authored and GitHub committed 2016-12-14 08:52:22 +01:00
commit aeefc11f25
1117 files changed
+8138 -5262

No files matched your search

+1 -1
View File
@@ -15,5 +15,5 @@ datanucleus.log
/bin/ /bin/
/bin/ /bin/
/bin/ /bin/
*.log
data-mapper/src/main/resources/log4j.xml data-mapper/src/main/resources/log4j.xml
+1 -1
View File
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,33 +1,29 @@
@startuml @startuml
package com.iluwatar.abstractdocument.domain { package com.iluwatar.abstractdocument.domain {
class Part {
+ Part(properties : Map<String, Object>)
}
interface HasPrice {
+ PROPERTY : String {static}
+ getPrice() : Optional<Number>
}
interface HasParts {
+ PROPERTY : String {static}
+ getParts() : Stream<Part>
}
class Car { class Car {
+ Car(properties : Map<String, Object>) + Car(properties : Map<String, Object>)
} }
interface HasType {
+ PROPERTY : String {static}
+ getType() : Optional<String>
}
interface HasModel { interface HasModel {
+ PROPERTY : String {static} + PROPERTY : String {static}
+ getModel() : Optional<String> + getModel() : Optional<String>
} }
interface HasParts {
+ PROPERTY : String {static}
+ getParts() : Stream<Part>
}
interface HasPrice {
+ PROPERTY : String {static}
+ getPrice() : Optional<Number>
}
interface HasType {
+ PROPERTY : String {static}
+ getType() : Optional<String>
}
class Part {
+ Part(properties : Map<String, Object>)
}
} }
package com.iluwatar.abstractdocument { package com.iluwatar.abstractdocument {
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class AbstractDocument { abstract class AbstractDocument {
- properties : Map<String, Object> - properties : Map<String, Object>
# AbstractDocument(properties : Map<String, Object>) # AbstractDocument(properties : Map<String, Object>)
@@ -36,24 +32,28 @@ package com.iluwatar.abstractdocument {
+ put(key : String, value : Object) + put(key : String, value : Object)
+ toString() : String + toString() : String
} }
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
interface Document { interface Document {
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract} + children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
+ get(String) : Object {abstract} + get(String) : Object {abstract}
+ put(String, Object) {abstract} + put(String, Object) {abstract}
} }
} }
AbstractDocument --+ Map
Part ..|> HasType
Part ..|> HasModel
Part ..|> HasPrice
Part --|> AbstractDocument
AbstractDocument ..|> Document AbstractDocument ..|> Document
HasPrice --|> Document
HasParts --|> Document
Car ..|> HasModel Car ..|> HasModel
Car ..|> HasPrice Car ..|> HasPrice
Car ..|> HasParts Car ..|> HasParts
Car --|> AbstractDocument Car --|> AbstractDocument
HasType --|> Document
HasModel --|> Document HasModel --|> Document
HasParts --|> Document
HasPrice --|> Document
HasType --|> Document
Part ..|> HasType
Part ..|> HasModel
Part ..|> HasPrice
Part --|> AbstractDocument
@enduml @enduml
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,8 @@ import com.iluwatar.abstractdocument.domain.HasModel;
import com.iluwatar.abstractdocument.domain.HasParts; import com.iluwatar.abstractdocument.domain.HasParts;
import com.iluwatar.abstractdocument.domain.HasPrice; import com.iluwatar.abstractdocument.domain.HasPrice;
import com.iluwatar.abstractdocument.domain.HasType; import com.iluwatar.abstractdocument.domain.HasType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@@ -44,11 +46,13 @@ import java.util.Map;
*/ */
public class App { public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/** /**
* Executes the App * Executes the App
*/ */
public App() { public App() {
System.out.println("Constructing parts and car"); LOGGER.info("Constructing parts and car");
Map<String, Object> carProperties = new HashMap<>(); Map<String, Object> carProperties = new HashMap<>();
carProperties.put(HasModel.PROPERTY, "300SL"); carProperties.put(HasModel.PROPERTY, "300SL");
@@ -68,12 +72,11 @@ public class App {
Car car = new Car(carProperties); Car car = new Car(carProperties);
System.out.println("Here is our car:"); LOGGER.info("Here is our car:");
System.out.println("-> model: " + car.getModel().get()); LOGGER.info("-> model: {}", car.getModel().get());
System.out.println("-> price: " + car.getPrice().get()); LOGGER.info("-> price: {}", car.getPrice().get());
System.out.println("-> parts: "); LOGGER.info("-> parts: ");
car.getParts().forEach(p -> System.out car.getParts().forEach(p -> LOGGER.info("\t{}/{}/{}", p.getType().get(), p.getModel().get(), p.getPrice().get()));
.println("\t" + p.getType().get() + "/" + p.getModel().get() + "/" + p.getPrice().get()));
} }
/** /**
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p> * <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+43 -42
View File
@@ -1,6 +1,7 @@
@startuml @startuml
package com.iluwatar.abstractfactory { package com.iluwatar.abstractfactory {
class App { class App {
- LOGGER : Logger {static}
- army : Army - army : Army
- castle : Castle - castle : Castle
- king : King - king : King
@@ -17,58 +18,58 @@ package com.iluwatar.abstractfactory {
- setCastle(castle : Castle) - setCastle(castle : Castle)
- setKing(king : King) - setKing(king : King)
} }
class OrcKingdomFactory { interface Army {
+ OrcKingdomFactory() + getDescription() : String {abstract}
+ createArmy() : Army }
+ createCastle() : Castle interface Castle {
+ createKing() : King + getDescription() : String {abstract}
}
class ElfArmy {
~ DESCRIPTION : String {static}
+ ElfArmy()
+ getDescription() : String
} }
class ElfCastle { class ElfCastle {
~ DESCRIPTION : String {static} ~ DESCRIPTION : String {static}
+ ElfCastle() + ElfCastle()
+ getDescription() : String + getDescription() : String
} }
class ElfKing {
~ DESCRIPTION : String {static}
+ ElfKing()
+ getDescription() : String
}
class ElfKingdomFactory {
+ ElfKingdomFactory()
+ createArmy() : Army
+ createCastle() : Castle
+ createKing() : King
}
interface King {
+ getDescription() : String {abstract}
}
interface KingdomFactory {
+ createArmy() : Army {abstract}
+ createCastle() : Castle {abstract}
+ createKing() : King {abstract}
}
class OrcArmy {
~ DESCRIPTION : String {static}
+ OrcArmy()
+ getDescription() : String
}
class OrcCastle { class OrcCastle {
~ DESCRIPTION : String {static} ~ DESCRIPTION : String {static}
+ OrcCastle() + OrcCastle()
+ getDescription() : String + getDescription() : String
} }
interface KingdomFactory {
+ createArmy() : Army {abstract}
+ createCastle() : Castle {abstract}
+ createKing() : King {abstract}
}
class ElfKing {
~ DESCRIPTION : String {static}
+ ElfKing()
+ getDescription() : String
}
class ElfArmy {
~ DESCRIPTION : String {static}
+ ElfArmy()
+ getDescription() : String
}
interface Castle {
+ getDescription() : String {abstract}
}
interface Army {
+ getDescription() : String {abstract}
}
class OrcKing { class OrcKing {
~ DESCRIPTION : String {static} ~ DESCRIPTION : String {static}
+ OrcKing() + OrcKing()
+ getDescription() : String + getDescription() : String
} }
class OrcArmy { class OrcKingdomFactory {
~ DESCRIPTION : String {static} + OrcKingdomFactory()
+ OrcArmy()
+ getDescription() : String
}
interface King {
+ getDescription() : String {abstract}
}
class ElfKingdomFactory {
+ ElfKingdomFactory()
+ createArmy() : Army + createArmy() : Army
+ createCastle() : Castle + createCastle() : Castle
+ createKing() : King + createKing() : King
@@ -77,12 +78,12 @@ package com.iluwatar.abstractfactory {
App --> "-castle" Castle App --> "-castle" Castle
App --> "-king" King App --> "-king" King
App --> "-army" Army App --> "-army" Army
OrcKingdomFactory ..|> KingdomFactory
ElfCastle ..|> Castle
OrcCastle ..|> Castle
ElfKing ..|> King
ElfArmy ..|> Army ElfArmy ..|> Army
OrcKing ..|> King ElfCastle ..|> Castle
OrcArmy ..|> Army ElfKing ..|> King
ElfKingdomFactory ..|> KingdomFactory ElfKingdomFactory ..|> KingdomFactory
OrcArmy ..|> Army
OrcCastle ..|> Castle
OrcKing ..|> King
OrcKingdomFactory ..|> KingdomFactory
@enduml @enduml
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -22,6 +22,9 @@
*/ */
package com.iluwatar.abstractfactory; package com.iluwatar.abstractfactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
* The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme * The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme
@@ -39,6 +42,8 @@ package com.iluwatar.abstractfactory;
*/ */
public class App { public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
private King king; private King king;
private Castle castle; private Castle castle;
private Army army; private Army army;
@@ -98,17 +103,17 @@ public class App {
App app = new App(); App app = new App();
System.out.println("Elf Kingdom"); LOGGER.info("Elf Kingdom");
app.createKingdom(new ElfKingdomFactory()); app.createKingdom(new ElfKingdomFactory());
System.out.println(app.getArmy().getDescription()); LOGGER.info(app.getArmy().getDescription());
System.out.println(app.getCastle().getDescription()); LOGGER.info(app.getCastle().getDescription());
System.out.println(app.getKing().getDescription()); LOGGER.info(app.getKing().getDescription());
System.out.println("\nOrc Kingdom"); LOGGER.info("Orc Kingdom");
app.createKingdom(new OrcKingdomFactory()); app.createKingdom(new OrcKingdomFactory());
System.out.println(app.getArmy().getDescription()); LOGGER.info(app.getArmy().getDescription());
System.out.println(app.getCastle().getDescription()); LOGGER.info(app.getCastle().getDescription());
System.out.println(app.getKing().getDescription()); LOGGER.info(app.getKing().getDescription());
} }
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+8 -6
View File
@@ -1,18 +1,19 @@
@startuml @startuml
package com.iluwatar.adapter { package com.iluwatar.adapter {
interface BattleShip { class App {
+ fire() {abstract} + App()
+ move() {abstract} + main(args : String[]) {static}
} }
class BattleFishingBoat { class BattleFishingBoat {
- LOGGER : Logger {static}
- boat : FishingBoat - boat : FishingBoat
+ BattleFishingBoat() + BattleFishingBoat()
+ fire() + fire()
+ move() + move()
} }
class App { interface BattleShip {
+ App() + fire() {abstract}
+ main(args : String[]) {static} + move() {abstract}
} }
class Captain { class Captain {
- battleship : BattleShip - battleship : BattleShip
@@ -23,6 +24,7 @@ package com.iluwatar.adapter {
+ setBattleship(battleship : BattleShip) + setBattleship(battleship : BattleShip)
} }
class FishingBoat { class FishingBoat {
- LOGGER : Logger {static}
+ FishingBoat() + FishingBoat()
+ fish() + fish()
+ sail() + sail()
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -22,6 +22,9 @@
*/ */
package com.iluwatar.adapter; package com.iluwatar.adapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
* Adapter class. Adapts the interface of the device ({@link FishingBoat}) into {@link BattleShip} * Adapter class. Adapts the interface of the device ({@link FishingBoat}) into {@link BattleShip}
@@ -33,6 +36,8 @@ package com.iluwatar.adapter;
*/ */
public class BattleFishingBoat implements BattleShip { public class BattleFishingBoat implements BattleShip {
private static final Logger LOGGER = LoggerFactory.getLogger(BattleFishingBoat.class);
private FishingBoat boat; private FishingBoat boat;
public BattleFishingBoat() { public BattleFishingBoat() {
@@ -41,7 +46,7 @@ public class BattleFishingBoat implements BattleShip {
@Override @Override
public void fire() { public void fire() {
System.out.println("fire!"); LOGGER.info("fire!");
} }
@Override @Override
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -22,6 +22,9 @@
*/ */
package com.iluwatar.adapter; package com.iluwatar.adapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
* Device class (adaptee in the pattern). We want to reuse this class * Device class (adaptee in the pattern). We want to reuse this class
@@ -29,12 +32,14 @@ package com.iluwatar.adapter;
*/ */
public class FishingBoat { public class FishingBoat {
private static final Logger LOGGER = LoggerFactory.getLogger(FishingBoat.class);
public void sail() { public void sail() {
System.out.println("The Boat is moving to that place"); LOGGER.info("The Boat is moving to that place");
} }
public void fish() { public void fish() {
System.out.println("fishing ..."); LOGGER.info("fishing ...");
} }
} }
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,8 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
@@ -37,6 +39,8 @@ import java.io.IOException;
@Component @Component
public class ProductInformationClientImpl implements ProductInformationClient { public class ProductInformationClientImpl implements ProductInformationClient {
private static final Logger LOGGER = LoggerFactory.getLogger(ProductInformationClientImpl.class);
@Override @Override
public String getProductTitle() { public String getProductTitle() {
String response = null; String response = null;
@@ -46,7 +50,7 @@ public class ProductInformationClientImpl implements ProductInformationClient {
response = EntityUtils.toString(httpResponse.getEntity()); response = EntityUtils.toString(httpResponse.getEntity());
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOGGER.error("Exception caught.", e);
} }
return response; return response;
} }
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -27,6 +27,8 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
@@ -37,6 +39,8 @@ import java.io.IOException;
@Component @Component
public class ProductInventoryClientImpl implements ProductInventoryClient { public class ProductInventoryClientImpl implements ProductInventoryClient {
private static final Logger LOGGER = LoggerFactory.getLogger(ProductInventoryClientImpl.class);
@Override @Override
public int getProductInventories() { public int getProductInventories() {
String response = "0"; String response = "0";
@@ -46,7 +50,7 @@ public class ProductInventoryClientImpl implements ProductInventoryClient {
response = EntityUtils.toString(httpResponse.getEntity()); response = EntityUtils.toString(httpResponse.getEntity());
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOGGER.error("Exception caught.", e);
} }
return Integer.parseInt(response); return Integer.parseInt(response);
} }
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,16 +1,15 @@
@startuml @startuml
package com.iluwatar.aggregator.microservices { package com.iluwatar.aggregator.microservices {
class ProductInventoryClientImpl { class Aggregator {
+ ProductInventoryClientImpl() - informationClient : ProductInformationClient
+ getProductInventories() : int - inventoryClient : ProductInventoryClient
+ Aggregator()
+ getProduct() : Product
} }
class App { class App {
+ App() + App()
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
interface ProductInventoryClient {
+ getProductInventories() : int {abstract}
}
class Product { class Product {
- productInventories : int - productInventories : int
- title : String - title : String
@@ -20,22 +19,25 @@ package com.iluwatar.aggregator.microservices {
+ setProductInventories(productInventories : int) + setProductInventories(productInventories : int)
+ setTitle(title : String) + setTitle(title : String)
} }
class Aggregator {
- informationClient : ProductInformationClient
- inventoryClient : ProductInventoryClient
+ Aggregator()
+ getProduct() : Product
}
class ProductInformationClientImpl {
+ ProductInformationClientImpl()
+ getProductTitle() : String
}
interface ProductInformationClient { interface ProductInformationClient {
+ getProductTitle() : String {abstract} + getProductTitle() : String {abstract}
} }
class ProductInformationClientImpl {
- LOGGER : Logger {static}
+ ProductInformationClientImpl()
+ getProductTitle() : String
}
interface ProductInventoryClient {
+ getProductInventories() : int {abstract}
}
class ProductInventoryClientImpl {
- LOGGER : Logger {static}
+ ProductInventoryClientImpl()
+ getProductInventories() : int
}
} }
Aggregator --> "-inventoryClient" ProductInventoryClient
Aggregator --> "-informationClient" ProductInformationClient Aggregator --> "-informationClient" ProductInformationClient
ProductInventoryClientImpl ..|> ProductInventoryClient Aggregator --> "-inventoryClient" ProductInventoryClient
ProductInformationClientImpl ..|> ProductInformationClient ProductInformationClientImpl ..|> ProductInformationClient
ProductInventoryClientImpl ..|> ProductInventoryClient
@enduml @enduml
@@ -1,12 +1,12 @@
@startuml @startuml
package com.iluwatar.inventory.microservice { package com.iluwatar.inventory.microservice {
class InventoryController {
+ InventoryController()
+ getProductInventories() : int
}
class InventoryApplication { class InventoryApplication {
+ InventoryApplication() + InventoryApplication()
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
class InventoryController {
+ InventoryController()
+ getProductInventories() : int
}
} }
@enduml @enduml
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* <p/> * <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+22 -22
View File
@@ -1,12 +1,27 @@
@startuml @startuml
package com.iluwatar.api.gateway { package com.iluwatar.api.gateway {
class ApiGateway {
- imageClient : ImageClient
- priceClient : PriceClient
+ ApiGateway()
+ getProductDesktop() : DesktopProduct
+ getProductMobile() : MobileProduct
}
class App { class App {
+ App() + App()
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
class PriceClientImpl { class DesktopProduct {
+ PriceClientImpl() - imagePath : String
- price : String
+ DesktopProduct()
+ getImagePath() : String
+ getPrice() : String + getPrice() : String
+ setImagePath(imagePath : String)
+ setPrice(price : String)
}
interface ImageClient {
+ getImagePath() : String {abstract}
} }
class ImageClientImpl { class ImageClientImpl {
+ ImageClientImpl() + ImageClientImpl()
@@ -18,31 +33,16 @@ package com.iluwatar.api.gateway {
+ getPrice() : String + getPrice() : String
+ setPrice(price : String) + setPrice(price : String)
} }
interface ImageClient {
+ getImagePath() : String {abstract}
}
class ApiGateway {
- imageClient : ImageClient
- priceClient : PriceClient
+ ApiGateway()
+ getProductDesktop() : DesktopProduct
+ getProductMobile() : MobileProduct
}
class DesktopProduct {
- imagePath : String
- price : String
+ DesktopProduct()
+ getImagePath() : String
+ getPrice() : String
+ setImagePath(imagePath : String)
+ setPrice(price : String)
}
interface PriceClient { interface PriceClient {
+ getPrice() : String {abstract} + getPrice() : String {abstract}
} }
class PriceClientImpl {
+ PriceClientImpl()
+ getPrice() : String
}
} }
ApiGateway --> "-imageClient" ImageClient ApiGateway --> "-imageClient" ImageClient
ApiGateway --> "-priceClient" PriceClient ApiGateway --> "-priceClient" PriceClient
PriceClientImpl ..|> PriceClient
ImageClientImpl ..|> ImageClient ImageClientImpl ..|> ImageClient
PriceClientImpl ..|> PriceClient
@enduml @enduml
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
# #
# The MIT License # The MIT License
# Copyright (c) 2014 Ilkka Seppälä # Copyright (c) 2014-2016 Ilkka Seppälä
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,22 +1,26 @@
@startuml @startuml
package com.iluwatar.async.method.invocation { package com.iluwatar.async.method.invocation {
class App { class App {
- LOGGER : Logger {static}
+ App() + App()
- callback(name : String) : AsyncCallback<T> {static} - callback(name : String) : AsyncCallback<T> {static}
- lazyval(value : T, delayMillis : long) : Callable<T> {static} - lazyval(value : T, delayMillis : long) : Callable<T> {static}
- log(msg : String) {static} - log(msg : String) {static}
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
interface AsyncResult<T> { interface AsyncCallback<T> {
+ await() {abstract} + onComplete(T, Optional<Exception>) {abstract}
+ getValue() : T {abstract}
+ isCompleted() : boolean {abstract}
} }
interface AsyncExecutor { interface AsyncExecutor {
+ endProcess(AsyncResult<T>) : T {abstract} + endProcess(AsyncResult<T>) : T {abstract}
+ startProcess(Callable<T>) : AsyncResult<T> {abstract} + startProcess(Callable<T>) : AsyncResult<T> {abstract}
+ startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract} + startProcess(Callable<T>, AsyncCallback<T>) : AsyncResult<T> {abstract}
} }
interface AsyncResult<T> {
+ await() {abstract}
+ getValue() : T {abstract}
+ isCompleted() : boolean {abstract}
}
class ThreadAsyncExecutor { class ThreadAsyncExecutor {
- idx : AtomicInteger - idx : AtomicInteger
+ ThreadAsyncExecutor() + ThreadAsyncExecutor()
@@ -24,9 +28,6 @@ package com.iluwatar.async.method.invocation {
+ startProcess(task : Callable<T>) : AsyncResult<T> + startProcess(task : Callable<T>) : AsyncResult<T>
+ startProcess(task : Callable<T>, callback : AsyncCallback<T>) : AsyncResult<T> + startProcess(task : Callable<T>, callback : AsyncCallback<T>) : AsyncResult<T>
} }
interface AsyncCallback<T> {
+ onComplete(T, Optional<Exception>) {abstract}
}
-class CompletableResult<T> { -class CompletableResult<T> {
~ COMPLETED : int {static} ~ COMPLETED : int {static}
~ FAILED : int {static} ~ FAILED : int {static}
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -22,6 +22,9 @@
*/ */
package com.iluwatar.async.method.invocation; package com.iluwatar.async.method.invocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
/** /**
@@ -54,6 +57,8 @@ import java.util.concurrent.Callable;
*/ */
public class App { public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/** /**
* Program entry point * Program entry point
*/ */
@@ -120,6 +125,6 @@ public class App {
} }
private static void log(String msg) { private static void log(String msg) {
System.out.println(String.format("[%1$-10s] - %2$s", Thread.currentThread().getName(), msg)); LOGGER.info(msg);
} }
} }
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
+71 -68
View File
@@ -1,72 +1,9 @@
@startuml @startuml
package com.iluwatar.bridge { package com.iluwatar.bridge {
class FlyingMagicWeapon {
+ FlyingMagicWeapon(imp : FlyingMagicWeaponImpl)
+ fly()
+ getImp() : FlyingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
class Stormbringer {
+ Stormbringer()
+ eatSoulImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
abstract class FlyingMagicWeaponImpl {
+ FlyingMagicWeaponImpl()
+ flyImp() {abstract}
}
class SoulEatingMagicWeapon {
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
+ eatSoul()
+ getImp() : SoulEatingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
abstract class MagicWeaponImpl {
+ MagicWeaponImpl()
+ swingImp() {abstract}
+ unwieldImp() {abstract}
+ wieldImp() {abstract}
}
abstract class SoulEatingMagicWeaponImpl {
+ SoulEatingMagicWeaponImpl()
+ eatSoulImp() {abstract}
}
class Excalibur {
+ Excalibur()
+ blindImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class Mjollnir {
+ Mjollnir()
+ flyImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class App { class App {
+ App() + App()
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
abstract class MagicWeapon {
# imp : MagicWeaponImpl
+ MagicWeapon(imp : MagicWeaponImpl)
+ getImp() : MagicWeaponImpl
+ swing() {abstract}
+ unwield() {abstract}
+ wield() {abstract}
}
abstract class BlindingMagicWeaponImpl {
+ BlindingMagicWeaponImpl()
+ blindImp() {abstract}
}
class BlindingMagicWeapon { class BlindingMagicWeapon {
+ BlindingMagicWeapon(imp : BlindingMagicWeaponImpl) + BlindingMagicWeapon(imp : BlindingMagicWeaponImpl)
+ blind() + blind()
@@ -75,15 +12,81 @@ package com.iluwatar.bridge {
+ unwield() + unwield()
+ wield() + wield()
} }
abstract class BlindingMagicWeaponImpl {
+ BlindingMagicWeaponImpl()
+ blindImp() {abstract}
}
class Excalibur {
- LOGGER : Logger {static}
+ Excalibur()
+ blindImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class FlyingMagicWeapon {
+ FlyingMagicWeapon(imp : FlyingMagicWeaponImpl)
+ fly()
+ getImp() : FlyingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
abstract class FlyingMagicWeaponImpl {
+ FlyingMagicWeaponImpl()
+ flyImp() {abstract}
}
abstract class MagicWeapon {
# imp : MagicWeaponImpl
+ MagicWeapon(imp : MagicWeaponImpl)
+ getImp() : MagicWeaponImpl
+ swing() {abstract}
+ unwield() {abstract}
+ wield() {abstract}
}
abstract class MagicWeaponImpl {
+ MagicWeaponImpl()
+ swingImp() {abstract}
+ unwieldImp() {abstract}
+ wieldImp() {abstract}
}
class Mjollnir {
- LOGGER : Logger {static}
+ Mjollnir()
+ flyImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
class SoulEatingMagicWeapon {
+ SoulEatingMagicWeapon(imp : SoulEatingMagicWeaponImpl)
+ eatSoul()
+ getImp() : SoulEatingMagicWeaponImpl
+ swing()
+ unwield()
+ wield()
}
abstract class SoulEatingMagicWeaponImpl {
+ SoulEatingMagicWeaponImpl()
+ eatSoulImp() {abstract}
}
class Stormbringer {
- LOGGER : Logger {static}
+ Stormbringer()
+ eatSoulImp()
+ swingImp()
+ unwieldImp()
+ wieldImp()
}
} }
MagicWeapon --> "-imp" MagicWeaponImpl MagicWeapon --> "-imp" MagicWeaponImpl
BlindingMagicWeapon --|> MagicWeapon
BlindingMagicWeaponImpl --|> MagicWeaponImpl
Excalibur --|> BlindingMagicWeaponImpl
FlyingMagicWeapon --|> MagicWeapon FlyingMagicWeapon --|> MagicWeapon
Stormbringer --|> SoulEatingMagicWeaponImpl
FlyingMagicWeaponImpl --|> MagicWeaponImpl FlyingMagicWeaponImpl --|> MagicWeaponImpl
Mjollnir --|> FlyingMagicWeaponImpl
SoulEatingMagicWeapon --|> MagicWeapon SoulEatingMagicWeapon --|> MagicWeapon
SoulEatingMagicWeaponImpl --|> MagicWeaponImpl SoulEatingMagicWeaponImpl --|> MagicWeaponImpl
Excalibur --|> BlindingMagicWeaponImpl Stormbringer --|> SoulEatingMagicWeaponImpl
Mjollnir --|> FlyingMagicWeaponImpl
BlindingMagicWeaponImpl --|> MagicWeaponImpl
BlindingMagicWeapon --|> MagicWeapon
@enduml @enduml
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- <!--
The MIT License The MIT License
Copyright (c) 2014 Ilkka Seppälä Copyright (c) 2014-2016 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
/** /**
* The MIT License * The MIT License
* Copyright (c) 2014 Ilkka Seppälä * Copyright (c) 2014-2016 Ilkka Seppälä
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
Loaded 100 of 1117 files, more files were not shown because too many files have changed in this diff. Show more