KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > mo > MOFactory


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - MOFactory.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.mo;
23
24 import org.snmp4j.smi.OID;
25 import org.snmp4j.smi.Variable;
26 import org.snmp4j.agent.MOAccess;
27 import org.snmp4j.agent.mo.snmp.tc.TextualConvention;
28 // for JavaDoc
29
import org.snmp4j.smi.SMIConstants;
30
31 /**
32  * The <code>MOFactory</code> interface provides factory methods for creating
33  * all types of managed objects known by SNMP4J-Agent. By using this factory
34  * instead of creating the managed objects and related objects directly,
35  * one can easily install a sort of aspect oriented layer into the managed
36  * object instrumentation.
37  *
38  * @author Frank Fock
39  * @version 1.1
40  */

41 public interface MOFactory extends MOTableRowFactory {
42
43   /**
44    * Adds a textual convention to this factory which can then be used by the
45    * factory to create appropriate value constraints for columnar and scalar
46    * managed objects.
47    * @param tc
48    * a TextualConvention instance.
49    */

50   void addTextualConvention(TextualConvention tc);
51
52   /**
53    * Removes the supplied textual convention from the supported TCs by this
54    * ManagedObject factory.
55    * @param tc
56    * a TextualConvention instance.
57    */

58   void removeTextualConvention(TextualConvention tc);
59
60   /**
61    * Gets the textual convention described by the TC's name and the MIB module
62    * name of the MIB module specifying the TC.
63    * @param moduleName
64    * the name of the MIB module that defines the TC.
65    * @param name
66    * the object name of the TC.
67    * @return
68    * the <code>TextualConvention</code> that matches the given values, or
69    * <code>null</code> if such a TC is not registered with this factory.
70    */

71   TextualConvention getTextualConvention(String JavaDoc moduleName, String JavaDoc name);
72
73   /**
74    * Creates an MOAccess instance from an access specification constant that is
75    * the result of a bitwise OR of any of the constants defined by
76    * {@link MOAccess}.
77    *
78    * @param moAccess
79    * any bitwise OR combined constant from {@link MOAccess}.
80    * @return
81    * a MOAccess instance.
82    */

83   MOAccess createAccess(int moAccess);
84
85   /**
86    * Creates a MOTable instance for the supplied OID, index definition, and
87    * columns with the {@link DefaultMOMutableTableModel} as table model.
88    * @param oid
89    * the OID of the table entry (thus table OID + ".1").
90    * @param indexDef
91    * the index defintion of the table.
92    * @param columns
93    * the columns for the new table as an array of <code>MOColumn</code>
94    * instances.
95    * @return
96    * a MOTable instance.
97    */

98   MOTable createTable(OID oid, MOTableIndex indexDef, MOColumn[] columns);
99
100   /**
101    * Creates a MOTable instance for the supplied OID, index definition,
102    * columns, and table model.
103    * @param oid
104    * the OID of the table entry (thus table OID + ".1").
105    * @param indexDef
106    * the index defintion of the table.
107    * @param columns
108    * the columns for the new table as an array of <code>MOColumn</code>
109    * instances.
110    * @param model
111    * the table model to use for the table.
112    * @return
113    * a MOTable instance.
114    */

115   MOTable createTable(OID oid, MOTableIndex indexDef,
116                       MOColumn[] columns, MOTableModel model);
117
118   /**
119    * Creates an index definition from the supplied sub-index definitions without
120    * index validation.
121    * @param subIndexes
122    * an array of <code>MOTableSubIndex</code> instances defining the sub-
123    * index values of this index.
124    * @param impliedLength
125    * indicates whether the last variable length sub-index value has an
126    * implied length or not (default is false).
127    * @return MOTableIndex
128    * a <code>MOTableIndex</code> instance.
129    */

130   MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength);
131
132
133   /**
134    * Creates an index definition from the supplied sub-index definitions with
135    * index validation according to the supplied validator.
136    * @param subIndexes
137    * an array of <code>MOTableSubIndex</code> instances defining the sub-
138    * index values of this index.
139    * @param impliedLength
140    * indicates whether the last variable length sub-index value has an
141    * implied length or not (default is false).
142    * @param validator
143    * an index validator to check index values.
144    * @return MOTableIndex
145    * a <code>MOTableIndex</code> instance.
146    */

147   MOTableIndex createIndex(MOTableSubIndex[] subIndexes, boolean impliedLength,
148                            MOTableIndexValidator validator);
149
150   /**
151    * Creates a sub-index definition.
152    * @param smiSyntax
153    * the SMI syntax as defined by {@link SMIConstants}.
154    * @return
155    * a <code>MOTableSubIndex</code> instance.
156    * @deprecated
157    * Use the createSubIndex methods with oid instead.
158    */

159   MOTableSubIndex createSubIndex(int smiSyntax);
160
161   /**
162    * Creates a sub-index definition.
163    * @param smiSyntax
164    * the SMI syntax as defined by {@link SMIConstants}.
165    * @param minLength
166    * the minimum length in sub-identifiers (without length sub-id) of the
167    * sub-index.
168    * @param maxLength
169    * the maximum length in sub-identifiers (without length sub-id) of the
170    * sub-index.
171    * @return
172    * a <code>MOTableSubIndex</code> instance.
173    * @deprecated
174    * Use the createSubIndex methods with oid instead.
175    */

176   MOTableSubIndex createSubIndex(int smiSyntax, int minLength, int maxLength);
177
178   /**
179    * Creates a sub-index definition.
180    * @param oid
181    * the object identifier of the OBJECT-TYPE that defines this sub-index
182    * or <code>null</code> if that information is not available. An non
183    * <code>null</code> is required for AgentX shared tables.
184    * @param smiSyntax
185    * the SMI syntax as defined by {@link SMIConstants}.
186    * @return
187    * a <code>MOTableSubIndex</code> instance.
188    * @since 1.1
189    */

190   MOTableSubIndex createSubIndex(OID oid, int smiSyntax);
191
192   /**
193    * Creates a sub-index definition.
194    * @param oid
195    * the object identifier of the OBJECT-TYPE that defines this sub-index
196    * or <code>null</code> if that information is not available. An non
197    * <code>null</code> is required for AgentX shared tables.
198    * @param smiSyntax
199    * the SMI syntax as defined by {@link SMIConstants}.
200    * @param minLength
201    * the minimum length in sub-identifiers (without length sub-id) of the
202    * sub-index.
203    * @param maxLength
204    * the maximum length in sub-identifiers (without length sub-id) of the
205    * sub-index.
206    * @return
207    * a <code>MOTableSubIndex</code> instance.
208    * @since 1.1
209    */

210   MOTableSubIndex createSubIndex(OID oid,
211                                  int smiSyntax, int minLength, int maxLength);
212
213   /**
214    * Creates a columnar object by supplying column ID, syntax, and maximum
215    * access. Use this method for columns not based on a textual convention.
216    *
217    * @param columnID
218    * the column ID of the column. The column ID is the last sub-identifier
219    * of a column definition. It is NOT the index of the column.
220    * @param syntax
221    * the SMI syntax of the column as defined by {@link SMIConstants}.
222    * @param access
223    * the maximum access supported by this column.
224    * @return
225    * a <code>MOColumn</code> instance.
226    */

227   MOColumn createColumn(int columnID, int syntax, MOAccess access);
228
229   /**
230    * Creates a columnar object by supplying column ID, syntax, and maximum
231    * access. Use this method for columns based on the textual convention.
232    *
233    * @param columnID
234    * the column ID of the column. The column ID is the last sub-identifier
235    * of a column definition. It is NOT the index of the column.
236    * @param syntax
237    * the (effective) SMI syntax of the column as defined by
238    * {@link SMIConstants}.
239    * @param access
240    * the maximum access supported by this column.
241    * @param tcModuleName
242    * the MIB module name that defines the textual conventions.
243    * @param textualConvention
244    * the object name of the textual convention on which this column is based.
245    * @return
246    * a <code>MOColumn</code> instance.
247    */

