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(final Map<String, AttributeConfigElement> configuration,
28 final ConfigTransactionClient ta, final String module, final String instance,
29 final ServiceRegistryWrapper services)
30 throws ConfigHandlingException {
31 throw new ConfigHandlingException(
32 String.format("Unable to delete %s : %s , ServiceInstance not found", module, instance),
33 DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
34 DocumentedException.ErrorSeverity.ERROR);
38 void executeStrategy(final Map<String, AttributeConfigElement> configuration, final ConfigTransactionClient ta,
39 final ObjectName on, final ServiceRegistryWrapper services) throws ConfigHandlingException {
42 LOG.debug("ServiceInstance {} deleted successfully", on);
43 } catch (InstanceNotFoundException e) {
44 throw new ConfigHandlingException(
45 String.format("Unable to delete %s because of exception %s" + on, e.getMessage()), e,
46 DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
47 DocumentedException.ErrorSeverity.ERROR);