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