List of usage examples for java.util Collections enumeration
public static <T> Enumeration<T> enumeration(final Collection<T> c)
From source file:org.wso2.carbon.identity.application.authentication.framework.model.AuthenticationFrameworkWrapper.java
/** * Will return header names which were in original request and will append * all the header names which were in authentication request cache entry *//*from w w w. j a va 2 s. c o m*/ @Override public Enumeration<String> getHeaderNames() { List<String> list = new ArrayList<String>(); for (Enumeration<String> headerNames = super.getHeaderNames(); headerNames.hasMoreElements();) { list.add(headerNames.nextElement()); } for (String keys : modifiableHeaders.keySet()) { list.add(keys); } return Collections.enumeration(list); }
From source file:org.eclipse.gyrex.cloud.internal.NodeMetricsReporter.java
@Override protected IStatus run(final IProgressMonitor monitor) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; }//from w w w .j a v a 2 s . c o m try { final Properties metrics = new Properties() { private static final long serialVersionUID = 1L; @Override public synchronized Enumeration<Object> keys() { return Collections.enumeration(keySet()); } @Override public Set<Object> keySet() { return new TreeSet<Object>(super.keySet()); } }; final OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); metrics.setProperty("os.availableProcessors", String.valueOf(operatingSystemMXBean.getAvailableProcessors())); metrics.setProperty("os.systemLoadAverage", String.valueOf(operatingSystemMXBean.getSystemLoadAverage())); metrics.setProperty("os.committedVirtualMemorySize", getUsingReflection(operatingSystemMXBean, "getCommittedVirtualMemorySize")); metrics.setProperty("os.totalSwapSpaceSize", getUsingReflection(operatingSystemMXBean, "getTotalSwapSpaceSize")); metrics.setProperty("os.freeSwapSpaceSize", getUsingReflection(operatingSystemMXBean, "getFreeSwapSpaceSize")); metrics.setProperty("os.processCpuTime", getUsingReflection(operatingSystemMXBean, "getProcessCpuTime")); metrics.setProperty("os.freePhysicalMemorySize", getUsingReflection(operatingSystemMXBean, "getFreePhysicalMemorySize")); metrics.setProperty("os.totalPhysicalMemorySize", getUsingReflection(operatingSystemMXBean, "getTotalPhysicalMemorySize")); metrics.setProperty("os.openFileDescriptorCount", getUsingReflection(operatingSystemMXBean, "getOpenFileDescriptorCount")); metrics.setProperty("os.maxFileDescriptorCount", getUsingReflection(operatingSystemMXBean, "getMaxFileDescriptorCount")); final MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); final MemoryUsage heapMemoryUsage = memoryMXBean.getHeapMemoryUsage(); metrics.setProperty("heap.used", String.valueOf(heapMemoryUsage.getUsed())); metrics.setProperty("heap.committed", String.valueOf(heapMemoryUsage.getCommitted())); metrics.setProperty("heap.max", String.valueOf(heapMemoryUsage.getMax())); metrics.setProperty("heap.init", String.valueOf(heapMemoryUsage.getInit())); final MemoryUsage nonHeapMemoryUsage = memoryMXBean.getNonHeapMemoryUsage(); metrics.setProperty("nonHeap.used", String.valueOf(nonHeapMemoryUsage.getUsed())); metrics.setProperty("nonHeap.committed", String.valueOf(nonHeapMemoryUsage.getCommitted())); metrics.setProperty("nonHeap.max", String.valueOf(nonHeapMemoryUsage.getMax())); metrics.setProperty("nonHeap.init", String.valueOf(nonHeapMemoryUsage.getInit())); final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); metrics.setProperty("thread.count", String.valueOf(threadMXBean.getThreadCount())); metrics.setProperty("thread.peak", String.valueOf(threadMXBean.getPeakThreadCount())); metrics.setProperty("thread.totalStarted", String.valueOf(threadMXBean.getTotalStartedThreadCount())); final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); metrics.setProperty("uptime", String.valueOf(runtimeMXBean.getUptime())); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final NodeInfo nodeInfo = CloudState.getNodeInfo(); metrics.store(out, String.valueOf(nodeInfo)); ZooKeeperGate.get().writeRecord(IZooKeeperLayout.PATH_NODES_METRICS.append(nodeInfo.getNodeId()), CreateMode.PERSISTENT, out.toByteArray()); if (CloudDebug.nodeMetrics) { LOG.debug("Node metrics reported successfully.{}{}", SystemUtils.LINE_SEPARATOR, new String(out.toByteArray(), CharEncoding.ISO_8859_1)); } } catch (final Exception e) { LOG.warn("Failed to update node metrics. {}", e.getMessage()); } finally { // reschedule schedule(DELAY); } return Status.OK_STATUS; }
From source file:org.atricore.idbus.kernel.main.authn.BaseRoleImpl.java
/** * Returns an enumeration of the members in the group. * The returned objects can be instances of either Principal * or Group (which is a subinterface of Principal). * * @return an enumeration of the group members. *//*from w ww. j a v a 2 s.co m*/ public Enumeration members() { return Collections.enumeration(members.values()); }
From source file:Main.java
@Override public Enumeration children() { return Collections.enumeration(nodes); }
From source file:net.formio.upload.MultipartRequestPreprocessor.java
/** * Return all request parameter names, for both regular form fields and file * upload fields./* w ww. j a v a 2 s .co m*/ */ public Enumeration<String> getParameterNames() { Set<String> allNames = new LinkedHashSet<String>(); allNames.addAll(regularParams.keySet()); allNames.addAll(fileParams.keySet()); return Collections.enumeration(allNames); }
From source file:org.dspace.app.webui.util.FileUploadRequest.java
public Enumeration getParameterNames() { Collection<String> c = parameters.keySet(); return Collections.enumeration(c); }
From source file:org.jasig.portal.security.provider.PersonImpl.java
/** * Returns a <code>java.util.Enumeration</code> of all the attribute values. * @return <code>java.util.Enumeration</code> of the attributes. *//*from w ww .j ava2 s . c o m*/ public Enumeration<List<Object>> getAttributes() { if (this.userAttributes == null) { return null; } final Collection<List<Object>> values = this.userAttributes.values(); return Collections.enumeration(values); }
From source file:ltistarter.oauth.OAuth1LibraryTests.java
@Test public void testGetSignatureBaseString() throws Exception { Map<String, String[]> requestParameters = new HashMap<>(); requestParameters.put("file", new String[] { "vacation.jpg" }); requestParameters.put("size", new String[] { "original" }); when(request.getParameterNames()).thenReturn(Collections.enumeration(requestParameters.keySet())); for (String key : requestParameters.keySet()) { when(request.getParameterValues(key)).thenReturn(requestParameters.get(key)); }//from ww w . j a v a2 s. co m when(request.getHeaders("Authorization")) .thenReturn(Collections.enumeration(Arrays.asList("OAuth realm=\"http://sp.example.com/\",\n" + " oauth_consumer_key=\"dpf43f3p2l4k3l03\",\n" + " oauth_token=\"nnch734d00sl2jdk\",\n" + " oauth_signature_method=\"HMAC-SHA1\",\n" + " oauth_signature=\"unimportantforthistest\",\n" + " oauth_timestamp=\"1191242096\",\n" + " oauth_nonce=\"kllo9940pd9333jh\",\n" + " oauth_version=\"1.0\""))); when(request.getMethod()).thenReturn("gEt"); CoreOAuthProviderSupport support = new CoreOAuthProviderSupport(); support.setBaseUrl("http://photos.example.net"); when(request.getRequestURI()).thenReturn("photos"); String baseString = support.getSignatureBaseString(request); assertEquals( "GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal", baseString); }
From source file:com.github.achatain.nopasswordauthentication.utils.FakeHttpServletRequest.java
public Enumeration<Locale> getLocales() { return Collections.enumeration(Collections.singleton(Locale.US)); }
From source file:org.apereo.portal.portlet.container.PortalContextImpl.java
@Override public Enumeration<PortletMode> getSupportedPortletModes() { return Collections.enumeration(this.portletModes); }