The main changes in those commits are:
AS FILE
as been changed to AS FILEREF
.
The issue here is that FILE
is a reserved keyword in Oracle database. This can be seen on the
Oracle Database Reserved Words page (verified December 14, 2015).
Once we know that FILE
is a reserved keyword, the name chosen as a substitute (FILEREF
in this commit) is irrelevant.
In SIS, we use PARAM_FILE
by analogy with the PARAMETERFILE
keyword defined in ISO 19162 (WKT 2) for the same thing.FactoryUsingSQL
as DirectEpsgFactory
and DefaultFactory
as ThreadedEpsgFactory
.
Apache SIS use different class names: EPSGDataAccess
and a subclass of EPSGFactory
respectively.adaptSQL
method. We reworded this comment in SIS.Command line:
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r25800:25940 https://svn.osgeo.org/geotools/trunk/modules/library/referencing/src/main/java/org/geotools/referencing/factory/epsg/DirectEpsgFactory.java
Revision 25800 | Revision 25940 |
---|---|
import org.geotools.referencing.factory.AbstractAuthorityFactory;
import org.geotools.referencing.factory.DirectAuthorityFactory;
import org.geotools.referencing.factory.IdentifiedObjectFinder;
import org.geotools.referencing.factory.FactoryGroup;
import org.geotools.referencing.NamedIdentifier;
import org.geotools.referencing.datum.DefaultGeodeticDatum;
import org.geotools.referencing.datum.BursaWolfParameters; |
import org.geotools.referencing.factory.AbstractAuthorityFactory; import org.geotools.referencing.factory.DirectAuthorityFactory; import org.geotools.referencing.factory.IdentifiedObjectFinder; import org.geotools.referencing.NamedIdentifier; import org.geotools.referencing.datum.DefaultGeodeticDatum; import org.geotools.referencing.datum.BursaWolfParameters; |
/** * Default implementation for a coordinate reference system factory backed by the EPSG database. * The EPSG database is freely available at <A HREF="http://www.epsg.org">http://www.epsg.org</a>. * Current version of this class requires EPSG database version 6.6 or above. * <p> * This factory doesn't cache any result. Any call to a {@code createFoo} method will send a new * query to the EPSG database. For caching, this factory should be wrapped in some buffered factory * like {@link DefaultFactory}. * <p> * This factory accepts names as well as numerical identifiers. For example * "<cite>NTF (Paris) / France I</cite>" and {@code "27581"} both fetchs the same object. * However, names may be ambiguous since the same name may be used for more than one object. * This is the case of "WGS 84" for example. If such an ambiguity is found, an exception |
/** * A coordinate reference system factory backed by the EPSG database tables. * <p> * The EPSG database is freely available at <A HREF="http://www.epsg.org">http://www.epsg.org</a>. * Current version of this class requires EPSG database version 6.6 or above. * <p> * This factory doesn't cache any result. Any call to a {@code createFoo} method will send a new * query to the EPSG database. For caching, this factory should be wrapped in some buffered factory * like {@link ThreadedEpsgFactory}. * <p> * This class is abstract - please see the subclasses for dialect specific implementations: * <ul> * <li>{@link AccessDialectEpsgFactory} * <li>{@link OracleDialectEpsgFactory} * <li>{@link OracleDialectEpsgFactory} * <li>{@link PostgreSQLDialectEpsgFactory} * </ul> * These factories accepts names as well as numerical identifiers. For example * "<cite>NTF (Paris) / France I</cite>" and {@code "27581"} both fetchs the same object. * However, names may be ambiguous since the same name may be used for more than one object. * This is the case of "WGS 84" for example. If such an ambiguity is found, an exception |
* will be thrown. If names are not wanted as a legal EPSG code, subclasses can override the * {@link #isPrimaryKey} method. * <p> * This factory uses the MS-Access dialect of SQL, because the primary distribution format for the * EPSG database is MS-Access. For translating this SQL dialect into an other one, subclasses * should override the {@link #adaptSQL} method. * * @since 2.1 * @source $URL$ |
* will be thrown. If names are not wanted as a legal EPSG code, subclasses can override the * {@link #isPrimaryKey} method. * <p> * * @since 2.1 * @source $URL$ |
* @author Matthias Basler
* @author Andrea Aime
*/
public class FactoryUsingSQL extends DirectAuthorityFactory
implements CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory,
CoordinateOperationAuthorityFactory
{ |
* @author Matthias Basler
* @author Andrea Aime
*/
public abstract class DirectEpsgFactory extends DirectAuthorityFactory
implements CRSAuthorityFactory, CSAuthorityFactory, DatumAuthorityFactory,
CoordinateOperationAuthorityFactory
{ |
/**
* The name of the thread to execute at JVM shutdown. This thread will be created
* by {@link DefaultFactory} on registration. It will be checked by {@link #dispose}
* in order to determine if we are in the process for shutting down the database engine.
*/
static final String SHUTDOWN_THREAD = "EPSG factory shutdown"; |
/**
* The name of the thread to execute at JVM shutdown. This thread will be created
* by {@link ThreadedEpsgFactory} on registration. It will be checked by {@link #dispose}
* in order to determine if we are in the process for shutting down the database engine.
*/
static final String SHUTDOWN_THREAD = "EPSG factory shutdown"; |
* the sets. The {@link AuthorityCodes} reference in this map is then cleared by the garbage
* collector. The {@link #canDispose} method checks if there is any remaining live reference
* in this map, and returns {@code false} if some are found (thus blocking the call to
* {@link #dispose} by the {@link DefaultFactory} timer).
*/
private final Map/*<Class,Reference<AuthorityCodes>>*/ authorityCodes = new HashMap(); |
* the sets. The {@link AuthorityCodes} reference in this map is then cleared by the garbage
* collector. The {@link #canDispose} method checks if there is any remaining live reference
* in this map, and returns {@code false} if some are found (thus blocking the call to
* {@link #dispose} by the {@link ThreadedEpsgFactory} timer).
*/
private final Map/*<Class,Reference<AuthorityCodes>>*/ authorityCodes = new HashMap(); |
/**
* The buffered authority factory, or {@code this} if none. This field is set
* to a different value by {@link DefaultFactory} only, which will point toward a
* buffered factory wrapping this {@code FactoryUsingSQL} for efficienty.
*/
AbstractAuthorityFactory buffered = this; |
/**
* The buffered authority factory, or {@code this} if none. This field is set
* to a different value by {@link ThreadedEpsgFactory} only, which will point toward a
* buffered factory wrapping this {@code FactoryUsingSQL} for efficienty.
*/
AbstractAuthorityFactory buffered = this; |
*
* @since 2.2
*/
public FactoryUsingSQL(final Hints userHints, final Connection connection) {
super(userHints, MAXIMUM_PRIORITY-20);
// The following hints have no effect on this class behaviour,
// but tell to the user what this factory do about axis order. |
*
* @since 2.2
*/
public DirectEpsgFactory(final Hints userHints, final Connection connection) {
super(userHints, MAXIMUM_PRIORITY-20);
// The following hints have no effect on this class behaviour,
// but tell to the user what this factory do about axis order. |
statement.close();
} catch (SQLException exception) {
org.geotools.util.Logging.unexpectedException(LOGGER.getName(),
FactoryUsingSQL.class, "getAuthority", exception);
return Citations.EPSG;
}
return authority; |
statement.close();
} catch (SQLException exception) {
org.geotools.util.Logging.unexpectedException(LOGGER.getName(),
DirectEpsgFactory.class, "getAuthority", exception);
return Citations.EPSG;
}
return authority; |
} catch (NumberFormatException exception) {
// Not a fatal error...
org.geotools.util.Logging.unexpectedException(LOGGER.getName(),
FactoryUsingSQL.class, "createDatum", exception);
}
final DatumFactory factory = factories.getDatumFactory();
final Datum datum; |
} catch (NumberFormatException exception) {
// Not a fatal error...
org.geotools.util.Logging.unexpectedException(LOGGER.getName(),
DirectEpsgFactory.class, "createDatum", exception);
}
final DatumFactory factory = factories.getDatumFactory();
final Datum datum; |
*/
final PreparedStatement units = prepareStatement("ParameterUnit",
"SELECT MIN(UOM_CODE) AS UOM,"
+ " MIN(PARAM_VALUE_FILE_REF) AS FILE"
+ " FROM [Coordinate_Operation Parameter Value]"
+ " WHERE (PARAMETER_CODE = ?)"
+ " GROUP BY UOM_CODE" |
*/
final PreparedStatement units = prepareStatement("ParameterUnit",
"SELECT MIN(UOM_CODE) AS UOM,"
+ " MIN(PARAM_VALUE_FILE_REF) AS FILEREF"
+ " FROM [Coordinate_Operation Parameter Value]"
+ " WHERE (PARAMETER_CODE = ?)"
+ " GROUP BY UOM_CODE" |
/**
* Returns a set of authority codes that <strong>may</strong> identify the same object
* than the specified one. This implementation tries to get a smaller set than what
* {@link FactoryUsingSQL#getAuthorityCodes} would produce.
*/
//@Override
protected Set getCodeCandidates(final IdentifiedObject object) throws FactoryException { |
/**
* Returns a set of authority codes that <strong>may</strong> identify the same object
* than the specified one. This implementation tries to get a smaller set than what
* {@link DirectEpsgFactory#getAuthorityCodes} would produce.
*/
//@Override
protected Set getCodeCandidates(final IdentifiedObject object) throws FactoryException { |
* Invoked when a new {@link PreparedStatement} is about to be created from a SQL string. * Since the <A HREF="http://www.epsg.org">EPSG database</A> is available mainly in MS-Access * format, SQL statements are formatted using some syntax specific to this particular database * software (for example "<code>SELECT * FROM [Coordinate Reference System]</code>"). If the * EPSG database is ported to an other software, then this method should be overridden in order * to adapt the SQL syntax. For example a subclass connecting to a * <cite>PostgreSQL</cite> database could replace all spaces (" ") between * watching braces ("[" and "]") by underscore ("_"). * * @param statement The statement in MS-Access syntax. * @return The SQL statement to use. The default implementation returns the string unchanged. */ protected String adaptSQL(final String statement) { return statement; } /** * Returns {@code true} if the specified code may be a primary key in some table. This method |
* Invoked when a new {@link PreparedStatement} is about to be created from a SQL string. * Since the <A HREF="http://www.epsg.org">EPSG database</A> is available mainly in MS-Access * format, SQL statements are formatted using some syntax specific to this particular database * software (for example "<code>SELECT * FROM [Coordinate Reference System]</code>"). When * prociding subclass targeting another database vendor, then this method should be overridden * in order to adapt the local SQL syntax. * <p> * For example a subclass connecting to a <cite>PostgreSQL</cite> database could replace * all spaces (" ") between watching braces ("[" and "]") by underscore ("_"). * </p> * @param statement The statement in MS-Access syntax. * @return The SQL statement to use. The default implementation returns the string unchanged. */ abstract protected String adaptSQL(final String statement); /** * Returns {@code true} if the specified code may be a primary key in some table. This method |
/**
* Returns {@code true} if it is safe to dispose this factory. This method is invoked indirectly
* by {@link DefaultFactory} after some timeout in order to release resources. This method will
* block the disposal if some {@linkplain #getAuthorityCodes set of authority codes} are still
* in use.
*/ |
/**
* Returns {@code true} if it is safe to dispose this factory. This method is invoked indirectly
* by {@link ThreadedEpsgFactory} after some timeout in order to release resources. This method will
* block the disposal if some {@linkplain #getAuthorityCodes set of authority codes} are still
* in use.
*/ |
}
/**
* Shutdown the database engine. This method is invoked twice by {@link DefaultFactory}
* at JVM shutdown: one time before the {@linkplain #connection} is closed, and a second
* time after. This shutdown hook is usefull for <cite>embedded</cite> database engine
* starting a server process in addition to the client process. Just closing the connection |
}
/**
* Shutdown the database engine. This method is invoked twice by {@link ThreadedEpsgFactory}
* at JVM shutdown: one time before the {@linkplain #connection} is closed, and a second
* time after. This shutdown hook is usefull for <cite>embedded</cite> database engine
* starting a server process in addition to the client process. Just closing the connection |