Java 类com.amazonaws.mturk.filter.Message 实例源码

项目:java-aws-mturk    文件:AppendKeywordFilter.java   
/**
 * Checks if method is createHIT and appends 'myHIT' to the set of keywords
 */
@Override
public Reply execute(Message m) throws ServiceException {
    if (m.getMethodName().equals("CreateHIT")) {
        CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
        for (CreateHITRequest request : requestArray) {
            StringBuffer keywords = new StringBuffer();
            //append existing keywords to string buffer 
            if (request.getKeywords() != null) {
                keywords.append(request.getKeywords());
                keywords.append(", ");
            }
            keywords.append("myHIT");
            request.setKeywords(keywords.toString());
        }
    }
    //pass the message to the next filter
    return passMessage(m);
}
项目:mturksdk-java-code-maven    文件:AppendKeywordFilter.java   
/**
 * Checks if method is createHIT and appends 'myHIT' to the set of keywords
 */
@Override
public Reply execute(Message m) throws ServiceException {
    if (m.getMethodName().equals("CreateHIT")) {
        CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
        for (CreateHITRequest request : requestArray) {
            StringBuffer keywords = new StringBuffer();
            //append existing keywords to string buffer 
            if (request.getKeywords() != null) {
                keywords.append(request.getKeywords());
                keywords.append(", ");
            }
            keywords.append("myHIT");
            request.setKeywords(keywords.toString());
        }
    }
    //pass the message to the next filter
    return passMessage(m);
}
项目:gort-public    文件:AppendKeywordFilter.java   
/**
 * Checks if method is createHIT and appends 'myHIT' to the set of keywords
 */
@Override
public Reply execute(Message m) throws ServiceException {
    if (m.getMethodName().equals("CreateHIT")) {
        CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
        for (CreateHITRequest request : requestArray) {
            StringBuffer keywords = new StringBuffer();
            //append existing keywords to string buffer 
            if (request.getKeywords() != null) {
                keywords.append(request.getKeywords());
                keywords.append(", ");
            }
            keywords.append("myHIT");
            request.setKeywords(keywords.toString());
        }
    }
    //pass the message to the next filter
    return passMessage(m);
}
项目:java-aws-mturk    文件:TestFilter.java   
public Reply execute(Message m) {
    if (m.getMethodName().equals("CreateHIT")) {
        CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
        for (CreateHITRequest request : requestArray) {
            if (request.getReward().getAmount().doubleValue() < 0.05) {
                request.getReward().setAmount(new BigDecimal(0.05));
            }
        }
    }
    return passMessage(m);
}
项目:mturksdk-java-code-maven    文件:TestFilter.java   
public Reply execute(Message m) {
    if (m.getMethodName().equals("CreateHIT")) {
        CreateHITRequest[] requestArray = (CreateHITRequest[]) m.getRequests();
        for (CreateHITRequest request : requestArray) {
            if (request.getReward().getAmount().doubleValue() < 0.05) {
                request.getReward().setAmount(new BigDecimal(0.05));
            }
        }
    }
    return passMessage(m);
}
项目:java-aws-mturk    文件:AsyncRequest.java   
/**
 * Returns the message that is/was send to the requester service
 */
public Message getMessage() {
  return message;
}
项目:mturksdk-java-code-maven    文件:AsyncRequest.java   
/**
 * Returns the message that is/was send to the requester service
 */
public Message getMessage() {
  return message;
}
项目:java-aws-mturk    文件:FilteredAWSService.java   
/**
 * Enqueues the request array in the Axis work queue for asynchronous sending.
 * The result can be obtained through the future contained in the AsyncReply
 * 
 * The work queue is using a pool of daemon threads to process the submitted tasks.
 * To guarantee that all work submitted to the queue was processed before the JVM
 * exits, this requires to wait for all future results of the submitted work items.
 * This can conveniently be done using the getResult() method of the AsyncReply
 * object returned by this method. A typical usage pattern would be to first submit
 * all requests to the work queue, store the AsyncReply objects in an array and then
 * call getResult() for each of the objects in the array.
 *  
 * @param requests
 * @param axisMethodName
 * @param resultAccessorName
 * @param callback  Callback interface to invoke when the request has been processed (optional)
 * @return
 */    
