Example usage for java.util Collections unmodifiableSet

List of usage examples for java.util Collections unmodifiableSet

Introduction

In this page you can find the example usage for java.util Collections unmodifiableSet.

Prototype

public static <T> Set<T> unmodifiableSet(Set<? extends T> s) 

Source Link

Document

Returns an unmodifiable view of the specified set.

Usage

From source file:org.redisson.spring.cache.RedissonSpringCacheManager.java

@Override
public Collection<String> getCacheNames() {
    return Collections.unmodifiableSet(configMap.keySet());
}

From source file:org.jasig.portlet.blackboardvcportlet.service.impl.LdapUserServiceImpl.java

@Override
public Set<BasicUser> searchForUserByName(String name) {
    final List<String> nameParts = getNameParts(name);

    //Nothing useful to search on return an empty set
    if (nameParts.isEmpty()) {
        return Collections.emptySet();
    }/*from ww w.  j a  va 2s .  com*/

    final AndFilter andFilter = createBaseFilter();

    final OrFilter orFilter = new OrFilter();

    final String namePartZero = nameParts.get(0);
    if (nameParts.size() == 1) {
        orFilter.or(new LikeFilter(firstNameAttributeName, namePartZero + "*"));
        orFilter.or(new LikeFilter(lastNameAttributeName, namePartZero + "*"));
        orFilter.or(new LikeFilter(displayNameAttributeName, namePartZero + "*"));
    } else {
        final AndFilter firstLastFilter = new AndFilter();
        firstLastFilter.and(new LikeFilter(firstNameAttributeName, namePartZero + "*"));
        firstLastFilter.and(new LikeFilter(lastNameAttributeName, nameParts.get(nameParts.size() - 1) + "*"));
        orFilter.or(firstLastFilter);

        final String displayNameSearch = NAME_SPLIT.matcher(name.trim()).replaceAll("*") + "*";
        orFilter.or(new LikeFilter(displayNameAttributeName, displayNameSearch));
    }
    andFilter.and(orFilter);

    final String searchFilter = andFilter.encode();
    @SuppressWarnings("unchecked")
    final List<BasicUser> results = ldapOperations.search("", searchFilter, basicUserAttributeMapper);

    return Collections.unmodifiableSet(new LinkedHashSet<BasicUser>(results));
}

From source file:com.kolich.pusachat.spring.beans.ChatRooms.java

public synchronized Set<UUID> getAllRooms() {
    return Collections.unmodifiableSet(chatRooms_.keySet());
}

From source file:com.thinkbiganalytics.nifi.v2.ingest.MergeTable.java

public MergeTable() {
    final Set<Relationship> r = new HashSet<>();
    r.add(REL_SUCCESS);//  w w  w.  ja  v  a 2s .  c  om
    r.add(REL_FAILURE);
    relationships = Collections.unmodifiableSet(r);

    final List<PropertyDescriptor> pds = new ArrayList<>();
    pds.add(THRIFT_SERVICE);
    pds.add(MERGE_STRATEGY);
    pds.add(SOURCE_SCHEMA);
    pds.add(SOURCE_TABLE);
    pds.add(TARGET_SCHEMA);
    pds.add(TARGET_TABLE);
    pds.add(FEED_PARTITION);
    pds.add(PARTITION_SPECIFICATION);
    pds.add(FIELD_SPECIFICATION);
    pds.add(HIVE_CONFIGURATIONS);

    propDescriptors = Collections.unmodifiableList(pds);
}

From source file:org.jasig.springframework.security.portlet.authentication.PortletXmlMappableAttributesRetriever.java

/**
 * Loads the portlet.xml file using the configured <tt>ResourceLoader</tt> and
 * parses the role-name elements from it, using these as the set of <tt>mappableAttributes</tt>.
 *//*from  www .  j a  va2 s.  co m*/
public void afterPropertiesSet() throws Exception {
    Resource portletXml = resourceLoader.getResource("/WEB-INF/portlet.xml");
    Document doc = getDocument(portletXml.getInputStream());

    final XPathExpression roleNamesExpression;
    if (portletConfig == null) {
        final XPathFactory xPathFactory = XPathFactory.newInstance();

        final XPath xPath = xPathFactory.newXPath();
        roleNamesExpression = xPath.compile("/portlet-app/portlet/security-role-ref/role-name");
    } else {
        final XPathFactory xPathFactory = XPathFactory.newInstance();
        xPathFactory.setXPathVariableResolver(new XPathVariableResolver() {
            @Override
            public Object resolveVariable(QName variableName) {
                if ("portletName".equals(variableName.getLocalPart())) {
                    return portletConfig.getPortletName();
                }

                return null;
            }
        });
        final XPath xPath = xPathFactory.newXPath();
        roleNamesExpression = xPath
                .compile("/portlet-app/portlet[portlet-name=$portletName]/security-role-ref/role-name");
    }

    final NodeList securityRoles = (NodeList) roleNamesExpression.evaluate(doc, XPathConstants.NODESET);
    final Set<String> roleNames = new HashSet<String>();

    for (int i = 0; i < securityRoles.getLength(); i++) {
        Element secRoleElt = (Element) securityRoles.item(i);
        String roleName = secRoleElt.getTextContent().trim();
        roleNames.add(roleName);
        logger.info("Retrieved role-name '" + roleName + "' from portlet.xml");
    }

    if (roleNames.isEmpty()) {
        logger.info("No security-role-ref elements found in " + portletXml
                + (portletConfig == null ? "" : " for portlet " + portletConfig.getPortletName()));
    }

    mappableAttributes = Collections.unmodifiableSet(roleNames);
}

