devxlogo

Getting Started with Sun Java System RFID

Getting Started with Sun Java System RFID

un Java System RFID Software is an RFID infrastructure framework that integrates data and RFID-enabled devices into enterprise application systems ranging from small projects to large deployments. Java System RFID Software can be used to build systems that facilitate asset tracking, enforce policy compliance, detect tampering, and prevent crime.

Sun Java System RFID Software v3.0
The Java System RFID Software is a standards-based RFID Middleware framework from Sun that, among other things, gathers and filters information from RFID readers; exchanges this information as XML messages; stores the information to relational databases; and manages RFID devices, events, and components.

The Sun Java System RFID Software consists of four modules:

  1. RFID Event Manager is an event processing framework that manages data coming from all readers in the network.
  2. RFID Configuration Manager is a GUI application you use to specify the set of devices connected to the RFID Event Manager.
  3. RFID Management Console is a Web-based application used to modify various read and write attributes of the RFID Event Manager.
  4. RFID Information Server is a J2EE application that facilitates capturing and querying EPC-related data (see the sidebar “Electronic Product Code“) and provides interfaces for back-end systems.

The Sun Java System RFID Event Manager
The RFID Event Manager framework is a Jini-based event processing framework that facilitates the capture, filtering, and storage of Electronic Product Code (EPC) events generated by RFID devices. The Jini services of the RFID Event Manager framework are managed through Rio, an open source container of a component model called Jini Service Beans (JSBs).

The RFID Event Manager consists of a management application called “Control Station” and one or more workload handlers called “Execution Agents.” Execution Agents register with the Control Station application, which uses them to gather and filter RFID information. Each Execution Agent provides one or more specialized Web services called “reader services.” A reader service communicates with the RFID device, processes the information according to a configuration object, and communicates an event client.

The Sun Java System RFID Configuration Manager
The RFID Configuration Manager is a GUI application that is used define the set of devices that will be managed by the RFID Event Manager, how device information is processed within the RFID Event Manager, and where the information is to be sent once it has been processed.

The RFID Configuration Manager uses a chain of subclasses of com.sun.autoid.ems.AbstractComponent called a “Configuration Object” to identify a device to be managed by the RFID Event Manager and the software services that will be used to process the device information.

There are several subclasses of AbstractComponent that you should understand:

  • Adapters begin the event chain by receiving information from the device and sending information to the device. Received information is packaged inside an event object, which is posted to listeners that are registered with the adapter.
  • Filters are used in the middle of the event chain to remove noise, such as excessive read events, or to manipulate event objects received from an adapter. Filters post event objects to connectors.
  • Connectors (also called loggers) reside at the end of the event chain to collect and augment data for back-end processes or listeners (also called consumers). A back-end process might be the RFID Information Server or a third-party software application.
 
Figure 1: Sun RFID Component Relationships: The figure illustrates the Sun RFID Software module relationships and event flow.

Configuration Object components generate events to communicate with each other. Every component is an event producer and every component can register itself with other components to consume their events.

The Sun Java System RFID Information Server
The RFID Information Server is a J2EE application that captures and queries EPC-related, low-level data and translates it into higher-level business data.

RFID Information Server is typically deployed on a different machine than the RFID Event Manager. The RFID Information Server is built on Jini 2.0, Project Rio 3.1, and the Sun Java System Application Server 8.1.

The Sun Java System RFID Management Console
The Sun Java System RFID Management Console is a Web based application that is used to modify attributes of the RFID Event Manager components and to monitor and manage the status of devices that are connected to the RFID Event Manager.

The diagram in Figure 1 illustrates the relationships between components of the Sun Java System RFID framework.

Obtaining Sun Java System RFID

  1. Download the RFID Software.
  2. Unzip the software to the directory of your choice.
  3. Change to the directory containing the unzipped download file.
  4. Change to the rfidem directory and double-click setup.bat to start the RFID Event Manager installer. The Welcome panel appears.
  5. From the “Welcome” panel, click “Next” and follow the instructions on the panels to perform the installation.
  6. On the “Select Type of Installation” panel, select the “Typical” installation option, and click “Next.”
  7. On the “Select Java Home Location” panel, confirm that the installation selected the top level of the path to your J2SE installation.
  8. On the “Station Location and Group Configuration” panel, type the name or IP address of the host system and a unique Jini group name. The group name must be unique for every control station you set up. The group name gives the control station its identity over the network. The installer defaults the group name to AutoID-hostname. Note that if you are performing this installation in a DHCP environment (such as a laptop), type localhost for the IP address.
  9. When the installation completes, click “Close.”

