com.spss.psapi.extensions.common

Interface ExtensionInteractor

  • All Superinterfaces:
    Interactor


    public interface ExtensionInteractor
    extends Interactor
    Manages an interactive session with an extension peer.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addMessageListener(MessageListener listener)
      Registers a listener for asynchronous messages from the peer arriving at this interactor.
      void getContent(java.lang.String filename, java.io.OutputStream target)
      Transfers content from the specified file owned by the peer.
      byte[] getContentAsBinary(java.lang.String filename)
      Returns binary content from the specified file owned by the peer.
      java.lang.String getContentAsUTF8(java.lang.String filename)
      Returns text content from the specified file owned by the peer.
      boolean isMessageDeliveryBlocked()
      Returns true if delivery of asynchronous messages to message listeners is temporarily blocked.
      void putContent(java.lang.String filename, byte[] content)
      Transfers binary content to the specified file owned by the peer.
      void putContent(java.lang.String filename, ContentContainer container)
      Transfers content to the specified file owned by the peer.
      void putContent(java.lang.String filename, java.io.InputStream source)
      Transfers content to the specified file owned by the peer.
      void putContent(java.lang.String filename, java.lang.String text)
      Transfers text content to the specified file owned by the peer.
      void removeMessageListener(MessageListener listener)
      Removes a listener from the list of registered message listeners.
      java.lang.String request(java.lang.String req)
      Executes the specified request on the peer.
      void setMessageDeliveryBlocked(boolean blocked)
      Enables or disables the delivery of asynchronous messages.
    • Method Detail

      • request

        java.lang.String request(java.lang.String req)
                                 throws SessionException
        Executes the specified request on the peer.
        Parameters:
        req - the request string
        Returns:
        the reply string
        Throws:
        SessionException
      • putContent

        void putContent(java.lang.String filename,
                      byte[] content)
                        throws SessionException
        Transfers binary content to the specified file owned by the peer.
        Parameters:
        filename - the target file within the peer's file space
        content - the file content
        Throws:
        SessionException - if an error occurs in the transfer
      • putContent

        void putContent(java.lang.String filename,
                      java.lang.String text)
                        throws SessionException
        Transfers text content to the specified file owned by the peer. The text is written to the file in UTF-8 encoding.
        Parameters:
        filename - the target file within the peer's file space
        text - the file content
        Throws:
        SessionException - if an error occurs in the transfer
      • putContent

        void putContent(java.lang.String filename,
                      ContentContainer container)
                        throws SessionException
        Transfers content to the specified file owned by the peer. Content is read from the specified container and written as binary data or UTF-8 text according to the container format.
        Parameters:
        filename - the target file within the peer's file space
        container - provides the file content
        Throws:
        SessionException - if an error occurs in the transfer
      • putContent

        void putContent(java.lang.String filename,
                      java.io.InputStream source)
                        throws java.io.IOException,
                               SessionException
        Transfers content to the specified file owned by the peer. Content is read from the specified source up to the end of input.
        Parameters:
        filename - the target file within the peer's file space
        source - provides the file content
        Throws:
        java.io.IOException - if an error occurs reading from the source
        SessionException - if an error occurs in the transfer
      • getContentAsBinary

        byte[] getContentAsBinary(java.lang.String filename)
                                  throws SessionException
        Returns binary content from the specified file owned by the peer.
        Parameters:
        filename - the source file within the peer's file space
        Returns:
        the file content as a byte array
        Throws:
        SessionException - if an error occurs in the transfer
      • getContentAsUTF8

        java.lang.String getContentAsUTF8(java.lang.String filename)
                                          throws SessionException
        Returns text content from the specified file owned by the peer. The file content must be encoded as UTF-8.
        Parameters:
        filename - the source file within the peer's file space
        Returns:
        the file content as a string
        Throws:
        SessionException - if an error occurs in the transfer
      • getContent

        void getContent(java.lang.String filename,
                      java.io.OutputStream target)
                        throws java.io.IOException,
                               SessionException
        Transfers content from the specified file owned by the peer. Content is written to the specified target stream.
        Parameters:
        filename - the source file within the peer's file space
        target - consumes the file content
        Throws:
        java.io.IOException - if an error occurs writing to the target
        SessionException - if an error occurs in the transfer
      • addMessageListener

        void addMessageListener(MessageListener listener)
        Registers a listener for asynchronous messages from the peer arriving at this interactor.
        Parameters:
        listener - the listener to be registered
      • removeMessageListener

        void removeMessageListener(MessageListener listener)
        Removes a listener from the list of registered message listeners.
        Parameters:
        listener - the listener to be removed
      • isMessageDeliveryBlocked

        boolean isMessageDeliveryBlocked()
        Returns true if delivery of asynchronous messages to message listeners is temporarily blocked.
        Returns:
        true if message delivery is blocked
      • setMessageDeliveryBlocked

        void setMessageDeliveryBlocked(boolean blocked)
        Enables or disables the delivery of asynchronous messages. While delivery is blocked, messages are queued and will be delivered in order as soon as the block is lifted. Message delivery must not be disabled indefinitely.
        Parameters:
        blocked - true to disable delivery of asynchronous messages

(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.