public class CGThriftServerHandler extends Object implements org.wso2.carbon.cloud.gateway.common.thrift.gen.CloudGatewayService.Iface
Constructor and Description |
---|
CGThriftServerHandler(org.apache.axis2.transport.base.threads.WorkerPool workerPool) |
Modifier and Type | Method and Description |
---|---|
static void |
addNewRequestBuffer(String token)
Add a new request buffer to the list of request buffers
|
static void |
addRequestMessage(org.wso2.carbon.cloud.gateway.common.thrift.gen.Message msg,
String token)
Add a message into the server's request buffer, wait if the buffer is full.
|
List<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> |
exchange(List<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> responseMessageList,
int blockSize,
String token)
This will perform the exchange of data buffers between the client and the server.
|
static Map<String,org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> |
getMiddleBuffer() |
BlockingQueue<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> |
getRequestBuffer(String token)
Return the request message buffer
Note that since the buffers are static objects anybody has the access to buffers (and
the data inside them) but before deploy any custom be warned to review them!
|
static Map<String,BlockingQueue<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message>> |
getRequestBuffers()
Return the list of request buffers
Note that since the buffers are static objects anybody has the access to buffers (and
the data inside them) but before deploy any custom be warned to review them!
|
static org.wso2.carbon.cloud.gateway.common.thrift.gen.Message |
getResponseMessage()
Return the head of the response buffer, not that if there are no message it'll
block if no messages available.
|
static String |
getSecureUUID(String queueName)
Return the token give the queue name
|
static Map<String,Semaphore> |
getSemaphoreMap() |
String |
login(String userName,
String password,
String queueName)
Allow access to user userName for the buffer queueName and return the token or throw
exception if user can't allow access to the buffer
|
public CGThriftServerHandler(org.apache.axis2.transport.base.threads.WorkerPool workerPool)
public String login(String userName, String password, String queueName) throws org.wso2.carbon.cloud.gateway.common.thrift.gen.NotAuthorizedException, org.apache.thrift.TException
login
in interface org.wso2.carbon.cloud.gateway.common.thrift.gen.CloudGatewayService.Iface
userName
- user name of the clientpassword
- password of the clientqueueName
- the name of the buffer to use should allow access toorg.wso2.carbon.cloud.gateway.common.thrift.gen.NotAuthorizedException
- throws in case of illegal accessorg.apache.thrift.TException
- throws in case of an connection errorpublic List<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> exchange(List<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> responseMessageList, int blockSize, String token) throws org.wso2.carbon.cloud.gateway.common.thrift.gen.NotAuthorizedException, org.apache.thrift.TException
exchange
in interface org.wso2.carbon.cloud.gateway.common.thrift.gen.CloudGatewayService.Iface
responseMessageList
- The response buffer from thrift clientblockSize
- size of the message bulk that need to return clienttoken
- the token to authorize the exchange operationorg.wso2.carbon.cloud.gateway.common.thrift.gen.NotAuthorizedException
- in case the provided token is invalidorg.apache.thrift.TException
- in case of an errorpublic static void addRequestMessage(org.wso2.carbon.cloud.gateway.common.thrift.gen.Message msg, String token) throws org.apache.axis2.AxisFault
msg
- the new Thrift messagetoken
- the token to look up the real bufferorg.apache.axis2.AxisFault
- in case of an error - for e.g. out of space in the queuepublic static org.wso2.carbon.cloud.gateway.common.thrift.gen.Message getResponseMessage()
public BlockingQueue<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message> getRequestBuffer(String token)
token
- the token to the buffer is bound topublic static String getSecureUUID(String queueName)
queueName
- queue namepublic static Map<String,BlockingQueue<org.wso2.carbon.cloud.gateway.common.thrift.gen.Message>> getRequestBuffers()
public static void addNewRequestBuffer(String token)
token
- the token for the new bufferCopyright © 2019 WSO2. All rights reserved.