net.jqhome.jwps.ea
Class EAFactory

java.lang.Object
  |
  +--net.jqhome.jwps.ea.EAFactory

public class EAFactory
extends java.lang.Object

This is the factory you should use to create EAs. It contains all the logic that is applicable. There is only one static method to call, createNewEA and it takes a raw EA object. Typically this is called by the native method for making new objects. This will try to make a standard EA for a given raw EA (such the subject EA). If the EA is not a standard EA, it will then try to create an EA based on the type, such as EAT_MVMT. Failing that, it will return a byte array EA, consisiting of just the name of the EA and the bytes.

The reason for this is that there is no control exercised by OS/2 for writing EAs. It is therefore possible for an application to state it is writing, say, a string EA but fill it up with byte data. If at all possible, this factory will return an EA which you might then have to laboriously parse.

Note: If no factory is set, the default is to use this factory. Be sure to set the factory if needed before the first call.

If you are subclassing this factory, you will need to override all of the newEA methods. These are what control the functionality of this class and therefore the creation of EAs.


Constructor Summary
EAFactory()
           
 
Method Summary
static AbstractEA createNewEA(PendingDOMEA pEA)
          Wrapper method.
static AbstractEA createNewEA(RawEA rawEA)
          Wrapper method.
static int getEAType(java.lang.String eaType)
          Returns the EA type from a string, e.g.
static EAFactory getFactory()
          Gets the factory to use.
static java.lang.String getTypeString(int type)
          Converts the numeric type to a string.
static AbstractEA newEA(PendingDOMEA pEA)
          This creates a new EA from a pending one.
static AbstractEA newEA(RawEA rawEA)
          The method that is charged with creating EAs from their raw data.
static void setFactory(EAFactory eaFactory)
          Setter for the EAFactory or subclass thereof to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EAFactory

public EAFactory()
Method Detail

setFactory

public static void setFactory(EAFactory eaFactory)
Setter for the EAFactory or subclass thereof to use. If you do not set a factory before your first calls to FileEAs then the default factory (this class) will be used.


getFactory

public static EAFactory getFactory()
Gets the factory to use.


newEA

public static AbstractEA newEA(RawEA rawEA)
                        throws JWPException
The method that is charged with creating EAs from their raw data.

JWPException

newEA

public static AbstractEA newEA(PendingDOMEA pEA)
                        throws JWPException
This creates a new EA from a pending one. Pending EAs are objects that are made in the course of parsing the XML format of an EA.

JWPException

createNewEA

public static AbstractEA createNewEA(RawEA rawEA)
                              throws JWPException
Wrapper method. This just calls the corresponding newEA method.

JWPException

createNewEA

public static AbstractEA createNewEA(PendingDOMEA pEA)
                              throws JWPException
Wrapper method. This just calls the corresponding newEA method.

JWPException

getEAType

public static int getEAType(java.lang.String eaType)
                     throws JWPException
Returns the EA type from a string, e.g. if the argument is EAT_ASCII then the integer value for that type will be returned.

JWPException

getTypeString

public static java.lang.String getTypeString(int type)
Converts the numeric type to a string. This is useful when formatting output an is required for converting an EA to its XML format.