com.ibm.websphere.ras.Tr.entry()

Here are the examples of the java api com.ibm.websphere.ras.Tr.entry() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1301 Examples 7

19 Source : OpentracingUserFeatureAccessService.java
with Eclipse Public License 1.0
from OpenLiberty

// 
/**
 * <p>Answer a tracer instance for a named application.</p>
 *
 * <p>Invoked from {@link io.openliberty.opentracing.internal.OpentracingTracerManager#createTracer(String)}.</p>
 *
 * @param appName The name of the application for which to create the tracer instance.
 *
 * @return The new tracer.
 */
@Trivial
public static Tracer getTracerInstance(String appName) {
    String methodName = "getTracerInstance";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, appName);
    }
    Tracer tracer = null;
    if (opentracingTracerFactory != null) {
        try {
            tracer = opentracingTracerFactory.newInstance(appName);
        } catch (Throwable t) {
            Tr.error(tc, "OPENTRACING_COULD_NOT_CREATE_TRACER", t);
        }
    }
    // It's not worth synchronizing around this and creating a
    // bottleneck, since the only purpose is to print an error
    // message if there is no factory configured. In the worst
    // (and unlikely) case, this may cause a handful of those error messages to
    // be printed instead of the expected 1, and this is fine
    // to avoid the performance impact.
    if (factoryFirstUse) {
        factoryFirstUse = false;
        if (opentracingTracerFactory == null) {
            Tr.warning(tc, "OPENTRACING_TRACERFACTORY_NOT_PROVIDED");
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, OpentracingUtils.getTracerText(tracer));
    }
    return tracer;
}

19 Source : OpentracingTracerManager.java
with Eclipse Public License 1.0
from OpenLiberty

@Trivial
private static Tracer ensureTracer(String appName) {
    String methodName = "ensureTracer";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, appName);
    }
    Tracer tracer = null;
    boolean found = true;
    if (appName != null) {
        tracer = applicationTracers.get(appName);
        if (tracer == null) {
            found = false;
            tracer = applicationTracers.computeIfAbsent(appName, TracerCreator.INSTANCE);
        }
        if (tracer == TRACER_NOT_FOUND) {
            tracer = null;
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        String tracerCase;
        if (appName == null) {
            tracerCase = "appName is null";
        } else {
            tracerCase = found ? "previously created" : "newly created or previously created if lost race condition";
        }
        Tr.exit(tc, methodName + " (" + tracerCase + ")", OpentracingUtils.getTracerText(tracer));
    }
    return tracer;
}

19 Source : OpentracingTracerManager.java
with Eclipse Public License 1.0
from OpenLiberty

// Open tracing context preplaced through ...
/**
 * <p>Answer the tracer of the active open tracing context.</p>
 *
 * @Return The tracer of the active open tracing context.
 */
@Trivial
public static Tracer getTracer() {
    String methodName = "getTracer";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName);
    }
    String appName = null;
    Tracer tracer = null;
    appName = OpentracingUtils.lookupAppName();
    tracer = ensureTracer(appName);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Thread currentThread = Thread.currentThread();
        String threadName = currentThread.getName();
        long threadId = currentThread.getId();
        Tr.exit(tc, methodName + " (" + threadName + ":" + Long.toString(threadId) + ")", OpentracingUtils.getTracerText(tracer));
    }
    return tracer;
}

19 Source : SRTServletResponse31.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * @throws IOException
 */
protected void flushData() throws IOException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "flushData", " we've written output so flush" + " [" + this + "]");
    }
    if (_pwriter != null && writerClosed == false) {
        _pwriter.flush();
    }
    if (_gotOutputStream) {
        _response.flushBuffer();
    }
    // if resource did not had printWriter or output stream but still needs to flush, then flush headers
    // check if this will effect Websocket, may be not as it always get it for Transportconnection ?
    if (_pwriter == null && !_gotOutputStream) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "only flush headers as output or writer are not created" + " [" + this + "]");
        }
        ((IResponse31Impl) _response).flushHeaders();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "flushData", " we've flushed" + " [" + this + "]");
    }
}

19 Source : SRTServletResponse31.java
with Eclipse Public License 1.0
from OpenLiberty

// for upgrade request
/**
 * @throws IOException
 */
public void finishKeepConnection() throws IOException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "finishKeepConnection", " [" + this + "]");
    }
    if (!isCommitted()) {
        commit();
        // need to flush data, so code outside WebContainer that are upgraded can immediately send data once the response is finished
        flushData();
    }
    super.cleanupFromFinish();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "finishKeepConnection", " [" + this + "]");
    }
}

19 Source : ReadListenerRunnable.java
with Eclipse Public License 1.0
from OpenLiberty

/* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
@Override
public void run() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "run", Thread.currentThread().getName() + " " + this.in.getReadListener());
    }
    try {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Issuing the async read for the data");
        }
        if (_isc == null) {
            _callback.complete(null);
        } else {
            // Call into the HttpInboundService context for the body data, preplaceding in the callback and forcing
            // the read to go asynchronous
            // If there is data immediately available Channel will call the callback.complete before returning to this thread
            _isc.getRequestBodyBuffer(_callback, true);
        }
    } catch (Exception e) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "An exception occurred during the async read : " + e);
        }
        e.printStackTrace();
        // There was a problem with the read so we should invoke their onError, since technically it's been set now
        if (this.in.getReadListener() != null)
            this.in.getReadListener().onError(e);
    } finally {
        asyncContext.setReadListenerRunning(false);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "run", this.in.getReadListener());
    }
}

19 Source : AsyncReadCallback.java
with Eclipse Public License 1.0
from OpenLiberty

/* (non-Javadoc)
     * @see com.ibm.wsspi.channelfw.InterChannelCallback#complete(com.ibm.wsspi.channelfw.VirtualConnection)
     */
