Java 类org.apache.commons.collections.EnumerationUtils 实例源码

项目:SamlSnort    文件:KeyStoreTool.java   
@SuppressWarnings("unchecked")
public static List<String> getAliases() {
    LOGGER.entering(KeyStoreTool.class.getName(), "getAliases");

    List<String> result = new LinkedList<String>();

    try {
        result.addAll(EnumerationUtils.toList(keyStore.aliases()));
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Error while reading aliases.", e);
    }

    LOGGER.exiting(KeyStoreTool.class.getName(), "getAliases", result);

    return result;
}
项目:confucius-commons    文件:JarUtils.java   
/**
 * Filter {@link JarEntry} list from {@link JarFile}
 *
 * @param jarFile
 *         {@link JarFile}
 * @param jarEntryFilter
 *         {@link JarEntryFilter}
 * @return Read-only List
 */
@Nonnull
public static List<JarEntry> filter(JarFile jarFile, JarEntryFilter jarEntryFilter) {
    if (jarFile == null) {
        return Collections.emptyList();
    }
    Enumeration<JarEntry> jarEntries = jarFile.entries();
    List<JarEntry> jarEntriesList = EnumerationUtils.toList(jarEntries);
    return doFilter(jarEntriesList, jarEntryFilter);
}
项目:kc-rice    文件:KSBDispatcherServlet.java   
/**
 * This is a workaround after upgrading to CXF 2.7.0 whereby we could no longer just call "setHideServiceList" on
 * the ServletController. Instead, it is now reading this information from the ServletConfig, so wrapping the base
 * ServletContext to return true or false for hide service list depending on whether or not we are in dev mode.
 */
protected ServletConfig getCXFServletConfig(final ServletConfig baseServletConfig) {
    // disable handling of URLs ending in /services which display CXF generated service lists if we are not in dev mode
    final String shouldHide = Boolean.toString(!ConfigContext.getCurrentContextConfig().getDevMode().booleanValue());
    return new ServletConfig() {
        private static final String HIDE_SERVICE_LIST_PAGE_PARAM = "hide-service-list-page";
        @Override
        public String getServletName() {
            return baseServletConfig.getServletName();
        }
        @Override
        public ServletContext getServletContext() {
            return baseServletConfig.getServletContext();
        }
        @Override
        public String getInitParameter(String parameter) {
            if (HIDE_SERVICE_LIST_PAGE_PARAM.equals(parameter)) {
                return shouldHide;
            }
            return baseServletConfig.getInitParameter(parameter);
        }
        @Override
        public Enumeration<String> getInitParameterNames() {
            List<String> initParameterNames = EnumerationUtils.toList(baseServletConfig.getInitParameterNames());
            initParameterNames.add(HIDE_SERVICE_LIST_PAGE_PARAM);
            return new Vector<String>(initParameterNames).elements();
        }
    };
}
项目:FHIR-Server    文件:HttpProxyTest.java   
@Read
public Patient read(@IdParam IdDt theId, HttpServletRequest theRequest) {
    Patient retVal = new Patient();
    retVal.setId(theId);
    ourRequest = theRequest;

    ourLog.info(EnumerationUtils.toList(ourRequest.getHeaderNames()).toString());
    ourLog.info("Proxy-Connection: " + EnumerationUtils.toList(ourRequest.getHeaders("Proxy-Connection")));
    ourLog.info("Host: " + EnumerationUtils.toList(ourRequest.getHeaders("Host")));
    ourLog.info("User-Agent: " + EnumerationUtils.toList(ourRequest.getHeaders("User-Agent")));

    return retVal;
}
项目:hapi-fhir    文件:HttpProxyTest.java   
@Read
public Patient read(@IdParam IdType theId, HttpServletRequest theRequest) {
    Patient retVal = new Patient();
    retVal.setId(theId);
    ourRequest = theRequest;

    ourLog.info(EnumerationUtils.toList(ourRequest.getHeaderNames()).toString());
    ourLog.info("Proxy-Connection: " + EnumerationUtils.toList(ourRequest.getHeaders("Proxy-Connection")));
    ourLog.info("Host: " + EnumerationUtils.toList(ourRequest.getHeaders("Host")));
    ourLog.info("User-Agent: " + EnumerationUtils.toList(ourRequest.getHeaders("User-Agent")));

    return retVal;
}
项目:rice    文件:KSBDispatcherServlet.java   
/**
 * This is a workaround after upgrading to CXF 2.7.0 whereby we could no longer just call "setHideServiceList" on
 * the ServletController. Instead, it is now reading this information from the ServletConfig, so wrapping the base
 * ServletContext to return true or false for hide service list depending on whether or not we are in dev mode.
 */
