Summary: How to get your .NET application to work with the GigaSpaces JavaSpaces interface.
Use Space-Based .NET API
In GigaSpaces 6.0, it is recommended to use Space-Based .NET API instead of ExternalEntry.
Overview
To get your .NET application to work with the GigaSpaces JavaSpaces interface, simply create an ExternalEntry object (com.j_spaces.core.client.ExternalEntry; see Javadoc), use it to store your data as a space Entry or template, and then pass it to the relevant .NET method.
For a detailed list of the ExternalEntry methods and constructors, see Javadoc.
Converting ExternalEntry to .NET Object
Converting a .NET ExternalEntry object to a .NET object is done in the following manner:
public void notify(RemoteEvent theEvent)
{
EntryArrivedRemoteEvent arrivedRemoteEvent = (EntryArrivedRemoteEvent)theEvent;
ExternalEntry ee = (ExternalEntry)arrivedRemoteEvent.getEntry(true);
object obj = proxy.Converter.getObject(ee);
}
Integration Architecture
A .NET application interfaces transparently with a GigaSpaces space instance using three communication bridges:
- The ExternalEntry wrapper – used to pass information to GigaSpaces .NET methods. This may be a JavaSpaces Entry or a template. Use ExternalEntry with the JavaSpaces Interface.
- .NET to Java conversion – an automatic mechanism that converts method calls made on the .NET library to equivalent calls on the Java library.
- Operation on space – the client Java component interacts with the space, running either in remote or local mode.
.NET JavaSpaces & Map Interfaces
| Interface |
Located in Package |
| JavaSpaces interface |
net.jini.javaspace;
com.j_spaces.core.client |
| Map interface |
com.j_spaces.map |
Differences Between .NET and Java Libraries
If you are accustomed to working with the GigaSpaces Java library, you should note the following:
- Package names are the same in .NET as in Java.
- If you use ExternalEntry with the JavaSpaces interface, ExternalEntry objects are returned as well.
- Java element types are mapped to .NET types as follows:
| Java Element Type |
.NET Element Type |
Array Type |
| java.lang.Number |
java.lang.Number |
java.lang.NumberArray |
| java.lang.Object |
System.Object |
java.lang.ObjectArray |
| java.lang.String |
System.String |
java.lang.StringArray |
- Static properties for the Java interface classes are declared in the Impl of the relevant class. For example, the JavaSpace static properties of the .Net JavaSpaceImpl class:
Console.WriteLine( "{0}", JavaSpaceImpl.NO_WAIT )
Work Process
To perform a space operation from a .NET environment, an application performs the following steps:
- Load the relevant information into a com.j_space.core.client.ExternalEntry. The information may be, for example, the class that should be written to the space, or the take/read template.
- Call one of the space methods in the .NET library, such as net.jini.space.JavaSpace.write or com.j_spaces.core.IJSpace.updateMultiple.Pass, with the ExternalEntry object as the Entry argument.
- The operation is automatically converted to Java and performed on the space.
- In operations such as read, the .NET method returns the required information wrapped in an ExternalEntry object.
Using Constructors for Different Space Operations
The table below shows which constructors should be used to create the ExternalEntry object for different space operations.
| # |
Constructor Fields |
Used for Operations |
Meta Data |
UID |
| 1 |
entryUID |
read, take |
N/A |
Required |
| 2 |
multipleUIDs |
readMultiple, takeMultiple |
N/A |
Required |
| 3 |
className, fieldsValues |
read, take, write (new class instance) |
Required |
N/A |
| 4 |
className, fieldsValues, fieldsNames, fieldsTypes |
write (new class) |
Required |
N/A |
More in this Section
Performing Space Operations from .NET – The page Performing Space Operations from .NET - 6.0 does not exist.
.NET ExternalEntry Example – The page .NET ExternalEntry Example - 6.0 does not exist.