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