The Java examples must be built (and run) even for .NET and C++ because the cache server runs in Java. In order to run the examples, see How to Run the Examples.
Unzip the example source into an "examples" directory.
Follow the language-specific instructions:
In order to build the examples, you must have Coherence version 3.4.2 or
later and a Java
development kit (JDK) 1.4.2 or greater.
$COHERENCE_HOME
Make sure that the COHERENCE_HOME
environment variable points to the location of the unpacked Coherence 3.4
(or later) directory.
$JAVA_HOME
Make sure that the JAVA_HOME environment
variable points to the location of a 1.4.2 or greater JDK before
building
the examples. A Java runtime 1.4.2 or greater is needed to run the examples.
The directory structure described below is relative to the "examples" directory.
java/bin
Scripts for building and executing examples.
There are two sets of scripts. Scripts with no file extension
are bash
scripts. Scripts with a .cmd file extension are Windows command scripts.
The following description
refers to the script names without specifying
the file extension.
script name | purpose |
---|---|
build | builds an example |
java/src
All example source. The examples are in the
com.tangosol.examples package. The next
level of the package
after examples represents a related set of example classes. "contacts"
in com.tangosol.examples.contacts is the contacts example. In other
words, the name of
the example collection is the name after com.tangosol.examples.
The data model classes used by the examples
are in the "model" package.
java/classes
The class files output from a build. This
directory will not exist until the build
script is executed.
java/resource/config
The coherence configuration files
required by the examples.
$COHERENCE_HOME/lib
Coherence libraries used for compiling
and running the examples.
Execute the build script with the name of the example collection: "bin/build contacts".
In order to build the examples, you must have Coherence version 3.4.2 or later for .NET and Visual Studio 2005 or later or Visual Studio 2005 Express or later. To run the examples, you will also need to build the Java examples. The Java version is required because the Coherence*Extend proxy and cache servers require Java. Also, the examples depend on Java example classes that must be built before running the proxy and cache server.
The directory structure described below is relative to the "examples" directory.
dotnet\src
All example source. The examples are in
the Tangosol.Examples namespace. The next level of the name after
examples represents a related set of example classes. "Contacts"
in Tangosol.Examples.Contacts is the contacts example. In other
words, the name of the example is the name after Tangosol.Examples.
The data model classes used by the examples are in the Tangosol.Examples.Model
namespace.
Each collection of examples has its own Visual Studio 2005 project in the src directory. For example, src contains a project for the contacts example (contacts.csproj and contacts.sln). The contacts example includes an application configuration file, App.config, which references the config files (see below) using relative file paths. If the location of the config files is changed, that new location must be reflected in contacts\App.config.
dotnet\resource\config
The coherence configuration
files required by the examples.
Open the examples project from the src\<example> directory with Visual Studio. Add a reference to the Coherence.dll from the Coherence .NET installation. If you are using .NET 1.1, use the library found in the bin\net\1.1 folder. If you are using .NET 2.0 or higher, use the library found in the bin\net\2.0 folder. In Visual Studio, select Build -> Build Solution from the menu.
The build for the contacts example will copy resource\contacts.csv to the build output directory. contacts.csv is a comma separated value file containing sample contacts information for the contacts collection of examples.
In order to build the examples, you must have the appropriate C++ library of Coherence version 3.4 or later. Also you must have a C++ development environment. To run the examples, you will also need to build the Java examples. The Java version is required because the Coherence*Extend proxy and cache servers require Java. Also, the examples depend on Java example classes that must be built before running the proxy and cache server.
$COHERENCE_CPP_HOME
Make sure that the COHERENCE_CPP_HOME
environment variable points to the location of the unpacked Coherence 3.4
C++ installation (or later) directory.
Compiler enviroments supported.
The directory structure described below is relative to the "examples" directory.
cpp\src\contacts
All example source. The examples are
in the coherence::examples namespace. The next level of the name
after examples represents a related set of example classes. "Driver"
in coherence::examples::LoaderExample is the Loader for the contacts
example. In other words, the name of the example is the name after coherence::examples.
cpp\src\model
The data model is represented in this
directory. The rationale is to show how to utilize an already existing data
model and exposing it in Coherence. The model classes does not contain any
Coherence specific code to prove this point. However there is a serializer
that is associated with each model type. For example the Contact has a ContactSerializer
class which purpose is to create register the model type with Coherence and
serialization operations.
The generated output will be in the form of a dynamic library.
cpp\config
The coherence configuration files required
by the examples.
For Windows
Open a development environment command prompt. This
should have been installed with Visual Studio or the platform SDK. Go to the
C++ examples directory and type "bin\build.cmd contacts". This will
build both the model and the contacts example executable.
The model will put the model.lib and model.dll file under
cpp\model\out. These are needed for building and running the contacts
example
The executable contacts.exe will be generated in cpp\contacts\out
directory/
To run the contacts example type "bin\run.cmd contacts"
As an alternative, in any command window you can cd to the C++ bin directory and run vcvars32.bat before trying to build the examples. With a default install of Visual Studio, the bin dir is "C:\Program Files\Mircorsoft Visual Studio 9.0\vc\bin". Then follow the previous instructions for running the build script.
For Linux/Mac and Solaris
Open a command shell. Go to the C++
examples directory and type "bin/build contacts". This will
build both the model and the contacts examples executable.
The model
dynamic library and lib file will be put in cpp/model/out. These
are needed for building and running the contacts example.
The executable
contacts, will be generated in cpp/contacts/out.
To run the contacts example type "bin\run contacts"