com.sun.grizzly.ssl
Class SSLHandshakeEncoder

java.lang.Object
  extended by com.sun.grizzly.ssl.SSLHandshakeEncoder
All Implemented Interfaces:
Transformer<Buffer,Buffer>

public class SSLHandshakeEncoder
extends Object
implements Transformer<Buffer,Buffer>

Transformer, which works as the encoder on the SSL handshaking phase.

Author:
Alexey Stashok

Constructor Summary
SSLHandshakeEncoder()
           
 
Method Summary
 Buffer getInput(AttributeStorage state)
          Gets the input data, which Transformer will work with.
 TransformationResult<Buffer> getLastResult(AttributeStorage state)
          Gets the last returned Transformer result.
 Buffer getOutput(AttributeStorage state)
          Gets the output, which Transformer will use for transformed data.
 AttributeHolder getProperties(AttributeStorage state)
          Gets the property storage, using which it's possible to read or update Transformer properties.
 void hibernate(AttributeStorage state)
          If hibernate is called - it means result data were not written on network completely and next write attempt may be executed in different thread, so we need to detach all thread associated resources.
 void release(AttributeStorage state)
          The Transformer has done its work and can release all associated resource.
 void setInput(AttributeStorage state, Buffer input)
          Sets the input data, which Transformer will work with.
 void setOutput(AttributeStorage state, Buffer output)
          Gets the output, which Transformer will use for transformed data.
 TransformationResult transform(AttributeStorage state)
          Transforms an input data to some custom representation.
 TransformationResult transform(AttributeStorage state, Buffer input, Buffer output)
          Transforms an input data to some custom representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLHandshakeEncoder

public SSLHandshakeEncoder()
Method Detail

transform

public TransformationResult transform(AttributeStorage state)
                               throws TransformationException
Description copied from interface: Transformer
Transforms an input data to some custom representation. Input and output are not passed implicitly, which means that Transformer is able to retrieve input and output from its internal state or from external storage (AttributeStorage).

Specified by:
transform in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could get/put a state.
Returns:
the result TransformationResult
Throws:
TransformationException

transform

public TransformationResult transform(AttributeStorage state,
                                      Buffer input,
                                      Buffer output)
                               throws TransformationException
Description copied from interface: Transformer
Transforms an input data to some custom representation.

Specified by:
transform in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
Returns:
the result TransformationResult
Throws:
TransformationException

getInput

public Buffer getInput(AttributeStorage state)
Description copied from interface: Transformer
Gets the input data, which Transformer will work with. Very often Transformers are used together with I/O operations. When Transformer is used with read operation, this method may return a Buffer, where "reader" will read the data to. But note, the returned Buffer should always represent READY data.In other words, if there is no data to be transformed - the Buffer should have 0 remaining bytes.

Specified by:
getInput in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
Returns:
the Transformer input.

setInput

public void setInput(AttributeStorage state,
                     Buffer input)
Description copied from interface: Transformer
Sets the input data, which Transformer will work with. Very often Transformers are used together with I/O operations. When Transformer is used with read operation, the input Buffer will be used by "reader" to read the data to. But note, the input Buffer should always represent READY data.In other words, if there is no data to be transformed - the Buffer should have 0 remaining bytes.

Specified by:
setInput in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
input - Input data

getOutput

public Buffer getOutput(AttributeStorage state)
Description copied from interface: Transformer
Gets the output, which Transformer will use for transformed data. Although output could be used to get a result of transformation, it is recommended to return transformation result directly from transform method within TransformationResult.

Specified by:
getOutput in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
Returns:
the Transformer output.

setOutput

public void setOutput(AttributeStorage state,
                      Buffer output)
Description copied from interface: Transformer
Gets the output, which Transformer will use for transformed data. Although output could be used to get a result of transformation, it is recommended to return transformation result directly from transform method within TransformationResult.

Specified by:
setOutput in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
output - Output

getLastResult

public TransformationResult<Buffer> getLastResult(AttributeStorage state)
Description copied from interface: Transformer
Gets the last returned Transformer result. Last result could be either retrieved from internal state, or external storage, which is passed as the parameter.

Specified by:
getLastResult in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
Returns:
the last returned Transformer result.

getProperties

public AttributeHolder getProperties(AttributeStorage state)
Description copied from interface: Transformer
Gets the property storage, using which it's possible to read or update Transformer properties.

Specified by:
getProperties in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.
Returns:
the property storage.

hibernate

public void hibernate(AttributeStorage state)
If hibernate is called - it means result data were not written on network completely and next write attempt may be executed in different thread, so we need to detach all thread associated resources.

Specified by:
hibernate in interface Transformer<Buffer,Buffer>
Parameters:
state -

release

public void release(AttributeStorage state)
Description copied from interface: Transformer
The Transformer has done its work and can release all associated resource.

Specified by:
release in interface Transformer<Buffer,Buffer>
Parameters:
state - the external state storage, where Transformer could retrieve or store its state.


Copyright © 2009 SUN Microsystems. All Rights Reserved.