it.eng.spagobi.engines.weka
Class WekaServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by it.eng.spagobi.engines.weka.WekaServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class WekaServlet
extends javax.servlet.http.HttpServlet

Process weka execution requests and returns bytes of the filled reports

See Also:
Serialized Form

Nested Class Summary
 class WekaServlet.RunnerThread
           
 
Field Summary
static java.lang.String CONNECTION
           
static java.lang.String CR_MANAGER_URL
           
static java.lang.String EVENT
           
static java.lang.String EVENTS_MANAGER_URL
           
static java.lang.String INPUT_CONNECTION
           
static java.lang.String KEYS
           
private static org.apache.log4j.Logger logger
          Logger component
static java.lang.String OUTPUT_CONNECTION
           
private  java.util.Map params
          Input parameters map
private  java.security.PublicKey publicKeyDSASbi
          SpagoBI Public Key
private  boolean securityAble
          security check able or not
static java.lang.String TEMPLATE_PATH
           
static java.lang.String USER
           
static java.lang.String VERSION
           
static java.lang.String VERSION_COLUMN_NAME
           
static java.lang.String VERSIONING
           
static java.lang.String WRITE_MODE
           
 
Constructor Summary
WekaServlet()
           
 
Method Summary
private  boolean authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Authenticate the caller (must be SpagoBI)
private  byte[] decodeBase64(java.lang.String encoded)
          Decode a Base64 String into a byte array
 java.sql.Connection getConnection(java.lang.String connectionName)
          This method, based on the engine-config.xml configuration, gets a database connection and return it
private  java.sql.Connection getConnectionFromJndiDS(it.eng.spago.base.SourceBean connectionConfig)
          Get the connection from JNDI
private  java.sql.Connection getDirectConnection(it.eng.spago.base.SourceBean connectionConfig)
          Get the connection using jdbc
private  java.security.PublicKey getPublicKey()
          Get the SpagoBI Public Key for a DSA alghoritm
 void init(javax.servlet.ServletConfig config)
          Initialize the engine
private  java.lang.String[] parseKeysProp(java.lang.String keysStr)
           
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          process weka execution requests
private  boolean verifySignature(byte[] tokenclear, byte[] tokensign)
          Verify the signature
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static transient org.apache.log4j.Logger logger
Logger component


publicKeyDSASbi

private transient java.security.PublicKey publicKeyDSASbi
SpagoBI Public Key


securityAble

private transient boolean securityAble
security check able or not


params

private java.util.Map params
Input parameters map


TEMPLATE_PATH

public static final java.lang.String TEMPLATE_PATH
See Also:
Constant Field Values

CR_MANAGER_URL

public static final java.lang.String CR_MANAGER_URL
See Also:
Constant Field Values

EVENTS_MANAGER_URL

public static final java.lang.String EVENTS_MANAGER_URL
See Also:
Constant Field Values

EVENT

public static final java.lang.String EVENT
See Also:
Constant Field Values

USER

public static final java.lang.String USER
See Also:
Constant Field Values

CONNECTION

public static final java.lang.String CONNECTION
See Also:
Constant Field Values

INPUT_CONNECTION

public static final java.lang.String INPUT_CONNECTION
See Also:
Constant Field Values

OUTPUT_CONNECTION

public static final java.lang.String OUTPUT_CONNECTION
See Also:
Constant Field Values

WRITE_MODE

public static final java.lang.String WRITE_MODE
See Also:
Constant Field Values

KEYS

public static final java.lang.String KEYS
See Also:
Constant Field Values

VERSIONING

public static final java.lang.String VERSIONING
See Also:
Constant Field Values

VERSION_COLUMN_NAME

public static final java.lang.String VERSION_COLUMN_NAME
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

WekaServlet

public WekaServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initialize the engine

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
process weka execution requests

Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
javax.servlet.ServletException

getConnection

public java.sql.Connection getConnection(java.lang.String connectionName)
This method, based on the engine-config.xml configuration, gets a database connection and return it

Parameters:
connectionName - Logical name of the connection configuration (defined into engine-config.xml)
Returns:
the database connection

getConnectionFromJndiDS

private java.sql.Connection getConnectionFromJndiDS(it.eng.spago.base.SourceBean connectionConfig)
Get the connection from JNDI

Parameters:
connectionConfig - SourceBean describing data connection
Returns:
Connection to database

getDirectConnection

private java.sql.Connection getDirectConnection(it.eng.spago.base.SourceBean connectionConfig)
Get the connection using jdbc

Parameters:
connectionConfig - SourceBean describing data connection
Returns:
Connection to database

authenticate

private boolean authenticate(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Authenticate the caller (must be SpagoBI)

Parameters:
request - HttpRequest
response - HttpResponse
Returns:
boolean, true if autheticated false otherwise

getPublicKey

private java.security.PublicKey getPublicKey()
Get the SpagoBI Public Key for a DSA alghoritm

Returns:
Public Key for SpagoBI (DSA alghoritm)

decodeBase64

private byte[] decodeBase64(java.lang.String encoded)
Decode a Base64 String into a byte array

Parameters:
encoded - String encoded with Base64 algorithm
Returns:
byte array decoded

verifySignature

private boolean verifySignature(byte[] tokenclear,
                                byte[] tokensign)
Verify the signature

Parameters:
tokenclear - Clear data
tokensign - Signed data
Returns:
true if the signature is verified false otherwise

parseKeysProp

private java.lang.String[] parseKeysProp(java.lang.String keysStr)