List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:com.griddynamics.jagger.diagnostics.reporting.ProfileReporter.java
@Override public JRDataSource getDataSource(String testId) { if (!enable) { return new JRBeanCollectionDataSource(Collections.emptySet()); }//from www . java 2 s. c o m if (sysUnderTests == null) { sysUnderTests = loadData(); } loadMonitoringMap(); List<SysUnderTestDTO> data = sysUnderTests.get(testId); if (data == null) { data = sysUnderTests.get(relatedMonitoringTask(testId)); } return new JRBeanCollectionDataSource(data); }
From source file:com.espertech.esper.epl.join.table.PropertySortedEventTable.java
/** * Returns the set of events that have the same property value as the given event. * @param keyStart to compare against/*from ww w .ja v a2 s . com*/ * @param keyEnd to compare against * @param allowRangeReversal indicate whether "a between 60 and 50" should return no results (equivalent to a>= X and a <=Y) or should return results (equivalent to 'between' and 'in' * @return set of events with property value, or null if none found (never returns zero-sized set) */ public Set<EventBean> lookupRange(Object keyStart, boolean includeStart, Object keyEnd, boolean includeEnd, boolean allowRangeReversal) { if (keyStart == null || keyEnd == null) { return Collections.emptySet(); } keyStart = coerce(keyStart); keyEnd = coerce(keyEnd); SortedMap<Object, Set<EventBean>> submap; try { submap = propertyIndex.subMap(keyStart, includeStart, keyEnd, includeEnd); } catch (IllegalArgumentException ex) { if (allowRangeReversal) { submap = propertyIndex.subMap(keyEnd, includeStart, keyStart, includeEnd); } else { return Collections.emptySet(); } } return normalize(submap); }
From source file:com.vmware.identity.saml.idm.IdmPrincipalAttributesExtractor.java
@Override public Set<PrincipalAttribute> getAttributes(PrincipalId principalId, Collection<PrincipalAttributeDefinition> attributeDefinitions) throws InvalidPrincipalException, SystemException { Validate.notNull(principalId);//from ww w . j ava2 s . c o m Validate.notNull(attributeDefinitions); Set<Attribute> attributeDefsIDM = new HashSet<Attribute>(); for (PrincipalAttributeDefinition principalAttributeDefinition : attributeDefinitions) { attributeDefsIDM.add(convertToIDMAttributeDefinition(principalAttributeDefinition)); } Collection<AttributeValuePair> attributes = Collections.emptySet(); try { final long start = System.nanoTime(); attributes = idmClient.getAttributeValues(tenantName, principalId, attributeDefsIDM); perfLog.trace("'idmClient.getAttributes' took {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); } catch (com.vmware.identity.idm.InvalidPrincipalException e) { throw new InvalidPrincipalException(e); } catch (Exception e) { throw new SystemException(e); } Set<PrincipalAttribute> result = Collections.emptySet(); if (attributes != null) { log.trace("{} attributes retrieved for {}", attributes.size(), principalId); result = new HashSet<PrincipalAttribute>(attributes.size()); for (AttributeValuePair attr : attributes) { final Attribute attrDefinition = attr.getAttrDefinition(); if (attrDefinition == null || attrDefinition.getName() == null || attrDefinition.getNameFormat() == null) { throw new IllegalStateException("Missing or invalid attribute definition!"); } List<String> values = attr.getValues(); final PrincipalAttribute newAttr = new PrincipalAttribute(attrDefinition.getName(), attrDefinition.getNameFormat(), attrDefinition.getFriendlyName(), values == null || values.size() == 0 ? null : values.toArray(new String[values.size()])); result.add(newAttr); log.trace("An attribute {} retrieved for {}", newAttr, principalId); } } return result; }
From source file:com.dianping.dpsf.jmx.DpsfResponsorMonitor.java
/** * get services at specified port/* w w w .j av a 2 s . com*/ * @param port * @return */ @MBeanMeta(ignore = true) public Collection<String> servicesAtPort(int port) { RequestProcessor requestProcessor = getRequestProcessor(port); if (requestProcessor == null) { return Collections.emptySet(); } ServiceRepository serviceRepository = requestProcessor.getServiceRepository(); return serviceRepository.getServiceNames(); }
From source file:com.ge.predix.acs.service.policy.matcher.PolicyMatcherImplTest.java
/** * Tests matching a blanket policy to a request. * * @throws IOException// w w w . j av a 2 s.com * on failure to load policy required for test. */ public void testMatchPolicyWithNoTarget() throws IOException { File file = getPolicyFileForTest(getMethodName()); PolicySet policySet = PolicySets.loadFromFile(file); List<Policy> policies = policySet.getPolicies(); PolicyMatchCandidate candidate = new PolicyMatchCandidate(); candidate.setAction("GET"); candidate.setResourceURI("/this/does/not/exist"); candidate.setSubjectIdentifier("Edward R. Murrow"); candidate.setSupplementalResourceAttributes(Collections.emptySet()); candidate.setSupplementalSubjectAttributes(Collections.emptySet()); List<MatchedPolicy> matchedPolicies = this.policyMatcher.match(candidate, policies); Assert.assertEquals(matchedPolicies.size(), 1); Assert.assertEquals(matchedPolicies.get(0).getPolicy(), policies.get(policies.size() - 1)); Assert.assertNull(matchedPolicies.get(0).getPolicy().getTarget()); }
From source file:jp.realglobe.util.uploader.DirectoryUploader.java
/** * ??//ww w . j a va 2 s.c o m * @param watchDirectoryPath ?? * @param delay ????? * ?????????? * @param latestOnly ???????? * @param targetExtensions ?? * @param minSize ??? * @param maxSize ?? * @param urlBase ?? URL * @param userId ???? ID * @param name ?? * @param id ? ID * @param token ? * @throws URISyntaxException URL ????? * @throws MalformedURLException URL ???? */ public DirectoryUploader(final Path watchDirectoryPath, final long delay, final boolean latestOnly, final Collection<String> targetExtensions, final long minSize, final long maxSize, final String urlBase, final String userId, final String name, final String id, final String token) throws MalformedURLException, URISyntaxException { this.watchDirectoryPath = watchDirectoryPath; this.delay = delay; this.latestOnly = latestOnly; this.targetExtensions = (targetExtensions == null ? Collections.emptySet() : new HashSet<>(targetExtensions)); this.minSize = minSize; this.maxSize = maxSize; this.userId = userId; this.id = id; this.name = name; this.tokenUrl = null; this.uploadUrl = (new URL( urlBase + Constants.URL_PATH_UPLOAD_PREFIX + "/" + this.id + Constants.URL_PATH_UPLOAD_SUFFIX)) .toURI(); this.store = null; this.token = token; LOG.info("ID is " + this.id); }
From source file:io.apicurio.hub.core.beans.ApiDesignResourceInfoTest.java
/** * Test method for {@link io.apicurio.hub.core.beans.ApiDesignResourceInfo#fromContent(java.lang.String)}. *///from w ww.j a va 2 s. co m @Test public void testFromContent_20_Yaml() throws Exception { String content = IOUtils.toString( ApiDesignResourceInfoTest.class.getResourceAsStream("ApiDesignResourceInfoTest_2.0.yaml")); ApiDesignResourceInfo info = ApiDesignResourceInfo.fromContent(content); Assert.assertNotNull(info); Assert.assertEquals(FormatType.YAML, info.getFormat()); Assert.assertEquals("Rate Limiter API", info.getName()); Assert.assertEquals("A REST API used by clients to access the standalone Rate Limiter micro-service.", info.getDescription()); Assert.assertEquals(Collections.emptySet(), info.getTags()); }
From source file:com.amalto.core.integrity.DefaultCheckDataSource.java
public Set<ReferenceFieldMetadata> getForeignKeyList(String concept, String dataModel) throws XtentisException { // Get FK(s) to check MetadataRepository mr = ServerContext.INSTANCE.get().getMetadataRepositoryAdmin().get(dataModel); TypeMetadata type = mr.getType(concept); if (type != null) { return mr.accept(new InboundReferences(type)); } else {/*from w w w . j a va 2s . com*/ logger.warn("Type '" + concept + "' does not exist anymore in data model '" + dataModel //$NON-NLS-1$//$NON-NLS-2$ + "'. No integrity check will be performed."); //$NON-NLS-1$ return Collections.emptySet(); } }
From source file:com.github.jknack.handlebars.JsonNodeValueResolver.java
@Override public Set<Entry<String, Object>> propertySet(final Object context) { if (context instanceof ObjectNode) { ObjectNode node = (ObjectNode) context; Iterator<String> fieldNames = node.fieldNames(); Map<String, Object> result = new LinkedHashMap<String, Object>(); while (fieldNames.hasNext()) { String key = fieldNames.next(); result.put(key, resolve(node, key)); }/*from w w w . j ava 2s . c om*/ return result.entrySet(); } return Collections.emptySet(); }
From source file:com.wavemaker.runtime.data.util.DataServiceUtils.java
public static ObjectGraphTraversal getRelatedTraversal(ObjectGraphTraversal.ObjectVisitor visitor, final ObjectAccess objectAccess, final DataServiceMetaData metaData, final boolean skipToMany) { ObjectGraphTraversal.PropertyFactory pf = new ObjectGraphTraversal.PropertyFactory() { @Override/*from www .j av a 2s . c o m*/ public Collection<String> getProperties(Object o, ObjectGraphTraversal.Context ctx) { Class<?> entityClass = getEntityClass(o.getClass()); if (!metaData.isEntity(entityClass)) { return Collections.emptySet(); } Collection<String> relPropNames = metaData.getRelPropertyNames(entityClass); if (!skipToMany) { return relPropNames; } else { Collection<String> rtn = new HashSet<String>(); for (String propertyName : relPropNames) { if (!isRelatedMany(objectAccess.getPropertyType(entityClass, propertyName))) { rtn.add(propertyName); } } return rtn; } } }; return new ObjectGraphTraversal(pf, visitor, objectAccess); }