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