Package jadex.bridge.service.search
Class ServiceQuery<T>
- java.lang.Object
- 
- jadex.bridge.service.search.ServiceQuery<T>
 
- 
 public class ServiceQuery<T> extends java.lang.ObjectService query definition. T is the return type for search methods.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classServiceQuery.MultiplicityDefine cases for multiplicity.
 - 
Field SummaryFields Modifier and Type Field Description static java.util.Map<java.lang.String,java.lang.Boolean>DEFAULT_MATCHINGMODESDefault matching modes set the elements with OR semantics.protected booleaneventmodeFlag if event mode is enabled on the query.protected booleanexcludeownerFlag, if service by the query owner should be excluded, i.e.protected java.lang.StringidThe query id.protected java.util.Map<java.lang.String,java.lang.Boolean>matchingmodesThe matching mode for multivalued terms.protected ServiceQuery.MultiplicitymultiplicityThe multiple flag.protected java.lang.String[]networknamesThe network names.static java.lang.String[]NETWORKS_NOT_SETMarker for networks not set.protected IComponentIdentifierownerThe query owner.protected IComponentIdentifierplatformThe service platform.static java.lang.StringPROXYTYPE_DECOUPLEDThe (default) decoupled proxy type (decouples from component thread to caller thread).static java.lang.StringPROXYTYPE_DIRECTThe direct proxy type (supports custom interceptors, but uses caller thread).static java.lang.StringPROXYTYPE_RAWThe raw proxy type (i.e.protected java.lang.StringrequiredproxytypeRequired service proxy type.protected ServiceScopescopeThe search scope.protected IComponentIdentifiersearchstartStarting point for the search scoping.protected IServiceIdentifierserviceidentifierThe service ID of the target service.protected java.lang.String[]servicetagsTags of the service.protected ClassInfoservicetypeThe service type.protected java.lang.BooleanunrestrictedShould the service be unrestricted.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedServiceQuery()Create a new service query.ServiceQuery(ClassInfo servicetype)Create a new service query.ServiceQuery(ClassInfo servicetype, ServiceScope scope, IComponentIdentifier owner)Create a new service query.ServiceQuery(ServiceQuery<T> original)Shallow copy constructor.ServiceQuery(java.lang.Class<T> servicetype)Create a new service query.ServiceQuery(java.lang.Class<T> servicetype, ServiceScope scope)Create a new service query.ServiceQuery(java.lang.Class<T> servicetype, ServiceScope scope, IComponentIdentifier owner)Create a new service query.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> RequiredServiceInfocreateServiceInfo(ServiceQuery<T> query)When searching with query -> create required service info from service query.booleanequals(java.lang.Object obj)Test if other object equals this one.java.lang.StringgetId()Get the id.java.util.List<Tuple3<java.lang.String,java.lang.String[],java.lang.Boolean>>getIndexerSearchSpec()Gets the specification for the indexer.java.lang.BooleangetMatchingMode(java.lang.String key)Get the matching mode for a key.ServiceQuery.MultiplicitygetMultiplicity()Get the multiplicity.java.lang.String[]getNetworkNames()Get the networknames.IComponentIdentifiergetOwner()Get the owner.IComponentIdentifiergetPlatform()Get the platform.java.lang.StringgetRequiredProxyType()Returns the requested required service proxy type.ServiceScopegetScope()Get the scope.IComponentIdentifiergetSearchStart()Get the provider.IServiceIdentifiergetServiceIdentifier()Gets the service identifier.static <T> ServiceQuery<T>getServiceQuery(IInternalAccess ia, RequiredServiceInfo info)When searching for declared service -> map required service declaration to service query.java.lang.String[]getServiceTags()Gets the service tags.ClassInfogetServiceType()Get the service type.IComponentIdentifiergetTargetPlatform()Get the target platform if specified (using platform and provider).inthashCode()Get the hashcode.booleanisEventMode()Checks if query is in event mode.booleanisExcludeOwner()Checks if service of the query owner should be excluded.java.lang.BooleanisUnrestricted()Get the unrestricted mode.protected booleanmatchesKeys(IServiceIdentifier service)Tests if the query keys matches a service.ServiceQuery<ServiceEvent<T>>setEventMode()Changes the query to event mode.voidsetEventMode(boolean eventmode)Deprecated.For bean purposes only, use setEventMode().ServiceQuery<T>setExcludeOwner(boolean excludeowner)Sets if service of the query owner should be excluded.ServiceQuery<T>setId(java.lang.String id)Set the id.ServiceQuery<T>setMatchingMode(java.lang.String key, java.lang.Boolean and)Set a matching mode.ServiceQuery<T>setMultiplicity(int multiplicity)Set the multiplicity.ServiceQuery<T>setMultiplicity(int multiplicitystart, int multiplicityend)Set the multiplicity.ServiceQuery<T>setMultiplicity(ServiceQuery.Multiplicity multiplicity)Set the multiplicity.ServiceQuery<T>setNetworkNames(java.lang.String... networknames)Set the networknames.ServiceQuery<T>setOwner(IComponentIdentifier owner)Set the owner.ServiceQuery<T>setPlatform(IComponentIdentifier platform)Set the platform.ServiceQuery<T>setProvider(IComponentIdentifier provider)Set the provider.ServiceQuery<T>setRequiredProxyType(java.lang.String requiredproxytype)Sets the requested required service proxy type.ServiceQuery<T>setScope(ServiceScope scope)Set the scope.ServiceQuery<T>setSearchStart(IComponentIdentifier searchstart)Set the provider.ServiceQuery<T>setServiceIdentifier(IServiceIdentifier serviceidentifier)Sets the service identifier.ServiceQuery<T>setServiceTags(java.lang.String... servicetags)Sets the service tags.ServiceQuery<T>setServiceTags(java.lang.String[] servicetags, IExternalAccess component)Sets the service tags.ServiceQuery<T>setServiceType(ClassInfo servicetype)Set the service type.ServiceQuery<T>setUnrestricted(java.lang.Boolean unrestricted)Set the unrestricted mode.java.lang.StringtoString()Get the string representation.
 
- 
- 
- 
Field Detail- 
PROXYTYPE_RAWpublic static final java.lang.String PROXYTYPE_RAW The raw proxy type (i.e. no proxy).- See Also:
- Constant Field Values
 
 - 
PROXYTYPE_DIRECTpublic static final java.lang.String PROXYTYPE_DIRECT The direct proxy type (supports custom interceptors, but uses caller thread).- See Also:
- Constant Field Values
 
 - 
PROXYTYPE_DECOUPLEDpublic 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_SETpublic static final java.lang.String[] NETWORKS_NOT_SET Marker for networks not set.
 - 
DEFAULT_MATCHINGMODESpublic static final java.util.Map<java.lang.String,java.lang.Boolean> DEFAULT_MATCHINGMODES Default matching modes set the elements with OR semantics.
 - 
servicetypeprotected ClassInfo servicetype The service type.
 - 
servicetagsprotected java.lang.String[] servicetags Tags of the service.
 - 
searchstartprotected IComponentIdentifier searchstart Starting point for the search scoping.
 - 
platformprotected IComponentIdentifier platform The service platform. (Find a service from another known platform, e.g. cms)
 - 
serviceidentifierprotected IServiceIdentifier serviceidentifier The service ID of the target service. Fast lookup of a service by id.
 - 
networknamesprotected java.lang.String[] networknames The network names.
 - 
unrestrictedprotected java.lang.Boolean unrestricted Should the service be unrestricted.
 - 
scopeprotected ServiceScope scope The search scope.
 - 
ownerprotected IComponentIdentifier owner The query owner. (rename queryowner?)
 - 
excludeownerprotected boolean excludeowner Flag, if service by the query owner should be excluded, i.e. do not return my own service.
 - 
multiplicityprotected ServiceQuery.Multiplicity multiplicity The multiple flag. Search for multiple services
 - 
eventmodeprotected boolean eventmode Flag if event mode is enabled on the query.
 - 
matchingmodesprotected java.util.Map<java.lang.String,java.lang.Boolean> matchingmodes The matching mode for multivalued terms. True is and and false is or.
 - 
requiredproxytypeprotected java.lang.String requiredproxytype Required service proxy type.
 - 
idprotected 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- 
ServiceQueryprotected ServiceQuery() Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(java.lang.Class<T> servicetype) Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(java.lang.Class<T> servicetype, ServiceScope scope) Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(java.lang.Class<T> servicetype, ServiceScope scope, IComponentIdentifier owner) Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(ClassInfo servicetype) Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(ClassInfo servicetype, ServiceScope scope, IComponentIdentifier owner) Create a new service query.
 - 
ServiceQuerypublic ServiceQuery(ServiceQuery<T> original) Shallow copy constructor.- Parameters:
- original- Original query.
 
 
- 
 - 
Method Detail- 
getServiceTypepublic ClassInfo getServiceType() Get the service type.- Returns:
- The service type
 
 - 
setServiceTypepublic 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.
 
 - 
setEventModepublic ServiceQuery<ServiceEvent<T>> setEventMode() Changes the query to event mode.- Returns:
- The new query.
 
 - 
isEventModepublic boolean isEventMode() Checks if query is in event mode.- Returns:
- True, if in event mode
 
 - 
getScopepublic ServiceScope getScope() Get the scope.- Returns:
- The scope
 
 - 
setScopepublic ServiceQuery<T> setScope(ServiceScope scope) Set the scope.- Parameters:
- scope- The scope to set
 
 - 
getServiceTagspublic java.lang.String[] getServiceTags() Gets the service tags.- Returns:
- The service tags.
 
 - 
setServiceTagspublic ServiceQuery<T> setServiceTags(java.lang.String... servicetags) Sets the service tags.- Parameters:
- servicetags- The service tags.
 
 - 
setServiceTagspublic 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!?
 
 - 
setProviderpublic ServiceQuery<T> setProvider(IComponentIdentifier provider) Set the provider.- Parameters:
- provider- The provider to set
 
 - 
getSearchStartpublic IComponentIdentifier getSearchStart() Get the provider.- Returns:
- The provider
 
 - 
setSearchStartpublic ServiceQuery<T> setSearchStart(IComponentIdentifier searchstart) Set the provider.- Parameters:
- provider- The provider to set
 
 - 
getPlatformpublic IComponentIdentifier getPlatform() Get the platform.- Returns:
- The platform
 
 - 
setPlatformpublic ServiceQuery<T> setPlatform(IComponentIdentifier platform) Set the platform.- Parameters:
- platform- The platform
 
 - 
getServiceIdentifierpublic IServiceIdentifier getServiceIdentifier() Gets the service identifier.- Returns:
- The service identifier.
 
 - 
setServiceIdentifierpublic ServiceQuery<T> setServiceIdentifier(IServiceIdentifier serviceidentifier) Sets the service identifier. Also sets the corresponding provider when sid!=null.- Parameters:
- serviceidentifier- The service identifier.
 
 - 
getOwnerpublic IComponentIdentifier getOwner() Get the owner.- Returns:
- The owner
 
 - 
setOwnerpublic ServiceQuery<T> setOwner(IComponentIdentifier owner) Set the owner.- Parameters:
- owner- The owner to set
 
 - 
isExcludeOwnerpublic boolean isExcludeOwner() Checks if service of the query owner should be excluded.- Returns:
- True, if the services should be excluded.
 
 - 
setExcludeOwnerpublic ServiceQuery<T> setExcludeOwner(boolean excludeowner) Sets if service of the query owner should be excluded.- Parameters:
- excludeowner- True, if the services should be excluded.
 
 - 
getIdpublic java.lang.String getId() Get the id.- Returns:
- the id
 
 - 
setIdpublic ServiceQuery<T> setId(java.lang.String id) Set the id.- Parameters:
- id- The id to set
 
 - 
getMultiplicitypublic ServiceQuery.Multiplicity getMultiplicity() Get the multiplicity.- Returns:
- the multiplicity
 
 - 
setMultiplicitypublic ServiceQuery<T> setMultiplicity(int multiplicity) Set the multiplicity.- Parameters:
- multiplicity- The minimum multiplicity to set
 
 - 
setMultiplicitypublic ServiceQuery<T> setMultiplicity(int multiplicitystart, int multiplicityend) Set the multiplicity.- Parameters:
- multiplicitystart- The minimum multiplicity to set
- multiplicityend- The max multiplicity to set
 
 - 
setMultiplicitypublic ServiceQuery<T> setMultiplicity(ServiceQuery.Multiplicity multiplicity) Set the multiplicity.- Parameters:
- multiplicity- The multiplicity to set
 
 - 
getIndexerSearchSpecpublic 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.
 
 - 
getMatchingModepublic 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.
 
 - 
setMatchingModepublic ServiceQuery<T> setMatchingMode(java.lang.String key, java.lang.Boolean and) Set a matching mode.- Parameters:
- key- The key name.
- and- True for and.
 
 - 
isUnrestrictedpublic java.lang.Boolean isUnrestricted() Get the unrestricted mode.- Returns:
- The unrestricted mode.
 
 - 
setUnrestrictedpublic ServiceQuery<T> setUnrestricted(java.lang.Boolean unrestricted) Set the unrestricted mode.- Parameters:
- unrestricted- the unrestricted to set
 
 - 
matchesKeysprotected boolean matchesKeys(IServiceIdentifier service) Tests if the query keys matches a service.- Parameters:
- service- The service.
- Returns:
- True, if the service matches the keys.
 
 - 
getNetworkNamespublic java.lang.String[] getNetworkNames() Get the networknames.- Returns:
- the networknames
 
 - 
setNetworkNamespublic ServiceQuery<T> setNetworkNames(java.lang.String... networknames) Set the networknames.- Parameters:
- networknames- The networknames to set
 
 - 
getRequiredProxyTypepublic java.lang.String getRequiredProxyType() Returns the requested required service proxy type.- Returns:
- The requested required service proxy type.
 
 - 
setRequiredProxyTypepublic ServiceQuery<T> setRequiredProxyType(java.lang.String requiredproxytype) Sets the requested required service proxy type.- Parameters:
- requiredproxytype- The requested required service proxy type.
 
 - 
hashCodepublic int hashCode() Get the hashcode.- Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) Test if other object equals this one.- Overrides:
- equalsin class- java.lang.Object
 
 - 
getTargetPlatformpublic IComponentIdentifier getTargetPlatform() Get the target platform if specified (using platform and provider).- Returns:
- The target platform.
 
 - 
getServiceQuerypublic static <T> ServiceQuery<T> getServiceQuery(IInternalAccess ia, RequiredServiceInfo info) When searching for declared service -> map required service declaration to service query.
 - 
createServiceInfopublic static <T> RequiredServiceInfo createServiceInfo(ServiceQuery<T> query) When searching with query -> create required service info from service query.
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-