Package handlers.files

Source Code of handlers.files.ResultsHandler

package handlers.files;


import handlers.AbstractServerHandler;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import queries.Query;
import queries.QueryManager;

import static main.ServerMain.*;

import connection.ClientConnection;


public class ResultsHandler extends AbstractServerHandler
{
  @SuppressWarnings("unchecked")
  public void execute(ClientConnection connection, ObjectInputStream is,
      ObjectOutputStream os) throws IOException, ClassNotFoundException
  {
    int queryId = is.readInt();
    Object results = is.readObject();

    QueryManager queryManager = getQueryManager();

    Query query = queryManager.getQuery(queryId);
    if (query == null)
    {
      return;
    }

    ClientConnection client = getConnectionManager().getClientById(
        query.getQuerierId());
    if (client == null)
    {
      return;
    }

    client.sendSearchResults(query.getQuerierCookie(), results);
  }

}
TOP

Related Classes of handlers.files.ResultsHandler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.