@Override
@FFDCIgnore(IOException.clreplaced)
public void complete(VirtualConnection vc) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "complete", vc);
    }
    if (null == vc) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "complete");
        }
        return;
    }
    // We don't need to do an initial seeding of the buffer here as HTTP Channel has already done that in their
    // complete callback from the TCP Channel. When we call an async read on them they will return indicating
    // there is data to read
    synchronized (this.in.getCompleteLockObj()) {
        // This variable was introduced to prevent us from calling into Channel again when there is an outstanding ready
        // Once isReady returns false once, we don't want to change it back until the next call into onDataAvailable
        // This variable prevents isReady from returning true if there is an outstanding read
        this.in.setAsyncReadOutstanding(false);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Calling user's ReadListener onDataAvailable : " + this.in.getReadListener());
        }
        SRTServletRequestThreadData.getInstance().init(_requestDataAsyncReadCallbackThread);
        // Push the original thread's context onto the current thread, also save off the current thread's context
        boolean localPushedThreadContext = false;
        try {
            if (pushedThreadContext == false) {
                this.threadContextManager.pushContextData();
                this.pushedThreadContext = true;
                localPushedThreadContext = true;
            }
            // Call into the user's ReadListener to indicate there is data available
            try {
                this.in.getReadListener().onDataAvailable();
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Returned from user's ReadListener onDataAvailable : " + this.in.getReadListener());
                }
            } catch (Throwable onDataAvailableException) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Exception occurred during ReadListener.onDataAvailable : " + onDataAvailableException + ", " + this.in.getReadListener());
                }
                error(vc, onDataAvailableException);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                    Tr.exit(tc, "complete");
                }
                return;
            }
            if (this.in.getReadListener() != null) {
                // the stream may have been closed during onDataAvailable
                // cannot call onAllDataRead()
                // Determine if the message has been fully read. If so call the user's ReadListener to indicate all data has been read
                // If the message isn't fully read then issue a forced async read to the channel
                if (in.isFinished()) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Message is fully read, calling ReadListener onAllDataRead : " + this.in.getReadListener());
                    }
                    try {
                        if (!onAllDataReadCalled) {
                            onAllDataReadCalled = true;
                            this.in.getReadListener().onAllDataRead();
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Returned from user's ReadListener onAllDataRead : " + this.in.getReadListener());
                            }
                        } else {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Returned from user's ReadListener onAllDataRead onAllDataRead has already been called, do nothing here.");
                            }
                        }
                    } catch (Throwable onAllDataReadException) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Exception occurred during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + this.in.getReadListener());
                        }
                        error(vc, onAllDataReadException);
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                            Tr.exit(tc, "complete");
                        }
                        return;
                    }
                } else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Data hasn't been fully read yet. There should be an outstanding read at this point : " + this.in.getReadListener());
                    }
                    // Need to call pre-join since the async read will occur on another
                    // thread.
                    if (onErrorDriven == false) {
                        this.in.prepareAsyncReadListener();
                    }
                }
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "ReadListener is not set , stream must be closed, cannot call onAllDataRead()");
                }
            }
        } finally {
            // Revert back to the thread's current context
            if (localPushedThreadContext == true) {
                this.pushedThreadContext = false;
                this.threadContextManager.popContextData();
            }
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "complete");
    }
}

19 Source : AsyncAlreadyReadCallback.java
with Eclipse Public License 1.0
from OpenLiberty

/* (non-Javadoc)
     * @see com.ibm.wsspi.channelfw.InterChannelCallback#complete(com.ibm.wsspi.channelfw.VirtualConnection)
     */
@Override
@FFDCIgnore(IOException.clreplaced)
public void complete(VirtualConnection vc) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "complete", vc);
    }
    synchronized (this.in.getCompleteLockObj()) {
        SRTServletRequestThreadData.getInstance().init(_requestDataAsyncReadCallbackThread);
        // Push the original thread's context onto the current thread, also save off the current thread's context
        this.threadContextManager.pushContextData();
        // Call into the user's ReadListener to indicate there is data available
        try {
            if (!in.isFinished()) {
                this.in.getReadListener().onDataAvailable();
            }
        } catch (Throwable onDataAvailableException) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Exception occurred during ReadListener.onDataAvailable : " + onDataAvailableException + ", " + this.in.getReadListener());
            }
            this.threadContextManager.popContextData();
            error(vc, onDataAvailableException);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                Tr.exit(tc, "complete");
            }
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Message is fully read, calling ReadListener onAllDataRead : " + this.in.getReadListener());
        }
        if (this.in.getReadListener() != null) {
            // if all the data has been read we are done.
            if (in.isFinished()) {
                try {
                    this.in.getReadListener().onAllDataRead();
                } catch (Throwable onAllDataReadException) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Exception occurred during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + this.in.getReadListener());
                    }
                    this.threadContextManager.popContextData();
                    error(vc, onAllDataReadException);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
                        Tr.exit(tc, "complete");
                    }
                    return;
                }
            } else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "onDataAavailabe returned without reading all data. Read Listener will no be called again : " + this.in.getReadListener());
            } else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "ReadListener is not set , stream must be closed, cannot call onAllDataRead()");
                }
            }
        }
        // Revert back to the thread's current context
        this.threadContextManager.popContextData();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "complete");
    }
}

19 Source : UOWManagerFactory.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Returns a stateless thread-safe UOWManager instance.
 *
 * @return UOWManager instance
 */
public static UOWManager getUOWManager() {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "getUOWManager");
    final UOWManager uowm = com.ibm.ws.uow.embeddable.UOWManagerFactory.getUOWManager();
    if (tc.isEntryEnabled())
        Tr.exit(tc, "getUOWManager", uowm);
    return uowm;
}

19 Source : EmbeddableJCATranWrapperImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 */
@Override
public void resume() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.entry(tc, "resume");
    switch(_suspendedUOWType) {
        case UOWCurrent.UOW_LOCAL:
            LocalTranCurrentSet.instance().resume((LocalTransactionCoordinator) _suspendedUOW);
            break;
        case UOWCurrent.UOW_GLOBAL:
            try {
                _tranManager.resume((Transaction) _suspendedUOW);
            } catch (Exception e) {
                FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.EmbeddableJCATranWrapperImpl.resume", "135", this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, "Failed to resume", new Object[] { _suspendedUOW, e });
            }
            break;
        default:
            break;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.exit(tc, "resume");
}

19 Source : EmbeddableJCATranWrapperImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Suspend any transaction context off the thread - save the LTC in the wrapper
 */
@Override
public void suspend() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.entry(tc, "suspend");
    _suspendedUOWType = ((UOWCurrent) _tranManager).getUOWType();
    switch(_suspendedUOWType) {
        case UOWCurrent.UOW_LOCAL:
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "suspending (local)");
            }
            _suspendedUOW = LocalTranCurrentSet.instance().suspend();
            break;
        case UOWCurrent.UOW_GLOBAL:
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "suspending (global)");
            }
            _suspendedUOW = _tranManager.suspend();
            break;
        case UOWCurrent.UOW_NONE:
            _suspendedUOW = null;
            break;
        default:
            break;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.exit(tc, "suspend", _suspendedUOWType);
}

19 Source : EmbeddableLTCUOWCallback.java
with Eclipse Public License 1.0
from OpenLiberty

