Jini and JavaSpaces: the B2B Dark Horse?

by Robert Flenner

Much has been written lately of e-markets, auctions, supply chains, and integrated B2B networks. The ability to do business-to-business (B2B) e-commerce over public networks is all the rage. Forrester and other industry analysts frequently project growth rates in excess of 100%, of markets measured in billions of dollars. It's no wonder vendors and software providers are releasing B2B solutions daily. Most solutions have focused on application servers, commerce servers, customer relationship, and content management systems.

In this article we focus on applying Jini technology to B2B technical challenges by examining:

Dynamic service and trading partner discovery

UDDI and ebXML
Universal Description, Discovery and Integration is an initiative of IBM, Microsoft, and Ariba to promote B2B e-commerce by providing a framework for trading partners to publish and find business service interfaces. The UDDI defines three primary components.

The UDDI defines three primary components.

Figure 1. The UDDI defines three primary components.

Service requesters can search by industry code, products and services offered, and geographic location. Web Service Definition Language (WSDL) is an XML schema that describes service interfaces, implementation details, access protocols, and contact endpoints between trading partners. These definitions are published and exchanged with service brokers. See uddi.org for more information.

The Electronic Business XML (ebXML) initiative is being defined by the United Nations body for Trade Facilitation and Electronic Business (UN/CEFACT) and Organization for the Advancement of Structured Information Standards (OASIS). They've also begun a project to standardize XML business specifications.

The most important components of the ebXML architecture are the Registry and the Repository. The Registry provides access services, information models, and reference implementation information. The repository provides the physical backend information store. The repository contains Document Type Definitions (DTD) and schemas that are retrieved by the registry for conducting e-commerce transactions using ebXML. The ebXML Messaging Service provides for the exchange of ebXML messages between trading partners over various transfer protocols (SMTP, HTTP/S, FTP). See ebxml.org for more information.

Components of the ebXML architecture.

Figure 2. Components of the ebXML architecture.

Both UDDI and ebXML admit the importance of a "yellow pages" structure to B2B system integration. Both approaches involve a registry or broker to answer questions like

Both approaches use XML to define and specify the answers. There's even a trading partner markup language (tpaML) being defined to standardize the information exchanged. Each approach requires the implementation of a well-known interface at a well-known location. In addition a considerable amount of effort is required to document the interface and to exchange the necessary information to conduct B2B e-commerce.

However, what if you want to break out of the yellow pages paradigm? What if the service you need isn't in the phone book? Do you call the operator?

Jini discovery and lookup
Like UDDI and ebXML, Jini supports the service discovery. Jini network technology provides a network-centric view of services and service delivery. Services are broadly defined: from applications to mobile appliances and anything in between that can exist on a network. Clients can request services without prior knowledge of where or what may ultimately satisfy the request. Services take on a life of their own in Jini networks. The goal is to minimize the amount of human intervention and administration required to keep the Jini network satisfied.

Discovery is the process used to find registries on the Jini network. The process may use a well-known registry address, like the approaches above, or it may use a more dynamic discovery process (a multi-cast protocol).

Lookup is the process used to find a particular service from the registry and learn how to use that service. You can search the lookup service for a particular object type. The lookup service understands Java type semantics, allowing support of interfaces and class inheritance hierarchies. It also provides the basis for a system to system or agent to software agent negotiation process.

The lookup service can be conceived as containing any number of service items. Each service item can have attributes associated with it. For instance like UDDI, they may include industry codes, implementation details, access protocols, and geographic locations. These attributes can be used to refine the search for a specific service.

The lookup service conceptually can be thought of as
containing any number of service items.

Figure 3. The lookup service can be conceived as containing any number of service items.

In addition a proxy for the service is available that knows how to interface with the service. The code is downloadable to the client requesting the service. Downloadable service proxies are one of the key differences between other yellow-page-like services and Jini. In effect not only have you located a business service, but you've been transported there, conducted commerce, all while never having left your place of business.

