Please help me. My project to display like window explore from any client's ip address. If i used command line, i can set ip & post listen for server by code:
start java TestWEImplServer -ORBInitialPort 1050 -ORBInitialHost localhost
&
java TestWEImplClient -ORBInitialPort 1050 -ORBInitialHost localhost
but went i use eclipse 3.5. jdk 1.6 with plugin ORBStudio_7.7.7.jar for eclipse to run idl file. I don't know how to set ip address to display.
Please, help me as soon as you can.

Where do the programs TestWEImplServer & TestWEImplClient come from?

Sorry, i mistake. Here is my code
file: assignment.idl

module TestCorba{
	struct FileInfo {
		string filePath;
		string fileName;
		boolean isDirectory;
	};
		typedef sequence<FileInfo> FileIf;
	interface TestWE{
		FileIf listRoot();
		FileIf listChild(in string path);
	};

};

& File make connect corba

package server;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.net.ConnectException;
import java.util.Properties;

import org.omg.PortableServer.IdAssignmentPolicyValue;
// import org.omg.PortableServer.LifespanPolicyValue;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
import org.omg.PortableServer.ThreadPolicyValue;

public class Server_AOM {

	public static void main(String[] args) {
		//Properties props = new Properties();
		Properties props = System.getProperties();
		props.setProperty("org.omg.CORBA.ORBClass", "com.sun.corba.se.internal.POA.POAORB");
		props.setProperty("org.omg.CORBA.ORBSingletonClass", "com.sun.corba.se.internal.corba.ORBSingleton");
		//props.setProperty(Connect, value)
		try {
			// Initialize the ORB.
			org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, props);

			// get a reference to the root POA
			org.omg.CORBA.Object obj = orb.resolve_initial_references("RootPOA");
			POA poaRoot = POAHelper.narrow(obj);

			// Create policies for our persistent POA
			org.omg.CORBA.Policy[] policies = {
					// poaRoot.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
					poaRoot.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID),
					poaRoot.create_thread_policy(ThreadPolicyValue.ORB_CTRL_MODEL) 
			};

			// Create myPOA with the right policies
			POA poa = poaRoot.create_POA("TestWEServerImpl_poa",	poaRoot.the_POAManager(), policies);

			// Create the servant
			TestWEServerImpl servant = new TestWEServerImpl();

			// Activate the servant with the ID on myPOA
			byte[] objectId = "AnyObjectID".getBytes();
			poa.activate_object_with_id(objectId, servant);
			
			// Activate the POA manager
			poaRoot.the_POAManager().activate();

			// Get a reference to the servant and write it down.
			obj = poa.servant_to_reference(servant);

			// ---- Uncomment below to enable Naming Service access. ----
			// org.omg.CORBA.Object ncobj = orb.resolve_initial_references("NameService");
			// NamingContextExt nc = NamingContextExtHelper.narrow(ncobj);
			// nc.bind(nc.to_name("MyServerObject"), obj);

			PrintWriter ps = new PrintWriter(new FileOutputStream(new File("server.ior")));
			ps.println(orb.object_to_string(obj));
			ps.close();

			System.out.println("CORBA Server ready...");

			// Wait for incoming requests
			orb.run();
		}
		catch(Exception ex) {
			ex.printStackTrace();
		}
	}
}
package server;

import java.io.File;
import java.util.ArrayList;

import TestCorba.FileInfo;

/**
 * This class is the implemetation object for your IDL interface.
 *
 * Let the Eclipse complete operations code by choosing 'Add unimplemented methods'.
 */
public class TestWEServerImpl extends TestCorba.TestWEPOA {
	/**
	 * Constructor for TestWEServerImpl 
	 */
	public TestWEServerImpl() {
	}

//	@Override
	public FileInfo[] listChild(String path) {
		// TODO Auto-generated method stub
		File fdir = new File(path);
		//System.out.println("Root: " + fdir.list().toString());
		FileInfo fileIf;
		ArrayList<FileInfo> listFiles = new ArrayList<FileInfo>();
		// FileInfo[] listFiles;
		if (path == null && path.equals(".")) {
			return listRoot();
		} else {
			if (fdir.isDirectory()) {
				System.out.println("test: " + fdir.getName() + " " + fdir);
				for (File f : fdir.listFiles()) {
					fileIf = new FileInfo(f.getPath(), f.getName(), f.isDirectory());
					listFiles.add(fileIf);
					System.out.println("child: " + f.getPath());
				}
			}
		}
		return listFiles.toArray(new FileInfo[listFiles.size()]);
	}

	@Override
	public FileInfo[] listRoot() throws NullPointerException {
		// TODO Auto-generated method stub
		File[] listRoots = File.listRoots();
		ArrayList<FileInfo> listFiles = new ArrayList<FileInfo>();
		// FileInfo[] list = new FileInfo[listRoots.length];
		FileInfo fileIf;
		for (File f : listRoots) {
			fileIf = new FileInfo(f.getPath(), "" + f, f.isDirectory());
			listFiles.add(fileIf);
			System.out.println(" " + f.getPath());
		}
		return listFiles.toArray(new FileInfo[listFiles.size()]);
	}
}

& code for client

package client;

import TestCorba.FileInfo;

/**
 * @author lethuy
 *
 */
public class FileNode {
	private FileInfo fileInfo;
	public FileNode(FileInfo fileInfo){
		this.fileInfo=fileInfo;
	}
	public String toString(){
		return fileInfo.fileName;
	}
	public String getFilePath() {
		return fileInfo.filePath;
	}
	public boolean isDirectory() {
		return fileInfo.isDirectory;
	}
}
package client;

import java.awt.Component;
import java.io.File;

import javax.swing.JTree;
import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.DefaultTreeCellRenderer;

