netcom.proxy
Class HandleXMLTask

java.lang.Object
  extended bynetcom.proxy.HandleXMLTask
All Implemented Interfaces:
java.lang.Runnable

public class HandleXMLTask
extends java.lang.Object
implements java.lang.Runnable

Title: Handle XML Task

Description: Class which is a task to handle the parsing of XML into Requests, doing authentication, and sending Requests along their way

Copyright: Copyright (c) 2002

Company:


Constructor Summary
HandleXMLTask(java.util.Map outgoing_sockets, java.net.Socket incoming_socket, WrappedInputStream wrapped_in, java.util.Map incoming_names, java.util.Collection outside_connects, LDAPCommunicator ldap_communicator, Logger log, Document doc, java.util.Map object_streams, java.util.Map return_streams)
          Constructor, This takes a socket and a map of PServer to MDS sockets and handles tasks coming from the outside (e.g.
HandleXMLTask(java.net.Socket new_socket, java.util.Map outgoing_sockets, java.util.Collection outside_connects, java.util.Map incoming_names, LDAPCommunicator ldap_communicator, Logger log, AddressPort inet_sock, java.util.Map return_streams)
          Constructor, This takes a new socket, a map of PServer to MDS sockets and a List of active sockets and handles tasks coming from the outside (e.g.
 
Method Summary
 boolean addNewUser(java.lang.String name, java.lang.String password)
          Method to talk with LDAP and add a new user
 void addPServerPipe(java.net.Socket in_socket)
          method to create a new connection to a MDS node for a PServer
 int checkAuth(java.lang.String name, java.lang.String password)
          Method to check the authorization of a login and password
 NodeEntry getBestPClientMDS()
          Method to find the best MDS according to PClient load-balancing criteria
 NodeEntry getBestPServerMDS()
          Method to find the best MDS according to PServer load-balancing criteria
 boolean logout(java.lang.String type)
          Method to handle a logout XML message(Element child
 void parseXML(java.io.BufferedInputStream xml_stream)
          Major method to parse an XML stream (socket) and then call the appropriate other functions to handle the XML message.
 void parseXMLAuth()
          PClients and PServers that are logged in get put in a list that is polled for xml data.
 void run()
          Handles the XML requests from the outside
 void sendError(Document response_doc)
          Method to send and Error back to an originating socket (PClient or PServer)
 void sendPServerRequest(AbstractRequest new_request)
          Method to send a PServer request to a MDS node
 void sendSearchRequest(SearchRequest search_request)
          Method to send a search request to a MDS node, ie open a socket, send, then drop it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandleXMLTask

public HandleXMLTask(java.util.Map outgoing_sockets,
                     java.net.Socket incoming_socket,
                     WrappedInputStream wrapped_in,
                     java.util.Map incoming_names,
                     java.util.Collection outside_connects,
                     LDAPCommunicator ldap_communicator,
                     Logger log,
                     Document doc,
                     java.util.Map object_streams,
                     java.util.Map return_streams)
Constructor, This takes a socket and a map of PServer to MDS sockets and handles tasks coming from the outside (e.g. PServer/PClient connections tasks) if the socket has been authenticated

Parameters:
outgoing_sockets - the map of PServer to MDS
incoming_socket - the socket that needs a task done
incoming_names - the map of sockets connections to usernames
ldap_communicator - Handles communication with LDAP server
log - Logs events

HandleXMLTask

public HandleXMLTask(java.net.Socket new_socket,
                     java.util.Map outgoing_sockets,
                     java.util.Collection outside_connects,
                     java.util.Map incoming_names,
                     LDAPCommunicator ldap_communicator,
                     Logger log,
                     AddressPort inet_sock,
                     java.util.Map return_streams)
Constructor, This takes a new socket, a map of PServer to MDS sockets and a List of active sockets and handles tasks coming from the outside (e.g. PServer/PClient connections tasks).

Parameters:
new_socket - the socket that needs a task done
outgoing_sockets - the map of PServer to MDS
outside_connects - List of active authenticated sockets
incoming_names - the map of sockets connections to usernames
ldap_communicator - Handles communication with LDAP server
log - Logs events
inet_sock - The socket address of the MDSProxy server socket
Method Detail

run

public void run()
Handles the XML requests from the outside

Specified by:
run in interface java.lang.Runnable

parseXML

public void parseXML(java.io.BufferedInputStream xml_stream)
Major method to parse an XML stream (socket) and then call the appropriate other functions to handle the XML message. New incoming connections get parsed here.

Parameters:
xml_stream - the icoming socket's input stream

parseXMLAuth

public void parseXMLAuth()
PClients and PServers that are logged in get put in a list that is polled for xml data.


checkAuth

public int checkAuth(java.lang.String name,
                     java.lang.String password)
Method to check the authorization of a login and password


addNewUser

public boolean addNewUser(java.lang.String name,
                          java.lang.String password)
Method to talk with LDAP and add a new user


logout

public boolean logout(java.lang.String type)
Method to handle a logout XML message(Element child


getBestPClientMDS

public NodeEntry getBestPClientMDS()
Method to find the best MDS according to PClient load-balancing criteria


getBestPServerMDS

public NodeEntry getBestPServerMDS()
Method to find the best MDS according to PServer load-balancing criteria


addPServerPipe

public void addPServerPipe(java.net.Socket in_socket)
method to create a new connection to a MDS node for a PServer


sendPServerRequest

public void sendPServerRequest(AbstractRequest new_request)
Method to send a PServer request to a MDS node


sendError

public void sendError(Document response_doc)
Method to send and Error back to an originating socket (PClient or PServer)


sendSearchRequest

public void sendSearchRequest(SearchRequest search_request)
Method to send a search request to a MDS node, ie open a socket, send, then drop it