Downloadable service proxies are one of the key
differences between other

Figure 4. Downloadable service proxies are one of the key differences between other yellow-page- like services and Jini.

So while the other approaches to service definition are being satisfied through agreed-upon XML schemas, Jini discovery and lookup provides a dynamic alternative to finding and interacting with B2B service providers. Jini itself could be used to bootstrap the process of finding UDDI and ebXML registries.

Leasing and the need for self healing networks in B2B

If you've integrated systems across a network, you know that the resiliency of the network and the ability to cope with network failures separates good applications from primitive ones. Jini assumes at its foundation that the network may be unstable.

Jini introduces the idea of a lease to service management. If you are a user of a service, you never own the service, you simply lease it. Nothing is permanent. All resources must have some management process that periodically checks to see if everything is okay and to determine whether the resource is still required by the user.

Imagine I am a service provider publishing services offered to B2B exchanges. My system crashes, or I am having system problems. How does the exchange maintain my status in a timely fashion? There's not likely to be a consistent approach across exchanges.

Leasing is an important part of Jini infrastructure robustness. Leasing allows the lookup service to delete services that have failed to renew their lease. If you provide a service, or if you are using a service, you must periodically renew your lease. The renewal period depends on the application. You request a finite renewal period on your lease, and the service provider determines the actual lease commitment. It's analogous to apartment leasing. I ask the apartment complex for a 6-month lease. They inform me they can only commit to 1-month lease periods. After 1 month I must renew my lease, or I am evicted.

When you use the Web you often find nvalid URL references or slow sites. B2B e-commerce is being built on this same infrastructure and architecture. System and network instability will be an issue. B2B E-Commerce will require the self-healing properties of a Jini network.

Distributed transactions

Transactions are at the core of B2B e-commerce. The exchange of goods and services involves monetary transactions. Transactions and transactional integrity are not new issues in distributed computing. However, traditional solutions have tended to be heavyweight and complex. As we expand our notion of distributed transactions to include a broader array of cliens like cell phones, palm pilots, and mobile agents, we will require support for more flexible and lightweight transactions.

Jini uses the traditional two-phase commit transaction protocol, which attempts to ensure the well-known ACID properties to data manipulations. Database management systems go to great lengths to ensure data integrity. As a result system overhead is generally proportional to the degree of transactional integrity. More system resources are required to ensure data integrity in the light of failures that may occure in reading, writing, and updating it.

Jini provides only the interface to transactions, and it closely resembles the two-phase commit protocol. Jini also comes packaged with an example Transaction service, mahalo, that's used with the JavaSpaces service (See below). By providing only an object interface to transactions, Jini does not dictate implementation. The notion of data consistency with regard to partial failure is promoted through the two-phase commit based interface. But the key is the degree to which the implementation will try to ensure consistency despite a partial or catastrophic failure.

Lightweight implementations will reduce the overhead and time required to deploy transactional systems. Similar to message oriented middleware (MOM), which provides various levels of message assurance, the new breed of transactional systems will provide various levels of transactional integrity.

In B2B exchanges the degree of transactional integrity will be dependent on the application context. B2B supply chain integration requires the coordination of multiple trading partner processes. Workflow is one area where transactional coordination of processes may be satisfied by a lighter weight implementation.

Workflow Automation and Integration

JavaSpaces is an example service that runs on the Jini network. JavaSpaces is closely tied to the Jini architecture. In fact it is one of the few services bundled with Jini. JavaSpaces was heavily influenced by the tuple spaces, which were first described in 1982 in the Linda language. The basic idea is that you can have many active programs distributed over physically dispersed machines, unaware of each other's existence, able to communicate by releasing tuples into the shared tuple space. Programs read, write, and take tuples from the tuple space that are of interest to them.

The B2B e-commerce environment has many of the attributes just described. For instance the environment is composed of distributed cooperating systems able to communicate by exchanging business information. The requirement to locate trading partners dynamically provides an even closer comparison.

