public class PortFactoryManager
extends java.lang.Object
The naming for the objects is not arbitrary. That is, it is possible to find a resource consistently knowing only about the desired resource. For example, Serialfactories are stored by the name of the serial port that they are accessing. This means that any component can find a port for, say "COM1" or "ttyS0" with no other information. The serial ports are keyed with a platform neutral "serial0", "serial1", etc. There is a chance for conflict here, that is, if one component needs the port configured for 9600 baud and another for 1200 baud the descriptor in insufficient to identify these needs. There is no attempt to resolve that problem here since the resolution is application specific. That is, if you really have two devices connected that require different baud rates you need to change the baud rate between reads, which is beyond the scope of this component.
Similarly, active network factories are stored with a has of the port number and target name or address, eg "192.168.5.15:5000". There is a chance for conflict here since no effort is made to equate names/addresses, it is the users responsibility, if it's important, to ensure that the naming scheme is consistent.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
cvsRev |
Constructor and Description |
---|
PortFactoryManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
factoryAvailable(java.lang.String name)
This will let a client know if there is already a factory by that name.
|
PortFactoryInterface |
getFactory(java.lang.String name,
java.lang.Object checkedForDuplication)
Calling this methods inidicates that a component is interested in this
factory and will (presumably) be calling
"checkin/checkout" at some later date to get access to the underlying
resource.
|
static PortFactoryManager |
getPortManager()
This will return the singleton port manager.
|
void |
registerFactory(java.lang.String name,
PortFactoryInterface factory)
This will add a factory for a given name.
|
void |
releaseFactory(java.lang.String name,
java.lang.Object mustHaveBeenAdded)
Once a factory is no longer required, that is, checkin/checkout will no longer be called on this factory,
the reference to the factory should be removed allowing the factory and any underlying resources to be freed.
|
void |
unregisterFactory(java.lang.String name)
This will remove the resource from public access.
|
public static final java.lang.String cvsRev
public boolean factoryAvailable(java.lang.String name)
public PortFactoryInterface getFactory(java.lang.String name, java.lang.Object checkedForDuplication) throws BadParameterException
BadParameterException
public static PortFactoryManager getPortManager()
public void registerFactory(java.lang.String name, PortFactoryInterface factory)
public void releaseFactory(java.lang.String name, java.lang.Object mustHaveBeenAdded) throws BadParameterException
BadParameterException
public void unregisterFactory(java.lang.String name)
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.