001/*
002 * Copyright 2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2024 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2024 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk;
037
038
039
040import java.util.ArrayList;
041import java.util.Collections;
042import java.util.List;
043
044import com.unboundid.util.ThreadSafety;
045import com.unboundid.util.ThreadSafetyLevel;
046
047
048
049/**
050 * This class provides information about the current version of the UnboundID
051 * LDAP SDK for Java.
052 * <BR><BR>
053 * Note that if you reference the constant values directly in your source code,
054 * those constant values may be compiled into your source code directly rather
055 * than dynamically replacing them at runtime or when the class is loaded.  This
056 * means that if you swap out the LDAP SDK library after the source code has
057 * been compiled, the already-compiled code may not accurately reflect the
058 * values from the version of the LDAP SDK that is actually being used.  To
059 * avoid that, you may wish to use the provided methods to obtain the values
060 * rather than referencing the constants directly (e.g., use
061 * {@link #getProductName} instead of {@link #PRODUCT_NAME}).
062 */
063@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
064public final class Version
065{
066  //
067  // NOTE -- This file is dynamically generated.  Do not edit it.  If you need
068  //         to add something to it, then add it to the
069  //         resource/Version.java.stub file below the LDAP SDK build root.
070  //
071
072
073
074  /**
075   * The official full product name for the LDAP SDK.  For this build, the
076   * value is "UnboundID LDAP SDK for Java".
077   */
078  public static final String PRODUCT_NAME =
079       "UnboundID LDAP SDK for Java";
080
081
082
083  /**
084   * The short product name for the LDAP SDK.  This will not have any spaces.
085   * For this build, the value is "unboundid-ldapsdk".
086   */
087  public static final String SHORT_NAME =
088       "unboundid-ldapsdk";
089
090
091
092  /**
093   * The major version number for the LDAP SDK.  For this build, the value is
094   * 7.
095   */
096  public static final int MAJOR_VERSION = 7;
097
098
099
100  /**
101   * The minor version number for the LDAP SDK.  For this build, the value is
102   * 0.
103   */
104  public static final int MINOR_VERSION = 0;
105
106
107
108  /**
109   * The point version number for the LDAP SDK.  For this build, the value is
110   * 1.
111   */
112  public static final int POINT_VERSION = 1;
113
114
115
116  /**
117   * The version qualifier string for the LDAP SDK.  It will often be a
118   * zero-length string, but may be non-empty for special builds that should be
119   * tagged in some way (e.g., "-beta1" or "-rc2").  For this build, the value
120   * is "".
121   */
122  public static final String VERSION_QUALIFIER =
123       "";
124
125
126
127  /**
128   * A timestamp that indicates when this build of the LDAP SDK was generated.
129   * For this build, the value is "20240618150625Z".
130   */
131  public static final String BUILD_TIMESTAMP = "20240618150625Z";
132
133
134
135  /**
136   * The type of repository from which the source code used to build the LDAP
137   * SDK was retrieved.  It will be one of "subversion", "git", or "{unknown}".
138   * For this build, the value is "git".
139   */
140  public static final String REPOSITORY_TYPE = "git";
141
142
143
144  /**
145   * The URL for the repository from which the source code used to build the
146   * LDAP SDK was retrieved.  If repository information could not be determined
147   * at build time, then this will be a file URL that references the path to the
148   * source code on the system used to build the LDAP SDK library.  For this
149   * build, the value is
150   * "https://github.com/pingidentity/ldapsdk.git".
151   */
152  public static final String REPOSITORY_URL =
153       "https://github.com/pingidentity/ldapsdk.git";
154
155
156
157  /**
158   * The path to the LDAP SDK source code in the repository.  If repository
159   * information could not be determined at build time, then this will be "/".
160   * For this build, the value is
161   * "/".
162   */
163  public static final String REPOSITORY_PATH =
164       "/";
165
166
167
168  /**
169   * The string representation of the source revision from which this build of
170   * the LDAP SDK was generated.  For a subversion repository, this will be the
171   * string representation of the revision number.  For a git repository, this
172   * will be the hexadecimal representation of the digest for the most recent
173   * commit.  If repository information could not be determined at build time,
174   * the value will be "{unknown}".  For this build, the value is
175   * "b3aa7b0ed0d31f12faaddbdb312a6aa0480800d5".
176   */
177  public static final String REVISION_ID =
178       "b3aa7b0ed0d31f12faaddbdb312a6aa0480800d5";
179
180
181
182  /**
183   * The revision number for the source revision from which this build of the
184   * LDAP SDK was generated.  For a subversion repository, this will be the
185   * revision number.  For a git repository (which uses a hexadecimal digest to
186   * indicate revisions), or if repository information could not be determined
187   * at build time, the value will be -1.  For this build, the value is
188   * -1.
189   *
190   * @deprecated  Use the {@link #REVISION_ID} property instead, since it can
191   *              handle non-numeric revision identifiers.
192   */
193  @Deprecated()
194  public static final long REVISION_NUMBER = -1;
195
196
197
198  /**
199   * The full version string for the LDAP SDK.  For this build, the value is
200   * "UnboundID LDAP SDK for Java 7.0.1".
201   */
202  public static final String FULL_VERSION_STRING =
203       PRODUCT_NAME + ' ' + MAJOR_VERSION + '.' + MINOR_VERSION + '.' +
204       POINT_VERSION + VERSION_QUALIFIER;
205
206
207
208  /**
209   * The short version string for the LDAP SDK.  This will not have any spaces.
210   * For this build, the value is
211   * "unboundid-ldapsdk-7.0.1".
212   */
213  public static final String SHORT_VERSION_STRING =
214       SHORT_NAME + '-' + MAJOR_VERSION + '.' + MINOR_VERSION + '.' +
215       POINT_VERSION + VERSION_QUALIFIER;
216
217
218
219  /**
220   * The version number string for the LDAP SDK, which contains just the major,
221   * minor, and point version, and optional version qualifier.  For this build,
222   * the version string is
223   * "7.0.1".
224   */
225  public static final String NUMERIC_VERSION_STRING =
226       MAJOR_VERSION + "." + MINOR_VERSION + '.' +
227       POINT_VERSION + VERSION_QUALIFIER;
228
229
230
231  /**
232   * Prevent this class from being instantiated.
233   */
234  private Version()
235  {
236    // No implementation is required.
237  }
238
239
240
241  /**
242   * Prints version information from this class to standard output.
243   *
244   * @param  args  The command-line arguments provided to this program.
245   */
246  public static void main(final String... args)
247  {
248    for (final String line : getVersionLines())
249    {
250      System.out.println(line);
251    }
252  }
253
254
255
256  /**
257   * Retrieves the official full product name for the LDAP SDK.  For this build,
258   * the value is "UnboundID LDAP SDK for Java".
259   *
260   * @return  The official full product name for the LDAP SDK.
261   */
262  public static String getProductName()
263  {
264    return PRODUCT_NAME;
265  }
266
267
268
269  /**
270   * Retrieves the short product name for the LDAP SDK.  This will not have any
271   * spaces.  For this build, the value is "unboundid-ldapsdk".
272   *
273   * @return  The short product name for the LDAP SDK.
274   */
275  public static String getShortName()
276  {
277    return SHORT_NAME;
278  }
279
280
281
282  /**
283   * Retrieves the major version number for the LDAP SDK.  For this build, the
284   * value is 7.
285   *
286   * @return  The major version number for the LDAP SDK.
287   */
288  public static int getMajorVersion()
289  {
290    return MAJOR_VERSION;
291  }
292
293
294
295  /**
296   * Retrieves the minor version number for the LDAP SDK.  For this build, the
297   * value is 0.
298   *
299   * @return  The minor version number for the LDAP SDK.
300   */
301  public static int getMinorVersion()
302  {
303    return MINOR_VERSION;
304  }
305
306
307
308  /**
309   * Retrieves the point version number for the LDAP SDK.  For this build, the
310   * value is 1.
311   *
312   * @return  The point version number for the LDAP SDK.
313   */
314  public static int getPointVersion()
315  {
316    return POINT_VERSION;
317  }
318
319
320
321  /**
322   * Retrieves the version qualifier string for the LDAP SDK.  It will often be
323   * a zero-length string, but may be non-empty for special builds that should
324   * be tagged in some way (e.g., "-beta1" or "-rc2"). For this build, the value
325   * is "".
326   *
327   * @return  The version qualifier string for the LDAP SDK.
328   */
329  public static String getVersionQualifier()
330  {
331    return VERSION_QUALIFIER;
332  }
333
334
335
336  /**
337   * Retrieves a timestamp that indicates when this build of the LDAP SDK was
338   * generated.  For this build, the value is "20240618150625Z".
339   *
340   * @return  A timestamp that indicates when this build of the LDAP SDK was
341   *          generated.
342   */
343  public static String getBuildTimestamp()
344  {
345    return BUILD_TIMESTAMP;
346  }
347
348
349
350  /**
351   * Retrieves the type of repository from which the source code used to build
352   * the LDAP SDK was retrieved.  It will be one of "subversion", "git", or
353   * "{unknown}".  For this build, the value is "git".
354   *
355   * @return  The type of repository from which the source code used to build
356   *          the LDAP SDK was retrieved.
357   */
358  public static String getRepositoryType()
359  {
360    return REPOSITORY_TYPE;
361  }
362
363
364
365  /**
366   * Retrieves the URL for the repository from which the source code used to
367   * build the LDAP SDK was retrieved.  If repository information could not be
368   * determined at build time, then this will be a file URL that references the
369   * path to the source code on the system used to build the LDAP SDK library.
370   * For this build, the value is
371   * "https://github.com/pingidentity/ldapsdk.git".
372   *
373   * @return  The URL for the repository from which the source code used to
374   *          build the LDAP SDK was retrieved.
375   */
376  public static String getRepositoryURL()
377  {
378    return REPOSITORY_URL;
379  }
380
381
382
383  /**
384   * Retrieves the path to the LDAP SDK source code in the repository.  If
385   * repository information could not be determined at build time, then this
386   * will be "/".  For this build, the value is
387   * "/".
388   *
389   * @return  The path to the LDAP SDK source code in the repository.
390   */
391  public static String getRepositoryPath()
392  {
393    return REPOSITORY_PATH;
394  }
395
396
397
398  /**
399   * Retrieves the string representation of the source revision from which this
400   * build of the LDAP SDK was generated.  For a subversion repository, this
401   * will be the string representation of the revision number.  For a git
402   * repository, this will be the hexadecimal representation of the digest for
403   * the most recent commit.  If repository information could not be determined
404   * at build time, the value will be "{unknown}".  For this build, the value is
405   * "b3aa7b0ed0d31f12faaddbdb312a6aa0480800d5".
406   *
407   * @return  The string representation of the source revision from which this
408   *          build of the LDAP SDK was generated.
409   */
410  public static String getRevisionID()
411  {
412    return REVISION_ID;
413  }
414
415
416
417  /**
418   * Retrieves the full version string for the LDAP SDK.  For this build, the
419   * value is
420   * "UnboundID LDAP SDK for Java 7.0.1".
421   *
422   * @return  The full version string for the LDAP SDK.
423   */
424  public static String getFullVersionString()
425  {
426    return FULL_VERSION_STRING;
427  }
428
429
430
431  /**
432   * Retrieves the short version string for the LDAP SDK.  This will not have
433   * any spaces.  For this build, the value is
434   * "unboundid-ldapsdk-7.0.1".
435   *
436   * @return  The short version string for the LDAP SDK.
437   */
438  public static String getShortVersionString()
439  {
440    return SHORT_VERSION_STRING;
441  }
442
443
444
445  /**
446   * Retrieves the version number string for the LDAP SDK, which contains just
447   * the major, minor, and point version, and optional version qualifier.  For
448   * this build, the version string is
449   * "7.0.1".
450   *
451   * @return  The version number string for the LDAP SDK.
452   */
453  public static String getNumericVersionString()
454  {
455    return NUMERIC_VERSION_STRING;
456  }
457
458
459
460  /**
461   * Retrieves a list of lines containing information about the LDAP SDK
462   * version.
463   *
464   * @return  A list of lines containing information about the LDAP SDK
465   *          version.
466   */
467  public static List<String> getVersionLines()
468  {
469    final ArrayList<String> versionLines = new ArrayList<>(11);
470
471    versionLines.add("Full Version String:   " + FULL_VERSION_STRING);
472    versionLines.add("Short Version String:  " + SHORT_VERSION_STRING);
473    versionLines.add("Product Name:          " + PRODUCT_NAME);
474    versionLines.add("Short Name:            " + SHORT_NAME);
475    versionLines.add("Major Version:         " + MAJOR_VERSION);
476    versionLines.add("Minor Version:         " + MINOR_VERSION);
477    versionLines.add("Point Version:         " + POINT_VERSION);
478    versionLines.add("Version Qualifier:     " + VERSION_QUALIFIER);
479    versionLines.add("Build Timestamp:       " + BUILD_TIMESTAMP);
480    versionLines.add("Repository Type:       " + REPOSITORY_TYPE);
481    versionLines.add("Repository URL:        " + REPOSITORY_URL);
482    versionLines.add("Repository Path:       " + REPOSITORY_PATH);
483    versionLines.add("Revision:              " + REVISION_ID);
484
485    return Collections.unmodifiableList(versionLines);
486  }
487}