Java Reference
In-Depth Information
javax::datamining::resource
ConnectionFactory
javax::datamining::resource
Connection
Connection dmeConn =
getConnection(...)
getconnection (ConnectionSpec spec):
getconnection (Connection connection)
getconnection () : Connection
...
javax::naming
Referenceable
java::10
Serializable
com::xyz::resource
XYZConnectionFactory
getReference () : Reference
Creates
com::xyz::resource
XYZConnection
getconnection (ConnectionSpec spec):
getconnection (Connection connection)
getconnection () : Connection
...
Figure 8-14
XYZ vendors ConnectionFactory implementation details.
vendor-neutral way. Once the application gets access to the vendor-
specific ConnectionFactory , here the XYZConnectionFactory object, it
can instantiate a vendor-specific implementation of the Connection
object, that is, XYZConnection . This vendor-neutral DME connection
framework enables an application to interact with multiple DME
implementations.
8.4
Object Factories
In JDM, objects are defined as Java interfaces except for enumeration
and exception classes. A vendor must implement the JDM interfaces
to provide an implementation. All object factories inherit from a
common interface called Factory . Factory is defined as a marker inter-
face , that is an interface with no methods to distinguish the factory
objects from the other API objects. An application uses JDM object
factories, which are obtained through the Connection, to instantiate
mining objects. The Connection object serves as an abstract factory that
can create factory objects for any vendor-provided JDM interface
object. The getFactory method in Connection takes an object's class
name as input and creates an associated factory object. For example,
to create a PhysicalDataSetFactory instance, users invoke getFac-
tory(“javax.datamining.data.PhysicalDataSet”) . The abstract factory
pattern nicely hides the details of how the factory object is created by
the vendor-specific implementation.
Figure 8-15 depicts how a client application can create a
vendor-neutral object factory using the abstract factory pattern.
 
Search WWH ::




Custom Search