Skip to content

Commit 35a44de

Browse files
committed
even more doc updates, get ready for 0.5.0 release
1 parent 09e7b2a commit 35a44de

54 files changed

Lines changed: 2470 additions & 1852 deletions

File tree

Some content is hidden

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

README.md

Lines changed: 72 additions & 1460 deletions
Large diffs are not rendered by default.

gh-pages.ant

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<exec executable="git" dir="${workdir}">
1717
<arg value="clone" />
1818
<arg value="-b" />
19-
<arg value="gh-pages" />
19+
<arg value="site" />
2020
<arg value="--single-branch" />
2121
<arg value="${gitrepo}" />
2222
<arg value="." />
@@ -32,7 +32,7 @@
3232
<fileset dir="target/site/apidocs" />
3333
</copy>
3434

35-
<!-- -->
35+
<!--
3636
<exec executable="git" dir="${workdir}">
3737
<arg value="add" />
3838
<arg value="-A" />
@@ -41,14 +41,14 @@
4141
<exec executable="git" dir="${workdir}">
4242
<arg value="commit" />
4343
<arg value="-m" />
44-
<arg value="Sync docs from master branch to docs gh-pages directory" />
44+
<arg value="prepare web site" />
4545
</exec>
4646
4747
<exec executable="git" dir="${workdir}">
4848
<arg value="push" />
4949
<arg value="origin" />
50-
<arg value="gh-pages" />
51-
</exec>
50+
<arg value="site" />
51+
</exec>-->
5252

5353
</target>
5454

