Skip to content

Commit 4805efa

Browse files
GuanHua.WangGuanHua.Wang
authored andcommitted
Merge remote-tracking branch 'iluwatar/master'
2 parents e01c852 + cca4760 commit 4805efa

File tree

1,705 files changed

+86308
-8664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,705 files changed

+86308
-8664
lines changed

.gitignore

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
target
2-
.metadata
3-
.settings
4-
.classpath
5-
.project
6-
*.class
7-
# Package Files #
8-
*.jar
9-
*.war
10-
*.ear
1+
target
2+
.metadata
3+
.settings
4+
.classpath
5+
.project
6+
*.class
7+
# Package Files #
8+
*.jar
9+
*.war
10+
*.ear
11+
.idea
12+
*.iml
13+
*.swp
14+
datanucleus.log
15+
/bin/
16+
/bin/
17+
/bin/
18+
*.log
19+
data-mapper/src/main/resources/log4j.xml

.travis.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
1-
language: java
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
5+
env:
6+
global:
7+
- GH_REF: github.com/iluwatar/java-design-patterns.git
8+
- secure: LxTDuNS/rBWIvKkaEqr79ImZAe48mCdoYCF41coxNXgNoippo4GIBArknqtv+XvdkiuRZ1yGyj6pn8GU33c/yn+krddTUkVCwTbVatbalW5jhQjDbHYym/JcxaK9ZS/3JTeGcWrBgiPqHEEDhCf26vPZsXoMSeVCEORVKTp1BSg=
9+
- secure: "eoWlW9GyTJY04P8K3pxayXwU9/hmptQg/LfirispQkV9YvmziCfSzXnatnBhNfud98sCzY8BScXnb+OWLTnjLKpId4rtEqb0aJ40Jc32cUKzgzFAUn7cNcDAbUIfyPAGVqyQqfj/11wYSADwWMMOPlW97ExUtoyiH2WenXuRHso="
10+
11+
before_install:
12+
- export DISPLAY=:99.0
13+
- sh -e /etc/init.d/xvfb start
14+
15+
# default install command is just "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V"
16+
install:
17+
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V -e
18+
19+
after_success:
20+
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=$SONAR_TOKEN
21+
- bash update-ghpages.sh
22+
23+
# use latest java version available instead of travis default
24+
addons:
25+
apt:
26+
packages:
27+
- oracle-java8-installer
28+
29+
notifications:
30+
email:
31+
- iluwatar@gmail.com
32+
webhooks:
33+
urls:
34+
- https://webhooks.gitter.im/e/3319623945358a093a6f
35+
on_success: change # options: [always|never|change] default: always
36+
on_failure: always # options: [always|never|change] default: always
37+
on_start: never # options: [always|never|change] default: always
38+
39+
sudo: false # route the build to the container-based infrastructure for a faster build

CODE_COVERAGE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Code Coverage Report generation
2+
3+
To generate the code coverage report, execute the following command:
4+
> mvn clean verify
5+
6+
This will generate code coverage report in each of the modules. In order to view the same, open the following file in your browser.
7+
> target/site/jacoco/index.html
8+
9+
Please note that the above folder is created under each of the modules. For example:
10+
* adapter/target/site/jacoco/index.html
11+
* busniess-delegate/target/site/jacoco/index.html
12+
13+

CONTRIBUTING.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This is great you have something to contribute!
2+
3+
Before going any further please read the [wiki](https://github.com/iluwatar/java-design-patterns/wiki)
4+
with conventions and rules we used for this project.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Ilkka Seppälä
3+
Copyright (c) 2014-2016 Ilkka Seppälä
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 29 additions & 371 deletions
Large diffs are not rendered by default.

_scripts/postPumlsToServer.firstrun.output

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.

_scripts/postPumlsToServer.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#
2+
# The MIT License
3+
# Copyright (c) 2014-2016 Ilkka Seppälä
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
#
23+
24+
import requests, glob, re, os
25+
26+
# taken from here: http://stackoverflow.com/a/13641746
27+
def replace(file, pattern, subst):
28+
# Read contents from file as a single string
29+
file_handle = open(file, 'r')
30+
file_string = file_handle.read()
31+
file_handle.close()
32+
33+
# Use RE package to allow for replacement (also allowing for (multiline) REGEX)
34+
file_string = (re.sub(pattern, subst, file_string))
35+
36+
# Write contents to file.
37+
# Using mode 'w' truncates the file.
38+
file_handle = open(file, 'w')
39+
file_handle.write(file_string)
40+
file_handle.close()
41+
42+
# list of all puml files
43+
fileList = glob.glob('*/etc/*.puml')
44+
for puml in fileList:
45+
pathSplit = puml.split("/")
46+
# parent folder
47+
parent = pathSplit[0]
48+
# individual artifact/project name
49+
artifact = pathSplit[2].replace(".urm.puml", "")
50+
print "parent: " + parent + "; artifact: " + artifact
51+
52+
# do a POST to the official plantuml hosting site with a little trick "!includeurl" and raw github content
53+
data = {
54+
'text': "!includeurl https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/" + puml
55+
}
56+
r = requests.post('http://plantuml.com/plantuml/uml', data=data)
57+
pumlId = r.url.replace("http://plantuml.com/plantuml/uml/", "")
58+
59+
# the only thing needed to get a png/svg/ascii from the server back
60+
print "Puml Server ID: " + pumlId
61+
62+
# add the id so jekyll/liquid can use it
63+
if (parent == artifact):
64+
replace("./" + parent + "/README.md", "categories:", "pumlid: {}\\ncategories:".format(pumlId))
65+
else:
66+
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)
67+

abstract-document/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
layout: pattern
3+
title: Abstract Document
4+
folder: abstract-document
5+
permalink: /patterns/abstract-document/
6+
pumlid: PSjB3eCm34NHhPG599vtDyQn85L-ifzX-p3lxEf8Twj3MXGDQvyJMFubChxpKN767gucSq07iinEjSNDOACVNvoAUZr6MWoe3QVE_WRnxZ0Mf38b-hkIGlurX_MyehS7
7+
categories: Structural
8+
tags:
9+
- Java
10+
- Difficulty-Intermediate
11+
---
12+
13+
## Intent
14+
Achieve flexibility of untyped languages and keep the type-safety
15+
16+
![alt text](./etc/abstract-document-base.png "Abstract Document Base")
17+
18+
![alt text](./etc/abstract-document.png "Abstract Document Traits and Domain")
19+
20+
21+
## Applicability
22+
Use the Abstract Document Pattern when
23+
24+
* there is a need to add new properties on the fly
25+
* you want a flexible way to organize domain in tree like structure
26+
* you want more loosely coupled system
27+
28+
29+
## Credits
30+
31+
* [Wikipedia: Abstract Document Pattern](https://en.wikipedia.org/wiki/Abstract_Document_Pattern)
32+
* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf)
14.6 KB
Loading

0 commit comments

Comments
 (0)