com.ibm.ia.common

Interface ModelSerializer

  • All Known Subinterfaces:
    BaseFactory, EntityFactory, EventFactory


    public interface ModelSerializer
    Factory class used to parse and serialize Event and Entities

    to be used in Events and Entities

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      com.ibm.ia.model.Entity parseEntity(DataFormat format, byte[] entityData, java.lang.String encoding)
      Creates Entity instance from a byte array
      com.ibm.ia.model.Entity parseEntity(DataFormat format, org.w3c.dom.Document entityDom)
      Creates Entity instance from a DOM document
      com.ibm.ia.model.Entity parseEntity(DataFormat format, java.io.InputStream entityData, java.lang.String encoding)
      Creates Entity instance from a byte stream
      com.ibm.ia.model.Entity parseEntity(DataFormat format, java.io.Reader entityData)
      Creates Entity instance from a charset stream reader
      com.ibm.ia.model.Entity parseEntity(DataFormat format, java.lang.String entityData)
      Creates Entity instance from a string
      com.ibm.ia.model.Event parseEvent(DataFormat format, byte[] eventData, java.lang.String encoding)
      Creates Event instance from byte array.
      com.ibm.ia.model.Event parseEvent(DataFormat format, org.w3c.dom.Document eventDocument)
      Creates Event instance from a Dom document.
      com.ibm.ia.model.Event parseEvent(DataFormat format, java.io.InputStream eventData, java.lang.String encoding)
      Creates Event instance from a byte stream.
      com.ibm.ia.model.Event parseEvent(DataFormat format, java.io.Reader eventData)
      Creates Event instance from a charset stream If the event data is not known by the solution, a UnknownDataElementException is thrown.
      com.ibm.ia.model.Event parseEvent(DataFormat format, java.lang.String eventData)
      Creates Event instance from a String If the event data is not known by the solution, a UnknownDataElementException is thrown.
      java.lang.String serializeEntity(DataFormat format, com.ibm.ia.model.Entity entity)
      Serializes Entity instance to String
      void serializeEntity(DataFormat format, java.io.OutputStream outputStream, com.ibm.ia.model.Entity entity, java.lang.String encoding)
      Serializes Entity instance to byte stream
      java.lang.String serializeEvent(DataFormat format, com.ibm.ia.model.Event event)
      Serializes given Event to String
      void serializeEvent(DataFormat format, java.io.OutputStream outputStream, com.ibm.ia.model.Event event, java.lang.String encoding)
      Serializes given Event to byte stream
    • Method Detail

      • parseEvent

        com.ibm.ia.model.Event parseEvent(DataFormat format,
                                        byte[] eventData,
                                        java.lang.String encoding)
                                          throws java.lang.UnsupportedOperationException,
                                                 DataParseException
        Creates Event instance from byte array. If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        eventData - event bytes
        encoding - optional encoding type, default to UTF-8
        Returns:
        Event instance
      • parseEvent

        com.ibm.ia.model.Event parseEvent(DataFormat format,
                                        java.io.InputStream eventData,
                                        java.lang.String encoding)
                                          throws java.lang.UnsupportedOperationException,
                                                 DataParseException,
                                                 java.io.IOException
        Creates Event instance from a byte stream. If the event data is not known by the solution, a UnknownDataElementException is thrown.
      • parseEvent

        com.ibm.ia.model.Event parseEvent(DataFormat format,
                                        org.w3c.dom.Document eventDocument)
                                          throws java.lang.UnsupportedOperationException,
                                                 DataParseException
        Creates Event instance from a Dom document. If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventDocument - event's Dom document
        Returns:
        Event instance
      • parseEvent

        com.ibm.ia.model.Event parseEvent(DataFormat format,
                                        java.lang.String eventData)
                                          throws java.lang.UnsupportedOperationException,
                                                 DataParseException
        Creates Event instance from a String If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventData - event String
        Returns:
        Event instance
      • parseEvent

        com.ibm.ia.model.Event parseEvent(DataFormat format,
                                        java.io.Reader eventData)
                                          throws java.lang.UnsupportedOperationException,
                                                 DataParseException,
                                                 java.io.IOException
        Creates Event instance from a charset stream If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventData - event charset reader
        Returns:
        Event instance
      • serializeEvent

        java.lang.String serializeEvent(DataFormat format,
                                      com.ibm.ia.model.Event event)
                                        throws java.lang.UnsupportedOperationException
        Serializes given Event to String
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        event - Event instance
        Returns:
        String representation of the event
      • serializeEvent

        void serializeEvent(DataFormat format,
                          java.io.OutputStream outputStream,
                          com.ibm.ia.model.Event event,
                          java.lang.String encoding)
                            throws java.lang.UnsupportedOperationException,
                                   java.io.IOException
        Serializes given Event to byte stream
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        java.io.IOException - if the output cannot be written.
        Parameters:
        format - data format (#see DataFormat)
        outputStream - stream to write bytes to
        event - Event instance
        encoding - optional encoding type, default to UTF-8
      • parseEntity

        com.ibm.ia.model.Entity parseEntity(DataFormat format,
                                          byte[] entityData,
                                          java.lang.String encoding)
                                            throws java.lang.UnsupportedOperationException,
                                                   DataParseException
        Creates Entity instance from a byte array
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity bytes
        encoding - optional encoding type, default to UTF-8
        Returns:
        Entity instance
      • parseEntity

        com.ibm.ia.model.Entity parseEntity(DataFormat format,
                                          java.io.InputStream entityData,
                                          java.lang.String encoding)
                                            throws java.lang.UnsupportedOperationException,
                                                   DataParseException,
                                                   java.io.IOException
        Creates Entity instance from a byte stream
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity input stream
        encoding - optional encoding type, default to UTF-8
        Returns:
        Entity instance
      • parseEntity

        com.ibm.ia.model.Entity parseEntity(DataFormat format,
                                          org.w3c.dom.Document entityDom)
                                            throws java.lang.UnsupportedOperationException,
                                                   DataParseException
        Creates Entity instance from a DOM document
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityDom - entity Dom document
        Returns:
        Entity instance
      • parseEntity

        com.ibm.ia.model.Entity parseEntity(DataFormat format,
                                          java.lang.String entityData)
                                            throws java.lang.UnsupportedOperationException,
                                                   DataParseException
        Creates Entity instance from a string
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity String
        Returns:
        Entity instance
      • parseEntity

        com.ibm.ia.model.Entity parseEntity(DataFormat format,
                                          java.io.Reader entityData)
                                            throws java.lang.UnsupportedOperationException,
                                                   DataParseException,
                                                   java.io.IOException
        Creates Entity instance from a charset stream reader
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity charset reader
        Returns:
        Entity instance
      • serializeEntity

        java.lang.String serializeEntity(DataFormat format,
                                       com.ibm.ia.model.Entity entity)
                                         throws java.lang.UnsupportedOperationException
        Serializes Entity instance to String
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entity - Entity instance
        Returns:
        String entity representation
      • serializeEntity

        void serializeEntity(DataFormat format,
                           java.io.OutputStream outputStream,
                           com.ibm.ia.model.Entity entity,
                           java.lang.String encoding)
                             throws java.lang.UnsupportedOperationException,
                                    java.io.IOException
        Serializes Entity instance to byte stream
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        java.io.IOException - if the output cannot be written.
        Parameters:
        format - data format (#see DataFormat);
        outputStream - stream to write bytes to
        entity - Entity instance
        encoding - optional encoding type, default to UTF-8

© Copyright IBM 2017