From source file:de.kapsi.net.daap.Database.java

/**
 * Returns an unmodifiable Set with all Playlists
 * in this Database//from ww  w .j  a v  a 2  s.  c om
 * 
 * @return unmodifiable Set of Playlists
 */
public Set getPlaylists() {
    return Collections.unmodifiableSet(containers);
}

From source file:com.connexta.arbitro.attr.StandardAttributeFactory.java

/**
 * Private initializer for the supported datatypes. This isn't called until something needs
 * these values, and is only called once.
 *//*from  ww w . j a v  a  2s  . c o m*/
private static void initDatatypes() {
    if (logger.isDebugEnabled()) {
        logger.debug("Initializing standard datatypes");
    }

    supportedDatatypes = new HashMap();

    // the 1.x datatypes
    supportedDatatypes.put(BooleanAttribute.identifier, new BooleanAttributeProxy());
    supportedDatatypes.put(StringAttribute.identifier, new StringAttributeProxy());
    supportedDatatypes.put(DateAttribute.identifier, new DateAttributeProxy());
    supportedDatatypes.put(TimeAttribute.identifier, new TimeAttributeProxy());
    supportedDatatypes.put(DateTimeAttribute.identifier, new DateTimeAttributeProxy());
    supportedDatatypes.put(DayTimeDurationAttribute.identifier, new DayTimeDurationAttributeProxy());
    supportedDatatypes.put(YearMonthDurationAttribute.identifier, new YearMonthDurationAttributeProxy());
    supportedDatatypes.put(DoubleAttribute.identifier, new DoubleAttributeProxy());
    supportedDatatypes.put(IntegerAttribute.identifier, new IntegerAttributeProxy());
    supportedDatatypes.put(AnyURIAttribute.identifier, new AnyURIAttributeProxy());
    supportedDatatypes.put(HexBinaryAttribute.identifier, new HexBinaryAttributeProxy());
    supportedDatatypes.put(Base64BinaryAttribute.identifier, new Base64BinaryAttributeProxy());
    supportedDatatypes.put(X500NameAttribute.identifier, new X500NameAttributeProxy());
    supportedDatatypes.put(RFC822NameAttribute.identifier, new RFC822NameAttributeProxy());

    supportedV1Identifiers = Collections.unmodifiableSet(supportedDatatypes.keySet());

    // the 2.0 datatypes
    supportedDatatypes.put(DNSNameAttribute.identifier, new DNSNameAttributeProxy());
    supportedDatatypes.put(IPAddressAttribute.identifier, new IPAddressAttributeProxy());

    supportedV2Identifiers = Collections.unmodifiableSet(supportedDatatypes.keySet());

    // the 3.0 datatypes.
    supportedDatatypes.put(XPathAttribute.identifier, new XPathAttributeProxy());

    supportedV3Identifiers = Collections.unmodifiableSet(supportedDatatypes.keySet());
}

From source file:paillard.florent.springframework.simplejdbcupdate.AbstractJdbcUpdate.java

/**
 * Get the names of 'where' columns/* w  w  w  . j a  v  a  2  s.  c  om*/
 */
public Set<String> getRestrictingColumns() {
    return Collections.unmodifiableSet(this.restrictingColumns.keySet());
}

From source file:edu.uci.ics.jung.graph.impl.SimpleSparseVertex.java

/**
 * @see edu.uci.ics.jung.graph.Vertex#getOutEdges()
 *///from   ww w.  j  a  v a 2  s . co  m
public Set getOutEdges() {
    Collection outEdges = getSuccsToOutEdges().values();
    Collection adjacentEdges = getNeighborsToEdges().values();

    Set edges = new HashSet();
    if (outEdges != null)
        edges.addAll(outEdges);
    if (adjacentEdges != null)
        edges.addAll(adjacentEdges);

    return Collections.unmodifiableSet(edges);
}

From source file:io.gravitee.gateway.http.core.endpoint.impl.DefaultEndpointLifecycleManager.java

@Override
public Set<String> endpoints() {
    return Collections.unmodifiableSet(endpoints.keySet());
}