Remove open-coded revision formats and use cached formatted
revisions where available.
Change-Id: I0f41f3f449cb0fd1abab11ef5e93adb636c19b8b
Signed-off-by: Robert Varga <rovarga@cisco.com>
21 files changed:
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.absent() :
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.absent() :
- Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
+ Optional.of(module.getQNameModule().getFormattedRevision())));
InputStream sourceStream = null;
String source;
InputStream sourceStream = null;
String source;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.module.list.module.submodules.SubmoduleBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.YangIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.library.rev160409.module.list.module.submodules.SubmoduleBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.YangIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
// TODO Conformance type is always set to Implement value, but it should it really be like this?
// TODO Add also deviations and features lists to module entries
moduleBuilder.setName(new YangIdentifier(module.getName()))
// TODO Conformance type is always set to Implement value, but it should it really be like this?
// TODO Add also deviations and features lists to module entries
moduleBuilder.setName(new YangIdentifier(module.getName()))
- .setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision())))
+ .setRevision(new OptionalRevision(module.getQNameModule().getFormattedRevision()))
.setNamespace(new Uri(module.getNamespace().toString()))
.setConformanceType(ConformanceType.Implement)
.setSubmodules(createSubmodulesForModule(module));
.setNamespace(new Uri(module.getNamespace().toString()))
.setConformanceType(ConformanceType.Implement)
.setSubmodules(createSubmodulesForModule(module));
for (final Module subModule : module.getSubmodules()) {
final SubmoduleBuilder subModuleEntryBuilder = new SubmoduleBuilder();
subModuleEntryBuilder.setName(new YangIdentifier(subModule.getName()))
for (final Module subModule : module.getSubmodules()) {
final SubmoduleBuilder subModuleEntryBuilder = new SubmoduleBuilder();
subModuleEntryBuilder.setName(new YangIdentifier(subModule.getName()))
- .setRevision(new OptionalRevision(SimpleDateFormatUtil.getRevisionFormat().format(subModule.getRevision())));
+ .setRevision(new OptionalRevision(subModule.getQNameModule().getFormattedRevision()));
submodulesList.add(subModuleEntryBuilder.build());
}
return new SubmodulesBuilder().setSubmodule(submodulesList).build();
}
submodulesList.add(subModuleEntryBuilder.build());
}
return new SubmodulesBuilder().setSubmodule(submodulesList).build();
}
-}
\ No newline at end of file
remoteSchemaContext.getAllModuleIdentifiers().stream().map(mi ->
RevisionSourceIdentifier.create(mi.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == mi.getRevision() ? Optional.<String>absent() :
remoteSchemaContext.getAllModuleIdentifiers().stream().map(mi ->
RevisionSourceIdentifier.create(mi.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == mi.getRevision() ? Optional.<String>absent() :
- Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(mi.getRevision())))))
+ Optional.of(mi.getQNameModule().getFormattedRevision()))))
.collect(Collectors.toList());
// send initial data to master actor and create actor for providing it
.collect(Collectors.toList());
// send initial data to master actor and create actor for providing it
import java.util.regex.Pattern;
import org.opendaylight.netconf.cli.reader.ReadingException;
import org.opendaylight.yangtools.yang.common.QName;
import java.util.regex.Pattern;
import org.opendaylight.netconf.cli.reader.ReadingException;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
}
public static Date parseDate(final String revision) {
}
public static Date parseDate(final String revision) {
- final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
- return formatter.parse(revision);
+ return SimpleDateFormatUtil.getRevisionFormat().parse(revision);
} catch (final ParseException e) {
throw new IllegalArgumentException("Date not valid", e);
}
} catch (final ParseException e) {
throw new IllegalArgumentException("Date not valid", e);
}
private void addModuleCapability(final SharedSchemaRepository consumer, final Set<Capability> capabilities, final Module module) {
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
private void addModuleCapability(final SharedSchemaRepository consumer, final Set<Capability> capabilities, final Module module) {
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
(SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
- Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
+ Optional.of(module.getQNameModule().getFormattedRevision())));
try {
final String moduleContent = new String(consumer.getSchemaSource(moduleSourceIdentifier, YangTextSchemaSource.class)
.checkedGet().read());
try {
final String moduleContent = new String(consumer.getSchemaSource(moduleSourceIdentifier, YangTextSchemaSource.class)
.checkedGet().read());
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
private static final int CHAR_NOT_FOUND = -1;
private static final int CHAR_NOT_FOUND = -1;
- private static final SimpleDateFormat REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
-
private static final String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
private BrokerFacade broker;
private static final String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
private BrokerFacade broker;
- final Date eventSubscriptionAugRevision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-07-08");
+ final Date eventSubscriptionAugRevision = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-08");
NETCONF_BASE_QNAME =
QName.create(QNameModule.create(new URI(NETCONF_BASE), null), NETCONF_BASE_PAYLOAD_NAME);
SAL_REMOTE_AUGMENT = QNameModule.create(NAMESPACE_EVENT_SUBSCRIPTION_AUGMENT, eventSubscriptionAugRevision);
NETCONF_BASE_QNAME =
QName.create(QNameModule.create(new URI(NETCONF_BASE), null), NETCONF_BASE_PAYLOAD_NAME);
SAL_REMOTE_AUGMENT = QNameModule.create(NAMESPACE_EVENT_SUBSCRIPTION_AUGMENT, eventSubscriptionAugRevision);
try {
final String moduleName = pathArgs.get(0);
final String revision = pathArgs.get(1);
try {
final String moduleName = pathArgs.get(0);
final String revision = pathArgs.get(1);
- final Date moduleRevision = REVISION_FORMAT.parse(revision);
+ final Date moduleRevision = SimpleDateFormatUtil.getRevisionFormat().parse(revision);
return QName.create(null, moduleRevision, moduleName);
} catch (final ParseException e) {
LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier);
return QName.create(null, moduleRevision, moduleName);
} catch (final ParseException e) {
LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier);
ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "revision");
final DataSchemaNode revisionSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null);
Preconditions.checkState(revisionSchemaNode instanceof LeafSchemaNode);
ControllerContext.findInstanceDataChildrenByName(listModuleSchemaNode, "revision");
final DataSchemaNode revisionSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null);
Preconditions.checkState(revisionSchemaNode instanceof LeafSchemaNode);
- final String revision = REVISION_FORMAT.format(module.getRevision());
+ final String revision = module.getQNameModule().getFormattedRevision();
moduleNodeValues
.withChild(Builders.leafBuilder((LeafSchemaNode) revisionSchemaNode).withValue(revision).build());
moduleNodeValues
.withChild(Builders.leafBuilder((LeafSchemaNode) revisionSchemaNode).withValue(revision).build());
import com.google.common.collect.Sets;
import java.net.URI;
import java.text.ParseException;
import com.google.common.collect.Sets;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Date;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import java.util.Date;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.restconf.utils.parser.builder.ParserBuilderConstants;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.restconf.utils.parser.builder.ParserBuilderConstants;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
static {
Date eventSubscriptionAugRevision;
try {
static {
Date eventSubscriptionAugRevision;
try {
- eventSubscriptionAugRevision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-07-08");
+ eventSubscriptionAugRevision = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-08");
} catch (final ParseException e) {
final String errMsg = "It wasn't possible to convert revision date of sal-remote-augment to date";
LOG.debug(errMsg);
} catch (final ParseException e) {
final String errMsg = "It wasn't possible to convert revision date of sal-remote-augment to date";
LOG.debug(errMsg);
package org.opendaylight.restconf.utils;
import com.google.common.base.Splitter;
package org.opendaylight.restconf.utils;
import com.google.common.base.Splitter;
-import java.text.SimpleDateFormat;
/**
* Util class for Restconf constants.
/**
* Util class for Restconf constants.
public static final String JSON = "+json";
public static final String MOUNT = "yang-ext:mount";
public static final String IDENTIFIER = "identifier";
public static final String JSON = "+json";
public static final String MOUNT = "yang-ext:mount";
public static final String IDENTIFIER = "identifier";
- public static final SimpleDateFormat REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
public static final char SLASH = '/';
public static final Splitter SLASH_SPLITTER = Splitter.on(SLASH);
public static final String DRAFT_PATTERN = "restconf/17";
public static final char SLASH = '/';
public static final Splitter SLASH_SPLITTER = Splitter.on(SLASH);
public static final String DRAFT_PATTERN = "restconf/17";
addCommonLeafs(module, mapEntryBuilder, ietfYangLibraryModule);
addChildOfModuleBySpecificModuleInternal(
IetfYangLibrary.SPECIFIC_MODULE_SCHEMA_LEAF_QNAME, mapEntryBuilder, IetfYangLibrary.BASE_URI_OF_SCHEMA
addCommonLeafs(module, mapEntryBuilder, ietfYangLibraryModule);
addChildOfModuleBySpecificModuleInternal(
IetfYangLibrary.SPECIFIC_MODULE_SCHEMA_LEAF_QNAME, mapEntryBuilder, IetfYangLibrary.BASE_URI_OF_SCHEMA
- + module.getName() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(module.getRevision()),
+ + module.getName() + "/" + module.getQNameModule().getFormattedRevision(),
ietfYangLibraryModule);
if (!isSubmodule) {
addChildOfModuleBySpecificModuleOfListChild(IetfYangLibrary.SPECIFIC_MODULE_NAMESPACE_LEAF_QNAME,
ietfYangLibraryModule);
if (!isSubmodule) {
addChildOfModuleBySpecificModuleOfListChild(IetfYangLibrary.SPECIFIC_MODULE_NAMESPACE_LEAF_QNAME,
addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_NAME_LEAF_QNAME, mapEntryBuilder,
module.getName(), ietfYangLibraryModule);
addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_REVISION_LEAF_QNAME, mapEntryBuilder,
addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_NAME_LEAF_QNAME, mapEntryBuilder,
module.getName(), ietfYangLibraryModule);
addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_REVISION_LEAF_QNAME, mapEntryBuilder,
- new SimpleDateFormat("yyyy-MM-dd").format(module.getRevision()), ietfYangLibraryModule);
+ module.getQNameModule().getFormattedRevision(), ietfYangLibraryModule);
import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
import java.text.ParseException;
import java.util.Date;
import java.util.Iterator;
import java.text.ParseException;
import java.util.Date;
import java.util.Iterator;
import org.opendaylight.restconf.utils.RestconfConstants;
import org.opendaylight.restconf.utils.validation.RestconfValidation;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.restconf.utils.RestconfConstants;
import org.opendaylight.restconf.utils.validation.RestconfValidation;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextNode;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
- return new InstanceIdentifierContext<RpcDefinition>(mountYangInstanceIdentifier, def, mountPoint.get(),
+ return new InstanceIdentifierContext<>(mountYangInstanceIdentifier, def, mountPoint.get(),
mountPoint.get().getSchemaContext());
} else {
final YangInstanceIdentifier deserialize = IdentifierCodec.deserialize(identifier, schemaContext);
mountPoint.get().getSchemaContext());
} else {
final YangInstanceIdentifier deserialize = IdentifierCodec.deserialize(identifier, schemaContext);
- return new InstanceIdentifierContext<RpcDefinition>(deserialize, def, null, schemaContext);
+ return new InstanceIdentifierContext<>(deserialize, def, null, schemaContext);
moduleNameAndRevision = identifier;
}
moduleNameAndRevision = identifier;
}
- final Splitter splitter = Splitter.on(RestconfConstants.SLASH);
- final Iterable<String> split = splitter.split(moduleNameAndRevision);
- final List<String> pathArgs = Lists.newArrayList(split);
+ final List<String> pathArgs = RestconfConstants.SLASH_SPLITTER.splitToList(moduleNameAndRevision);
if (pathArgs.size() != 2) {
if (pathArgs.size() != 2) {
- LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier);
+ LOG.debug("URI has bad format '{}'. It should be 'moduleName/yyyy-MM-dd'", identifier);
throw new RestconfDocumentedException(
"URI has bad format. End of URI should be in format \'moduleName/yyyy-MM-dd\'", ErrorType.PROTOCOL,
ErrorTag.INVALID_VALUE);
}
throw new RestconfDocumentedException(
"URI has bad format. End of URI should be in format \'moduleName/yyyy-MM-dd\'", ErrorType.PROTOCOL,
ErrorTag.INVALID_VALUE);
}
+ final Date moduleRevision;
- final String moduleName = pathArgs.get(0);
- final String revision = pathArgs.get(1);
- final Date moduleRevision = RestconfConstants.REVISION_FORMAT.parse(revision);
-
- return QName.create(null, moduleRevision, moduleName);
+ moduleRevision = SimpleDateFormatUtil.getRevisionFormat().parse(pathArgs.get(1));
} catch (final ParseException e) {
} catch (final ParseException e) {
- LOG.debug("URI has bad format. It should be \'moduleName/yyyy-MM-dd\' " + identifier);
+ LOG.debug("URI has bad format: '{}'. It should be 'moduleName/yyyy-MM-dd'", identifier);
throw new RestconfDocumentedException("URI has bad format. It should be \'moduleName/yyyy-MM-dd\'",
ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
}
throw new RestconfDocumentedException("URI has bad format. It should be \'moduleName/yyyy-MM-dd\'",
ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
}
+
+ return QName.create(null, moduleRevision, pathArgs.get(0));
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import java.net.URI;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
* @throws ParseException
*/
@Test
* @throws ParseException
*/
@Test
- public void getDataWithSlashesBehindMountPoint() throws Exception {
+ public void getDataWithSlashesBehindMountPoint() throws ParseException {
final YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), eq(awaitedInstanceIdentifier),
Mockito.anyString())).thenReturn(prepareCnDataForSlashesBehindMountPointTest());
final YangInstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
when(brokerFacade.readConfigurationData(any(DOMMountPoint.class), eq(awaitedInstanceIdentifier),
Mockito.anyString())).thenReturn(prepareCnDataForSlashesBehindMountPointTest());
assertEquals(200, get(uri, MediaType.APPLICATION_XML));
}
assertEquals(200, get(uri, MediaType.APPLICATION_XML));
}
- private static YangInstanceIdentifier prepareInstanceIdentifierForList() throws Exception {
+ private static YangInstanceIdentifier prepareInstanceIdentifierForList() throws ParseException {
final List<PathArgument> parameters = new ArrayList<>();
final QName qNameCont = newTestModuleQName("cont");
final List<PathArgument> parameters = new ArrayList<>();
final QName qNameCont = newTestModuleQName("cont");
return YangInstanceIdentifier.create(parameters);
}
return YangInstanceIdentifier.create(parameters);
}
- private static QName newTestModuleQName(final String localPart) throws Exception {
- final Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
- final URI uri = new URI("test:module");
+ private static QName newTestModuleQName(final String localPart) throws ParseException {
+ final Date revision = SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-09");
+ final URI uri = URI.create("test:module");
return QName.create(uri, revision, localPart);
}
return QName.create(uri, revision, localPart);
}
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
-import java.text.SimpleDateFormat;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.opendaylight.yangtools.util.SingletonSet;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.util.SingletonSet;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
public class NotificationListenerTest {
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
public class NotificationListenerTest {
+ private static final QNameModule MODULE;
+ static {
+ try {
+ MODULE = QNameModule.create(URI.create("notifi:mod"),
+ SimpleDateFormatUtil.getRevisionFormat().parse("2016-11-23"));
+ } catch (ParseException e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
private SchemaContext schmeaCtx;
private SchemaContext schmeaCtx;
@Test
public void notifi_leafTest() throws Exception {
@Test
public void notifi_leafTest() throws Exception {
- final QNameModule moduleQName =
- QNameModule.create(new URI("notifi:mod"), new SimpleDateFormat("yyyy-MM-dd").parse("2016-11-23"));
- final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(moduleQName, "notifi-leaf"));
+ final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(MODULE, "notifi-leaf"));
final DOMNotification notificationData = mock(DOMNotification.class);
final DOMNotification notificationData = mock(DOMNotification.class);
- final LeafNode leaf = mockLeaf(QName.create(moduleQName, "lf"));
+ final LeafNode leaf = mockLeaf(QName.create(MODULE, "lf"));
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), leaf);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), leaf);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
@Test
public void notifi_cont_leafTest() throws Exception {
@Test
public void notifi_cont_leafTest() throws Exception {
- final QNameModule moduleQName =
- QNameModule.create(new URI("notifi:mod"), new SimpleDateFormat("yyyy-MM-dd").parse("2016-11-23"));
-
- final SchemaPath schemaPathNotifi =
- SchemaPath.create(false, QName.create(moduleQName, "notifi-cont"));
+ final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(MODULE, "notifi-cont"));
final DOMNotification notificationData = mock(DOMNotification.class);
final DOMNotification notificationData = mock(DOMNotification.class);
- final LeafNode leaf = mockLeaf(QName.create(moduleQName, "lf"));
- final ContainerNode cont = mockCont(QName.create(moduleQName, "cont"), leaf);
+ final LeafNode leaf = mockLeaf(QName.create(MODULE, "lf"));
+ final ContainerNode cont = mockCont(QName.create(MODULE, "cont"), leaf);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), cont);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), cont);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
@Test
public void notifi_list_Test() throws Exception {
@Test
public void notifi_list_Test() throws Exception {
- final QNameModule moduleQName =
- QNameModule.create(new URI("notifi:mod"), new SimpleDateFormat("yyyy-MM-dd").parse("2016-11-23"));
-
- final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(moduleQName, "notifi-list"));
+ final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(MODULE, "notifi-list"));
final DOMNotification notificationData = mock(DOMNotification.class);
final DOMNotification notificationData = mock(DOMNotification.class);
- final LeafNode leaf = mockLeaf(QName.create(moduleQName, "lf"));
- final MapEntryNode entry = mockMapEntry(QName.create(moduleQName, "lst"), leaf);
- final MapNode list = mockList(QName.create(moduleQName, "lst"), entry);
- final ContainerNode cont = mockCont(QName.create(moduleQName, "cont"), list);
+ final LeafNode leaf = mockLeaf(QName.create(MODULE, "lf"));
+ final MapEntryNode entry = mockMapEntry(QName.create(MODULE, "lst"), leaf);
+ final MapNode list = mockList(QName.create(MODULE, "lst"), entry);
+ final ContainerNode cont = mockCont(QName.create(MODULE, "cont"), list);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), cont);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), cont);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
@Test
public void notifi_grpTest() throws Exception {
@Test
public void notifi_grpTest() throws Exception {
- final QNameModule moduleQName =
- QNameModule.create(new URI("notifi:mod"), new SimpleDateFormat("yyyy-MM-dd").parse("2016-11-23"));
-
- final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(moduleQName, "notifi-grp"));
+ final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(MODULE, "notifi-grp"));
final DOMNotification notificationData = mock(DOMNotification.class);
final DOMNotification notificationData = mock(DOMNotification.class);
- final LeafNode leaf = mockLeaf(QName.create(moduleQName, "lf"));
+ final LeafNode leaf = mockLeaf(QName.create(MODULE, "lf"));
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), leaf);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), leaf);
when(notificationData.getType()).thenReturn(schemaPathNotifi);
@Test
public void notifi_augmTest() throws Exception {
@Test
public void notifi_augmTest() throws Exception {
- final QNameModule moduleQName =
- QNameModule.create(new URI("notifi:mod"), new SimpleDateFormat("yyyy-MM-dd").parse("2016-11-23"));
-
- final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(moduleQName, "notifi-augm"));
+ final SchemaPath schemaPathNotifi = SchemaPath.create(false, QName.create(MODULE, "notifi-augm"));
final DOMNotification notificationData = mock(DOMNotification.class);
final DOMNotification notificationData = mock(DOMNotification.class);
- final LeafNode leaf = mockLeaf(QName.create(moduleQName, "lf-augm"));
+ final LeafNode leaf = mockLeaf(QName.create(MODULE, "lf-augm"));
final AugmentationNode augm = mockAugm(leaf);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), augm);
final AugmentationNode augm = mockAugm(leaf);
final ContainerNode notifiBody = mockCont(schemaPathNotifi.getLastComponent(), augm);
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import java.util.Collection;
import javax.ws.rs.core.MediaType;
import org.junit.BeforeClass;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
private static QNameModule initializeInstanceIdentifierModule() {
try {
return QNameModule.create(URI.create("instance:identifier:module"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-17"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2014-01-17"));
} catch (final ParseException e) {
throw new Error(e);
}
} catch (final ParseException e) {
throw new Error(e);
}
import static org.junit.Assert.fail;
import java.net.URI;
import static org.junit.Assert.fail;
import java.net.URI;
-import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Set;
import org.junit.Before;
import java.util.List;
import java.util.Set;
import org.junit.Before;
import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.netconf.sal.restconf.impl.RestconfError.ErrorType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles("/jukebox"));
final QNameModule qNameModule = QNameModule.create(URI.create("http://example.com/ns/example-jukebox"),
YangParserTestUtils.parseYangSources(TestRestconfUtils.loadFiles("/jukebox"));
final QNameModule qNameModule = QNameModule.create(URI.create("http://example.com/ns/example-jukebox"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2015-04-04"));
+ SimpleDateFormatUtil.getRevisionFormat().parse("2015-04-04"));
this.jukeboxQName = QName.create(qNameModule, "jukebox");
this.playerQName = QName.create(qNameModule, "player");
this.jukeboxQName = QName.create(qNameModule, "jukebox");
this.playerQName = QName.create(qNameModule, "player");
this.augmentedLibraryQName = QName.create(
QNameModule.create(
URI.create("http://example.com/ns/augmented-jukebox"),
this.augmentedLibraryQName = QName.create(
QNameModule.create(
URI.create("http://example.com/ns/augmented-jukebox"),
- new SimpleDateFormat("yyyy-MM-dd").parse("2016-05-05")),
+ SimpleDateFormatUtil.getRevisionFormat().parse("2016-05-05")),
"augmented-library");
this.albumQName = QName.create(qNameModule, "album");
this.nameQName = QName.create(qNameModule, "name");
"augmented-library");
this.albumQName = QName.create(qNameModule, "album");
this.nameQName = QName.create(qNameModule, "name");
package org.opendaylight.restconf.utils.schema.context;
package org.opendaylight.restconf.utils.schema.context;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.mockito.Mockito;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.yangtools.yang.common.QName;
import org.mockito.Mockito;
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
/**
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
/**
private static SchemaNode mockSchemaNode(final String origKey) {
final SchemaNode mockSchNode = Mockito.mock(SchemaNode.class);
Mockito.when(mockSchNode.getQName())
private static SchemaNode mockSchemaNode(final String origKey) {
final SchemaNode mockSchNode = Mockito.mock(SchemaNode.class);
Mockito.when(mockSchNode.getQName())
- .thenReturn(QName.create("ns", new SimpleDateFormat("yyyy-MM-dd").format(new Date()), origKey));
+ .thenReturn(QName.create("ns", SimpleDateFormatUtil.getRevisionFormat().format(new Date()), origKey));
LOG.info("Modules found [{}]", modules.size());
for (final Module module : modules) {
LOG.info("Modules found [{}]", modules.size());
for (final Module module : modules) {
- final String revisionString = SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision());
+ final String revisionString = module.getQNameModule().getFormattedRevision();
final Resource resource = new Resource();
LOG.debug("Working on [{},{}]...", module.getName(), revisionString);
final ApiDeclaration doc =
final Resource resource = new Resource();
LOG.debug("Working on [{},{}]...", module.getName(), revisionString);
final ApiDeclaration doc =