Project

General

Profile

Any - org-z2env-any » History » Version 2

Henning Blohm, 20.06.2015 20:32

1 2 Henning Blohm
h1. "Any" Components (type *org.z2env.any*)
2
3
_Any_ components are not bound to any specific interface type but may implement essentially any interface type. At times, it can be very handy to simply have some interface implementation readily available for lookup as z2 component or via [[JNDI|JNDI Support]].
4
5
An implementation of of an any component only needs to specify the type and then implementation class, for example like this:
6
7
<pre><code class="bash">
8
org.z2env.component.type=org.z2env.any
9
component.className=mypackage.MyClass
10
</code></pre>
11
12
Standard component properties such as state dependencies may be specified.
13
14
An implementation of the component type *org.z2env.any* has essentially two choices. 
15
16
One possibility is to extends the base Resource class (JAVADOC). In that case, all resolution of typed lookups will be delegated to the as(...) (JAVADOC) method. Likewise the invalidate(...) (JAVADOC) method will be invoked when the component is invalidated.
17
18
Alternatively and in simple cases more conveniently, an implementation may choose to be of some other type hierarchy. In that case, z2 will test of the implementation instance implements a given interface that was specific via the lookup. If so, the instance will be returned. Otherwise @null@ will be returned.
19
20
h2. Properties
21
22
|_. name |_. values |
23
| org.z2env.component.type | org.z2env.any |
24
| component.className | Name of the class that implements the any components |