Class ServiceQuery<T>

java.lang.Object
jadex.providedservice.impl.search.ServiceQuery<T>

public class ServiceQuery<T> extends Object
Service query definition. T is the return type for search methods.
  • Field Details

    • PROXYTYPE_RAW

      public static final String PROXYTYPE_RAW
      The raw proxy type (i.e. no proxy).
      See Also:
    • PROXYTYPE_DIRECT

      public static final String PROXYTYPE_DIRECT
      The direct proxy type (supports custom interceptors, but uses caller thread).
      See Also:
    • PROXYTYPE_DECOUPLED

      public static final String PROXYTYPE_DECOUPLED
      The (default) decoupled proxy type (decouples from component thread to caller thread).
      See Also:
    • NETWORKS_NOT_SET

      public static final String[] NETWORKS_NOT_SET
      Marker for networks not set.
    • DEFAULT_MATCHINGMODES

      public static final Map<String,Boolean> DEFAULT_MATCHINGMODES
      Default matching modes set the elements with OR semantics.
    • servicetype

      protected jadex.common.ClassInfo servicetype
      The service type.
    • servicetags

      protected String[] servicetags
      Tags of the service.
    • serviceidentifier

      protected IServiceIdentifier serviceidentifier
      The service ID of the target service. Fast lookup of a service by id.
    • networknames

      protected String[] networknames
      The network names.
    • unrestricted

      protected Boolean unrestricted
      Should the service be unrestricted.
    • scope

      protected ServiceScope scope
      The search scope.
    • owner

      protected jadex.core.ComponentIdentifier owner
      The query owner. (rename queryowner?)
    • excludeowner

      protected boolean excludeowner
      Flag, if service by the query owner should be excluded, i.e. do not return my own service.
    • multiplicity

      protected ServiceQuery.Multiplicity multiplicity
      The multiple flag. Search for multiple services
    • eventmode

      protected boolean eventmode
      Flag if event mode is enabled on the query.
    • matchingmodes

      protected Map<String,Boolean> matchingmodes
      The matching mode for multivalued terms. True is and and false is or.
    • requiredproxytype

      protected String requiredproxytype
      Required service proxy type.
    • id

      protected String id
      The query id. Id is used for hashcode and equals and the same is used by servicequeryinfo class. Allows for hashing queryies and use a queryinfo object for lookup.
  • Constructor Details

    • ServiceQuery

      protected ServiceQuery()
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(Class<T> servicetype)
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(Class<T> servicetype, ServiceScope scope)
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(Class<T> servicetype, ServiceScope scope, jadex.core.ComponentIdentifier owner)
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(jadex.common.ClassInfo servicetype)
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(jadex.common.ClassInfo servicetype, ServiceScope scope, jadex.core.ComponentIdentifier owner)
      Create a new service query.
    • ServiceQuery

      public ServiceQuery(ServiceQuery<T> original)
      Shallow copy constructor.
      Parameters:
      original - Original query.
  • Method Details

    • getServiceType

      public jadex.common.ClassInfo getServiceType()
      Get the service type.
      Returns:
      The service type
    • setServiceType

      public ServiceQuery<T> setServiceType(jadex.common.ClassInfo servicetype)
      Set the service type.
      Parameters:
      type - The service type to set
    • setEventMode

      @Deprecated public void setEventMode(boolean eventmode)
      Deprecated.
      For bean purposes only, use setEventMode().
      Changes the query to event mode.
      Parameters:
      eventmode - the event mode state.
    • setEventMode

      public ServiceQuery<ServiceEvent> setEventMode()
      Changes the query to event mode.
      Returns:
      The new query.
    • isEventMode

      public boolean isEventMode()
      Checks if query is in event mode.
      Returns:
      True, if in event mode
    • getScope

      public ServiceScope getScope()
      Get the scope.
      Returns:
      The scope
    • setScope

      public ServiceQuery<T> setScope(ServiceScope scope)
      Set the scope.
      Parameters:
      scope - The scope to set
    • getServiceTags

      public String[] getServiceTags()
      Gets the service tags.
      Returns:
      The service tags.
    • setServiceTags

      public ServiceQuery<T> setServiceTags(String[] servicetags)
      Sets the service tags.
      Parameters:
      servicetags - The service tags. todo: move or refactor to hide complexity!?
    • setProvider

      public ServiceQuery<T> setProvider(jadex.core.ComponentIdentifier provider)
      Set the provider.
      Parameters:
      provider - The provider to set
    • getServiceIdentifier

      public IServiceIdentifier getServiceIdentifier()
      Gets the service identifier.
      Returns:
      The service identifier.
    • setServiceIdentifier

      public ServiceQuery<T> setServiceIdentifier(IServiceIdentifier serviceidentifier)
      Sets the service identifier. Also sets the corresponding provider when sid!=null.
      Parameters:
      serviceidentifier - The service identifier.
    • getOwner

      public jadex.core.ComponentIdentifier getOwner()
      Get the owner.
      Returns:
      The owner
    • setOwner

      public ServiceQuery<T> setOwner(jadex.core.ComponentIdentifier owner)
      Set the owner.
      Parameters:
      owner - The owner to set
    • isExcludeOwner

      public boolean isExcludeOwner()
      Checks if service of the query owner should be excluded.
      Returns:
      True, if the services should be excluded.
    • setExcludeOwner

      public ServiceQuery<T> setExcludeOwner(boolean excludeowner)
      Sets if service of the query owner should be excluded.
      Parameters:
      excludeowner - True, if the services should be excluded.
    • getId

      public String getId()
      Get the id.
      Returns:
      the id
    • setId

      public ServiceQuery<T> setId(String id)
      Set the id.
      Parameters:
      id - The id to set
    • getMultiplicity

      public ServiceQuery.Multiplicity getMultiplicity()
      Get the multiplicity.
      Returns:
      the multiplicity
    • setMultiplicity

      public ServiceQuery<T> setMultiplicity(int multiplicity)
      Set the multiplicity.
      Parameters:
      multiplicity - The minimum multiplicity to set
    • setMultiplicity

      public ServiceQuery<T> setMultiplicity(int multiplicitystart, int multiplicityend)
      Set the multiplicity.
      Parameters:
      multiplicitystart - The minimum multiplicity to set
      multiplicityend - The max multiplicity to set
    • setMultiplicity

      public ServiceQuery<T> setMultiplicity(ServiceQuery.Multiplicity multiplicity)
      Set the multiplicity.
      Parameters:
      multiplicity - The multiplicity to set
    • getIndexerSearchSpec

      public List<jadex.common.Tuple3<String,String[],Boolean>> getIndexerSearchSpec()
      Gets the specification for the indexer. Query needs to be enhanced before calling this method. See RequiredServiceFeature.enhanceQuery()
      Returns:
      The specification for the indexer.
    • getMatchingMode

      public Boolean getMatchingMode(String key)
      Get the matching mode for a key.
      Parameters:
      key - The key name.
      Returns:
      True for and, false for or.
    • setMatchingMode

      public ServiceQuery<T> setMatchingMode(String key, Boolean and)
      Set a matching mode.
      Parameters:
      key - The key name.
      and - True for and.
    • isUnrestricted

      public Boolean isUnrestricted()
      Get the unrestricted mode.
      Returns:
      The unrestricted mode.
    • setUnrestricted

      public ServiceQuery<T> setUnrestricted(Boolean unrestricted)
      Set the unrestricted mode.
      Parameters:
      unrestricted - the unrestricted to set
    • matchesKeys

      protected boolean matchesKeys(IServiceIdentifier service)
      Tests if the query keys matches a service.
      Parameters:
      service - The service.
      Returns:
      True, if the service matches the keys.
    • getNetworkNames

      public String[] getNetworkNames()
      Get the networknames.
      Returns:
      the networknames
    • setNetworkNames

      public ServiceQuery<T> setNetworkNames(String... networknames)
      Set the networknames.
      Parameters:
      networknames - The networknames to set
    • getRequiredProxyType

      public String getRequiredProxyType()
      Returns the requested required service proxy type.
      Returns:
      The requested required service proxy type.
    • setRequiredProxyType

      public ServiceQuery<T> setRequiredProxyType(String requiredproxytype)
      Sets the requested required service proxy type.
      Parameters:
      requiredproxytype - The requested required service proxy type.
    • hashCode

      public int hashCode()
      Get the hashcode.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Test if other object equals this one.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Get the string representation.
      Overrides:
      toString in class Object