Class SerializationServices
- java.lang.Object
- 
- jadex.platform.service.serialization.SerializationServices
 
- 
- All Implemented Interfaces:
- ISerializationServices
 
 public class SerializationServices extends java.lang.Object implements ISerializationServices Functionality for managing serialization.
- 
- 
Field SummaryFields Modifier and Type Field Description protected ICodec[]codecsAll available codecs.protected ISerializerdefaultsendserializerDefault serializer used for sending.protected ISerializeroptimizedsendserializerOptimized serializer used for sending to platforms with the same version.protected ITraverseProcessor[]postprocessorsPostprocessors for decoding.protected ITraverseProcessor[]preprocessorsPreprocessors for encoding.protected java.util.Map<java.lang.Class<?>,boolean[]>referencesThe reference class cache (clazz->boolean (is reference)).protected RemoteReferenceModulerrmThe remote reference moduleprotected IRwMap<IComponentIdentifier,java.lang.Boolean>sameversioncacheCache for identifying platforms with the same version.protected ISecurityServicesecservThe security service which injects itself once available.protected ICodec[]sendcodecsCodecs used for sending.protected ISerializer[]serializersAll available serializers
 - 
Constructor SummaryConstructors Constructor Description SerializationServices(IComponentIdentifier comp)Creates the management.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringconvertObjectToString(java.lang.Object val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.String mediatype, java.lang.Object context)Convert object to string.java.lang.ObjectconvertStringToObject(java.lang.String val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.String mediatype, java.lang.Object context)Convert string to object.java.util.List<ITraverseProcessor>createPostprocessors()Create the preprocessors.java.util.List<ITraverseProcessor>createPreprocessors()java.lang.Objectdecode(IMsgHeader header, IInternalAccess component, byte[] enc)Decodes/deserializes an object.byte[]encode(IMsgHeader header, IInternalAccess component, java.lang.Object obj)Encodes/serializes an object for a particular receiver.java.util.List<ITraverseProcessor>getCloneProcessors()Get the clone processors.ICodec[]getCodecs()Returns all codecs.ITraverseProcessor[]getPostprocessors()Gets the post-processors for decoding a received message.protected static intgetPrefixSize(int codeccount)ITraverseProcessor[]getPreprocessors()Gets the pre-processors for encoding a received message.RemoteReferenceModulegetRemoteReferenceModule()Get the remote reference module.ICodec[]getSendCodecs(IComponentIdentifier receiver)Returns the codecs for sending.ISerializergetSendSerializer(IComponentIdentifier receiverplatform)Returns the serializer for sending.static ISerializationServicesgetSerializationServices(IComponentIdentifier platform)Gets the serialization services.ISerializergetSerializer(int id)Returns a serializer per id.ISerializer[]getSerializers()Returns all serializers.java.util.Map<java.lang.String,IStringConverter>getStringConverters()Get the string converters (can convert to and from string, possibly only for some types).booleanisLocalReference(java.lang.Object object)Test if an object has reference semantics.booleanisRemoteObject(java.lang.Object target)Test if an object is a remote object.voidsetSecurityService(ISecurityService secserv)Injects the security service.
 
- 
- 
- 
Field Detail- 
rrmprotected RemoteReferenceModule rrm The remote reference module
 - 
defaultsendserializerprotected ISerializer defaultsendserializer Default serializer used for sending.
 - 
optimizedsendserializerprotected ISerializer optimizedsendserializer Optimized serializer used for sending to platforms with the same version.
 - 
serializersprotected ISerializer[] serializers All available serializers
 - 
sendcodecsprotected ICodec[] sendcodecs Codecs used for sending.
 - 
codecsprotected ICodec[] codecs All available codecs.
 - 
preprocessorsprotected ITraverseProcessor[] preprocessors Preprocessors for encoding.
 - 
postprocessorsprotected ITraverseProcessor[] postprocessors Postprocessors for decoding.
 - 
referencesprotected java.util.Map<java.lang.Class<?>,boolean[]> references The reference class cache (clazz->boolean (is reference)).
 - 
secservprotected ISecurityService secserv The security service which injects itself once available.
 - 
sameversioncacheprotected IRwMap<IComponentIdentifier,java.lang.Boolean> sameversioncache Cache for identifying platforms with the same version.
 
- 
 - 
Constructor Detail- 
SerializationServicespublic SerializationServices(IComponentIdentifier comp) Creates the management.
 
- 
 - 
