Package connection.peer.secure

Source Code of connection.peer.secure.ServerSideSecurableConnection

package connection.peer.secure;


import handlers.AbstractContextualHandler;
import handlers.sets.ServerSideSecurityHandlerSet;

import java.io.IOException;

import main.settings.Settings;

import common.connection.AbstractConnection;
import common.handlers.AbstractHandlerSet;
import connection.peer.secure.reconnector.ServerSideReconnector;


public class ServerSideSecurableConnection extends AbstractSecurableConnection
{
  private static final ServerSideSecurityHandlerSet HANDLER_SET = new ServerSideSecurityHandlerSet();

  public ServerSideSecurableConnection(ConnectionSecurerInterface requestor)
      throws IOException
  {
    super(requestor);
  }

  protected SecurityAbility determineSecurityAbility()
  {
    if (Settings.connection.security.from_peers)
    {
      return SecurityAbility.WANT;
    }
    else
    {
      return SecurityAbility.CAN;
    }
  }

  protected AbstractHandlerSet getHandlerSet()
  {
    return HANDLER_SET;
  }

  public AbstractContextualHandler getContextualHandler(int protocolId, int opcode)
      throws IOException, ClassNotFoundException
  {
    return ServerSideSecurityHandlerSet.HANDLERS[protocolId][opcode]
        .createContext(this);
  }

  protected AbstractConnection reconnect(ConnectionSecurerInterface securer)
      throws IOException
  {
    return new ServerSideReconnector(this, securer).reconnect();
  }

}
TOP

Related Classes of connection.peer.secure.ServerSideSecurableConnection

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.