Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
244 commits
Select commit Hold shift + click to select a range
88c3b04
#297 Create API Gateway pattern
TylerMcConville Feb 7, 2016
3cbb88e
#297 Create unit tests for Gateway API pattern
TylerMcConville Feb 7, 2016
3ed3bc1
Added mutex and semaphore modules to demonstrate locks
gwildor28 Mar 7, 2016
2ed0899
Initial commit for Hexagonal Architecture pattern
iluwatar Mar 13, 2016
06546ae
Fix license headers
iluwatar Mar 13, 2016
b0f96ad
Added class for lottery numbers and unit tests for it
iluwatar Mar 19, 2016
cd3a5d4
Work on lottery numbers unit tests
iluwatar Mar 19, 2016
81718eb
Added player details and unit tests
iluwatar Mar 19, 2016
035b14f
Added lottery ticket and unit tests
iluwatar Mar 19, 2016
804ffc3
Added lottery service interface
iluwatar Mar 20, 2016
2785f69
Add lottery ticket check result
iluwatar Mar 20, 2016
95e6a67
Added interface for accessing lottery tickets in database
iluwatar Mar 20, 2016
15d2b9d
Added interface to lottery service provider's bank account
iluwatar Mar 20, 2016
e8671e1
Add interface for lottery event notifications
iluwatar Mar 20, 2016
fde3399
Added interface for lottery administrators
iluwatar Mar 20, 2016
8b147c4
Add mock database for lottery tickets
iluwatar Mar 20, 2016
d2f620a
Added tests for lottery ticket repository
iluwatar Mar 22, 2016
266b658
Refactor interfaces
iluwatar Mar 22, 2016
6e4b269
Update according to review comments #397
gwildor28 Mar 24, 2016
8d6bc52
Simplify lottery ticket submit
iseppala Mar 26, 2016
656b599
Refactor to test utils
iseppala Mar 26, 2016
39a1c1e
Implement admin interface
iseppala Mar 26, 2016
4bb7dda
Work on admin tests
iseppala Mar 26, 2016
ac468bb
Added high level lottery test
iseppala Mar 26, 2016
f620123
Organize packages
iseppala Mar 26, 2016
11c0654
Add banking implementation
iseppala Mar 26, 2016
28d3cb2
Add notifications implementation
iseppala Mar 26, 2016
6608a8d
Utilize notifications and banking
iseppala Mar 27, 2016
28a5a43
basic implementation ++
inbravo Mar 29, 2016
474f265
Merge remote-tracking branch 'refs/remotes/iluwatar/master'
gwildor28 Mar 29, 2016
e2af78f
Update According to Review Comments #397
gwildor28 Mar 29, 2016
187658c
Merge remote-tracking branch 'iluwatar/master'
gwildor28 Mar 29, 2016
0c6d3f2
#297 Create Spring Boot-backed Image microservice with an endpoint to…
TylerMcConville Apr 2, 2016
01737bc
#297 Create Spring Boot-backed Price microservice with an endpoint to…
TylerMcConville Apr 2, 2016
665256e
#297 Create Spring Boot-backed API Gateway that aggregates calls to t…
TylerMcConville Apr 2, 2016
e80583f
#297 Create unit test for ImageController
TylerMcConville Apr 2, 2016
4ebb64c
#297 Create unit test for PriceController
TylerMcConville Apr 2, 2016
deb15e2
JDBC removed...
inbravo Apr 4, 2016
eb72493
JDBC removed...
inbravo Apr 4, 2016
59b6b81
Test/Doc added
inbravo Apr 4, 2016
822ab8d
Second type mapper is updated to use java.util.vector
inbravo Apr 4, 2016
c53dcf1
Intent++
inbravo Apr 6, 2016
06e0a15
Applicability++
inbravo Apr 6, 2016
b94a705
Add constants for win sum and prize payer's bank account
iseppala Apr 9, 2016
48803d4
Add example lottery run
iseppala Apr 9, 2016
5de9c7e
Lots of improvements to the example
iseppala Apr 9, 2016
68725bf
Merge branch 'master' into hexagonal
iseppala Apr 9, 2016
0fe8eec
Fix merge conflict
iseppala Apr 9, 2016
9b3aa78
Add missing license headers
iseppala Apr 9, 2016
ccc1ec9
Add readme and class diagram
iseppala Apr 10, 2016
c2f4194
Add alias name for the pattern
iseppala Apr 10, 2016
e546d5d
Add general description for the example code
iseppala Apr 10, 2016
cfda338
Fix version number
iseppala Apr 10, 2016
a7dfe76
Add alias names
iseppala Apr 11, 2016
1fd15d5
Merge remote-tracking branch 'refs/remotes/iluwatar/master'
gwildor28 Apr 13, 2016
3f9a756
pom update
gwildor28 Apr 13, 2016
ca8be7c
pom update
gwildor28 Apr 13, 2016
685d093
added relative paths to pom in mutex/semaphore
gwildor28 Apr 14, 2016
e821abd
updated version to fix pom
gwildor28 Apr 14, 2016
a284329
JUnit tests
gwildor28 Apr 17, 2016
8529d6e
First review changes++
inbravo Apr 18, 2016
32736fc
uml diagram++
inbravo Apr 18, 2016
534fb67
Merge pull request #397 from gwildor28/master
iluwatar Apr 18, 2016
28c2714
review comments++
inbravo Apr 19, 2016
8fa774d
mvn build file++
inbravo Apr 19, 2016
d5f7cb4
build check style error--
inbravo Apr 19, 2016
93b0b37
build error fix++
inbravo Apr 19, 2016
018a4e5
build error fix++
inbravo Apr 19, 2016
59e9d02
version++
inbravo Apr 19, 2016
af1db79
version++
inbravo Apr 20, 2016
49ca630
Merge branch 'master' into hexagonal
iseppala Apr 20, 2016
5b72510
Merge pull request #417 from inbravo/master
iluwatar Apr 23, 2016
bf7b682
Add License Shield
markusmo3 Apr 24, 2016
71e3443
Fix permalink to represent its current dir
markusmo3 Apr 24, 2016
a54cea7
#297 Create class diagrams for API Gateway, Price microservice, and I…
TylerMcConville Apr 24, 2016
9a9df80
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
TylerMcConville Apr 24, 2016
28d259a
#297 Create README.md
TylerMcConville Apr 24, 2016
b92318a
#297 Increase version number
TylerMcConville Apr 24, 2016
b115c61
#297 Fix error in README
TylerMcConville Apr 24, 2016
5abd20f
#297 Update license headers
TylerMcConville May 3, 2016
a6036e5
#297 Update category and tags in README
TylerMcConville May 3, 2016
8653eb8
#297 Move API Gateway code into a new submodule: api-gateway-service.…
TylerMcConville May 3, 2016
dd23853
#297 Add new dependencies to java-design-patterns/pom.xml and referen…
TylerMcConville May 3, 2016
f234a68
#297 Update class diagram to reflect new location of files
TylerMcConville May 3, 2016
0ad9937
Merge pull request #427 from surgeforward/297
iluwatar May 6, 2016
2ed3748
Improve Singleton holder example
iseppala May 7, 2016
75ed1b1
Review fixes
iseppala May 21, 2016
9de2cbe
Merge pull request #421 from iluwatar/hexagonal
iluwatar May 21, 2016
f6649a4
Markdown fix
iseppala May 22, 2016
509de97
renamed HeroBuilder to Builder
VarunVats9 May 29, 2016
c1187ae
#355 init abstract-document module
qza May 31, 2016
9134117
#355 document, abstract base, traits and example domain
qza Jun 1, 2016
32b6473
#355 class diagrams
qza Jun 1, 2016
a372f05
#355 override toString to log properties
qza Jun 2, 2016
43f90ea
#355 abstract document test
qza Jun 2, 2016
f3110de
#355 handle case when there are no child elements for the given key
qza Jun 2, 2016
c229ec2
#355 clean up
qza Jun 2, 2016
afdeba4
#355 finalize example
qza Jun 4, 2016
34431d7
Merge pull request #431 from VarunVats9/master
iluwatar Jun 5, 2016
f57b94a
Merge pull request #433 from qza/master
iluwatar Jun 7, 2016
53fc8b7
Page Object pattern implementation
colinbut Jun 18, 2016
c8f04d2
added Class Diagram
colinbut Jun 18, 2016
0282d66
README
colinbut Jun 18, 2016
6677d10
implementation of microservices architectural pattern #296
protopapa Jun 23, 2016
27bbbd8
fix bug
protopapa Jun 26, 2016
f2e1982
Merge pull request #435 from protopapa/aggregator-microservices
iluwatar Jun 26, 2016
e7bd3ca
Update link for Naked Objects paper
iseppala Jun 26, 2016
35c0942
syncing fork
colinbut Jun 27, 2016
27e4e9a
Feedback changes - restructed project structure
colinbut Jun 28, 2016
8efaf44
Feedback changes - sort out dependency
colinbut Jun 28, 2016
c212ee5
Feedback changes - fix dependency in pom
colinbut Jun 28, 2016
4eac37c
Feedback changes - removed file
colinbut Jun 28, 2016
7a118e4
Reached milestone 1.12.0
iseppala Jun 30, 2016
5c26f46
Set version number for next development iteration
iseppala Jun 30, 2016
b1e40d9
Feedback changes - final and refactored code
colinbut Jul 3, 2016
8832189
remove old class diagram
colinbut Jul 3, 2016
4a069ee
new class diagrams
colinbut Jul 3, 2016
5d58a1b
syncing fork
colinbut Jul 3, 2016
ef2ada4
syncing fork
colinbut Jul 3, 2016
f806c5b
Add known uses to Factory Method
iseppala Jul 4, 2016
849df50
Fix formatting
iseppala Jul 4, 2016
ff8037e
Add aliases for Specification pattern
iluwatar Jul 7, 2016
7be98fa
added missing licence headers to 2 files
colinbut Jul 9, 2016
85f432f
exclude library class from jacoco code coverage
colinbut Jul 9, 2016
f182e87
fixed app launch
colinbut Jul 10, 2016
b46d2de
Merge pull request #434 from colinbut/master
iluwatar Jul 12, 2016
fe1d760
Fix license headers
iseppala Jul 12, 2016
9f0320a
Add some tags to Page Object
iseppala Jul 12, 2016
0fbbd8d
#463 Added javax.servlet.Filter to real world examples of chain
pnowy Jul 17, 2016
f7b7f15
#463 Added javax.servlet.Filter to real world examples of interceptin…
pnowy Jul 17, 2016
d4c2f03
Merge pull request #464 from pnowy/#463-chain-of-responsibility
iluwatar Jul 18, 2016
ea75034
Work on #403, added basic implementation of promise pattern
npathai Jul 20, 2016
8124fd0
Adjust pattern categories and tags
iseppala Jul 21, 2016
1023414
Work on #403, added application class and test cases.
npathai Jul 21, 2016
bc94d0f
Fix link
iseppala Jul 21, 2016
4bd1f14
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
npathai Jul 22, 2016
2b945ca
Work on #403, removed dependency on async method invocation module, a…
npathai Jul 22, 2016
eb560f5
Work on #403, removed checkstyle violations
npathai Jul 22, 2016
09ba5ca
Work on #403, added class diagrams and javadocs
npathai Jul 22, 2016
40ac552
Work on #403, added README
npathai Jul 23, 2016
5fcef89
#459 added known aliast for monostate pattern
Crossy147 Jul 26, 2016
3001fa4
Merge pull request #471 from Crossy147/issue-#459
iluwatar Jul 27, 2016
383e4a3
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
npathai Jul 29, 2016
e7be94d
Merge branch 'Promise' of https://github.com/iluwatar/java-design-pat…
npathai Jul 29, 2016
547d798
Merge pull request #1 from iluwatar/master
sumityadav6541 Aug 3, 2016
94c3a2c
removed extra "is" from the javadoc of InitializingOnDemandHolderIdio…
sumityadav6541 Aug 3, 2016
55028a4
Merge pull request #476 from sumityadav6541/master
npathai Aug 4, 2016
7697063
Work on #403, incorporate review changes
npathai Aug 4, 2016
d484e7f
Documented singleton double check idiom, explaining the dynamics that…
npathai Aug 5, 2016
d50139e
Merge pull request #478 from iluwatar/DocumentDoubleCheckIdiom
iluwatar Aug 5, 2016
ffbc5f2
Reorganize LotteryNumbers for easier inclusion in the blog
iseppala Aug 13, 2016
7c2f5da
Add final keyword
iseppala Aug 13, 2016
0b36a31
Fix checkstyle error
iseppala Aug 14, 2016
b16d7fc
Configure Travis notification email
iseppala Aug 14, 2016
7e77216
remove link, resolves #479
markusmo3 Aug 15, 2016
5610092
Addendum #481
markusmo3 Aug 15, 2016
c79df70
#211 added real world examples from Java api for creational patterns
npathai Aug 20, 2016
eb75773
Added FAQ on Memento pattern
npathai Aug 20, 2016
a0c77c3
#211 added further examples for structural and behavioral patterns
npathai Aug 20, 2016
fdcf546
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
npathai Aug 20, 2016
28647cd
#211, consistent use of real world examples section in all readme files.
npathai Aug 20, 2016
95cf9fe
Work on #403, made example readable and moved methods into utility
npathai Aug 22, 2016
f16ae08
Remove extra space
alexsomai Aug 26, 2016
095adda
Change access level to private
alexsomai Aug 26, 2016
6575b3a
Merge pull request #491 from alexsomai/patch-1
npathai Aug 28, 2016
483c61a
Some refactoring, added javadocs
npathai Aug 28, 2016
5796e19
Work on #403, updated diagram and finishing touches
npathai Aug 29, 2016
ad11ea4
Work on #403, javadocs updated
npathai Aug 29, 2016
59cf100
#403, updated javadocs
npathai Aug 29, 2016
e73867f
Work on #190: Add automagic puml generation in pom.xml's
Aug 30, 2016
36fe249
Work on #190: Add first batch of automagically generated puml files
Aug 30, 2016
09037b0
Rename index.md to README.md
markusmo3 Aug 30, 2016
9dd1503
Work on #190: add postPumlsToServer.py python script
Aug 30, 2016
58dce1b
Work on #190: Commit initial pumlId's added by the script
Aug 30, 2016
5c1a4f1
Added example that mocking frameworks use proxy pattern
npathai Aug 31, 2016
e425c2e
Add webhook for travis build failures to gitter
markusmo3 Aug 31, 2016
678a06e
Merge pull request #470 from iluwatar/Promise
iluwatar Sep 2, 2016
90c636a
Add missing license headers
iseppala Sep 2, 2016
be2c7fd
Update URM version: 1.4.0 -> 1.4.1, fixes #492
Sep 2, 2016
165d1f1
Turn Error Tracing on when installing
markusmo3 Sep 2, 2016
fa52a7f
Run build with latest java 8 release
markusmo3 Sep 2, 2016
ff23e90
Add puml for Promise pattern
iseppala Sep 3, 2016
2d99061
Issue #469: Implementation of Event-based Asynchronous pattern
Aug 8, 2016
e1836fe
Updated parent POM to include new pattern (Event-asynchronous)
Aug 8, 2016
f115971
Fixed Checkstyle errors.
Aug 8, 2016
233f1e6
Removed PUBLIC modifiers from IEvent
Aug 9, 2016
e57a094
Merge pull request #490 from iluwatar/DocumentUsages
iluwatar Sep 3, 2016
ab68129
Hexagonal pattern: move business logic to core
iseppala Sep 3, 2016
3cb8728
Hexagonal pattern: remove unnecessary repository usage from a unit test
iseppala Sep 4, 2016
4493341
add documentation to 'use latest java 8' change
markusmo3 Sep 4, 2016
22821ba
Move Guice to parent pom dependency management section
iseppala Sep 6, 2016
348e577
Hexagonal pattern: Add Guice dependency
iseppala Sep 6, 2016
1b10ddb
Hexagonal pattern: Use Guice dependency injection
iseppala Sep 6, 2016
0f2807b
Hexagonal pattern: More descriptive class names
iseppala Sep 9, 2016
adc6019
Hexagonal pattern: Remove interfaces with only one implementation
iseppala Sep 10, 2016
121ed3c
Hexagonal pattern: Move lottery administration and service to the cor…
iseppala Sep 10, 2016
e17d72b
Hexagonal pattern: Added console interfaces for players and administr…
iseppala Sep 10, 2016
4410419
Hexagonal pattern: Simplified lottery ticket ids
iseppala Sep 11, 2016
a854634
Hexagonal pattern: Add mongo driver dependency
iseppala Sep 11, 2016
fce30db
Updating fork branch
Sep 11, 2016
626c567
Hexagonal pattern: Added Mongo based ticket repository and set produc…
iseppala Sep 11, 2016
9a90f2d
Changes based on code review
Sep 11, 2016
59e6a0a
Hexagonal pattern: Ignore Mongo repository test
iseppala Sep 11, 2016
f215951
Merge remote-tracking branch 'upstream/master'
Sep 11, 2016
e685512
Hexagonal pattern: Added Mongo based banking adapter and bound it in …
iseppala Sep 11, 2016
27e8cb7
Hexagonal pattern: Add separate class for Mongo connection properties
iseppala Sep 14, 2016
3cf2b34
Hexagonal pattern: Improve connection properties handling
iseppala Sep 14, 2016
c4c5e78
Hexagonal pattern: Improve error handling in console lottery
iseppala Sep 14, 2016
df32a7b
Hexagonal pattern: Introduced lottery events port with two adapters
iseppala Sep 15, 2016
914d135
Hexagonal pattern: Update test application description
iseppala Sep 15, 2016
6aa58e8
Hexagonal pattern: Remove unnecessary factories
iseppala Sep 17, 2016
b030cd4
Hexagonal pattern: Introduce lottery utils class
iseppala Sep 17, 2016
6026eed
UML generation: Mark the urm-maven-plugin execution to be ignored in …
iseppala Sep 18, 2016
dbd605e
Changes based on latest code review
Sep 19, 2016
371b262
Changes based on latest code review
Sep 19, 2016
69cab15
Merge remote-tracking branch 'upstream/master'
Sep 19, 2016
6ed842e
Caching pattern: Refactor shutdown hook to use method reference
christofferh Sep 22, 2016
865f788
Caching pattern: Refactor LRU cache to avoid NPE and unnecessary cach…
christofferh Sep 22, 2016
e3355d7
Caching pattern: Style fix for null check
christofferh Sep 22, 2016
b31edda
Caching pattern: Implementation of Cache-Aside pattern
christofferh Sep 22, 2016
c5e6dcc
Reached milestone 1.13.0
iseppala Sep 30, 2016
4ca205c
Set version number for next development iteration
iseppala Sep 30, 2016
9512f3e
Closes #436. Adds criticism to service locator pattern.
dmitraver Oct 3, 2016
12544ca
Changes based on review feedback.
Oct 3, 2016
5eacf52
Merge remote-tracking branch 'upstream/master'
Oct 3, 2016
622376e
Updated version snapshot to 1.14.0
Oct 3, 2016
8f1758c
Alter JUnit tests to run in lesser time.
Oct 3, 2016
eea8785
Fixes #437. Adds criticism to Singleton pattern.
dmitraver Oct 4, 2016
f114b5b
Caching pattern: Documentation and diagram
christofferh Oct 9, 2016
8506078
End process logic clause has been corrected.
dzmitryh Oct 15, 2016
37b930c
Unused import removed.
dzmitryh Oct 15, 2016
64bdab4
Merge pull request #495 from christofferh/feat/cache-aside
iluwatar Oct 17, 2016
986c529
Moved config into a separate dir
Oct 17, 2016
7031812
Changed config to non-interactive
Oct 17, 2016
0f7b44c
Merge pull request #483 from waisuan/master
iluwatar Oct 18, 2016
9967786
Event Based Asynchronous pattern: Add missing license header and puml…
iseppala Oct 18, 2016
b66e8ec
Adds more criticism to Singleton pattern.
dmitraver Oct 18, 2016
a37a29e
Merge pull request #500 from dmitraver/master
iluwatar Oct 18, 2016
ffdaf2e
Add Travis instructions for SonarQube.com analysis
iseppala Oct 19, 2016
19cb715
Fix environment variable
iseppala Oct 19, 2016
1c02785
Add SonarQube.com badge
bellingard Oct 23, 2016
932700d
Merge pull request #506 from dzmitryh/master
iluwatar Oct 28, 2016
9433c78
Merge pull request #510 from bellingard/patch-1
iluwatar Oct 28, 2016
124fd33
Remove use of coveralls-maven-plugin (sonarqube.com covers this)
iseppala Nov 1, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ target
.idea
*.iml
*.swp
datanucleus.log
datanucleus.log
/bin/
/bin/
/bin/

