use of java.util.Enumeration in project robovm by robovm.
the class ElemTemplateElement method setPrefixes.
/**
* Copy the namespace declarations from the NamespaceSupport object.
* Take care to call resolveInheritedNamespaceDecls.
* after all namespace declarations have been added.
*
* @param nsSupport non-null reference to NamespaceSupport from
* the ContentHandler.
* @param excludeXSLDecl true if XSLT namespaces should be ignored.
*
* @throws TransformerException
*/
public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl) throws TransformerException {
Enumeration decls = nsSupport.getDeclaredPrefixes();
while (decls.hasMoreElements()) {
String prefix = (String) decls.nextElement();
if (null == m_declaredPrefixes)
m_declaredPrefixes = new ArrayList();
String uri = nsSupport.getURI(prefix);
if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
continue;
// System.out.println("setPrefixes - "+prefix+", "+uri);
XMLNSDecl decl = new XMLNSDecl(prefix, uri, false);
m_declaredPrefixes.add(decl);
}
}
use of java.util.Enumeration in project jforum2 by rafaelsteil.
the class SystemGlobals method saveInstallation.
/**
* Save installation defaults
*/
public static void saveInstallation() {
// our new keys.
class SortedProperties extends Properties {
public synchronized Enumeration keys() {
Enumeration keysEnum = super.keys();
Vector keyList = new Vector();
while (keysEnum.hasMoreElements()) {
keyList.add(keysEnum.nextElement());
}
Collections.sort(keyList);
return keyList.elements();
}
}
Properties p = new SortedProperties();
p.putAll(globals.installation);
try {
FileOutputStream out = new FileOutputStream(globals.installationConfig);
p.store(out, "Installation specific configuration options");
out.close();
} catch (IOException e) {
throw new ForumException(e);
}
ConfigLoader.listenInstallationConfig();
}
use of java.util.Enumeration in project jforum2 by rafaelsteil.
the class ConfigAction method getConfig.
Properties getConfig() {
Properties p = new Properties();
for (Enumeration e = this.request.getParameterNames(); e.hasMoreElements(); ) {
String formFieldName = (String) e.nextElement();
if (formFieldName.startsWith("p_")) {
String propertyKey = formFieldName.substring(formFieldName.indexOf('_') + 1);
p.setProperty(propertyKey, this.safeValue(propertyKey, this.request.getParameter(formFieldName)));
}
}
return p;
}
use of java.util.Enumeration in project jforum2 by rafaelsteil.
the class ConfigAction method list.
public void list() {
Properties p = new Properties();
Iterator iter = SystemGlobals.fetchConfigKeyIterator();
while (iter.hasNext()) {
String key = (String) iter.next();
String value = SystemGlobals.getValue(key);
p.put(key, value);
}
Properties locales = new Properties();
FileInputStream fis = null;
try {
fis = new FileInputStream(SystemGlobals.getValue(ConfigKeys.CONFIG_DIR) + "/languages/locales.properties");
locales.load(fis);
} catch (IOException e) {
throw new ForumException(e);
} finally {
if (fis != null) {
try {
fis.close();
} catch (Exception e) {
}
}
}
List localesList = new ArrayList();
for (Enumeration e = locales.keys(); e.hasMoreElements(); ) {
localesList.add(e.nextElement());
}
this.context.put("config", p);
this.context.put("locales", localesList);
this.setTemplateName(TemplateKeys.CONFIG_LIST);
}
use of java.util.Enumeration in project roboguice by roboguice.
the class ServletDefinition method init.
public void init(final ServletContext servletContext, Injector injector, Set<HttpServlet> initializedSoFar) throws ServletException {
// This absolutely must be a singleton, and so is only initialized once.
if (!Scopes.isSingleton(injector.getBinding(servletKey))) {
throw new ServletException("Servlets must be bound as singletons. " + servletKey + " was not bound in singleton scope.");
}
HttpServlet httpServlet = injector.getInstance(servletKey);
this.httpServlet.set(httpServlet);
// Only fire init() if we have not appeared before in the filter chain.
if (initializedSoFar.contains(httpServlet)) {
return;
}
//initialize our servlet with the configured context params and servlet context
httpServlet.init(new ServletConfig() {
public String getServletName() {
return servletKey.toString();
}
public ServletContext getServletContext() {
return servletContext;
}
public String getInitParameter(String s) {
return initParams.get(s);
}
public Enumeration getInitParameterNames() {
return Iterators.asEnumeration(initParams.keySet().iterator());
}
});
// Mark as initialized.
initializedSoFar.add(httpServlet);
}
Aggregations