+ /**
+ * JNDI context for launching converters.
+ */
+ private transient static final Properties _JNDPROPS;
+ /**
+ * Siman web application name.
+ */
+ private transient static String wappname;
+ /**
+ * General properties from the application properties files.
+ */
+ private transient static final Properties _WAPPROPS = new Properties();
+ /**
+ * Siman web application root path on the server.
+ */
+ private transient static String wapproot;
+ /**
+ * Available template files.
+ */
+ private transient static Map<String, String> tempfile;
+ /**
+ * List of file extensions mapped to a viewer.
+ */
+ private transient static String[] viewermap;
+ /**
+ * Available document format converters.
+ */
+ private transient static Map<String, Converter> convertmap;
+
+ static {
+ synchronized (_WAPPROPS) {
+ // Do common configuration for all users
+
+ _JNDPROPS = new Properties();
+ tempfile = new HashMap<String, String>();
+ viewermap = new String[0];
+ convertmap = new HashMap<String, Converter>();
+
+ ClassLoader cloader = Thread.currentThread()
+ .getContextClassLoader();
+ HttpServletRequest curRequest = ((ServletRequestAttributes) RequestContextHolder
+ .currentRequestAttributes()).getRequest();
+ String appname = curRequest.getContextPath();
+ if (appname.startsWith("/")) {
+ wappname = appname.substring(1);
+ }
+ // Set local path on the server to the application root.
+ wapproot = curRequest.getSession().getServletContext().getRealPath(
+ "/");
+
+ try {
+ _JNDPROPS.load(cloader.getResourceAsStream("jndi.properties"));
+ _WAPPROPS.load(cloader.getResourceAsStream(wappname
+ + ".properties"));
+ } catch (IOException e) {
+ LOG.info(
+ "Can't load application properties: " + e.getMessage(),
+ e);
+ }
+
+ // Configure login security
+ System.setProperty("java.security.auth.login.config", wapproot
+ + ApplicationSettings.getApplicationProperty("wapp.login"));
+
+ // Customization (must be done after above default settings)
+ File config = new File(wapproot
+ + getApplicationProperty("wapp.customization"));
+ if (config.exists()) {
+ loadCustomization(config); // Sets default document types, installed modules and available templates
+ } else {
+ LOG.info("Could not find the application configuration file \""
+ + config.getAbsolutePath()
+ + "\", using default settings");
+ }
+ }
+ }
+
+ /**
+ * All value.
+ */
+ private static final String ALL = "all";
+
+ /**
+ * Hold icon file name.
+ */
+ private static final String IMG_HOLD = "image.hold.gif";
+ /**
+ * Attach icon file name.
+ */
+ private static final String IMG_ATTACH = "image.attach.png";
+ /**
+ * Version icon file name.
+ */
+ private static final String IMG_VERSION = "image.version.png";
+ /**
+ * Delete icon file name.
+ */
+ private static final String IMG_DELETE = "icon.delete.png";
+ /**
+ * Attach menu item name.
+ */
+ private static final String MNU_ATTACH = "attach";
+ /**
+ * Demote menu item name.
+ */
+ private static final String MNU_DEMOTE = "demote";
+ /**
+ * Promote menu item name.
+ */
+ private static final String MNU_PROMOTE = "promote";
+ /**
+ * Publish menu item name.
+ */
+ private static final String MNU_PUBLISH = "publish";
+ /**
+ * Edit menu item name.
+ */
+ private static final String MNU_EDIT = "edit";
+ /**
+ * Script menu item name.
+ */
+ private static final String MNU_SCRIPT = "script";
+ /**
+ * Version menu item name.
+ */
+ private static final String MNU_VERSION = "version";
+ // /**
+ // * Purge menu item name.
+ // */
+ // private static final String MNU_PURGE = "purge";
+ /**
+ * Remove menu item name.
+ */
+ private static final String MNU_REMOVE = "remove";
+ /**
+ * Rename menu item name.
+ */
+ private static final String MNU_RENAME = "rename";
+
+ /**
+ * Attach menu item name.
+ */
+ private static final String MNU_NAME_ATTACH = "menu.attach";
+ /**
+ * Demote menu item name.
+ */
+ private static final String MNU_NAME_DEMOTE = "menu.demote";
+ /**
+ * Promote menu item name.
+ */
+ private static final String MNU_NAME_PROMOTE = "menu.promote";
+ /**
+ * Publish menu item name.
+ */
+ private static final String MNU_NAME_PUBLISH = "menu.publish";
+ /**
+ * Protect menu item name.
+ */
+ private static final String MNU_NAME_PROTECT = "menu.protect";
+ /**
+ * Edit menu item name.
+ */
+ private static final String MNU_NAME_EDIT = "menu.edit";
+ /**
+ * Edit menu item name.
+ */
+ private static final String MNU_NAME_REMOVE = "menu.remove";
+ /**
+ * Script menu item name.
+ */
+ private static final String MNU_NAME_SCRIPT = "menu.newscenario";
+ /**
+ * Version menu item name.
+ */
+ private static final String MNU_NAME_VERSION = "menu.version";
+ /**
+ * Purge menu item name.
+ */
+ // private static final String MNU_NAME_PURGE = "menu.purge";
+ /**
+ * Remove menu item name.
+ */
+ private static final String MNU_NAME_REMOVE_VERSION = "menu.remove.version";
+ /**
+ * Rename menu item name.
+ */
+ private static final String MNU_NAME_RENAME = "menu.rename";
+ /**
+ * Mark as reference menu item name.
+ */
+ private static final String MNU_MARK_AS_REFERENCE = "markasreference";
+ /**
+ * Mark as reference menu item label key.
+ */
+ private static final String MNU_NAME_MARK_AS_REFERENCE = "menu.markasreference";
+ /**
+ * Remove as reference menu item label key.
+ */
+ private static final String MNU_NAME_REMOVE_AS_REFERENCE = "menu.removeasreference";
+ // /**
+ // * Not yet implemented action name.
+ // */
+ // private static final String ACT_NOT_YET_IMPLEMENTED = "notyetimplemented";
+ /**
+ * Attach action name.
+ */
+ private static final String ACT_ATTACH = "select-file?nextAction=attach";
+ /**
+ * Version action name.
+ */
+ private static final String ACT_VERSION = "select-file?nextAction=version";
+ /**
+ * Mark as reference action name.
+ */
+ private static final String ACT_MARK_AS_REFERENCE = "markasref-study";
+ /**
+ * Remove as reference action name.
+ */
+ private static final String ACT_REMOVE_AS_REFERENCE = "removeasref-study";