data-mapper/src/main/resources/log4j.xml
23 changes: 22 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,34 @@ env:
global:
- GH_REF: github.com/iluwatar/java-design-patterns.git
- secure: LxTDuNS/rBWIvKkaEqr79ImZAe48mCdoYCF41coxNXgNoippo4GIBArknqtv+XvdkiuRZ1yGyj6pn8GU33c/yn+krddTUkVCwTbVatbalW5jhQjDbHYym/JcxaK9ZS/3JTeGcWrBgiPqHEEDhCf26vPZsXoMSeVCEORVKTp1BSg=
- secure: "eoWlW9GyTJY04P8K3pxayXwU9/hmptQg/LfirispQkV9YvmziCfSzXnatnBhNfud98sCzY8BScXnb+OWLTnjLKpId4rtEqb0aJ40Jc32cUKzgzFAUn7cNcDAbUIfyPAGVqyQqfj/11wYSADwWMMOPlW97ExUtoyiH2WenXuRHso="

before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

# default install command is just "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V"
install:
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -e

after_success:
- mvn clean test jacoco:report coveralls:report
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=$SONAR_TOKEN
- bash update-ghpages.sh

# use latest java version available instead of travis default
addons:
apt:
packages:
- oracle-java8-installer

notifications:
email:
- iluwatar@gmail.com
webhooks:
urls:
- https://webhooks.gitter.im/e/3319623945358a093a6f
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always