/*
     * Notification from UserTransaction or UserActivitySession interface implementations
     * that the state of a bean-managed UOW has changed. As a result of this bean-managed
     * UOW change we may have to change the LTC that's on the thread.
     */
@Override
public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException {
    final boolean traceOn = TraceComponent.isAnyTracingEnabled();
    if (traceOn && tc.isEntryEnabled())
        Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this });
    try {
        // Determine the Tx change type and process.  Ensure we do what
        // we need to do as close to the context switch as possible
        switch(typeOfChange) {
            case PRE_BEGIN:
                try {
                    LTCCallbacks.instance().contextChange(typeOfChange);
                } finally {
                    uowPreBegin();
                }
                break;
            case POST_BEGIN:
                try {
                    uowPostBegin(scope);
                } finally {
                    LTCCallbacks.instance().contextChange(typeOfChange);
                }
                break;
            case PRE_END:
                try {
                    LTCCallbacks.instance().contextChange(typeOfChange);
                } finally {
                    uowPreEnd(scope);
                }
                break;
            case POST_END:
                try {
                    uowPostEnd();
                } finally {
                    LTCCallbacks.instance().contextChange(typeOfChange);
                }
                break;
            default:
                if (traceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange);
        }
    } catch (IllegalStateException ise) {
        if (traceOn && tc.isEntryEnabled())
            Tr.exit(tc, "contextChange", ise);
        throw ise;
    }
    if (traceOn && tc.isEntryEnabled())
        Tr.exit(tc, "contextChange");
}

19 Source : EmbeddableLTCUOWCallback.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
protected void uowPreBegin() throws IllegalStateException {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "uowPreBegin", new Object[] { this, new Exception("uowPreBegin") });
    Byte beginContextByte = _beginContext.get();
    super.uowPreBegin();
    beginContextByte = _beginContext.get();
    if (beginContextByte == null) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "_beginContext= NULL !");
        }
    } else {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "_beginContext=" + beginContextByte);
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "uowPreBegin");
    }
}

19 Source : EmbeddableTransactionState.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
protected void logSupOrRecCoord() throws Exception {
    final boolean traceOn = TraceComponent.isAnyTracingEnabled();
    if (traceOn && tc.isEntryEnabled())
        Tr.entry(tc, "logSupOrRecCoord", this);
    final WSATRecoveryCoordinator wsatRC = ((EmbeddableTransactionImpl) _tran).getWSATRecoveryCoordinator();
    if (wsatRC != null) {
        final RecoverableUnitSection recoveryCoordSection = _tranLog.createSection(TransactionImpl.RECCOORD_WSAT_SECTION, true);
        recoveryCoordSection.addData(wsatRC.toLogData());
        if (traceOn && tc.isEventEnabled())
            Tr.event(tc, "WSATRecoveryCoordinator logged ", wsatRC);
    } else {
        // Throw exception to convert a prepare vote to rollback
        final NullPointerException npe = new NullPointerException("Null recovery coordinator");
        if (traceOn && tc.isEntryEnabled())
            Tr.exit(tc, "logSupOrRecCoord", npe);
        throw npe;
    }
    if (traceOn && tc.isEntryEnabled())
        Tr.exit(tc, "logSupOrRecCoord");
}

19 Source : EmbeddableRecoveryManager.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
protected boolean handleTranRecord(RecoverableUnit ru, boolean recoveredTransactions, LogCursor recoverableUnits) throws SystemException, NotSupportedException, InternalLogException {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "handleTranRecord", new Object[] { ru, recoveredTransactions, recoverableUnits });
    final EmbeddableTransactionImpl tx = new EmbeddableTransactionImpl((EmbeddableFailureScopeController) _failureScopeController);
    if (tx.reconstruct(ru, _tranLog)) {
        // If this txn was imported from an RA we need to re insert it in
        // TxExecutionHandler.txnTable
        if (tx.isRAImport()) {
            TxExecutionContextHandler.addTxn(tx);
        }
        recoveredTransactions = true;
    } else {
        // Discard any recoverable unit that is not reconstructed
        recoverableUnits.remove();
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "handleTranRecord", recoveredTransactions);
    return recoveredTransactions;
}

19 Source : EmbeddableRecoveryAgentImpl.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
protected FailureScopeController createFailureScopeController(FailureScope currentFailureScope) throws Exception {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "createFailureScopeController", currentFailureScope);
    FailureScopeController fsc = new EmbeddableFailureScopeController(currentFailureScope);
    if (tc.isEntryEnabled())
        Tr.exit(tc, "createFailureScopeController", fsc);
    return fsc;
}

19 Source : DeflateInputHandler.java
with Eclipse Public License 1.0
from OpenLiberty

private void reset() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(this, tc, "reset");
    }
    this.countRead += this.inflater.getBytesRead();
    this.countWritten += this.inflater.getBytesWritten();
    this.inflater.reset();
    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(this, tc, "reset done on inflater, counters updated");
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(this, tc, "reset");
    }
}

19 Source : DeflateInputHandler.java
with Eclipse Public License 1.0
from OpenLiberty

/*
     * @see
     * com.ibm.wsspi.http.channel.compression.DecompressionHandler#decompress(
     * com.ibm.wsspi.bytebuffer.WsByteBuffer)
     */
public List<WsByteBuffer> decompress(WsByteBuffer inputBuffer) throws DataFormatException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "decompress, input=" + inputBuffer);
    }
    List<WsByteBuffer> list = new LinkedList<WsByteBuffer>();
    int dataSize = inputBuffer.remaining();
    byte[] input = new byte[dataSize];
    inputBuffer.get(input, 0, dataSize);
    int inOffset = 0;
    // if the inflater is finished, then this is a repeat call
    // to decompress with the same handler and a reset is required
    if (this.inflater.finished())
        reset();
    if (!this.inflater.finished()) {
        this.inflater.setInput(input, inOffset, dataSize - inOffset);
    }
    long initialBytesRead = this.inflater.getBytesRead();
    int outOffset = 0;
    // keep decompressing until we've used up the entire input buffer or reached
    // the end of the compressed stream
    int len = -1;
    while (inOffset < input.length && !this.inflater.finished() && 0 != len) {
        try {
            len = this.inflater.inflate(this.buf, outOffset, this.buf.length - outOffset);
        } catch (DataFormatException dfe) {
            // no FFDC required, clean up any buffers we've allocated so far
            release(list);
            throw dfe;
        }
        long bytesRead = this.inflater.getBytesRead();
        inOffset += (bytesRead - initialBytesRead);
        initialBytesRead = bytesRead;
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Decompressed amount=" + len + " inOffset=" + inOffset + " read=" + this.inflater.getBytesRead() + " written=" + this.inflater.getBytesWritten() + " finished=" + this.inflater.finished());
        }
        outOffset += len;
        if (outOffset == this.buf.length) {
            WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocate(this.buf.length);
            buffer.put(this.buf, 0, this.buf.length);
            buffer.flip();
            list.add(buffer);
            outOffset = 0;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Storing decompressed buffer; " + buffer);
            }
        }
    }
    // save off any extra output that is ready
    if (0 < outOffset) {
        WsByteBuffer buffer = HttpDispatcher.getBufferManager().allocate(outOffset);
        buffer.put(this.buf, 0, outOffset);
        buffer.flip();
        list.add(buffer);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Stored final decompressed buffer; " + buffer);
        }
    }
    if (inOffset < dataSize) {
        // did not use the entire buffer
        inputBuffer.position(inputBuffer.position() - (dataSize - inOffset));
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "input buffer has unused data; " + inputBuffer);
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "decompress, output=" + list.size());
    }
    return list;
}

19 Source : HTTPLoggingServiceImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Final call when the service is being destroyed. The service cannot be
 * restarted once this is used.
 */
public void destroy() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "destroy");
    }
    this.bRunning = false;
    this.ncsaLog.disable();
    this.frcaLog.disable();
    this.debugLog.disable();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "destroy");
    }
}

19 Source : HTTPLoggingServiceImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Stop this service. It can be restarted after this method call.
 */
public void stop() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "stop");
    }
    if (this.bRunning) {
        this.bRunning = false;
        this.ncsaLog.stop();
        this.frcaLog.stop();
        this.debugLog.stop();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "stop");
    }
}

19 Source : HTTPLoggingServiceImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Start this service.
 */
public void start() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "start");
    }
    if (!this.bRunning) {
        this.ncsaLog.start();
        this.frcaLog.start();
        this.debugLog.start();
        this.bRunning = true;
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "start");
    }
}

19 Source : FilterListFastStr.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Convert a single URL address to an Entry object. The entry object will
 * contain the hashcode array and length array of the substrings of this
 * address
 *
 * @param newAddress
 *                       address to convert
 * @return the Entry object created from this address.
 */
private Entry convertToEntries(String newAddress) {
    byte[] ba = null;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "convertToEntries");
    }
    try {
        ba = newAddress.getBytes("ISO-8859-1");
    } catch (UnsupportedEncodingException x) {
        // should never happen, log a message and use default encoding
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "ISO-8859-1 encoding not supported.  Exception: " + x);
        }
        ba = newAddress.getBytes();
    }
    int baLength = ba.length;
    int hashValue = 0;
    int hashLength = 0;
    int e31 = 1;
    Entry oEntry = new Entry();
    for (int i = 0; i < baLength; i++) {
        if (ba[i] == WILDCARD_VALUE) {
            boolean valid = true;
            // make sure it is the first entry, followed by a ".", or nothing
            if (i != 0) {
                valid = false;
            }
            if (baLength >= 2) {
                if (ba[1] != PERIOD_VALUE) {
                    valid = false;
                }
            }
            if (valid) {
                // if isolated, then store it, and continue to next word.
                // Store as wildcard entry
                oEntry.addEntry(0, 0);
                // jump over next period to avoid processing this char again
                i = 1;
                // go back to start of for loop
                continue;
            }
        }
        if (ba[i] != PERIOD_VALUE) {
            // continue calculating hashcode for this entry
            hashValue += e31 * ba[i];
            e31 = e31 * 31;
            hashLength++;
        }
        if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) {
            // end of a "word", need to add if length is non-zero
            if (hashLength > 0) {
                oEntry.addEntry(hashValue, hashLength);
            }
            // prepare to calculate next entry
            hashLength = 0;
            e31 = 1;
            hashValue = 0;
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "convertToEntries");
    }
    return oEntry;
}

19 Source : XAFlowCallbackImpl.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
public boolean beforeXAFlow(int flowType, int flag) {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "beforeXAFlow", new Object[] { getFlowType(flowType), getBeforeFlag(flag), _activated });
    if (_activated) {
        if (flowType == COMMIT) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Bringing server down");
            Runtime.getRuntime().halt(1);
        }
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "beforeXAFlow", true);
    return true;
}

19 Source : TestUOWEventListener.java
with Eclipse Public License 1.0
from OpenLiberty

/*
     * (non-Javadoc)
     *
     * @see com.ibm.wsspi.tx.UOWEventListener#UOWEvent(com.ibm.wsspi.tx.UOWEventEmitter, int, java.lang.Object)
     */
@Override
public void UOWEvent(UOWEventEmitter uow, int event, Object data) {
    final UOWEventDetails ed = new UOWEventDetails(uow, event, data);
    synchronized (got) {
        long key = Thread.currentThread().getId();
        if (got.get(key) == null) {
            final List<UOWEventDetails> l = new ArrayList<UOWEventDetails>();
            l.add(ed);
            System.out.println("Adding event to new list for thread " + key + " which now has " + l.size() + " elements");
            got.put(key, l);
        } else {
            got.get(key).add(ed);
            System.out.println("Adding event to existing list for thread " + key + " which now has " + got.get(key).size() + " elements");
        }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        final String e;
        switch(event) {
            case UOWEventListener.POST_BEGIN:
                e = "POST_BEGIN";
                break;
            case UOWEventListener.POST_END:
                e = "POST_END";
                break;
            case UOWEventListener.REGISTER_SYNC:
                e = "REGISTER_SYNC";
                break;
            case UOWEventListener.RESUME:
                e = "RESUME";
                break;
            case UOWEventListener.SUSPEND:
                e = "SUSPEND";
                break;
            default:
                e = "UNKNOWN";
                break;
        }
        System.out.println("UOWEvent on thread " + Thread.currentThread().getId());
        System.out.println(ed);
        Tr.entry(tc, "UOWEvent", Thread.currentThread().getId(), ed);
        Tr.exit(tc, "UOWEvent");
    }
}

19 Source : WSPKCSInKeyStoreList.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Insert a new keystore into the list.
 *
 * @param tokenType
 * @param tokenlib
 * @param tokenPwd
 * @param askeystore
 * @param contextProvider
 * @param pureAcceleration
 * @return WSPKCSInKeyStore
 * @throws Exception
 */
