Using GigaSpaces from .Net/C#: Hello World

This post basically duplicate the information found with the examples in the "dotnet" directory of the GigaSpaces installation. To run the example, please download the product downloads.html">http://www.gigaspaces.com/osdownloads.html">url=downloads.html">http://www.gigaspaces.com/osdownloads.htmlhere/url. This example references code found in the following files: Application.cs, Example.cs, Message.cs and Message.java

Introduction
The Hello World example demonstrates how you can use a Gigaspaces??? space from .NET.

The source code for the example is contained in Application.cs, Example.cs, and Message.cs. You can easily see that Application.cs and Example.cs contain user-written application code that performs a couple of simple Space operations before exiting. Example.cs contains shared functionality that is used by all examples that use the Gigaspaces Platform.

Message.cs is different: it was generated using Codemesh's JuggerNET tool. It is a C# type which corresponds with the Java Message class (provided in Message.java), much like the Gigaspaces C# types were generated to correspond with the Gigaspaces Java API.

Because you typically don't have the JuggerNET code generator installed on your machine, you cannot generate C# types for the proprietary Java types that you might wish to use with the Gigaspaces API. Consequently, this example is not 100% relevant to you (unless you want to get yourself a code generator in addition to the Gigaspaces distribution). In your own application, you would be using a more generic approach to integrating your types with the space. This more generic approach is demonstrated in the spacewriter example.

*Building and Running the Example with Microsoft Visual Studio *
Browse to the example's directory (dotNET/examples/hello-world).
Double-click the hello-world.csproj file, depending on the version of VisualStudio you have.
Choose "Build". You should end up with a file called hello.exe in the Debug or Release subdirectory. The post build action should also have copied the required runtime DLLs into this directory. You can probably skip the next step.
If you have not done so before, you need to copy the DLLs from the dotnet/lib folder to your example directory. Almost all DLLs in this directory will be required at runtime (you need either the *sn.dll or the *.dll version). Alternatively, you can copy the DLLs into a directory on your path but in that case you might have hard-to-diagnose problems later on when you upgrade to a later version of the .NET libraries and forget to replace the old DLLs.
In a console window, change into the proper build directory and type:
hello rmi://localhost/./myCache

to start the application. The application will run and display some text messages reporting success or failure.

Building and Running the Example with ANT
Open a console and change into the array example's directory (dotNET/examples/hello-world).
Run ANT to build a test application, and run the built test app.
To build and run the example on Windows, you invoke ANT without any arguments while you are in the directory that contains your build script:

cd cpp/examples\hello-world
ant

On Unix, you will usually need to make sure that you're invoking the launcher script in the example directory by explicitly specifying directory:

cd cpp/examples/hello-world
./ant

You may also want to take a look at the build.xml file to get an idea about how we build the .NET application.

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2006-02-25 21:52:04 -0500

gbarnea gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete