/* (non-Javadoc)
@see org.hortonmachine.hmachine.modules.hydrogeomorphology.adige.core.IHillSlope#getUpstreamElementAtPfafstetter(org.hortonmachine.hmachine.modules.network.PfafstetterNumber)
491988
public IHillSlope getUpstreamElementAtPfafstetter( PfafstetterNumber pNum ) {
        // am I the one
        if (pfafstetterNumber.compareTo(pNum) == 0) {
            return this;
        }
        // // perhaps my upstream elements
        // for( UpstreamElement upstreamElement : upstreamElements ) {
        // if (upstreamElement.getPfafstetterNumber().compare(
        // upstreamElement.getPfafstetterNumber(), pNum) == 0) {
        // return upstreamElement;
        // }
        // }
        // digg further
        IHillSlope theChosen = null;
        for( IHillSlope upstreamElement : upstreamElements ) {
            theChosen = upstreamElement.getUpstreamElementAtPfafstetter(pNum);
            if (theChosen != null) {
                break;
            }
        }
        return theChosen;
    }
1170153
@Override
    public BrowseCursor getBrowseCursor(SelectionCriteria criteria) throws SIResourceException, SISelectorSyntaxException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getBrowseCursor", criteria);

        NonLockingCursor msgStoreCur = null;
        MessageSelectorFilter filter = null;
        BrowseCursor cursor = null;
        try
        {
            //if there is a selection criteria then we have to
            //create a MessageStore filter
            if (criteria != null &&
                ((criteria.getSelectorString() != null && !criteria.getSelectorString().equals("")) ||
                (criteria.getDiscriminator() != null && !criteria.getDiscriminator().equals(""))))
            {
                filter = new MessageSelectorFilter(_messageProcessor, criteria);
            }

            //try to get a new browseCursor from the message store
            if (itemStream != null)
                msgStoreCur = itemStream.newNonLockingItemCursor(filter);
            else if (subscriptionItemStream != null)
                msgStoreCur = subscriptionItemStream.newNonLockingCursor(filter);

            cursor = new JSBrowseCursor(msgStoreCur);

        } catch (SISelectorSyntaxException e)
        {
            // shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                        "1:2314:1.280.5.25",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                      "1:2321:1.280.5.25",
                                      e });

            if (cursor != null)
            {
                //try and finish off this bad cursor
                try
                {
                    cursor.finished();
                } catch (SISessionDroppedException e1)
                {
                    //an error trying to close the bad cursor. We swallow this error
                    //and instead throw the exception that caused us to try and close
                    FFDCFilter.processException(
                                                e1,
                                                "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                                "1:2338:1.280.5.25",
                                                this);

                    SibTr.exception(tc, e1);
                    SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                new Object[] {
                                              "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                              "1:2345:1.280.5.25",
                                              SIMPUtils.getStackTrace(e1) });
                }
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "getBrowseCursor", e);
            throw e;
        } catch (Exception e)
        {
            // shouldn't occur so FFDC.
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                        "1:2361:1.280.5.25",
                                        this);

            SibTr.exception(tc, e);
            SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                        new Object[] {
                                      "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                      "1:2368:1.280.5.25",
                                      e });

            if (cursor != null)
            {
                try
                {
                    cursor.finished();
                } catch (SISessionDroppedException e1)
                {
                    FFDCFilter.processException(
                                                e1,
                                                "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                                "1:2382:1.280.5.25",
                                                this);

                    SibTr.exception(tc, e1);
                    SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                new Object[] {
                                              "com.ibm.ws.sib.processor.impl.ConsumerDispatcher.getBrowseCursor",
                                              "1:2389:1.280.5.25",
                                              SIMPUtils.getStackTrace(e1) });
                }
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "getBrowseCursor", e);

            throw new SIResourceException(
                            nls.getFormattedMessage(
                                                    "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                    new Object[] {
                                                                  "com.ibm.ws.sib.processor.impl.ConsumerDispatcher",
                                                                  "1:2402:1.280.5.25",
                                                                  e },
                                                    null),
                            e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getBrowseCursor", cursor);
        //return the cursor or null
        return cursor;
    }
593614
@Override
    public org.fcrepo.server.types.gen.MIMETypedStream getDatastreamDissemination(String pid,
                                                                                  String dsID,
                                                                                  String asOfDateTime) {
        MessageContext ctx = context.getMessageContext();
        Context context = ReadOnlyContext.getSoapContext(ctx);
        assertInitialized();
        try {
            org.fcrepo.server.storage.types.MIMETypedStream mimeTypedStream =
                    m_access.getDatastreamDissemination(context,
                                                        pid,
                                                        dsID,
                                                        DateUtility
                                                                .parseDateOrNull(asOfDateTime));
            org.fcrepo.server.types.gen.MIMETypedStream genMIMETypedStream =
                    TypeUtility
                            .convertMIMETypedStreamToGenMIMETypedStream(mimeTypedStream);
            return genMIMETypedStream;
        } catch (OutOfMemoryError oome) {
            LOG.error("Out of memory error getting " + dsID
                    + " datastream dissemination for " + pid);
            String exceptionText =
                    "The datastream you are attempting to retrieve is too large "
                            + "to transfer via getDatastreamDissemination (as determined "
                            + "by the server memory allocation.) Consider retrieving this "
                            + "datastream via REST at: ";
            String restURL =
                    describeRepository().getRepositoryBaseURL() + "/get/" + pid
                            + "/" + dsID;
            throw CXFUtility.getFault(new Exception(exceptionText + restURL));

        } catch (Throwable th) {
            LOG.error("Error getting datastream dissemination", th);
            throw CXFUtility.getFault(th);
        }
    }
837670
void rfftb(final float a[], final int offa) {
		if (n == 1)
			return;
		int l1, l2, na, nf, ip, iw, ido, idl1;

		final int twon = 2 * n;
		nf = (int) wtable_r[1 + twon];
		na = 0;
		l1 = 1;
		iw = n;
		for (int k1 = 1; k1 <= nf; k1++) {
			ip = (int) wtable_r[k1 + 1 + twon];
			l2 = ip * l1;
			ido = n / l2;
			idl1 = ido * l1;
			switch (ip) {
				case 2:
					if (na == 0) {
						radb2(ido, l1, a, offa, ch, 0, iw);
					} else {
						radb2(ido, l1, ch, 0, a, offa, iw);
					}
					na = 1 - na;
					break;
				case 3:
					if (na == 0) {
						radb3(ido, l1, a, offa, ch, 0, iw);
					} else {
						radb3(ido, l1, ch, 0, a, offa, iw);
					}
					na = 1 - na;
					break;
				case 4:
					if (na == 0) {
						radb4(ido, l1, a, offa, ch, 0, iw);
					} else {
						radb4(ido, l1, ch, 0, a, offa, iw);
					}
					na = 1 - na;
					break;
				case 5:
					if (na == 0) {
						radb5(ido, l1, a, offa, ch, 0, iw);
					} else {
						radb5(ido, l1, ch, 0, a, offa, iw);
					}
					na = 1 - na;
					break;
				default:
					if (na == 0) {
						radbg(ido, ip, l1, idl1, a, offa, ch, 0, iw);
					} else {
						radbg(ido, ip, l1, idl1, ch, 0, a, offa, iw);
					}
					if (ido == 1)
						na = 1 - na;
					break;
			}
			l1 = l2;
			iw += (ip - 1) * ido;
		}
		if (na == 0)
			return;
		System.arraycopy(ch, 0, a, offa, n);
	}
333155
@Override
    public java.util.concurrent.Future<GetShardIteratorResult> getShardIteratorAsync(String streamName, String shardId, String shardIteratorType,
            String startingSequenceNumber) {

        return getShardIteratorAsync(new GetShardIteratorRequest().withStreamName(streamName).withShardId(shardId).withShardIteratorType(shardIteratorType)
                .withStartingSequenceNumber(startingSequenceNumber));
    }
1353006
public void initUpstream()
	{
		for (Conversion conv : getUpstreamConversions(pe.getParticipantOf()))
		{
			ConversionWrapper conW = (ConversionWrapper) graph.getGraphObject(conv);
			if (conW == null) continue;

			if (conv.getConversionDirection() == ConversionDirectionType.REVERSIBLE &&
				conv.getLeft().contains(pe))
			{
				conW = conW.getReverse();
			}
			Edge edge = new EdgeL3(conW, this, graph);
			conW.getDownstreamNoInit().add(edge);
			this.getUpstreamNoInit().add(edge);
		}

		for (Interaction inter : pe.getParticipantOf())
		{
			if (inter instanceof TemplateReaction)
			{
				TemplateReaction tr = (TemplateReaction) inter;
				TemplateReactionWrapper trw = (TemplateReactionWrapper) graph.getGraphObject(tr);
				if (trw == null) continue;

				Edge edge = new EdgeL3(trw, this, graph);

				assert trw.getDownstreamNoInit() != null;

				trw.getDownstreamNoInit().add(edge);
				this.getUpstreamNoInit().add(edge);
			}
		}
	}
1350011
@Override
    public List getForwardRoutingPath()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getForwardRoutingPath");

        // The 'rule' (existing behaviour) is that we only use an FRP if this alias
        // has one, i.e. we don't walk the chain until we find the first FRP we come
        // to. So all we do here is return our FRP (which could be null).

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getForwardRoutingPath", _forwardRoutingPath);

        return _forwardRoutingPath;
    }
856033
@Override
    public final LongStream asLongStream() {
        return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE,
                                                     StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
            @Override
            public Sink<Integer> opWrapSink(int flags, Sink<Long> sink) {
                return new Sink.ChainedInt<Long>(sink) {
                    @Override
                    public void accept(int t) {
                        downstream.accept((long) t);
                    }
                };
            }
        };
    }
1335776
public String getUploadUrlOfAgent(JobIdentifier jobIdentifier, String filePath, int attempt) {
        return format("%s/%s/%s/%s?attempt=%d&buildId=%d", baseRemotingURL, "remoting", "files", jobIdentifier.artifactLocator(filePath), attempt, jobIdentifier.getBuildId());
    }
946161
@Builder(builderClassName = "ProxiedFileSystemFromKeytab", builderMethodName = "fromKeytab")
  private static FileSystem getProxiedFileSystemUsingKeytab(@NonNull final String userNameToProxyAs,
      final String superUserName, final Path superUserKeytabLocation, final URI fsURI, final Configuration conf,
      FileSystem referenceFS) throws IOException, ExecutionException {
    Preconditions.checkNotNull(userNameToProxyAs, "Must provide a user name to proxy as.");
    Preconditions.checkNotNull(superUserName, "Must provide a super user name.");
    Preconditions.checkNotNull(superUserKeytabLocation, "Must provide a keytab location.");
    URI actualURI = resolveUri(fsURI, conf, referenceFS);
    Configuration actualConfiguration = resolveConfiguration(conf, referenceFS);

    return USER_NAME_TO_FILESYSTEM_CACHE.get(getFileSystemKey(actualURI, userNameToProxyAs, referenceFS),
        new CreateProxiedFileSystemFromKeytab(userNameToProxyAs, superUserName, superUserKeytabLocation, actualURI,
            actualConfiguration, referenceFS));
  }
968178
@Override
    public org.fcrepo.server.types.mtom.gen.MIMETypedStream getDissemination(String pid,
                                                                             String serviceDefinitionPid,
                                                                             String methodName,
                                                                             org.fcrepo.server.types.mtom.gen.GetDissemination.Parameters parameters,
                                                                             String asOfDateTime) {
        MessageContext ctx = context.getMessageContext();
        Context context = ReadOnlyContext.getSoapContext(ctx);
        assertInitialized();
        try {
            org.fcrepo.server.storage.types.Property[] properties =
                    TypeUtility
                            .convertGenPropertyArrayToPropertyArray(parameters);
            org.fcrepo.server.storage.types.MIMETypedStream mimeTypedStream =
                    m_access.getDissemination(context,
                                              pid,
                                              serviceDefinitionPid,
                                              methodName,
                                              properties,
                                              DateUtility
                                                      .parseDateOrNull(asOfDateTime));
            org.fcrepo.server.types.mtom.gen.MIMETypedStream genMIMETypedStream =
                    TypeUtility
                            .convertMIMETypedStreamToGenMIMETypedStreamMTOM(mimeTypedStream);
            return genMIMETypedStream;
        } catch (Throwable th) {
            LOG.error("Error getting dissemination", th);
            throw CXFUtility.getFault(th);
        }
    }
46513
private static FactorComparator<Executor> getNumberOfAssignedFlowComparator(final int weight) {
    return FactorComparator
        .create(NUMOFASSIGNEDFLOW_COMPARATOR_NAME, weight, new Comparator<Executor>() {

          @Override
          public int compare(final Executor o1, final Executor o2) {
            final ExecutorInfo stat1 = o1.getExecutorInfo();
            final ExecutorInfo stat2 = o2.getExecutorInfo();

            final Integer result = 0;
            if (statisticsObjectCheck(stat1, stat2, NUMOFASSIGNEDFLOW_COMPARATOR_NAME)) {
              return result;
            }
            return ((Integer) stat1.getRemainingFlowCapacity())
                .compareTo(stat2.getRemainingFlowCapacity());
          }
        });
  }
1110195
@Override
    public long getCountHighWaterMark() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getCountHighWaterMark");

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getCountHighWaterMark", new Long(_nextHighWatermark));
        return _nextHighWatermark;
    }
135860
public JsonElement getActualHighWatermark() {
    if (!contains(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY)) {
      return null;
    }
    return JSON_PARSER.parse(getProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY));
  }
959490
private void bindUpstream(BioPAXElement element)
	{
		AbstractNode node = (AbstractNode) graph.getGraphObject(element);

		if (node != null)
		{
			Edge edge = new EdgeL3(node, this, graph);
			node.getDownstreamNoInit().add(edge);
			this.getUpstreamNoInit().add(edge);
		}
	}
316718
private UploadRequestProcessor getUploadRequestProcessor(TransferContext transferContext) {
        LOGGER.entering(transferContext);
        String contentType = transferContext.getHttpServletRequest().getContentType() != null ? transferContext
                .getHttpServletRequest().getContentType().toLowerCase() : "unknown";
        if (contentType.contains(AbstractUploadRequestProcessor.MULTIPART_CONTENT_TYPE)) {

            // Return a Multipart request processor
            UploadRequestProcessor uploadRequestProcessor = new MultipartUploadRequestProcessor(
                    transferContext);
            LOGGER.exiting(uploadRequestProcessor);
            return uploadRequestProcessor;
        }
        if (contentType.contains(AbstractUploadRequestProcessor.APPLICATION_URLENCODED_CONTENT_TYPE)) {

            // Return normal Urlencoded request processor
            UploadRequestProcessor uploadRequestProcessor = new ApplicationUploadRequestProcessor(
                    transferContext);
            LOGGER.exiting(uploadRequestProcessor);
            return uploadRequestProcessor;
        }
        throw new ArtifactUploadException("Content-Type should be either: "
                + AbstractUploadRequestProcessor.MULTIPART_CONTENT_TYPE + " or: "
                + AbstractUploadRequestProcessor.APPLICATION_URLENCODED_CONTENT_TYPE + " for file uploads");
    }
388833
@SuppressWarnings({ "rawtypes", "unchecked" })
	private IntegrationFlowBuilder getFlowBuilder() {

		IntegrationFlowBuilder flowBuilder;
		URLName urlName = this.properties.getUrl();

		if (this.properties.isIdleImap()) {
			flowBuilder = getIdleImapFlow(urlName);
		}
		else {

			MailInboundChannelAdapterSpec adapterSpec;
			switch (urlName.getProtocol().toUpperCase()) {
				case "IMAP":
				case "IMAPS":
					adapterSpec = getImapFlowBuilder(urlName);
					break;
				case "POP3":
				case "POP3S":
					adapterSpec = getPop3FlowBuilder(urlName);
					break;
				default:
					throw new IllegalArgumentException(
							"Unsupported mail protocol: " + urlName.getProtocol());
			}
			flowBuilder = IntegrationFlows.from(
					adapterSpec.javaMailProperties(getJavaMailProperties(urlName))
							.selectorExpression(this.properties.getExpression())
							.shouldDeleteMessages(this.properties.isDelete()),
					new Consumer<SourcePollingChannelAdapterSpec>() {

						@Override
						public void accept(
								SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) {
							sourcePollingChannelAdapterSpec.poller(MailSourceConfiguration.this.defaultPoller);
						}

					});

		}
		return flowBuilder;
	}