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.impl;
 
 
 
 import static com.cisco.oss.foundation.directory.ServiceDirectory.getServiceDirectoryConfig;
The RegistrationManager implementation.
 
 
     private static final Logger LOGGER = LoggerFactory
             .getLogger(RegistrationManagerImpl.class);


   
Mark component started or not
 
     private final AtomicBoolean isStarted = new AtomicBoolean(false);

    
The DirectoryRegistrationService to do Service Registration.
 
     private final DirectoryRegistrationService registrationService;

    
Constructor.
 
         this. = service;
     }

    
Start the RegistrationManagerImpl.
 
     @Override
     public void start(){
         .set(true);
     }

    
Stop the RegistrationManagerImpl
 
     @Override
     public void stop(){
         if (.compareAndSet(true,false)) {
             ((StoppablegetRegistrationService()).stop();
         }
     }

    
 
     @Override
     public void registerService(ProvidedServiceInstance serviceInstance)
             throws ServiceException {
 
         ServiceInstanceUtils.validateManagerIsStarted();
         ServiceInstanceUtils.validateProvidedServiceInstance(serviceInstance);
 
         getRegistrationService().registerService(serviceInstance);
     }

    
 
     @Override
    public void registerService(ProvidedServiceInstance serviceInstance,
            ServiceInstanceHealth registryHealththrows ServiceException {
        ServiceInstanceUtils.validateManagerIsStarted();
        ServiceInstanceUtils.validateProvidedServiceInstance(serviceInstance);
        getRegistrationService().registerService(serviceInstanceregistryHealth);
    }

    
    @Override
    public void updateServiceUri(String serviceName,
            String providerIdString urithrows ServiceException {
        ServiceInstanceUtils.validateManagerIsStarted();
        ServiceInstanceUtils.validateServiceName(serviceName);
        ServiceInstanceUtils.validateServiceInstanceID(providerId);
        ServiceInstanceUtils.validateURI(uri);
        getRegistrationService().updateServiceUri(serviceNameproviderIduri);
    }

    
    @Override
    public void updateServiceOperationalStatus(String serviceName,
            String providerIdOperationalStatus statusthrows ServiceException {
        ServiceInstanceUtils.validateManagerIsStarted();
        ServiceInstanceUtils.validateServiceName(serviceName);
        ServiceInstanceUtils.validateServiceInstanceID(providerId);
        getRegistrationService().updateServiceOperationalStatus(serviceNameproviderIdstatus);
    }

    
    @Override
    public void updateService(ProvidedServiceInstance serviceInstance)
            throws ServiceException {
     
        ServiceInstanceUtils.validateManagerIsStarted();
        ServiceInstanceUtils.validateProvidedServiceInstance(serviceInstance);
     
        getRegistrationService().updateService(serviceInstance);
    }

    
    @Override
    public void unregisterService(String serviceNameString providerId)
            throws ServiceException {
       
        ServiceInstanceUtils.validateManagerIsStarted();
        ServiceInstanceUtils.validateServiceName(serviceName);
        ServiceInstanceUtils.validateServiceInstanceID(providerId);
        
        getRegistrationService().unregisterService(serviceNameproviderId);
    }
        return ;
    }
New to GrepCode? Check out our FAQ X