001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt.  If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 *      Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 *      Copyright 2010-2021 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.types;
028
029
030
031import java.util.Set;
032
033import com.unboundid.directory.sdk.common.operation.GenericResult;
034import com.unboundid.util.NotExtensible;
035import com.unboundid.util.ThreadSafety;
036import com.unboundid.util.ThreadSafetyLevel;
037
038
039
040/**
041 * This interface defines a set of methods that may be used to obtain
042 * information about an operation for which processing has been completed.
043 */
044@NotExtensible()
045@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
046public interface CompletedOperationContext
047       extends OperationContext
048{
049  /**
050   * Retrieves the time that the operation was added to the work queue, if
051   * available.    The value returned will be an offset in milliseconds since
052   * 12:00 a.m. on January 1, 1970.
053   *
054   * @return  The time that the operation was added to the work queue, or -1 if
055   *          the enqueue time is not available.
056   */
057  long getEnqueueTime();
058
059
060
061  /**
062   * Retrieves the time that the operation was removed from the work queue, if
063   * available.    The value returned will be an offset in milliseconds since
064   * 12:00 a.m. on January 1, 1970.
065   *
066   * @return  The time that the operation was removed form the work queue, or -1
067   *          if the dequeue time is not available.
068   */
069  long getDequeueTime();
070
071
072
073  /**
074   * Retrieves the length of time in milliseconds that the operation was held in
075   * the work queue before being picked up for processing by a worker thread.
076   *
077   * @return  The length of time in milliseconds that the operation was held in
078   *          the work queue, or -1 if the queue wait time is not available.
079   */
080  long getQueueWaitTimeMillis();
081
082
083
084  /**
085   * Retrieves the time that the worker thread began processing the operation.
086   * The value returned will be an offset in milliseconds since 12:00 a.m. on
087   * January 1, 1970.
088   *
089   * @return  The time that the worker thread began processing the operation.
090   */
091  long getProcessingStartTime();
092
093
094
095  /**
096   * Retrieves the time that the worker thread completed processing for the
097   * operation.  The value returned will be an offset in milliseconds since
098   * 12:00 a.m. on January 1, 1970.
099   *
100   * @return  The time that the worker thread completed processing for the
101   *          operation.
102   */
103  long getProcessingEndTime();
104
105
106
107  /**
108   * Retrieves the length of time in milliseconds that the worker thread spent
109   * processing the operation.
110   *
111   * @return  The length of time in milliseconds that the worker thread spent
112   *          processing the operation.
113   */
114  long getProcessingTimeMillis();
115
116
117
118  /**
119   * Retrieves the length of time in nanoseconds that the worker thread spent
120   * processing the operation.
121   *
122   * @return  The length of time in nanoseconds that the worker thread spent
123   *          processing the operation.
124   */
125  long getProcessingTimeNanos();
126
127
128
129  /**
130   * Retrieves information about the result of the operation processing.
131   *
132   * @return  Information about the result of the operation processing.
133   */
134  GenericResult getResult();
135
136
137
138  /**
139   * Retrieves the names of the privileges used in the course of processing the
140   * operation.  The set of defined privileges may be found in the
141   * privilege-list.html and privilege-list.csv files in the server docs
142   * directory.
143   *
144   * @param  includePreAuthorizationPrivileges  Indicates whether the returned
145   *                                            set of privileges should include
146   *                                            any privileges used before the
147   *                                            assignment of an alternate
148   *                                            authorization identity.
149   *
150   * @return  The names of the privileges used in the course of processing the
151   *          operation, or an empty set if no privileges were used.
152   */
153  Set<String> getUsedPrivilegeNames(
154                   final boolean includePreAuthorizationPrivileges);
155
156
157
158  /**
159   * Retrieves the names of any privileges used before the assignment of an
160   * alternate authorization identity.  If no alternate authorization identity
161   * was used, then this set will be empty.  If an alternate authorization
162   * identity was used, then it should include at least the proxied-auth
163   * privilege, but may include other privileges that had been used before the
164   * assignment of that alternate authorization identity.
165   * <BR><BR>
166   * The set of defined privileges may be found in the privilege-list.html and
167   * privilege-list.csv files in the server docs directory.
168   *
169   * @return  The names of any privileges used before the assignment of an
170   *          alternate authorization identity, or an set if no alternate
171   *          authorization identity was used.
172   */
173  Set<String> getPreAuthorizationUsedPrivilegeNames();
174
175
176
177  /**
178   * Retrieves the names of any privileges that were required during the course
179   * of processing the operation that the requester did not have.  The set of
180   * defined privileges may be found in the privilege-list.html and
181   * privilege-list.csv files in the server docs directory.
182   *
183   * @return  The names of any privileges that were required during the course
184   *          of processing the operation that the requester did not have, or an
185   *          empty set if the requester was not missing any required
186   *          privileges.
187   */
188  Set<String> getMissingPrivilegeNames();
189}