/**
* JNDI context for launching converters.
*/
- private transient static final Properties _jndprops;
+ private transient static final Properties _JNDPROPS;
/**
* Siman web application name.
*/
- private transient static String _wappname;
+ private transient static String wappname;
/**
* General properties from the application properties files.
*/
- private transient static final Properties _wapprops = new Properties();
+ private transient static final Properties _WAPPROPS = new Properties();
/**
* Siman web application root path on the server.
*/
- private transient static String _wapproot;
+ private transient static String wapproot;
/**
* Available template files.
*/
- private transient static Map<String, String> _tempfile;
+ private transient static Map<String, String> tempfile;
/**
* List of file extensions mapped to a viewer.
*/
- private transient static String[] _viewermap;
+ private transient static String[] viewermap;
/**
* Available document format converters.
*/
- private transient static Map<String, Converter> _convertmap;
+ private transient static Map<String, Converter> convertmap;
static {
- synchronized (_wapprops) {
+ 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>();
+ _JNDPROPS = new Properties();
+ tempfile = new HashMap<String, String>();
+ viewermap = new String[0];
+ convertmap = new HashMap<String, Converter>();
ClassLoader cloader = Thread.currentThread()
.getContextClassLoader();
.currentRequestAttributes()).getRequest();
String appname = curRequest.getContextPath();
if (appname.startsWith("/")) {
- _wappname = appname.substring(1);
+ wappname = appname.substring(1);
}
// Set local path on the server to the application root.
- _wapproot = curRequest.getSession().getServletContext()
- .getRealPath("/");
+ wapproot = curRequest.getSession().getServletContext().getRealPath(
+ "/");
try {
- _jndprops.load(cloader.getResourceAsStream("jndi.properties"));
- _wapprops.load(cloader.getResourceAsStream(_wappname
+ _JNDPROPS.load(cloader.getResourceAsStream("jndi.properties"));
+ _WAPPROPS.load(cloader.getResourceAsStream(wappname
+ ".properties"));
} catch (IOException e) {
LOG.info(
}
// Configure login security
- System.setProperty("java.security.auth.login.config", _wapproot
+ 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
+ File config = new File(wapproot
+ getApplicationProperty("wapp.customization"));
if (config.exists()) {
loadCustomization(config); // Sets default document types, installed modules and available templates
/**
* Rename menu item name.
*/
- private static final String MNU_NAME_RENAME = "menu.rename";
+ private static final String MNU_NAME_RENAME = "menu.rename";
/**
- * Publish menu item name.
+ * 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_MARK_AS_REFERENCE = "menu.markasreference";
+ private static final String MNU_NAME_MARK_AS_REFERENCE = "menu.markasreference";
/**
* Not yet implemented action name.
*/
+ curRequest.getServerPort();
LOG.info("Application server is set to " + _wappserver);
- LOG.info("Application name is set to " + _wappname);
+ LOG.info("Application name is set to " + wappname);
}
/**
"select?menu=create&item=new-empty");
addItem("new-copy", new MenuItem("menu.new.copy")
.icon("image.copy.png"));
- /*addItem("new-instance", new MenuItem("menu.new.instance")
- .icon(IMG_HOLD));
- addItem("new-import", new MenuItem("menu.new.import")
- .icon("icon.upload.png"));*/
+ /*
+ * addItem("new-instance", new MenuItem("menu.new.instance") .icon(IMG_HOLD)); addItem("new-import", new
+ * MenuItem("menu.new.import") .icon("icon.upload.png"));
+ */
this.selects("new-empty");
}
}
private PropertiesMenu() {
super("configuration");
addItem("prop-general", "menu.prop.general", IMG_HOLD,
- "select?menu=properties&item=prop-general");
+ "select?menu=configuration&item=prop-general");
addItem("prop-scenario", "menu.prop.scenario", IMG_HOLD,
- "select?menu=properties&item=prop-scenario");
+ "select?menu=configuration&item=prop-scenario");
// These menu items will not be implemented in the current version.
/*
* addItem("prop-timestamp", new MenuItem("menu.prop.timestamp") .icon("image.stamp.png")); addItem("prop-comlog", new
}
}
+ /**
+ * Menu items enumeration.
+ */
private enum Item {
- publish, accept, approve, promote, demote, undo, rename, attach, edit, script, version, replace, export, remove, purge
+ /**
+ * Publish the study.
+ */
+ publish,
+ /**
+ * Accept the document.
+ */
+ accept,
+ /**
+ * Approve the document.
+ */
+ approve,
+ /**
+ * Promote the document.
+ */
+ promote,
+ /**
+ * Demote the docuemnt.
+ */
+ demote,
+ /**
+ * Undo the last operation.
+ */
+ undo,
+ /**
+ * Rename the document.
+ */
+ rename,
+ /**
+ * Attach a file to the document.
+ */
+ attach,
+ /**
+ * Edit the document.
+ */
+ edit,
+ /**
+ * script
+ */
+ script,
+ /**
+ * Version the document.
+ */
+ version,
+ /**
+ * replace
+ */
+ replace,
+ /**
+ * export
+ */
+ export,
+ /**
+ * Remove the document.
+ */
+ remove,
+ /**
+ * purge
+ */
+ purge,
+ /**
+ * Mark the study as reference.
+ */
+ markasreference
};
// Resources relative to studies
private EditableStudyPopup() {
super();
- addItem(MNU_MARK_AS_REFERENCE, new PopupItem(MNU_MARK_AS_REFERENCE)
- .action(ACT_NOT_YET_IMPLEMENTED)
- .confirmation("message.markasreference.study"));
+ addItem(MNU_MARK_AS_REFERENCE, new PopupItem(MNU_NAME_MARK_AS_REFERENCE)
+ .action(ACT_NOT_YET_IMPLEMENTED).confirmation(
+ "message.markasreference.study"));
addItem(MNU_PUBLISH, new PopupItem(MNU_NAME_PUBLISH).icon(
"image.publish.png").action("edit-study?action=publish")
.confirmation("message.publish.study"));
- /*addItem(MNU_PROMOTE, new PopupItem("menu.archive"));*/
+ /* addItem(MNU_PROMOTE, new PopupItem("menu.archive")); */
addSeparator();
addItem(MNU_EDIT, new PopupItem("menu.properties").icon(
"icon.ed.png").action("../select?menu=properties"));
addSeparator();
addItem(MNU_SCRIPT, new PopupItem(MNU_NAME_SCRIPT)
.action("add-scenario"));
- /*addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon(
- IMG_VERSION).action(ACT_NOT_YET_IMPLEMENTED));*/
+ /*
+ * addItem(MNU_VERSION, new PopupItem(MNU_NAME_VERSION).icon( IMG_VERSION).action(ACT_NOT_YET_IMPLEMENTED));
+ */
addSeparator();
- /*addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE)
- .confirmation("message.purge.study"));
- addItem("export", new PopupItem("menu.export")
- .icon("image.export.png")); // For future needs
-*/ addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(IMG_DELETE)
- .action(ACT_NOT_YET_IMPLEMENTED).confirmation(
- "message.delete.study"));
+ /*
+ * addItem(MNU_PURGE, new PopupItem(MNU_NAME_PURGE) .confirmation("message.purge.study")); addItem("export", new
+ * PopupItem("menu.export") .icon("image.export.png")); // For future needs
+ */addItem(MNU_REMOVE, new PopupItem(MNU_NAME_REMOVE).icon(
+ IMG_DELETE).action(ACT_NOT_YET_IMPLEMENTED).confirmation(
+ "message.delete.study"));
}
+ /**
+ * {@inheritDoc}
+ * @see org.splat.wapp.ContextualMenu#isEnabled(java.lang.String)
+ */
@Override
public boolean isEnabled(final String name) {
boolean res = (_user != null);
*/
private static class ApprovedPopup extends PopupMenu {
private ApprovedPopup() {
- super();
+ super();
addItem(MNU_ATTACH, new PopupItem(MNU_NAME_ATTACH).icon(IMG_ATTACH)
.action(ACT_ATTACH));
addSeparator();
break;
case version:
res = _user.canVersion();
- break;
+ break;
case replace:
res = _user.canReplace();
break;
if (dtype != null) {
docname = dtype.getName();
}
- if (_tempfile.get(docname) == null) { // No available template
+ if (tempfile.get(docname) == null) { // No available template
String tool = parsed[parsed.length - 1];
String icon = name[0];
if ("index".equals(icon)) {
}
public static String getApplicationProperty(final String name) {
- return _wapprops.getProperty(name); // May be null
+ return _WAPPROPS.getProperty(name); // May be null
}
public static String getApplicationRootPath() {
// The property is supposed including the Web application name
- return _wapproot;
+ return wapproot;
}
public String getApplicationURL() {
StringBuffer url = new StringBuffer("http://").append(_wappserver)
- .append("/").append(_wappname);
+ .append("/").append(wappname);
return url.toString();
}
}
static public Properties getNamingProperties() {
- return _jndprops;
+ return _JNDPROPS;
}
// ==============================================================================================================================
public static Converter getConverter(final DocumentType type,
final String format) {
- return _convertmap.get(format + type.getName()); // May be null;
+ return convertmap.get(format + type.getName()); // May be null;
}
public DocumentType getDefaultDocumentType(final Step step,
}
public static Locale[] getSupportedLocales() {
- String[] code = _wapprops.getProperty("locale.supported").split(",");
+ String[] code = _WAPPROPS.getProperty("locale.supported").split(",");
Locale[] result = new Locale[code.length];
for (int i = 0; i < code.length; i++) {
result[i] = new Locale(code[i]);
}
public static String[] getViewersMapping() {
- return _viewermap;
+ return viewermap;
}
public static String getWebSiteURL() {
NamedNodeMap natr = child.getAttributes();
String dext = natr.getNamedItem("extension").getNodeValue();
String exec = natr.getNamedItem("executable").getNodeValue();
- _wapprops.put("executable." + dext, exec);
+ _WAPPROPS.put("executable." + dext, exec);
}
// Viewer mappings tag
child = children.get("viewers");
- _viewermap = child.getAttributes().getNamedItem("extension")
+ viewermap = child.getAttributes().getNamedItem("extension")
.getNodeValue().split(",");
}
String from = natr.getNamedItem("from").getNodeValue();
String to = natr.getNamedItem("to").getNodeValue();
String exec = natr.getNamedItem("executable").getNodeValue();
- _convertmap.put(from + "geometry", new Converter("geometry",
+ convertmap.put(from + "geometry", new Converter("geometry",
from, to, exec));
}
}
NamedNodeMap natr = child.getAttributes();
String type = natr.getNamedItem("type").getNodeValue();
String file = natr.getNamedItem("file").getNodeValue();
- _tempfile.put(type, file);
+ tempfile.put(type, file);
}
}