Project

General

Profile

Wiki » History » Version 34

Henning Blohm, 28.01.2015 17:04

1 1 Henning Blohm
h1. Intro
2
3 2 Henning Blohm
This project is for the development of [[z2-environment:wiki|z2-environment]] version 3.0.
4 1 Henning Blohm
5 2 Henning Blohm
Version 3.0 is a major refactoring release of z2 with new repository code lines and complete package renaming.
6 1 Henning Blohm
7 2 Henning Blohm
h1. Essential Differences between v2.3 and v3.
8 1 Henning Blohm
9 2 Henning Blohm
* All the typical declarations and package names are no longer *com.zfabrik.<something>* but rather *org.z2env.<something>*
10 13 Henning Blohm
* The <z2 home> layout is completely new and more flexible
11 3 Henning Blohm
* The essential component types that can be _invoked_ from the core is *system state* and *main program*.
12 14 Henning Blohm
* While Jetty is still contained to support Eclipsoid and z2Unit, we support a pre-installed Tomcat as application container (and with TomEE would even get a Java EE profile)
13 1 Henning Blohm
* The core is lighter and more dedicated. 
14 12 Henning Blohm
* There will be substantially less built-in application support like
15
** a local JTA implementation 
16
** No worker suppport without a corresponding add-on.
17 1 Henning Blohm
18 12 Henning Blohm
The main task of v3 is:
19 13 Henning Blohm
* Make the lower parts of z2 more accessible and easier to understand: While z2 previously started System Centric, we now close the gap from the ordinary main program.
20 12 Henning Blohm
* Increase the OSS flavor of z2
21
22 15 Henning Blohm
Obvious TODOs:
23
* Finish Java 8 support
24
* Test TomEE
25
* Fix Eclipsoid templates
26
* Support MVNCR, also for distributions
27 12 Henning Blohm
28 9 Henning Blohm
h1. Draft Intro Documentation
29 1 Henning Blohm
30 2 Henning Blohm
h2. Getting Started
31 1 Henning Blohm
32 2 Henning Blohm
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. 
33 1 Henning Blohm
34 6 Henning Blohm
Check out [[wiki#Understanding-Z2|understanding-z2]] for that.
35 1 Henning Blohm
36 2 Henning Blohm
It is simplest to start by running a simple Java main program in z2 or a simple Web App. 
37 1 Henning Blohm
38 2 Henning Blohm
Follow this trail:
39 1 Henning Blohm
40 4 Henning Blohm
* [[wiki#Building-z2env-core|Building the core]]
41 7 Henning Blohm
* [[wiki#Running-a-Hello-World-main-program|Running a Hello World main program]]
42 10 Henning Blohm
* [[wiki#Running-a-Hello-World-Web-App|Running a Hello World Web App]]
43 22 Henning Blohm
* [[wiki#Developing-with-Eclipse-or-IntelliJ|Developing with Eclipse or IntelliJ]]
44 32 Henning Blohm
* [[wiki#Going-Multi-Module|Going Multi Module]]
45 1 Henning Blohm
46 22 Henning Blohm
47
48 3 Henning Blohm
h2. Building z2env-core
49 1 Henning Blohm
50 17 Henning Blohm
(For now, we need to build the core).
51
52
h3. Pre-requisites
53
54
* You need Git installed
55
* You need a JDK, at least version 7
56
* You need the ANT build tool
57
58 3 Henning Blohm
First clone http://git.z2-environment.net/z2env.core
59
60
<pre>
61
git clone http://git.z2-environment.net/z2env.core
62
</pre>
63
64 25 Henning Blohm
Change into *org.z2env.core.main* and run 
65 3 Henning Blohm
66
<pre>
67 18 Henning Blohm
ant -Doutput=<z2home> -Dsetup=<setup> 
68 3 Henning Blohm
</pre>
69
70 18 Henning Blohm
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.
71 3 Henning Blohm
72
If you omit *output* it will default to *gen/dist*. If you omit *setup*, no content will be pre-configured will be modified. 
73
74
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).
75
76 1 Henning Blohm
In general this build always updates only boot, z.jar, roots. It will not remove anything.
77
78 18 Henning Blohm
79 3 Henning Blohm
Example to install/update a core only into ../../z2env:
80
81
<pre>
82 24 Henning Blohm
ant -Doutput=../../z2env 
83 3 Henning Blohm
</pre>
84
85 1 Henning Blohm
To install/update a web-basic setup (with tomcat and eclipsoid support) with updates from remote repos:
86
87
<pre>
88 3 Henning Blohm
ant -Doutput=../../z2env -Dsetup=web-basic-remote
89
</pre>
90 19 Henning Blohm
91
Check out [[wiki#Understanding-the-ltHOMEgt|Understanding the <HOME>]] to learn more about the generated structure.
92
93 7 Henning Blohm
94
h2. Running a Hello World main program
95
96
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. 
97
98
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 
99
100
<pre>
101
greeter/hello
102
</pre>
103
104
Finally, as this component actually has implementation code, we need to declare a Java component. By convention this is 
105
106
<pre>
107
greeter/java
108
</pre>
109
110
Now, after installing in <HOME> the place to simply drop a module is under <HOME>/modules. All in all, here is the complete structure to create:
111
112
| <HOME>/modules/greeter/hello.properties | 
113
<pre><code class="ruby">org.z2env.component.type=org.z2env.main
114
component.className=greetings.Main
115
</code></pre> |
116
| <HOME>/modules/greeter/java/z.properties | 
117
<pre><code class="ruby">org.z2env.component.type=org.z2env.java
118
</code></pre> |
119
| <HOME>/modules/greeter/java/src.impl/greetings/Main.java |
120
<pre><code class="java">
121
package greetings;
122
123
public class Main {
124
  public static void main(String[] args) {
125 8 Henning Blohm
    System.out.println("Hello!");
126 7 Henning Blohm
  }
127
}
128
</code></pre> |
129
130
That gives us the two components of module greeter. To run this on the command line, run
131
132
<pre>
133
java -DcomponentName=greeter/hello -jar z.jar
134
</pre>
135
136 1 Henning Blohm
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.
137 10 Henning Blohm
138
h2. Running a Hello World Web App
139
140 11 Henning Blohm
This introduction explains how to connect a z2 core to a given Tomcat installation and how to develop a simple Web Application.
141 7 Henning Blohm
142 11 Henning Blohm
Furthermore it describes how to use the Dev Repository and the Eclipsoid plugin for the Eclipse or the IntelliJ development environment.
143
144
h3. Pre-Requisites
145
146
* We assume a development workspace in *workspace*.
147
* Have a local Tomcat (7 or higher) installation.*
148
149
h3. Steps we are going to take
150
151
# Create a module with a simple Web app
152
# Make it visible to Z2
153
# Run the Web App in a Tomcat Web Container
154
155
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 
156
157
<pre>
158
ant -Doutput=workspace/z2env -Dsetup=web-basic-remote
159
</pre>
160
161 26 Henning Blohm
(*Note:* If in doubt, use an absolute path for *workspace*)
162 1 Henning Blohm
163 26 Henning Blohm
Using your IDE create a new project *hello* in *workspace* with the following structure:
164 11 Henning Blohm
165
| java/z.properties | 
166
<pre><code class="ruby">
167
org.z2env.component.type=org.z2env.java
168
java.privateReferences=\
169
	javax.servlet
170
</code></pre> |
171
| web/z.properties |
172
<pre><code class="ruby">
173
org.z2env.component.type=org.z2env.tomcat.webapp
174
webapp.path=/hello
175
</code></pre> |
176
| web/WebContent/index.jsp |
177
<pre><code class="html"><html><body>Hello! Did you know that 7*7=<%=7*7%>?</body></html></code></pre> |
178
| LOCAL | <empty file> |
179
180 20 Henning Blohm
Your *workspace* folder now contains two subfolders *z2env* and *hello*.
181
182 11 Henning Blohm
So far, that's it.  We will touch on the LOCAL file later. 
183
184
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. 
185
186
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*. 
187
188
To be on the safe side and assuming the location is */home/me/tomcat*, we open a terminal, change into *workspace/z2env* and run
189
190
<pre>
191
java -Dcatalina.home=/home/me/tomcat -jar z.jar hello/web
192
</pre>
193
194
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 
195
196
<pre>
197
http://localhost:8080/hello
198
</pre>
199
200 28 Henning Blohm
*Note:* What you just created is a prototypical z2 module structure containing a Java component *java* (holding implementation) and a Web component *web*. 
201 1 Henning Blohm
202 28 Henning Blohm
Instead of creating the structure yourself, you could use the Eclipsoid plugin (introduced below) for that:
203
* In Eclipse: New / Others / new z2...., 
204
* In IntelliJ: New / Module / z2....
205 1 Henning Blohm
206 28 Henning Blohm
... but beware of the pre-generated configuration. Where it says *com.zfabrik* change to *org.z2env*.
207 27 Henning Blohm
208 28 Henning Blohm
209
*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. 
210 11 Henning Blohm
211
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.
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 1 Henning Blohm
222 11 Henning Blohm
Similarly, from now on, changes made to the hello module will be picked up, whenever you synchronize.
223 1 Henning Blohm
224 22 Henning Blohm
h2. Developing with Eclipse or IntelliJ
225 1 Henning Blohm
226 21 Henning Blohm
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.
227 1 Henning Blohm
228 21 Henning Blohm
h3. Pre-Requisite
229 1 Henning Blohm
230 21 Henning Blohm
* Have an Eclipse or IntelliJ installation
231
* Install the Eclipsoid plugin from http://z2-environment.net/eclipsoid/update/site.xml or by searching for "z2" in the IntelliJ Plugin Repository respectively
232
233
h3. Steps we are going to take
234
235
# Complete the development workspace setup
236
# Add a simple Controller
237
238
h4. In Eclipse
239
240
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. 
241
242 30 Henning Blohm
Add a source folder *java/src.impl* to the project.
243
244 21 Henning Blohm
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. 
245
246
Go into Window/Preferences, pick "z2-Environment". Change the port to 8081, set the user to "z*" and the password to "z". Done.
247
248
h4. In IntelliJ
249
250 30 Henning Blohm
Add a source folder *java/src.impl* to the module.
251
252 21 Henning Blohm
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.
253
254
h4. IDE Indepently
255
256
Start z2 as in the previous section but make sure the development support is enabled. Use this command line:
257
258
<pre>
259
java -Dcatalina.home=/home/me/tomcat -jar z.jar org.z2env.dev.shared/ready hello/web
260
</pre>
261
262
(possibly you want to turn this into a shell script)
263
264 23 Henning Blohm
*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.
265 1 Henning Blohm
266 29 Henning Blohm
267 1 Henning Blohm
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. 
268 29 Henning Blohm
269 30 Henning Blohm
Now add a class *SimpleController* and change the following files:
270 21 Henning Blohm
271 22 Henning Blohm
| java/src.impl/hello/SimpleController.java | 
272 21 Henning Blohm
<pre><code class="java">
273
package hello;
274
275
import javax.servlet.*;
276
import javax.servlet.http.*;
277
import java.io.IOException;
278
279
public class SimpleController extends HttpServlet {
280
281
    @Override
282
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
283
        String input = req.getParameter("input");
284
        if (input!=null && input.trim().length()>0) {
285
            req.setAttribute("output","You said: "+input);
286
        }
287
        req.getRequestDispatcher("/").forward(req,resp);
288
    }
289
}
290
</code></pre> |
291
| java/z.properties | 
292
<pre><code class="ruby">
293
org.z2env.component.type = org.z2env.java
294
295
java.privateReferences=\
296
  javax.servlet,\
297
  javax.servlet.jsp.jstl
298
</code></pre> |
299
| web/WebContent/WEB-INF/web.xml | 
300
<pre><code class="xml">
301
<?xml version="1.0" encoding="UTF-8"?>
302
<web-app id="hello" version="2.5"
303
		xmlns="http://java.sun.com/xml/ns/javaee"
304
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
305
		xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
306
307
    <servlet>
308
        <servlet-name>controller</servlet-name>
309
        <servlet-class>hello.SimpleController</servlet-class>
310
    </servlet>
311
    
312
    <servlet-mapping>
313
        <servlet-name>controller</servlet-name>
314
        <url-pattern>/do</url-pattern>
315
    </servlet-mapping>    
316
</web-app>
317
</code></pre> |
318
| web/WebContent/index.jsp |
319
<pre><code class="html">
320
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core_1_1" %>
321
<html>
322
<body>
323
  <c:if test="${not empty output}">
324
    <p><c:out value="${output}"/></p>
325
  </c:if>
326
  <form method="POST" action="<c:url value='/do'/>">
327
    Input: <input type="text" name="input"><input type="submit" value="go!">
328
  </form>
329
</body>
330
</html>
331
</code></pre>|
332
333
Make sure the *hello* module is armed (right-click) by having a LOCAL file.
334
335
Now synchronize your running z2 by either:
336
337
* Pressing the "Sync with z2-Environment" button in the toolbar
338
* Pressing ALT+y in your IDE
339
* Entering "s" on the command line running z2.
340
341
Go to http://localhost:8080/hello and check it out.
342
343
344
h2. Going Multi-Module
345 12 Henning Blohm
346 31 Henning Blohm
In this section we will extend the previous work by a simple service module. 
347
348
h3. Pre-Requisites
349
350
# Have all the results from the previous section ready.
351
# Start IDE and z2 as above.
352
353
354
h3. Steps we are going to take
355
356
# add a new module with a service API
357
# reference the module API from the *hello* module and invoke the service.
358
359
360
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
361
362
<pre><code class="ruby">
363
org.z2env.component.type=org.z2env.java
364
</code></pre>
365
366
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. 
367
368
369
| java/src.api/goodbye/GoodbyeService.java | 
370
<pre><code class="java">
371
package goodbye;
372
373
public interface GoodbyeService {
374
375
	String sayGoodbye(String in);
376
	
377
}
378
379
</code></pre> |
380
| java/src.impl/goodbye/GoodbyeServiceImpl.java | 
381
<pre><code class="java">
382
package goodbye;
383
384
public class GoodbyeServiceImpl implements GoodbyeService {
385
386
	@Override
387
	public String sayGoodbye(String in) {
388
		return "Goodbye "+in+"!";
389
	}
390
391
}
392
</code></pre> |
393
| java/service.properties | 
394
<pre><code class="ruby">
395
org.z2env.component.type=org.z2env.any
396
component.className=goodbye.GoodbyeServiceImpl
397
</code></pre> |
398
| java/z.properties | 
399
<pre><code class="ruby">
400
org.z2env.component.type=org.z2env.java
401
</code></pre> |
402 1 Henning Blohm
403 32 Henning Blohm
In effect we created the following:
404
405
* A module *goodbye* that has 
406
* A Java component with API and Implementation source code
407
* An _any_ component *goodbye/service* that manages the service implementation (as we will see below)
408
409
Back in the *hello* module, we want to use the _goodbye service_. We apply the following changes:
410
411
| java/z.properties | 
412
<pre><code class="ruby">
413
org.z2env.component.type=org.z2env.java
414
415
java.privateReferences=\
416
    javax.servlet,\
417
    javax.servlet.jsp.jstl,\
418
    goodbye
419
</code></pre> |
420 33 Henning Blohm
| java/src.impl/hello/SimpleController.java | 
421 32 Henning Blohm
<pre><code class="java">
422
package hello;
423
424
import goodbye.GoodbyeService;
425
426
import java.io.IOException;
427
428
import javax.servlet.ServletException;
429
import javax.servlet.http.HttpServlet;
430
import javax.servlet.http.HttpServletRequest;
431
import javax.servlet.http.HttpServletResponse;
432
433
import org.z2env.components.IComponentsLookup;
434
435
public class SimpleController extends HttpServlet {
436
437
    @Override
438
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
439
    	GoodbyeService gb = IComponentsLookup.CL.lookup("goodbye/service", GoodbyeService.class);
440
        String input = req.getParameter("input");
441
        if (input!=null && input.trim().length()>0) {
442
            req.setAttribute(
443
        		"output",
444
        		gb.sayGoodbye(input)
445
        	);
446
        }
447
        req.getRequestDispatcher("/").forward(req,resp);
448
    }
449
}
450
</code></pre> |
451
452
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
453
your IDE will not complain about using the *GoodbyeService* interface.
454
455
Now synchronize your running z2 by either:
456
457
* Pressing the "Sync with z2-Environment" button in the toolbar
458
* Pressing ALT+y in your IDE
459
* Entering "s" on the command line running z2.
460
461
Go to http://localhost:8080/hello and check it out.
462 31 Henning Blohm
463 34 Henning Blohm
h3. Discussion
464 31 Henning Blohm
465 34 Henning Blohm
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.
466
467
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.
468 12 Henning Blohm
469
h2. Going System-Centric
470
471
TBD
472
473
Getting more real by adding a remote repo as system repo.
474
475
Develop by checking out modules and using the Dev Repo.
476 3 Henning Blohm
477 1 Henning Blohm
478 3 Henning Blohm
h2. Understanding the <HOME>
479 1 Henning Blohm
480 18 Henning Blohm
We call an installation of a z2env core a *<home>*. The file structure of the *<home>* consists of few but important locations
481 3 Henning Blohm
482 18 Henning Blohm
h3. Layout
483
484 3 Henning Blohm
| z.jar | The actual core implementation. This is precompiled.|
485
| boot/ | A component repository adding to the core and provides the most basic capabilities such as compiling Java code and running a main program. |
486
| 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. |
487 1 Henning Blohm
| modules/ | A file system repository declared under roots/ that is useful to locally augment a core installation.|
488
489
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.
490 18 Henning Blohm
491
h3. Folders and Properties
492
493
When running z2 from the command line, some logic is applied to derive where stuff is and some defaults apply:
494
495
|_. What |_. System property |_. Defaults |
496
| 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 |
497
| 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 |
498
499 5 Henning Blohm
500
h2. Understanding Z2
501
502
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.
503
504
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.
505
506
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. 
507
508
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.
509
510
*Component Repositories* provides modules and components to z2. A component is prefixed by the module name:
511
512
<pre>
513
<global component name> = <module name>/<local component name>
514
</pre>
515
516
In fact, the typical component repository has a file system style structure that is made up exactly like that. 
517
518
Structure from repo root:
519
520
| /<module>/<cmp>.properties | A component <cmp> in module <module> that has no resources on its own.|
521
| /<module>/<cmp>/z.properties | A component <cmp> in module <module> that may have additional resources on its own.|
522
523
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.
524
525
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.
526
527
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). 
528
529
!uml1.png!
530
531
Dependencies, for example those between Java components, translate into dependencies between resources that are observed during invalidation of resources. This introduces invalidation and synchronization.
532
533 16 Henning Blohm
h3. A crucial concept of z2 is that of a synchronization. 
534 5 Henning Blohm
535
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. 
536
537
In z2 a synchronization describes the following process:
538
539
# Check for changes in component repositories
540
# Based on changes found, identify components affected and invalidate associated runtime resources incl. dependent resources.
541
# Try to attain target states
542
543 1 Henning Blohm
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.
544 16 Henning Blohm
545
h3. A second crucial concept of z2 is that of *System Centric Development*
546
547
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. 
548
549
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.
550
551
h3. The third and final concept is that of a compile-free environment
552
553
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.
554 9 Henning Blohm
555
h2. The Component Model
556
557
See [[z2-environment:Z2_Modules_intro]]
558
559
h2. Java Components
560
561
See [[z2-environment:Z2_Java_components_intro]]