com.sibvisions.rad.server.protocol
Class ProtocolFactory

java.lang.Object
  extended by com.sibvisions.rad.server.protocol.ProtocolFactory

public abstract class ProtocolFactory
extends java.lang.Object

The ProtocolFactory is responsible for an IProtocolWriter. It defines the creation of the writer instance, via createWriter(). The factory itself doesn't create a writer, because it's abstract and delegates the creation to a concrete implementation, because creating protocols may depend on OS or runtime environment.


Constructor Summary
protected ProtocolFactory()
          Invisible constructor, because the ProtocolFactory is a utility class.
 
Method Summary
abstract  IProtocolWriter createWriter()
          Creates a new instance of IProtocolWriter.
static ProtocolFactory getInstance()
          Gets the current factory instance.
static IProtocolWriter getWriter()
          Construct (if necessary) and return an IProtocolWriter instance, using the factory's current set of configuration attributes.
static void init(java.lang.String pClassName)
          Creates and sets a new instance of ProtocolFactory.
static Record openRecord(java.lang.String pCommand, java.lang.Object... pParameter)
          Opens a protocol record via getWriter().
static Record openRecord(java.lang.String pCategory, java.lang.String pCommand, java.lang.Object... pParameter)
          Opens a protocol record via getWriter().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolFactory

protected ProtocolFactory()
Invisible constructor, because the ProtocolFactory is a utility class.

Method Detail

createWriter

public abstract IProtocolWriter createWriter()
Creates a new instance of IProtocolWriter.

Returns:
the writer

init

public static void init(java.lang.String pClassName)
Creates and sets a new instance of ProtocolFactory. If the pClassName was not found then the factory won't be initialized.

Parameters:
pClassName - the protocol factory implementation

getInstance

public static ProtocolFactory getInstance()
Gets the current factory instance.

Returns:
the current factory instnance or null if no instance was initialized
See Also:
init(String)

getWriter

public static IProtocolWriter getWriter()
Construct (if necessary) and return an IProtocolWriter instance, using the factory's current set of configuration attributes.

Returns:
the writer or null if factory was not initialized
See Also:
init(String)

openRecord

public static Record openRecord(java.lang.String pCommand,
                                java.lang.Object... pParameter)
Opens a protocol record via getWriter().

Parameters:
pCommand - the command
pParameter - additional parameter
Returns:
the record

openRecord

public static Record openRecord(java.lang.String pCategory,
                                java.lang.String pCommand,
                                java.lang.Object... pParameter)
Opens a protocol record via getWriter().

Parameters:
pCategory - the protocol category
pCommand - the command
pParameter - additional parameter
Returns:
the record


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.