001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 */ 016package org.forgerock.opendj.server.config.meta; 017 018 019 020import java.net.InetAddress; 021import java.util.Collection; 022import java.util.SortedSet; 023import org.forgerock.opendj.config.AdministratorAction; 024import org.forgerock.opendj.config.AliasDefaultBehaviorProvider; 025import org.forgerock.opendj.config.BooleanPropertyDefinition; 026import org.forgerock.opendj.config.ClassPropertyDefinition; 027import org.forgerock.opendj.config.client.ConcurrentModificationException; 028import org.forgerock.opendj.config.client.ManagedObject; 029import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException; 030import org.forgerock.opendj.config.client.OperationRejectedException; 031import org.forgerock.opendj.config.DefaultBehaviorProvider; 032import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider; 033import org.forgerock.opendj.config.EnumPropertyDefinition; 034import org.forgerock.opendj.config.IntegerPropertyDefinition; 035import org.forgerock.opendj.config.IPAddressMaskPropertyDefinition; 036import org.forgerock.opendj.config.IPAddressPropertyDefinition; 037import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException; 038import org.forgerock.opendj.config.ManagedObjectDefinition; 039import org.forgerock.opendj.config.PropertyException; 040import org.forgerock.opendj.config.PropertyOption; 041import org.forgerock.opendj.config.PropertyProvider; 042import org.forgerock.opendj.config.server.ConfigurationChangeListener; 043import org.forgerock.opendj.config.server.ServerManagedObject; 044import org.forgerock.opendj.config.StringPropertyDefinition; 045import org.forgerock.opendj.config.Tag; 046import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; 047import org.forgerock.opendj.ldap.AddressMask; 048import org.forgerock.opendj.ldap.DN; 049import org.forgerock.opendj.ldap.LdapException; 050import org.forgerock.opendj.server.config.client.SNMPConnectionHandlerCfgClient; 051import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg; 052import org.forgerock.opendj.server.config.server.SNMPConnectionHandlerCfg; 053 054 055 056/** 057 * An interface for querying the SNMP Connection Handler managed 058 * object definition meta information. 059 * <p> 060 * The SNMP Connection Handler can be used to process SNMP requests to 061 * retrieve monitoring information described by the MIB 2605. Supported 062 * protocol are SNMP V1, V2c and V3. 063 */ 064public final class SNMPConnectionHandlerCfgDefn extends ManagedObjectDefinition<SNMPConnectionHandlerCfgClient, SNMPConnectionHandlerCfg> { 065 066 /** The singleton configuration definition instance. */ 067 private static final SNMPConnectionHandlerCfgDefn INSTANCE = new SNMPConnectionHandlerCfgDefn(); 068 069 070 071 /** 072 * Defines the set of permissable values for the "security-level" property. 073 * <p> 074 * Specifies the type of security level : NoAuthNoPriv : No security 075 * mechanisms activated, AuthNoPriv : Authentication activated with 076 * no privacy, AuthPriv : Authentication with privacy activated. This 077 * property is required for SNMP V3 security configuration. 078 */ 079 public static enum SecurityLevel { 080 081 /** 082 * Authentication activated with no privacy. 083 */ 084 AUTHNOPRIV("authnopriv"), 085 086 087 088 /** 089 * Authentication with privacy activated. 090 */ 091 AUTHPRIV("authpriv"), 092 093 094 095 /** 096 * No security mechanisms activated. 097 */ 098 NOAUTHNOPRIV("noauthnopriv"); 099 100 101 102 /** String representation of the value. */ 103 private final String name; 104 105 106 107 /** Private constructor. */ 108 private SecurityLevel(String name) { this.name = name; } 109 110 111 112 /** {@inheritDoc} */ 113 public String toString() { return name; } 114 115 } 116 117 118 119 /** The "allowed-manager" property definition. */ 120 private static final StringPropertyDefinition PD_ALLOWED_MANAGER; 121 122 123 124 /** The "allowed-user" property definition. */ 125 private static final StringPropertyDefinition PD_ALLOWED_USER; 126 127 128 129 /** The "community" property definition. */ 130 private static final StringPropertyDefinition PD_COMMUNITY; 131 132 133 134 /** The "java-class" property definition. */ 135 private static final ClassPropertyDefinition PD_JAVA_CLASS; 136 137 138 139 /** The "listen-address" property definition. */ 140 private static final IPAddressPropertyDefinition PD_LISTEN_ADDRESS; 141 142 143 144 /** The "listen-port" property definition. */ 145 private static final IntegerPropertyDefinition PD_LISTEN_PORT; 146 147 148 149 /** The "opendmk-jarfile" property definition. */ 150 private static final StringPropertyDefinition PD_OPENDMK_JARFILE; 151 152 153 154 /** The "registered-mbean" property definition. */ 155 private static final BooleanPropertyDefinition PD_REGISTERED_MBEAN; 156 157 158 159 /** The "security-agent-file" property definition. */ 160 private static final StringPropertyDefinition PD_SECURITY_AGENT_FILE; 161 162 163 164 /** The "security-level" property definition. */ 165 private static final EnumPropertyDefinition<SecurityLevel> PD_SECURITY_LEVEL; 166 167 168 169 /** The "trap-port" property definition. */ 170 private static final IntegerPropertyDefinition PD_TRAP_PORT; 171 172 173 174 /** The "traps-community" property definition. */ 175 private static final StringPropertyDefinition PD_TRAPS_COMMUNITY; 176 177 178 179 /** The "traps-destination" property definition. */ 180 private static final StringPropertyDefinition PD_TRAPS_DESTINATION; 181 182 183 184 /** Build the "allowed-manager" property definition. */ 185 static { 186 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "allowed-manager"); 187 builder.setOption(PropertyOption.MULTI_VALUED); 188 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "allowed-manager")); 189 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("*"); 190 builder.setDefaultBehaviorProvider(provider); 191 PD_ALLOWED_MANAGER = builder.getInstance(); 192 INSTANCE.registerPropertyDefinition(PD_ALLOWED_MANAGER); 193 } 194 195 196 197 /** Build the "allowed-user" property definition. */ 198 static { 199 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "allowed-user"); 200 builder.setOption(PropertyOption.MULTI_VALUED); 201 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "allowed-user")); 202 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("*"); 203 builder.setDefaultBehaviorProvider(provider); 204 PD_ALLOWED_USER = builder.getInstance(); 205 INSTANCE.registerPropertyDefinition(PD_ALLOWED_USER); 206 } 207 208 209 210 /** Build the "community" property definition. */ 211 static { 212 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "community"); 213 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "community")); 214 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("OpenDJ"); 215 builder.setDefaultBehaviorProvider(provider); 216 PD_COMMUNITY = builder.getInstance(); 217 INSTANCE.registerPropertyDefinition(PD_COMMUNITY); 218 } 219 220 221 222 /** Build the "java-class" property definition. */ 223 static { 224 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 225 builder.setOption(PropertyOption.MANDATORY); 226 builder.setOption(PropertyOption.ADVANCED); 227 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "java-class")); 228 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.snmp.SNMPConnectionHandler"); 229 builder.setDefaultBehaviorProvider(provider); 230 builder.addInstanceOf("org.opends.server.api.ConnectionHandler"); 231 PD_JAVA_CLASS = builder.getInstance(); 232 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 233 } 234 235 236 237 /** Build the "listen-address" property definition. */ 238 static { 239 IPAddressPropertyDefinition.Builder builder = IPAddressPropertyDefinition.createBuilder(INSTANCE, "listen-address"); 240 builder.setOption(PropertyOption.MULTI_VALUED); 241 builder.setOption(PropertyOption.READ_ONLY); 242 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.SERVER_RESTART, INSTANCE, "listen-address")); 243 DefaultBehaviorProvider<InetAddress> provider = new DefinedDefaultBehaviorProvider<InetAddress>("0.0.0.0"); 244 builder.setDefaultBehaviorProvider(provider); 245 PD_LISTEN_ADDRESS = builder.getInstance(); 246 INSTANCE.registerPropertyDefinition(PD_LISTEN_ADDRESS); 247 } 248 249 250 251 /** Build the "listen-port" property definition. */ 252 static { 253 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "listen-port"); 254 builder.setOption(PropertyOption.MANDATORY); 255 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "listen-port")); 256 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>()); 257 builder.setUpperLimit(65535); 258 builder.setLowerLimit(1); 259 PD_LISTEN_PORT = builder.getInstance(); 260 INSTANCE.registerPropertyDefinition(PD_LISTEN_PORT); 261 } 262 263 264 265 /** Build the "opendmk-jarfile" property definition. */ 266 static { 267 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "opendmk-jarfile"); 268 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "opendmk-jarfile")); 269 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 270 PD_OPENDMK_JARFILE = builder.getInstance(); 271 INSTANCE.registerPropertyDefinition(PD_OPENDMK_JARFILE); 272 } 273 274 275 276 /** Build the "registered-mbean" property definition. */ 277 static { 278 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "registered-mbean"); 279 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "registered-mbean")); 280 DefaultBehaviorProvider<Boolean> provider = new DefinedDefaultBehaviorProvider<Boolean>("false"); 281 builder.setDefaultBehaviorProvider(provider); 282 PD_REGISTERED_MBEAN = builder.getInstance(); 283 INSTANCE.registerPropertyDefinition(PD_REGISTERED_MBEAN); 284 } 285 286 287 288 /** Build the "security-agent-file" property definition. */ 289 static { 290 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "security-agent-file"); 291 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "security-agent-file")); 292 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("config/snmp/security/opendj-snmp.security"); 293 builder.setDefaultBehaviorProvider(provider); 294 PD_SECURITY_AGENT_FILE = builder.getInstance(); 295 INSTANCE.registerPropertyDefinition(PD_SECURITY_AGENT_FILE); 296 } 297 298 299 300 /** Build the "security-level" property definition. */ 301 static { 302 EnumPropertyDefinition.Builder<SecurityLevel> builder = EnumPropertyDefinition.createBuilder(INSTANCE, "security-level"); 303 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "security-level")); 304 DefaultBehaviorProvider<SecurityLevel> provider = new DefinedDefaultBehaviorProvider<SecurityLevel>("authnopriv"); 305 builder.setDefaultBehaviorProvider(provider); 306 builder.setEnumClass(SecurityLevel.class); 307 PD_SECURITY_LEVEL = builder.getInstance(); 308 INSTANCE.registerPropertyDefinition(PD_SECURITY_LEVEL); 309 } 310 311 312 313 /** Build the "trap-port" property definition. */ 314 static { 315 IntegerPropertyDefinition.Builder builder = IntegerPropertyDefinition.createBuilder(INSTANCE, "trap-port"); 316 builder.setOption(PropertyOption.MANDATORY); 317 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "trap-port")); 318 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Integer>()); 319 PD_TRAP_PORT = builder.getInstance(); 320 INSTANCE.registerPropertyDefinition(PD_TRAP_PORT); 321 } 322 323 324 325 /** Build the "traps-community" property definition. */ 326 static { 327 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "traps-community"); 328 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "traps-community")); 329 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("OpenDJ"); 330 builder.setDefaultBehaviorProvider(provider); 331 PD_TRAPS_COMMUNITY = builder.getInstance(); 332 INSTANCE.registerPropertyDefinition(PD_TRAPS_COMMUNITY); 333 } 334 335 336 337 /** Build the "traps-destination" property definition. */ 338 static { 339 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "traps-destination"); 340 builder.setOption(PropertyOption.MULTI_VALUED); 341 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "traps-destination")); 342 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "traps-destination")); 343 PD_TRAPS_DESTINATION = builder.getInstance(); 344 INSTANCE.registerPropertyDefinition(PD_TRAPS_DESTINATION); 345 } 346 347 348 349 // Register the tags associated with this managed object definition. 350 static { 351 INSTANCE.registerTag(Tag.valueOf("core-server")); 352 } 353 354 355 356 /** 357 * Get the SNMP Connection Handler configuration definition 358 * singleton. 359 * 360 * @return Returns the SNMP Connection Handler configuration 361 * definition singleton. 362 */ 363 public static SNMPConnectionHandlerCfgDefn getInstance() { 364 return INSTANCE; 365 } 366 367 368 369 /** 370 * Private constructor. 371 */ 372 private SNMPConnectionHandlerCfgDefn() { 373 super("snmp-connection-handler", ConnectionHandlerCfgDefn.getInstance()); 374 } 375 376 377 378 /** {@inheritDoc} */ 379 public SNMPConnectionHandlerCfgClient createClientConfiguration( 380 ManagedObject<? extends SNMPConnectionHandlerCfgClient> impl) { 381 return new SNMPConnectionHandlerCfgClientImpl(impl); 382 } 383 384 385 386 /** {@inheritDoc} */ 387 public SNMPConnectionHandlerCfg createServerConfiguration( 388 ServerManagedObject<? extends SNMPConnectionHandlerCfg> impl) { 389 return new SNMPConnectionHandlerCfgServerImpl(impl); 390 } 391 392 393 394 /** {@inheritDoc} */ 395 public Class<SNMPConnectionHandlerCfg> getServerConfigurationClass() { 396 return SNMPConnectionHandlerCfg.class; 397 } 398 399 400 401 /** 402 * Get the "allowed-client" property definition. 403 * <p> 404 * Specifies a set of host names or address masks that determine the 405 * clients that are allowed to establish connections to this SNMP 406 * Connection Handler. 407 * <p> 408 * Valid values include a host name, a fully qualified domain name, 409 * a domain name, an IP address, or a subnetwork with subnetwork 410 * mask. 411 * 412 * @return Returns the "allowed-client" property definition. 413 */ 414 public IPAddressMaskPropertyDefinition getAllowedClientPropertyDefinition() { 415 return ConnectionHandlerCfgDefn.getInstance().getAllowedClientPropertyDefinition(); 416 } 417 418 419 420 /** 421 * Get the "allowed-manager" property definition. 422 * <p> 423 * Specifies the hosts of the managers to be granted the access 424 * rights. This property is required for SNMP v1 and v2 security 425 * configuration. An asterisk (*) opens access to all managers. 426 * 427 * @return Returns the "allowed-manager" property definition. 428 */ 429 public StringPropertyDefinition getAllowedManagerPropertyDefinition() { 430 return PD_ALLOWED_MANAGER; 431 } 432 433 434 435 /** 436 * Get the "allowed-user" property definition. 437 * <p> 438 * Specifies the users to be granted the access rights. This 439 * property is required for SNMP v3 security configuration. An 440 * asterisk (*) opens access to all users. 441 * 442 * @return Returns the "allowed-user" property definition. 443 */ 444 public StringPropertyDefinition getAllowedUserPropertyDefinition() { 445 return PD_ALLOWED_USER; 446 } 447 448 449 450 /** 451 * Get the "community" property definition. 452 * <p> 453 * Specifies the v1,v2 community or the v3 context name allowed to 454 * access the MIB 2605 monitoring information or the USM MIB. The 455 * mapping between "community" and "context name" is set. 456 * 457 * @return Returns the "community" property definition. 458 */ 459 public StringPropertyDefinition getCommunityPropertyDefinition() { 460 return PD_COMMUNITY; 461 } 462 463 464 465 /** 466 * Get the "denied-client" property definition. 467 * <p> 468 * Specifies a set of host names or address masks that determine the 469 * clients that are not allowed to establish connections to this SNMP 470 * Connection Handler. 471 * <p> 472 * Valid values include a host name, a fully qualified domain name, 473 * a domain name, an IP address, or a subnetwork with subnetwork 474 * mask. If both allowed and denied client masks are defined and a 475 * client connection matches one or more masks in both lists, then 476 * the connection is denied. If only a denied list is specified, then 477 * any client not matching a mask in that list is allowed. 478 * 479 * @return Returns the "denied-client" property definition. 480 */ 481 public IPAddressMaskPropertyDefinition getDeniedClientPropertyDefinition() { 482 return ConnectionHandlerCfgDefn.getInstance().getDeniedClientPropertyDefinition(); 483 } 484 485 486 487 /** 488 * Get the "enabled" property definition. 489 * <p> 490 * Indicates whether the SNMP Connection Handler is enabled. 491 * 492 * @return Returns the "enabled" property definition. 493 */ 494 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 495 return ConnectionHandlerCfgDefn.getInstance().getEnabledPropertyDefinition(); 496 } 497 498 499 500 /** 501 * Get the "java-class" property definition. 502 * <p> 503 * Specifies the fully-qualified name of the Java class that 504 * provides the SNMP Connection Handler implementation. 505 * 506 * @return Returns the "java-class" property definition. 507 */ 508 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 509 return PD_JAVA_CLASS; 510 } 511 512 513 514 /** 515 * Get the "listen-address" property definition. 516 * <p> 517 * Specifies the address or set of addresses on which this SNMP 518 * Connection Handler should listen for connections from SNMP 519 * clients. 520 * <p> 521 * Multiple addresses may be provided as separate values for this 522 * attribute. If no values are provided, then the SNMP Connection 523 * Handler listens on all interfaces. 524 * 525 * @return Returns the "listen-address" property definition. 526 */ 527 public IPAddressPropertyDefinition getListenAddressPropertyDefinition() { 528 return PD_LISTEN_ADDRESS; 529 } 530 531 532 533 /** 534 * Get the "listen-port" property definition. 535 * <p> 536 * Specifies the port number on which the SNMP Connection Handler 537 * will listen for connections from clients. 538 * <p> 539 * Only a single port number may be provided. 540 * 541 * @return Returns the "listen-port" property definition. 542 */ 543 public IntegerPropertyDefinition getListenPortPropertyDefinition() { 544 return PD_LISTEN_PORT; 545 } 546 547 548 549 /** 550 * Get the "opendmk-jarfile" property definition. 551 * <p> 552 * Indicates the OpenDMK runtime jar file location 553 * 554 * @return Returns the "opendmk-jarfile" property definition. 555 */ 556 public StringPropertyDefinition getOpendmkJarfilePropertyDefinition() { 557 return PD_OPENDMK_JARFILE; 558 } 559 560 561 562 /** 563 * Get the "registered-mbean" property definition. 564 * <p> 565 * Indicates whether the SNMP objects have to be registered in the 566 * directory server MBeanServer or not allowing to access SNMP 567 * Objects with RMI connector if enabled. 568 * 569 * @return Returns the "registered-mbean" property definition. 570 */ 571 public BooleanPropertyDefinition getRegisteredMbeanPropertyDefinition() { 572 return PD_REGISTERED_MBEAN; 573 } 574 575 576 577 /** 578 * Get the "security-agent-file" property definition. 579 * <p> 580 * Specifies the USM security configuration to receive authenticated 581 * only SNMP requests. 582 * 583 * @return Returns the "security-agent-file" property definition. 584 */ 585 public StringPropertyDefinition getSecurityAgentFilePropertyDefinition() { 586 return PD_SECURITY_AGENT_FILE; 587 } 588 589 590 591 /** 592 * Get the "security-level" property definition. 593 * <p> 594 * Specifies the type of security level : NoAuthNoPriv : No security 595 * mechanisms activated, AuthNoPriv : Authentication activated with 596 * no privacy, AuthPriv : Authentication with privacy activated. This 597 * property is required for SNMP V3 security configuration. 598 * 599 * @return Returns the "security-level" property definition. 600 */ 601 public EnumPropertyDefinition<SecurityLevel> getSecurityLevelPropertyDefinition() { 602 return PD_SECURITY_LEVEL; 603 } 604 605 606 607 /** 608 * Get the "trap-port" property definition. 609 * <p> 610 * Specifies the port to use to send SNMP Traps. 611 * 612 * @return Returns the "trap-port" property definition. 613 */ 614 public IntegerPropertyDefinition getTrapPortPropertyDefinition() { 615 return PD_TRAP_PORT; 616 } 617 618 619 620 /** 621 * Get the "traps-community" property definition. 622 * <p> 623 * Specifies the community string that must be included in the traps 624 * sent to define managers (trap-destinations). This property is used 625 * in the context of SNMP v1, v2 and v3. 626 * 627 * @return Returns the "traps-community" property definition. 628 */ 629 public StringPropertyDefinition getTrapsCommunityPropertyDefinition() { 630 return PD_TRAPS_COMMUNITY; 631 } 632 633 634 635 /** 636 * Get the "traps-destination" property definition. 637 * <p> 638 * Specifies the hosts to which V1 traps will be sent. V1 Traps are 639 * sent to every host listed. 640 * <p> 641 * If this list is empty, V1 traps are sent to "localhost". Each 642 * host in the list must be identifed by its name or complete IP 643 * Addess. 644 * 645 * @return Returns the "traps-destination" property definition. 646 */ 647 public StringPropertyDefinition getTrapsDestinationPropertyDefinition() { 648 return PD_TRAPS_DESTINATION; 649 } 650 651 652 653 /** 654 * Managed object client implementation. 655 */ 656 private static class SNMPConnectionHandlerCfgClientImpl implements 657 SNMPConnectionHandlerCfgClient { 658 659 /** Private implementation. */ 660 private ManagedObject<? extends SNMPConnectionHandlerCfgClient> impl; 661 662 663 664 /** Private constructor. */ 665 private SNMPConnectionHandlerCfgClientImpl( 666 ManagedObject<? extends SNMPConnectionHandlerCfgClient> impl) { 667 this.impl = impl; 668 } 669 670 671 672 /** {@inheritDoc} */ 673 public SortedSet<AddressMask> getAllowedClient() { 674 return impl.getPropertyValues(INSTANCE.getAllowedClientPropertyDefinition()); 675 } 676 677 678 679 /** {@inheritDoc} */ 680 public void setAllowedClient(Collection<AddressMask> values) { 681 impl.setPropertyValues(INSTANCE.getAllowedClientPropertyDefinition(), values); 682 } 683 684 685 686 /** {@inheritDoc} */ 687 public SortedSet<String> getAllowedManager() { 688 return impl.getPropertyValues(INSTANCE.getAllowedManagerPropertyDefinition()); 689 } 690 691 692 693 /** {@inheritDoc} */ 694 public void setAllowedManager(Collection<String> values) { 695 impl.setPropertyValues(INSTANCE.getAllowedManagerPropertyDefinition(), values); 696 } 697 698 699 700 /** {@inheritDoc} */ 701 public SortedSet<String> getAllowedUser() { 702 return impl.getPropertyValues(INSTANCE.getAllowedUserPropertyDefinition()); 703 } 704 705 706 707 /** {@inheritDoc} */ 708 public void setAllowedUser(Collection<String> values) { 709 impl.setPropertyValues(INSTANCE.getAllowedUserPropertyDefinition(), values); 710 } 711 712 713 714 /** {@inheritDoc} */ 715 public String getCommunity() { 716 return impl.getPropertyValue(INSTANCE.getCommunityPropertyDefinition()); 717 } 718 719 720 721 /** {@inheritDoc} */ 722 public void setCommunity(String value) { 723 impl.setPropertyValue(INSTANCE.getCommunityPropertyDefinition(), value); 724 } 725 726 727 728 /** {@inheritDoc} */ 729 public SortedSet<AddressMask> getDeniedClient() { 730 return impl.getPropertyValues(INSTANCE.getDeniedClientPropertyDefinition()); 731 } 732 733 734 735 /** {@inheritDoc} */ 736 public void setDeniedClient(Collection<AddressMask> values) { 737 impl.setPropertyValues(INSTANCE.getDeniedClientPropertyDefinition(), values); 738 } 739 740 741 742 /** {@inheritDoc} */ 743 public Boolean isEnabled() { 744 return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 745 } 746 747 748 749 /** {@inheritDoc} */ 750 public void setEnabled(boolean value) { 751 impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value); 752 } 753 754 755 756 /** {@inheritDoc} */ 757 public String getJavaClass() { 758 return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 759 } 760 761 762 763 /** {@inheritDoc} */ 764 public void setJavaClass(String value) { 765 impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value); 766 } 767 768 769 770 /** {@inheritDoc} */ 771 public SortedSet<InetAddress> getListenAddress() { 772 return impl.getPropertyValues(INSTANCE.getListenAddressPropertyDefinition()); 773 } 774 775 776 777 /** {@inheritDoc} */ 778 public void setListenAddress(Collection<InetAddress> values) throws PropertyException { 779 impl.setPropertyValues(INSTANCE.getListenAddressPropertyDefinition(), values); 780 } 781 782 783 784 /** {@inheritDoc} */ 785 public Integer getListenPort() { 786 return impl.getPropertyValue(INSTANCE.getListenPortPropertyDefinition()); 787 } 788 789 790 791 /** {@inheritDoc} */ 792 public void setListenPort(int value) { 793 impl.setPropertyValue(INSTANCE.getListenPortPropertyDefinition(), value); 794 } 795 796 797 798 /** {@inheritDoc} */ 799 public String getOpendmkJarfile() { 800 return impl.getPropertyValue(INSTANCE.getOpendmkJarfilePropertyDefinition()); 801 } 802 803 804 805 /** {@inheritDoc} */ 806 public void setOpendmkJarfile(String value) { 807 impl.setPropertyValue(INSTANCE.getOpendmkJarfilePropertyDefinition(), value); 808 } 809 810 811 812 /** {@inheritDoc} */ 813 public boolean isRegisteredMbean() { 814 return impl.getPropertyValue(INSTANCE.getRegisteredMbeanPropertyDefinition()); 815 } 816 817 818 819 /** {@inheritDoc} */ 820 public void setRegisteredMbean(Boolean value) { 821 impl.setPropertyValue(INSTANCE.getRegisteredMbeanPropertyDefinition(), value); 822 } 823 824 825 826 /** {@inheritDoc} */ 827 public String getSecurityAgentFile() { 828 return impl.getPropertyValue(INSTANCE.getSecurityAgentFilePropertyDefinition()); 829 } 830 831 832 833 /** {@inheritDoc} */ 834 public void setSecurityAgentFile(String value) { 835 impl.setPropertyValue(INSTANCE.getSecurityAgentFilePropertyDefinition(), value); 836 } 837 838 839 840 /** {@inheritDoc} */ 841 public SecurityLevel getSecurityLevel() { 842 return impl.getPropertyValue(INSTANCE.getSecurityLevelPropertyDefinition()); 843 } 844 845 846 847 /** {@inheritDoc} */ 848 public void setSecurityLevel(SecurityLevel value) { 849 impl.setPropertyValue(INSTANCE.getSecurityLevelPropertyDefinition(), value); 850 } 851 852 853 854 /** {@inheritDoc} */ 855 public Integer getTrapPort() { 856 return impl.getPropertyValue(INSTANCE.getTrapPortPropertyDefinition()); 857 } 858 859 860 861 /** {@inheritDoc} */ 862 public void setTrapPort(int value) { 863 impl.setPropertyValue(INSTANCE.getTrapPortPropertyDefinition(), value); 864 } 865 866 867 868 /** {@inheritDoc} */ 869 public String getTrapsCommunity() { 870 return impl.getPropertyValue(INSTANCE.getTrapsCommunityPropertyDefinition()); 871 } 872 873 874 875 /** {@inheritDoc} */ 876 public void setTrapsCommunity(String value) { 877 impl.setPropertyValue(INSTANCE.getTrapsCommunityPropertyDefinition(), value); 878 } 879 880 881 882 /** {@inheritDoc} */ 883 public SortedSet<String> getTrapsDestination() { 884 return impl.getPropertyValues(INSTANCE.getTrapsDestinationPropertyDefinition()); 885 } 886 887 888 889 /** {@inheritDoc} */ 890 public void setTrapsDestination(Collection<String> values) { 891 impl.setPropertyValues(INSTANCE.getTrapsDestinationPropertyDefinition(), values); 892 } 893 894 895 896 /** {@inheritDoc} */ 897 public ManagedObjectDefinition<? extends SNMPConnectionHandlerCfgClient, ? extends SNMPConnectionHandlerCfg> definition() { 898 return INSTANCE; 899 } 900 901 902 903 /** {@inheritDoc} */ 904 public PropertyProvider properties() { 905 return impl; 906 } 907 908 909 910 /** {@inheritDoc} */ 911 public void commit() throws ManagedObjectAlreadyExistsException, 912 MissingMandatoryPropertiesException, ConcurrentModificationException, 913 OperationRejectedException, LdapException { 914 impl.commit(); 915 } 916 917 918 919 /** {@inheritDoc} */ 920 public String toString() { 921 return impl.toString(); 922 } 923 } 924 925 926 927 /** 928 * Managed object server implementation. 929 */ 930 private static class SNMPConnectionHandlerCfgServerImpl implements 931 SNMPConnectionHandlerCfg { 932 933 /** Private implementation. */ 934 private ServerManagedObject<? extends SNMPConnectionHandlerCfg> impl; 935 936 /** The value of the "allowed-client" property. */ 937 private final SortedSet<AddressMask> pAllowedClient; 938 939 /** The value of the "allowed-manager" property. */ 940 private final SortedSet<String> pAllowedManager; 941 942 /** The value of the "allowed-user" property. */ 943 private final SortedSet<String> pAllowedUser; 944 945 /** The value of the "community" property. */ 946 private final String pCommunity; 947 948 /** The value of the "denied-client" property. */ 949 private final SortedSet<AddressMask> pDeniedClient; 950 951 /** The value of the "enabled" property. */ 952 private final boolean pEnabled; 953 954 /** The value of the "java-class" property. */ 955 private final String pJavaClass; 956 957 /** The value of the "listen-address" property. */ 958 private final SortedSet<InetAddress> pListenAddress; 959 960 /** The value of the "listen-port" property. */ 961 private final int pListenPort; 962 963 /** The value of the "opendmk-jarfile" property. */ 964 private final String pOpendmkJarfile; 965 966 /** The value of the "registered-mbean" property. */ 967 private final boolean pRegisteredMbean; 968 969 /** The value of the "security-agent-file" property. */ 970 private final String pSecurityAgentFile; 971 972 /** The value of the "security-level" property. */ 973 private final SecurityLevel pSecurityLevel; 974 975 /** The value of the "trap-port" property. */ 976 private final int pTrapPort; 977 978 /** The value of the "traps-community" property. */ 979 private final String pTrapsCommunity; 980 981 /** The value of the "traps-destination" property. */ 982 private final SortedSet<String> pTrapsDestination; 983 984 985 986 /** Private constructor. */ 987 private SNMPConnectionHandlerCfgServerImpl(ServerManagedObject<? extends SNMPConnectionHandlerCfg> impl) { 988 this.impl = impl; 989 this.pAllowedClient = impl.getPropertyValues(INSTANCE.getAllowedClientPropertyDefinition()); 990 this.pAllowedManager = impl.getPropertyValues(INSTANCE.getAllowedManagerPropertyDefinition()); 991 this.pAllowedUser = impl.getPropertyValues(INSTANCE.getAllowedUserPropertyDefinition()); 992 this.pCommunity = impl.getPropertyValue(INSTANCE.getCommunityPropertyDefinition()); 993 this.pDeniedClient = impl.getPropertyValues(INSTANCE.getDeniedClientPropertyDefinition()); 994 this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 995 this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 996 this.pListenAddress = impl.getPropertyValues(INSTANCE.getListenAddressPropertyDefinition()); 997 this.pListenPort = impl.getPropertyValue(INSTANCE.getListenPortPropertyDefinition()); 998 this.pOpendmkJarfile = impl.getPropertyValue(INSTANCE.getOpendmkJarfilePropertyDefinition()); 999 this.pRegisteredMbean = impl.getPropertyValue(INSTANCE.getRegisteredMbeanPropertyDefinition()); 1000 this.pSecurityAgentFile = impl.getPropertyValue(INSTANCE.getSecurityAgentFilePropertyDefinition()); 1001 this.pSecurityLevel = impl.getPropertyValue(INSTANCE.getSecurityLevelPropertyDefinition()); 1002 this.pTrapPort = impl.getPropertyValue(INSTANCE.getTrapPortPropertyDefinition()); 1003 this.pTrapsCommunity = impl.getPropertyValue(INSTANCE.getTrapsCommunityPropertyDefinition()); 1004 this.pTrapsDestination = impl.getPropertyValues(INSTANCE.getTrapsDestinationPropertyDefinition()); 1005 } 1006 1007 1008 1009 /** {@inheritDoc} */ 1010 public void addSNMPChangeListener( 1011 ConfigurationChangeListener<SNMPConnectionHandlerCfg> listener) { 1012 impl.registerChangeListener(listener); 1013 } 1014 1015 1016 1017 /** {@inheritDoc} */ 1018 public void removeSNMPChangeListener( 1019 ConfigurationChangeListener<SNMPConnectionHandlerCfg> listener) { 1020 impl.deregisterChangeListener(listener); 1021 } 1022 /** {@inheritDoc} */ 1023 public void addChangeListener( 1024 ConfigurationChangeListener<ConnectionHandlerCfg> listener) { 1025 impl.registerChangeListener(listener); 1026 } 1027 1028 1029 1030 /** {@inheritDoc} */ 1031 public void removeChangeListener( 1032 ConfigurationChangeListener<ConnectionHandlerCfg> listener) { 1033 impl.deregisterChangeListener(listener); 1034 } 1035 1036 1037 1038 /** {@inheritDoc} */ 1039 public SortedSet<AddressMask> getAllowedClient() { 1040 return pAllowedClient; 1041 } 1042 1043 1044 1045 /** {@inheritDoc} */ 1046 public SortedSet<String> getAllowedManager() { 1047 return pAllowedManager; 1048 } 1049 1050 1051 1052 /** {@inheritDoc} */ 1053 public SortedSet<String> getAllowedUser() { 1054 return pAllowedUser; 1055 } 1056 1057 1058 1059 /** {@inheritDoc} */ 1060 public String getCommunity() { 1061 return pCommunity; 1062 } 1063 1064 1065 1066 /** {@inheritDoc} */ 1067 public SortedSet<AddressMask> getDeniedClient() { 1068 return pDeniedClient; 1069 } 1070 1071 1072 1073 /** {@inheritDoc} */ 1074 public boolean isEnabled() { 1075 return pEnabled; 1076 } 1077 1078 1079 1080 /** {@inheritDoc} */ 1081 public String getJavaClass() { 1082 return pJavaClass; 1083 } 1084 1085 1086 1087 /** {@inheritDoc} */ 1088 public SortedSet<InetAddress> getListenAddress() { 1089 return pListenAddress; 1090 } 1091 1092 1093 1094 /** {@inheritDoc} */ 1095 public int getListenPort() { 1096 return pListenPort; 1097 } 1098 1099 1100 1101 /** {@inheritDoc} */ 1102 public String getOpendmkJarfile() { 1103 return pOpendmkJarfile; 1104 } 1105 1106 1107 1108 /** {@inheritDoc} */ 1109 public boolean isRegisteredMbean() { 1110 return pRegisteredMbean; 1111 } 1112 1113 1114 1115 /** {@inheritDoc} */ 1116 public String getSecurityAgentFile() { 1117 return pSecurityAgentFile; 1118 } 1119 1120 1121 1122 /** {@inheritDoc} */ 1123 public SecurityLevel getSecurityLevel() { 1124 return pSecurityLevel; 1125 } 1126 1127 1128 1129 /** {@inheritDoc} */ 1130 public int getTrapPort() { 1131 return pTrapPort; 1132 } 1133 1134 1135 1136 /** {@inheritDoc} */ 1137 public String getTrapsCommunity() { 1138 return pTrapsCommunity; 1139 } 1140 1141 1142 1143 /** {@inheritDoc} */ 1144 public SortedSet<String> getTrapsDestination() { 1145 return pTrapsDestination; 1146 } 1147 1148 1149 1150 /** {@inheritDoc} */ 1151 public Class<? extends SNMPConnectionHandlerCfg> configurationClass() { 1152 return SNMPConnectionHandlerCfg.class; 1153 } 1154 1155 1156 1157 /** {@inheritDoc} */ 1158 public DN dn() { 1159 return impl.getDN(); 1160 } 1161 1162 1163 1164 /** {@inheritDoc} */ 1165 public String toString() { 1166 return impl.toString(); 1167 } 1168 } 1169}