001    /*
002     * Copyright 2012-2015 UnboundID Corp.
003     * All Rights Reserved.
004     */
005    /*
006     * Copyright (C) 2015 UnboundID Corp.
007     *
008     * This program is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU General Public License (GPLv2 only)
010     * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011     * as published by the Free Software Foundation.
012     *
013     * This program is distributed in the hope that it will be useful,
014     * but WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016     * GNU General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with this program; if not, see <http://www.gnu.org/licenses>.
020     */
021    package com.unboundid.ldap.sdk.unboundidds.controls;
022    
023    
024    
025    import com.unboundid.ldap.sdk.Control;
026    import com.unboundid.ldap.sdk.LDAPException;
027    import com.unboundid.ldap.sdk.ResultCode;
028    import com.unboundid.util.NotMutable;
029    import com.unboundid.util.ThreadSafety;
030    import com.unboundid.util.ThreadSafetyLevel;
031    
032    import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033    
034    
035    
036    /**
037     * <BLOCKQUOTE>
038     *   <B>NOTE:</B>  This class is part of the Commercial Edition of the UnboundID
039     *   LDAP SDK for Java.  It is not available for use in applications that
040     *   include only the Standard Edition of the LDAP SDK, and is not supported for
041     *   use in conjunction with non-UnboundID products.
042     * </BLOCKQUOTE>
043     * This class provides a request control which may be used to request that the
044     * server return resource limit information for the authenticated user in the
045     * response to a successful bind operation.  Resource limits that may be
046     * returned include custom size limit, time limit, idle time limit, lookthrough
047     * limit, equivalent authorization user DN, client connection policy name, and
048     * privilege names.
049     * <BR><BR>
050     * This control does not have a value.  The criticality may be either
051     * {@code true} or {@code false}.
052     *
053     * @see GetUserResourceLimitsResponseControl
054     */
055    @NotMutable()
056    @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
057    public final class GetUserResourceLimitsRequestControl
058           extends Control
059    {
060      /**
061       * The OID (1.3.6.1.4.1.30221.2.5.25) for the get user resource limits request
062       * control.
063       */
064      public static final String GET_USER_RESOURCE_LIMITS_REQUEST_OID =
065           "1.3.6.1.4.1.30221.2.5.25";
066    
067    
068    
069      /**
070       * The serial version UID for this serializable class.
071       */
072      private static final long serialVersionUID = 3355139762944763749L;
073    
074    
075    
076      /**
077       * Creates a new get user resource limits request control.  It will not be
078       * marked critical.
079       */
080      public GetUserResourceLimitsRequestControl()
081      {
082        this(false);
083      }
084    
085    
086    
087      /**
088       * Creates a new get user resource limits request control with the specified
089       * criticality.
090       *
091       * @param  isCritical  Indicates whether this control should be marked
092       *                     critical.
093       */
094      public GetUserResourceLimitsRequestControl(final boolean isCritical)
095      {
096        super(GET_USER_RESOURCE_LIMITS_REQUEST_OID, isCritical,  null);
097      }
098    
099    
100    
101      /**
102       * Creates a new get user resource limits request control which is decoded
103       * from the provided generic control.
104       *
105       * @param  control  The generic control to be decoded as a get user resource
106       *                  limits request control.
107       *
108       * @throws  LDAPException  If the provided control cannot be decoded as a get
109       *                         user resource limits request control.
110       */
111      public GetUserResourceLimitsRequestControl(final Control control)
112             throws LDAPException
113      {
114        super(control);
115    
116        if (control.hasValue())
117        {
118          throw new LDAPException(ResultCode.DECODING_ERROR,
119               ERR_GET_USER_RESOURCE_LIMITS_REQUEST_HAS_VALUE.get());
120        }
121      }
122    
123    
124    
125      /**
126       * {@inheritDoc}
127       */
128      @Override()
129      public String getControlName()
130      {
131        return INFO_CONTROL_NAME_GET_USER_RESOURCE_LIMITS_REQUEST.get();
132      }
133    
134    
135    
136      /**
137       * {@inheritDoc}
138       */
139      @Override()
140      public void toString(final StringBuilder buffer)
141      {
142        buffer.append("GetUserResourceLimitsRequestControl(isCritical=");
143        buffer.append(isCritical());
144        buffer.append(')');
145      }
146    }