2 * Copyright (c) 2015 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);
28 void handleMissingInstance(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta,
29 String module, String instance, ServiceRegistryWrapper services) throws
30 ConfigHandlingException {
31 throw new ConfigHandlingException(String.format("Unable to delete %s : %s , ServiceInstance not found", module, instance),
32 DocumentedException.ErrorType.application,
33 DocumentedException.ErrorTag.operation_failed,
34 DocumentedException.ErrorSeverity.error);
38 void executeStrategy(Map<String, AttributeConfigElement> configuration, ConfigTransactionClient ta, ObjectName on, ServiceRegistryWrapper services) throws
39 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()),
46 DocumentedException.ErrorType.application,
47 DocumentedException.ErrorTag.operation_failed,
48 DocumentedException.ErrorSeverity.error);