public class FileSystemTreeRenderer extends DefaultTreeCellRenderer {
	private FileSystemView fsv;

	public FileSystemTreeRenderer(FileSystemView fsv) {
		this.fsv = fsv;
	}

	public FileSystemTreeRenderer() {
		this(FileSystemView.getFileSystemView());
	}

	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
		if (!(value instanceof File)) {
			return super.getTreeCellRendererComponent(tree, value, sel,
					expanded, leaf, row, hasFocus);
		}

		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
				row, hasFocus);

		setText(fsv.getSystemDisplayName((File) value));
		setIcon(fsv.getSystemIcon((File) value));

		return this;
	}
}
package client;

/*
 * The client implementation is generated by the ORB Studio.
 */
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.Properties;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;

import TestCorba.FileInfo;
import TestCorba.TestWE;

class TestWEClientImpl extends JFrame implements TreeExpansionListener,
		TreeSelectionListener {
	private TestCorba.TestWE target = null;
	private org.omg.CORBA.ORB orb = null;

	private JTree tree;
	private DefaultTreeModel m_model;
	private DefaultMutableTreeNode top;
	private DefaultTreeCellRenderer renderer;

	/**
	 * Constructor for TestWEClientImpl
	 * 
	 * @throws IOException
	 */
	public TestWEClientImpl() throws IOException {
		initORB(null);
	}

	/**
	 * Constructor for TestWEClientImpl
	 * 
	 * @throws IOException
	 * @see java.lang.Object#Object()
	 */
	public TestWEClientImpl(String[] args) throws IOException {
		initORB(args);
		top = new DefaultMutableTreeNode("My Computer");
		DefaultMutableTreeNode child;
		FileInfo[] roots = getORBInterface().listRoot();
		if (roots == null) {
			System.out.println("NULL");
		} else {
			for (int i = 0; i < roots.length; i++) {
				child = new DefaultMutableTreeNode(new FileNode(roots[i]));
				top.add(child);
			}
		}
		m_model = new DefaultTreeModel(top);
		renderer = new FileSystemTreeRenderer();
		tree = new JTree(m_model);
		tree.setCellRenderer(renderer);

		tree.addTreeSelectionListener(this);
		tree.addTreeExpansionListener(this);
		// ///////////////////////////////// show console
		// ////////////////////////

		JScrollPane pane = new JScrollPane(tree);
		this.setContentPane(pane);
		this.setVisible(true);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.pack();
	}

	DefaultMutableTreeNode getTreeNode(TreePath path) {
		return (DefaultMutableTreeNode) (path.getLastPathComponent());
	}

	public void expand(DefaultMutableTreeNode root) throws IOException {
		FileNode fnode = (FileNode) (root.getUserObject());
		System.out.println("Expand111: " + fnode);
		root.removeAllChildren();
		System.out.println("Expand: " + root);
		FileInfo[] files = getORBInterface().listChild(fnode.getFilePath());
		System.out.println("ExpandTT::: " + files);
		if (files == null) {
			return;
		}
		for (int i = 0; i < files.length; i++) {
			System.out.println("node: " + files[i].filePath);
			FileNode newFileNode = new FileNode(files[i]);
			DefaultMutableTreeNode newChild = new DefaultMutableTreeNode(
					newFileNode);
			root.add(newChild);

		}

	}

	/**
	 * Initialize ORB.
	 * 
	 * @param args
	 * @throws IOException
	 */
	public void initORB(String[] args) throws IOException {

		Properties props = System.getProperties();
		props.setProperty("org.omg.CORBA.ORBClass",
				"com.sun.corba.se.internal.POA.POAORB");
		props.setProperty("org.omg.CORBA.ORBSingletonClass",
				"com.sun.corba.se.internal.corba.ORBSingleton");

		// Initialize the ORB
		orb = org.omg.CORBA.ORB.init((String[]) args, props);

		// ---- Uncomment below to enable Naming Service access. ----
		// org.omg.CORBA.Object ncobj =
		// orb.resolve_initial_references("NameService");
		// NamingContextExt nc = NamingContextExtHelper.narrow(ncobj);
		// org.omg.CORBA.Object obj = nc.resolve_str("MyServerObject");

		LineNumberReader input = new LineNumberReader(new FileReader(
				"server.ior"));
		String ior = input.readLine();
		org.omg.CORBA.Object obj = orb.string_to_object(ior);

		target = TestCorba.TestWEHelper.narrow(obj);
	}

	/**
	 * Obtain ORB Interface.
	 * 
	 * @return
	 */
	public TestCorba.TestWE getORBInterface() {
		return target;
	}

	/**
	 * Shutdown ORB.
	 */
	public void shutdown() {
		orb.shutdown(true);
	}

	/**
	 * Test driver for TestWEClientImpl.
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			// TestWEClientImpl test = new TestWEClientImpl();
			new TestWEClientImpl(args);
			// test.getORBInterface().operation1("A message in the bottle...");

			// test.shutdown();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}

	@Override
	public void treeCollapsed(TreeExpansionEvent event) {
		// TODO Auto-generated method stub

	}

	@Override
	public void treeExpanded(TreeExpansionEvent event) {
		// TODO Auto-generated method stub
		// TODO Auto-generated method stub
		// FileInfo [] lFiles = test.listChild(event.getPath().toString());
		final DefaultMutableTreeNode node = getTreeNode(event.getPath());
		// final FileNode fnode = (FileNode)(node.getUserObject());

		try {
			expand(node);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void valueChanged(TreeSelectionEvent e) {
		// TODO Auto-generated method stub
		try {
			final DefaultMutableTreeNode node = getTreeNode(e.getPath());
			expand(node);
		} catch (IOException ex) {
			// TODO Auto-generated catch block
			ex.printStackTrace();
		}

	}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.