Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2014 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 
 
 
 package com.cisco.oss.foundation.directory;
 
 import java.util.List;
 
LookupManager interface for the service consumer. The service consumer uses this interface to look up or query ServiceInstance stored on the directory server.
 
 public interface LookupManager extends AutoCloseable {

    
Look up a service instance by the service name. It selects one instance from a set of instances for a given service based on round robin strategy.

Parameters:
serviceName The Service name.
Returns:
The ServiceInstance.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
 
     public ServiceInstance lookupInstance(String serviceNamethrows ServiceException;

    
Look up a list of service instances for a given service. It returns the complete list of the UP service instances.

Parameters:
serviceName The Service name.
Returns:
The ServiceInstance list.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
 
     public List<ServiceInstancelookupInstances(String serviceNamethrows ServiceException;

    
Query for a service instance based on the service name and some filtering criteria on the service metadata. It returns a service instance from the service instance list based on round robin selection strategy. The ServiceInstance list is of the specified Service.

Parameters:
serviceName The Service name.
query The ServiceInstanceQuery for filtering the service instances.
Returns:
The ServiceInstance.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
 
     public ServiceInstance queryInstanceByName(String serviceNameServiceInstanceQuery querythrows ServiceException;

    
Query for all the ServiceInstances of the specified Service, which satisfy the query criteria on the service metadata. It returns all ServiceInstances of specified Service that satisfy the ServiceInstanceQuery. The ServiceInstance list is of the specified Service.

Parameters:
serviceName The Service name.
query The ServiceInstanceQuery for filtering the service instances.
Returns:
The ServiceInstance list.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
 
     public List<ServiceInstancequeryInstancesByName(String serviceNameServiceInstanceQuery querythrows ServiceException;

    
Query for a ServiceInstance which satisfies the query criteria on the service metadata. It returns a service instance from the service instance list based on round robin selection strategy. The ServiceInstance list may have different Services.

Parameters:
query The ServiceInstanceQuery for filtering the service instances.
Returns:
The ServiceInstance list.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
 
Query for all the ServiceInstances which satisfy the query criteria on the service metadata. It returns all ServiceInstances of different Services which satisfy the query criteria.

Parameters:
query The ServiceInstanceQuery for filtering the service instances.
Returns:
The ServiceInstance list.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
Get a ServiceInstance. It returns a ServiceInstances of the Service including the ServiceInstance of OperationalStatus DOWN.

Deprecated:
the providerId/instanceId is used in the 1.1 API. the method is replaced by getInstanceByAddress(java.lang.String,java.lang.String)
Parameters:
serviceName the service name.
instanceId the instanceId
Returns:
the ServiceInstance.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    @Deprecated
    public ServiceInstance getInstance(String serviceNameString instanceIdthrows ServiceException;


    
Get a ServiceInstance It returns a ServiceInstance of the Service matching the given name and address .

Parameters:
serviceName the service name.
instanceAddress the instanceAddress
Returns:
the ServiceInstance.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public ServiceInstance getInstanceByAddress(String serviceNameString instanceAddressthrows ServiceException;

    
Get all ServiceInstances of the target Service, including the DOWN ServiceInstance. It will return all ServiceInstances of the Service including the ServiceInstance of OperationalStatus DOWN.

Parameters:
serviceName the service name.
Returns:
the ServiceInstance List.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public List<ServiceInstancegetAllInstances(String serviceNamethrows ServiceException;

    
Get all ServiceInstances of the specified Service, including the DOWN ServiceIntance, which satisfy the query criteria on the service metadata. It filters all ServiceInstances of the specified Service including the ServiceInstance of OperationalStatus DOWN, against the ServiceInstanceQuery.

Parameters:
serviceName the Service name.
query the ServiceInstanceQuery.
Returns:
the ServiceInstance List.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public List<ServiceInstancegetAllInstances(String serviceNameServiceInstanceQuery querythrows ServiceException;

    
Get all the ServiceInstances, including the DOWN ServiceInstance, which satisfy the query criteria on the service metadata. It filters all ServiceInstances of different Services, including the DOWN ServiceInstance, which satisfy the query criteria.

Parameters:
query the ServiceInstanceQuery criteria.
Returns:
the ServiceInstance List.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
Get all ServiceInstances in the ServiceDirectory including the DOWN ServiceInstance.

Returns:
the ServiceInstance List.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public List<ServiceInstancegetAllInstances() throws ServiceException;

    
Add a NotificationHandler to the Service. This method checks the duplicated NotificationHandler for the serviceName, if the NotificationHandler already exists for the serviceName, do nothing.

Parameters:
serviceName the service name.
handler the NotificationHandler for the service.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public void addNotificationHandler(String serviceNameNotificationHandler handlerthrows ServiceException;

    
Remove a NotificationHandler from the Service.

Parameters:
serviceName the service name.
handler the NotificationHandler for the service.
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    public void removeNotificationHandler(String serviceNameNotificationHandler handlerthrows ServiceException ;

    
Add a ServiceInstanceChangeListener to the Service. This method will check the duplicated listener for the serviceName, if the listener already exists for the serviceName, do nothing. Throws IllegalArgumentException if serviceName or listener is null.

Parameters:
serviceName the service name
listener the ServiceInstanceChangeListener for the service
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    void addInstanceChangeListener(String serviceNameServiceInstanceChangeListener listenerthrows ServiceException;

    
Remove a ServiceInstanceChangeListener from the Service. Throws IllegalArgumentException if serviceName or listener is null.

Parameters:
serviceName the service name
listener the ServiceInstanceChangeListener for the service
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    void removeInstanceChangeListener(String serviceNameServiceInstanceChangeListener listenerthrows ServiceException;


    
Close the Lookup Manager The LookupManager supports JDK-7 try-with-resource

    @Override
    void close() throws ServiceException;

    
If the Lookup Manager is started

Returns:
true if the lookup manager is started, or false if not
Throws:
com.cisco.oss.foundation.directory.exception.ServiceException
    boolean isStarted() throws ServiceException;
New to GrepCode? Check out our FAQ X