protected ServletConfig getCXFServletConfig(final ServletConfig baseServletConfig) {
    // disable handling of URLs ending in /services which display CXF generated service lists if we are not in dev mode
    final String shouldHide = Boolean.toString(!ConfigContext.getCurrentContextConfig().getDevMode().booleanValue());
    return new ServletConfig() {
        private static final String HIDE_SERVICE_LIST_PAGE_PARAM = "hide-service-list-page";
        @Override
        public String getServletName() {
            return baseServletConfig.getServletName();
        }
        @Override
        public ServletContext getServletContext() {
            return baseServletConfig.getServletContext();
        }
        @Override
        public String getInitParameter(String parameter) {
            if (HIDE_SERVICE_LIST_PAGE_PARAM.equals(parameter)) {
                return shouldHide;
            }
            return baseServletConfig.getInitParameter(parameter);
        }
        @Override
        public Enumeration<String> getInitParameterNames() {
            List<String> initParameterNames = EnumerationUtils.toList(baseServletConfig.getInitParameterNames());
            initParameterNames.add(HIDE_SERVICE_LIST_PAGE_PARAM);
            return new Vector<String>(initParameterNames).elements();
        }
    };
}
项目:ws-proxy    文件:HttpRequestHeaderTransfererInterceptor.java   
@SuppressWarnings("unchecked")
public static List<Pair<String, String>> extractHeaders(HttpServletRequest httpServletRequest) {
    List<Pair<String, String>> result = new ArrayList<>();

    for (String headerName : (List<String>) EnumerationUtils.toList(httpServletRequest.getHeaderNames())) {
        result.add(Pair.of(headerName, httpServletRequest.getHeader(headerName)));
    }
    return result;
}
项目:pi    文件:CryptoFacade.java   
/**
 * Gets all aliases in the {@link KeyStore}.
 */
@SuppressWarnings(UNCHECKED)
public Collection<String> getAliases() {
    try {
        return EnumerationUtils.toList(crypto.getKeyStore().aliases());
    } catch (KeyStoreException e) {
        // no way to recover
        throw new RuntimeException(e);
    }
}
项目:kuali_rice    文件:KSBDispatcherServlet.java   
/**
 * This is a workaround after upgrading to CXF 2.7.0 whereby we could no longer just call "setHideServiceList" on
 * the ServletController. Instead, it is now reading this information from the ServletConfig, so wrapping the base
 * ServletContext to return true or false for hide service list depending on whether or not we are in dev mode.
 */
protected ServletConfig getCXFServletConfig(final ServletConfig baseServletConfig) {
    // disable handling of URLs ending in /services which display CXF generated service lists if we are not in dev mode
    final String shouldHide = Boolean.toString(!ConfigContext.getCurrentContextConfig().getDevMode().booleanValue());
    return new ServletConfig() {
        private static final String HIDE_SERVICE_LIST_PAGE_PARAM = "hide-service-list-page";
        @Override
        public String getServletName() {
            return baseServletConfig.getServletName();
        }
        @Override
        public ServletContext getServletContext() {
            return baseServletConfig.getServletContext();
        }
        @Override
        public String getInitParameter(String parameter) {
            if (HIDE_SERVICE_LIST_PAGE_PARAM.equals(parameter)) {
                return shouldHide;
            }
            return baseServletConfig.getInitParameter(parameter);
        }
        @Override
        public Enumeration<String> getInitParameterNames() {
            List<String> initParameterNames = EnumerationUtils.toList(baseServletConfig.getInitParameterNames());
            initParameterNames.add(HIDE_SERVICE_LIST_PAGE_PARAM);
            return new Vector<String>(initParameterNames).elements();
        }
    };
}
项目:ApprovalTests.Java    文件:ReportEnvironmentServer.java   
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
  resp.setContentType("text/html");
  ServletOutputStream out = resp.getOutputStream();
  List<String> list = EnumerationUtils.toList(req.getHeaderNames());
  for (String key : list)
  {
    out.print(String.format("%s = %s <br>", key, req.getHeader(key)));
  }
  out.flush();
}
项目:usergrid    文件:HttpServletRequestSession.java   
@SuppressWarnings({ "unchecked" })
@Override
public Collection<Object> getAttributeKeys() throws InvalidSessionException {
    return EnumerationUtils.toList( request.getAttributeNames() );
}
项目:confucius-commons    文件:ClassLoaderUtils.java   
/**
 * Get the resource URLs Set under specified resource name and type
 *
 * @param classLoader
 *         ClassLoader
 * @param resourceType
 *         {@link ResourceType} Enum
 * @param resourceName
 *         resource name ,e.g : <br /> <ul> <li>Resource Name :<code>"/com/abc/def.log"</code></li> <li>Class Name :
 *         <code>"java.lang.String"</code></li> </ul>
 * @return the resource URL under specified resource name and type
 * @throws NullPointerException
 *         If any argument is <code>null</code>
 * @throws IOException
 * @version 1.0.0
 * @since 1.0.0
 */
public static Set<URL> getResources(ClassLoader classLoader, ResourceType resourceType, String resourceName) throws NullPointerException, IOException {
    String normalizedResourceName = resourceType.resolve(resourceName);
    Enumeration<URL> resources = classLoader.getResources(normalizedResourceName);
    return resources != null && resources.hasMoreElements() ? Sets.newLinkedHashSet(EnumerationUtils.toList(resources)) : Collections.<URL>emptySet();
}