📄 transaction.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.4.2_13) on Tue Jun 05 11:36:23 GMT-05:00 2007 --><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>Transaction (Geotools 2.3.x 2.3.2 API)</TITLE><META NAME="keywords" CONTENT="org.geotools.data.Transaction interface"><META NAME="keywords" CONTENT="AUTO_COMMIT"><META NAME="keywords" CONTENT="getProperty()"><META NAME="keywords" CONTENT="getAuthorizations()"><META NAME="keywords" CONTENT="putState()"><META NAME="keywords" CONTENT="removeState()"><META NAME="keywords" CONTENT="getState()"><META NAME="keywords" CONTENT="commit()"><META NAME="keywords" CONTENT="rollback()"><META NAME="keywords" CONTENT="addAuthorization()"><META NAME="keywords" CONTENT="putProperty()"><META NAME="keywords" CONTENT="close()"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="Transaction (Geotools 2.3.x 2.3.2 API)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" 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_top_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="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Transaction.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/data/Repository.html" title="interface in org.geotools.data"><B>PREV CLASS</B></A> <A HREF="../../../org/geotools/data/Transaction.State.html" title="interface in org.geotools.data"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A> <A HREF="Transaction.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><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.geotools.data</FONT><BR>Interface Transaction</H2><DL><DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../org/geotools/data/DefaultTransaction.html" title="class in org.geotools.data">DefaultTransaction</A></DD></DL><HR><DL><DT>public interface <B>Transaction</B></DL><P>The controller for Transaction with FeatureStore. <p> Shapefiles, databases, etc. are safely modified with the assistance of this interface. Transactions are also to provide authorization when working with locked features. </p> <p> All opperations are considered to be working against a Transaction. Transaction.AUTO_COMMIT is used to represent an immidiate mode where requests are immidately commited. </p> <p> For more information please see DataStore and FeatureStore. </p> <p> Example Use: </p> <pre><code> Transaction t = new DefaultTransaction("handle"); t.putProperty( "hint", new Integer(7) ); try { FeatureStore road = (FeatureStore) store.getFeatureSource("road"); FeatureStore river = (FeatureStore) store.getFeatureSource("river"); road.setTransaction( t ); river.setTransaction( t ); t.addAuthorization( lockID ); // provide authoriztion road.removeFeatures( filter ); // opperate against transaction river.removeFeature( filter ); // opperate against transaction t.commit(); // commit opperations } catch (IOException io){ t.rollback(); // cancel opperations } finally { t.close(); // free resources } </code></pre> <p> Example code walkthrough from the (perspective of Tranasction): </p> <ol> <li>A new transaction is created (an instanceof DefaultTransaction with a handle)</li> <li>A hint is provided using Transaction.putProperty( key, value )</li> <li>Transaction is provided to two FeatureStores, this may result in Transaction.State instances being registered</li> <ul> <li>TransactionStateDiff (stored by DataStore): Used for in memory locking is used by many DataStore's (like ShapefileDataStore). Lazy creation by AbstractDataStore.state(transaction). </li> <li>JDBCTransactionState (stored by ConnectionPool): Used to manage connection rollback/commit. Lazy creation as part of JDBCDataStore.getConnection(transaction). </li> <li>InProcessLockingManager.FeatureLock (stored by LockingManger): Used for per transaction FeatureLocks, used to free locked features on Transaction commit/rollback. </li> </ul> These instances of Transaction state may make use of any hint provided to Transaction.putProperty( key, value ) when they are connected with Transaction.State.setTransaction( transaction ). <li>t.addAuthorization(lockID) is called, each Transaction.State has its addAuthroization(String) callback invoked with the value of lockID</li> <li>FeatureStore.removeFeatures methods are called on the two DataStores. <ul> <li>PostgisFeatureStore.removeFeatures(fitler) handles opperation without delegation. </li> <li>Most removeFeature(filter) implementations use the implementation provided by AbstractFeatureStore which delegates to FeatureWriter. </li> </ul> Any of these opperations may make use of the Transaction.putProperty( key, value ). <li>The transaction is commited, all of the Transaction.State methods have there Transaction.State.commit() methods called gicing them a chance to applyDiff maps, or commit various connections. </li> <li>The transaction is closed, all of the Transaction.State methods have there Transaction.State.setTransaction( null ) called, giving them a chance to clean up diffMaps, or return connections to the pool. </li> </ol><P><P><DL><DT><B>Author:</B></DT> <DD>Jody Garnett, Chris Holmes, TOPP</DD><DT><B>Module:</B></DT><DD><CODE><B>module/api</B></CODE> (<A HREF="http://maven.geotools.fr/repository/org/geotools/gt2-api/"><CODE>gt2-api.jar</CODE></A>) (<A HREF="http://maven.geotools.fr/reports/api/index.html">Maven report</A>) (<A HREF="http://svn.geotools.org/geotools/tags/2.3.2/module/api/src/org/geotools/data/Transaction.java">SVN head</A>)</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Nested Class Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static interface</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.State.html" title="interface in org.geotools.data">Transaction.State</A></B></CODE><BR> DataStore implementations can use this interface to externalize the state they require to implement Transaction Support. </TD></TR></TABLE> <!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../org/geotools/data/Transaction.html" title="interface in org.geotools.data">Transaction</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#AUTO_COMMIT">AUTO_COMMIT</A></B></CODE><BR> Represents AUTO_COMMIT Mode</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#addAuthorization(java.lang.String)">addAuthorization</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> authID)</CODE><BR> Provides an Authorization ID for this Transaction. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#close()">close</A></B>()</CODE><BR> Provides an oppertunity for a Transaction to free an State it maintains. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#commit()">commit</A></B>()</CODE><BR> Makes all transactions made since the previous commit/rollback permanent. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#getAuthorizations()">getAuthorizations</A></B>()</CODE><BR> List of Authorizations IDs held by this transaction. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#getProperty(java.lang.Object)">getProperty</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</CODE><BR> Retrive a Transaction property held by this transaction. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/geotools/data/Transaction.State.html" title="interface in org.geotools.data">Transaction.State</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#getState(java.lang.Object)">getState</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</CODE><BR> Allows DataStores to squirel away information( and callbacks ) for later. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#putProperty(java.lang.Object, java.lang.Object)">putProperty</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> value)</CODE><BR> Provides a Transaction property for this Transasction. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#putState(java.lang.Object, org.geotools.data.Transaction.State)">putState</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key, <A HREF="../../../org/geotools/data/Transaction.State.html" title="interface in org.geotools.data">Transaction.State</A> state)</CODE><BR> Allows FeatureSource to squirel away information( and callbacks ) for later. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#removeState(java.lang.Object)">removeState</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</CODE><BR> Allows FeatureSources to clean up information ( and callbacks ) they earlier provided. </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/geotools/data/Transaction.html#rollback()">rollback</A></B>()</CODE><BR> Undoes all transactions made since the last commit or rollback. </TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -