Package com.yahoo.messagebus.test
Class SimpleProtocol
java.lang.Object
com.yahoo.messagebus.test.SimpleProtocol
- All Implemented Interfaces:
Protocol
- Author:
- Simon Thoresen Hult
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Defines a policy factory interface that tests can use to register arbitrary policies with this protocol. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPolicyFactory
(String name, SimpleProtocol.PolicyFactory factory) Registers a policy factory with this protocol under a given name.createPolicy
(String name, String param) Create a policy of the named type with the named param passed to the constructor of that policy.decode
(com.yahoo.component.Version version, byte[] data) Decodes the protocol specific data into a routable of the correct type.byte[]
Encodes the protocol specific data of a routable into a byte array.getName()
Returns a global unique name for this protocol.
-
Field Details
-
NAME
public static final com.yahoo.text.Utf8String NAME -
MESSAGE
public static final int MESSAGE- See Also:
-
REPLY
public static final int REPLY- See Also:
-
-
Constructor Details
-
SimpleProtocol
public SimpleProtocol()
-
-
Method Details
-
getName
Description copied from interface:Protocol
Returns a global unique name for this protocol. -
createPolicy
Description copied from interface:Protocol
Create a policy of the named type with the named param passed to the constructor of that policy.- Specified by:
createPolicy
in interfaceProtocol
- Parameters:
name
- the name of the policy to createparam
- the parameter to that policy's constructor- Returns:
- the created policy
-
decode
Description copied from interface:Protocol
Decodes the protocol specific data into a routable of the correct type. -
encode
Description copied from interface:Protocol
Encodes the protocol specific data of a routable into a byte array. -
addPolicyFactory
Registers a policy factory with this protocol under a given name. Whenever a policy is requested that matches this name, the factory is invoked.- Parameters:
name
- The name of the policy.factory
- The policy factory.
-