Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2013-2014 by Cisco Systems, Inc. All rights reserved.
  
  package com.cisco.oss.foundation.directory.impl;
  
  import java.util.List;
 
It is the Directory LookupService to perform the lookup functionality. It looks up ServiceInstance from DirectoryServer.

Author(s):
zuxiang
 
 public class DirectoryLookupService {

The DirectoryServiceClientManager to get the DirectoryServiceClient.
 
Constructor.

Parameters:
directoryServiceClientManager the DirectoryServiceClientManager.
 
 	public DirectoryLookupService(DirectoryServiceClientManager directoryServiceClientManager){
 		this. = directoryServiceClientManager;
 	}

Get the ModelService.

Parameters:
serviceName the Service name.
Returns:
the ModelService.
 
 	protected ModelService getModelService(String serviceName){
 		return service;
 	}

Get the ModelMetadataKey

Parameters:
keyName the metadata key name.
Returns:
the ModelMetadataKey.
 
 		return key;
 	}

Get the ModelServiceInstance by serviceName and instanceId.

Parameters:
serviceName the service name.
instanceId the instanceId.
Returns:
the ModelServiceInstance.
 
 	public ModelServiceInstance getModelServiceInstance(String serviceNameString instanceId){
 		ModelService service = getModelService(serviceName);
 		if(service != null && service.getServiceInstances() != null ){
 				if(instance.getInstanceId().equals(instanceId)){
 					return instance;
 				}
 			}
 			
 		}
 		return null;
 	}

Get the ModelServiceInstance list by the Metadata Key.

Parameters:
keyName the metadata key name.
Returns:
the UP ModelServiceInstances that has the metadata key.
		if(key == null || key.getServiceInstances().size() == 0){
			return Collections.emptyList();
		}else{
		}
	}

Get the UP ModelServiceInstance list by the Metadata Key. It only return the UP ServiceInstance.

Parameters:
keyName the metadata key name.
Returns:
the ModelServiceInstances that has the metadata key.
		List<ModelServiceInstancelist = null;
		if(key != null && key.getServiceInstances().size() > 0){
					if(list == null){
					}
					list.add(instance);
				}
			}
		}
		if(list == null){
			return Collections.emptyList();
		}else{
			return list;
		}
	}

Get the ModelServiceInstance list of the Service.

Parameters:
serviceName the service name.
Returns:
the ModelServiceInstance list of the Service.
		ModelService service = getModelService(serviceName);
		if(service == null || service.getServiceInstances().size() == 0){
			return Collections.emptyList();
		}else{
		}
	}

Get All ModelServiceInstance in the ServiceDirectory.

Returns:
the ModelServiceInstance List.
		return allInstances;
	}

Get the UP ModelServiceInstance list of the Service. It only return the UP ServiceInstance of the Service.

Parameters:
serviceName the service name.
Returns:
the ModelServiceInstance list of the Service.
		ModelService service = getModelService(serviceName);
		List<ModelServiceInstancelist = null;
		if(service != null && service.getServiceInstances().size() > 0){
					if(list == null){
					}
					list.add(instance);
				}
			}
		}
		if(list == null){
			return Collections.emptyList();
		}else{
			return list;
		}
	}

Add a NotificationHandler to the Service.

Parameters:
serviceName the service name.
handler the NotificationHandler for the service.
	public void addNotificationHandler(String serviceNameNotificationHandler handler){
	}

Remove the NotificationHandler from the Service.

Parameters:
serviceName the service name.
handler the NotificationHandler for the service.
	public void removeNotificationHandler(String serviceNameNotificationHandler handler){
	}

Get the DirectoryServiceClient.

Returns:
the DirectoryServiceClient
		try {
catch (ServiceException e) {
		}
	}
New to GrepCode? Check out our FAQ X