Project

General

Profile

Getting Started » History » Version 8

Henning Blohm, 01.03.2015 21:26

1 3 Henning Blohm
h1. Getting Started with org.z2env
2 1 Henning Blohm
3
See also [[FAQ]]
4
5
To understand how z2 works, you need to understand at most what are z2 modules and components and what are component repositories and how these concepts interplay. 
6
7
Check out [[wiki#Understanding-Z2|understanding-z2]] for that.
8
9
It is simplest to start by running a simple Java main program in z2 or a simple Web App. 
10
11
Follow this trail:
12
13
* [[Getting Started#Building-z2env-core|Building the core]]
14
* [[Getting Started#Running-a-Hello-World-main-program|Running a Hello World main program]]
15
* [[Getting Started#Running-a-Hello-World-Web-App|Running a Hello World Web App]]
16
* [[Getting Started#Developing-with-Eclipse-or-IntelliJ|Developing with Eclipse or IntelliJ]]
17
* [[Getting Started#Going-Multi-Module|Going Multi Module]]
18
19
20
h2. Building z2env-core
21
22
(For now, we need to build the core).
23
24 4 Henning Blohm
{{collapse
25 1 Henning Blohm
h3. Pre-requisites
26
27
* You need Git installed
28
* You need a JDK, at least version 7
29
* You need the ANT build tool
30
31
First clone http://git.z2-environment.net/z2env.core
32
33
<pre>
34
git clone http://git.z2-environment.net/z2env.core
35
</pre>
36
37
Change into *org.z2env.core.main* and run 
38
39
<pre>
40
ant -Doutput=<z2home> -Dsetup=<setup> 
41
</pre>
42
43
where <z2home> is where you want to install z2 (the *z2 home* that is) and <setup> is a choice of pre-configured content, actually component repositories.
44
45
If you omit *output* it will default to *gen/dist*. If you omit *setup*, no content will be pre-configured will be modified. 
46
47
Check the folder *setups* for available setups of the core build. These can be local (all repos will be cloned locally) or remote (repos will be remoted).
48
49
In general this build always updates only boot, z.jar, roots. It will not remove anything.
50
51
52
Example to install/update a core only into ../../z2env:
53
54
<pre>
55
ant -Doutput=../../z2env 
56
</pre>
57
58
To install/update a web-basic setup (with tomcat and eclipsoid support) with updates from remote repos:
59
60
<pre>
61
ant -Doutput=../../z2env -Dsetup=web-basic-remote
62
</pre>
63
64
Check out [[wiki#Understanding-the-ltHOMEgt|Understanding the <HOME>]] to learn more about the generated structure.
65
66 2 Henning Blohm
h4. Summary
67 1 Henning Blohm
68 2 Henning Blohm
* At any time you can update a z2 core installation by running the core build and using the *output* property to point to your installation
69
* Using the *setup* property you can choose between completely local setups (no remote access required - no automatic synchronization from remote either) or mostly remote setups (all except the core will be synchronized from remote repositories). 
70
71 4 Henning Blohm
}}
72
73 1 Henning Blohm
h2. Running a Hello World main program
74
75 5 Henning Blohm
In this section we will let z2 do what it is actually made for: Run some Java program in a modular environment without build and deploy.
76
77 4 Henning Blohm
{{collapse
78 1 Henning Blohm
For now, we will assume you have a z2 core installed in <HOME>. In its purest form, all the core can actually execute is simple Java main programs. 
79
80
Being in a modular environment, even if we only want to say „Hello World“, we need a module. Let's call it the greeter module. In order to have a main program run by z2, we need to also declare a  component for it, as that is what we tell z2 to run (not a class – mind you – but rather a component in a module). Assuming we use the local component name hello, than the absolut component name is 
81
82
<pre>
83
greeter/hello
84
</pre>
85
86
Finally, as this component actually has implementation code, we need to declare a Java component. By convention this is 
87
88
<pre>
89
greeter/java
90
</pre>
91
92
Now, after installing in <HOME> the place to simply drop a module is under <HOME>/modules. You might need to create that folder.
93
94
All in all, here is the complete structure to create:
95
96
| <HOME>/modules/greeter/hello.properties | 
97
<pre><code class="ruby">org.z2env.component.type=org.z2env.main
98
component.className=greetings.Main
99
</code></pre> |
100
| <HOME>/modules/greeter/java/z.properties | 
101
<pre><code class="ruby">org.z2env.component.type=org.z2env.java
102
</code></pre> |
103
| <HOME>/modules/greeter/java/src.impl/greetings/Main.java |
104
<pre><code class="java">
105
package greetings;
106
107
public class Main {
108
  public static void main(String[] args) {
109
    System.out.println("Hello!");
110
  }
111
}
112
</code></pre> |
113
114
That gives us the two components of module greeter. To run this on the command line, run
115
116
<pre>
117
java -DcomponentName=greeter/hello -jar z.jar
118
</pre>
119
120
Now, obviously this sample is not worth a modular execution environment. But even from here, you could check your module in with some Git repository that is referenced from the roots and all other users of the same repo would be able to run your component without installing anything.
121
122 2 Henning Blohm
h4. Summary
123
124
* Running a simple program in a modular environment requires no more than declaring the modules and add some code
125
* Apart from more technical component types, at the heart of the z2 core is to run simple Java main programs
126
127 4 Henning Blohm
}}
128 2 Henning Blohm
129 1 Henning Blohm
h2. Running a Hello World Web App
130
131 6 Henning Blohm
Rather than just running a Main program, using the Tomcat add-on we might as well run full-featured Web applications - of course: From anywhere, without build and deploy.
132
133 4 Henning Blohm
{{collapse
134
135 1 Henning Blohm
This introduction explains how to connect a z2 core to a given Tomcat installation and how to develop a simple Web Application.
136
137
Furthermore it describes how to use the Dev Repository and the Eclipsoid plugin for the Eclipse or the IntelliJ development environment.
138
139
h3. Pre-Requisites
140
141
* We assume a development workspace in *workspace*.
142
* Have a local Tomcat (7 or higher) installation.*
143
144
h3. Steps we are going to take
145
146
# Create a module with a simple Web app
147
# Make it visible to Z2
148
# Run the Web App in a Tomcat Web Container
149
150
At first get yourself a z2env core with the *web-basic-local* or *web-basic-remote* setup. Make sure it is in your *workspace*. If you follow [[wiki#Building-z2env-core|Building the core]] this means running 
151
152
<pre>
153
ant -Doutput=workspace/z2env -Dsetup=web-basic-remote
154
</pre>
155
156
(*Note:* If in doubt, use an absolute path for *workspace*)
157
158
Using your IDE create a new project *hello* in *workspace* with the following structure:
159
160
| java/z.properties | 
161
<pre><code class="ruby">
162
org.z2env.component.type=org.z2env.java
163
java.privateReferences=\
164
	javax.servlet
165
</code></pre> |
166
| web/z.properties |
167
<pre><code class="ruby">
168
org.z2env.component.type=org.z2env.tomcat.webapp
169
webapp.path=/hello
170
</code></pre> |
171
| web/WebContent/index.jsp |
172
<pre><code class="html"><html><body>Hello! Did you know that 7*7=<%=7*7%>?</body></html></code></pre> |
173
| LOCAL | <empty file> |
174
175
Your *workspace* folder now contains two subfolders *z2env* and *hello*.
176
177
So far, that's it.  We will touch on the LOCAL file later. 
178
179
When we run Z2 knowing this Web Application, it will attempt to start a Tomcat Web Container that will serve the application's content. To do that, it needs to find one. 
180
181
In order to tell Z2 where to look, you can either set an environment variable *CATALINA_HOME* (you might have already – it's the Tomcat standard) or specify an environment variable *catalina.home*. 
182
183
To be on the safe side and assuming the location is */home/me/tomcat*, we open a terminal, change into *workspace/z2env* and run
184
185
<pre>
186
java -Dcatalina.home=/home/me/tomcat -jar z.jar hello/web
187
</pre>
188
189
Note, unlike for the main program, the command line will not return. Instead you can enter „q“ to quit or „s“ to synchronize. But first let's open a browser and check out 
190
191
<pre>
192
http://localhost:8080/hello
193
</pre>
194
195
*Note:* What you just created is a prototypical z2 module structure containing a Java component *java* (holding implementation) and a Web component *web*. 
196
197
Instead of creating the structure yourself, you could use the Eclipsoid plugin (introduced below) for that:
198
* In Eclipse: New / Others / new z2...., 
199
* In IntelliJ: New / Module / z2....
200
201
... but beware of the pre-generated configuration. Where it says *com.zfabrik* change to *org.z2env*.
202
203
204
*Note:* Now on to that LOCAL file. Unlike for the Hello World main program, this time it was to so-called Dev Repo that made our module available to z2. 
205
206
The dev repo is a key component to the development approach with z2. It checks for all modules that have a LOCAL file and that are stored some levels deep, relative to the parent folder of the z2 home (by default), which not so coincidentally is our workspace.
207
208
We call modules with a LOCAL file _armed_.
209
210
*Note:* By default the dev repo looks for modules beneath the parent folder of the <home> location. Use the system property *org.z2env.dev.local.workspace* to specify other locations (separated by comma) to check for modules.
211
212
213
Try this: 
214
215
# Remove LOCAL
216
# Enter „s“ for synchronization. 
217
# Check the URL above (should say „not found“)
218
# Create a LOCAL file again
219
# Synchronize
220
# Check again.
221
222
Similarly, from now on, changes made to the hello module will be picked up, whenever you synchronize.
223
224 2 Henning Blohm
h4. Summary
225
226
* Addons extend z2 with capabilities, such as a Tomcat hosted Web application (albeit running in z2's module environment)
227
* The _dev repository_ allows to flexibly define local modules. Modules can put into or out visibility by a simple LOCAL marker file.
228
229 4 Henning Blohm
}}
230
231 1 Henning Blohm
h2. Developing with Eclipse or IntelliJ
232
233
In this section we will add some code to the hello Web app and see how to develop using an integrated development environment like the Eclipse IDE or Jetbrains' IntelliJ IDEA.
234
235 4 Henning Blohm
{{collapse
236
237 1 Henning Blohm
h3. Pre-Requisite
238
239
* Have an Eclipse or IntelliJ installation
240
* Install the Eclipsoid plugin from http://z2-environment.net/eclipsoid/update/site.xml or by searching for "z2" in the IntelliJ Plugin Repository respectively
241
242
h3. Steps we are going to take
243
244
# Complete the development workspace setup
245
# Add a simple Controller
246
247
h4. In Eclipse
248
249
Use the workspace *workspace*. Create a Java project *hello* where we created the *hello* module. That is, we use the existing module as project content. You should now have an Eclipse development workspace that has one Java project named "hello". Right-click on the project and choose "Transform into z2 Project". A small "Z" icon should not decorate the project icon. 
250
251
Add a source folder *java/src.impl* to the project.
252
253
Try "Arm Z2 Projects" and "Disarm Z2 Projects" from the context menu. You should see a LOCAL file showing up and disappearing as well as the "Z" decoration showing a green halo and going back to normal. 
254
255
Go into Window/Preferences, pick "z2-Environment". Change the port to 8081, set the user to "z*" and the password to "z". Done.
256
257
h4. In IntelliJ
258
259
Add a source folder *java/src.impl* to the module.
260
261
Start a new Project with root folder *workspace*. Press the "Manage z2-Modules" button in the toolbar. Import the *hello* module into your IntelliJ project. Open the Settings dialog, pick "z2-Environment". Change the port to 8081, set the user to "z*" and the password to "z". Done.
262
263
h4. Independently of whether you use IntelliJ or Eclipse
264
265
Start z2 as in the previous section but make sure the development support is enabled. Use this command line:
266
267
<pre>
268
java -Dcatalina.home=/home/me/tomcat -jar z.jar org.z2env.dev.shared/ready hello/web
269
</pre>
270
271
(possibly you want to turn this into a shell script)
272
273
*Note:* The _system state_ *org.z2env.dev.shared/ready* will pull up all necessary development support components. Make sure this is part of your to-be-run list.
274
275
276
Regardless whether you are using Eclipse or IntelliJ, press the "Resolve Classpath from Z2" button in the toolbar. This will make sure that all required dependencies for Z2 modules, as far as Java code is concerned, will be resolved for your workspace. 
277
278
Now add a class *SimpleController* and change the following files:
279
280
| java/src.impl/hello/SimpleController.java | 
281
<pre><code class="java">
282
package hello;
283
284
import javax.servlet.*;
285
import javax.servlet.http.*;
286
import java.io.IOException;
287
288
public class SimpleController extends HttpServlet {
289
290
    @Override
291
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
292
        String input = req.getParameter("input");
293
        if (input!=null && input.trim().length()>0) {
294
            req.setAttribute("output","You said: "+input);
295
        }
296
        req.getRequestDispatcher("/").forward(req,resp);
297
    }
298
}
299
</code></pre> |
300
| java/z.properties | 
301
<pre><code class="ruby">
302
org.z2env.component.type = org.z2env.java
303
304
java.privateReferences=\
305
  javax.servlet,\
306
  javax.servlet.jsp.jstl
307
</code></pre> |
308
| web/WebContent/WEB-INF/web.xml | 
309
<pre><code class="xml">
310
<?xml version="1.0" encoding="UTF-8"?>
311
<web-app id="hello" version="2.5"
312
		xmlns="http://java.sun.com/xml/ns/javaee"
313
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
314
		xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
315
316
    <servlet>
317
        <servlet-name>controller</servlet-name>
318
        <servlet-class>hello.SimpleController</servlet-class>
319
    </servlet>
320
    
321
    <servlet-mapping>
322
        <servlet-name>controller</servlet-name>
323
        <url-pattern>/do</url-pattern>
324
    </servlet-mapping>    
325
</web-app>
326
</code></pre> |
327
| web/WebContent/index.jsp |
328
<pre><code class="html">
329
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %>
330
<html>
331
<body>
332
  <c:if test="${not empty output}">
333
    <p><c:out value="${output}"/></p>
334
  </c:if>
335
  <form method="POST" action="<c:url value='/do'/>">
336
    Input: <input type="text" name="input"><input type="submit" value="go!">
337
  </form>
338
</body>
339
</html>
340
</code></pre>|
341
342
Make sure the *hello* module is armed (right-click) by having a LOCAL file.
343
344
Now synchronize your running z2 by either:
345
346
* Pressing the "Sync with z2-Environment" button in the toolbar
347
* Pressing ALT+y in your IDE
348
* Entering "s" on the command line running z2.
349
350
Go to http://localhost:8080/hello and check it out.
351
352 2 Henning Blohm
h4. Summary
353 1 Henning Blohm
354 2 Henning Blohm
* Using IDE plugins for Eclipse or IntelliJ you can conveniently develop for Z2.
355
* Regardless of the component types in use, all class path considerations will be resolved from Z2 and you will never need to change IDE configuration.
356
* Using the interplay of IDE plugin and the dev repository (see also [[FAQ#Development]]) synchronization from the IDE and overlay of modules with local development versions is simple and fast. 
357
358 4 Henning Blohm
}}
359
360 1 Henning Blohm
h2. Going Multi-Module
361
362
In this section we will extend the previous work by a simple service module. 
363
364 4 Henning Blohm
{{collapse
365 1 Henning Blohm
h3. Pre-Requisites
366
367
# Have all the results from the previous section ready.
368
# Start IDE and z2 as above.
369
370
371
h3. Steps we are going to take
372
373
# add a new module with a service API
374
# reference the module API from the *hello* module and invoke the service.
375
376
377
In your workspace, use Eclipsoid to create a new z2 Java module *goodbye*. Open *java/z.properties* and change all *com.zfabrik.* prefixes to *org.z2env*. Essentially the file only needs the line
378
379
<pre><code class="ruby">
380
org.z2env.component.type=org.z2env.java
381
</code></pre>
382
383
In our API we will only expose an interface and rather leave the implementation hidden in the implementation parts of the module. We do that, as we prefer a strong separation of API and implementation. This is not at all required but a conscious design choice. 
384
385
386
| java/src.api/goodbye/GoodbyeService.java | 
387
<pre><code class="java">
388
package goodbye;
389
390
public interface GoodbyeService {
391
392
	String sayGoodbye(String in);
393
	
394
}
395
396
</code></pre> |
397
| java/src.impl/goodbye/GoodbyeServiceImpl.java | 
398
<pre><code class="java">
399
package goodbye;
400
401
public class GoodbyeServiceImpl implements GoodbyeService {
402
403
	@Override
404
	public String sayGoodbye(String in) {
405
		return "Goodbye "+in+"!";
406
	}
407
408
}
409
</code></pre> |
410
| java/service.properties | 
411
<pre><code class="ruby">
412
org.z2env.component.type=org.z2env.any
413
component.className=goodbye.GoodbyeServiceImpl
414
</code></pre> |
415
| java/z.properties | 
416
<pre><code class="ruby">
417
org.z2env.component.type=org.z2env.java
418
</code></pre> |
419
420
In effect we created the following:
421
422
* A module *goodbye* that has 
423
* A Java component with API and Implementation source code
424
* An _any_ component *goodbye/service* that manages the service implementation (as we will see below)
425
426
Back in the *hello* module, we want to use the _goodbye service_. We apply the following changes:
427
428
| java/z.properties | 
429
<pre><code class="ruby">
430
org.z2env.component.type=org.z2env.java
431
432
java.privateReferences=\
433
    javax.servlet,\
434
    javax.servlet.jsp.jstl,\
435
    goodbye
436
</code></pre> |
437
| java/src.impl/hello/SimpleController.java | 
438
<pre><code class="java">
439
package hello;
440
441
import goodbye.GoodbyeService;
442
443
import java.io.IOException;
444
445
import javax.servlet.ServletException;
446
import javax.servlet.http.HttpServlet;
447
import javax.servlet.http.HttpServletRequest;
448
import javax.servlet.http.HttpServletResponse;
449
450
import org.z2env.components.IComponentsLookup;
451
452
public class SimpleController extends HttpServlet {
453
454
    @Override
455
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
456
    	GoodbyeService gb = IComponentsLookup.CL.lookup("goodbye/service", GoodbyeService.class);
457
        String input = req.getParameter("input");
458
        if (input!=null && input.trim().length()>0) {
459
            req.setAttribute(
460
        		"output",
461
        		gb.sayGoodbye(input)
462
        	);
463
        }
464
        req.getRequestDispatcher("/").forward(req,resp);
465
    }
466
}
467
</code></pre> |
468
469
After you have changed the Java references in *java/z.properties* you might want to press Alt-R or the "Resolve Classpath from Z2" button in the toolbar to have the IDE resolve the dependency for the *goodbye* module and so that
470
your IDE will not complain about using the *GoodbyeService* interface.
471
472
Now synchronize your running z2 by either:
473
474
* Pressing the "Sync with z2-Environment" button in the toolbar
475
* Pressing ALT+y in your IDE
476
* Entering "s" on the command line running z2.
477
478
Go to http://localhost:8080/hello and check it out.
479
480
h3. Discussion
481
482
What you just implemented is a programmatic component lookup. The first time <code>IComponentsLookup.CL.lookup("goodbye/service", GoodbyeService.class)</code> was invoked, z2 searched for a factory for *org.z2env.any* components. This specific factory simply created a singleton instance of the Goodbye Service and checked whether the requested interface is implemented. As that held, it returned the actual instance.
483
484
In later sections (for now check out [[z2-environment:How_to_Spring]]) we will explain how to that extends to the Spring Framework and Dependency Injection in general.
485
486 2 Henning Blohm
h4. Summary
487
488
* Being a modular runtime environment, Z2 offers an effective yet simple Java modularization approach
489
* The module concept of Z2 goes beyond code considerations and includes arbitrary component types such as Web applications
490
491 1 Henning Blohm
Feel free to apply changes to the Goodbye Service implementation class and have them made effective by synchronizing Z2.
492
493 4 Henning Blohm
}}
494
495 8 Henning Blohm
hr.
496
497 1 Henning Blohm
h2. Going System-Centric
498 2 Henning Blohm
499
In this section we show how to turn your z2 installation into a mere execution node of a system (which is what it really should be). That is, in team development situations for systems of non-trivial size of distribution requirements, it is crucial to be integrated with a common source code level. 
500 1 Henning Blohm
501 4 Henning Blohm
{{collapse
502
503 2 Henning Blohm
Using remote repositories in combination with the dev repository, z2 offers just that: Integration for all but those pieces you do actually need isolation from changes.
504
505
Using z2's synchronization approach rolling out changes to remote installation and scale-outs become a non-issue.
506 8 Henning Blohm
507
h3. Pre-Requisites
508
509
# Have the multi-module setup from the previous section at hand
510
# Start IDE and z2 as above.
511
512 2 Henning Blohm
513
h3. Steps we are going to take
514
515
# check our modules in with some new Git repository
516
# add a Git-based component repository component 
517
# develop with partial overlays
518
519
520 1 Henning Blohm
521 4 Henning Blohm
}}
522 1 Henning Blohm
523
524
h2. Understanding the <HOME>
525
526 4 Henning Blohm
We call an installation of a z2env core a *<home>*. The file structure of the *<home>* consists of few but important locations.
527 1 Henning Blohm
528 4 Henning Blohm
{{collapse
529 1 Henning Blohm
h3. Layout
530
531
| z.jar | The actual core implementation. This is precompiled.|
532
| boot/ | A component repository adding to the core and provides the most basic capabilities such as compiling Java code and running a main program. |
533
| roots/ | A file system component repository that is always registered by the core. This is typically filled with other repository components linking to remote or local component repositories. |
534
| modules/ | A file system repository declared under roots/ that is useful to locally augment a core installation.|
535
536
We use the modules repository for example for command line experiments and simple hacks. It is not as useful for regular development operations as is the dev repo.
537
538 4 Henning Blohm
539
540
541 1 Henning Blohm
h3. Folders and Properties
542
543
When running z2 from the command line, some logic is applied to derive where stuff is and some defaults apply:
544
545
|_. What |_. System property |_. Defaults |
546
| Z2 home - the installation location | org.z2env.home | If no system property is set, the environment variable Z2_HOME will be checked. If that is not set, the z2 home location will be derived from the location of the z.jar file |
547
| Dev Repo workspaces - where the Dev Repo checks for local modules | org.z2env.dev.local.workspaces | Defaults to ${z2.home}/.. assuming modules will be next to the home or one level deeper |
548
549 4 Henning Blohm
See also [[Core Layout]]
550 1 Henning Blohm
551 4 Henning Blohm
}}
552
553 1 Henning Blohm
h2. Understanding Z2
554
555
Most of the concepts that make up z2 can be derived from the desire to efficiently develop standard Java Web Applications that are defined in a central system definition. Add to that the wish to avoid all that build complexity and the desire for a practically usable modularization approach.
556
557 4 Henning Blohm
{{collapse
558 1 Henning Blohm
Once you loose the ability to tweak some build script or configuration to describe how to package a Web app or some libraries, you need some structural hint and simple declarations providing sufficient information.
559
560
Secondy, assuming you want to apply changes at runtime, you need some way of determining what to unload at runtime, given some changed file. Again: Structural information needs to present that maps to runtime state. 
561
562
Finally, as we want some support for modular application development anyway, why not make modules our essential structure. As we have not only code but also Web Applications, Data Sources,  Background Jobs and much more to consider, we add components with type into the mix. Voila.
563
564
*Component Repositories* provides modules and components to z2. A component is prefixed by the module name:
565
566
<pre>
567
<global component name> = <module name>/<local component name>
568
</pre>
569
570
In fact, the typical component repository has a file system style structure that is made up exactly like that. 
571
572
Structure from repo root:
573
574
| /<module>/<cmp>.properties | A component <cmp> in module <module> that has no resources on its own.|
575
| /<module>/<cmp>/z.properties | A component <cmp> in module <module> that may have additional resources on its own.|
576
577
Note that some components, like Web applications and typically Java components have file resources, such as HTML files or Java source code files, while other components, such as main program declarations or data source declarations, so not.
578
579
There are some conventions around this naming scheme. In particular, by convention, whenever a component requires Java implementation, z2 will first look for a component named *java* of the same module. As for example in the Hello World example.
580
581
To give you an idea what this model translates to at runtime consider this: At runtime, the static component is turned into a Resource instance by a component type implementation (that, in fact, is provided by another, built-in component type). 
582
583
!uml1.png!
584
585
Dependencies, for example those between Java components, translate into dependencies between resources that are observed during invalidation of resources. This introduces invalidation and synchronization.
586
587
h3. A crucial concept of z2 is that of a synchronization. 
588
589
For fast development roundtrips and in some cases for general configuration updates, it is desirable to not require a complete restart of a Java Virtual Machine process but rather just to change runtime state accordingly. 
590
591
In z2 a synchronization describes the following process:
592
593
# Check for changes in component repositories
594
# Based on changes found, identify components affected and invalidate associated runtime resources incl. dependent resources.
595
# Try to attain target states
596
597
That is, whenever you do a change and trigger a synchronization from your IDE, this is exactly what happens: Identify what needs to be thrown away, make sure to remove dependent stuff as well,  bring up what needs to be running.
598
599
h3. A second crucial concept of z2 is that of *System Centric Development*
600
601
When working on a software system with many access points and high re-use on a service level, as is typical for business systems, staying quick integration with a team's changes is key. Component repositories can be fed from remotely accessible version control systems such as Subversion and Git. When connecting to a central, team-shared repository, every synchronization will make sure that you are up-to-date with the real source of truth. 
602
603
Using the dev repo, you can still isolate yourself from changes on part of the system that you are actively working on. After your modifications are completed, rebased, and locally tested, getting a clean and consistent state is just one synchronization away.
604
605
h3. The third and final concept is that of a compile-free environment
606
607
It is within the nature of the synchronization concept, that anything required to happen to have your software available for execution must have happened after synchronization completed. Most preparation steps are executed at first use. This includes the compilation of Java code. Z2 uses the Eclipse Java Compiler for that purpose.
608
609
h2. The Component Model
610
611
See [[z2-environment:Z2_Modules_intro]]
612
613
h2. Java Components
614
615
See [[z2-environment:Z2_Java_components_intro]]
616 4 Henning Blohm
617
}}