public synchronized WSPKCSInKeyStore insert(String tokenType, String tokenlib, String tokenPwd, boolean askeystore, String keyStoreProvider) throws Exception {
    // check to see if the library has been initialized already;by comparing
    // the elements in the enumerations
    // perhaps a java 2 sec mgr
    if (tc.isEntryEnabled())
        Tr.entry(tc, "insert", new Object[] { tokenType, tokenlib, keyStoreProvider });
    WSPKCSInKeyStore pKS = insertedAlready(tokenlib);
    boolean already = false;
    // what is inserted already, but not as the askeystore specified. In
    // other words, askeystore indicates keystore, but
    // the pKS was inserted as truststore.
    // looks like we have not inserted anything yet.
    if (pKS == null) {
        pKS = new WSPKCSInKeyStore(tokenlib, keyStoreProvider);
    } else {
        already = true;
    }
    if (askeystore)
        pKS.asKeyStore(tokenType, tokenlib, tokenPwd);
    else
        pKS.asTrustStore(tokenType, tokenlib, tokenPwd);
    if (!already)
        theV.add(pKS);
    if (tc.isEntryEnabled()) {
        Tr.exit(tc, "insert");
    }
    return pKS;
}

19 Source : TrustManagerData.java
with Eclipse Public License 1.0
from OpenLiberty

public String getTrustManagerString() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.entry(tc, "getTrustManagerString");
    String rc = null;
    if (tmCustomClreplaced != null) {
        rc = tmCustomClreplaced;
    } else if (tmAlgorithm != null && tmProvider != null) {
        rc = tmAlgorithm + "|" + tmProvider;
    } else if (tmAlgorithm != null) {
        rc = tmAlgorithm;
    } else {
        rc = JSSEProviderFactory.getTrustManagerFactoryAlgorithm();
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        Tr.exit(tc, "getTrustManagerString -> " + rc);
    return rc;
}

19 Source : KeyManagerData.java
with Eclipse Public License 1.0
from OpenLiberty

public String getKeyManagerString() {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "getKeyManagerString");
    String rc = null;
    if (kmCustomClreplaced != null) {
        rc = kmCustomClreplaced;
    } else if (kmAlgorithm != null && kmProvider != null) {
        rc = kmAlgorithm + "|" + kmProvider;
    } else if (kmAlgorithm != null) {
        rc = kmAlgorithm;
    } else {
        rc = JSSEProviderFactory.getKeyManagerFactoryAlgorithm();
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "getKeyManagerString -> " + rc);
    return rc;
}

19 Source : Constants.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This method adjusts the supported ciphers to include those appropriate
 * to the security level (HIGH, MEDIUM, LOW).
 *
 * @param supportedCiphers
 * @param securityLevel
 * @return String[]
 */
public static String[] adjustSupportedCiphersToSecurityLevel(String[] supportedCiphers, String securityLevel) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, "adjustSupportedCiphersToSecurityLevel", new Object[] { convertCipherListToString(supportedCiphers), securityLevel });
    }
    List<String> newCipherList = new ArrayList<String>();
    if (supportedCiphers != null && supportedCiphers.length > 0) {
        if (securityLevel == null) {
            securityLevel = Constants.SECURITY_LEVEL_HIGH;
        }
        if (securityLevel.equals(Constants.SECURITY_LEVEL_LOW)) {
            /**
             * Security Level "high" will pare it down even more.
             * Strict Level Criteria: Support integrity signing algorithms but not to perform encryption
             */
            for (int i = 0; i < supportedCiphers.length; i++) {
                if ((supportedCiphers[i].indexOf("_anon_") != -1 || supportedCiphers[i].indexOf("_NULL_") != -1) && supportedCiphers[i].indexOf("_KRB5_") == -1 && supportedCiphers[i].indexOf("_AES_") == -1 && supportedCiphers[i].indexOf("DES") == -1 && supportedCiphers[i].indexOf("_RC") == -1 && supportedCiphers[i].indexOf("_EXPORT_") == -1) {
                    newCipherList.add(supportedCiphers[i]);
                }
            }
        } else if (securityLevel.equals(Constants.SECURITY_LEVEL_MEDIUM)) {
            /**
             * Security Level "medium" will pare it down remove "anonymous" and
             * "NULL" ciphers.
             */
            for (int i = 0; i < supportedCiphers.length; i++) {
                if ((supportedCiphers[i].indexOf("40_") != -1 || supportedCiphers[i].indexOf("_DES_") != -1) && supportedCiphers[i].indexOf("_anon_") == -1 && supportedCiphers[i].indexOf("_NULL_") == -1 && supportedCiphers[i].indexOf("_KRB5_") == -1 && supportedCiphers[i].indexOf("_RC4") == -1 && supportedCiphers[i].indexOf("_EXPORT_") == -1) {
                    newCipherList.add(supportedCiphers[i]);
                }
            }
        } else {
            /**
             * Security Level "high" will pare it down even more.
             */
            for (int i = 0; i < supportedCiphers.length; i++) {
                if ((supportedCiphers[i].indexOf("128_") != -1 || supportedCiphers[i].indexOf("256_") != -1 || supportedCiphers[i].indexOf("CHACHA20_POLY1305_") != -1) && supportedCiphers[i].indexOf("_anon_") == -1 && supportedCiphers[i].indexOf("_NULL_") == -1 && supportedCiphers[i].indexOf("_KRB5_") == -1 && supportedCiphers[i].indexOf("_RC4") == -1 && supportedCiphers[i].indexOf("_EXPORT_") == -1 && supportedCiphers[i].indexOf("_FIPS_") == -1 && supportedCiphers[i].indexOf("_3DES_") == -1) {
                    newCipherList.add(supportedCiphers[i]);
                }
            }
        }
    }
    String[] rc = newCipherList.toArray(new String[newCipherList.size()]);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, "adjustSupportedCiphersToSecurityLevel -> " + convertCipherListToString(rc));
    }
    return rc;
}

