Search in sources :

Example 96 with Enumeration

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);
    }
}
Also used : Enumeration(java.util.Enumeration) ArrayList(java.util.ArrayList)

Example 97 with Enumeration

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();
}
Also used : Enumeration(java.util.Enumeration) ForumException(net.jforum.exceptions.ForumException) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) Properties(java.util.Properties) Vector(java.util.Vector)

Example 98 with Enumeration

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;
}
Also used : Enumeration(java.util.Enumeration) Properties(java.util.Properties)

Example 99 with Enumeration

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);
}
Also used : ForumException(net.jforum.exceptions.ForumException) Enumeration(java.util.Enumeration) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IOException(java.io.IOException) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) ForumException(net.jforum.exceptions.ForumException)

Example 100 with Enumeration

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);
}
Also used : ServletException(javax.servlet.ServletException) Enumeration(java.util.Enumeration) HttpServlet(javax.servlet.http.HttpServlet) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext)

Aggregations

Enumeration (java.util.Enumeration)1179 IOException (java.io.IOException)202 ArrayList (java.util.ArrayList)141 File (java.io.File)102 HashMap (java.util.HashMap)86 Properties (java.util.Properties)85 Vector (java.util.Vector)83 List (java.util.List)77 HashSet (java.util.HashSet)65 Hashtable (java.util.Hashtable)63 Map (java.util.Map)59 Set (java.util.Set)59 URL (java.net.URL)57 ZipEntry (java.util.zip.ZipEntry)55 ServletContext (javax.servlet.ServletContext)53 Iterator (java.util.Iterator)50 InputStream (java.io.InputStream)47 ZipFile (java.util.zip.ZipFile)46 FileInputStream (java.io.FileInputStream)40 X509Certificate (java.security.cert.X509Certificate)37