Hi Fabian, 
     
    On 2/15/2011 11:47 PM, Fabian Meyer wrote:
    
      
      
      Using non-serializable object as shared objects
      
      Hi, 
           
          is there a way to use non-serializable object as shared
          objects in ECF? At the moment I'm using somethings that looks
          a littly hacky to me and doesn't feel correct...  
     
    
      I wrote a bundle which tracks the
          IContainerManager services. When a new SOContainer is created
          I'm calling the setSharedObjectMessageSerializer to inject my
          own message serializer. The serializer uses a special input
          and output stream for object reading/writing where known
          non-serializable objects are serialized by hand and wrapped in
          a container. 
           
          @Override 
          protected Object replaceObject(Object obj) throws IOException
          { 
                  if (obj instanceof OWLObject) { 
                          OWLObjectContainer cont = new
          OWLObjectContainer(); 
                                  
                          final String owlObjectString =
          renderer.render((OWLObject) obj); 
                          cont.setOWLObjectString(owlObjectString); 
                                  
                          return cont; 
                  } 
                          
                  return obj; 
          } 
           
          On the client side the container is resolved and replaced by
          the unserialiable object. 
           
          @Override 
          protected Object resolveObject(Object obj) throws IOException
          { 
                          
                  if (obj instanceof OWLObjectContainer) { 
                          String owlObjectString = ((OWLObjectContainer)
          obj).getOWLObjectString(); 
                          OWLObject owlObj =
          parser.parse(owlObjectString));      
                          return owlObj; 
                  } 
                          
                  return obj; 
          } 
         
     
     
    I'm not sure I understand...this is working for you...but it doesn't
    seem correct? 
     
     
    
      
           
          Is it possible to register something like a "serializer
          service" in ecf that is used to serialize a special class of
          objects? 
     
     
    No, not currently.  It would be perfectly feasible to introduce such
    a serializer service (presumably meant to be an OSGi service using
    whiteboard pattern?), so please open an enhancement/bug to that
    effect.  And if you can help implement, please do...as our resources
    for new features are currently minimal. 
     
    Scott 
     
     
  
 |