Method Detail- 
encodepublic byte[] encode(IMsgHeader header, IInternalAccess component, java.lang.Object obj) Encodes/serializes an object for a particular receiver.- Specified by:
- encodein interface- ISerializationServices
- Parameters:
- receiver- The receiver.
- cl- The classloader used for encoding.
- obj- Object to be encoded.
- Returns:
- Encoded object.
 
 - 
decodepublic java.lang.Object decode(IMsgHeader header, IInternalAccess component, byte[] enc) Decodes/deserializes an object.- Specified by:
- decodein interface- ISerializationServices
- Parameters:
- cl- The classloader used for decoding.
- enc- Encoded object.
- header- The header object if available, null otherwise.
- Returns:
- Object to be encoded.
 
 - 
getSendSerializerpublic ISerializer getSendSerializer(IComponentIdentifier receiverplatform) Returns the serializer for sending.- Parameters:
- receiver- Receiving platform.
- Returns:
- Serializer.
 
 - 
getSerializerspublic ISerializer[] getSerializers() Returns all serializers.- Specified by:
- getSerializersin interface- ISerializationServices
- Parameters:
- platform- Sending platform.
- Returns:
- Serializers.
 
 - 
getSerializerpublic ISerializer getSerializer(int id) Returns a serializer per id.- Specified by:
- getSerializerin interface- ISerializationServices
- Parameters:
- id- The id.
- Returns:
- The serializer.
 
 - 
getSendCodecspublic ICodec[] getSendCodecs(IComponentIdentifier receiver) Returns the codecs for sending.- Parameters:
- receiver- Receiving platform.
- Returns:
- Codecs.
 
 - 
getCodecspublic ICodec[] getCodecs() Returns all codecs.- Returns:
- Codecs.
 
 - 
getPostprocessorspublic ITraverseProcessor[] getPostprocessors() Gets the post-processors for decoding a received message.
 - 
getPreprocessorspublic ITraverseProcessor[] getPreprocessors() Gets the pre-processors for encoding a received message.
 - 
createPostprocessorspublic java.util.List<ITraverseProcessor> createPostprocessors() Create the preprocessors.
 - 
createPreprocessorspublic java.util.List<ITraverseProcessor> createPreprocessors() 
 - 
getPrefixSizeprotected static final int getPrefixSize(int codeccount) 
 - 
isLocalReferencepublic boolean isLocalReference(java.lang.Object object) Test if an object has reference semantics. It is a reference when: - it implements IRemotable - it is an IService, IExternalAccess or IFuture - if the object has used an @Reference annotation at type level - has been explicitly set to be reference- Specified by:
- isLocalReferencein interface- ISerializationServices
 
 - 
isRemoteObjectpublic boolean isRemoteObject(java.lang.Object target) Test if an object is a remote object.- Specified by:
- isRemoteObjectin interface- ISerializationServices
 
 - 
getCloneProcessorspublic java.util.List<ITraverseProcessor> getCloneProcessors() Get the clone processors.- Specified by:
- getCloneProcessorsin interface- ISerializationServices
- Returns:
- The clone processors.
 
 - 
setSecurityServicepublic void setSecurityService(ISecurityService secserv) Injects the security service.- Parameters:
- secserv- The security service.
 
 - 
getSerializationServicespublic static final ISerializationServices getSerializationServices(IComponentIdentifier platform) Gets the serialization services.- Parameters:
- platform- The platform ID.
- Returns:
- The serialization services.
 
 - 
getRemoteReferenceModulepublic RemoteReferenceModule getRemoteReferenceModule() Get the remote reference module.- Returns:
- the remote reference module.
 
 - 
getStringConverterspublic java.util.Map<java.lang.String,IStringConverter> getStringConverters() Get the string converters (can convert to and from string, possibly only for some types).- Specified by:
- getStringConvertersin interface- ISerializationServices
- Returns:
- The converters.
 
 - 
convertObjectToStringpublic java.lang.String convertObjectToString(java.lang.Object val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.String mediatype, java.lang.Object context)Convert object to string.- Specified by:
- convertObjectToStringin interface- ISerializationServices
- Parameters:
- val- The value.
- Returns:
- The string value.
 
 - 
convertStringToObjectpublic java.lang.Object convertStringToObject(java.lang.String val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.String mediatype, java.lang.Object context)Convert string to object.- Specified by:
- convertStringToObjectin interface- ISerializationServices
- Parameters:
- val- The value.
- Returns:
- The object.
 
 
- 
 
-