net.sf.farrago.namespace.jdbc
Class MedJdbcForeignDataWrapper

java.lang.Object
  extended by net.sf.farrago.plugin.FarragoAbstractPluginBase
      extended by net.sf.farrago.namespace.impl.MedAbstractBase
          extended by net.sf.farrago.namespace.impl.MedAbstractDataWrapper
              extended by net.sf.farrago.namespace.jdbc.MedJdbcForeignDataWrapper
All Implemented Interfaces:
FarragoMedDataWrapperInfo, FarragoMedDataWrapper, FarragoPlugin, FarragoAllocation, ClosableAllocation

public class MedJdbcForeignDataWrapper
extends MedAbstractDataWrapper

MedJdbcForeignDataWrapper implements the FarragoMedDataWrapper interface by accessing foreign tables provided by any JDBC driver.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/jdbc/MedJdbcForeignDataWrapper.java#20 $
Author:
John V. Sichi

Field Summary
static String PROP_DRIVER_CLASS_NAME
           
 
Fields inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase
BOOLEAN_CHOICES_DEFAULT_FALSE, BOOLEAN_CHOICES_DEFAULT_TRUE, EMPTY_DRIVER_PROPERTIES
 
Constructor Summary
MedJdbcForeignDataWrapper()
          Creates a new data wrapper instance.
 
Method Summary
private  String[] getArtificialSchemas(DatabaseMetaData meta)
           
 String getDescription(Locale locale)
          Obtains a description of this plugin.
 DriverPropertyInfo[] getServerPropertyInfo(Locale locale, Properties wrapperProps, Properties serverProps)
          Obtains information about the properties applicable to server initialization (the props parameter to the newServer method).
 String getSuggestedName()
          Obtains a suggested name for this plugin in the SQL catalog.
 void initialize(FarragoRepos repos, Properties props)
          Initializes this plugin with a given set of properties.
protected  Driver loadDriverClass(String driverClassName)
           
 FarragoMedDataServer newServer(String serverMofId, Properties props)
          Creates an instance of this wrapper for a particular server.
 
Methods inherited from class net.sf.farrago.namespace.impl.MedAbstractDataWrapper
closeAllocation, getColumnPropertyInfo, getColumnSetPropertyInfo, getLibraryName, getPluginPropertyInfo, getProperties, getRepos, isForeign, setLibraryName, supportsServerSharing
 
Methods inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase
getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getShortProperty, requireProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_DRIVER_CLASS_NAME

public static final String PROP_DRIVER_CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

MedJdbcForeignDataWrapper

public MedJdbcForeignDataWrapper()
Creates a new data wrapper instance.

Method Detail

getSuggestedName

public String getSuggestedName()
Description copied from interface: FarragoPlugin
Obtains a suggested name for this plugin in the SQL catalog.

Returns:
suggested name

getDescription

public String getDescription(Locale locale)
Description copied from interface: FarragoPlugin
Obtains a description of this plugin.

Parameters:
locale - Locale for formatting description
Returns:
localized description

getServerPropertyInfo

public DriverPropertyInfo[] getServerPropertyInfo(Locale locale,
                                                  Properties wrapperProps,
                                                  Properties serverProps)
Description copied from interface: FarragoMedDataWrapperInfo
Obtains information about the properties applicable to server initialization (the props parameter to the newServer method).

Specified by:
getServerPropertyInfo in interface FarragoMedDataWrapperInfo
Overrides:
getServerPropertyInfo in class MedAbstractDataWrapper
Parameters:
locale - Locale for formatting property info
wrapperProps - proposed list of property name/value pairs which will be sent to FarragoPlugin.initialize(net.sf.farrago.catalog.FarragoRepos, java.util.Properties)
serverProps - proposed list of property name/value pairs which will be sent to FarragoMedDataWrapper.newServer(java.lang.String, java.util.Properties)
Returns:
0 or more property info descriptors

initialize

public void initialize(FarragoRepos repos,
                       Properties props)
                throws SQLException
Description copied from interface: FarragoPlugin
Initializes this plugin with a given set of properties. This is called after an uninitialized instance has been created via Class.forName. As much validation as possible should be performed.

Specified by:
initialize in interface FarragoPlugin
Overrides:
initialize in class MedAbstractDataWrapper
Parameters:
repos - FarragoRepos which can be used for metadata access
props - plugin properties
Throws:
SQLException - if plugin initialization is unsuccessful

loadDriverClass

protected Driver loadDriverClass(String driverClassName)

getArtificialSchemas

private String[] getArtificialSchemas(DatabaseMetaData meta)
                               throws SQLException
Throws:
SQLException

newServer

public FarragoMedDataServer newServer(String serverMofId,
                                      Properties props)
                               throws SQLException
Description copied from interface: FarragoMedDataWrapper
Creates an instance of this wrapper for a particular server. This supports the SQL/MED CREATE SERVER statement. The TYPE and VERSION attributes are rolled in with the other properties. As much validation as possible should be performed, including establishing connections if appropriate.

If this wrapper returns false from the isForeign method, then returned server instances must implement the FarragoMedLocalDataServer interface.

Parameters:
serverMofId - MOFID of server definition in repository; this can be used for accessing the server definition from generated code
props - server properties
Returns:
new server instance
Throws:
SQLException - if server connection is unsuccessful