com.gridsystems.innergrid.kernel.services
Class Connector

java.lang.Object
  extended by com.gridsystems.innergrid.kernel.services.Connector
All Implemented Interfaces:
java.lang.Cloneable

public class Connector
extends java.lang.Object
implements java.lang.Cloneable

Type description.

Version:
1.0
Author:
Rodrigo Ruiz

Field Summary
static java.lang.String HTTP
          HTTP protocol identifier.
static java.lang.String HTTPS
          HTTPS protocol identifier.
 
Constructor Summary
Connector(java.lang.String name, int port, java.lang.String protocol)
          Creates a new instance.
 
Method Summary
static void addNewProtocol(java.lang.String protocol)
          Add to list of available protocols a new protocol.
 Connector copy()
          Type-safe version of clone().
static Connector fromString(java.lang.String s)
          Factory method that creates a Connector instance by parsing the specified string.
 int getAcceptCount()
          Gets the acceptCount value.
 java.lang.String getAddress()
          Gets the address value.
static java.lang.String[] getAvailableProtocols()
          Return list of available protocols.
 int getBufferSize()
          Gets the bufferSize value.
 java.lang.String getClientAuth()
          Gets the clientAuth value.
 java.lang.String getCompression()
          Gets the compression value.
 int getConnectionLinger()
          Gets the connectionLinger value.
 long getConnectionTimeout()
          Gets the connectionTimeout value.
 int getMaxProcessors()
          Gets the maxProcessors value.
 int getMinProcessors()
          Gets the minProcessors value.
 java.lang.String getName()
          Gets the name value.
 int getPort()
          Gets the port value.
 java.lang.String getProtocol()
           
 java.lang.String getScheme()
          Gets the name of the protocol to have returned by calls to request.getScheme().
 boolean isEnableLookups()
          Gets the enableLookups value.
 boolean isUserCreated()
          Gets the userCreated value.
static java.util.List<Connector> loadFromFile(java.io.File f)
          Reads a list of Connector instance from a text file, and returns it into an ArrayList instance.
static Connector merge(Connector c1, Connector c2)
          Merges two instances in a new one.
static void saveToFile(java.io.File f, java.util.List list)
          Saves to a text file the list of connectors.
 void setAcceptCount(int acceptCount)
          Sets the acceptCount value.
 void setAddress(java.lang.String address)
          Sets the address value.
 void setBufferSize(int bufferSize)
          Sets the bufferSize value.
 void setClientAuth(java.lang.String clientAuth)
          Sets the clientAuth value.
 void setCompression(java.lang.String compression)
          Sets the compression value.
 void setConnectionLinger(int connectionLinger)
          Sets the connectionLinger value.
 void setConnectionTimeout(long connectionTimeout)
          Sets the connectionTimeout value.
 void setEnableLookups(boolean enableLookups)
          Sets the enableLookups value.
 void setMaxProcessors(int maxProcessors)
          Sets the maxProcessors value.
 void setMinProcessors(int minProcessors)
          Sets the minProcessors value.
 void setName(java.lang.String name)
          Sets the name value.
 void setPort(int port)
          Sets the port value.
 void setProtocol(java.lang.String protocol)
           
 void setUserCreated(boolean userCreated)
          Sets the userCreated value.
 java.lang.String toString()
           WARNING: SJM.
static java.lang.String toXML(java.util.List conns, java.lang.String keystore, java.lang.String password, java.lang.String trustStore, java.lang.String trustPaswd)
          Converts a list of connectors into an XML string.
 java.lang.String toXML(java.lang.String keystore, java.lang.String password, java.lang.String truststore, java.lang.String trustpass)
          Gets an XML fragment for insertion into a Tomcat server.xml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HTTP

public static final java.lang.String HTTP
HTTP protocol identifier.

See Also:
Constant Field Values

HTTPS

public static final java.lang.String HTTPS
HTTPS protocol identifier.

See Also:
Constant Field Values
Constructor Detail

Connector

public Connector(java.lang.String name,
                 int port,
                 java.lang.String protocol)
Creates a new instance.

Parameters:
name - the connector display name
port - the connector port
protocol - The protocol.
Method Detail

getAcceptCount

public int getAcceptCount()
Gets the acceptCount value.

Returns:
The acceptCount

setAcceptCount

public void setAcceptCount(int acceptCount)
Sets the acceptCount value.

Parameters:
acceptCount - The acceptCount to set

getAddress

public java.lang.String getAddress()
Gets the address value.

Returns:
The address

setAddress

public void setAddress(java.lang.String address)
Sets the address value.

Parameters:
address - The address to set

getBufferSize

public int getBufferSize()
Gets the bufferSize value.

Returns:
The bufferSize

setBufferSize

public void setBufferSize(int bufferSize)
Sets the bufferSize value.

Parameters:
bufferSize - The bufferSize to set

getClientAuth

public java.lang.String getClientAuth()
Gets the clientAuth value.

Returns:
The attribute value

setClientAuth

public void setClientAuth(java.lang.String clientAuth)
Sets the clientAuth value.

Parameters:
clientAuth - The attribute value. Valid values are (false, true, want)

getCompression

public java.lang.String getCompression()
Gets the compression value.

Returns:
The compression

setCompression

public void setCompression(java.lang.String compression)
Sets the compression value.

Parameters:
compression - The compression to set

getConnectionLinger

public int getConnectionLinger()
Gets the connectionLinger value.

Returns:
The connectionLinger

setConnectionLinger

public void setConnectionLinger(int connectionLinger)
Sets the connectionLinger value.

