This HOWTO will show you how to setup the entire ZipTie development environment. Building ZipTie requires scarcely more than extracting the source and typing ant dist dbreset in the Build project directory. But we assume that you're building the source because you want to work with the source, and therefore you'll want to setup the development environment. Hence this HOWTO.
If all you want to do is browse the source, you can access the repository on the web at http://fisheye.ziptie.org/.
Eclipse is not stictly required, but all of these instructions are given in terms of using Eclipse.
The following only applies if you are running a version of java 6 prior to 1.6.0_04. In 1.6.0_04, sun packaged JAXB v 2.1 instead of JAXB 2.0.
If Java 6 is being used to compile the ZipTie source code, then the manual installation of two JAR files are required: jaxb-api.jar and jaxws-api.jar. This is due to Sun including backlevel versions of libraries in the JDK that ZipTie depends on for the Web Services component. ZipTie uses JAXB 2.1, while JDK6 ships JAXB 2.0.
To install the jaxb-api.jar and jaxws-api.jar, do the following:
jre\lib directory of your JDK6 install, create a new directory called endorsedorg.ziptie.zap.metro\lib directory in your ZipTie directory.jaxb-api.jar and jaxws-api.jar files from the org.ziptie.zap.metro\lib directory to the jre\lib\endorsed directory in your JDK6 installation.
You will notice an error like this if you do not have the jaxb-api.jar and jaxws-api.jar files properly installed:
C:\Dev\ziptie\HEAD\Build\build.xml:119: The following error occurred while executing this line: C:\Dev\ziptie\HEAD\org.ziptie.provider.scheduler\build.xml:8: The following error occurred while executing this line: C:\Dev\ziptie\HEAD\Build\buildCG.xml:87: You are running on JDK6 which comes with JAX-WS 2.0 API, but this tool requires JAX-WS 2.1 API. Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), or set xendorsed="true" on <wsgen>. Total time: 5 seconds C:\Dev\ziptie\HEAD\Build>java -version java version "1.6.0_02" Java(TM) SE Runtime Environment (build 1.6.0_02-b06) Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
To actually work with the source you will need to extract it from our CVS repository.
| CVS Connection Information | |
|---|---|
| Host | cvs.ziptie.org |
| Repository Path | /usr/local/cvsroot |
| User | anonymous |
| Password | (leave blank) |
| Connection Type | pserver |
For command line users the CVSROOT variable would look like :pserver:anonymous@cvs.ziptie.org:/usr/local/cvsroot. ZipTie is composed of many projects, but all of the ones necessary to build the distribution are encapsulated in the ziptie module alias. If you “check out” the ziptie module, you will get all of the projects necessary to build ZipTie.
The first thing to do is create a new Eclipse workspace. Once in that workspace, open the CVS Repository perspective and right-click in the left navigation area and choose New → Repository Location…. You should get a dialog similar to the following dialog, fill it out with the values listed above (and shown in the image):
Once connected, expand the repository entry in the tree and then expand the HEAD node. You should see a list of projects. Scroll down and find the project called ziptie, which is an alias (“super-project”) that is comprised of the proper set of projects in the repository. Once you find the ziptie project, right-click on it and select checkout as shown in the screen capture below:
Depending on the speed of your connection, the checkout will take anywhere from a few minutes to half and hour or so.
Before you go on to compiling, follow these steps to configure your Eclipse workspace for ZipTie development.
Go to Window→Preferences→Plug-in Development→Target Platform and change the Location to point at workspace/TargetPlatform/eclipse
The ZipTie team uses specific code style setting in Eclipse to format our code. Formatting with this template should result in a file that is compliant with the ZipTie Coding Standard as well as complying with the enforcement rules of Checkstyle. All files should be formatted with these settings (Shift-Ctrl-F in Eclipse).
The import file for the coding style is located in the Build project in the /conf directory.
The ZipTie team uses the following code template. It ensures that all files have the appropriate Mozilla Public License (MPL 1.1) banner at the top, as well as other minor formatting tweaks.
The import file for the coding template is located in the Build project in the /conf directory.
This is the Eclipse plugin for the Checkstyle project, and provides enforcement of our code style settings as well as the ZipTie Coding Standard. In Eclipse, go to Help→Software Updates→Find and install… to install the eclipse-cs plugin.
eclipse_cs update site: http://eclipse-cs.sourceforge.net/update
After installing the plugins, follow these instructions to configure:
The ZipTie development team uses the FindBugs plugin.
FindBugs Eclipse update site: http://findbugs.cs.umd.edu/eclipse
The ZipTie development team has started using the Metrics plugin. We are experimenting with this tool and do not currently have guidelines about its use. Use it to inform your development, but feel free to ignore some of it's warnings. Additionally, this is a plugin that you should Disable (in the project settings) when you're not looking for it's advice – it is very expensive to run. You will need to clean build after Enabling it.
Metrics Plugin: http://sourceforge.net/projects/metrics
Unfortunately, this tool does not provide for import/export of settings so here are our recommendations:
Metrics Preferences → Safe Ranges
| Metric | Max | Comment |
|---|---|---|
| Number of Static Methods | 20 | max # of static methods in a class |
| Total Lines of Code | ? | max lines of code in a package |
| Afferent Coupling | ? | see below |
| Normalized Distance | ? | see below |
| Number of Classes | 25 | max # of classes per package |
| Specialization Index | ? | see below |
| Instability | ? | see below |
| Number of Attributes | 10 | max # of attributes per class |
| Number of Packages | ? | max # of packages referenced by a class? |
| Method Lines of Code | 120 | max lines of code in a method |
| Weighted methods per Class | ? | |
| Number of Overridden Methods | ? | see below |
| Number of static Attributes | ? | max # of static attributes per class |
| Nested Block Depth | 5 | max block nesting level |
| Number of methods | ? | max # of methods per class |
| Lack of Cohesion of Methods | ? | see below |
| McCabe? Cyclomatic Complexity | 10 | see below |
| Number of Parameters | 5 | max # of input parameters per method |
| Abstractness | ? | see below |
| Number of Interfaces | 2 | max # of interfaces a class can implement? |
| Efferent Coupling | ? | see below |
| Number of Children | 8 | max # of subclasses from a parent class |
| Depth of Inheritance Tree | 6 | max levels of class or interface inheritance |
Some of these metrics, in this author's opinion, are fairly meaningless at worst or hard to quantify a “good” range for at best.
See this link for a discussion of the metrics: http://open.ncsu.edu/se/tutorials/metrics/index.html#section4_0
You can do the full build from the “Build” directory by executing the command below:
ant clean dist dbreset
If your “ant dist dbreset” runs out of perm gen space, increase it by setting the following environment variable.
ANT_OPTS = '-Xmx960m -XX:MaxPermSize=128m -XX:PermSize=64m'
For Windows developers: if mxmlc (located in <workspace>\TargetPlatform\flex\bin) returns fatal error saying that it could not find JVM (Error: could not find a JVM.) probably you'll have to set JVM in the jvm.config located in the same folder.
java.home=C:/<JDK_ROOT>/jre
IMPORTANT: USE FORWARDING SLASHES.
If this setting does not resolve the issue uninstall JRE (if you have one installed).