The CDE editor uses projects to manage contracts and the components to which they apply. Each project comprises the bottom two layers of an application. To create a new application, the steps to be taken in this phase are:
Create the components with any text editor (which may be the text editor included in the CDE editor) or with a Java IDE and compile them (using JDK or the Java IDE) to make sure they have no errors.
Create a project in the CDE editor, and add the Java source files of the components to the project.
Write all the necessary contracts, compile them to check there are no errors, and add them to the project.
Build the project, i.e., generate the Java code that adapts the components and implements the contracts.
The following subsections explain in detail the above steps for our running example, for which all component (and contract) source files have been written for you. We therefore begin directly with step 2. Moreover, this guide includes links to the source files, so that you can read them without having to use the CDE tools or an external text editor.
The CDE presupposes a certain organization of the files that are involved in the development process. In particular it assumes that there is a directory that will hold all application-specific files. We call this the application directory. It has several subdirectories. The application source files are in a source directory, usually with the name src. Those Java classes that are subject to coordination are put in a component directory with name components. The Java files generated by the CDE are put in the generation directory, and the result of compiling all source files is put in a class directory, with the name classes. All these subdirectories of the application directory have further subdirectories according to the application package tree.
The application directory for the running example of this guide is demos/tour
in the CDE root directory. It already contains the source directory with the necessary
files. The source
directory has a subdirectory Bank corresponding to the package to
which the components belong.