Parameters:
connectionLinger - The connectionLinger to set

getConnectionTimeout

public long getConnectionTimeout()
Gets the connectionTimeout value.

Returns:
The connectionTimeout

setConnectionTimeout

public void setConnectionTimeout(long connectionTimeout)
Sets the connectionTimeout value.

Parameters:
connectionTimeout - The connectionTimeout to set

isEnableLookups

public boolean isEnableLookups()
Gets the enableLookups value.

Returns:
The enableLookups

setEnableLookups

public void setEnableLookups(boolean enableLookups)
Sets the enableLookups value.

Parameters:
enableLookups - The enableLookups to set

getMaxProcessors

public int getMaxProcessors()
Gets the maxProcessors value.

Returns:
The maxProcessors

setMaxProcessors

public void setMaxProcessors(int maxProcessors)
Sets the maxProcessors value.

Parameters:
maxProcessors - The maxProcessors to set

getMinProcessors

public int getMinProcessors()
Gets the minProcessors value.

Returns:
The minProcessors

setMinProcessors

public void setMinProcessors(int minProcessors)
Sets the minProcessors value.

Parameters:
minProcessors - The minProcessors to set

getName

public java.lang.String getName()
Gets the name value.

Returns:
The name

setName

public void setName(java.lang.String name)
Sets the name value.

Parameters:
name - The name to set

getPort

public int getPort()
Gets the port value.

Returns:
The port

setPort

public void setPort(int port)
Sets the port value.

Parameters:
port - The port to set

isUserCreated

public boolean isUserCreated()
Gets the userCreated value.

Returns:
The userCreated

setUserCreated

public void setUserCreated(boolean userCreated)
Sets the userCreated value.

Parameters:
userCreated - The userCreated to set

getScheme

public java.lang.String getScheme()
Gets the name of the protocol to have returned by calls to request.getScheme().

It can be "http" or "https", depending on the secure flag value.

Returns:
The connector scheme.

toString

public java.lang.String toString()
WARNING: SJM. The RedundantServerPlugin has a copy of this class to read the data of the ports of the server. That copy needs to be updated when this class suffers changes that do affect the serialization of the port list.

Overrides:
toString in class java.lang.Object

copy

public Connector copy()
Type-safe version of clone().

Returns:
a copy of this instance

toXML

public java.lang.String toXML(java.lang.String keystore,
                              java.lang.String password,
                              java.lang.String truststore,
                              java.lang.String trustpass)
Gets an XML fragment for insertion into a Tomcat server.xml file. WARNING: SJM. The RedundantServerPlugin has a copy of this class to read the data of the ports of the server. That copy needs to be updated when this class suffers changes that do affect the serialization of the port list.

Parameters:
keystore - the path to the keystore (for SSL connectors)
password - the keystore password (for SSL connectors)
truststore - the path to the truststore (optional, for SSL connectors)
trustpass - the truststore password (optional, for SSL connectors)
Returns:
a string with the XML representation of this object

toXML

public static java.lang.String toXML(java.util.List conns,
                                     java.lang.String keystore,
                                     java.lang.String password,
                                     java.lang.String trustStore,
                                     java.lang.String trustPaswd)
Converts a list of connectors into an XML string. WARNING: SJM. The RedundantServerPlugin has a copy of this class to read the data of the ports of the server. That copy needs to be updated when this class suffers changes that do affect the serialization of the port list.

Parameters:
conns - the list of connectors
keystore - the keystore path
password - the keystore password
trustStore - the trust store
trustPaswd - the trust store password
Returns:
the xml for a Tomcat server.xml configuration file

merge

public static Connector merge(Connector c1,
                              Connector c2)
Merges two instances in a new one.

The created instance will have its attributes set to appropriate values for serving both Connectors.

Parameters:
c1 - The first connector
c2 - The second connector
Returns:
A connector with merged attributes

fromString

public static Connector fromString(java.lang.String s)
                            throws java.text.ParseException
Factory method that creates a Connector instance by parsing the specified string. WARNING: SJM. The RedundantServerPlugin has a copy of this class to read the data of the ports of the server. That copy needs to be updated when this class suffers changes that do affect the serialization of the port list.

Parameters:
s - the string to parse
Returns:
a Connector instance
Throws:
java.text.ParseException - if a syntax error is detected

loadFromFile

public static java.util.List<Connector> loadFromFile(java.io.File f)
                                              throws java.io.IOException,
                                                     java.text.ParseException
Reads a list of Connector instance from a text file, and returns it into an ArrayList instance.

Parameters:
f - the file to read from
Returns:
the list
Throws:
java.io.IOException - If a read error occurs
java.text.ParseException - If a syntax error occurs

saveToFile

public static void saveToFile(java.io.File f,
                              java.util.List list)
                       throws java.io.IOException
Saves to a text file the list of connectors.

Parameters:
f - the destination file
list - the list of connectors
Throws:
java.io.IOException - If a write error occurs
java.lang.ClassCastException - If an element of the list is not a Connector instance

getProtocol

public java.lang.String getProtocol()
Returns:
Returns the protocol.

setProtocol

public void setProtocol(java.lang.String protocol)
Parameters:
protocol - The protocol to set.

addNewProtocol

public static void addNewProtocol(java.lang.String protocol)
Add to list of available protocols a new protocol.

Parameters:
protocol - New protocol to add.

getAvailableProtocols

public static java.lang.String[] getAvailableProtocols()
Return list of available protocols.

Returns:
List of available protocols.


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.