📄 dispatcher.html
字号:
public static final byte <B>PROCESS_INPUT_DATA</B></PRE><DL><DD>Identifies the input data processing phase.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javacard.framework.service.Dispatcher.PROCESS_INPUT_DATA">Constant Field Values</A></DL></DL><HR><A NAME="PROCESS_COMMAND"><!-- --></A><H3>PROCESS_COMMAND</H3><PRE>public static final byte <B>PROCESS_COMMAND</B></PRE><DL><DD>Identifies the main command processing phase.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javacard.framework.service.Dispatcher.PROCESS_COMMAND">Constant Field Values</A></DL></DL><HR><A NAME="PROCESS_OUTPUT_DATA"><!-- --></A><H3>PROCESS_OUTPUT_DATA</H3><PRE>public static final byte <B>PROCESS_OUTPUT_DATA</B></PRE><DL><DD>Identifies the output data processing phase.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javacard.framework.service.Dispatcher.PROCESS_OUTPUT_DATA">Constant Field Values</A></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="Dispatcher(short)"><!-- --></A><H3>Dispatcher</H3><PRE>public <B>Dispatcher</B>(short maxServices) throws <A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></PRE><DL><DD>Creates a <CODE>Dispatcher</CODE> with a designated maximum number of services.<P><DL><DT><B>Parameters:</B><DD><CODE>maxServices</CODE> - the maximum number of services that can be registered to this dispatcher<DT><B>Throws:</B><DD><CODE><A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></CODE> - with the following reason code:<ul> <li><code>ServiceException.ILLEGAL_PARAM</code> if the maxServices parameter is negative. </ul></DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="addService(javacard.framework.service.Service, byte)"><!-- --></A><H3>addService</H3><PRE>public void <B>addService</B>(<A HREF="../../../javacard/framework/service/Service.html" title="interface in javacard.framework.service">Service</A> service, byte phase) throws <A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></PRE><DL><DD>Atomically adds the specified service to the dispatcher registry for the specified processing phase. Services are invoked in the order in which they are added to the registry during the processing of that phase. If the requested service is already registered for the specified processing phase, this method does nothing.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>service</CODE> - the Service to be added to the dispatcher<DD><CODE>phase</CODE> - the processing phase associated with this service<DT><B>Throws:</B><DD><CODE><A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></CODE> - with the following reason code:<ul> <li><code>ServiceException.DISPATCH_TABLE_FULL</code> if the maximum number of registered services is exceeded. <li><code>ServiceException.ILLEGAL_PARAM</code> if the phase parameter is undefined or if the service parameter is null. </ul></DL></DD></DL><HR><A NAME="removeService(javacard.framework.service.Service, byte)"><!-- --></A><H3>removeService</H3><PRE>public void <B>removeService</B>(<A HREF="../../../javacard/framework/service/Service.html" title="interface in javacard.framework.service">Service</A> service, byte phase) throws <A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></PRE><DL><DD>Atomically removes the specified service for the specified processing phase from the dispatcher registry. Upon removal, the slot used by the specified service in the dispatcher registry is available for re-use. If the specified service is not registered for the specified processing phase, this method does nothing.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>service</CODE> - the <code>Service</code> to be deleted from the dispatcher<DD><CODE>phase</CODE> - the processing phase associated with this service<DT><B>Throws:</B><DD><CODE><A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></CODE> - with the following reason code:<ul> <li><code>ServiceException.ILLEGAL_PARAM</code> if the phase parameter is unknown or if the service parameter is null. </ul></DL></DD></DL><HR><A NAME="dispatch(javacard.framework.APDU, byte)"><!-- --></A><H3>dispatch</H3><PRE>public <A HREF="../../../java/lang/Exception.html" title="class in java.lang">Exception</A> <B>dispatch</B>(<A HREF="../../../javacard/framework/APDU.html" title="class in javacard.framework">APDU</A> command, byte phase) throws <A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></PRE><DL><DD>Manages the processing of the command in the <CODE>APDU</CODE> object. This method is called when only partial processing using the registered services is required or when the APDU response following an error during the processing needs to be controlled. <p> It sequences through the registered services by calling the appropriate processing methods. Processing starts with the phase indicated in the input parameter. Services registered for that processing phase are called in the sequence in which they were registered until all the services for the processing phase have been called or a service indicates that processing for that phase is complete by returning <CODE>true</CODE> from its processing method. The dispatcher then processes the next phases in a similar manner until all the phases have been processed. The <CODE>PROCESS_OUTPUT_DATA</CODE> processing phase is performed only if the command processing has completed normally (<CODE>APDU</CODE> object state is <CODE>APDU.STATE_OUTGOING</CODE>). <p>The processing sequence is <CODE>PROCESS_INPUT_DATA</CODE> phase, followed by the <CODE>PROCESS_COMMAND</CODE> phase and lastly the <CODE>PROCESS_OUTPUT_DATA</CODE>. The processing is performed as follows: <ul><li><CODE>PROCESS_INPUT_DATA</CODE> phase invokes the <CODE>Service.processDataIn(APDU)</CODE> method <li><CODE>PROCESS_COMMAND</CODE> phase invokes the <CODE>Service.processCommand(APDU)</CODE> method <li><CODE>PROCESS_OUTPUT_DATA</CODE> phase invokes the <CODE>Service.processDataOut(APDU)</CODE> method </ul> If the command processing completes normally, the output data, assumed to be in the APDU buffer in the Common Service Format (CSF) defined in <code>BasicService</code>, is sent using <CODE>APDU.sendBytes</CODE> and the response status is generated by throwing an <CODE>ISOException</CODE> exception. If the command could not be processed, <CODE>null</CODE> is returned. If any exception is thrown by a Service during the processing, that exception is returned. <p><P><DD><DL><DT><B>Parameters:</B><DD><CODE>command</CODE> - the APDU object containing the command to be processed<DD><CODE>phase</CODE> - the processing phase to perform first<DT><B>Returns:</B><DD>an exception that occurred during the processing of the command, or <code>null</code> if the command could not be processed<DT><B>Throws:</B><DD><CODE><A HREF="../../../javacard/framework/service/ServiceException.html" title="class in javacard.framework.service">ServiceException</A></CODE> - with the following reason code:<ul> <li><code>ServiceException.ILLEGAL_PARAM</code> if the phase parameter is PROCESS_NONE or an undefined value. </ul><DT><B>See Also:</B><DD><A HREF="../../../javacard/framework/service/BasicService.html" title="class in javacard.framework.service"><CODE>BasicService</CODE></A></DL></DD></DL><HR><A NAME="process(javacard.framework.APDU)"><!-- --></A><H3>process</H3><PRE>public void <B>process</B>(<A HREF="../../../javacard/framework/APDU.html" title="class in javacard.framework">APDU</A> command) throws <A HREF="../../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></PRE><DL><DD>Manages the entire processing of the command in the APDU object input parameter. This method is called to delegate the complete processing of the incoming APDU command to the configured services. <p>This method uses the <A HREF="../../../javacard/framework/service/Dispatcher.html#dispatch(javacard.framework.APDU, byte)"><CODE>dispatch(APDU,byte)</CODE></A> method with <CODE>PROCESS_INPUT_DATA</CODE> as the input phase parameter to sequence through the services registered for all three phases : <CODE>PROCESS_INPUT_DATA</CODE> followed by <CODE>PROCESS_COMMAND</CODE> and lastly <CODE>PROCESS_OUTPUT_DATA</CODE>. <p>If the command processing completes normally, the output data is sent using <CODE>APDU.sendBytes</CODE> and the response status is generated by throwing an <CODE>ISOException</CODE> exception or by simply returning (for status = 0x9000). If an exception is thrown by any Service during the processing, <CODE>ISO7816.SW_UNKNOWN</CODE> response status code is generated by throwing an <CODE>ISOException</CODE>. If the command could not be processed <CODE>ISO7816.SW_INS_NOT_SUPPORTED</CODE> response status is generated by throwing an <CODE>ISOException</CODE>. <p>Note:<ul> <li><em>If additional command processing is required following a call to this method, the caller should catch and process exceptions thrown by this method.</em> </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>command</CODE> - the APDU object containing command to be processed<DT><B>Throws:</B><DD><CODE><A HREF="../../../javacard/framework/ISOException.html" title="class in javacard.framework">ISOException</A></CODE> - with the response bytes per ISO 7816-4</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><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=2 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="#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/Dispatcher.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><b>Java Card </b><br><font size="-1">v2.2.2</font></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javacard/framework/service/CardRemoteObject.html" title="class in javacard.framework.service"><B>PREV CLASS</B></A> <A HREF="../../../javacard/framework/service/RemoteService.html" title="interface in javacard.framework.service"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javacard/framework/service/Dispatcher.html" target="_top"><B>FRAMES</B></A> <A HREF="Dispatcher.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: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><i>Copyright © 1993-2005 Sun Microsystems, Inc. 4150 Network Circle,<br>Santa Clara, CA, 95054, U.S.A. All Rights Reserved.</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -