org.snmp4j.agent
Class MOQueryWithSource

java.lang.Object
  extended by org.snmp4j.agent.DefaultMOQuery
      extended by org.snmp4j.agent.MOQueryWithSource
All Implemented Interfaces:
MOQuery

public class MOQueryWithSource
extends DefaultMOQuery

The MOQueryWithSource class is the implementation of a managed object query for a Request. It is used to lookup managed objects, for example in a MOServer repository.

Since:
2.0
Version:
2.0
Author:
Frank Fock

Constructor Summary
MOQueryWithSource(MOContextScope scope, boolean isWriteAccessIntended, java.lang.Object source)
          Creates a context aware query from a context aware OID scope.
 
Method Summary
 java.lang.Object getSource()
          Gets the source (Request) object on whose behalf this query is executed.
static boolean isSameSource(MOQuery query, java.lang.Object source)
          This method checks whether the supplied query and the given source reference refer to the same source (request).
 
Methods inherited from class org.snmp4j.agent.DefaultMOQuery
getScope, isWriteAccessQuery, matchesQuery, substractScope, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MOQueryWithSource

public MOQueryWithSource(MOContextScope scope,
                         boolean isWriteAccessIntended,
                         java.lang.Object source)
Creates a context aware query from a context aware OID scope.

Parameters:
scope - a scope that defines the possible result set of OIDs from a specific context for this query.
isWriteAccessIntended - indicates whether this query serves a write access on ManagedObjects or not.
source - the Request on whose behalf this query is being executed.
Since:
2.0
Method Detail

getSource

public java.lang.Object getSource()
Gets the source (Request) object on whose behalf this query is executed. This object reference can be used to determine whether a query needs to update ManagedObject content or not. When the reference is the same as those from the last query then an update is not necessary.

Returns:
an Object on whose behalf this query is executed which will be in most cases a Request instance, but code should not rely on that. If null is returned, the query source cannot be determined.
Since:
1.1

isSameSource

public static boolean isSameSource(MOQuery query,
                                   java.lang.Object source)
This method checks whether the supplied query and the given source reference refer to the same source (request).

Parameters:
query - a MOQuery instance.
source - any source object reference.
Returns:
true only if query is a DefaultMOQuery instance and getSource() == source and source is not null.
Since:
1.1

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.