net.sourceforge.fluxion.datasource.impl
Class BeanModelDataSourceFactory

java.lang.Object
  extended by net.sourceforge.fluxion.datasource.impl.BeanModelDataSourceFactory

public class BeanModelDataSourceFactory
extends java.lang.Object

Factory for constructing new Datasources given a url to a jar file that represents the datasource.

Author:
Tony Burdett

Constructor Summary
BeanModelDataSourceFactory()
          Default constructor for the factory that produces bean modelling datasources.
BeanModelDataSourceFactory(java.lang.ClassLoader classLoader)
          Constructor for the factory that produces bean modelling datasources.
 
Method Summary
 boolean addAdditionalDataSource(java.net.URL datasourceJarURL)
          Adds an extra URL to the factory, so that additional datasources can be loaded from outside the current classloader.
 void clearAdditionalDataSources()
          Clears the set of urls from which additional datasources are loaded
 java.util.Set<DataSource> createDataSources()
          Creates all datasources found either in the current classloader or at any of the additional locations specified by getAdditionalDataSources().
 java.util.Set<java.net.URL> getAdditionalDataSources()
          Returns the list of urls that is currently configured as additional datasource locations
 java.lang.ClassLoader getFactoryClassLoader()
          Returns the classloader this factory is currently configured with.
 boolean removeAdditionalDataSource(java.net.URL datasourceJarURL)
          Removes a URL to the factory, so that additional datasources will not be loaded from outside the current classloader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanModelDataSourceFactory

public BeanModelDataSourceFactory()
Default constructor for the factory that produces bean modelling datasources. Note that this will by default load all datasources on the current classpath.


BeanModelDataSourceFactory

public BeanModelDataSourceFactory(java.lang.ClassLoader classLoader)
Constructor for the factory that produces bean modelling datasources. This will load datasources from the given classloader.

Parameters:
classLoader - the classloader to load datasources from
Method Detail

addAdditionalDataSource

public boolean addAdditionalDataSource(java.net.URL datasourceJarURL)
Adds an extra URL to the factory, so that additional datasources can be loaded from outside the current classloader. createDataSources() will then generate datasources for all datasources found in the current classloader or jar files at the additional urls specified.

Parameters:
datasourceJarURL - the url to load additional datasources from
Returns:
true if the add operation succeeds

removeAdditionalDataSource

public boolean removeAdditionalDataSource(java.net.URL datasourceJarURL)
Removes a URL to the factory, so that additional datasources will not be loaded from outside the current classloader. createDataSources() will generate datasources for all datasources found in the current classloader or jar files at the additional urls specified, but no longer including this one.

Parameters:
datasourceJarURL - the url to remove from datasources generation
Returns:
true if the remove operation succeeds

clearAdditionalDataSources

public void clearAdditionalDataSources()
Clears the set of urls from which additional datasources are loaded


getFactoryClassLoader

public java.lang.ClassLoader getFactoryClassLoader()
Returns the classloader this factory is currently configured with. Any datasources found in this classloader will be included in datasource creation

Returns:
the classloader for this factory

getAdditionalDataSources

public java.util.Set<java.net.URL> getAdditionalDataSources()
Returns the list of urls that is currently configured as additional datasource locations

Returns:
the currently configured list of additional datasources

createDataSources

public java.util.Set<DataSource> createDataSources()
                                            throws DataSourceException
Creates all datasources found either in the current classloader or at any of the additional locations specified by getAdditionalDataSources().

Returns:
the set of datasources generated
Throws:
DataSourceException - if there is a problem generating new datasources


Copyright © 2010. All Rights Reserved.