[ONOS-5793] Implementation of Runtime Service API
Change-Id: Ibfc7aab7a18b17a16881d973d2d2bdd0daa23871
diff --git a/runtime/api/pom.xml b/runtime/api/pom.xml
deleted file mode 100644
index 462eb3a..0000000
--- a/runtime/api/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<!--
- ~ Copyright 2017-present Open Networking Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime</artifactId>
- <version>1.12-SNAPSHOT</version>
- </parent>
-
- <artifactId>onos-yang-runtime-api</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-api</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <configuration>
- <skipIfEmpty>true</skipIfEmpty>
- </configuration>
- <executions>
- <execution>
- <id>default</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/ModelRegistrationParam.java b/runtime/api/src/main/java/org/onosproject/yang/runtime/api/ModelRegistrationParam.java
deleted file mode 100644
index c1d2bf5..0000000
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/ModelRegistrationParam.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yang.runtime.api;
-
-import org.onosproject.yang.YangModel;
-import org.onosproject.yang.YangModuleId;
-
-/**
- * Representation of model registration parameters.
- */
-public interface ModelRegistrationParam {
-
- /**
- * Returns YANG model.
- *
- * @return YANG model
- */
- YangModel getYangModel();
-
- /**
- * Sets YANG model.
- *
- * @param model YANG model
- */
- void setYangModel(YangModel model);
-
- /**
- * Returns extended app related information of a module/sub-module.
- *
- * @param id YANG module identifier
- * @return application module information
- */
- AppModuleInfo getAppModuleInfo(YangModuleId id);
-
- /**
- * Adds application module information associated with module identifier.
- * It's expected that application should provide information for all the
- * YANG modules.
- *
- * @param id YANG module identifier
- * @param info application information associated with module identifier
- */
- void addAppModuleInfo(YangModuleId id, AppModuleInfo info);
-}
diff --git a/runtime/app/pom.xml b/runtime/app/pom.xml
deleted file mode 100644
index 973b6a2..0000000
--- a/runtime/app/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<!--
- ~ Copyright 2017-present Open Networking Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime</artifactId>
- <version>1.12-SNAPSHOT</version>
- </parent>
-
- <artifactId>onos-yang-runtime-app</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-datamodel</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime-uils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-api</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>RELEASE</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-maven-plugin</artifactId>
- <version>${project.version}</version>
- <configuration>
- <yangFilesDir>src/test/resources</yangFilesDir>
- </configuration>
- <executions>
- <execution>
- <id>default</id>
- <goals>
- <goal>yang2java</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <configuration>
- <skipIfEmpty>true</skipIfEmpty>
- </configuration>
- <executions>
- <execution>
- <id>default</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/package-info.java b/runtime/app/src/main/java/org/onosproject/yang/runtime/app/package-info.java
deleted file mode 100644
index d4e7f72..0000000
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Implementation of runtime api.
- */
-package org.onosproject.yang.runtime.app;
\ No newline at end of file
diff --git a/runtime/pom.xml b/runtime/pom.xml
index 6760614..b046e4e 100644
--- a/runtime/pom.xml
+++ b/runtime/pom.xml
@@ -1,5 +1,5 @@
<!--
- ~ Copyright 2016-present Open Networking Laboratory
+ ~ Copyright 2017-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -25,13 +26,7 @@
</parent>
<artifactId>onos-yang-runtime</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>api</module>
- <module>app</module>
- <module>utils</module>
- </modules>
+ <packaging>jar</packaging>
<dependencies>
<dependency>
@@ -44,6 +39,31 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-model</artifactId>
+ <version>1.12-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-compiler-api</artifactId>
+ <version>1.12-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-compiler-datamodel</artifactId>
+ <version>1.12-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-yang-compiler-plugin-utils</artifactId>
+ <version>1.12-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>RELEASE</version>
+ </dependency>
</dependencies>
<build>
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/AnnotatedNodeInfo.java b/runtime/src/main/java/org/onosproject/yang/runtime/AnnotatedNodeInfo.java
similarity index 97%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/AnnotatedNodeInfo.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/AnnotatedNodeInfo.java
index d897cb9..3c249b3 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/AnnotatedNodeInfo.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/AnnotatedNodeInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.model.ResourceId;
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/Annotation.java b/runtime/src/main/java/org/onosproject/yang/runtime/Annotation.java
similarity index 95%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/Annotation.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/Annotation.java
index e2db85d..dd01e93 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/Annotation.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/Annotation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
/**
* Abstraction of an entity that represents annotated attribute.
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/AppModuleInfo.java b/runtime/src/main/java/org/onosproject/yang/runtime/AppModuleInfo.java
similarity index 80%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/AppModuleInfo.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/AppModuleInfo.java
index f75f119..4ad75a4 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/AppModuleInfo.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/AppModuleInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import java.util.List;
@@ -33,13 +33,6 @@
Class<?> getModuleClass();
/**
- * Sets module class.
- *
- * @param moduleClass module class
- */
- void setModuleClass(Class<?> moduleClass);
-
- /**
* Reference RFC 7895
* Retrieves the list of YANG feature names from this module that are
* supported by the server, regardless of whether they are
@@ -48,11 +41,4 @@
* @return list of YANG features
*/
List<String> getFeatureList();
-
- /**
- * Adds supported feature.
- *
- * @param feature supported feature
- */
- void addFeature(String feature);
}
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeData.java b/runtime/src/main/java/org/onosproject/yang/runtime/CompositeData.java
similarity index 92%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeData.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/CompositeData.java
index ea9667f..33653b3 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeData.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/CompositeData.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import java.util.List;
@@ -60,9 +60,9 @@
Builder addAnnotatedNodeInfo(AnnotatedNodeInfo info);
/**
- * Builds an instance of decoded output.
+ * Builds an instance of composite data.
*
- * @return decoded output
+ * @return composite data
*/
CompositeData build();
}
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeStream.java b/runtime/src/main/java/org/onosproject/yang/runtime/CompositeStream.java
similarity index 95%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeStream.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/CompositeStream.java
index 066e230..c64d8e6 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/CompositeStream.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/CompositeStream.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import java.io.InputStream;
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotatedNodeInfo.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotatedNodeInfo.java
new file mode 100644
index 0000000..5e460aa
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotatedNodeInfo.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import org.onosproject.yang.model.ResourceId;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.hash;
+
+/**
+ * Representation of default implementation of annotated node information.
+ */
+public class DefaultAnnotatedNodeInfo implements AnnotatedNodeInfo {
+
+ private ResourceId resourceId;
+ private List<Annotation> annotations;
+
+ /**
+ * Creates an instance of data node.
+ *
+ * @param b data node builder
+ */
+ protected DefaultAnnotatedNodeInfo(Builder b) {
+ resourceId = b.resourceId;
+ annotations = b.annotations;
+ }
+
+ @Override
+ public ResourceId resourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public List<Annotation> annotations() {
+ return annotations;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash(resourceId, annotations);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultAnnotatedNodeInfo) {
+ DefaultAnnotatedNodeInfo that = (DefaultAnnotatedNodeInfo) obj;
+ return Objects.equals(resourceId, that.resourceId) &&
+ Objects.equals(annotations, that.annotations);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(getClass())
+ .add("resourceId", resourceId)
+ .add("annotations", annotations)
+ .toString();
+ }
+
+ /**
+ * Retrieves a new annotated node info builder.
+ *
+ * @return annotated node info builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Represents implementation of annotated node information builder.
+ */
+ public static class Builder implements AnnotatedNodeInfo.Builder {
+
+ private ResourceId resourceId;
+ private List<Annotation> annotations;
+
+ /**
+ * Creates an instance of annotated node info builder.
+ */
+ public Builder() {
+ annotations = new LinkedList<>();
+ }
+
+ @Override
+ public Builder resourceId(ResourceId id) {
+ resourceId = id;
+ return this;
+ }
+
+ @Override
+ public Builder addAnnotation(Annotation a) {
+ annotations.add(a);
+ return this;
+ }
+
+ @Override
+ public AnnotatedNodeInfo build() {
+ return new DefaultAnnotatedNodeInfo(this);
+ }
+ }
+}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotation.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotation.java
new file mode 100644
index 0000000..9c011e7
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAnnotation.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.hash;
+
+/**
+ * Representation of default implementation of annotation.
+ */
+public class DefaultAnnotation implements Annotation {
+
+ private String name;
+ private String value;
+
+ /**
+ * Creates an instance of annotation.
+ *
+ * @param n annotation name
+ * @param v annotation value
+ */
+ protected DefaultAnnotation(String n, String v) {
+ name = n;
+ value = v;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public String value() {
+ return value;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash(name, value);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultAnnotation) {
+ DefaultAnnotation that = (DefaultAnnotation) obj;
+ return Objects.equals(name, that.name) &&
+ Objects.equals(value, that.value);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(getClass())
+ .add("name", name)
+ .add("value", value)
+ .toString();
+ }
+}
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultAppModuleInfo.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAppModuleInfo.java
similarity index 77%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultAppModuleInfo.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/DefaultAppModuleInfo.java
index 8fdc82b..ff1f4e1 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultAppModuleInfo.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultAppModuleInfo.java
@@ -14,30 +14,30 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime;
-import org.onosproject.yang.runtime.api.AppModuleInfo;
-
-import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
/**
* Represents default application module information.
*/
public class DefaultAppModuleInfo implements AppModuleInfo {
- private Class<?> module;
private final List<String> features;
+ private Class<?> module;
/**
* Creates an instance of application module information.
+ *
+ * @param m module's class
+ * @param f supported features
*/
- public DefaultAppModuleInfo() {
- features = new ArrayList<>();
+ public DefaultAppModuleInfo(Class<?> m, List<String> f) {
+ features = f;
+ module = m;
}
@Override
@@ -46,22 +46,11 @@
}
@Override
- public void setModuleClass(Class<?> moduleClass) {
- checkNotNull(moduleClass);
- module = moduleClass;
- }
-
- @Override
public List<String> getFeatureList() {
return features;
}
@Override
- public void addFeature(String feature) {
- features.add(feature);
- }
-
- @Override
public int hashCode() {
return Objects.hash(module, features);
}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeData.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeData.java
new file mode 100644
index 0000000..b2e9f72
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeData.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.hash;
+
+/**
+ * Representation of default implementation of composite data.
+ */
+public class DefaultCompositeData implements CompositeData {
+
+ private ResourceData data;
+ private List<AnnotatedNodeInfo> annotationsInfo;
+
+ /**
+ * Creates an instance of composite data.
+ *
+ * @param b composite data builder
+ */
+ protected DefaultCompositeData(Builder b) {
+ data = b.data;
+ annotationsInfo = b.annotationsInfo;
+ }
+
+ @Override
+ public ResourceData resourceData() {
+ return data;
+ }
+
+ @Override
+ public List<AnnotatedNodeInfo> annotatedNodesInfo() {
+ return annotationsInfo;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash(data, annotationsInfo);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultCompositeData) {
+ DefaultCompositeData that = (DefaultCompositeData) obj;
+ return Objects.equals(data, that.data) &&
+ Objects.equals(annotationsInfo, that.annotationsInfo);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(getClass())
+ .add("data", data)
+ .add("annotationsInfo", annotationsInfo)
+ .toString();
+ }
+
+ /**
+ * Retrieves a new composite data builder.
+ *
+ * @return composite data builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Represents implementation of composite data builder.
+ */
+ public static class Builder implements CompositeData.Builder {
+
+ private ResourceData data;
+ private List<AnnotatedNodeInfo> annotationsInfo;
+
+ /**
+ * Creates an instance of composite data builder.
+ */
+ protected Builder() {
+ annotationsInfo = new LinkedList<>();
+ }
+
+ @Override
+ public Builder resourceData(ResourceData rd) {
+ data = rd;
+ return this;
+ }
+
+ @Override
+ public Builder addAnnotatedNodeInfo(AnnotatedNodeInfo info) {
+ annotationsInfo.add(info);
+ return this;
+ }
+
+ @Override
+ public CompositeData build() {
+ return new DefaultCompositeData(this);
+ }
+ }
+}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeStream.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeStream.java
new file mode 100644
index 0000000..68a4b89
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultCompositeStream.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import java.io.InputStream;
+
+/**
+ * Representation of default implementation of composite stream.
+ */
+public class DefaultCompositeStream implements CompositeStream {
+
+ private String resourceId;
+ private InputStream resourceData;
+
+ /**
+ * Creates an instance of composite stream.
+ *
+ * @param id uri as per RFC 3986
+ * @param data input data stream
+ */
+ public DefaultCompositeStream(String id, InputStream data) {
+ resourceId = id;
+ resourceData = data;
+ }
+
+ @Override
+ public String resourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public InputStream resourceData() {
+ return resourceData;
+ }
+}
+
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultModelRegistrationParam.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultModelRegistrationParam.java
similarity index 61%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultModelRegistrationParam.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/DefaultModelRegistrationParam.java
index 36d72be..54739e8 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultModelRegistrationParam.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultModelRegistrationParam.java
@@ -14,33 +14,33 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.YangModel;
import org.onosproject.yang.YangModuleId;
-import org.onosproject.yang.runtime.api.AppModuleInfo;
-import org.onosproject.yang.runtime.api.ModelRegistrationParam;
-import java.util.LinkedHashMap;
+import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
/**
* Represents default model registration parameter.
*/
public class DefaultModelRegistrationParam implements ModelRegistrationParam {
- private YangModel model;
private final Map<YangModuleId, AppModuleInfo> appInfoMap;
+ private YangModel model;
/**
- * Creates an instance of model registration parameter.
+ * Creates an instance of model registration param.
+ *
+ * @param b model registration param builder
*/
- public DefaultModelRegistrationParam() {
- appInfoMap = new LinkedHashMap<>();
+ protected DefaultModelRegistrationParam(Builder b) {
+ appInfoMap = b.appInfoMap;
+ model = b.model;
}
@Override
@@ -49,22 +49,11 @@
}
@Override
- public void setYangModel(YangModel model) {
- checkNotNull(model);
- this.model = model;
- }
-
- @Override
public AppModuleInfo getAppModuleInfo(YangModuleId id) {
return appInfoMap.get(id);
}
@Override
- public void addAppModuleInfo(YangModuleId id, AppModuleInfo info) {
- appInfoMap.put(id, info);
- }
-
- @Override
public int hashCode() {
return Objects.hash(appInfoMap, model);
}
@@ -94,4 +83,47 @@
.add("appInfo", appInfoMap)
.toString();
}
+
+ /**
+ * Retrieves a new model registration parameter builder.
+ *
+ * @return model registration parameter builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Represents implementation of model registration parameter builder.
+ */
+ public static class Builder implements ModelRegistrationParam.Builder {
+
+ private final Map<YangModuleId, AppModuleInfo> appInfoMap;
+ private YangModel model;
+
+ /**
+ * Creates an instance of model registration parameter builder.
+ */
+ public Builder() {
+ appInfoMap = new HashMap<>();
+ }
+
+ @Override
+ public Builder addAppModuleInfo(
+ YangModuleId id, AppModuleInfo info) {
+ appInfoMap.put(id, info);
+ return this;
+ }
+
+ @Override
+ public ModelRegistrationParam.Builder setYangModel(YangModel m) {
+ model = m;
+ return this;
+ }
+
+ @Override
+ public DefaultModelRegistrationParam build() {
+ return new DefaultModelRegistrationParam(this);
+ }
+ }
}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java
new file mode 100644
index 0000000..dfdf5e2
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultResourceData.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import org.onosproject.yang.model.DataNode;
+import org.onosproject.yang.model.ResourceId;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.hash;
+
+/**
+ * Representation of default implementation of resource data.
+ */
+public class DefaultResourceData implements ResourceData {
+
+ private List<DataNode> nodes;
+ private ResourceId resourceId;
+
+ /**
+ * Creates an instance of resource data.
+ *
+ * @param b resource data builder
+ */
+ protected DefaultResourceData(Builder b) {
+ resourceId = b.resourceId;
+ nodes = b.nodes;
+ }
+
+ @Override
+ public List<DataNode> dataNodes() {
+ return nodes;
+ }
+
+ @Override
+ public ResourceId resourceId() {
+ return resourceId;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash(resourceId, nodes);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultResourceData) {
+ DefaultResourceData that = (DefaultResourceData) obj;
+ return Objects.equals(resourceId, that.resourceId) &&
+ Objects.equals(nodes, that.nodes);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(getClass())
+ .add("resourceId", resourceId)
+ .add("nodes", nodes)
+ .toString();
+ }
+
+ /**
+ * Retrieves a new resource data builder.
+ *
+ * @return resource data builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Represents implementation of resource data builder.
+ */
+ public static class Builder implements ResourceData.Builder {
+
+ private List<DataNode> nodes;
+ private ResourceId resourceId;
+
+ /**
+ * Creates an instance of resource data builder.
+ */
+ protected Builder() {
+ nodes = new LinkedList<>();
+ }
+
+ @Override
+ public ResourceData.Builder addDataNode(DataNode node) {
+ nodes.add(node);
+ return this;
+ }
+
+ @Override
+ public ResourceData.Builder resourceId(ResourceId id) {
+ resourceId = id;
+ return this;
+ }
+
+ @Override
+ public ResourceData build() {
+ return new DefaultResourceData(this);
+ }
+ }
+}
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerContext.java b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultYangSerializerContext.java
similarity index 91%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerContext.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/DefaultYangSerializerContext.java
index 65f699e..9da0b01 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerContext.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/DefaultYangSerializerContext.java
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.model.SchemaContext;
-import org.onosproject.yang.runtime.api.YangSerializerContext;
/**
* Represents YANG serializer context implementation.
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/ModelRegistrationParam.java b/runtime/src/main/java/org/onosproject/yang/runtime/ModelRegistrationParam.java
new file mode 100644
index 0000000..2308427
--- /dev/null
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ModelRegistrationParam.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime;
+
+import org.onosproject.yang.YangModel;
+import org.onosproject.yang.YangModuleId;
+
+/**
+ * Representation of model registration parameters.
+ */
+public interface ModelRegistrationParam {
+
+ /**
+ * Returns YANG model.
+ *
+ * @return YANG model
+ */
+ YangModel getYangModel();
+
+ /**
+ * Returns extended app related information of a module/sub-module.
+ *
+ * @param id YANG module identifier
+ * @return application module information
+ */
+ AppModuleInfo getAppModuleInfo(YangModuleId id);
+
+ /**
+ * Abstraction of an entity that represents builder of model registration
+ * parameters.
+ */
+ interface Builder {
+
+ /**
+ * Adds application module information associated with module identifier.
+ * It's expected that application should provide information for all the
+ * YANG modules.
+ *
+ * @param id YANG module identifier
+ * @param info application information associated with module identifier
+ * @return builder
+ */
+ Builder addAppModuleInfo(YangModuleId id, AppModuleInfo info);
+
+ /**
+ * Sets YANG model.
+ *
+ * @param model YANG model
+ * @return builder
+ */
+ Builder setYangModel(YangModel model);
+
+ /**
+ * Builds an instance of model registration param.
+ *
+ * @return model registration param
+ */
+ ModelRegistrationParam build();
+ }
+}
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/ResourceData.java b/runtime/src/main/java/org/onosproject/yang/runtime/ResourceData.java
similarity index 90%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/ResourceData.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/ResourceData.java
index 05e2137..b4af900 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/ResourceData.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ResourceData.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.ResourceId;
@@ -62,10 +62,10 @@
Builder resourceId(ResourceId identifier);
/**
- * Builds an instance of composite data.
+ * Builds an instance of resource data.
*
- * @return composite data
+ * @return resource data
*/
- CompositeStream build();
+ ResourceData build();
}
}
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangModelRegistry.java
similarity index 96%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangModelRegistry.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangModelRegistry.java
index 036c399..a89212e 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangModelRegistry.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.YangModel;
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeException.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeException.java
similarity index 97%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeException.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeException.java
index f6b6f24..744cbb6 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeException.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
/**
* Represents base class for exceptions in YANG runtime operations.
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeService.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeService.java
similarity index 98%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeService.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeService.java
index e75d329..1d54ff7 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangRuntimeService.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangRuntimeService.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
/**
* Service for encoding and decoding between internal and external model
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializer.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializer.java
similarity index 98%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializer.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangSerializer.java
index bc22af0..15d1b90 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializer.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializer.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
/**
* Abstraction of entity capable of encoding and decoding arbitrary
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerContext.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerContext.java
similarity index 95%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerContext.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerContext.java
index 1feee33..a5972e6 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerContext.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerContext.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import org.onosproject.yang.model.SchemaContext;
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerRegistry.java
similarity index 83%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerRegistry.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerRegistry.java
index 1d1b335..3a3610d 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/YangSerializerRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/YangSerializerRegistry.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.api;
+package org.onosproject.yang.runtime;
import java.util.Set;
@@ -24,7 +24,8 @@
public interface YangSerializerRegistry {
/**
- * Registers a new serializer.
+ * Registers a new serializer. Overwrites, if serializer for a given data
+ * format is already registered.
*
* @param serializer serializer to be registered
*/
@@ -34,6 +35,7 @@
* Unregisters the specified serializer.
*
* @param serializer serializer to be unregistered
+ * @throws IllegalArgumentException when input serializer is not registered
*/
void unregisterSerializer(YangSerializer serializer);
@@ -43,5 +45,4 @@
* @return collection of serializers
*/
Set<YangSerializer> getSerializers();
-
}
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/RuntimeHelper.java b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/RuntimeHelper.java
similarity index 90%
rename from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/RuntimeHelper.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/helperutils/RuntimeHelper.java
index 5792862..63aa34a 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/RuntimeHelper.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/RuntimeHelper.java
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.utils;
+package org.onosproject.yang.runtime.helperutils;
import org.onosproject.yang.YangModel;
import org.onosproject.yang.YangModule;
import org.onosproject.yang.compiler.datamodel.YangNode;
import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.compiler.plugin.utils.YangApacheUtils;
import java.io.IOException;
import java.io.InputStream;
@@ -114,4 +115,14 @@
public static String getServiceName(YangSchemaNode schemaNode) {
return getInterfaceClassName(schemaNode) + SERVICE;
}
+
+ /**
+ * Returns date in string format.
+ *
+ * @param schemaNode schema node
+ * @return date in string format
+ */
+ public static String getDateInStringFormat(YangNode schemaNode) {
+ return YangApacheUtils.getDateInStringFormat(schemaNode);
+ }
}
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/SerializerHelper.java b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
similarity index 96%
rename from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/SerializerHelper.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
index 4315c35..e786673 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/SerializerHelper.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/SerializerHelper.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.utils;
+package org.onosproject.yang.runtime.helperutils;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.ResourceId;
-import org.onosproject.yang.runtime.api.YangSerializerContext;
+import org.onosproject.yang.runtime.YangSerializerContext;
import java.util.List;
@@ -136,7 +136,7 @@
*/
public static Builder addDataNode(Builder builder,
String name, String namespace,
- String value, DataNode type) {
+ String value, DataNode.Type type) {
// TODO implementation
return null;
}
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/package-info.java
similarity index 92%
rename from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/helperutils/package-info.java
index 145ee65..6788c8a 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/helperutils/package-info.java
@@ -17,4 +17,4 @@
/**
* Representation of YANG runtime utilities.
*/
-package org.onosproject.yang.runtime.utils;
\ No newline at end of file
+package org.onosproject.yang.runtime.helperutils;
\ No newline at end of file
diff --git a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/package-info.java b/runtime/src/main/java/org/onosproject/yang/runtime/package-info.java
similarity index 94%
rename from runtime/api/src/main/java/org/onosproject/yang/runtime/api/package-info.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/package-info.java
index 5a0f954..bd6976e 100644
--- a/runtime/api/src/main/java/org/onosproject/yang/runtime/api/package-info.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/package-info.java
@@ -17,4 +17,4 @@
/**
* Set of facilities for processing and working with compiled YANG models.
*/
-package org.onosproject.yang.runtime.api;
\ No newline at end of file
+package org.onosproject.yang.runtime;
\ No newline at end of file
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
similarity index 96%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistry.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
index f5e3a60..b064e9b 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/DefaultYangModelRegistry.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.ymrimpl;
import org.onosproject.yang.YangModel;
import org.onosproject.yang.YangModuleId;
@@ -28,9 +28,9 @@
import org.onosproject.yang.model.SchemaContext;
import org.onosproject.yang.model.SchemaId;
import org.onosproject.yang.model.SingleInstanceNodeContext;
-import org.onosproject.yang.runtime.api.AppModuleInfo;
-import org.onosproject.yang.runtime.api.ModelRegistrationParam;
-import org.onosproject.yang.runtime.api.YangModelRegistry;
+import org.onosproject.yang.runtime.AppModuleInfo;
+import org.onosproject.yang.runtime.ModelRegistrationParam;
+import org.onosproject.yang.runtime.YangModelRegistry;
import org.slf4j.Logger;
import java.util.ArrayList;
@@ -44,11 +44,11 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Collections.sort;
import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.getNodeIdFromSchemaId;
-import static org.onosproject.yang.compiler.plugin.utils.YangApacheUtils.getDateInStringFormat;
-import static org.onosproject.yang.runtime.utils.RuntimeHelper.getInterfaceClassName;
-import static org.onosproject.yang.runtime.utils.RuntimeHelper.getNodes;
-import static org.onosproject.yang.runtime.utils.RuntimeHelper.getOpParamClassName;
-import static org.onosproject.yang.runtime.utils.RuntimeHelper.getServiceName;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getDateInStringFormat;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getInterfaceClassName;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getNodes;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getOpParamClassName;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getServiceName;
import static org.slf4j.LoggerFactory.getLogger;
/**
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/package-info.java
similarity index 86%
copy from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
copy to runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/package-info.java
index 145ee65..2f5448f 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ymrimpl/package-info.java
@@ -15,6 +15,6 @@
*/
/**
- * Representation of YANG runtime utilities.
+ * Contains implementation of YANG model registry.
*/
-package org.onosproject.yang.runtime.utils;
\ No newline at end of file
+package org.onosproject.yang.runtime.ymrimpl;
\ No newline at end of file
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangRuntimeHandler.java b/runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/DefaultYangRuntimeHandler.java
similarity index 79%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangRuntimeHandler.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/DefaultYangRuntimeHandler.java
index b832370..22667dd 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangRuntimeHandler.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/DefaultYangRuntimeHandler.java
@@ -14,16 +14,19 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.yrhimpl;
import org.onosproject.yang.model.SchemaContext;
-import org.onosproject.yang.runtime.api.CompositeData;
-import org.onosproject.yang.runtime.api.CompositeStream;
-import org.onosproject.yang.runtime.api.YangRuntimeException;
-import org.onosproject.yang.runtime.api.YangRuntimeService;
-import org.onosproject.yang.runtime.api.YangSerializer;
-import org.onosproject.yang.runtime.api.YangSerializerContext;
-import org.onosproject.yang.runtime.api.YangSerializerRegistry;
+import org.onosproject.yang.runtime.CompositeData;
+import org.onosproject.yang.runtime.CompositeStream;
+import org.onosproject.yang.runtime.DefaultYangSerializerContext;
+import org.onosproject.yang.runtime.YangRuntimeException;
+import org.onosproject.yang.runtime.YangRuntimeService;
+import org.onosproject.yang.runtime.YangSerializer;
+import org.onosproject.yang.runtime.YangSerializerContext;
+import org.onosproject.yang.runtime.YangSerializerRegistry;
+import org.onosproject.yang.runtime.ysrimpl.DefaultYangSerializerRegistry;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java b/runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/package-info.java
similarity index 86%
copy from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
copy to runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/package-info.java
index 145ee65..d4aef06 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/yrhimpl/package-info.java
@@ -15,6 +15,6 @@
*/
/**
- * Representation of YANG runtime utilities.
+ * Contains implementation of YANG runtime service.
*/
-package org.onosproject.yang.runtime.utils;
\ No newline at end of file
+package org.onosproject.yang.runtime.yrhimpl;
\ No newline at end of file
diff --git a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/DefaultYangSerializerRegistry.java
similarity index 91%
rename from runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerRegistry.java
rename to runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/DefaultYangSerializerRegistry.java
index daf4ac6..df652b5 100644
--- a/runtime/app/src/main/java/org/onosproject/yang/runtime/app/DefaultYangSerializerRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/DefaultYangSerializerRegistry.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.ysrimpl;
-import org.onosproject.yang.runtime.api.YangSerializer;
-import org.onosproject.yang.runtime.api.YangSerializerRegistry;
+import org.onosproject.yang.runtime.YangSerializer;
+import org.onosproject.yang.runtime.YangSerializerRegistry;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import org.slf4j.Logger;
import java.util.HashSet;
diff --git a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java b/runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/package-info.java
similarity index 86%
copy from runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
copy to runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/package-info.java
index 145ee65..93f65f4 100644
--- a/runtime/utils/src/main/java/org/onosproject/yang/runtime/utils/package-info.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/ysrimpl/package-info.java
@@ -15,6 +15,6 @@
*/
/**
- * Representation of YANG runtime utilities.
+ * Contains implementation of YANG schema registry.
*/
-package org.onosproject.yang.runtime.utils;
\ No newline at end of file
+package org.onosproject.yang.runtime.ysrimpl;
\ No newline at end of file
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
similarity index 98%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
index baa6e7b..8d6caba 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/DefaultYangModelRegistryTest.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistryTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Rule;
import org.junit.Test;
@@ -22,6 +22,7 @@
import org.onosproject.yang.compiler.datamodel.YangNode;
import org.onosproject.yang.compiler.datamodel.YangRevision;
import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import java.io.IOException;
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/RuntimeHandlerTest.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/RuntimeHandlerTest.java
similarity index 75%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/RuntimeHandlerTest.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/RuntimeHandlerTest.java
index 24a2e13..1d6369b 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/RuntimeHandlerTest.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/RuntimeHandlerTest.java
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Test;
-import org.onosproject.yang.runtime.api.CompositeData;
-import org.onosproject.yang.runtime.api.CompositeStream;
-import org.onosproject.yang.runtime.api.YangRuntimeService;
-import org.onosproject.yang.runtime.api.YangSerializer;
+import org.onosproject.yang.runtime.CompositeData;
+import org.onosproject.yang.runtime.CompositeStream;
+import org.onosproject.yang.runtime.YangRuntimeService;
+import org.onosproject.yang.runtime.YangSerializer;
+import org.onosproject.yang.runtime.yrhimpl.DefaultYangRuntimeHandler;
+import org.onosproject.yang.runtime.ysrimpl.DefaultYangSerializerRegistry;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
-import static org.onosproject.yang.runtime.app.SerializerRegistryTest.JSON;
-import static org.onosproject.yang.runtime.app.SerializerRegistryTest.XML;
-import static org.onosproject.yang.runtime.app.TestSerializer.TESTSTREAM;
+import static org.onosproject.yang.runtime.impl.SerializerRegistryTest.JSON;
+import static org.onosproject.yang.runtime.impl.SerializerRegistryTest.XML;
+import static org.onosproject.yang.runtime.impl.TestSerializer.TESTSTREAM;
/**
* Test cases for YANG runtime handler.
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/SerializerRegistryTest.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/SerializerRegistryTest.java
similarity index 94%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/SerializerRegistryTest.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/SerializerRegistryTest.java
index 5d4b206..6d9f88c 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/SerializerRegistryTest.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/SerializerRegistryTest.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Test;
-import org.onosproject.yang.runtime.api.YangSerializer;
+import org.onosproject.yang.runtime.YangSerializer;
+import org.onosproject.yang.runtime.ysrimpl.DefaultYangSerializerRegistry;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestCaseSchemaContext.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestCaseSchemaContext.java
similarity index 89%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestCaseSchemaContext.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestCaseSchemaContext.java
index 136fd58..cedfdf5 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestCaseSchemaContext.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestCaseSchemaContext.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Test;
import org.onosproject.yang.compiler.datamodel.DefaultYangNamespace;
@@ -24,12 +24,13 @@
import org.onosproject.yang.compiler.datamodel.YangSchemaNodeIdentifier;
import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
import org.onosproject.yang.model.SchemaId;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import static org.onosproject.yang.model.DataNode.Type.MULTI_INSTANCE_NODE;
import static org.onosproject.yang.model.DataNode.Type.SINGLE_INSTANCE_NODE;
-import static org.onosproject.yang.runtime.app.TestUtils.checkLeafListSchemaContext;
-import static org.onosproject.yang.runtime.app.TestUtils.checkLeafSchemaContext;
-import static org.onosproject.yang.runtime.app.TestUtils.checkSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkLeafListSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkLeafSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkSchemaContext;
/**
* Tests the default schema context methods.
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestLeafSchemaContext.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestLeafSchemaContext.java
similarity index 89%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestLeafSchemaContext.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestLeafSchemaContext.java
index d11e930..4ceecf9 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestLeafSchemaContext.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestLeafSchemaContext.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Test;
import org.onosproject.yang.compiler.datamodel.DefaultYangNamespace;
@@ -26,10 +26,11 @@
import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.SchemaId;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
-import static org.onosproject.yang.runtime.app.TestUtils.checkLeafListSchemaContext;
-import static org.onosproject.yang.runtime.app.TestUtils.checkLeafSchemaContext;
-import static org.onosproject.yang.runtime.app.TestUtils.checkSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkLeafListSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkLeafSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkSchemaContext;
/**
* Tests the default schema context methods.
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestRpcSchemaContext.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestRpcSchemaContext.java
similarity index 97%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestRpcSchemaContext.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestRpcSchemaContext.java
index 7968b2d..1468222 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestRpcSchemaContext.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestRpcSchemaContext.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
/**
* Tests the default schema context methods.
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSchemaContext.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSchemaContext.java
similarity index 92%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSchemaContext.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSchemaContext.java
index 2c2605a..a767c1c 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSchemaContext.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSchemaContext.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.junit.Test;
import org.onosproject.yang.compiler.datamodel.YangAugment;
@@ -24,11 +24,13 @@
import org.onosproject.yang.compiler.datamodel.YangNode;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.SchemaId;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import java.util.List;
-import static org.onosproject.yang.runtime.app.TestUtils.checkLeafSchemaContext;
-import static org.onosproject.yang.runtime.app.TestUtils.checkSchemaContext;
+
+import static org.onosproject.yang.runtime.impl.TestUtils.checkLeafSchemaContext;
+import static org.onosproject.yang.runtime.impl.TestUtils.checkSchemaContext;
/**
* Tests the default schema context methods.
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSerializer.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSerializer.java
similarity index 86%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSerializer.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSerializer.java
index e6f203c..bf63dc6 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestSerializer.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestSerializer.java
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.onosproject.yang.model.DataNode;
import org.onosproject.yang.model.ResourceId;
-import org.onosproject.yang.runtime.api.AnnotatedNodeInfo;
-import org.onosproject.yang.runtime.api.CompositeData;
-import org.onosproject.yang.runtime.api.CompositeStream;
-import org.onosproject.yang.runtime.api.ResourceData;
-import org.onosproject.yang.runtime.api.YangSerializer;
-import org.onosproject.yang.runtime.api.YangSerializerContext;
+import org.onosproject.yang.runtime.AnnotatedNodeInfo;
+import org.onosproject.yang.runtime.CompositeData;
+import org.onosproject.yang.runtime.CompositeStream;
+import org.onosproject.yang.runtime.ResourceData;
+import org.onosproject.yang.runtime.YangSerializer;
+import org.onosproject.yang.runtime.YangSerializerContext;
import java.io.InputStream;
import java.util.List;
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestUtils.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestUtils.java
similarity index 98%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestUtils.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestUtils.java
index a69dc02..f249534 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestUtils.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestUtils.java
@@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+
+package org.onosproject.yang.runtime.impl;
import org.onosproject.yang.compiler.datamodel.YangLeaf;
import org.onosproject.yang.compiler.datamodel.YangLeafList;
diff --git a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
similarity index 79%
rename from runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java
rename to runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
index a42f2fb..59418e5 100644
--- a/runtime/app/src/test/java/org/onosproject/yang/runtime/app/TestYangSchemaNodeProvider.java
+++ b/runtime/src/main/test/java/org/onosproject/yang/runtime/impl/TestYangSchemaNodeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,14 +14,17 @@
* limitations under the License.
*/
-package org.onosproject.yang.runtime.app;
+package org.onosproject.yang.runtime.impl;
import org.onosproject.yang.YangModel;
import org.onosproject.yang.compiler.datamodel.YangNode;
import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
-import org.onosproject.yang.runtime.api.AppModuleInfo;
-import org.onosproject.yang.runtime.api.ModelRegistrationParam;
-import org.onosproject.yang.runtime.api.YangModelRegistry;
+import org.onosproject.yang.runtime.AppModuleInfo;
+import org.onosproject.yang.runtime.DefaultAppModuleInfo;
+import org.onosproject.yang.runtime.DefaultModelRegistrationParam;
+import org.onosproject.yang.runtime.ModelRegistrationParam;
+import org.onosproject.yang.runtime.YangModelRegistry;
+import org.onosproject.yang.runtime.ymrimpl.DefaultYangModelRegistry;
import java.io.File;
import java.io.IOException;
@@ -34,7 +37,7 @@
import static org.onosproject.yang.compiler.plugin.utils.YangApacheUtils.processYangModel;
import static org.onosproject.yang.compiler.utils.UtilConstants.TEMP;
import static org.onosproject.yang.compiler.utils.io.impl.YangIoUtils.deleteDirectory;
-import static org.onosproject.yang.runtime.utils.RuntimeHelper.getInterfaceClassName;
+import static org.onosproject.yang.runtime.helperutils.RuntimeHelper.getInterfaceClassName;
/**
* Represents mock bundle context. provides bundle context for YSR to do unit
@@ -84,18 +87,17 @@
}
//Create model registration param.
- ModelRegistrationParam param = new
- DefaultModelRegistrationParam();
+ ModelRegistrationParam.Builder b =
+ DefaultModelRegistrationParam.builder();
//create a new YANG model
YangModel model = processYangModel(META_PATH, nodes);
//set YANG model
- param.setYangModel(model);
+ b.setYangModel(model);
//generate app info.
- AppModuleInfo info = new DefaultAppModuleInfo();
- info.setModuleClass(cls);
- param.addAppModuleInfo(processModuleId((YangNode) node), info);
- reg.registerModel(param);
+ AppModuleInfo info = new DefaultAppModuleInfo(cls, null);
+ b.addAppModuleInfo(processModuleId((YangNode) node), info);
+ reg.registerModel(b.build());
}
deleteDirectory(TEMP_FOLDER_PATH);
} catch (IOException e) {
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/choice-case.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/choice-case.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/choice-case.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/choice-case.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/food.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/food.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/food.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/food.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-inet-types.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-inet-types.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-inet-types.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-inet-types.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-network.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-network.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-network.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-network.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-schedule.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-schedule.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-schedule.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-schedule.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-topology.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-topology.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-topology.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-topology.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-types.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-types.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-types.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-te-types.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-types.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-types.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-types.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-types.yang
diff --git a/runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-network-topology.yang b/runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-network-topology.yang
similarity index 100%
rename from runtime/app/src/test/resources/schemaProviderTestYangFiles/yrt-network-topology.yang
rename to runtime/src/main/test/resources/schemaProviderTestYangFiles/yrt-network-topology.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/CheckWithNamespace.yang b/runtime/src/main/test/resources/ysrTestYangFiles/CheckWithNamespace.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/CheckWithNamespace.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/CheckWithNamespace.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang b/runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/norev.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang b/runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang b/runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev2.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang b/runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev3.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang b/runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/multiRevisions/withrev4.yang
diff --git a/runtime/app/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang b/runtime/src/main/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
similarity index 100%
rename from runtime/app/src/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
rename to runtime/src/main/test/resources/ysrTestYangFiles/withoutNotification/ysr3.yang
diff --git a/runtime/utils/pom.xml b/runtime/utils/pom.xml
deleted file mode 100644
index cb401e2..0000000
--- a/runtime/utils/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<!--
- ~ Copyright 2017-present Open Networking Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime</artifactId>
- <version>1.12-SNAPSHOT</version>
- </parent>
-
- <artifactId>onos-yang-runtime-uils</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-model</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-api</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-runtime-api</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-yang-compiler-plugin-utils</artifactId>
- <version>1.12-SNAPSHOT</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <configuration>
- <skipIfEmpty>true</skipIfEmpty>
- </configuration>
- <executions>
- <execution>
- <id>default</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>