Class GridRestProtocolAdapter
- java.lang.Object
-
- org.apache.ignite.internal.processors.rest.protocols.GridRestProtocolAdapter
-
- All Implemented Interfaces:
GridRestProtocol
- Direct Known Subclasses:
GridTcpRestProtocol
public abstract class GridRestProtocolAdapter extends Object implements GridRestProtocol
Abstract protocol adapter.
-
-
Field Summary
Fields Modifier and Type Field Description protected GridKernalContextctxContext.protected InetAddresshostHost used by this protocol.protected IgniteLoggerlogLogger.protected intportPort used by this protocol.protected StringsecretKeySecret key.
-
Constructor Summary
Constructors Modifier Constructor Description protectedGridRestProtocolAdapter(GridKernalContext ctx)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertParameter(boolean cond, String condDesc)protected booleanauthenticate(@Nullable String tok)Authenticates current request.protected ConnectorConfigurationconfig()protected abstract StringgetAddressPropertyName()Return node attribute name to store used address.protected abstract StringgetHostNamePropertyName()Return node attribute name to store used host name.protected abstract StringgetPortPropertyName()Return node attribute name to store used port number.Collection<IgniteBiTuple<String,Object>>getProperties()Returns protocol properties for setting node attributes.voidonKernalStart()Grid start callback.voidonProcessorStart()Processor start callback.protected StringstartInfo()protected StringstopInfo()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.rest.GridRestProtocol
name, start, stop
-
-
-
-
Field Detail
-
ctx
protected final GridKernalContext ctx
Context.
-
log
protected final IgniteLogger log
Logger.
-
secretKey
protected final String secretKey
Secret key.
-
host
protected InetAddress host
Host used by this protocol.
-
port
protected int port
Port used by this protocol.
-
-
Constructor Detail
-
GridRestProtocolAdapter
protected GridRestProtocolAdapter(GridKernalContext ctx)
- Parameters:
ctx- Context.
-
-
Method Detail
-
authenticate
protected boolean authenticate(@Nullable @Nullable String tok)Authenticates current request.Token consists of 2 parts separated by semicolon:
- Timestamp (time in milliseconds)
- Base64 encoded SHA1 hash of {1}:{secretKey}
- Parameters:
tok- Authentication token.- Returns:
trueif authentication info provided in request is correct.
-
startInfo
protected String startInfo()
- Returns:
- Start information string.
-
stopInfo
protected String stopInfo()
- Returns:
- Stop information string.
-
assertParameter
protected final void assertParameter(boolean cond, String condDesc) throws IgniteCheckedException- Parameters:
cond- Condition to check.condDesc- Error message.- Throws:
IgniteCheckedException- If check failed.
-
config
protected ConnectorConfiguration config()
- Returns:
- Client configuration.
-
getProperties
public Collection<IgniteBiTuple<String,Object>> getProperties()
Returns protocol properties for setting node attributes. Has meaningful result only after protocol start.- Specified by:
getPropertiesin interfaceGridRestProtocol- Returns:
- Protocol properties.
-
getAddressPropertyName
protected abstract String getAddressPropertyName()
Return node attribute name to store used address.- Returns:
- Node attribute name.
-
getHostNamePropertyName
protected abstract String getHostNamePropertyName()
Return node attribute name to store used host name.- Returns:
- Node attribute name.
-
getPortPropertyName
protected abstract String getPortPropertyName()
Return node attribute name to store used port number.- Returns:
- Node attribute name.
-
onKernalStart
public void onKernalStart()
Grid start callback.- Specified by:
onKernalStartin interfaceGridRestProtocol
-
onProcessorStart
public void onProcessorStart()
Processor start callback.- Specified by:
onProcessorStartin interfaceGridRestProtocol
-
-