diff options
author | Jose <jose@zeroc.com> | 2014-11-07 21:28:00 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2014-11-07 21:28:00 +0100 |
commit | f99742d525f519996a6d321afb323a67fd9be4f9 (patch) | |
tree | f7b4454611d64d1a28bf9609aa64234fe78d3f53 /java/demo/Manual/map_filesystem/Server.java | |
parent | Some IceJS linting fixes (diff) | |
download | ice-f99742d525f519996a6d321afb323a67fd9be4f9.tar.bz2 ice-f99742d525f519996a6d321afb323a67fd9be4f9.tar.xz ice-f99742d525f519996a6d321afb323a67fd9be4f9.zip |
Fix for (ICE-5832) Versioning of Jar files
Renaming JAR files
Diffstat (limited to 'java/demo/Manual/map_filesystem/Server.java')
-rw-r--r-- | java/demo/Manual/map_filesystem/Server.java | 80 |
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; +} |