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.
|