protected AsyncReply executeAsyncRequests(Object requests, String axisMethodName,
        String resultAccessorName, AsyncCallback callback) {

    Message message = new Message(requests, axisMethodName, resultAccessorName, null);

    return WorkQueue.submit(new AsyncRequest(message, this.filterList.getFirst(), callback));
}
项目:mturksdk-java-code-maven    文件:FilteredAWSService.java   
/**
 * Enqueues the request array in the Axis work queue for asynchronous sending.
 * The result can be obtained through the future contained in the AsyncReply
 * 
 * The work queue is using a pool of daemon threads to process the submitted tasks.
 * To guarantee that all work submitted to the queue was processed before the JVM
 * exits, this requires to wait for all future results of the submitted work items.
 * This can conveniently be done using the getResult() method of the AsyncReply
 * object returned by this method. A typical usage pattern would be to first submit
 * all requests to the work queue, store the AsyncReply objects in an array and then
 * call getResult() for each of the objects in the array.
 *  
 * @param requests
 * @param axisMethodName
 * @param resultAccessorName
 * @param callback  Callback interface to invoke when the request has been processed (optional)
 * @return
 */    
protected AsyncReply executeAsyncRequests(Object requests, String axisMethodName,
        String resultAccessorName, AsyncCallback callback) {

    Message message = new Message(requests, axisMethodName, resultAccessorName, null);

    return WorkQueue.submit(new AsyncRequest(message, this.filterList.getFirst(), callback));
}
项目:java-aws-mturk    文件:AsyncReply.java   
/**
 * Constructs a new reply once the message is submitted to the Axis work
 * queue
 * 
 * @param msg
 *            The request message to send
 * @param f
 *            The future contain the result of the asynchronous call
 */
public AsyncReply(Message msg, Future<Object> f) {
  this.future = f;
  this.requestMsg = msg;
}
项目:java-aws-mturk    文件:AsyncReply.java   
/**
 * Returns the request for this reply
 * 
 * @return
 */
public Message getRequestMessage() {
  return requestMsg;
}
项目:java-aws-mturk    文件:AsyncRequest.java   
/**
 * Creates a new asynchronous request
 * 
 * @param msg       The request to send to the requester endpoint
 * @param f         The first filter to invoke
 * @param callback  (Optional) A callback handler to invoke when the work queue processed the request
 */
public AsyncRequest(Message msg, Filter f, AsyncCallback callback) {
  this.message = msg;
  this.firstFilter = f;
  this.cb = callback;
}
项目:java-aws-mturk    文件:FilteredAWSService.java   
/**
 * Sets the common parameters, sends an array of AWS requests to the service, 
 * and returns results.
 * 
 * @see http://docs.amazonwebservices.com/AWSMechanicalTurkRequester/2006-10-31/ApiReference_CommonParametersArticle.html
 * @param requests
 * @param axisMethodName
 * @param resultAccessorName
 * @param credential
 * @return Result
 * @throws ServiceException
 */
protected Object [] executeRequests(Object requests, String axisMethodName,
        String resultAccessorName, String credential) {
    Message message = new Message(requests, axisMethodName, resultAccessorName, credential); 
    return this.filterList.getFirst().execute(message).getResults();
}
项目:mturksdk-java-code-maven    文件:AsyncReply.java   
/**
 * Constructs a new reply once the message is submitted to the Axis work
 * queue
 * 
 * @param msg
 *            The request message to send
 * @param f
 *            The future contain the result of the asynchronous call
 */
public AsyncReply(Message msg, Future<Object> f) {
  this.future = f;
  this.requestMsg = msg;
}
项目:mturksdk-java-code-maven    文件:AsyncReply.java   
/**
 * Returns the request for this reply
 * 
 * @return
 */
public Message getRequestMessage() {
  return requestMsg;
}
项目:mturksdk-java-code-maven    文件:AsyncRequest.java   
/**
 * Creates a new asynchronous request
 * 
 * @param msg       The request to send to the requester endpoint
 * @param f         The first filter to invoke
 * @param callback  (Optional) A callback handler to invoke when the work queue processed the request
 */
public AsyncRequest(Message msg, Filter f, AsyncCallback callback) {
  this.message = msg;
  this.firstFilter = f;
  this.cb = callback;
}
项目:mturksdk-java-code-maven    文件:FilteredAWSService.java   
/**
 * Sets the common parameters, sends an array of AWS requests to the service, 
 * and returns results.
 * 
 * @see http://docs.amazonwebservices.com/AWSMechanicalTurkRequester/2006-10-31/ApiReference_CommonParametersArticle.html
 * @param requests
 * @param axisMethodName
 * @param resultAccessorName
 * @param credential
 * @return Result
 * @throws ServiceException
 */
protected Object [] executeRequests(Object requests, String axisMethodName,
        String resultAccessorName, String credential) {
    Message message = new Message(requests, axisMethodName, resultAccessorName, credential); 
    return this.filterList.getFirst().execute(message).getResults();
}