Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [riena-dev] Serialization of IWorkspace/IProject object on Riena Server

Christian,
       What is this Attachment object. Please provide me with an example if you can, i will really appreciate your help.  What iam doing here is similar to  scenario.. lets say
I have client/Server env and from my Client RCP i connect to one of the servers and invoke "top" from client on to the server and want to print the results back my client RCP. In this case i  will have to pass outputStream from server onto client. Or is there any other way i could do this in Riena.

        If Not the whole workspace from server but atleast one project is what i want to serialize "ResourcePlugin.getWorkspace().getRoot().getProject("<name>") and pass
to client.

Thanks much,
Prasanna


A Remote Service call can not by magic do everything that a local call can do. So for example an inputstream or errorstream or actually any stream is a fairly complex thing to transfer. For that purpose Riena has the Attachment object. Just add the Attachment object into your Server object and create the Attachment from an errorStream or InputStream. And then on the client you should be able to read out the content from the stream the Attachment (readAsStream).
Prasanna:  What is this Attachment object, please provide me with an example if you can. I will really appreaciate your help.

Also ResourcePlugin.getWorkspace().getRoot() is likely not going to work. Do you seriously want to serialize the whole workspace. Again objects like File or Directory objects wont serialize because they are only references to local files. If you return them in a remote call, what do you expect to happen ?

Prasanna:
Hessian (and also Java serialization) have limitations. For Hessian read the docu http://hessian.caucho.com/

christian

Am 06.05.2009 um 22:40 schrieb Prasanna Tummala:

Hi Christian,
     Thank you for your quick reply.
     After sending this email i realized that with Riena Remote Service i am using "Hessian" as the serialization so don't need java Serialization.

    On Server iam executing a shelfCommand.
    ----------------------------------------------------
 Server runTest()
{
  1)  _process = DebugPlugin.exec(cmdLine, workingPath, envVars.getStringArray());
   2) server.serErrorStream(_process.getErrorStream());
   3) server.setInputStream(_process.getInputStream());
   4) server.setServerWorkspace(ResourcesPlugin.getWorkspace().getRoot());

    5) return server;
}

On Client 
-------------
I invoke runTest() on server and "server" object is returned to client.
(2),(3) items are serialized fine. But if i add (4) which is IWorkspaceRoot  i get following error. This means that i can serialize ErrorStream and InputStream
fine, but i was wondering how can i send server's IWorkspace object to client. Is it possible?

Thanks much,
Prasanna


javax.servlet.ServletException: 13 class java.lang.Object
    at org.eclipse.riena.communication.publisher.hessian.RienaHessianDispatcherServlet.service(RienaHessianDispatcherServlet.java:155)
    at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
    at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
May 6, 2009 3:24:46 PM org.mortbay.jetty.servlet.ServletHandler handle
SEVERE: /hessian/testServer?runTest&RID-ee54p68o: 
java.lang.RuntimeException: 13 class java.lang.Object
    at com.caucho.hessian.io.BasicSerializer.writeObject(BasicSerializer.java:282)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:251)
    at com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:208)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:251)
    at com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:208)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:251)
    at com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:208)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:251)
    at com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:208)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:251)
    at com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:208)
    at com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:172)
    at com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:490)
    at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:174)
    at org.eclipse.riena.communication.publisher.hessian.RienaHessianDispatcherServlet.service(RienaHessianDispatcherServlet.java:147)
    at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
    at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
May 6, 2009 3:39:24 PM org.mortbay.jetty.servlet.ServletHandler$Context log
    
     



From: christian.campo@xxxxxxxxxxxx
To: riena-dev@xxxxxxxxxxx
Subject: Re: [riena-dev] Serialization of IWorkspace/IProject object on Riena Server
Date: Wed, 6 May 2009 21:41:33 +0200

Hi Prasanna,

I am not sure I am getting this...... Remote service requires a service, an interface for the service (is that the workspace ?) and a client calling it. If you use Riena Remote Service, you use "hessian" as the serialization, so not Java Serialization code is needed. What is the purpose of this serializer code that you are doing on the server (in what service).

Maybe you can explain why you use Java serialization and what is the service ?

christian

Am 06.05.2009 um 21:17 schrieb Prasanna Tummala:

Hi,

        I anyone help me to Serialize IProject object that is created on server and pass it to client and deserialize it.

On Server(At send end) i am doing this..
FileOutputStream underlyingStream = new FileOutputStream("myobject.ser");
        ObjectOutputStream serializer = new ObjectOutputStream(underlyingStream);
        IProject pr = _project.getIProject();
        serializer.writeObject(_project);
        serializer.flush();
        serializer.close();

On client (At receive end) iam doing this
 FileInputStream fis = new FileInputStream("myobject.ser");
                 ObjectInputStream ois = new ObjectInputStream(fis);
                // IProject myDeserializedPorjectObject = (IProject)ois.readObject();
                 Project myDeserializedServerObject = (Project) ois.readObject();
                
                 ois.close();
                 IProject prj = myDeserializedServerObject.getIProject();
                 String path = myDeserializedServerObject.getProjectPath();

here On Client path is returned properly but IProject object is null. What am i missing here, why is IProject object not  passed from server

Here is my Project.java
public class Project implements Serializable {

private  String _projectName;
    private static String _projectPath;
    private static IWorkspace workspace;
    private static IWorkspaceRoot wsRoot;
    
    private  IProject _project = null;

    static final long serialVersionUID = 1L;
    
    /*************************************************************
    ** Constructor.
    *************************************************************/
    public Project(String usrName, String hostName, String projectName) {

        _projectName = projectName;
      
        // Save off the full path for the project.
        workspace = ResourcesPlugin.getWorkspace();
        wsRoot = workspace.getRoot();
       
        IProjectDescription description = workspace.newProjectDescription(projectName);
        // use the dct2000test project nature
       
        _project = workspace.getRoot().getProject("test");
    
       
    }
}



Thanks,
Prasanna


MSN Battles We pitch one stalwart against the other and give you the power. Who will you vote for? Share photos while you chat with Windows Live Messenger. <ATT00001.c>



Get easy photo sharing with Windows LiveT Photos. Drag n' drop <ATT00001.c>



Get easy photo sharing with Windows Live™ Photos. Drag n’ drop

Back to the top