Search Mailing List Archives
[protege-discussion] Remote Project Access Programmatically
Ron Schultz
rcaschultz at gmail.com
Fri Feb 20 19:45:31 PST 2009
I am trying to access a project remotely using RMI. I connect
sucessfully, but never get back the project itself, It is always null.
When I run the code shown below (basically copied from the
ProtegeWiki, I get the following: The two 'nulls' below are when I try
to output the project's name.
Getting Project: Capture
Preloading frame values: DefaultKnowledgeBase(KB_569716)
Preloading frame values: DefaultKnowledgeBase(KB_502614)
null
null
remote project dispose
The server properly shows adding a session, opening the project, and
then removing the session - as I would expect.
Can someone see what I am doing wrong?
Ron
public class PropertyHandler {
public static void main(String[] args) {
PropertyHandler handler = new PropertyHandler();
handler.getProperty();
}
public void getProperty() {
Project p = null;
try {
RemoteServer server = (RemoteServer) Naming.lookup("//schultz/" +
Server.getBoundName());
if (server != null) {
RemoteSession session = server.openSession("webprotege",
SystemUtilities.getMachineIpAddress(),
"webprotege");
if (session != null) {
ArrayList<String> list = (ArrayList)
server.getAvailableProjectNames(session);
Log.getLogger().info("Getting Project: " + list.get(0));
RemoteServerProject serverProject = server.openProject((String)
list.get(0), session);
if (serverProject != null) {
p = RemoteClientProject.createProject(server, serverProject,
session, true);
Log.getLogger().info(p.getName());
}
}
}
} catch (Exception e) {
Log.getLogger().severe(Log.toString(e));
}
Log.getLogger().info(p.getName());
p.dispose(); // Dispose of the connection
}
}
}
Log.getLogger().severe(Log.toString(e));
}
Log.getLogger().info(p.getName());
p.dispose();
class PropertyHandler {public static void main(String[] args) {new
PropertyHandler();public void getProperty() {null;try {"//schultz/" +
Server.getBoundName());if (server != null)
{"webprotege","webprotege");if (session != null) {"Getting Project: "
+ list.get(0));if (serverProject != null) { true);catch (Exception e)
{// Dispose of the connection
}
}
--
Ron
More information about the protege-discussion
mailing list