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