Service (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacard.framework.service
Interface Service

All Known Subinterfaces:
  RemoteService, SecurityService

All Known Implementing Classes:
  BasicService, RMIService

    @TransactionType(value=SUPPORTS)
    public interface Service

This is the base interface for the service framework on the Java Card platform. A `Service` is an object that is able to perform partial or complete processing on a set of incoming commands encapsulated in an APDU.

Services collaborate in pre-processing, command processing and post-processing of incoming `APDU` commands. They share the same `APDU` object by using the communication framework and the Common Service Format (CSF) defined in `BasicService`. An application is built by combining pre-built and newly defined Services within a `Dispatcher` object.

See Also:
  `BasicService`

Method Summary
`boolean` | `processCommand(APDU apdu)` Processes the command in the `APDU` object.
`boolean` | `processDataIn(APDU apdu)` Pre-processes the input data for the command in the `APDU` object.
`boolean` | `processDataOut(APDU apdu)` Post-processes the output data for the command in the `APDU` object.

Method Detail

### processDataIn

    boolean processDataIn(APDU apdu)

  Pre-processes the input data for the command in the `APDU` object. When invoked, the APDU object should either be in `STATE_INITIAL` with the APDU buffer in the Init format or in `STATE_FULL_INCOMING` with the APDU buffer in the Input Ready format defined in `BasicService`.

  The method must return `true` if no more pre-processing should be performed, and `false` otherwise. In particular, it must return `false` if it has not performed any processing on the command.

  After normal completion, the `APDU` object is usually in `STATE_FULL_INCOMING` with the APDU buffer in the Input Ready format defined in `BasicService`. However, in some cases if the Service processes the command entirely, the `APDU` object may be in `STATE_OUTGOING` with the APDU buffer in the Output Ready format defined in `BasicService`.

  Parameters:
    `apdu` - the `APDU` object containing the command being processed
  Returns:
    `true` if input processing is finished, `false` otherwise

### processCommand

    boolean processCommand(APDU apdu)

  Processes the command in the `APDU` object. When invoked, the `APDU` object should normally be in `STATE_INITIAL` with the APDU buffer in the Init format or in `STATE_FULL_INCOMING` with the `APDU` buffer in the Input Ready format defined in `BasicService`. However, in some cases, if a pre-processing service has processed the command entirely, the `APDU` object may be in `STATE_OUTGOING` with the APDU buffer in the Output Ready format defined in `BasicService`.

  The method must return `true` if no more command processing is required, and `false` otherwise. In particular, it should return `false` if it has not performed any processing on the command.

  After normal completion, the `APDU` object must be in `STATE_OUTGOING` and the output response must be in the APDU buffer in the Output Ready format defined in `BasicService`.

  Parameters:
    `apdu` - the `APDU` object containing the command being processed
  Returns:
    `true` if the command has been processed, `false` otherwise

### processDataOut

    boolean processDataOut(APDU apdu)

  Post-processes the output data for the command in the `APDU` object. When invoked, the `APDU` object should be in `STATE_OUTGOING` with the APDU buffer in the Output Ready format defined in `BasicService`.

  The method should return `true` if no more post-processing is required, and `false` otherwise. In particular, it should return `false` if it has not performed any processing on the command.

  After normal completion, the `APDU` object should must be in `STATE_OUTGOING` and the output response must be in the APDU buffer in the Output Ready format defined in `BasicService`.

  Parameters:
    `apdu` - the `APDU` object containing the command being processed
  Returns:
    `true` if output processing is finished, `false` otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.