com.tensegrity.palowebviewer.modules.engine.server
Class EngineService

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
              extended by com.tensegrity.palowebviewer.modules.engine.server.BasePaloService
                  extended by com.tensegrity.palowebviewer.modules.engine.server.EngineService
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, IEngineService, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class EngineService
extends BasePaloService
implements IEngineService

See Also:
Serialized Form

Nested Class Summary
protected static class EngineService.AuthInfo
           
 
Field Summary
 
Fields inherited from class com.tensegrity.palowebviewer.modules.engine.server.BasePaloService
logic
 
Constructor Summary
EngineService()
           
 
Method Summary
 java.lang.Boolean authenticate(java.lang.String login, java.lang.String password, boolean remember)
          This method authenticates the user.
 boolean checkExistance(XPath path)
          This methods checks existance of objects, specified via path.
 boolean checkExistance(XPath contextPath, java.lang.String elementName)
          More specified version of IEngineService.checkExistance(XPath) : it checks existance by name in some context.
 void forceReload()
          forces reload of all connection pools, e.g.
protected  EngineService.AuthInfo getAuthInfoFromCookies()
           
 IClientProperties getClientProperties()
          Retuns client properties from server.
 XElement[] getParentsOf(XPath contextPath, java.lang.String elementName)
          This method returns parents elements in element hierarchy for particular element.
 java.lang.Boolean isAuthenticated()
          Checks if user is already authenticated.
 XObject loadChild(XPath path, java.lang.String childId, int type)
          This methods loads single child specified by path to parend, id and type
 XObject loadChildByName(XPath path, java.lang.String name, int type)
           
 XObject[] loadChildren(XPath path, int type)
          This method loads all children (XObjects) of type of object specified by path.
 XDefaultView loadDefaultView(XPath path)
          This method constructs "default view", i.e.
 XFolder loadFavoriteViews()
          Loads favorite views from server.
 void logoff()
          Log off from the server.
 XResult[] query(XQueryPath[] queries)
          This method returns data for cube, specified by query.
 java.lang.String saveView(XViewPath viewPath)
          This method updates view if the one already exists and adds view otherwise.
protected  java.lang.Boolean tryCookiesAuthentication()
           
 void updateData(XPath cube, IXPoint point, IResultElement value)
          This method sets value of some cell of cube pointed by point
 
Methods inherited from class com.tensegrity.palowebviewer.modules.engine.server.BasePaloService
getContext, init, setContext
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
doGetSerializationPolicy, doPost, doUnexpectedFailure, getSerializationPolicy, getThreadLocalRequest, getThreadLocalResponse, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, shouldCompressResponse
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, 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
 

Constructor Detail

EngineService

public EngineService()
Method Detail

isAuthenticated

public java.lang.Boolean isAuthenticated()
Description copied from interface: IEngineService
Checks if user is already authenticated. If not, tries to do that via cookies.

If authentication succeed cookies max age setted up to 1 month.

Specified by:
isAuthenticated in interface IEngineService
Returns:
true, is authentication succeed.

authenticate

public java.lang.Boolean authenticate(java.lang.String login,
                                      java.lang.String password,
                                      boolean remember)
                               throws InternalErrorException
Description copied from interface: IEngineService
This method authenticates the user.

Specified by:
authenticate in interface IEngineService
Parameters:
login - - user login. Can't be null.
password - - user password. Can't be null.
remember - - remember user and password hash in cookies.
Returns:
true, if authentication succeed.
Throws:
InternalErrorException

logoff

public void logoff()
Description copied from interface: IEngineService
Log off from the server. The cookies are NOT DELETED, i.e. when user types application url the next time #authenticate() will return TRUE.

Specified by:
logoff in interface IEngineService

query

public XResult[] query(XQueryPath[] queries)
                throws InvalidObjectPathException
Description copied from interface: IEngineService
This method returns data for cube, specified by query. @{link XResult} This is batch version of query, e.g. it returs data for array of paths.

Assumption: all paths points to one server. Otherwise behavior is unpredicted (runtime exception will be thrown).

Specified by:
query in interface IEngineService
Parameters:
queries - - array of requests XQueryPath. It can't be null.
Returns:
array of results.
Throws:
InvalidObjectPathException - is thrown if one of paths doesn't points to cube or is invalid.

updateData

public void updateData(XPath cube,
                       IXPoint point,
                       IResultElement value)
                throws InvalidObjectPathException
Description copied from interface: IEngineService
This method sets value of some cell of cube pointed by point

