ActiveSpaces Examples
TIBCO ActiveSpaces provides examples programs that demonstrate how to use the various features of the product. Some of the examples (such as ASOperations) provide boilerplate code templates that you can copy and paste directly into your application; others demonstrate the use of specific API functions.
The example programs are one of the most important resources to use when learning to program with ActiveSpaces. It is highly recommended that any developer new to ActiveSpaces reserve some time to study the examples.
- The Examples Directory
The TIBCO ActiveSpaces examples are provided in the AS_HOME/examples directory. This directory contains examples for each API set included with the product—Java, C, and .NET. - Building the ActiveSpaces Examples
- Running the Examples
As long as your PATH/LD_LIBRARY_PATH and CLASSPATH environment variables are correctly set up, it should be straightforward to run the examples. - Security
Most of the examples can be run using the security features of TIBCO ActiveSpaces. To help you get started, an example security policy file and security token file can be found in the /security subdirectory of the examples for each language API. - ASOperations
The first example program you should examine is the ASOperations example. ASOperations defines and joins (as a leech) a space called myspace that has a very basic definition consisting of three fields. - ASBatchOperations
ASBatchOperations demonstrates how to perform batch operations on spaces. - ASChat
ASChat demonstrates how to build a peer-to-peer distributed application using ActiveSpaces: a multi-user chat room. - ASPaint (Java and .NET Only)
ASPaint is an implementation of a shared whiteboard. This example is provided only for Java and .NET. - ASQuery (Java Only)
The ASQuery example is provided only in a Java version. - ASPersistence
The ASPersistence example demonstrates how to implement the external shared-all persistence interface. - Shared-Nothing Persistence
The shared-nothing persistence example shows how to make an application be its own persister using the internal shared-nothing persistence feature. - ASRequestReplyServer and ASRequestReplyClient
These examples show how two spaces can work together as a reply server and reply client. - Remote Space Invocation InvokeClient
The example directory for each API set also contains an example showing how to implement and use remote space invocation. - Overview of ASBrowser ASEventBrowser and ASListener
The ASBrowser, ASEventBrowser, and ASListener examples show how simple it is to use the space browser and listener features to iterate over the contents of a space, or to listen for events on a space. ASBrowser and ASListener do exactly the same thing, but each uses a different set of ActiveSpaces API calls to achieve its goal. ASEventBrowser implements an event listener. Examine all three programs to evaluate when to use a browser and when to use a listener in your own code. - ASBrowser
The ASBrowser example creates a space browser which, by default, retrieves all of the entries in the default space 'myspace,’ displays them in the command window, and then exits. - ASEventBrowser
The ASEventBrowser example creates an event browser for a space. When started, the event browser displays all of the current entries in the space and then blocks, waiting for new operations to occur on the space. When a new operation occurs, the event browser displays the information about that event. - ASListener
The ASListener example creates a listener for a space. The listener callback is invoked whenever a put, take, expire, seed, or unseed event occurs for an entry in the space. The listener callback displays information about the event that caused it to be invoked. - MetaspaceMemberMonitor
The MetaspaceMemberMonitor example creates a MetaspaceMemberListener for a metaspace. The listener callback is invoked whenever a member joins, leaves or changes their role in the metaspace (e.g. member vs manager). The listener callback displays information about the event which caused it to be invoked. - SpaceDefMonitor
The SpaceDefMonitor example creates a SpaceDefListener for a metaspace. The listener callback is invoked whenever a space is defined or dropped from the metaspace. The listener callback displays information about the event that caused it to be invoked. - SpaceStateMonitor
The SpaceStateMonitor example creates a SpaceStateListener for a metaspace. The listener callback is invoked whenever the state of a space changes (e.g., READY, FAILED). The listener callback displays information about the event which caused it to be invoked. - SpaceMemberMonitor
The SpaceMemberMonitor example creates a SpaceMemberListener for a space. The listener callback is invoked whenever a member joins, leaves, or changes their role in the space (e.g. leech vs seeder). The listener callback displays information about the event which caused it to be invoked. - ASDomainController
You can use the ASDomainController example as a security domain controller when running the rest of the ActiveSpaces examples with security. ASDomainController uses a security policy file to connect to a metaspace and become a security domain controller for the metaspace. - ASUserAuthenticator
When using user authentication, the default ActiveSpaces behavior of prompting users to enter their authentication information may not be adequate. Therefore, TIBCO ActiveSpaces provides a callback mechanism that allows you to customize how user authentication information is retrieved for your users. - ASPerf
ASPerf is an example that demonstrates how to perform timing measurements to calculate how long it takes ActiveSpaces to perform an action.
Copyright © Cloud Software Group, Inc. All rights reserved.