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:com.qwazr.server.configuration.ServerConfiguration.java

private static Set<Path> getEtcDirectories(final String value) {
    final Set<Path> set = new LinkedHashSet<>();
    fillStringListProperty(value == null ? "etc" : value, File.pathSeparator, true, part -> {
        // By design relative path are relative to the working directory
        final Path etcPath = Paths.get(part);
        set.add(etcPath);//ww w .  j av  a  2s.c  o m
        LOGGER.info("Configuration (ETC) directory: " + etcPath.toAbsolutePath());
    });
    return Collections.unmodifiableSet(set);
}

From source file:libepg.epg.section.descriptor.DESCRIPTOR_TAG.java

private DESCRIPTOR_TAG(String tagName, Class<? extends Descriptor> dataType, Integer tag, Integer... tags) {

    this.tagName = tagName;
    if ((this.tagName == null) || ("".equals(this.tagName))) {
        throw new IllegalArgumentException("???????????");
    }/*from   ww  w . java 2 s. c om*/

    List<Integer> t = new ArrayList<>();
    if (tag != null) {
        t.add(tag);
    } else {
        throw new NullPointerException("??????");
    }
    if (tags != null) {
        t.addAll(Arrays.asList(tags));
    }
    Range<Integer> r = Range.between(0x0, 0xFF);
    for (Integer i : t) {
        if (!r.contains(i)) {
            MessageFormat msg = new MessageFormat("????={0}");
            Object[] parameters = { Integer.toHexString(i) };
            throw new IllegalArgumentException(msg.format(parameters));
        }
    }
    Set<Integer> temp = Collections.synchronizedSet(new HashSet<Integer>());
    temp.addAll(t);
    this.tags = Collections.unmodifiableSet(temp);
    this.dataType = dataType;
}

From source file:com.connexta.arbitro.AbstractPolicy.java

/**
 * Constructor used to create a policy from concrete components.
 *
 * @param id the policy id/*from www .  j  a v  a  2 s  . c  o  m*/
 * @param version the policy version or null for the default (this is always null for pre-2.0
 *            policies)
 * @param combiningAlg the combining algorithm to use
 * @param description describes the policy or null if there is none
 * @param target the policy's target
 * @param defaultVersion the XPath version to use for selectors
 * @param obligationExpressions the policy's ObligationExpressions
 * @param adviceExpressions the policy's advice expressions
 * @param parameters the policy's parameters
 */
protected AbstractPolicy(URI id, String version, CombiningAlgorithm combiningAlg, String description,
        AbstractTarget target, String defaultVersion, Set<AbstractObligation> obligationExpressions,
        Set<AdviceExpression> adviceExpressions, List<CombinerParameter> parameters) {

    idAttr = id;
    this.combiningAlg = combiningAlg;
    this.description = description;
    this.target = target;
    this.defaultVersion = defaultVersion;

    if (version == null)
        this.version = "1.0";
    else
        this.version = version;

    // FIXME: this needs to fill in the meta-data correctly
    metaData = null;

    if (obligationExpressions == null)
        this.obligationExpressions = new HashSet<AbstractObligation>();
    else
        this.obligationExpressions = Collections
                .unmodifiableSet(new HashSet<AbstractObligation>(obligationExpressions));

    if (adviceExpressions == null) {
        this.adviceExpressions = new HashSet<AdviceExpression>();
    } else {
        this.adviceExpressions = Collections.unmodifiableSet(new HashSet<AdviceExpression>(adviceExpressions));
    }

    if (parameters == null)
        this.parameters = new ArrayList<CombinerParameter>();
    else
        this.parameters = Collections.unmodifiableList(new ArrayList<CombinerParameter>(parameters));
}

From source file:com.connexta.arbitro.combine.StandardCombiningAlgFactory.java

/**
 * Private initializer for the supported algorithms. This isn't called until something needs
 * these values, and is only called once.
 *//*  w w  w . ja v  a2  s .co  m*/
