org.apache.lens.server
Class LensService

java.lang.Object
  extended by org.apache.hive.service.AbstractService
      extended by org.apache.hive.service.CompositeService
          extended by org.apache.lens.server.LensService
All Implemented Interfaces:
Externalizable, Serializable, org.apache.hive.service.Service
Direct Known Subclasses:
CubeMetastoreServiceImpl, HiveSessionService, QueryExecutionServiceImpl, QuerySchedulerServiceImpl, QuotaServiceImpl

public abstract class LensService
extends org.apache.hive.service.CompositeService
implements Externalizable

The Class LensService.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hive.service.CompositeService
org.apache.hive.service.CompositeService.CompositeServiceShutdownHook
 
Nested classes/interfaces inherited from interface org.apache.hive.service.Service
org.apache.hive.service.Service.STATE
 
Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
protected static ConcurrentHashMap<String,org.apache.lens.api.LensSessionHandle> sessionMap
          The session map.
protected  boolean stopped
          The stopped.
 
Constructor Summary
protected LensService(String name, org.apache.hive.service.cli.CLIService cliService)
          Instantiates a new lens service.
 
Method Summary
 void acquire(org.apache.lens.api.LensSessionHandle sessionHandle)
          Acquire.
 void acquire(String sessionHandle)
          Acquire a lens session specified by the public UUID.
 void addResource(org.apache.lens.api.LensSessionHandle sessionHandle, String type, String path)
          Adds the resource.
 void closeSession(org.apache.lens.api.LensSessionHandle sessionHandle)
          Close session.
 void deleteResource(org.apache.lens.api.LensSessionHandle sessionHandle, String type, String path)
          Delete resource.
 org.apache.hive.service.cli.CLIService getCliService()
           
static org.apache.hive.service.cli.SessionHandle getHiveSessionHandle(org.apache.lens.api.LensSessionHandle lensHandle)
          Gets the hive session handle.
 org.apache.hadoop.conf.Configuration getLensConf(org.apache.lens.api.LensConf conf)
          Gets the lens conf.
 org.apache.hadoop.conf.Configuration getLensConf(org.apache.lens.api.LensSessionHandle sessionHandle, org.apache.lens.api.LensConf conf)
          Gets the lens conf.
 String getServerDomain()
           
 LensSessionImpl getSession(org.apache.lens.api.LensSessionHandle sessionHandle)
          Gets the session.
protected  org.apache.lens.api.LensSessionHandle getSessionHandle(String sessionid)
          Gets the session handle.
 org.apache.hive.service.cli.session.SessionManager getSessionManager()
           
 org.apache.lens.api.LensSessionHandle openSession(String username, String password, Map<String,String> configuration)
          Open session.
 void prepareStopping()
          Prepare stopping.
 void readExternal(ObjectInput in)
           
 void release(org.apache.lens.api.LensSessionHandle sessionHandle)
          Release.
 void release(String sessionHandle)
          Releases a lens session specified by the public UUID.
 void restoreSession(org.apache.lens.api.LensSessionHandle sessionHandle, String userName, String password)
          Restore session from previous instance of lens server.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.apache.hive.service.CompositeService
addService, getServices, init, removeService, start, stop
 
Methods inherited from class org.apache.hive.service.AbstractService
getHiveConf, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
The Constant LOG.


stopped

protected boolean stopped
The stopped.


sessionMap

protected static ConcurrentHashMap<String,org.apache.lens.api.LensSessionHandle> sessionMap
The session map.

Constructor Detail

LensService

protected LensService(String name,
                      org.apache.hive.service.cli.CLIService cliService)
Instantiates a new lens service.

Parameters:
name - the name
cliService - the cli service
Method Detail

getCliService

public org.apache.hive.service.cli.CLIService getCliService()
Returns:
the cliService

getServerDomain

public String getServerDomain()

openSession

public org.apache.lens.api.LensSessionHandle openSession(String username,
                                                         String password,
                                                         Map<String,String> configuration)
                                                  throws org.apache.lens.api.LensException
Open session.

Parameters:
username - the username
password - the password
configuration - the configuration
Returns:
the lens session handle
Throws:
org.apache.lens.api.LensException - the lens exception

restoreSession

public void restoreSession(org.apache.lens.api.LensSessionHandle sessionHandle,
                           String userName,
                           String password)
                    throws org.apache.lens.api.LensException
Restore session from previous instance of lens server.

Parameters:
sessionHandle - the session handle
userName - the user name
password - the password
Throws:
org.apache.lens.api.LensException - the lens exception

closeSession

public void closeSession(org.apache.lens.api.LensSessionHandle sessionHandle)
                  throws org.apache.lens.api.LensException
Close session.

Parameters:
sessionHandle - the session handle
Throws:
org.apache.lens.api.LensException - the lens exception

getSessionManager

public org.apache.hive.service.cli.session.SessionManager getSessionManager()

getSession

public LensSessionImpl getSession(org.apache.lens.api.LensSessionHandle sessionHandle)
Gets the session.

Parameters:
sessionHandle - the session handle
Returns:
the session

acquire

public void acquire(org.apache.lens.api.LensSessionHandle sessionHandle)
Acquire.

Parameters:
sessionHandle - the session handle

acquire

public void acquire(String sessionHandle)
Acquire a lens session specified by the public UUID.

Parameters:
sessionHandle - public UUID of the session

release

public void release(org.apache.lens.api.LensSessionHandle sessionHandle)
Release.

Parameters:
sessionHandle - the session handle

release

public void release(String sessionHandle)
             throws org.apache.lens.api.LensException
Releases a lens session specified by the public UUID.

Parameters:
sessionHandle - the session handle
Throws:
org.apache.lens.api.LensException - if session cannot be released

getSessionHandle

protected org.apache.lens.api.LensSessionHandle getSessionHandle(String sessionid)
Gets the session handle.

Parameters:
sessionid - the sessionid
Returns:
the session handle

addResource

public void addResource(org.apache.lens.api.LensSessionHandle sessionHandle,
                        String type,
                        String path)
                 throws org.apache.lens.api.LensException
Adds the resource.

Parameters:
sessionHandle - the session handle
type - the type
path - the path
Throws:
org.apache.lens.api.LensException - the lens exception

deleteResource

public void deleteResource(org.apache.lens.api.LensSessionHandle sessionHandle,
                           String type,
                           String path)
                    throws org.apache.lens.api.LensException
Delete resource.

Parameters:
sessionHandle - the session handle
type - the type
path - the path
Throws:
org.apache.lens.api.LensException - the lens exception

getHiveSessionHandle

public static org.apache.hive.service.cli.SessionHandle getHiveSessionHandle(org.apache.lens.api.LensSessionHandle lensHandle)
Gets the hive session handle.

Parameters:
lensHandle - the lens handle
Returns:
the hive session handle

getLensConf

public org.apache.hadoop.conf.Configuration getLensConf(org.apache.lens.api.LensSessionHandle sessionHandle,
                                                        org.apache.lens.api.LensConf conf)
                                                 throws org.apache.lens.api.LensException
Gets the lens conf.

Parameters:
sessionHandle - the session handle
conf - the conf
Returns:
the lens conf
Throws:
org.apache.lens.api.LensException - the lens exception

getLensConf

public org.apache.hadoop.conf.Configuration getLensConf(org.apache.lens.api.LensConf conf)
                                                 throws org.apache.lens.api.LensException
Gets the lens conf.

Parameters:
conf - the conf
Returns:
the lens conf
Throws:
org.apache.lens.api.LensException - the lens exception

prepareStopping

public void prepareStopping()
Prepare stopping.


readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.