2 * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.config.facade.xml.strategy;
12 import javax.management.InstanceNotFoundException;
13 import javax.management.ObjectName;
14 import org.opendaylight.controller.config.facade.xml.exception.ConfigHandlingException;
15 import org.opendaylight.controller.config.facade.xml.mapping.attributes.fromxml.AttributeConfigElement;
16 import org.opendaylight.controller.config.facade.xml.mapping.config.ServiceRegistryWrapper;
17 import org.opendaylight.controller.config.util.ConfigTransactionClient;
18 import org.opendaylight.controller.config.util.xml.DocumentedException;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class DeleteEditConfigStrategy extends AbstractEditConfigStrategy {
24 private static final Logger LOG = LoggerFactory.getLogger(DeleteEditConfigStrategy.class);
27 void handleMissingInstance(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta,
28 String module, String instance, ServiceRegistryWrapper services) throws ConfigHandlingException {
29 throw new ConfigHandlingException(
30 String.format("Unable to delete %s : %s , ServiceInstance not found", module, instance),
31 DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
32 DocumentedException.ErrorSeverity.ERROR);
36 void executeStrategy(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta, ObjectName on,
37 ServiceRegistryWrapper services) throws ConfigHandlingException {
40 LOG.debug("ServiceInstance {} deleted successfully", on);
41 } catch (InstanceNotFoundException e) {
42 throw new ConfigHandlingException(
43 String.format("Unable to delete %s because of exception %s" + on, e.getMessage()),
44 DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
45 DocumentedException.ErrorSeverity.ERROR);