19 Source : TestMediator.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
public void mediateTokenException(AttributeList attributeList, OAuthException exception) throws OAuth20MediatorException {
    final String methodName = "mediateTokenException";
    if (tc.isEntryEnabled()) {
        Tr.entry(tc, methodName);
    }
    if ("preplacedword".equals(attributeList.getAttributeValueByName("grant_type"))) {
        // clear sensitive data
        attributeList.setAttribute("access_token", ATTRTYPE_RESPONSE_ATTRIBUTE, new String[0]);
        attributeList.setAttribute("refresh_token", ATTRTYPE_RESPONSE_ATTRIBUTE, new String[0]);
    }
    if (tc.isEntryEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : TestMediator.java
with Eclipse Public License 1.0
from OpenLiberty

@Override
public void mediateToken(AttributeList attributeList) throws OAuth20MediatorException {
    final String methodName = "mediateToken";
    if (tc.isEntryEnabled()) {
        Tr.entry(tc, methodName);
    }
    throw new OAuth20MediatorException("test deliberate fail", new Exception("test deliberate fail"));
/*
 * if (FLOW_PreplacedWORD.equals(attributeList
 * .getAttributeValueByName("grant_type"))) {
 * String username = attributeList.getAttributeValueByName("username");
 * String preplacedword = attributeList.getAttributeValueByName("preplacedword");
 * try {
 * reg.checkPreplacedword(username, preplacedword);
 * } catch (PreplacedwordCheckFailedException e) {
 * throw new OAuth20MediatorException(INVALID, e);
 * } catch (CustomRegistryException e) {
 * throw new OAuth20MediatorException(INVALID, e);
 * } catch (RemoteException e) {
 * throw new OAuth20MediatorException(INVALID, e);
 * }
 * }
 *
 * if (tc.isEntryEnabled()) {
 * Tr.exit(tc, methodName);
 * }
 */
}

19 Source : TestMediator.java
with Eclipse Public License 1.0
from OpenLiberty

public void mediateTokenException(AttributeList attributeList, OAuthException exception) throws OAuth20MediatorException {
    final String methodName = "mediateTokenException";
    if (tc.isEntryEnabled()) {
        Tr.entry(tc, methodName);
    }
    if ("preplacedword".equals(attributeList.getAttributeValueByName("grant_type"))) {
        // clear sensitive data
        attributeList.setAttribute("access_token", ATTRTYPE_RESPONSE_ATTRIBUTE, new String[0]);
        attributeList.setAttribute("refresh_token", ATTRTYPE_RESPONSE_ATTRIBUTE, new String[0]);
    }
    if (tc.isEntryEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : TestMediator.java
with Eclipse Public License 1.0
from OpenLiberty

public void mediateToken(AttributeList attributeList) throws OAuth20MediatorException {
    final String methodName = "mediateToken";
    if (tc.isEntryEnabled()) {
        Tr.entry(tc, methodName);
    }
    throw new OAuth20MediatorException("test deliberate fail", new Exception("test deliberate fail"));
/*
         * if (FLOW_PreplacedWORD.equals(attributeList
         * .getAttributeValueByName("grant_type"))) {
         * String username = attributeList.getAttributeValueByName("username");
         * String preplacedword = attributeList.getAttributeValueByName("preplacedword");
         * try {
         * reg.checkPreplacedword(username, preplacedword);
         * } catch (PreplacedwordCheckFailedException e) {
         * throw new OAuth20MediatorException(INVALID, e);
         * } catch (CustomRegistryException e) {
         * throw new OAuth20MediatorException(INVALID, e);
         * } catch (RemoteException e) {
         * throw new OAuth20MediatorException(INVALID, e);
         * }
         * }
         * 
         * if (tc.isEntryEnabled()) {
         * Tr.exit(tc, methodName);
         * }
         */
}

19 Source : PlatformServiceFactory.java
with Eclipse Public License 1.0
from OpenLiberty

public static PlatformService getPlatformService() {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "getPlatformService");
    if (platform == null) {
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Checking platform type");
        if (tryProp(TEST_PROP)) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Checking platform type");
            platform = new TestPlatformService();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "found prop " + TEST_PROP);
        } else if (tryProp(LIBERTY_PROP)) {
            platform = new LibertyPlatformService();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "found prop " + LIBERTY_PROP);
        } else if (tryClreplaced(WAS_CLreplaced)) {
            platform = new WASPlatformService();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "found clreplaced " + WAS_CLreplaced);
        } else {
            // defaulting to WAS
            platform = new WASPlatformService();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "nothing found, default platform");
        }
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Platform: " + platform.getClreplaced().getName());
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "getPlatformService");
    return platform;
}

19 Source : LibertyPlatformService.java
with Eclipse Public License 1.0
from OpenLiberty

public String getConfigFolder() {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "getConfigFolder");
    if (configFileDir == null) {
        String base = AccessController.doPrivileged(new PrivilegedAction<String>() {

            public String run() {
                return System.getProperty(serverDirKey);
            }
        });
        if (base == null) {
            Tr.error(tc, "no property SERVER_CONFIG_DIR");
        } else {
            File oauth20dir = new File(configFileDir, "oauth20");
            configFileDir = oauth20dir.getAbsolutePath();
            if (tc.isDebugEnabled())
                Tr.debug(tc, "OAuthConfigFileDir: " + configFileDir);
        }
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "getConfigFolder");
    return configFileDir;
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

void setGroupClaimAsOnlyGroupId(Object groupClaim) {
    String methodName = "setGroupClaimAsOnlyGroupId";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, groupClaim);
    }
    try {
        String groupName = (String) groupClaim;
        groupIds = new ArrayList<String>();
        groupIds.add(groupName);
    } catch (ClreplacedCastException cce) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "cannot get meaningful group due to CCE: " + cce);
        }
    }
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

void populateGroupIds(String jsonstr, String groupAttr) {
    String methodName = "populateGroupIds";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, jsonstr, groupAttr);
    }
    Object groupClaim = null;
    if (groupAttr != null) {
        groupClaim = getClaim(jsonstr, groupAttr);
    }
    populateGroupIdsFromGroupClaim(groupClaim);
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

Object getClaim(String jsonstr, String claimAttr) {
    String methodName = "getClaim";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, jsonstr, claimAttr);
    }
    Object claim = null;
    try {
        if (claims != null) {
            claim = claims.get(claimAttr);
        } else {
            claims = JsonUtils.claimsFromJsonObject(jsonstr);
            if (claims != null) {
                claim = claims.get(claimAttr);
            }
        }
    } catch (Exception e) {
        Tr.error(tc, "CANNOT_GET_CLAIM_FROM_JSON", new Object[] { claimAttr, e.getLocalizedMessage() });
    }
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName, claim);
    }
    return claim;
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

void populateGroupIdsFromGroupClaim(Object groupClaim) {
    String methodName = "populateGroupIdsFromGroupClaim";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, groupClaim);
    }
    if (groupClaim == null) {
        if (tc.isDebugEnabled()) {
            Tr.exit(tc, methodName);
        }
        return;
    }
    if (groupClaim instanceof ArrayList<?>) {
        setGroupIdArrayList(groupClaim);
    } else {
        setGroupClaimAsOnlyGroupId(groupClaim);
    }
    if (groupIds != null && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc, "groups size = ", groupIds.size());
    }
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