private static void initAlgorithms() {
    if (logger.isDebugEnabled()) {
        logger.debug("Initializing standard combining algorithms");
    }

    supportedAlgorithms = new HashSet();
    supportedAlgIds = new HashSet();

    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml2.DenyOverridesRuleAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml2.DenyOverridesRuleAlg.algId);
    supportedAlgorithms.add(new DenyOverridesPolicyAlg());
    supportedAlgIds.add(DenyOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new OrderedDenyOverridesRuleAlg());
    supportedAlgIds.add(OrderedDenyOverridesRuleAlg.algId);
    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml2.OrderedDenyOverridesPolicyAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml2.OrderedDenyOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml2.PermitOverridesRuleAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml2.PermitOverridesRuleAlg.algId);
    supportedAlgorithms.add(new PermitOverridesPolicyAlg());
    supportedAlgIds.add(PermitOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml2.OrderedPermitOverridesRuleAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml2.OrderedPermitOverridesRuleAlg.algId);
    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml2.OrderedPermitOverridesPolicyAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml2.OrderedPermitOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new FirstApplicableRuleAlg());
    supportedAlgIds.add(FirstApplicableRuleAlg.algId);
    supportedAlgorithms.add(new FirstApplicablePolicyAlg());
    supportedAlgIds.add(FirstApplicablePolicyAlg.algId);

    supportedAlgorithms.add(new OnlyOneApplicablePolicyAlg());
    supportedAlgIds.add(OnlyOneApplicablePolicyAlg.algId);

    // XACML 3.0

    supportedAlgorithms.add(new DenyUnlessPermitRuleAlg());
    supportedAlgIds.add(DenyUnlessPermitRuleAlg.algId);
    supportedAlgorithms.add(new DenyUnlessPermitPolicyAlg());
    supportedAlgIds.add(DenyUnlessPermitPolicyAlg.algId);

    supportedAlgorithms.add(new PermitUnlessDenyRuleAlg());
    supportedAlgIds.add(PermitUnlessDenyRuleAlg.algId);
    supportedAlgorithms.add(new PermitUnlessDenyPolicyAlg());
    supportedAlgIds.add(PermitUnlessDenyPolicyAlg.algId);

    supportedAlgorithms.add(new DenyOverridesRuleAlg());
    supportedAlgIds.add(DenyOverridesRuleAlg.algId);
    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml3.DenyOverridesPolicyAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml3.DenyOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml3.OrderedDenyOverridesRuleAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml3.OrderedDenyOverridesRuleAlg.algId);
    supportedAlgorithms.add(new OrderedDenyOverridesPolicyAlg());
    supportedAlgIds.add(OrderedDenyOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new PermitOverridesRuleAlg());
    supportedAlgIds.add(PermitOverridesRuleAlg.algId);
    supportedAlgorithms.add(new com.connexta.arbitro.combine.xacml3.PermitOverridesPolicyAlg());
    supportedAlgIds.add(com.connexta.arbitro.combine.xacml3.PermitOverridesPolicyAlg.algId);

    supportedAlgorithms.add(new OrderedPermitOverridesRuleAlg());
    supportedAlgIds.add(OrderedPermitOverridesRuleAlg.algId);
    supportedAlgorithms.add(new OrderedPermitOverridesPolicyAlg());
    supportedAlgIds.add(OrderedPermitOverridesPolicyAlg.algId);

    supportedAlgIds = Collections.unmodifiableSet(supportedAlgIds);
}

From source file:org.web4thejob.web.panel.DefaultMenuAuthorizationPanel.java

@Override
public Set<CommandEnum> getSupportedCommands() {
    Set<CommandEnum> supported = new HashSet<CommandEnum>(super.getSupportedCommands());
    supported.add(CommandEnum.ADD);//from   ww  w. ja v  a 2s  .  c om
    supported.add(CommandEnum.EDIT);
    supported.add(CommandEnum.REMOVE);
    supported.add(CommandEnum.MOVE_LEFT);
    supported.add(CommandEnum.MOVE_UP);
    supported.add(CommandEnum.MOVE_DOWN);
    return Collections.unmodifiableSet(supported);
}

From source file:org.apache.nifi.processors.att.m2x.GetM2XStream.java

@Override
protected void init(final ProcessorInitializationContext context) {
    super.init(context);

    final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
    descriptors.add(M2X_DEVICE_ID);/*from w  w  w  .jav a  2s.  c  o  m*/
    descriptors.add(M2X_STREAM_NAME);
    descriptors.add(START_TIME_AGO);
    descriptors.addAll(super.getSupportedPropertyDescriptors());
    this.descriptors = Collections.unmodifiableList(descriptors);

    final Set<Relationship> relationships = new HashSet<Relationship>();
    relationships.addAll(super.getRelationships());
    this.relationships = Collections.unmodifiableSet(relationships);
}

From source file:de.ks.flatadocdb.metamodel.EntityDescriptor.java

public EntityDescriptor(Builder b) {
    this.entityClass = b.entityClass;
    this.persister = b.persister;
    this.idGetterAccess = b.idGetterAccess;
    this.idSetterAccess = b.idSetterAccess;
    this.pathInRepoGetterAccess = b.pathInRepoGetterAccess;
    this.pathInRepoSetterAccess = b.pathInRepoSetterAccess;
    this.naturalIdFieldAccess = b.naturalIdFieldAccess;
    this.versionGetterAccess = b.versionGetterAccess;
    this.versionSetterAccess = b.versionSetterAccess;
    this.lifecycleMethods = Collections.unmodifiableMap(b.lifecycleMethods);
    this.propertyPersisters = Collections.unmodifiableMap(b.propertyPersisters);
    this.toOneRelations = Collections.unmodifiableSet(b.toOneRelations);
    this.toManyRelations = Collections.unmodifiableSet(b.toManyRelations);
    this.toOneChildRelations = Collections.unmodifiableSet(b.toOneChildRelations);
    this.toManyChildRelations = Collections.unmodifiableSet(b.toManyChildRelations);
    this.folderGenerator = b.folderGenerator;
    this.fileGenerator = b.fileGenerator;
    this.luceneExtractor = b.extractor;
    this.queries = Collections.unmodifiableSet(b.queries);

    HashSet<Relation> allRels = new HashSet<>();
    allRels.addAll(toManyChildRelations);
    allRels.addAll(toManyRelations);/*from ww w .  j a  v a 2s  .  c  o  m*/
    allRels.addAll(toOneChildRelations);
    allRels.addAll(toOneRelations);
    this.allRelations = Collections.unmodifiableSet(allRels);

    HashSet<Relation> childRelations = new HashSet<>();
    childRelations.addAll(toManyChildRelations);
    childRelations.addAll(toOneChildRelations);
    this.childRelations = Collections.unmodifiableSet(childRelations);

    HashSet<Relation> normalRelations = new HashSet<>();
    normalRelations.addAll(toManyRelations);
    normalRelations.addAll(toOneRelations);
    this.normalRelations = Collections.unmodifiableSet(normalRelations);
}

From source file:com.opengamma.bbg.loader.BloombergHistoricalLoader.java

/**
 * Gets the dataProviders field.//from w w w.  j ava 2  s. co m
 * @return the dataProviders
 */
public Set<String> getDataProviders() {
    return Collections.unmodifiableSet(_dataProviders);
}

From source file:io.coala.guice.GuiceBinder.java

@Override
public Set<Class<?>> getBindings() {
    final Set<Class<?>> result = new HashSet<>(this.lazyInstaller.available.keySet());
    if (getInjector() != null)
        for (Key<?> key : getInjector().getBindings().keySet())
            result.add(key.getTypeLiteral().getRawType());
    return Collections.unmodifiableSet(result);
}