com.ibm.sensorevent.model.converter
Class CBEConverter

java.lang.Object
  extended by com.ibm.sensorevent.model.generic.converter.GenericConverter
      extended by com.ibm.sensorevent.model.converter.Converter
          extended by com.ibm.sensorevent.model.converter.CBEConverter
All Implemented Interfaces:
IConverter, IGenericConverter, java.io.Serializable

public class CBEConverter
extends Converter
implements IConverter

The CBEConverter class converts ISensorEvents, XML strings, and CommonBaseEvent (CBE) objects to other formats. Specifically, use the CBEConverter class to convert:

Event XML created by CBEConverter follows the CBE specification, including a limit of 1024 characters for each attribute value. To create event XML without the 1024 character limit, use XMLConverter.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
           
protected  EventFactory eventFactory
          The CommonBaseEvent event factory used to create CommonBaseEvent instances.
static int MAX_LENGTH
           
 
Constructor Summary
CBEConverter()
          Constructs a new CBEConverter.
 
Method Summary
static CBEConverter getInstance()
          Factory method to create a CBEConverter instance.
 CommonBaseEvent toCBE(ISensorEvent event)
          Converts an ISensorEvent instance to a CommonBaseEvent instance.
 CommonBaseEvent toCBE(java.lang.String xml)
          Converts an XML string to a CommonBaseEvent instance.
 ISensorEvent toIBMSensorEvent(CommonBaseEvent cbe)
          Converts a CommonBaseEvent instance to an ISensorEvent instance.
 java.lang.String toXMLString(CommonBaseEvent cbe)
          Converts a CommonBaseEvent instance to an XML string.
 
Methods inherited from class com.ibm.sensorevent.model.generic.converter.GenericConverter
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

MAX_LENGTH

public static final int MAX_LENGTH
See Also:
Constant Field Values

eventFactory

protected EventFactory eventFactory
The CommonBaseEvent event factory used to create CommonBaseEvent instances.

Constructor Detail

CBEConverter

public CBEConverter()
Constructs a new CBEConverter.

Method Detail

getInstance

public static CBEConverter getInstance()
Factory method to create a CBEConverter instance.

Returns:
a new CBEConverter instance.

toCBE

public CommonBaseEvent toCBE(ISensorEvent event)
                      throws SensorEventException
Converts an ISensorEvent instance to a CommonBaseEvent instance.

Returns:
the converted CommonBaseEvent instance
Throws:
SensorEventException - if the ISensorEvent cannot be converted

toCBE

public CommonBaseEvent toCBE(java.lang.String xml)
                      throws SensorEventException
Converts an XML string to a CommonBaseEvent instance.

Returns:
the converted CommonBaseEvent instance
Throws:
SensorEventException - if the XML string cannot be converted

toIBMSensorEvent

public ISensorEvent toIBMSensorEvent(CommonBaseEvent cbe)
                              throws SensorEventException
Converts a CommonBaseEvent instance to an ISensorEvent instance.

Specified by:
toIBMSensorEvent in interface IConverter
Returns:
the converted ISensorEvent instance
Throws:
SensorEventException - if the CommonBaseEvent cannot be converted

toXMLString

public java.lang.String toXMLString(CommonBaseEvent cbe)
                             throws SensorEventException
Converts a CommonBaseEvent instance to an XML string.

Specified by:
toXMLString in interface IConverter
Returns:
the converted XML string
Throws:
SensorEventException - if the CommonBaseEvent cannot be converted


Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.