private String getUserName(String userNameAttr, String jsonstr) {
    String methodName = "getUserName";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, userNameAttr, jsonstr);
    }
    if (jsonstr != null && userNameAttr != null && !userNameAttr.isEmpty()) {
        Object user = getClaim(jsonstr, userNameAttr);
        setUserName(userNameAttr, user);
    }
    if (userName == null) {
        Tr.error(tc, "PRINCIPAL_MAPPING_MISSING_ATTR", new Object[] { userNameAttr, MicroProfileJwtConfigImpl.KEY_userNameAttribute });
    }
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName, userName);
    }
    return userName;
}

19 Source : JwtPrincipalMapping.java
with Eclipse Public License 1.0
from OpenLiberty

@SuppressWarnings("unchecked")
void setGroupIdArrayList(Object groupClaim) {
    String methodName = "setGroupIdArrayList";
    if (tc.isDebugEnabled()) {
        Tr.entry(tc, methodName, groupClaim);
    }
    groupIds = (ArrayList<String>) groupClaim;
    if (tc.isDebugEnabled()) {
        Tr.exit(tc, methodName);
    }
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This method will process a configuration value for any configuration setting in
 * {@link LdapIdenreplacedyStoreDefinition} or {@link DatabaseIdenreplacedyStoreDefinition} that
 * is a string and whose name is NOT a "*Expression". It will first check to see if it
 * is a EL expression. It it is, it will return the evaluated expression; otherwise, it
 * will return the literal String.
 *
 * @param name The name of the property. Used for error messages.
 * @param expression The value returned from from the idenreplacedy store definition, which can
 *            either be a literal String or an EL expression.
 * @param immediateOnly Return null if the value is a deferred EL expression.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might
 *            be contained in either the expression or the result.
 * @return The String value.
 */
@FFDCIgnore(ELException.clreplaced)
@Trivial
protected String processString(String name, String expression, boolean immediateOnly, boolean mask) {
    final String methodName = "processString";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask });
    }
    String result;
    boolean immediate = false;
    try {
        Object obj = evaluateElExpression(expression, mask);
        if (obj == null) {
            throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null.");
        } else if (obj instanceof String) {
            result = (String) obj;
            immediate = isImmediateExpression(expression, mask);
        } else {
            throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value.");
        }
    } catch (ELException e) {
        result = expression;
        immediate = true;
    }
    String finalResult = (immediateOnly && !immediate) ? null : result;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult);
    }
    return finalResult;
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This method will process a configuration value for an String[] setting in
 * {@link LdapIdenreplacedyStoreDefinition} or {@link DatabaseIdenreplacedyStoreDefinition}.
 * It will first check to see if there is an EL expression. It there is, it will return
 * the evaluated expression; otherwise, it will return the non-EL value.
 *
 * @param name The name of the property. Used for error messages.
 * @param expression The EL expression returned from from the idenreplacedy store definition.
 * @param immediateOnly Return null if the value is a deferred EL expression.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might be
 *            contained in either the expression or the result.
 * @return Either the evaluated EL expression or the non-EL value.
 */
@FFDCIgnore(ELException.clreplaced)
@Trivial
protected Stream<String> processStringStream(String name, String expression, boolean immediateOnly, boolean mask) {
    final String methodName = "processStringStream";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask });
    }
    Stream<String> result;
    boolean immediate = false;
    try {
        Object obj = evaluateElExpression(expression, mask);
        if (obj == null) {
            throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null.");
        } else if (obj instanceof Stream) {
            result = (Stream<String>) obj;
            immediate = isImmediateExpression(expression, mask);
        } else {
            throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a Stream<String> value.");
        }
    } catch (ELException e) {
        throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a Stream<String> value.");
    }
    Stream<String> finalResult = (immediateOnly && !immediate) ? null : result;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult);
    }
    return finalResult;
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * This method will process a configuration value for an String[] setting in
 * {@link LdapIdenreplacedyStoreDefinition} or {@link DatabaseIdenreplacedyStoreDefinition}.
 * It will first check to see if there is an EL expression. It there is, it will return
 * the evaluated expression; otherwise, it will return the non-EL value.
 *
 * @param name The name of the property. Used for error messages.
 * @param expression The EL expression returned from from the idenreplacedy store definition.
 * @param immediateOnly Return null if the value is a deferred EL expression.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might be
 *            contained in either the expression or the result.
 * @return Either the evaluated EL expression or the non-EL value.
 */
@FFDCIgnore(ELException.clreplaced)
@Trivial
protected String[] processStringArray(String name, String expression, boolean immediateOnly, boolean mask) {
    final String methodName = "processStringArray";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask });
    }
    String[] result;
    boolean immediate = false;
    try {
        Object obj = evaluateElExpression(expression, mask);
        if (obj == null) {
            throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null.");
        } else if (obj instanceof String[]) {
            result = (String[]) obj;
            immediate = isImmediateExpression(expression, mask);
        } else {
            throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value.");
        }
    } catch (ELException e) {
        throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String[] value.");
    }
    String[] finalResult = (immediateOnly && !immediate) ? null : result;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult);
    }
    return finalResult;
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Return whether the expression is an immediate EL expression.
 *
 * @param expression The expression to evaluate.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might be
 *            contained in either the expression or the result.
 * @return True if the expression is an immediate EL expression.
 */
@Trivial
static boolean isImmediateExpression(String expression, boolean mask) {
    final String methodName = "isImmediateExpression";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
    }
    boolean result = expression.startsWith("${") && expression.endsWith("}");
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, result);
    }
    return result;
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Remove the brackets from an EL expression.
 *
 * @param expression The expression to remove the brackets from.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might
 *            be contained in either the expression or the result.
 * @return The EL expression without the brackets.
 */
@Trivial
static String removeBrackets(String expression, boolean mask) {
    final String methodName = "removeBrackets";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
    }
    expression = expression.trim();
    if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) {
        expression = expression.substring(2, expression.length() - 1);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression);
    }
    return expression;
}

19 Source : ELHelper.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Evaluate a possible EL expression.
 *
 * @param expression The expression to evaluate.
 * @param mask Set whether to mask the expression and result. Useful for when preplacedwords might be
 *            contained in either the expression or the result.
 * @return The evaluated expression.
 */
@Trivial
protected Object evaluateElExpression(String expression, boolean mask) {
    final String methodName = "evaluateElExpression";
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask });
    }
    EvalPrivilegedAction evalPrivilegedAction = new EvalPrivilegedAction(expression, mask);
    Object result = AccessController.doPrivileged(evalPrivilegedAction);
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
        Tr.exit(tc, methodName, (result == null) ? null : mask ? OBFUSCATED_STRING : result);
    }
    return result;
}

