Skip to content

Commit b6a292d

Browse files
committed
Initial commit (taking code from company-internal vcs)
0 parents  commit b6a292d

File tree

82 files changed

+4264
-0
lines changed

Some content is hidden

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

82 files changed

+4264
-0
lines changed

.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

.gitignore

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
#################
2+
## Eclipse
3+
#################
4+
5+
*.pydevproject
6+
.project
7+
.metadata
8+
bin/
9+
tmp/
10+
*.tmp
11+
*.bak
12+
*.swp
13+
*~.nib
14+
local.properties
15+
.classpath
16+
.settings/
17+
.loadpath
18+
19+
# External tool builders
20+
.externalToolBuilders/
21+
22+
# Locally stored "Eclipse launch configurations"
23+
*.launch
24+
25+
# CDT-specific
26+
.cproject
27+
28+
# PDT-specific
29+
.buildpath
30+
31+
32+
#################
33+
## Visual Studio
34+
#################
35+
36+
## Ignore Visual Studio temporary files, build results, and
37+
## files generated by popular Visual Studio add-ons.
38+
39+
# User-specific files
40+
*.suo
41+
*.user
42+
*.sln.docstates
43+
44+
# Build results
45+
46+
[Dd]ebug/
47+
[Rr]elease/
48+
x64/
49+
build/
50+
[Bb]in/
51+
[Oo]bj/
52+
53+
# MSTest test Results
54+
[Tt]est[Rr]esult*/
55+
[Bb]uild[Ll]og.*
56+
57+
*_i.c
58+
*_p.c
59+
*.ilk
60+
*.meta
61+
*.obj
62+
*.pch
63+
*.pdb
64+
*.pgc
65+
*.pgd
66+
*.rsp
67+
*.sbr
68+
*.tlb
69+
*.tli
70+
*.tlh
71+
*.tmp
72+
*.tmp_proj
73+
*.log
74+
*.vspscc
75+
*.vssscc
76+
.builds
77+
*.pidb
78+
*.log
79+
*.scc
80+
81+
# Visual C++ cache files
82+
ipch/
83+
*.aps
84+
*.ncb
85+
*.opensdf
86+
*.sdf
87+
*.cachefile
88+
89+
# Visual Studio profiler
90+
*.psess
91+
*.vsp
92+
*.vspx
93+
94+
# Guidance Automation Toolkit
95+
*.gpState
96+
97+
# ReSharper is a .NET coding add-in
98+
_ReSharper*/
99+
*.[Rr]e[Ss]harper
100+
101+
# TeamCity is a build add-in
102+
_TeamCity*
103+
104+
# DotCover is a Code Coverage Tool
105+
*.dotCover
106+
107+
# NCrunch
108+
*.ncrunch*
109+
.*crunch*.local.xml
110+
111+
# Installshield output folder
112+
[Ee]xpress/
113+
114+
# DocProject is a documentation generator add-in
115+
DocProject/buildhelp/
116+
DocProject/Help/*.HxT
117+
DocProject/Help/*.HxC
118+
DocProject/Help/*.hhc
119+
DocProject/Help/*.hhk
120+
DocProject/Help/*.hhp
121+
DocProject/Help/Html2
122+
DocProject/Help/html
123+
124+
# Click-Once directory
125+
publish/
126+
127+
# Publish Web Output
128+
*.Publish.xml
129+
*.pubxml
130+
131+
# NuGet Packages Directory
132+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133+
#packages/
134+
135+
# Windows Azure Build Output
136+
csx
137+
*.build.csdef
138+
139+
# Windows Store app package directory
140+
AppPackages/
141+
142+
# Others
143+
sql/
144+
*.Cache
145+
ClientBin/
146+
[Ss]tyle[Cc]op.*
147+
~$*
148+
*~
149+
*.dbmdl
150+
*.[Pp]ublish.xml
151+
*.pfx
152+
*.publishsettings
153+
154+
# RIA/Silverlight projects
155+
Generated_Code/
156+
157+
# Backup & report files from converting an old project file to a newer
158+
# Visual Studio version. Backup files are not needed, because we have git ;-)
159+
_UpgradeReport_Files/
160+
Backup*/
161+
UpgradeLog*.XML
162+
UpgradeLog*.htm
163+
164+
# SQL Server files
165+
App_Data/*.mdf
166+
App_Data/*.ldf
167+
168+
#############
169+
## Windows detritus
170+
#############
171+
172+
# Windows image file caches
173+
Thumbs.db
174+
ehthumbs.db
175+
176+
# Folder config file
177+
Desktop.ini
178+
179+
# Recycle Bin used on file shares
180+
$RECYCLE.BIN/
181+
182+
# Mac crap
183+
.DS_Store
184+
185+
186+
#############
187+
## Python
188+
#############
189+
190+
*.py[co]
191+
192+
# Packages
193+
*.egg
194+
*.egg-info
195+
dist/
196+
build/
197+
eggs/
198+
parts/
199+
var/
200+
sdist/
201+
develop-eggs/
202+
.installed.cfg
203+
204+
# Installer logs
205+
pip-log.txt
206+
207+
# Unit test / coverage reports
208+
.coverage
209+
.tox
210+
211+
#Translations
212+
*.mo
213+
214+
#Mr Developer
215+
.mr.developer.cfg

pom.xml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.optimaize.command4j</groupId>
8+
<artifactId>command4j</artifactId>
9+
<name>command4j</name>
10+
<version>0.2-SNAPSHOT</version>
11+
<packaging>jar</packaging>
12+
13+
<url>https://github.com/optimaize/command4j</url>
14+
<description>
15+
A general-purpose command framework for Java.
16+
</description>
17+
<organization>
18+
<name>Optimaize GmbH, Switzerland</name>
19+
<url>http://www.optimaize.com/</url>
20+
</organization>
21+
22+
<properties>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
</properties>
25+
26+
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>org.apache.maven.plugins</groupId>
31+
<artifactId>maven-compiler-plugin</artifactId>
32+
<version>2.3.2</version>
33+
<configuration>
34+
<source>1.7</source>
35+
<target>1.7</target>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
40+
41+
42+
<dependencies>
43+
<dependency>
44+
<groupId>com.google.guava</groupId>
45+
<artifactId>guava</artifactId>
46+
<version>15.0</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.slf4j</groupId>
50+
<artifactId>slf4j-api</artifactId>
51+
<version>1.6.6</version>
52+
</dependency>
53+
<dependency> <!-- Yes it's also in the parent, but soon this module will become its own project. -->
54+
<groupId>com.intellij</groupId>
55+
<artifactId>annotations</artifactId>
56+
<version>12.0</version>
57+
</dependency>
58+
<dependency> <!-- Yes it's also in the parent, but soon this module will become its own project. -->
59+
<groupId>org.testng</groupId>
60+
<artifactId>testng</artifactId>
61+
<version>6.8.7</version>
62+
<scope>test</scope>
63+
</dependency>
64+
<!-- DO NOT ADD DEPENDENCIES unless you can really justify them well.
65+
This project tries to depend on as little as possible. -->
66+
</dependencies>
67+
68+
</project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.optimaize.command4j;
2+
3+
import com.google.common.base.Optional;
4+
import com.optimaize.command4j.lang.Tuples;
5+
import org.jetbrains.annotations.NotNull;
6+
import org.jetbrains.annotations.Nullable;
7+
8+
/**
9+
* The global contract of a command. They can get an optional argument A and
10+
* return some result R. The optional argument must aggregate all arguments
11+
* needed for the service call.
12+
*
13+
* <p>More "global" arguments like context information (such as an api-key
14+
* for a remote procedure call), are defined with the {@link Mode} class for
15+
* each execution. They are then also available to all nested tasks that may
16+
* be executed on behalf of another command.</p>
17+
*
18+
* <p>The argument/result specification allows for chaining commands.
19+
* Execute command 1, take the result, feed it to command 2, return (and such).</p>
20+
*
21+
* @param <A> the optional argument's data type
22+
* @param <R> the result's data type
23+
*
24+
* @author Eike Kettner
25+
* @author Fabian Kessler
26+
*/
27+
public interface Command<A, R> {
28+
29+
/**
30+
* Runs the remote command.
31+
*
32+
* <p>This method always blocks until either the command finishes successfully, aborts by throwing an
33+
* exception, or is cancelled early. (The {@link CommandExecutorService} allows you to execute
34+
* commands in a non-blocking way.)</p>
35+
*
36+
* @param arg The {@link Optional} argument. If you need more than 1 argument then you may create a
37+
* request class as container, or maybe it's enough to just use {@link Tuples tuples}.
38+
* @param ec
39+
* @return Commands may return null, since null values are handled by the framework in that they're wrapped
40+
* into an {@link Optional}.
41+
* @throws Exception
42+
*
43+
* TODO Eike: The return value is nullable and the framework makes an Optional out of it.
44+
* Why not the same for the argument? We could make the interface more consistent.
45+
* Is there a reason against that?
46+
*/
47+
@Nullable
48+
R call(@NotNull Optional<A> arg, @NotNull ExecutionContext ec) throws Exception;
49+
50+
}

0 commit comments

Comments
 (0)