Running Sun Java System RFID
Starting the RFID Configuration Manager on UNIX

  • Make sure you have superuser or administrator privileges
  • Start the RFID Configuration Manager by executing the rfidconfig script.
    • On Solaris: /opt/SUNWrfid/bin/rfidconfig
    • On Linux: /opt/sun/rfidem/bin/rfidconfig

Starting the RFID Configuration Manager on Microsoft Windows

  • From the Start Menu: Choose Start?> Programs?> Sun Microsystems?> Sun Java System RFID Software?> Configuration Manager.
  • From a command window: Enter C:Program FilesSunRFID Software
    fidemin
    fidconfig.bat

Handling Application-level Events with ALE
Sun Java System RFID offers an abstraction of Application-level Events (ALE) defined by the EPCglobal specification in the com.sun.autoid.ale.AleAPI interface. Classes implementing this interface (you’ll find it in sun-alesvc-common.jar) embody support for handling Application-level Events.

The EPCglobal Application-level Events (ALE) specification (also known as collection and filtering), is a Web service specification with a WSDL file that defines operations to define, configure, and request reports. It also defines an XML schema for reports and report requests.

Sun provides a default implementation of the AleAPI interface in the com.sun.autoid.ale.client.ALEClient class, installed when you select the ALE custom option during installation of the RFID Event Manager. You will find this class in the /rfidem/lib/sun-rfid-common.jar file, where SUN_RFID_HOME is the directory where you installed Sun Java System RFID.

The ALEClient class constantly searches for all readers on the system and maintains an up-to-date list of physical and logical names. The code you’ll see below illustrates how to use the ALEClient class to support the ALE specification.

The Sun Java RFID Software implements an ALE Web service using Java API for XML-based RPC (JAX-RPC). This service acts as an intermediary to a Jini RMI service contained within the RFID Event Manager. Requests and messages sent to this Web service are referred to as “report requests” and “report messages” respectively, and are implemented as Plain old Java objects (POJOs).

The ALE Web service supports three basic modes of interaction with clients: subscription, polling predefined ECSpecs, and polling a new ECSpec.

The following line of code connects to the ALE service specified by the ENDPOINT_ADDRESS parameter:

   ALEClient aleClient = new ALEClient(ENDPOINT_ADDRESS);

The ALE API defines two configuration objects: an Event Cycle Specification (ECSpec) and a Report Specification (ECReportSpec). When interacting with the ALE Web service, you must provide it with an ECSpec (a “define”) that describes an event cycle (the smallest unit of interaction between the ALE Web service and a client) by specifying the boundary (when to start and stop collecting data), the logical readers from which to receive data, and one or more ECReportSpecs. The system collects data during an event cycle. After an event cycle boundary has completed, the system groups and filters the data, and then generates reports.

   private static ECSpec defineECSpec(String specStr,      ALEClient aleClient, String ecSpecName)   {      ECSpec ecSpec = null;         try      {         ecSpec = xmlUtil.getSPEC(specStr);         aleClient.define(ecSpecName, ecSpec);         System.out.println("Define of ECSpec: "            + ecSpecName + " succeeded");      }      catch (Exception e)      {         System.out.println("Define of ECSpec: "            + ecSpecName + " failed");         System.err.println(e.getMessage());      }         return ecSpec;   }      private static void undefineECSpec(ALEClient aleClient,      String ecSpecName)   {      try      {         aleClient.undefine(ecSpecName);         System.out.println("Undefine succeeded");      }      catch (Exception e)      {         System.err.println("ECSpec undefine failed");         System.err.println(e.getMessage());      }   }

