X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager-facade-xml%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Ffacade%2Fxml%2Fmapping%2Fattributes%2Fresolving%2FSimpleAttributeResolvingStrategy.java;fp=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Fmapping%2Fattributes%2Fresolving%2FSimpleAttributeResolvingStrategy.java;h=38f58ea9a1a78b92809aafd0530f5a4e0ac0fe06;hp=f1e603c60d18c48d9dc685757b4e6cc4c78d7b1e;hb=refs%2Fchanges%2F13%2F23413%2F26;hpb=071a641d7c12c0e6112d5ce0afe806b54f116ed2 diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java similarity index 75% rename from opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java rename to opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java index f1e603c60d..38f58ea9a1 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java +++ b/opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java @@ -1,12 +1,12 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.resolving; +package org.opendaylight.controller.config.facade.xml.mapping.attributes.resolving; import com.google.common.base.Optional; import com.google.common.collect.Maps; @@ -18,8 +18,8 @@ import java.text.ParseException; import java.util.Date; import java.util.Map; import javax.management.openmbean.SimpleType; -import org.opendaylight.controller.netconf.api.NetconfDocumentedException; -import org.opendaylight.controller.netconf.confignetconfconnector.util.Util; +import org.opendaylight.controller.config.facade.xml.util.Util; +import org.opendaylight.controller.config.util.xml.DocumentedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS } @Override - public Optional parseAttribute(String attrName, Object value) throws NetconfDocumentedException { + public Optional parseAttribute(String attrName, Object value) throws DocumentedException { if (value == null) { return Optional.absent(); } @@ -72,34 +72,34 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS } static interface Resolver { - Object resolveObject(Class type, String attrName, String value) throws NetconfDocumentedException; + Object resolveObject(Class type, String attrName, String value) throws DocumentedException; } static class DefaultResolver implements Resolver { @Override - public Object resolveObject(Class type, String attrName, String value) throws NetconfDocumentedException { + public Object resolveObject(Class type, String attrName, String value) throws DocumentedException { try { return parseObject(type, value); } catch (Exception e) { - throw new NetconfDocumentedException("Unable to resolve attribute " + attrName + " from " + value, - NetconfDocumentedException.ErrorType.application, - NetconfDocumentedException.ErrorTag.operation_failed, - NetconfDocumentedException.ErrorSeverity.error); + throw new DocumentedException("Unable to resolve attribute " + attrName + " from " + value, + DocumentedException.ErrorType.application, + DocumentedException.ErrorTag.operation_failed, + DocumentedException.ErrorSeverity.error); } } - protected Object parseObject(Class type, String value) throws NetconfDocumentedException { + protected Object parseObject(Class type, String value) throws DocumentedException { Method method = null; try { method = type.getMethod("valueOf", String.class); return method.invoke(null, value); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.trace("Error parsing object ",e); - throw new NetconfDocumentedException("Error parsing object.", - NetconfDocumentedException.ErrorType.application, - NetconfDocumentedException.ErrorTag.operation_failed, - NetconfDocumentedException.ErrorSeverity.error); + throw new DocumentedException("Error parsing object.", + DocumentedException.ErrorType.application, + DocumentedException.ErrorTag.operation_failed, + DocumentedException.ErrorSeverity.error); } } } @@ -138,15 +138,15 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS static class DateResolver extends DefaultResolver { @Override - protected Object parseObject(Class type, String value) throws NetconfDocumentedException { + protected Object parseObject(Class type, String value) throws DocumentedException { try { return Util.readDate(value); } catch (ParseException e) { LOG.trace("Unable parse value {} due to ",value, e); - throw new NetconfDocumentedException("Unable to parse value "+value+" as date.", - NetconfDocumentedException.ErrorType.application, - NetconfDocumentedException.ErrorTag.operation_failed, - NetconfDocumentedException.ErrorSeverity.error); + throw new DocumentedException("Unable to parse value "+value+" as date.", + DocumentedException.ErrorType.application, + DocumentedException.ErrorTag.operation_failed, + DocumentedException.ErrorSeverity.error); } } }