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