Specified by:
updateData in interface IEngineService
Parameters:
cube - points to target cube
point - contains coordinates of point. @{link IXPoint}
value - of the point.
Throws:
InvalidObjectPathException - if cubePath is not valid path.

saveView

public java.lang.String saveView(XViewPath viewPath)
                          throws InvalidObjectPathException
Description copied from interface: IEngineService
This method updates view if the one already exists and adds view otherwise.

Specified by:
saveView in interface IEngineService
Parameters:
viewPath - defines the view. @{link XViewPath}.
Returns:
id of saved or newly created view
Throws:
InvalidObjectPathException - one of paths in viewPath is invalid.

forceReload

public void forceReload()
Description copied from interface: IEngineService
forces reload of all connection pools, e.g. all opened connections are marked to be reload. They will be actualy reloaded on the next use (e.g. query, updateData etc.)

Specified by:
forceReload in interface IEngineService

tryCookiesAuthentication

protected java.lang.Boolean tryCookiesAuthentication()

getAuthInfoFromCookies

protected EngineService.AuthInfo getAuthInfoFromCookies()

getClientProperties

public IClientProperties getClientProperties()
Description copied from interface: IEngineService
Retuns client properties from server.

Specified by:
getClientProperties in interface IEngineService
Returns:
client properties.

loadChildren

public XObject[] loadChildren(XPath path,
                              int type)
                       throws InvalidObjectPathException
Description copied from interface: IEngineService
This method loads all children (XObjects) of type of object specified by path.

Specified by:
loadChildren in interface IEngineService
Parameters:
path - for object. Can't be null.
type - specifies chilren type. IXConsts. If object has only one chilren type, type param have to be ingnored.
Returns:
children array.
Throws:
InvalidObjectPathException - will be thrown if path is wrong if type is wrong program behavior is unpredicted (e.g. runtime exception will be thrown)

getParentsOf

public XElement[] getParentsOf(XPath contextPath,
                               java.lang.String elementName)
                        throws InvalidObjectPathException
Description copied from interface: IEngineService
This method returns parents elements in element hierarchy for particular element.

Specified by:
getParentsOf in interface IEngineService
Parameters:
contextPath - defines context of element hierarcy. Can point only to dimension or subset. Can't be null.
elementName - element name. Can't be null.
Returns:
array of ancestors elements.
Throws:
InvalidObjectPathException - if 1. contextPath is invalid; 2. contextPath doesn't point to dimension or subset. 3. element with elementName can't be found.

loadDefaultView

public XDefaultView loadDefaultView(XPath path)
                             throws InvalidObjectPathException
Description copied from interface: IEngineService
This method constructs "default view", i.e. when user opens cube (e.g. first two dimensions are col- and row-axices etc.)

Specified by:
loadDefaultView in interface IEngineService
Parameters:
path - points to cube. Can't be null.
Returns:
constructed default view.
Throws:
InvalidObjectPathException - if path it invalid or it doen't point to cube.

checkExistance

public boolean checkExistance(XPath contextPath,
                              java.lang.String elementName)
                       throws InvalidObjectPathException
Description copied from interface: IEngineService
More specified version of IEngineService.checkExistance(XPath) : it checks existance by name in some context.

Specified by:
checkExistance in interface IEngineService
Parameters:
contextPath - context path (currently: dimension/subset)
elementName - element name
Returns:
true, if element exists, false otherwise
Throws:
InvalidObjectPathException - if contextPath is invalid or not points to dimension/subset

checkExistance

public boolean checkExistance(XPath path)
Description copied from interface: IEngineService
This methods checks existance of objects, specified via path.

Specified by:
checkExistance in interface IEngineService
Parameters:
path - for object. Can't be null.
Returns:
true, if object defined via path exists; and false otherwise

loadFavoriteViews

public XFolder loadFavoriteViews()
Description copied from interface: IEngineService
Loads favorite views from server.

Specified by:
loadFavoriteViews in interface IEngineService
Returns:
root folder of all favorite views. @{link XFolder}

loadChild

public XObject loadChild(XPath path,
                         java.lang.String childId,
                         int type)
                  throws InvalidObjectPathException
Description copied from interface: IEngineService
This methods loads single child specified by path to parend, id and type

Specified by:
loadChild in interface IEngineService
Parameters:
path - poinst to parent object.
childId - child identificator
type - child type.
Returns:
loaded child. Null if child can't be found.
Throws:
InvalidObjectPathException - if path is invalid.

loadChildByName

public XObject loadChildByName(XPath path,
                               java.lang.String name,
                               int type)
                        throws InvalidObjectPathException
Specified by:
loadChildByName in interface IEngineService
Throws:
InvalidObjectPathException