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