com.sap.ip.me.api.pios.connection
Class Connector

java.lang.Object
  extended bycom.sap.ip.me.api.pios.connection.Connector

public abstract class Connector
extends java.lang.Object

This class is the entry point to all peripheral connections. This class will be the factory providing instances of all peripherals supported by the PIOS layer. Uses connection parameters to find and open a particular connection to a desired peripheral service. The connection parameters define what service is requested and the initial configuration options.

The normal use of the Connector class to open a connection to a printer is as follows:
 
	Connector conn = Connector.getInstance();
 
	DriverInfo[] driverInfo = conn.listDrivers(ConnectionType.PRINTER);
 
	PrinterParameters params = new PrinterParameters(driverInfo[0]);
 
	PrinterConnection pt = (PrinterConnection) conn.open(params);
 
	//Add the printer code here
 
	pt.close();
 
 

Since:
MI 2.5
Author:
Abaco
See Also:
Connection, ConnectionParameters

Field Summary
static java.lang.String CONNECTOR_IMPL_KEY
          Constant for the name of the key used to specify an alternate connector implementation.
 
Constructor Summary
protected Connector()
          Constructs a new Connector object.
 
Method Summary
abstract  void clearDefaultDriver(ConnectionType connectionType)
          Clear the default driver for an specific connection type.
abstract  boolean deleteTraceFiles()
          Delete all trace log files.
protected abstract  ConfigurationManager getConfigurationManager(java.lang.String metaDataFile, java.lang.String configFile)
          This method is used internally to obtain the configuration manager implementation instance.
abstract  DriverInfo getDefaultDriver(ConnectionType connectionType)
          Returns the default driver for an specific connection type.
static Connector getInstance()
          Returns the connector implementation.
abstract  DriverInfo[] listDrivers(ConnectionType connectionType)
          Returns the installed PIOS drivers for the specified connection type.
abstract  Connection open(ConnectionParameters parameters)
          Opens a connection to a peripheral based on the parameters.
abstract  void setDefaultDriver(DriverInfo driverInfo)
          Sets the default driver for an specific connection type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTOR_IMPL_KEY

public static final java.lang.String CONNECTOR_IMPL_KEY
Constant for the name of the key used to specify an alternate connector implementation.

See Also:
Constant Field Values
Constructor Detail

Connector

protected Connector()
Constructs a new Connector object.

Method Detail

getInstance

public static Connector getInstance()
                             throws PIOSException
Returns the connector implementation.

Returns:
The Connector implementation.
Throws:
PIOSException - thrown if unable to find a Connector implementation

open

public abstract Connection open(ConnectionParameters parameters)
                         throws LibraryNotLoadedException,
                                UnsupportedException,
                                PIOSException
Opens a connection to a peripheral based on the parameters. The parameters must include any information required by the peripheral type. The connector will load and open a specific peripheral using the driver specified in the connection parameters.

Parameters:
parameters - the peripheral connection parameters to use when opening the connection
Returns:
A connection to a peripheral.
Throws:
PIOSException - thrown if an error occurs while creating or opening the peripheral connection
LibraryNotLoadedException - thrown if an error occurs while loading native resources for this connection.
UnsupportedException - thrown if an error occurs while opening the peripheral connection and functionality request thru the ConnectionParameters object is not supported by the driver.
See Also:
ConnectionType, DriverInfo, PIOSException

listDrivers

public abstract DriverInfo[] listDrivers(ConnectionType connectionType)
                                  throws PIOSException,
                                         LibraryNotLoadedException
Returns the installed PIOS drivers for the specified connection type. If no driver is found an empty array is returned.

Parameters:
connectionType - the requested connection type of driver
Returns:
A DriverInfo array containing the installed PIOS drivers that matches the connection type.
Throws:
PIOSException - thrown if an error occurs while listing the drivers
LibraryNotLoadedException - thrown if an error occurs while loading the native layer
See Also:
DriverInfo

getDefaultDriver

public abstract DriverInfo getDefaultDriver(ConnectionType connectionType)
                                     throws PIOSException,
                                            LibraryNotLoadedException
Returns the default driver for an specific connection type. If a default driver has not been specified or has been deleted this method will return null.

Parameters:
connectionType - the connection type for the default driver to find
Returns:
Instance of a DriverInfo with the default driver for the specified connection type.
Throws:
PIOSException - thrown if an error occurs while obtaining the default driver
LibraryNotLoadedException - thrown if an error occurs while loading the native layer

setDefaultDriver

public abstract void setDefaultDriver(DriverInfo driverInfo)
                               throws PIOSException,
                                      LibraryNotLoadedException
Sets the default driver for an specific connection type.

Parameters:
driverInfo - the new default driver
Throws:
PIOSException - thrown if an error occurs while setting the default driver
LibraryNotLoadedException - thrown if an error occurs while loading the native layer

clearDefaultDriver

public abstract void clearDefaultDriver(ConnectionType connectionType)
                                 throws PIOSException
Clear the default driver for an specific connection type.

Parameters:
connectionType - the connection type for the default driver to be clear.
Throws:
PIOSException - thrown if an error occurs while setting the default driver

getConfigurationManager

protected abstract ConfigurationManager getConfigurationManager(java.lang.String metaDataFile,
                                                                java.lang.String configFile)
                                                         throws ConfigurationException
This method is used internally to obtain the configuration manager implementation instance.

Parameters:
metaDataFile - the metadata file name
configFile - the configuration file name
Returns:
An instance of a ConfigurationManager class
Throws:
ConfigurationException - thrown if an error occurs while opening any of the specified files
See Also:
ConfigurationManager

deleteTraceFiles

public abstract boolean deleteTraceFiles()
Delete all trace log files. This method is for internal use only.

Returns:
The status of delete. If all trace log files are deleted, return true. If any one of the trace log files can not be deleted, return false.


Copyright © 2005 SAP AG. All Rights Reserved.