📄 package-summary.html
字号:
Authority factories for the <A HREF="http://www.epsg.org">EPSG</A> database. <P ALIGN="justify">EPSG codes are numerical identifiers. For example "4326" is the EPSG identifier for the "WGS 84" geographic CRS. However, the default implementation accepts names as well as numeric identifiers. For example "<cite>NTF (Paris) / France I</cite>" and both fetchs the same object. Note that 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.</P> <P ALIGN="justify">An EPSG authority factory is created using the following code:</P> <BLOCKQUOTE><CODE>CRSAuthorityFactory factory = <A HREF="../../../../../org/geotools/referencing/FactoryFinder.html" title="class in org.geotools.referencing">FactoryFinder</A>.getCRSAuthorityFactory("EPSG", null);</CODE></BLOCKQUOTE> <P ALIGN="justify">This package provides the general framework for accessing an EPSG database, but the actual connection to a database requires the existence of an EPSG plugin in the classpath. Otherwise, a <A HREF="../../../../../org/geotools/factory/FactoryNotFoundException.html" title="class in org.geotools.factory"><CODE>FactoryNotFoundException</CODE></A> will be thrown. Available plugins are:</P> <TABLE ALIGN="center" BORDER="1" CELLPADDING="3"> <TR> <TH>Required software</TH> <TH>Data source</TH> <TH>Plugin / JAR file</TH> <TH>Additional notes</TH> </TR> <TR> <TD>MS-Access ODBC driver</TD> <TD><A HREF="../../../../../org/geotools/referencing/factory/epsg/AccessDataSource.html" title="class in org.geotools.referencing.factory.epsg"><CODE>AccessDataSource</CODE></A></TD> <TD></TD> <TD>See <A HREF="doc-files/Access.html">installation instructions</A></TD> </TR> <TR> <TD>HSQL embedded database</TD> <TD><A HREF="../../../../../org/geotools/referencing/factory/epsg/HSQLDataSource.html" title="class in org.geotools.referencing.factory.epsg"><CODE>HSQLDataSource</CODE></A></TD> <TD></TD> <TD><A HREF="doc-files/HSQL.html">Note for module mainteners</A></TD> </TR> <TR> <TD>PostgreSQL database</TD> <TD><A HREF="../../../../../org/geotools/referencing/factory/epsg/PostgreDataSource.html" title="class in org.geotools.referencing.factory.epsg"><CODE>PostgreDataSource</CODE></A></TD> <TD></TD> <TD><A HREF="doc-files/PostgreSQL.html">Note for module mainteners</A></TD> </TR> </TABLE> <P> </P> <H2>How to create a custom data source</H2> <P ALIGN="justify">For getting the EPSG factory to uses a custom connection, create some subclass that implements Geotools's <A HREF="../../../../../org/geotools/referencing/factory/epsg/DataSource.html" title="interface in org.geotools.referencing.factory.epsg"><CODE>DataSource</CODE></A> interface. For example:</P> <BLOCKQUOTE><TABLE border="2" width="100%"><TR><TD><PRE><B>import</B> org.postgresql.ds.PGSimpleDataSource;<B>import</B> org.geotools.factory.Hints;<B>import</B> org.geotools.referencing.factory.AbstractAuthorityFactory;<B>import</B> org.geotools.referencing.factory.epsg.DataSource;<B>public</B> MyDataSource <B>extends</B> PGSimpleDataSource <B>implements</B> <A HREF="../../../../../org/geotools/referencing/factory/epsg/DataSource.html" title="interface in org.geotools.referencing.factory.epsg">DataSource</A> { <B>public</B> MyDataSource() { setServerName("myserver.com"); setDatabaseName("mydatabase"); } <B>public</B> <B>int</B> getPriority() { <B>return</B> MAXIMUM_PRIORITY - 200; <B>public</B> AbstractAuthorityFactory createFactory(Hints hints) <B>throws</B> SQLException { <B>return</B> <B>new</B> FactoryUsingAnsiSQL(hints, getConnection()); }}</PRE></TD></TR></TABLE></BLOCKQUOTE> <P ALIGN="justify">Then, declare this custom implementation in the following file (for uses by <A HREF="../../../../../org/geotools/factory/FactoryRegistry.html" title="class in org.geotools.factory"><CODE>FactoryRegistry</CODE></A>):</P> <BLOCKQUOTE><PRE>META-INF/services/org.geotools.referencing.factory.epsg.DataSource</PRE></BLOCKQUOTE> <P ALIGN="justify">Just providing a JAR file with the above-cited <A HREF="../../../../../org/geotools/referencing/factory/epsg/DataSource.html" title="interface in org.geotools.referencing.factory.epsg"><CODE>DataSource</CODE></A> implementation and registration is suffisient for an application to connects automatically to the specified server (providing that the relevant JDBC driver is present, of course).</P></LI> <h3>Registration with JNDI (usually J2EE)</h3> <P ALIGN="justify">Installation on Unix systems typically has a database software running on some server rather than the local machine. The administrator will probably have to download the SQL scripts from <A HREF="http://www.epsg.org">http://www.epsg.org</A> and executes it in whatever database software they use (PostgreSQL, MySQL, Oracle, <cite>etc.</cite>). The connection parameters (server URL, user name, <cite>etc.</cite>) can be specified as a <A HREF="../../../../../org/geotools/referencing/factory/epsg/DataSource.html" title="interface in org.geotools.referencing.factory.epsg"><CODE>DataSource</CODE></A> registered with a naming service based on Java Naming and Directory (JNDI) interfaces. Like databases, the naming service is typically located on some server. The data source name for the connection to the EPSG database is <code>{@value}</code>.</P> <UL> <LI><P ALIGN="justify">For setting up a naming service (LDAP, NIS, <cite>etc.</cite>), see the <A HREF="http://java.sun.com/products/jndi/tutorial/trailmap.html">JNDI tutorial</A>.</P></LI> <LI><P ALIGN="justify">For an example of <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/sql/DataSource.html" title="class or interface in javax.sql"><CODE>DataSource</CODE></A> creation with different connection parameters than the default ones, see <A HREF="http://java.sun.com/j2se/1.5/docs/guide/jdbc/bridge.html">New data source implementations in the JDBC-ODBC bridge</A>.</P></LI> <LI><P ALIGN="justify">For <A HREF="http://java.sun.com/j2se/1.4/docs/api/javax/sql/DataSource.html" title="class or interface in javax.sql"><CODE>DataSource</CODE></A> implementations targeting other database softwares, see their JDBC documentation. For example the <A HREF="http://jdbc.postgresql.org">PostgreSQL JDBC</A> provides an basic implementation.</P></LI> </UL><P><P><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../org/geotools/referencing/factory/package-summary.html"><B>PREV PACKAGE</B></A> <A HREF="../../../../../org/geotools/referencing/factory/wms/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright © 1996-2007 <a href="http://www.geotools.org">Geotools</a>. All Rights Reserved.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -