media.sdk.java.examples
Class SimpleMediaServer

java.lang.Object
  extended bymedia.sdk.java.examples.SimpleConnector
      extended bymedia.sdk.java.examples.SimpleMediaServer
All Implemented Interfaces:
java.lang.Runnable

public class SimpleMediaServer
extends SimpleConnector
implements java.lang.Runnable

Implements a simple server application that reads the content of a source directory. When parsing the directory, it creates a thread for processing each file. Each thread creates a MILInteraction, adds the file as attached data to the interaction, submits the interaction, and deletes the file from the source directory.


Field Summary
 java.lang.String interactionSubtype
          The interaction subtype for interactions to be submitted.
 java.lang.String interactionType
          The interaction type for interactions to be submitted.
 java.lang.String mediaType
          The media type for interactions to be submitted.
 java.lang.String queueName
          The queue name to which media interactions are submitted.
 
Fields inherited from class media.sdk.java.examples.SimpleConnector
connector
 
Constructor Summary
SimpleMediaServer(java.lang.String queue_name, java.lang.String media_type, java.lang.String interaction_type, java.lang.String interaction_subtype, java.lang.String source_path, java.lang.String save_path, boolean custom)
          Constructor.
 
Method Summary
protected  java.lang.String createTimeStamp()
          Returns a timestamp for log messages.
 void getSourceFiles()
          Reads the content of the sourcePath directory.
 long incrementID()
          Synchronized method that manages interaction IDs.
 void processFileList()
          Creates a thread for processing each file found in the filesToSend list.
 void run()
          This method periodically reads the source directory and process the file list.
 void stop()
          Stops the server and properly release factories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queueName

public java.lang.String queueName
The queue name to which media interactions are submitted.


mediaType

public java.lang.String mediaType
The media type for interactions to be submitted.


interactionType

public java.lang.String interactionType
The interaction type for interactions to be submitted.


interactionSubtype

public java.lang.String interactionSubtype
The interaction subtype for interactions to be submitted.

Constructor Detail

SimpleMediaServer

public SimpleMediaServer(java.lang.String queue_name,
                         java.lang.String media_type,
                         java.lang.String interaction_type,
                         java.lang.String interaction_subtype,
                         java.lang.String source_path,
                         java.lang.String save_path,
                         boolean custom)
Constructor.

Parameters:
queue_name - queue name to which media interactions are submitted.
media_type - media type possible values are defined in the Configuration Layer as "Media Type" attribute values.
interaction_type - interaction type; possible values are defined in the Configuration Layer as "Interaction Type" attribute values.
interaction_subtype - interaction subtype; possible values are defined in the Configuration Layer as "Interaction Type" attribute values.
source_path - source directory containing input files to attach to the created interactions.
save_path - directory in which to save files for which interaction creation failed.
Method Detail

incrementID

public long incrementID()
Synchronized method that manages interaction IDs.


run

public void run()
This method periodically reads the source directory and process the file list.

Specified by:
run in interface java.lang.Runnable

getSourceFiles

public void getSourceFiles()
Reads the content of the sourcePath directory.


processFileList

public void processFileList()
Creates a thread for processing each file found in the filesToSend list.


stop

public void stop()
Stops the server and properly release factories.

Overrides:
stop in class SimpleConnector

createTimeStamp

protected java.lang.String createTimeStamp()
Returns a timestamp for log messages.