248   MOColumn createColumn(int columnID, int syntax, MOAccess access,
249                         String JavaDoc tcModuleName, String JavaDoc textualConvention);
250
251   /**
252    * Creates a columnar object by supplying column ID, syntax, and maximum
253    * access. Use this method for columns based on the textual convention.
254    *
255    * @param columnID
256    * the column ID of the column. The column ID is the last sub-identifier
257    * of a column definition. It is NOT the index of the column.
258    * @param syntax
259    * the (effective) SMI syntax of the column as defined by
260    * {@link SMIConstants}.
261    * @param access
262    * the maximum access supported by this column.
263    * @param defaultValue
264    * the default value defined by the DEFVAL clause for this column.
265    * @param mutableInService
266    * if <code>true</code> this object may be changed while it is active
267    * (inService), otherwise such an attempt will be rejected with a
268    * inconsistentValue error.
269    * @return
270    * a <code>MOColumn</code> instance.
271    */

272   MOColumn createColumn(int columnID, int syntax, MOAccess access,
273                         Variable defaultValue, boolean mutableInService);
274
275   /**
276    * Creates a columnar object by supplying column ID, syntax, and maximum
277    * access. Use this method for columns based on the textual convention.
278    *
279    * @param columnID
280    * the column ID of the column. The column ID is the last sub-identifier
281    * of a column definition. It is NOT the index of the column.
282    * @param syntax
283    * the (effective) SMI syntax of the column as defined by
284    * {@link SMIConstants}.
285    * @param access
286    * the maximum access supported by this column.
287    * @param defaultValue
288    * the default value defined by the DEFVAL clause for this column.
289    * @param mutableInService
290    * if <code>true</code> this object may be changed while it is active
291    * (inService), otherwise such an attempt will be rejected with a
292    * inconsistentValue error.
293    * @param tcModuleName
294    * the MIB module name that defines the textual conventions.
295    * @param textualConvention
296    * the object name of the textual convention on which this column is based.
297    * @return
298    * a <code>MOColumn</code> instance.
299    */

300   MOColumn createColumn(int columnID, int syntax, MOAccess access,
301                         Variable defaultValue, boolean mutableInService,
302                         String JavaDoc tcModuleName, String JavaDoc textualConvention);
303
304   /**
305    * Creates a table model (by default a {@link DefaultMOMutableTableModel}).
306    * @param tableOID
307    * the table's OID for which this model is created.
308    * @param indexDef
309    * the index definition for the table.
310    * @param columns
311    * the columns defined for the table.
312    * @return
313    * a <code>MOTableModel</code> instance.
314    * @since 1.1
315    */

316   MOTableModel createTableModel(OID tableOID, MOTableIndex indexDef,
317                                 MOColumn[] columns);
318
319   /**
320    * Creates a scalar object from a OID, maximum access, and value.
321    * @param id
322    * the OID of the scalar (including the .0 suffix).
323    * @param access
324    * the maximum access supported by this scalar.
325    * @param value
326    * the (initial) value of the scalar.
327    * @return
328    * a <code>MOScalar</code> instance.
329    */

330   MOScalar createScalar(OID id, MOAccess access, Variable value);
331
332   /**
333    * Creates a scalar object from a OID, maximum access, and value.
334    * @param id
335    * the OID of the scalar (including the .0 suffix).
336    * @param access
337    * the maximum access supported by this scalar.
338    * @param value
339    * the (initial) value of the scalar.
340    * @param tcModuleName
341    * the MIB module name that defines the textual conventions.
342    * @param textualConvention
343    * the object name of the textual convention on which this scalar is based.
344    * @return
345    * a <code>MOScalar</code> instance.
346    */

347   MOScalar createScalar(OID id, MOAccess access, Variable value,
348                         String JavaDoc tcModuleName, String JavaDoc textualConvention);
349
350   /**
351    * Creates a relation between two tables. Related tables share one or more
352    * sub-indexes beginning with the first sub-index.
353    * @param baseTable
354    * the base table.
355    * @param dependentTable
356    * the dependent or augmenting table.
357    * @return
358    * a <code>MOTableRelation</code> instance relating the supplied tables.
359    */

360   MOTableRelation createTableRelation(MOTable baseTable,
361                                       MOTable dependentTable);
362 }
363
Popular Tags