The Subscribe mode of interaction requires the ECSpec to be defined ahead of time. Then a client adds a subscription to the ECSpec with which the ALE Web services communicates.

   private static void subscribeECSpec(ALEClient aleClient,      String ecSpecName, String outputFilePath)   {      try      {         aleClient.subscribe(ecSpecName, outputFilePath);         System.out.println("ECSpec: " + ecSpecName            + " subscribe Succeeded");      }      catch (Exception e)      {         System.err.println("ECSpec: " + ecSpecName            + " subscribe failed");         System.err.println(e.getMessage());      }   }      private static void unsubscribeECSpec(ALEClient aleClient,      String ecSpecName, String outputFilePath)   {      try      {         aleClient.unsubscribe(ecSpecName, outputFilePath);         System.out.println("ECSpec: " + ecSpecName            + " unsubscribe succeeded");      }      catch (Exception e)      {         System.err.println("ECSpec: " + ecSpecName             + " unsubscribe failed");         System.err.println(e.getMessage());         }      }

The Immediate mode of interaction demands that the ECSpec must be processed and fulfilled immediately, for example, when the ECSpecs first event cycle boundary completes.

   private static ECReports executeSpecImmediately(      String specStr, ALEClient aleClient)   {      ECReports reports = null;         try      {         ECSpec ecSpec = xmlUtil.getSPEC(specStr);         reports = aleClient.immediate(ecSpec);      }      catch (Exception e)      {         System.err.println("Execute failed");         System.err.println(e.getMessage());      }         return reports;   }

The Poll mode of interaction is similar to Immediate, except that the ECSpec is defined on the server beforehand and given a name, letting clients request data from it using the name rather than continually resending the ECSpec.

   private static ECReports pollForReports(      ALEClient aleClient, String ecSpecName)   {      try      {         return aleClient.poll(ecSpecName);      }      catch (Exception e)      {         System.err.println("Poll reports failed");         System.err.println(e.getMessage());      }         return null;   }

You can retrieve ancillary data and reports from the ALE Web service, as the following methods illustrate.

   private static List retrieveSubscribers(ALEClient aleClient,      String ecSpecName)   {      List subscribers = null;         try      {         subscribers = aleClient.getSubscribers(ecSpecName);      }      catch (Exception e)      {         System.err.println("ECSpec: " + ecSpecName            + " subscribers retrieval failed");         System.err.println(e.getMessage());      }         return subscribers;   }      private static ECSpec retrieveSpec(ALEClient aleClient,      String ecSpecName)   {      ECSpec ecSpec = null;         try      {         ecSpec = aleClient.getECSpec(ecSpecName);      }      catch (Exception e)      {         System.err.println("ECSpec retrieval for "            + ecSpecName + " failed");         System.err.println(e.getMessage());      }         return ecSpec;   }      private static List getSpecNames(ALEClient aleClient)   {      try      {         List specNames = aleClient.getECSpecNames();         return specNames;      }      catch (Exception e)      {         System.err.println("SpecNames fetch failed");         System.err.println(e.getMessage());      }         return new ArrayList();   }      private static String getVendorVersion(ALEClient aleClient)   {      try      {         return aleClient.getVendorVersion();      }      catch (Exception e)      {         System.err.println("VendorVersion failed");         System.err.println(e.getMessage());      }         return "";   }      private static String getStandardVersion(ALEClient aleClient)   {      try      {         return aleClient.getStandardVersion();      }      catch (Exception e)      {         System.err.println("StandardVersion failed");         System.err.println(e.getMessage());      }         return "";   }

Sample ECSpec Schema Implementation
The following listing illustrates a sample of a static ECSpec that could be sent to the ALE Web service in a “define” interaction.

                        PMLReader                           2000         1000                                                                     

As you can see, much of the developer work involves configuration and (rightfully) determining actions to take when RFID events occur. Otherwise, Sun Java System RFID Software provides an RFID infrastructure framework for integrating data and RFID-enabled devices. The framework acts as middleware to bridge the gap between RFID devices and enterprise application systems. You can capitalize on the Sun Java System RFID Software system to build applications that can, among other things, facilitate asset tracking, enforce policy compliance, detect tampering, and prevent crime.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist