KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > DuplicateRegistrationException


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - DuplicateRegistrationException.java
4   _##
5   _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21
22 package org.snmp4j.agent;
23
24 /**
25  * A <code>DuplicateRegistrationException</code> is thrown when a managed object
26  * registration attempt conflicts with an existing registration because their
27  * scope's overlap.
28  *
29  * @author Frank Fock
30  * @version 1.1
31  */

32 public class DuplicateRegistrationException extends MOException {
33
34   private static final long serialVersionUID = 2067223495895115541L;
35
36   private MOScope scope;
37   private MOScope duplicate;
38
39   public DuplicateRegistrationException() {
40   }
41
42   public DuplicateRegistrationException(String JavaDoc message) {
43     super(message);
44   }
45
46   public DuplicateRegistrationException(MOScope registrationScope) {
47     super(registrationScope.toString());
48     this.scope = registrationScope;
49   }
50
51   public DuplicateRegistrationException(MOScope registrationScope,
52                                         MOScope registeredScope) {
53     super(registrationScope.toString());
54     this.scope = registrationScope;
55     this.duplicate = registeredScope;
56   }
57
58   /**
59    * Returns the scope of the failed registration attempt.
60    * @return
61    * a <code>MOScope</code> instance, typically a {@link MOContextScope}.
62    */

63   public MOScope getRegistrationScope() {
64     return scope;
65   }
66
67   /**
68    * Returns the scope that is already registered and overlaps with the scope
69    * returned by {@link #getRegistrationScope()}.
70    * @return
71    * a <code>MOScope</code> instance.
72    * @since 1.1
73    */

74   public MOScope getRegisteredScope() {
75     return duplicate;
76   }
77
78 }
79
Popular Tags