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