📄 statefactory.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:37:42 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface StateFactory</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <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/StateFactory.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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/naming/spi/Resolver.html"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="StateFactory.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.naming.spi</FONT><BR>Interface StateFactory</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../javax/naming/spi/DirStateFactory.html">DirStateFactory</A></DD></DL><HR><DL><DT>public interface <B>StateFactory</B></DL><P>This interface represents a factory for obtaining the state of an object for binding.<p> The JNDI framework allows for object implementations to be loaded in dynamically via <em>object factories</em>. For example, when looking up a printer bound in the name space, if the print service binds printer names to <tt>Reference</tt>s, the printer <tt>Reference</tt> could be used to create a printer object, so that the caller of lookup can directly operate on the printer object after the lookup. <p>An <tt>ObjectFactory</tt> is responsible for creating objects of a specific type. In the above example, you may have a <tt>PrinterObjectFactory</tt> for creating <tt>Printer</tt> objects. <p> For the reverse process, when an object is bound into the namespace, JNDI provides <em>state factories</em>. Continuing with the printer example, suppose the printer object is updated and rebound: <blockquote><pre> ctx.rebind("inky", printer); </pre></blockquote> The service provider for <tt>ctx</tt> uses a state factory to obtain the state of <tt>printer</tt> for binding into its namespace. A state factory for the <tt>Printer</tt> type object might return a more compact object for storage in the naming system.<p> A state factory must implement the <tt>StateFactory</tt> interface. In addition, the factory class must be public and must have a public constructor that accepts no parameters.<p> The <tt>getStateToBind()</tt> method of a state factory may be invoked multiple times, possibly using different parameters. The implementation is thread-safe.<p> <tt>StateFactory</tt> is intended for use with service providers that implement only the <tt>Context</tt> interface. <tt>DirStateFactory</tt> is intended for use with service providers that implement the <tt>DirContext</tt> interface.<P><DL><DT><B>Since: </B><DD>1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/naming/spi/NamingManager.html#getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)"><CODE>NamingManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)</CODE></A>, <A HREF="../../../javax/naming/spi/DirectoryManager.html#getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable, javax.naming.directory.Attributes)"><CODE>DirectoryManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable, javax.naming.directory.Attributes)</CODE></A>, <A HREF="../../../javax/naming/spi/ObjectFactory.html"><CODE>ObjectFactory</CODE></A>, <A HREF="../../../javax/naming/spi/DirStateFactory.html"><CODE>DirStateFactory</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><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> <A HREF="../../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/naming/spi/StateFactory.html#getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)">getStateToBind</A></B>(<A HREF="../../../java/lang/Object.html">Object</A> obj, <A HREF="../../../javax/naming/Name.html">Name</A> name, <A HREF="../../../javax/naming/Context.html">Context</A> nameCtx, <A HREF="../../../java/util/Hashtable.html">Hashtable</A> environment)</CODE><BR> Retrieves the state of an object for binding.</TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)"><!-- --></A><H3>getStateToBind</H3><PRE>public <A HREF="../../../java/lang/Object.html">Object</A> <B>getStateToBind</B>(<A HREF="../../../java/lang/Object.html">Object</A> obj, <A HREF="../../../javax/naming/Name.html">Name</A> name, <A HREF="../../../javax/naming/Context.html">Context</A> nameCtx, <A HREF="../../../java/util/Hashtable.html">Hashtable</A> environment) throws <A HREF="../../../javax/naming/NamingException.html">NamingException</A></PRE><DL><DD>Retrieves the state of an object for binding.<p> <tt>NamingManager.getStateToBind()</tt> successively loads in state factories and invokes this method on them until one produces a non-null answer. <tt>DirectoryManager.getStateToBind()</tt> successively loads in state factories. If a factory implements <tt>DirStateFactory</tt>, then <tt>DirectoryManager</tt> invokes <tt>DirStateFactory.getStateToBind()</tt>; otherwise it invokes <tt>StateFactory.getStateToBind()</tt>.<p> When an exception is thrown by a factory, the exception is passed on to the caller of <tt>NamingManager.getStateToBind()</tt> and <tt>DirectoryManager.getStateToBind()</tt>. The search for other factories that may produce a non-null answer is halted. A factory should only throw an exception if it is sure that it is the only intended factory and that no other factories should be tried. If this factory cannot create an object using the arguments supplied, it should return null. <p> The <code>name</code> and <code>nameCtx</code> parameters may optionally be used to specify the name of the object being created. See the description of "Name and Context Parameters" in <A HREF="../../../javax/naming/spi/ObjectFactory.html#getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)"><CODE>ObjectFactory.getObjectInstance()</CODE></A> for details. If a factory uses <code>nameCtx</code> it should synchronize its use against concurrent access, since context implementations are not guaranteed to be thread-safe. <p> The <tt>name</tt> and <tt>environment</tt> parameters are owned by the caller. The implementation will not modify these objects or keep references to them, although it may keep references to clones or copies.<DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - A non-null object whose state is to be retrieved.<DD><CODE>name</CODE> - The name of this object relative to <code>nameCtx</code>, or null if no name is specified.<DD><CODE>nameCtx</CODE> - The context relative to which the <code>name</code> parameter is specified, or null if <code>name</code> is relative to the default initial context.<DD><CODE>environment</CODE> - The possibly null environment to be used in the creation of the object's state.<DT><B>Returns:</B><DD>The object's state for binding; null if the factory is not returning any changes.<DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/naming/NamingException.html">NamingException</A></CODE> - if this factory encountered an exception while attempting to get the object's state, and no other factories are to be tried.<DT><B>See Also: </B><DD><A HREF="../../../javax/naming/spi/NamingManager.html#getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)"><CODE>NamingManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)</CODE></A>, <A HREF="../../../javax/naming/spi/DirectoryManager.html#getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable, javax.naming.directory.Attributes)"><CODE>DirectoryManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable, javax.naming.directory.Attributes)</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <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/StateFactory.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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/naming/spi/Resolver.html"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="StateFactory.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -