Exemple #1
0
 private static void init() {
   languageCodes = new HashMap<Standard, List<String>>();
   List<String> temp = extractLanguageCodes(LANG_CODES_ISO_639_1_TXT_FILE);
   languageCodes.put(Standard.ISO_639_1, Collections.unmodifiableList(temp));
   temp = extractLanguageCodes(LANG_CODES_ISO_639_3_TXT_FILE);
   languageCodes.put(Standard.ISO_639_3, Collections.unmodifiableList(temp));
 }
Exemple #2
0
  public List<DeviceOutputSetting> getOutputSettings() {
    if (this.outputSettings == null || this.outputSettings.isEmpty()) {
      return Collections.unmodifiableList(this.createDefaultConfiguration());
    }

    return Collections.unmodifiableList(this.outputSettings);
  }
 @Override
 public List<Scenario> getScenarios() {
   if (DtVersionDetector.isAPM()) {
     return Collections.unmodifiableList(getScenarios(InstallationType.APM));
   }
   return Collections.unmodifiableList(getScenarios(InstallationType.Classic));
 }
 public GroupRules(String groupName) {
   mGroupName = groupName;
   mFilterRules = new ArrayList();
   mReadOnlyFilterRules = Collections.unmodifiableList(mFilterRules);
   mConditionRules = new ArrayList();
   mReadOnlyConditionRules = Collections.unmodifiableList(mConditionRules);
 }
 DataDeleteRequest(
     int i,
     long l,
     long l1,
     List list,
     List list1,
     List list2,
     boolean flag,
     boolean flag1,
     IBinder ibinder,
     String s) {
   mVersionCode = i;
   zzMS = l;
   zzann = l1;
   zzapG = Collections.unmodifiableList(list);
   zzanw = Collections.unmodifiableList(list1);
   zzapH = list2;
   zzapI = flag;
   zzapJ = flag1;
   if (ibinder == null) {
     list = null;
   } else {
     list = com.google.android.gms.internal.zznh.zza.zzbJ(ibinder);
   }
   zzapE = list;
   zzOZ = s;
 }
    @Override
    public void routeInputSourceTaskFailedEventToDestination(
        int sourceTaskIndex, Map<Integer, List<Integer>> destinationTaskAndInputIndices) {
      if (remainderRangeForLastShuffler < basePartitionRange) {
        int startOffset = sourceTaskIndex * basePartitionRange;
        List<Integer> allIndices = Lists.newArrayListWithCapacity(basePartitionRange);
        for (int i = 0; i < basePartitionRange; ++i) {
          allIndices.add(startOffset + i);
        }
        List<Integer> inputIndices = Collections.unmodifiableList(allIndices);
        for (int i = 0; i < numDestinationTasks - 1; ++i) {
          destinationTaskAndInputIndices.put(i, inputIndices);
        }

        startOffset = sourceTaskIndex * remainderRangeForLastShuffler;
        allIndices = Lists.newArrayListWithCapacity(remainderRangeForLastShuffler);
        for (int i = 0; i < remainderRangeForLastShuffler; ++i) {
          allIndices.add(startOffset + i);
        }
        inputIndices = Collections.unmodifiableList(allIndices);
        destinationTaskAndInputIndices.put(numDestinationTasks - 1, inputIndices);
      } else {
        // all tasks have same pattern
        int startOffset = sourceTaskIndex * basePartitionRange;
        List<Integer> allIndices = Lists.newArrayListWithCapacity(basePartitionRange);
        for (int i = 0; i < basePartitionRange; ++i) {
          allIndices.add(startOffset + i);
        }
        List<Integer> inputIndices = Collections.unmodifiableList(allIndices);
        for (int i = 0; i < numDestinationTasks; ++i) {
          destinationTaskAndInputIndices.put(i, inputIndices);
        }
      }
    }
    public Connecting next(RoadGui.ViaConnector via) {
      if (vias.isEmpty()) {
        return new Connecting(lane, Collections.unmodifiableList(Arrays.asList(via)));
      }

      final List<RoadGui.ViaConnector> tmp = new ArrayList<>(vias.size() + 1);
      final boolean even = (vias.size() & 1) == 0;
      final RoadGui.ViaConnector last = vias.get(vias.size() - 1);

      if (last.equals(via)
          || !even && last.getRoadEnd().getJunction().equals(via.getRoadEnd().getJunction())) {
        return pop().next(via);
      }

      if (vias.size() >= 2) {
        if (lane.getOutgoingJunction().equals(via.getRoadEnd().getJunction())) {
          return new Connecting(lane);
        } else if (via.equals(getBacktrackViaConnector())) {
          return new Connecting(lane, vias.subList(0, vias.size() - 1));
        }
      }

      for (RoadGui.ViaConnector v : vias) {
        tmp.add(v);

        if (!(even && v.equals(last))
            && v.getRoadEnd().getJunction().equals(via.getRoadEnd().getJunction())) {
          return new Connecting(lane, Collections.unmodifiableList(tmp));
        }
      }

      tmp.add(via);
      return new Connecting(lane, Collections.unmodifiableList(tmp));
    }
  public static <E> Collection<List<E>> selectExactly(List<E> original, int nb) {
    if (nb < 0) {
      throw new IllegalArgumentException();
    }
    if (nb == 0) {
      return Collections.emptyList();
    }
    if (nb == 1) {
      final List<List<E>> result = new ArrayList<List<E>>();
      for (E element : original) {
        result.add(Collections.singletonList(element));
      }
      return result;
    }
    if (nb > original.size()) {
      return Collections.emptyList();
    }
    if (nb == original.size()) {
      return Collections.singletonList(original);
    }
    final List<List<E>> result = new ArrayList<List<E>>();

    for (List<E> subList : selectExactly(original.subList(1, original.size()), nb - 1)) {
      final List<E> newList = new ArrayList<E>();
      newList.add(original.get(0));
      newList.addAll(subList);
      result.add(Collections.unmodifiableList(newList));
    }
    result.addAll(selectExactly(original.subList(1, original.size()), nb));

    return Collections.unmodifiableList(result);
  }
 public List<? extends TypeMirror> getParameterTypes() {
   MethodBinding binding = (MethodBinding) this._binding;
   TypeBinding[] parameters = binding.parameters;
   int length = parameters.length;
   boolean isEnumConstructor =
       binding.isConstructor()
           && binding.declaringClass.isEnum()
           && binding.declaringClass.isBinaryBinding()
           && ((binding.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0);
   if (isEnumConstructor) {
     if (length == 2) {
       return Collections.emptyList();
     }
     ArrayList<TypeMirror> list = new ArrayList<TypeMirror>();
     for (int i = 2; i < length; i++) {
       list.add(_env.getFactory().newTypeMirror(parameters[i]));
     }
     return Collections.unmodifiableList(list);
   }
   if (length != 0) {
     ArrayList<TypeMirror> list = new ArrayList<TypeMirror>();
     for (TypeBinding typeBinding : parameters) {
       list.add(_env.getFactory().newTypeMirror(typeBinding));
     }
     return Collections.unmodifiableList(list);
   }
   return Collections.emptyList();
 }
Exemple #10
0
  public News(
      int timestamp,
      @Nullable Bells bells,
      @Nullable List<Timetable> timetables,
      @Nullable List<LuckyNumber> luckyNumbers,
      @Nullable List<Replacements> replacements) {

    this.timestamp = timestamp;

    this.bells = bells;

    if (timetables == null) {
      this.timetables = Collections.emptyList();
    } else {
      this.timetables = Collections.unmodifiableList(new ArrayList<>(timetables));
    }

    if (luckyNumbers == null) {
      this.luckyNumbers = Collections.emptyList();
    } else {
      this.luckyNumbers = Collections.unmodifiableList(new ArrayList<>(luckyNumbers));
    }

    if (replacements == null) {
      this.replacements = Collections.emptyList();
    } else {
      this.replacements = Collections.unmodifiableList(new ArrayList<>(replacements));
    }
  }
Exemple #11
0
 private void load() throws FileNotFoundException {
   if (files == null && subdirs == null) {
     if (!directory.exists() || !directory.isDirectory()) {
       files = new ArrayList<File>();
       subdirs = new ArrayList<Directory>();
       return;
     }
     File[] listFiles = directory.listFiles(fileFilter);
     if (listFiles == null)
       throw new FileNotFoundException("Invalid directory name: '" + directory.getPath() + "'");
     files = Collections.unmodifiableList(Arrays.asList(listFiles));
     File[] subdirList = directory.listFiles(DIRECTORY_FILTER);
     subdirs = new ArrayList<Directory>();
     for (int i = 0; i < subdirList.length; i++) {
       Directory newDir = newDirectory(subdirList[i], fileFilter);
       newDir.parent = this;
       subdirs.add(newDir);
     }
     Collections.sort(
         subdirs,
         new Comparator<Directory>() {
           public int compare(Directory d1, Directory d2) {
             String name1 = d1.getPath().getName();
             String name2 = d2.getPath().getName();
             return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
           }
         });
     subdirs = Collections.unmodifiableList(subdirs);
   }
 }
Exemple #12
0
  /**
   * Utility method used in the construction of {@link UnitGraph}s, to be called only after the
   * unitToPreds and unitToSuccs maps have been built.
   *
   * <p><code>UnitGraph</code> provides an implementation of <code>buildHeadsAndTails()</code> which
   * defines the graph's set of heads to include the first {@link Unit} in the graph's body,
   * together with any other <tt>Unit</tt> which has no predecessors. It defines the graph's set of
   * tails to include all <tt>Unit</tt>s with no successors. Subclasses of <code>UnitGraph</code>
   * may override this method to change the criteria for classifying a node as a head or tail.
   */
  protected void buildHeadsAndTails() {
    List tailList = new ArrayList();
    List headList = new ArrayList();

    for (Iterator unitIt = unitChain.iterator(); unitIt.hasNext(); ) {
      Unit s = (Unit) unitIt.next();
      List succs = (List) unitToSuccs.get(s);
      if (succs.size() == 0) {
        tailList.add(s);
      }
      List preds = (List) unitToPreds.get(s);
      if (preds.size() == 0) {
        headList.add(s);
      }
    }

    // Add the first Unit, even if it is the target of
    // a branch.
    Unit entryPoint = (Unit) unitChain.getFirst();
    if (!headList.contains(entryPoint)) {
      headList.add(entryPoint);
    }

    tails = Collections.unmodifiableList(tailList);
    heads = Collections.unmodifiableList(headList);
  }
 /**
  * Return an immutable copy of the native ads currently rendered in this view.
  *
  * @return Copy of current set of native ads.
  */
 public List<AppLovinNativeAd> getNativeAds() {
   if (nativeAds != null) {
     return Collections.unmodifiableList(nativeAds);
   } else {
     return Collections.unmodifiableList(new ArrayList<AppLovinNativeAd>(0));
   }
 }
 public TemplateFile(
     NamespaceDeclaration namespace,
     List<AliasDeclaration> aliases,
     List<TemplateDeclaration> templates) {
   this.namespace = namespace;
   this.aliases = aliases;
   if (namespace != null && templates != null) {
     List<TemplateDeclaration> buffer = new LinkedList<TemplateDeclaration>(templates);
     for (ListIterator<TemplateDeclaration> iter = templates.listIterator(); iter.hasNext(); ) {
       TemplateDeclaration t = iter.next();
       BeginTemplateTag btt = t.getBeginTag();
       iter.set(
           new TemplateDeclaration(
               t.getTemplateDocComment(),
               new ContentTagPair(
                   new BeginTemplateTag(btt.getName(), namespace, btt.getAttributes()),
                   t.getEndTag(),
                   t.getContents())));
     }
     this.templates = Collections.unmodifiableList(buffer);
   } else if (templates != null) {
     this.templates = Collections.unmodifiableList(templates);
   } else {
     this.templates = Collections.emptyList();
   }
 }
  /**
   * Returns an immutable map containing each field to its list of values. The status line is mapped
   * to null.
   */
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 13:02:32.340 -0500",
      hash_original_method = "08275C5AA7086D8C8C86CDE1903B0FA3",
      hash_generated_method = "46EAB98AB1F752B052993E5E77B9B081")
  public Map<String, List<String>> toMultimap() {
    Map<String, List<String>> result = new TreeMap<String, List<String>>(FIELD_NAME_COMPARATOR);
    for (int i = 0; i < namesAndValues.size(); i += 2) {
      String fieldName = namesAndValues.get(i);
      String value = namesAndValues.get(i + 1);

      List<String> allValues = new ArrayList<String>();
      List<String> otherValues = result.get(fieldName);
      if (otherValues != null) {
        allValues.addAll(otherValues);
      }
      allValues.add(value);
      result.put(fieldName, Collections.unmodifiableList(allValues));
    }
    if (statusLine != null) {
      result.put(null, Collections.unmodifiableList(Collections.singletonList(statusLine)));
    }
    return Collections.unmodifiableMap(result);
  }
  /**
   * Creates a new instance.
   *
   * @param flowGraph the flow-graph which represents this flow-part structure
   * @param parameters the parameters for this flow-part
   * @throws IllegalArgumentException if some parameters were {@code null}
   * @since 0.5.0
   */
  public FlowPartDescription(FlowGraph flowGraph, List<? extends Parameter> parameters) {
    if (flowGraph == null) {
      throw new IllegalArgumentException("flowGraph must not be null"); // $NON-NLS-1$
    }
    if (parameters == null) {
      throw new IllegalArgumentException("parameters must not be null"); // $NON-NLS-1$
    }
    this.flowGraph = flowGraph;
    List<FlowElementPortDescription> inputs = new ArrayList<FlowElementPortDescription>();
    List<FlowElementPortDescription> outputs = new ArrayList<FlowElementPortDescription>();
    this.inputPorts = Collections.unmodifiableList(inputs);
    this.outputPorts = Collections.unmodifiableList(outputs);
    this.parameters = Collections.unmodifiableList(new ArrayList<Parameter>(parameters));

    for (FlowIn<?> in : flowGraph.getFlowInputs()) {
      inputs.add(
          new FlowElementPortDescription(
              in.getDescription().getName(),
              in.getDescription().getDataType(),
              PortDirection.INPUT));
    }
    for (FlowOut<?> out : flowGraph.getFlowOutputs()) {
      outputs.add(
          new FlowElementPortDescription(
              out.getDescription().getName(),
              out.getDescription().getDataType(),
              PortDirection.OUTPUT));
    }
  }
 public <T extends Object, U extends Object> Iterable<T> select(
     final AbstractNodeMappingCall<T, U> nodeMappingCall, final U domainArgument) {
   boolean _equals = Objects.equal(domainArgument, null);
   if (_equals) {
     return Collections.<T>unmodifiableList(CollectionLiterals.<T>newArrayList());
   }
   if ((nodeMappingCall instanceof NodeMappingCall<?, ?>)) {
     final NodeMappingCall<T, U> nodeMappingCallCasted = ((NodeMappingCall<T, U>) nodeMappingCall);
     Function1<? super U, ? extends T> _selector = nodeMappingCallCasted.getSelector();
     final T nodeObject =
         ((Function1<? super Object, ? extends T>)
                 ((Function1<? super Object, ? extends T>) _selector))
             .apply(domainArgument);
     boolean _equals_1 = Objects.equal(nodeObject, null);
     if (_equals_1) {
       return Collections.<T>unmodifiableList(CollectionLiterals.<T>newArrayList());
     } else {
       return Collections.<T>unmodifiableList(CollectionLiterals.<T>newArrayList(nodeObject));
     }
   } else {
     if ((nodeMappingCall instanceof MultiNodeMappingCall<?, ?>)) {
       final MultiNodeMappingCall<T, U> nodeMappingCallCasted_1 =
           ((MultiNodeMappingCall<T, U>) nodeMappingCall);
       Function1<? super U, ? extends Iterable<? extends T>> _selector_1 =
           nodeMappingCallCasted_1.getSelector();
       Iterable<T> _apply =
           ((Function1<? super Object, ? extends Iterable<T>>)
                   ((Function1<? super Object, ? extends Iterable<T>>) _selector_1))
               .apply(domainArgument);
       return IterableExtensions.<T>filterNull(_apply);
     }
   }
   return null;
 }
  public static void main(String[] args) {
    final String awsAccessKey = "accessKey";
    final String awsSecretKey = "secrect access key";
    List<String> items =
        Collections.unmodifiableList(Arrays.asList("i-6070edb9", "i-4d821d94", "i-06811edf"));
    List<String> metricOption =
        Collections.unmodifiableList(
            Arrays.asList(
                "CPUUtilization",
                "NetworkIn",
                "NetworkOut",
                "DiskReadBytes",
                "DiskReadOps",
                "DiskWriteOps",
                "DiskWriteBytes"));

    final AmazonCloudWatchClient client = client(awsAccessKey, awsSecretKey);
    for (String temp : items) {
      for (String options : metricOption) {
        final GetMetricStatisticsRequest request = request(temp, options);
        final GetMetricStatisticsResult result = result(client, request);
        toStdOut(result, temp, options);
      }
    }
  }
Exemple #19
0
 protected Device(Builder b) {
   mName = b.mName;
   mManufacturer = b.mManufacturer;
   mSoftware = Collections.unmodifiableList(b.mSoftware);
   mState = Collections.unmodifiableList(b.mState);
   mMeta = b.mMeta;
   mDefaultState = b.mDefaultState;
 }
 public org.apache.ibatis.mapping.ResultMapping build() {
   // lock down collections
   resultMapping.flags = Collections.unmodifiableList(resultMapping.flags);
   resultMapping.composites = Collections.unmodifiableList(resultMapping.composites);
   resolveTypeHandler();
   validate();
   return resultMapping;
 }
Exemple #21
0
  public static List<ErrorLogger.ErrorObject> conformVirtualTracksInCPL(
      PayloadRecord cplPayloadRecord,
      List<PayloadRecord> essencesHeaderPartitionPayloads,
      boolean conformAllVirtualTracks)
      throws IOException {

    IMFErrorLogger imfErrorLogger = new IMFErrorLoggerImpl();
    List<PayloadRecord> essencesHeaderPartition =
        Collections.unmodifiableList(essencesHeaderPartitionPayloads);

    try {
      imfErrorLogger.addAllErrors(validateCPL(cplPayloadRecord));
      if (imfErrorLogger.hasFatalErrors())
        return Collections.unmodifiableList(imfErrorLogger.getErrors());

      Composition composition =
          new Composition(new ByteArrayByteRangeProvider(cplPayloadRecord.getPayload()));

      imfErrorLogger.addAllErrors(validateIMFTrackFileHeaderMetadata(essencesHeaderPartition));

      List<HeaderPartitionTuple> headerPartitionTuples = new ArrayList<>();
      for (PayloadRecord payloadRecord : essencesHeaderPartition) {
        if (payloadRecord.getPayloadAssetType()
            != PayloadRecord.PayloadAssetType.EssencePartition) {
          imfErrorLogger.addError(
              IMFErrorLogger.IMFErrors.ErrorCodes.IMF_MASTER_PACKAGE_ERROR,
              IMFErrorLogger.IMFErrors.ErrorLevels.FATAL,
              String.format(
                  "Payload asset type is %s, expected asset type %s",
                  payloadRecord.getPayloadAssetType(),
                  PayloadRecord.PayloadAssetType.EssencePartition.toString()));
          continue;
        }
        headerPartitionTuples.add(
            new HeaderPartitionTuple(
                new HeaderPartition(
                    new ByteArrayDataProvider(payloadRecord.getPayload()),
                    0L,
                    (long) payloadRecord.getPayload().length,
                    imfErrorLogger),
                new ByteArrayByteRangeProvider(payloadRecord.getPayload())));
      }

      if (imfErrorLogger.hasFatalErrors()) {
        return imfErrorLogger.getErrors();
      }

      imfErrorLogger.addAllErrors(
          composition.conformVirtualTracksInComposition(
              Collections.unmodifiableList(headerPartitionTuples), conformAllVirtualTracks));

      imfErrorLogger.addAllErrors(composition.getErrors());
    } catch (IMFException e) {
      imfErrorLogger.addAllErrors(e.getErrors());
    }

    return imfErrorLogger.getErrors();
  }
  RangerPolicyRepository(ServicePolicies servicePolicies, RangerPolicyEngineOptions options) {
    super();

    serviceName = servicePolicies.getServiceName();
    serviceDef = servicePolicies.getServiceDef();
    policies = Collections.unmodifiableList(servicePolicies.getPolicies());
    policyVersion =
        servicePolicies.getPolicyVersion() != null
            ? servicePolicies.getPolicyVersion().longValue()
            : -1;

    List<RangerContextEnricher> contextEnrichers = new ArrayList<RangerContextEnricher>();
    if (!options.disableContextEnrichers
        && !CollectionUtils.isEmpty(serviceDef.getContextEnrichers())) {
      for (RangerServiceDef.RangerContextEnricherDef enricherDef :
          serviceDef.getContextEnrichers()) {
        if (enricherDef == null) {
          continue;
        }

        RangerContextEnricher contextEnricher = buildContextEnricher(enricherDef);

        if (contextEnricher != null) {
          contextEnrichers.add(contextEnricher);
        }
      }
    }
    this.contextEnrichers = Collections.unmodifiableList(contextEnrichers);

    List<RangerPolicyEvaluator> policyEvaluators = new ArrayList<RangerPolicyEvaluator>();
    for (RangerPolicy policy : servicePolicies.getPolicies()) {
      if (!policy.getIsEnabled()) {
        continue;
      }

      RangerPolicyEvaluator evaluator = buildPolicyEvaluator(policy, serviceDef, options);

      if (evaluator != null) {
        policyEvaluators.add(evaluator);
      }
    }
    Collections.sort(policyEvaluators);
    this.policyEvaluators = Collections.unmodifiableList(policyEvaluators);

    String propertyName = "ranger.plugin." + serviceName + ".policyengine.auditcachesize";

    if (options.cacheAuditResults) {
      int auditResultCacheSize =
          RangerConfiguration.getInstance()
              .getInt(propertyName, RANGER_POLICYENGINE_AUDITRESULT_CACHE_SIZE);

      accessAuditCache =
          Collections.synchronizedMap(new CacheMap<String, Boolean>(auditResultCacheSize));
    } else {
      accessAuditCache = null;
    }
  }
 public IndexService(
     IndexSettings indexSettings,
     NodeEnvironment nodeEnv,
     SimilarityService similarityService,
     ShardStoreDeleter shardStoreDeleter,
     AnalysisRegistry registry,
     @Nullable EngineFactory engineFactory,
     NodeServicesProvider nodeServicesProvider,
     QueryCache queryCache,
     IndexStore indexStore,
     IndexEventListener eventListener,
     IndexModule.IndexSearcherWrapperFactory wrapperFactory,
     MapperRegistry mapperRegistry,
     IndicesFieldDataCache indicesFieldDataCache,
     List<SearchOperationListener> searchOperationListeners,
     List<IndexingOperationListener> indexingOperationListeners)
     throws IOException {
   super(indexSettings);
   this.indexSettings = indexSettings;
   this.analysisService = registry.build(indexSettings);
   this.similarityService = similarityService;
   this.mapperService =
       new MapperService(
           indexSettings,
           analysisService,
           similarityService,
           mapperRegistry,
           IndexService.this::newQueryShardContext);
   this.indexFieldData =
       new IndexFieldDataService(
           indexSettings,
           indicesFieldDataCache,
           nodeServicesProvider.getCircuitBreakerService(),
           mapperService);
   this.shardStoreDeleter = shardStoreDeleter;
   this.bigArrays = nodeServicesProvider.getBigArrays();
   this.threadPool = nodeServicesProvider.getThreadPool();
   this.eventListener = eventListener;
   this.nodeEnv = nodeEnv;
   this.nodeServicesProvider = nodeServicesProvider;
   this.indexStore = indexStore;
   indexFieldData.setListener(new FieldDataCacheListener(this));
   this.bitsetFilterCache = new BitsetFilterCache(indexSettings, new BitsetCacheListener(this));
   this.warmer =
       new IndexWarmer(
           indexSettings.getSettings(), threadPool, bitsetFilterCache.createListener(threadPool));
   this.indexCache = new IndexCache(indexSettings, queryCache, bitsetFilterCache);
   this.engineFactory = engineFactory;
   // initialize this last -- otherwise if the wrapper requires any other member to be non-null we
   // fail with an NPE
   this.searcherWrapper = wrapperFactory.newWrapper(this);
   this.indexingOperationListeners = Collections.unmodifiableList(indexingOperationListeners);
   this.searchOperationListeners = Collections.unmodifiableList(searchOperationListeners);
   // kick off async ops for the first shard in this index
   this.refreshTask = new AsyncRefreshTask(this);
   rescheduleFsyncTask(indexSettings.getTranslogDurability());
 }
  // used by the constructors.
  private void parseElement(Element element) throws SAML2Exception {
    // make sure that the input xml block is not null
    if (element == null) {
      if (SAML2SDKUtils.debug.messageEnabled()) {
        SAML2SDKUtils.debug.message("AttributeStatementImpl." + "parseElement: Input is null.");
      }
      throw new SAML2Exception(SAML2SDKUtils.bundle.getString("nullInput"));
    }
    // Make sure this is an AttributeStatement.
    if (!SAML2SDKUtils.checkStatement(element, "AttributeStatement")) {
      if (SAML2SDKUtils.debug.messageEnabled()) {
        SAML2SDKUtils.debug.message(
            "AttributeStatementImpl." + "parseElement: not AttributeStatement.");
      }
      throw new SAML2Exception(SAML2SDKUtils.bundle.getString("wrongInput"));
    }

    // handle the sub elementsof the AuthnStatment
    NodeList nl = element.getChildNodes();
    Node child;
    String childName;
    int length = nl.getLength();
    for (int i = 0; i < length; i++) {
      child = nl.item(i);
      if ((childName = child.getLocalName()) != null) {
        if (childName.equals("Attribute")) {
          Attribute attr = AssertionFactory.getInstance().createAttribute((Element) child);
          if (attrs == null) {
            attrs = new ArrayList();
          }
          attrs.add(attr);
        } else if (childName.equals("EncryptedAttribute")) {
          EncryptedAttribute encAttr =
              AssertionFactory.getInstance().createEncryptedAttribute((Element) child);
          if (encAttrs == null) {
            encAttrs = new ArrayList();
          }
          encAttrs.add(encAttr);
        } else {
          if (SAML2SDKUtils.debug.messageEnabled()) {
            SAML2SDKUtils.debug.message(
                "AttributeStatementImpl." + "parse Element: Invalid element:" + childName);
          }
          throw new SAML2Exception(SAML2SDKUtils.bundle.getString("invalidElement"));
        }
      }
    }
    validateData();
    if (attrs != null) {
      attrs = Collections.unmodifiableList(attrs);
    }
    if (encAttrs != null) {
      encAttrs = Collections.unmodifiableList(encAttrs);
    }
    mutable = false;
  }
Exemple #25
0
  /**
   * Effect
   *
   * @return effect
   */
  public List<List<Double>> getEffect() {
    if (effect == null) {
      effect = new ArrayList<>();
      for (final List<Double> e : data.getEffect()) {
        effect.add(Collections.unmodifiableList(e));
      }
    }

    return Collections.unmodifiableList(effect);
  }
 /* (non-Javadoc)
  * @see org.esorm.LazyManagedEntityConfiguration#setManager(org.esorm.EntityManager)
  */
 public void setManager(EntityManager manager) {
   checkNotFixed();
   setProperties(Collections.unmodifiableList(getProperties()));
   for (Entry<FromExpression, List<Column>> e : getIdColumns().entrySet()) {
     e.setValue(Collections.unmodifiableList(e.getValue()));
   }
   setIdColumns(Collections.unmodifiableMap(getIdColumns()));
   super.setManager(manager);
   fixed = true;
 }
Exemple #27
0
  @Commit
  @SuppressWarnings("unused")
  private void afterDeserialization() throws Exception {
    if (otherAttributesForSerialization != null) {
      attributes.putAll(SimpleXmlWrappers.unwrap(otherAttributesForSerialization));
    }

    phrasesView = Collections.unmodifiableList(phrases);
    subclustersView = Collections.unmodifiableList(subclusters);
    // Documents will be restored on the ProcessingResult level
  }
 public DOMReference(
     String uri,
     String type,
     DigestMethod dm,
     List appliedTransforms,
     Data result,
     List transforms,
     String id,
     byte[] digestValue) {
   if (dm == null) {
     throw new NullPointerException("DigestMethod must be non-null");
   }
   if (appliedTransforms == null || appliedTransforms.isEmpty()) {
     this.appliedTransforms = Collections.EMPTY_LIST;
   } else {
     List transformsCopy = new ArrayList(appliedTransforms);
     for (int i = 0, size = transformsCopy.size(); i < size; i++) {
       if (!(transformsCopy.get(i) instanceof Transform)) {
         throw new ClassCastException("appliedTransforms[" + i + "] is not a valid type");
       }
     }
     this.appliedTransforms = Collections.unmodifiableList(transformsCopy);
   }
   if (transforms == null || transforms.isEmpty()) {
     this.transforms = Collections.EMPTY_LIST;
   } else {
     List transformsCopy = new ArrayList(transforms);
     for (int i = 0, size = transformsCopy.size(); i < size; i++) {
       if (!(transformsCopy.get(i) instanceof Transform)) {
         throw new ClassCastException("transforms[" + i + "] is not a valid type");
       }
     }
     this.transforms = Collections.unmodifiableList(transformsCopy);
   }
   List all = new ArrayList(this.appliedTransforms);
   all.addAll(this.transforms);
   this.allTransforms = Collections.unmodifiableList(all);
   this.digestMethod = dm;
   this.uri = uri;
   if ((uri != null) && (!uri.equals(""))) {
     try {
       new URI(uri);
     } catch (URISyntaxException e) {
       throw new IllegalArgumentException(e.getMessage());
     }
   }
   this.type = type;
   this.id = id;
   if (digestValue != null) {
     this.digestValue = (byte[]) digestValue.clone();
     this.digested = true;
   }
   this.appliedTransformData = result;
 }
 /**
  * Creates a new DataTable. This constructor should not be called by Cucumber users - it's used
  * internally only.
  *
  * @param gherkinRows the underlying rows.
  * @param tableConverter how to convert the rows.
  */
 public DataTable(List<DataTableRow> gherkinRows, TableConverter tableConverter) {
   this.gherkinRows = gherkinRows;
   this.tableConverter = tableConverter;
   List<List<String>> raw = new ArrayList<List<String>>();
   for (Row row : gherkinRows) {
     List<String> list = new ArrayList<String>();
     list.addAll(row.getCells());
     raw.add(Collections.unmodifiableList(list));
   }
   this.raw = Collections.unmodifiableList(raw);
 }
Exemple #30
0
  /**
   * Create {@link Extension} with name and parameters.
   *
   * @param name extension name.
   * @param parameters extension parameters.
   */
  public TyrusExtension(String name, List<Parameter> parameters) {
    if (name == null || name.length() == 0) {
      throw new IllegalArgumentException();
    }

    this.name = name;
    if (parameters != null) {
      this.parameters = Collections.unmodifiableList(new ArrayList<Parameter>(parameters));
    } else {
      this.parameters = Collections.unmodifiableList(Collections.<Parameter>emptyList());
    }
  }