summaryrefslogtreecommitdiff
path: root/java/demo/manual/map_filesystem/Server.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-11-03 15:58:54 +0100
committerBenoit Foucher <benoit@zeroc.com>2014-11-03 15:58:54 +0100
commit581d0449b2c5f1bbfd5bb3d6d1216040b832b273 (patch)
treec3ebc0b05f1ad8d5dc2156e471c799b30be8ecde /java/demo/manual/map_filesystem/Server.java
parentFixed ICE-5816: Silverlight build failure (diff)
downloadice-581d0449b2c5f1bbfd5bb3d6d1216040b832b273.tar.bz2
ice-581d0449b2c5f1bbfd5bb3d6d1216040b832b273.tar.xz
ice-581d0449b2c5f1bbfd5bb3d6d1216040b832b273.zip
Fixed ICE-5811: renamed book demos to manual demos
Diffstat (limited to 'java/demo/manual/map_filesystem/Server.java')
-rw-r--r--java/demo/manual/map_filesystem/Server.java80
1 files changed, 80 insertions, 0 deletions
diff --git a/java/demo/manual/map_filesystem/Server.java b/java/demo/manual/map_filesystem/Server.java
new file mode 100644
index 00000000000..8ce2d5f586a
--- /dev/null
+++ b/java/demo/manual/map_filesystem/Server.java
@@ -0,0 +1,80 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+import FilesystemDB.*;
+
+public class Server extends Ice.Application
+{
+ public
+ Server(String envName)
+ {
+ _envName = envName;
+ }
+
+ @Override
+ public int
+ run(String[] args)
+ {
+ //
+ // Create an object adapter
+ //
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("MapFilesystem");
+
+ Freeze.Connection connection = null;
+ try
+ {
+ //
+ // Open a connection to the files and directories
+ // database. This should remain open for the duration of the
+ // application for performance reasons.
+ //
+ connection = Freeze.Util.createConnection(communicator(), _envName);
+ new IdentityFileEntryMap(connection, FileI.filesDB(), true);
+ new IdentityDirectoryEntryMap(connection, DirectoryI.directoriesDB(), true);
+
+ //
+ // Add default servants for the file and directory.
+ //
+ adapter.addDefaultServant(new FileI(communicator(), _envName), "file");
+ adapter.addDefaultServant(new DirectoryI(communicator(), _envName), "");
+
+ //
+ // Ready to accept requests now
+ //
+ adapter.activate();
+
+ //
+ // Wait until we are done
+ //
+ communicator().waitForShutdown();
+ }
+ finally
+ {
+ //
+ // Close the connection gracefully.
+ //
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ Server app = new Server("db");
+ app.main("demo.book.map_filesystem.Server", args, "config.server");
+ System.exit(0);
+ }
+
+ private String _envName;
+}