Class ServiceQuery<T>


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

      • PROXYTYPE_RAW

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

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

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

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

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

        protected ClassInfo servicetype
        The service type.
      • servicetags

        protected java.lang.String[] servicetags
        Tags of the service.
      • platform

        protected IComponentIdentifier platform
        The service platform. (Find a service from another known platform, e.g. cms)
      • serviceidentifier

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

        protected java.lang.String[] networknames
        The network names.
      • unrestricted

        protected java.lang.Boolean unrestricted
        Should the service be unrestricted.
      • excludeowner

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

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

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

        protected java.lang.String requiredproxytype
        Required service proxy type.
      • id

        protected java.lang.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 Detail

      • ServiceQuery

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

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

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

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

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

      • getServiceType

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

        public ServiceQuery<T> setServiceType​(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
      • getServiceTags

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

        public ServiceQuery<T> setServiceTags​(java.lang.String... servicetags)
        Sets the service tags.
        Parameters:
        servicetags - The service tags.
      • setServiceTags

        public ServiceQuery<T> setServiceTags​(java.lang.String[] servicetags,
                                              IExternalAccess component)
        Sets the service tags.
        Parameters:
        servicetags - The service tags. todo: move or refactor to hide complexity!?
      • getSearchStart

        public IComponentIdentifier getSearchStart()
        Get the provider.
        Returns:
        The provider
      • 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.
      • 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 java.lang.String getId()
        Get the id.
        Returns:
        the id
      • setId

        public ServiceQuery<T> setId​(java.lang.String id)
        Set the id.
        Parameters:
        id - The id to set
      • 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
      • getIndexerSearchSpec

        public java.util.List<Tuple3<java.lang.String,​java.lang.String[],​java.lang.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 java.lang.Boolean getMatchingMode​(java.lang.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​(java.lang.String key,
                                               java.lang.Boolean and)
        Set a matching mode.
        Parameters:
        key - The key name.
        and - True for and.
      • isUnrestricted

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

        public ServiceQuery<T> setUnrestricted​(java.lang.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 java.lang.String[] getNetworkNames()
        Get the networknames.
        Returns:
        the networknames
      • setNetworkNames

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

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

        public ServiceQuery<T> setRequiredProxyType​(java.lang.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 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Test if other object equals this one.
        Overrides:
        equals in class java.lang.Object
      • getTargetPlatform

        public IComponentIdentifier getTargetPlatform()
        Get the target platform if specified (using platform and provider).
        Returns:
        The target platform.
      • createServiceInfo

        public static <T> RequiredServiceInfo createServiceInfo​(ServiceQuery<T> query)
        When searching with query -> create required service info from service query.
      • toString

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