jooby-camel/README.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# jooby-camel
2+
3+
[Apache Camel](http://camel.apache.org) integration for Jooby.
4+
5+
Exposes a [CamelContext], [ProducerTemplate] and [ConsumerTemplate].
6+
7+
NOTE: This module was designed to provide a better integration with Jooby. This module doesn't
8+
depend on [camel-guice](http://camel.apache.org/guice.html), but it provides similar features.
9+
10+
## dependency
11+
12+
```xml
13+
<dependency>
14+
<groupId>org.jooby</groupId>
15+
<artifactId>jooby-camel</artifactId>
16+
<version>0.4.2.1</version>
17+
</dependency>
18+
```
19+
20+
## usage
21+
22+
```java
23+
{
24+
use(new Camel()
25+
.routes((rb, config) -> {
26+
rb.from("direct:noop").to("mock:out");
27+
})
28+
);
29+
30+
get("/noop", req -> {
31+
req.require(ProducerTemplate.class).sendBody("direct:noop", "NOOP");
32+
return "/noop";
33+
});
34+
35+
}
36+
```
37+
38+
Previous example, add a direct route using the Java DSL. A route builder can be created and
39+
injected by Guice, see next section.
40+
41+
## camel routes
42+
43+
```java
44+
public class MyRoutes extends RouteBuilder {
45+
46+
@Inject
47+
public MyRoutes(Service service) {
48+
this.service = service;
49+
}
50+
51+
public void configure() {
52+
from("direct:noop").to("mock:out").bean(service);
53+
}
54+
}
55+
56+
...
57+
{
58+
use(new Camel().routes(MyRoutes.class));
59+
}
60+
```
61+
62+
or without extending RouteBuilder:
63+
64+
```java
65+
public class MyRoutes {
66+
67+
@Inject
68+
public MyRoutes(RouteBuilder router, Service service) {
69+
router.from("direct:noop").to("mock:out").bean(service);
70+
}
71+
72+
}
73+
74+
...
75+
{
76+
use(new Camel().routes(MyRoutes.class));
77+
}
78+
```
79+
80+
## configuration
81+
82+
Custom configuration is achieved in two ways:
83+
84+
### application.conf
85+
86+
A [CamelContext] can be configured from your ```application.conf```:
87+
88+
```properties
89+
camel.handleFault = false
90+
camel.shutdownRoute = Default
91+
camel.shutdownRunningTask = CompleteCurrentTaskOnly
92+
camel.streamCaching.enabled = false
93+
camel.tracing = false
94+
camel.autoStartup = true
95+
camel.allowUseOriginalMessage = false
96+
camel.jmx = false
97+
```
98+
99+
Same for [ShutdownStrategy]:
100+
101+
```properties
102+
camel.shutdown.shutdownRoutesInReverseOrder = true
103+
camel.shutdown.timeUnit = SECONDS
104+
camel.shutdown.timeout = 10
105+
```
106+
107+
[ThreadPoolProfile]:
108+
109+
```properties
110+
camel.threads.poolSize = ${runtime.processors-plus1}
111+
camel.threads.maxPoolSize = ${runtime.processors-x2}
112+
camel.threads.keepAliveTime = 60
113+
camel.threads.timeUnit = SECONDS
114+
camel.threads.rejectedPolicy = CallerRuns
115+
camel.threads.maxQueueSize = 1000
116+
camel.threads.id = default
117+
camel.threads.defaultProfile = true
118+
```
119+
120+
and [StreamCachingStrategy]:
121+
122+
```properties
123+
camel.streamCaching.enabled = false
124+
camel.streamCaching.spoolDirectory = ${application.tmpdir}${file.separator}"camel"${file.separator}"#uuid#"
125+
```
126+
127+
### programmatically
128+
129+
Using the ```doWith(Configurer)``` method:
130+
131+
```java
132+
{
133+
use(new Camel().doWith((ctx, config) -> {
134+
// set/override any other property.
135+
}));
136+
}
137+
```
138+
139+
That's all folks! Enjoy it!!!
140+
141+
## appendix: camel.conf
142+
```properties
143+
# Camel defaults
144+
camel.handleFault = false
145+
146+
camel.shutdownRoute = Default
147+
148+
camel.shutdownRunningTask = CompleteCurrentTaskOnly
149+
150+
camel.tracing = false
151+
152+
camel.autoStartup = true
153+
154+
camel.allowUseOriginalMessage = false
155+
156+
camel.jmx = false
157+
158+
# shutdown
159+
camel.shutdown.shutdownRoutesInReverseOrder = true
160+
camel.shutdown.timeUnit = SECONDS
161+
camel.shutdown.timeout = 10
162+
163+
# thread pool
164+
camel.threads.poolSize = ${runtime.processors-plus1}
165+
camel.threads.maxPoolSize = ${runtime.processors-x2}
166+
camel.threads.keepAliveTime = 60
167+
camel.threads.timeUnit = SECONDS
168+
camel.threads.rejectedPolicy = CallerRuns
169+
camel.threads.maxQueueSize = 1000
170+
camel.threads.id = default
171+
camel.threads.defaultProfile = true
172+
173+
# stream caching
174+
camel.streamCaching.enabled = false
175+
camel.streamCaching.spoolDirectory = ${application.tmpdir}${file.separator}"camel"${file.separator}"#uuid#"
176+
177+
```
178+

jooby-ftl/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# jooby-ftl
2+
3+
[Freemarker](http://freemarker.org) templates for [Jooby](/). Exposes a Configuration and [body formatter](/apidocs/org/jooby/BodyFormatter.html).
4+
5+
## dependency
6+
7+
```xml
8+
<dependency>
9+
<groupId>org.jooby</groupId>
10+
<artifactId>jooby-ftl</artifactId>
11+
<version>0.4.2.1</version>
12+
</dependency>
13+
```
14+
15+
## usage
16+
It is pretty straightforward:
17+
18+
```java
19+
{
20+
use(new Ftl());
21+
22+
get("/", req {@literal ->} View.of("index", "model", new MyModel());
23+
}
24+
```
25+
26+
public/index.html:
27+
28+
```java
29+
${model}
30+
```
31+
32+
Templates are loaded from root of classpath: ```/``` and must end with: ```.html```
33+
file extension.
34+
35+
## req locals
36+
37+
A template engine has access to ```request locals```. Here is an example:
38+
39+
```java
40+
{
41+
use(new Ftl());
42+
43+
get("*", req -> {
44+
req.set("req", req);
45+
req.set("session", req.session());
46+
});
47+
}
48+
```
49+
50+
By default, there is no access to ```req``` or ```session``` from your template. This example shows how to do it.
51+
52+
53+
## configuration
54+
There are two ways of changing a Freemarker configuration:
55+
56+
### application.conf
57+
Just add a ```freemarker.*``` option to your ```application.conf``` file:
58+
59+
```properties
60+
freemarker.default_encoding = UTF-8
61+
```
62+
63+
### programmatically
64+
65+
```java
66+
{
67+
use(new Ftl().doWith((freemarker, config) -> {
68+
freemarker.setDefaultEncoding("UTF-8");
69+
});
70+
}
71+
```
72+
73+
Keep in mind this is just an example and you don't need to set the default encoding. Default
74+
encoding is set to: ```application.charset``` which is ```UTF-8``` by default.
75+
76+
## template loader
77+
Templates are loaded from the root of classpath and must end with ```.html```. You can
78+
change the default template location and extensions too:
79+
80+
```java
81+
{
82+
use(new Ftl("/", ".ftl"));
83+
}
84+
```
85+
86+
## cache
87+
88+
Cache is OFF when ```env=dev``` (useful for template reloading), otherwise is ON.
89+
90+
Cache is backed by [Guava](https://github.com/google/guava) and default cache will expire after ```100``` entries.
91+
92+
If ```100``` entries is not enough or you need a more advanced cache setting, just set the
93+
```freemarker.cache``` option:
94+
95+
```properties
96+
freemarker.cache = "expireAfterWrite=1h"
97+
```
98+
99+
See [CacheBuilderSpec](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/cache/CacheBuilderSpec.html) for more detailed expressions.
100+
101+
That's all folks! Enjoy it!!!
102+
103+
## appendix: freemarker.conf
104+
```properties
105+
#freemarker defaults
106+
107+
freemarker.locale = ${application.lang}
108+
109+
freemarker.number_format = ${application.numberFormat}
110+
111+
freemarker.date_format = ${application.dateFormat}
112+
113+
freemarker.time_zone = ${application.tz}
114+
115+
freemarker.object_wrapper = default
116+
117+
freemarker.template_exception_handler = default
118+
119+
freemarker.defaultEncoding = ${application.charset}
120+
121+
# cache for env != dev
122+
freemarker.cache = "maximumSize=100"
123+
124+
```
125+
126+

jooby-hbm/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,22 @@
66
<dependency>
77
<groupId>org.jooby</groupId>
88
<artifactId>jooby-hbm</artifactId>
9-
<version>0.4.2</version>
9+
<version>0.4.2.1</version>
1010
</dependency>
1111
```
1212
## usage
1313

1414

15+
## appendix: hbm.conf
16+
```properties
17+
hibernate {
18+
id.new_generator_mappings = true
19+
archive.autodetection = class
20+
hbm2ddl.auto = update
21+
}
22+
23+
javax.persistence {
24+
}
25+
26+
```
27+

0 commit comments

Comments
 (0)