OpenSpaces Web Container

  Search Here
Searching XAP 6.0 Documentation

                                               

Overview

OpenSpaces are composed of a set of components (such as Space and Notify Container) which can be easily used both using pure code and using Spring support for different configuration mechanisms. Spring provides extensive support for integrating with web containers, as well as integrating with different web frameworks.

Required Libraries

Integrating with web containers will require to copy over GigaSpaces required jar files into the WEB-INF/lib directory.
The following jar files need to be copied over: JSpaces.jar, openspaces.jar, commons-logging.jar, gs-boot.jar, gs-lib.jar, gs-service.jar, jsk-lib.jar, jsk-platform.jar, reggie.jar, start.jar spring.jar.

Spring Configuration - Remote Connection

Most often the web container will connect to a remote Space/Processing Unit deployed within the Service Grid (possibly using a local cache). The following configuration allows to define a GigaSpace which can then be used to access the Space:

Spring Configuration - Embedded Space

Certain scenarios require starting an embedded Space within the web container. Configuring it require to start an embedded Space. Here is how this can be done:

The above configuration allows to start an embedded sync replicated Space. It also allows to externally configure (through system properties) the node id of the different cluster members. The simplest way to provide this node ids (without changing the war file) is to start the different web containers using a proper value for the given system property. For example, with Tomcat, start the Catalina shell with a system property of -Dgigaspaces.nodeId=1 for the first tomcat instance, and -Dgigaspaces.nodeId=2 for the second.

War configuration

Spring support extensive support for integration with web containers and web frameworks. If you are already using a web framework, consult its documentation on how Spring can be integrated with it. If Spring is not used, OpenSpaces components can still be fully configured through code.

Basic Spring integration with web application is documented here. Here is an example of how to configure Spring to load with a file called applicationContext.xml

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

This will start a Spring application context that is bounded to the lifecycle of the web application. Here is a very simple JSP that makes use of the configured application context and access the GigaSpace instance:

<%
    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(application);

    GigaSpace gigaSpace = (GigaSpace) context.getBean("clustertest.gigaSpace");

    if ("write".equals(request.getParameter("mode"))) {
        gigaSpace.write(new Message();
    } else {
        gigaSpace.readIfExists(new Message());
    }
%>


GigaSpaces 6.0 Documentation Contents (Current Page in Bold)

    Java

    C++

    .NET

    Middleware Capabilities

    Configuration and Management

Add GigaSpaces wiki search to your browser search engines!
(works on Firefox 2 and Internet Explorer 7)

Labels