Hi Bodgan, (Including [email protected] since your question is better handled on a mailing list where more people than just me can provide help)
First of all, when you say D-OSGi I assume you mean the CXF-based D-OSGi Implementation (http://cxf.apache.org/distributed-osgi.html). The D-OSGi/Remote Services spec (section 13.4.2 in http://www.osgi.org/Download/Release4V42) requires a fairly basic set of supported data types. However implementation are free to provide richer support. The CXF based implementation uses the Aegis Databinding (http://cxf.apache.org/docs/aegis-21.html) which supports more than that. It supports richer types (http://cxf.apache.org/docs/aegis-default-mappings.html) and also collections, arrays and complex types that are based on the previous types. By complex types I mean classes or interfaces that are directly or indirectly based on types from the supported basic set. So to answer your question in general: yes CXF-DOSGi does support complex data types. There are a few demos samples that show how this is done. However it does not support *arbitrary* complex types. Generally when doing distributed computing you should really design your interfaces to be suitable for remoting. The AWT classes were clearly designed with a different use-case in mind, not distribution. Some middleware implementations might allow you to remote arbitrary types, but this often leads to problems later on when these types are used in anger in a distributed context. So my advice is: when you want to do distributed computing, design your interfaces appropriately for that purpose. Hope this helps... David 2009/11/9 Bogdan Predusca <[email protected]> > > Hello, > > I`m trying to migrate from R-OSGi to D-OSGi and I`m having a problem using > AWT or Swing with D-OSGi. > I use Zookeeper for discovery and I try to simulate the R-OSGi ServiceUI > mechanism > (a bundle provides his own GUI by implementing the ServiceUIComponent > interface). > Is it not possible to use complex types with D-OSGi (for example AWT Panel)? > The greeter demo is not quite the same as my example. > In my example I do the following steps: > > -In the interface part: > public interface MyDiscovery { > Panel getPanel(); > } > > -In the implementation part: > ... > public Panel getPanel() { > myPanel = new Panel(); > Label l = new Label("Testing"); > myPanel.add(l); > return myPanel; > } > ... > -In the client part: > ... > Object svc = tracker1.addingService(sr); > if (svc instanceof MyDiscovery) { > MyDiscovery d = (MyDiscovery) svc; > Frame fr = new Frame(); > fr.setVisible(true); > fr.add(d.getPanel()); > } > ... > -The service provider exception: > at com.ctc.wstx.sw.BaseNsStreamWriter.closeStartElement > (BaseNsStreamWriter.java:382) > at com.ctc.wstx.sw.BaseNsStreamWriter.checkStartElement > (BaseNsStreamWriter.java:437) > at com.ctc.wstx.sw.SimpleNsStreamWriter.writeStartOrEmpty > (SimpleNsStreamWriter.java:260) > at com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement > (BaseNsStreamWriter.java:319) > at org.apache.cxf.aegis.xml.stax.ElementWriter.writeStartElement > (ElementWriter.java:119) > at org.apache.cxf.aegis.xml.stax.ElementWriter.<init>(ElementWriter.java:70) > at org.apache.cxf.aegis.xml.stax.ElementWriter.getElementWriter > (ElementWriter.java:155) > at org.apache.cxf.aegis.type.basic.BeanType.getWriter(BeanType.java:404) > at org.apache.cxf.aegis.type.basic.BeanType.writeElement(BeanType.java:394) > at > org.apache.cxf.aegis.type.basic.BeanType.writeObjectInternal(BeanType.java:380) > > -The client exception: > Caused by: org.apache.cxf.aegis.DatabindingException: Couldn't instantiate > class. > null. Nested exception is java.lang.InstantiationException: null > at > org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:181) > at > org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:161) > at > org.apache.cxf.aegis.AegisXMLStreamDataReader.read (AegisXMLStreamDataReader.java:82) > at org.apache.cxf.aegis.databinding.XMLStreamDataReader.read > (XMLStreamDataReader.java:61) > ... 46 more > Caused by: java.lang.InstantiationException at > sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance > (InstantiationExceptionConstructorAccessorImpl.java:30) > at > java.lang.reflect.Constructor.newInstance(Constructor.java:513) > at > java.lang.Class.newInstance0(Class.java:355) > at java.lang.Class.newInstance > (Class.java:308) > at > org.apache.cxf.aegis.type.basic.BeanType.readObject(BeanType.java:131) > > > Thank you very much for your time >
