001/*
002 * Copyright 2011-2022 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2011-2022 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) 2011-2022 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.listener;
037
038
039
040import java.util.Collection;
041import java.util.Collections;
042import java.util.List;
043import java.util.Map;
044import java.util.Set;
045import java.util.logging.Handler;
046
047import com.unboundid.ldap.sdk.DN;
048import com.unboundid.ldap.sdk.LDAPException;
049import com.unboundid.ldap.sdk.OperationType;
050import com.unboundid.ldap.sdk.schema.Schema;
051import com.unboundid.util.NotMutable;
052import com.unboundid.util.NotNull;
053import com.unboundid.util.Nullable;
054import com.unboundid.util.ThreadSafety;
055import com.unboundid.util.ThreadSafetyLevel;
056
057
058
059/**
060 * This class provides a read-only representation of an
061 * {@link InMemoryDirectoryServerConfig} object.  All methods for reading the
062 * configuration will work the same as they do in the superclass, but any
063 * methods which attempt to alter the configuration will throw an
064 * {@code UnsupportedOperationException}.
065 */
066@NotMutable()
067@ThreadSafety(level=ThreadSafetyLevel.NOT_THREADSAFE)
068public final class ReadOnlyInMemoryDirectoryServerConfig
069       extends InMemoryDirectoryServerConfig
070{
071  /**
072   * Creates a new read-only representation of an in-memory directory server
073   * config object using the provided configuration.
074   *
075   * @param  config  The configuration to use for this read-only representation.
076   */
077  public ReadOnlyInMemoryDirectoryServerConfig(
078              @NotNull final InMemoryDirectoryServerConfig config)
079  {
080    super(config);
081  }
082
083
084
085  /**
086   * {@inheritDoc}
087   */
088  @Override()
089  @NotNull()
090  public DN[] getBaseDNs()
091  {
092    final DN[] origBaseDNs = super.getBaseDNs();
093
094    final DN[] baseDNsCopy = new DN[origBaseDNs.length];
095    System.arraycopy(origBaseDNs, 0, baseDNsCopy, 0, baseDNsCopy.length);
096
097    return baseDNsCopy;
098  }
099
100
101
102  /**
103   * {@inheritDoc}  This method will always throw an
104   * {@code UnsupportedOperationException}.
105   *
106   * @throws  UnsupportedOperationException  To indicate that this object cannot
107   *                                         be altered.
108   */
109  @Override()
110  public void setBaseDNs(@NotNull final String... baseDNs)
111         throws LDAPException, UnsupportedOperationException
112  {
113    throw new UnsupportedOperationException();
114  }
115
116
117
118  /**
119   * {@inheritDoc}  This method will always throw an
120   * {@code UnsupportedOperationException}.
121   *
122   * @throws  UnsupportedOperationException  To indicate that this object cannot
123   *                                         be altered.
124   */
125  @Override()
126  public void setBaseDNs(@NotNull final DN... baseDNs)
127         throws LDAPException, UnsupportedOperationException
128  {
129    throw new UnsupportedOperationException();
130  }
131
132
133
134  /**
135   * {@inheritDoc}  The returned list will not be modifiable.
136   */
137  @Override()
138  @NotNull()
139  public List<InMemoryListenerConfig> getListenerConfigs()
140  {
141    return Collections.unmodifiableList(super.getListenerConfigs());
142  }
143
144
145
146  /**
147   * {@inheritDoc}  This method will always throw an
148   * {@code UnsupportedOperationException}.
149   *
150   * @throws  UnsupportedOperationException  To indicate that this object cannot
151   *                                         be altered.
152   */
153  @Override()
154  public void setListenerConfigs(
155                   @NotNull final InMemoryListenerConfig... listenerConfigs)
156         throws UnsupportedOperationException
157  {
158    throw new UnsupportedOperationException();
159  }
160
161
162
163  /**
164   * {@inheritDoc}  This method will always throw an
165   * {@code UnsupportedOperationException}.
166   *
167   * @throws  UnsupportedOperationException  To indicate that this object cannot
168   *                                         be altered.
169   */
170  @Override()
171  public void setListenerConfigs(
172              @NotNull final Collection<InMemoryListenerConfig> listenerConfigs)
173         throws UnsupportedOperationException
174  {
175    throw new UnsupportedOperationException();
176  }
177
178
179
180  /**
181   * {@inheritDoc}  The returned set will not be modifiable.
182   */
183  @Override()
184  @NotNull()
185  public Set<OperationType> getAllowedOperationTypes()
186  {
187    return Collections.unmodifiableSet(super.getAllowedOperationTypes());
188  }
189
190
191
192  /**
193   * {@inheritDoc}  This method will always throw an
194   * {@code UnsupportedOperationException}.
195   *
196   * @throws  UnsupportedOperationException  To indicate that this object cannot
197   *                                         be altered.
198   */
199  @Override()
200  public void setAllowedOperationTypes(
201                   @Nullable final OperationType... operationTypes)
202         throws UnsupportedOperationException
203  {
204    throw new UnsupportedOperationException();
205  }
206
207
208
209  /**
210   * {@inheritDoc}  This method will always throw an
211   * {@code UnsupportedOperationException}.
212   *
213   * @throws  UnsupportedOperationException  To indicate that this object cannot
214   *                                         be altered.
215   */
216  @Override()
217  public void setAllowedOperationTypes(
218                   @Nullable final Collection<OperationType> operationTypes)
219         throws UnsupportedOperationException
220  {
221    throw new UnsupportedOperationException();
222  }
223
224
225
226  /**
227   * {@inheritDoc}  The returned set will not be modifiable.
228   */
229  @Override()
230  @NotNull()
231  public Set<OperationType> getAuthenticationRequiredOperationTypes()
232  {
233    return Collections.unmodifiableSet(
234         super.getAuthenticationRequiredOperationTypes());
235  }
236
237
238
239  /**
240   * {@inheritDoc}  This method will always throw an
241   * {@code UnsupportedOperationException}.
242   *
243   * @throws  UnsupportedOperationException  To indicate that this object cannot
244   *                                         be altered.
245   */
246  @Override()
247  public void setAuthenticationRequiredOperationTypes(
248                   @Nullable final OperationType... operationTypes)
249         throws UnsupportedOperationException
250  {
251    throw new UnsupportedOperationException();
252  }
253
254
255
256  /**
257   * {@inheritDoc}  This method will always throw an
258   * {@code UnsupportedOperationException}.
259   *
260   * @throws  UnsupportedOperationException  To indicate that this object cannot
261   *                                         be altered.
262   */
263  @Override()
264  public void setAuthenticationRequiredOperationTypes(
265                   @Nullable final Collection<OperationType> operationTypes)
266         throws UnsupportedOperationException
267  {
268    throw new UnsupportedOperationException();
269  }
270
271
272
273  /**
274   * {@inheritDoc}  The returned map will not be modifiable.
275   */
276  @Override()
277  @NotNull()
278  public Map<DN,byte[]> getAdditionalBindCredentials()
279  {
280    return Collections.unmodifiableMap(super.getAdditionalBindCredentials());
281  }
282
283
284
285  /**
286   * {@inheritDoc}  This method will always throw an
287   * {@code UnsupportedOperationException}.
288   *
289   * @throws  UnsupportedOperationException  To indicate that this object cannot
290   *                                         be altered.
291   */
292  @Override()
293  public void addAdditionalBindCredentials(@NotNull final String dn,
294                                           @NotNull final String password)
295         throws LDAPException, UnsupportedOperationException
296  {
297    throw new UnsupportedOperationException();
298  }
299
300
301
302  /**
303   * {@inheritDoc}  This method will always throw an
304   * {@code UnsupportedOperationException}.
305   *
306   * @throws  UnsupportedOperationException  To indicate that this object cannot
307   *                                         be altered.
308   */
309  @Override()
310  public void addAdditionalBindCredentials(@NotNull final String dn,
311                                           @NotNull final byte[] password)
312         throws LDAPException, UnsupportedOperationException
313  {
314    throw new UnsupportedOperationException();
315  }
316
317
318
319  /**
320   * {@inheritDoc}  This method will always throw an
321   * {@code UnsupportedOperationException}.
322   *
323   * @throws  UnsupportedOperationException  To indicate that this object cannot
324   *                                         be altered.
325   */
326  @Override()
327  public void setListenerExceptionHandler(
328                   @NotNull final LDAPListenerExceptionHandler exceptionHandler)
329         throws UnsupportedOperationException
330  {
331    throw new UnsupportedOperationException();
332  }
333
334
335
336  /**
337   * {@inheritDoc}  This method will always throw an
338   * {@code UnsupportedOperationException}.
339   *
340   * @throws  UnsupportedOperationException  To indicate that this object cannot
341   *                                         be altered.
342   */
343  @Override()
344  public void setSchema(@Nullable final Schema schema)
345         throws UnsupportedOperationException
346  {
347    throw new UnsupportedOperationException();
348  }
349
350
351
352  /**
353   * {@inheritDoc}  This method will always throw an
354   * {@code UnsupportedOperationException}.
355   */
356  @Override()
357  public void setEnforceAttributeSyntaxCompliance(
358                   final boolean enforceAttributeSyntaxCompliance)
359  {
360    throw new UnsupportedOperationException();
361  }
362
363
364
365  /**
366   * {@inheritDoc}  This method will always throw an
367   * {@code UnsupportedOperationException}.
368   */
369  @Override()
370  public void setEnforceSingleStructuralObjectClass(
371                   final boolean enforceSingleStructuralObjectClass)
372  {
373    throw new UnsupportedOperationException();
374  }
375
376
377
378  /**
379   * {@inheritDoc}  This method will always throw an
380   * {@code UnsupportedOperationException}.
381   *
382   * @throws  UnsupportedOperationException  To indicate that this object cannot
383   *                                         be altered.
384   */
385  @Override()
386  public void setAccessLogHandler(@Nullable final Handler accessLogHandler)
387         throws UnsupportedOperationException
388  {
389    throw new UnsupportedOperationException();
390  }
391
392
393
394  /**
395   * {@inheritDoc}  This method will always throw an
396   * {@code UnsupportedOperationException}.
397   *
398   * @throws  UnsupportedOperationException  To indicate that this object cannot
399   *                                         be altered.
400   */
401  @Override()
402  public void setLDAPDebugLogHandler(
403                   @Nullable final Handler ldapDebugLogHandler)
404         throws UnsupportedOperationException
405  {
406    throw new UnsupportedOperationException();
407  }
408
409
410
411  /**
412   * {@inheritDoc}  The returned list will not be modifiable.
413   */
414  @Override()
415  @NotNull()
416  public List<InMemoryExtendedOperationHandler> getExtendedOperationHandlers()
417  {
418    return Collections.unmodifiableList(super.getExtendedOperationHandlers());
419  }
420
421
422
423  /**
424   * {@inheritDoc}  This method will always throw an
425   * {@code UnsupportedOperationException}.
426   *
427   * @throws  UnsupportedOperationException  To indicate that this object cannot
428   *                                         be altered.
429   */
430  @Override()
431  public void addExtendedOperationHandler(
432                   @NotNull final InMemoryExtendedOperationHandler handler)
433         throws UnsupportedOperationException
434  {
435    throw new UnsupportedOperationException();
436  }
437
438
439
440  /**
441   * {@inheritDoc}  The returned list will not be modifiable.
442   */
443  @Override()
444  @NotNull()
445  public List<InMemorySASLBindHandler> getSASLBindHandlers()
446  {
447    return Collections.unmodifiableList(super.getSASLBindHandlers());
448  }
449
450
451
452  /**
453   * {@inheritDoc}  This method will always throw an
454   * {@code UnsupportedOperationException}.
455   *
456   * @throws  UnsupportedOperationException  To indicate that this object cannot
457   *                                         be altered.
458   */
459  @Override()
460  public void addSASLBindHandler(@NotNull final InMemorySASLBindHandler handler)
461         throws UnsupportedOperationException
462  {
463    throw new UnsupportedOperationException();
464  }
465
466
467
468  /**
469   * {@inheritDoc}  This method will always throw an
470   * {@code UnsupportedOperationException}.
471   *
472   * @throws  UnsupportedOperationException  To indicate that this object cannot
473   *                                         be altered.
474   */
475  @Override()
476  public void setGenerateOperationalAttributes(
477                   final boolean generateOperationalAttributes)
478         throws UnsupportedOperationException
479  {
480    throw new UnsupportedOperationException();
481  }
482
483
484
485  /**
486   * {@inheritDoc}  This method will always throw an
487   * {@code UnsupportedOperationException}.
488   *
489   * @throws  UnsupportedOperationException  To indicate that this object cannot
490   *                                         be altered.
491   */
492  @Override()
493  public void setMaxChangeLogEntries(final int maxChangeLogEntries)
494         throws UnsupportedOperationException
495  {
496    throw new UnsupportedOperationException();
497  }
498
499
500
501  /**
502   * {@inheritDoc}  The returned list will not be modifiable.
503   */
504  @Override()
505  @NotNull()
506  public List<String> getEqualityIndexAttributes()
507  {
508    return Collections.unmodifiableList(super.getEqualityIndexAttributes());
509  }
510
511
512
513  /**
514   * {@inheritDoc}  This method will always throw an
515   * {@code UnsupportedOperationException}.
516   *
517   * @throws  UnsupportedOperationException  To indicate that this object cannot
518   *                                         be altered.
519   */
520  @Override()
521  public void setEqualityIndexAttributes(
522                   @Nullable final String... equalityIndexAttributes)
523         throws UnsupportedOperationException
524  {
525    throw new UnsupportedOperationException();
526  }
527
528
529
530  /**
531   * {@inheritDoc}  This method will always throw an
532   * {@code UnsupportedOperationException}.
533   *
534   * @throws  UnsupportedOperationException  To indicate that this object cannot
535   *                                         be altered.
536   */
537  @Override()
538  public void setEqualityIndexAttributes(
539                   @Nullable final Collection<String> equalityIndexAttributes)
540         throws UnsupportedOperationException
541  {
542    throw new UnsupportedOperationException();
543  }
544
545
546
547  /**
548   * {@inheritDoc}  The returned set will not be modifiable.
549   */
550  @Override()
551  @NotNull()
552  public Set<String> getReferentialIntegrityAttributes()
553  {
554    return Collections.unmodifiableSet(
555         super.getReferentialIntegrityAttributes());
556  }
557
558
559
560  /**
561   * {@inheritDoc}  This method will always throw an
562   * {@code UnsupportedOperationException}.
563   *
564   * @throws  UnsupportedOperationException  To indicate that this object cannot
565   *                                         be altered.
566   */
567  @Override()
568  public void setReferentialIntegrityAttributes(
569                   @Nullable final String... referentialIntegrityAttributes)
570         throws UnsupportedOperationException
571  {
572    throw new UnsupportedOperationException();
573  }
574
575
576
577  /**
578   * {@inheritDoc}  This method will always throw an
579   * {@code UnsupportedOperationException}.
580   *
581   * @throws  UnsupportedOperationException  To indicate that this object cannot
582   *                                         be altered.
583   */
584  @Override()
585  public void setReferentialIntegrityAttributes(
586              @Nullable final Collection<String> referentialIntegrityAttributes)
587         throws UnsupportedOperationException
588  {
589    throw new UnsupportedOperationException();
590  }
591
592
593
594  /**
595   * {@inheritDoc}  This method will always throw an
596   * {@code UnsupportedOperationException}.
597   *
598   * @throws  UnsupportedOperationException  To indicate that this object cannot
599   *                                         be altered.
600   */
601  @Override()
602  public void setVendorName(@Nullable final String vendorName)
603         throws UnsupportedOperationException
604  {
605    throw new UnsupportedOperationException();
606  }
607
608
609
610  /**
611   * {@inheritDoc}  This method will always throw an
612   * {@code UnsupportedOperationException}.
613   *
614   * @throws  UnsupportedOperationException  To indicate that this object cannot
615   *                                         be altered.
616   */
617  @Override()
618  public void setVendorVersion(@Nullable final String vendorVersion)
619         throws UnsupportedOperationException
620  {
621    throw new UnsupportedOperationException();
622  }
623}