To be successful in B2B e-commerce you must be able to integrate business transactions into your workflow processes and backend systems. Business-to-consumer (B2C) offerings have demonstrated the need for end-to-end service and fulfillment. Failure to support products and processes across channels diminishes your chances for success.

Integrating workflow and legacy systems has always been a complex and costly undertaking. JavaSpaces provides a simplified approach to dynamic communication, coordination, and sharing of objects between network resources. JavaSpaces acts as a virtual space between providers and requesters of network services. This allows participants in a distributed solution to exchange tasks, requests, and information in the form of Java objects.

Jini in concert with JavaSpaces provides a mechanism to loosely couple systems through remote events and a persistent shared memory model. Processes can exchange information through this space and be notified of changes through asynchronous events. JavaSpaces supports two implementation models: transient and persistent spaces. Transient spaces do not survive across a system restart, while persistent spaces use secondary storage to save restore services upon activation. The simplicity of the JavaSpaces API provides an easy interface, yet it still provides a powerful programming model.

As we move toward B2B service and component-based architectures, coordination and automation of processes both internal and external will take on more importance. Generic workflow engines supporting standard APIs will help integrate both internal and external processes. Jini and JavaSpaces are a network-centric middleware solution for enabling next generation communication and collaboration.

Agents of collaboration

Let's end our discussion of the B2B dark horse contender, Jini and JavaSpaces, by discussing it as a platform for agents of collaboration. We thus move beyond traditional two-tier environments to discuss the opportunities emerging with P2P.

Software agents conjure up images of sci-fi technology. But the popularity of the Internet has ushered in a new era of communication and collaboration. Autonomous agents will provide a strategic advantage in the acquisition and control of information.

Autonomous agents are often defined as systems capable of acting on behalf of a user by learning and cooperating with their environment. Typically there's an agenda or goal that drives an agent's behavior. A mobile agent is able to move across machines and networks to carry out this mission. There's lots of of work being done to provide mobile agents for network management. It is easy to envision the benefits gained by network managers using mobile agents to relay conditions and instructions to network elements.

Jini provides a foundation for many of the requirements of mobile agents. As mentioned above, the ability to move code from machine to machine, through downloadable proxies, is one of the key enablers of the Jini framework. Business-to-business e-commerce can also benefit from agent technologies and specifically Jini-based implementations.

Often we think of B2B and B2C as two separate models of participation and communication. But B2B and B2C are not discreet models but rather exist on a continuum. By introducing agents you add another element of complexity to your current processing capabilities. As a result the ability to leverage software agents at key points -- in distribution, manufacturing, sales, and customer relationship management -- becomes compelling.

B2B and B2C are not discreet models but rather exist
on a continuum.

Figure 5. , B2B and B2C are not discreet models but rather exist on a continuum.

Imagine a business engaged in distributing products and services over the Web. Detailed market research is involved in determining the effectiveness of this distribution channel. Many companies are looking for more effective data capture and analysis techniques. A trellis pattern is one possible solution.

A trellis consists of a hierarchical group of processes. These processes can range from low-level data capture to high-level production forecasting. Jinni and JavaSpaces can be used to build trellis patterns. These patterns combine traditional systems, agents, and information workers, coordinating and collaborating at different levels within the process hierarchy.

The Jini network of loosely-coupled collaborating processes is an ideal foundation for the acquisition and control of information. Cutting edge corporations are investing in technologies to help systems and information workers become more effective in the capture, analysis, and dissemination of information.

Jini and JavaSpaces offer great promise in allowing systems, agents, and information workers to collaborate in new and exciting ways. These technologies will enable multi-dimensional information exchange and intuitive work group formation.

Betting on the dark horse may be your best bet.

Robert Flenner is an active author, software developer, and independent contractor who is actively involved with emerging B2B technologies.

Return to ONJava.com.

Copyright © 2017 O'Reilly Media, Inc.