sudo: false # route the build to the container-based infrastructure for a faster build
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# Design patterns implemented in Java

[![Build status](https://travis-ci.org/iluwatar/java-design-patterns.svg?branch=master)](https://travis-ci.org/iluwatar/java-design-patterns)
[![Coverage Status](https://coveralls.io/repos/iluwatar/java-design-patterns/badge.svg?branch=master)](https://coveralls.io/r/iluwatar/java-design-patterns?branch=master)
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/LICENSE.md)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Quality Gate](https://sonarqube.com/api/badges/gate?key=com.iluwatar%3Ajava-design-patterns)](https://sonarqube.com/dashboard/index/com.iluwatar%3Ajava-design-patterns)

# Introduction

Expand All @@ -23,7 +24,7 @@ are familiar with the patterns.
# Getting started

Before you dive into the material, you should be familiar with various
[Programming/Software Design Principles](http://webpro.github.io/programming-principles/).
Programming/Software Design Principles.

All designs should be as simple as possible. You should start with KISS, YAGNI,
and Do The Simplest Thing That Could Possibly Work principles. Complexity and
Expand Down
190 changes: 190 additions & 0 deletions _scripts/postPumlsToServer.firstrun.output

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions _scripts/postPumlsToServer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# The MIT License
# Copyright (c) 2014 Ilkka Seppälä
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

import requests, glob, re, os

# taken from here: http://stackoverflow.com/a/13641746
def replace(file, pattern, subst):
# Read contents from file as a single string
file_handle = open(file, 'r')
file_string = file_handle.read()
file_handle.close()

# Use RE package to allow for replacement (also allowing for (multiline) REGEX)
file_string = (re.sub(pattern, subst, file_string))

# Write contents to file.
# Using mode 'w' truncates the file.
file_handle = open(file, 'w')
file_handle.write(file_string)
file_handle.close()

# list of all puml files
fileList = glob.glob('*/etc/*.puml')
for puml in fileList:
pathSplit = puml.split("/")
# parent folder
parent = pathSplit[0]
# individual artifact/project name
artifact = pathSplit[2].replace(".urm.puml", "")
print "parent: " + parent + "; artifact: " + artifact

# do a POST to the official plantuml hosting site with a little trick "!includeurl" and raw github content
data = {
'text': "!includeurl https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/" + puml
}
r = requests.post('http://plantuml.com/plantuml/uml', data=data)
pumlId = r.url.replace("http://plantuml.com/plantuml/uml/", "")

# the only thing needed to get a png/svg/ascii from the server back
print "Puml Server ID: " + pumlId

# add the id so jekyll/liquid can use it
if (parent == artifact):
replace("./" + parent + "/README.md", "categories:", "pumlid: {}\\ncategories:".format(pumlId))
else:
print "I dont want to program this, just add the following lines to the README.md file that corresponds to this puml file '" + puml + "'\npumlid: {}".format(pumlId)

32 changes: 32 additions & 0 deletions abstract-document/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: pattern
title: Abstract Document
folder: abstract-document
permalink: /patterns/abstract-document/
pumlid: PSjB3eCm34NHhPG599vtDyQn85L-ifzX-p3lxEf8Twj3MXGDQvyJMFubChxpKN767gucSq07iinEjSNDOACVNvoAUZr6MWoe3QVE_WRnxZ0Mf38b-hkIGlurX_MyehS7
categories: Structural
tags:
- Java
- Difficulty-Intermediate
---

## Intent
Achieve flexibility of untyped languages and keep the type-safety

![alt text](./etc/abstract-document-base.png "Abstract Document Base")

![alt text](./etc/abstract-document.png "Abstract Document Traits and Domain")


## Applicability
Use the Abstract Document Pattern when

* there is a need to add new properties on the fly
* you want a flexible way to organize domain in tree like structure
* you want more loosely coupled system


## Credits

* [Wikipedia: Abstract Document Pattern](https://en.wikipedia.org/wiki/Abstract_Document_Pattern)
* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf)
Binary file added abstract-document/etc/abstract-document-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions abstract-document/etc/abstract-document-base.ucls
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram version="1.1.9" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
realizations="true" associations="true" dependencies="false" nesting-relationships="true" router="FAN">
<interface id="1" language="java" name="com.iluwatar.abstractdocument.Document" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/Document.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="249" y="405"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<class id="2" language="java" name="com.iluwatar.abstractdocument.AbstractDocument" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/AbstractDocument.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="250" y="237"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="3" language="java" name="com.iluwatar.abstractdocument.domain.Car" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/Car.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="108" y="75"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="4" language="java" name="com.iluwatar.abstractdocument.domain.Part" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/Part.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="400" y="76"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<generalization id="5">
<end type="SOURCE" refId="4"/>
<end type="TARGET" refId="2"/>
</generalization>
<realization id="6">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="1"/>
</realization>
<generalization id="7">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="2"/>
</generalization>
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</classifier-display>
<association-display labels="true" multiplicity="true"/>
</class-diagram>
Binary file added abstract-document/etc/abstract-document.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions abstract-document/etc/abstract-document.ucls
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram version="1.1.9" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
realizations="true" associations="true" dependencies="false" nesting-relationships="true" router="FAN">
<interface id="1" language="java" name="com.iluwatar.abstractdocument.Document" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/Document.java" binary="false" corner="BOTTOM_RIGHT">
<position height="-1" width="-1" x="341" y="376"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<interface id="2" language="java" name="com.iluwatar.abstractdocument.domain.HasModel" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/HasModel.java" binary="false" corner="BOTTOM_RIGHT">
<position height="81" width="173" x="41" y="194"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<interface id="3" language="java" name="com.iluwatar.abstractdocument.domain.HasPrice" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/HasPrice.java" binary="false" corner="BOTTOM_RIGHT">
<position height="81" width="175" x="254" y="194"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<interface id="4" language="java" name="com.iluwatar.abstractdocument.domain.HasParts" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/HasParts.java" binary="false" corner="BOTTOM_RIGHT">
<position height="81" width="173" x="469" y="194"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<class id="5" language="java" name="com.iluwatar.abstractdocument.domain.Car" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/Car.java" binary="false" corner="BOTTOM_RIGHT">
<position height="99" width="173" x="254" y="37"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="6" language="java" name="com.iluwatar.abstractdocument.domain.Part" project="design-patterns"
file="/design-patterns/src/com/iluwatar/abstractdocument/domain/Part.java" binary="false" corner="BOTTOM_RIGHT">
<position height="99" width="173" x="41" y="37"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<realization id="7">
<end type="SOURCE" refId="5"/>
<end type="TARGET" refId="2"/>
</realization>
<realization id="8">
<end type="SOURCE" refId="6"/>
<end type="TARGET" refId="2"/>
</realization>
<generalization id="9">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="1"/>
</generalization>
<realization id="10">
<end type="SOURCE" refId="5"/>
<end type="TARGET" refId="3"/>
</realization>
<realization id="11">
<end type="SOURCE" refId="5"/>
<end type="TARGET" refId="4"/>
</realization>
<generalization id="12">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="1"/>
</generalization>
<generalization id="13">
<end type="SOURCE" refId="4"/>
<end type="TARGET" refId="1"/>
</generalization>
<realization id="14">
<end type="SOURCE" refId="6"/>
<end type="TARGET" refId="3"/>
</realization>
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</classifier-display>
<association-display labels="true" multiplicity="true"/>
</class-diagram>
59 changes: 59 additions & 0 deletions abstract-document/etc/abstract-document.urm.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@startuml
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 {
+ Car(properties : Map<String, Object>)
}
interface HasType {
+ PROPERTY : String {static}
+ getType() : Optional<String>
}
interface HasModel {
+ PROPERTY : String {static}
+ getModel() : Optional<String>
}
}
package com.iluwatar.abstractdocument {
class App {
+ App()
+ main(args : String[]) {static}
}
abstract class AbstractDocument {
- properties : Map<String, Object>
# AbstractDocument(properties : Map<String, Object>)
+ children(key : String, constructor : Function<Map<String, Object>, T>) : Stream<T>
+ get(key : String) : Object
+ put(key : String, value : Object)
+ toString() : String
}
interface Document {
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
+ get(String) : Object {abstract}
+ put(String, Object) {abstract}
}
}
AbstractDocument --+ Map
Part ..|> HasType
Part ..|> HasModel
Part ..|> HasPrice
Part --|> AbstractDocument
AbstractDocument ..|> Document
HasPrice --|> Document
HasParts --|> Document
Car ..|> HasModel
Car ..|> HasPrice
Car ..|> HasParts
Car --|> AbstractDocument
HasType --|> Document
HasModel --|> Document
@enduml
Loading