19 Source : CloudantDatabaseValidator.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * @see com.ibm.wsspi.validator.Validator#validate(java.lang.Object, java.util.Map, java.util.Locale)
 */
@Override
@FFDCIgnore(java.lang.NoSuchMethodException.clreplaced)
public LinkedHashMap<String, ?> validate(Object instance, Map<String, Object> props, Locale locale) {
    String auth = (String) props.get(AUTH);
    String authAlias = (String) props.get(AUTH_ALIAS);
    boolean trace = TraceComponent.isAnyTracingEnabled();
    if (trace && tc.isEntryEnabled())
        Tr.entry(this, tc, "validate", auth, authAlias);
    LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();
    try {
        ResourceConfig config = null;
        int authType = AUTH_CONTAINER.equals(auth) ? 0 : AUTH_APPLICATION.equals(auth) ? 1 : -1;
        if (authType >= 0) {
            config = resourceConfigFactory.createResourceConfig("com.cloudant.client.api.Database");
            config.setResAuthType(authType);
            if (authAlias != null && authType == 0)
                // set provided auth alias
                config.addLoginProperty("DefaultPrincipalMapping", authAlias);
        }
        Object database = ((ResourceFactory) instance).createResource(config);
        // There isn't anything particularly useful in the DB Info, but invoking the method
        // ensures that the database exists (or it will be created if create="true")
        database.getClreplaced().getMethod("info").invoke(database);
        URI dbURI = (URI) database.getClreplaced().getMethod("getDBUri").invoke(database);
        result.put("uri", dbURI == null ? "null" : dbURI.toString());
        Object cloudantClient = ((CloudantDatabaseService) instance).getCloudantClient(config);
        if (cloudantClient != null) {
            try {
                Object metaInfo = cloudantClient.getClreplaced().getMethod("metaInformation").invoke(cloudantClient);
                result.put("serverVersion", metaInfo.getClreplaced().getMethod("getVersion").invoke(metaInfo));
                Object metaInfoVendor = metaInfo.getClreplaced().getMethod("getVendor").invoke(metaInfo);
                result.put("vendorName", metaInfoVendor.getClreplaced().getMethod("getName").invoke(metaInfoVendor));
                String metaInfoVendorVersion = (String) metaInfoVendor.getClreplaced().getMethod("getVersion").invoke(metaInfoVendor);
                if (metaInfoVendorVersion != null) {
                    result.put("vendorVersion", metaInfoVendorVersion);
                }
                String metaInfoVendorVarient = (String) metaInfoVendor.getClreplaced().getMethod("getVariant").invoke(metaInfoVendor);
                if (metaInfoVendorVarient != null) {
                    result.put("vendorVariant", metaInfoVendorVarient);
                }
            } catch (NoSuchMethodException ex) {
                try {
                    result.put("serverVersion", cloudantClient.getClreplaced().getMethod("serverVersion").invoke(cloudantClient));
                } catch (NoSuchMethodException ignore) {
                }
            }
        }
    } catch (Throwable x) {
        result.put(FAILURE, x);
    }
    if (trace && tc.isEntryEnabled())
        Tr.exit(this, tc, "validate", result);
    return result;
}

19 Source : RLSControllerImpl.java
with Eclipse Public License 1.0
from OpenLiberty

// ------------------------------------------------------------------------------
// Method: RecoveryLogService.notifyTimeout
// ------------------------------------------------------------------------------
/**
 * Called by the RLSSuspendTokenManager in the event of
 * a suspension timeout occurring
 *
 * We need to check, if as a result of a suspension timing out,
 * whether we should resume the RLS.
 *
 * We will resume only if there are no other outstanding active suspensions
 *
 * @return boolean isSuspended
 */
static void notifyTimeout() {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "notifyTimeout");
    synchronized (SUSPEND_LOCK) {
        // Check if there are any outstanding suspends
        if (_tokenManager.isResumable()) {
            if (tc.isEventEnabled())
                Tr.event(tc, "Resuming recovery log service following a suspension timeout");
            _isSuspended = false;
            Tr.info(tc, "CWRLS0023_RESUME_RLS");
            // Notify all waiting threads that
            // normal service is resumed
            SUSPEND_LOCK.notifyAll();
        }
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "notifyTimeout");
}

19 Source : RLSControllerImpl.java
with Eclipse Public License 1.0
from OpenLiberty

// ------------------------------------------------------------------------------
// Method: RLSControllerImpl.suspendRLS
// ------------------------------------------------------------------------------
/**
 * Suspend i/o to the recovery log files
 * timeout : 0 = no timeout, > 0 and < 1,000,000,000 is timeout in seconds
 */
private static RLSSuspendToken suspendRLS(int timeout) throws RLSTimeoutRangeException {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "suspendRLS", timeout);
    if (timeout < 0 || timeout > 1000000000) {
        if (tc.isEventEnabled())
            Tr.event(tc, "Timeout value is out of range - throwing RLSTimeoutRangeException", timeout);
        if (tc.isEntryEnabled())
            Tr.exit(tc, "suspend", "RLSTimeoutRangeException");
        throw new RLSTimeoutRangeException();
    }
    RLSSuspendToken token = null;
    synchronized (SUSPEND_LOCK) {
        // If the server is not configured to be snapshot safe
        // then we should put out a warning message
        Tr.warning(tc, "CWRLS0020_SNAPSHOT_SAFE");
        // Notify the token manager that the RLS has been called to suspend
        token = _tokenManager.registerSuspend(timeout);
        Tr.info(tc, "CWRLS0001_SUSPEND_RLS", token);
        // RLS has not already been suspended
        // Set suspended flag true
        _isSuspended = true;
    }
    if (tc.isEntryEnabled())
        Tr.exit(tc, "suspendRLS", token);
    // Return the RLSSuspendToken
    return token;
}

19 Source : RLSControllerImpl.java
with Eclipse Public License 1.0
from OpenLiberty

/**
 * Cancels the corresponding suspend operation, identified by the supplied token.
 *
 * If there are no outstanding suspend operation, then resumes i/o to the recovery log files.
 *
 * @param token identifies the corresponding suspend operation to cancel
 *
 * @exception RLSInvalidSuspendTokenException Thrown if token is null, invalid or has expired
 *
 * @exception RecoveryLogServiceException     Thrown if RecoveryLogService failed to resume
 */
@Override
public void resume(RLSSuspendToken token) throws RLSInvalidSuspendTokenException {
    if (tc.isEntryEnabled())
        Tr.entry(tc, "resume", token);
    RLSControllerImpl.resumeRLS(token);
    if (tc.isEntryEnabled())
        Tr.exit(tc, "resume");
}

See More Examples