[ONOS-3875] Code Framework for YangUtils
Change-Id: I3844f8eca6f061900367637fb671cb828a8e6d09
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java b/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
new file mode 100644
index 0000000..f3798f8
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangNodeType.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016 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.yangutils.datamodel;
+
+/**
+ * Node type in data model tree corresponding to YANG schema.
+ */
+public enum YangNodeType {
+ /**
+ * Node contains module information.
+ */
+ MODULE_NODE,
+
+ /**
+ * Node contains sub module information.
+ */
+ SUB_MODULE_NODE,
+
+ /**
+ * Node contains "YANG's typedef" information.
+ */
+ TYPEDEF_NODE,
+
+ /**
+ * Node contains "YANG's type" information.
+ */
+ TYPE_NODE,
+
+ /**
+ * Node contains "YANG's choice" information.
+ */
+ CHOICE_NODE,
+
+ /**
+ * Node contains "YANG's case" information.
+ */
+ CASE_NODE,
+
+ /**
+ * Node contains "YANG's enumeration" information.
+ */
+ ENUMERATION_NODE,
+
+ /**
+ * Node contains grouping information.
+ */
+ GROUPING_NODE,
+
+ /**
+ * Node contains "YANG's uses" information.
+ */
+ USES_NODE,
+
+ /**
+ * Node contains augmentation information.
+ */
+ AUGMENT_NODE,
+
+ /**
+ * Node contains "YANG's container" information.
+ */
+ CONTAINER_NODE,
+
+ /**
+ * Node contains "YANG's list" information.
+ */
+ LIST_NODE
+}
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java b/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
new file mode 100644
index 0000000..8683928
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/exceptions/DataModelException.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2016 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.yangutils.datamodel.exceptions;
+
+/**
+ * Base class for exceptions in data model operations.
+ */
+public class DataModelException extends Exception {
+
+ private static final long serialVersionUID = 201601270658L;
+
+ /**
+ * Constructor to create a data model exception with message.
+ *
+ * @param message the detail of exception in string
+ */
+ public DataModelException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor to create exception from message and cause.
+ *
+ * @param message the detail of exception in string
+ * @param cause underlying cause of the error
+ */
+ public DataModelException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor to create exception from cause.
+ *
+ * @param cause underlying cause of the error
+ */
+ public DataModelException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java b/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
new file mode 100644
index 0000000..11492c9
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/exceptions/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2016 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.
+ */
+/**
+ * Custom data model exceptions.
+ */
+package org.onosproject.yangutils.datamodel.exceptions;
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/package-info.java b/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
new file mode 100644
index 0000000..6178452
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/datamodel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Maintains application's schema information.
+ */
+package org.onosproject.yangutils.datamodel;
diff --git a/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java b/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java
new file mode 100644
index 0000000..811f9a3
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/parser/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Parse the YANG information from ANTLR generated parse tree.
+ */
+package org.onosproject.yangutils.parser.impl;
diff --git a/src/main/java/org/onosproject/yangutils/parser/package-info.java b/src/main/java/org/onosproject/yangutils/parser/package-info.java
new file mode 100644
index 0000000..c748015
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/parser/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Interfaces to process YANG information from ANTLR generated listeners.
+ */
+package org.onosproject.yangutils.parser;
diff --git a/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
new file mode 100644
index 0000000..cc0c225
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016 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.yangutils.plugin.manager;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+* ONOS YANG utility maven plugin.
+* Goal of plugin is yang2java
+* Execution phase in generate-sources
+* requiresDependencyResolution at compile time
+*/
+@Mojo(name = "yang2java", defaultPhase = LifecyclePhase.GENERATE_SOURCES,
+ requiresDependencyResolution = ResolutionScope.COMPILE, requiresProject = true)
+public class YangUtilManager extends AbstractMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ //TODO: implement the MOJO plugin
+ }
+}
diff --git a/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java b/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java
new file mode 100644
index 0000000..0a398e7
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/plugin/manager/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * YANG utility maven plugin.
+ */
+package org.onosproject.yangutils.plugin.manager;
diff --git a/src/main/java/org/onosproject/yangutils/translator/package-info.java b/src/main/java/org/onosproject/yangutils/translator/package-info.java
new file mode 100644
index 0000000..c82cb5f
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/translator/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Translator to generate class definition corresponding to YANG definition.
+ */
+package org.onosproject.yangutils.translator;
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java b/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java
new file mode 100644
index 0000000..87abe12
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Generates java class definition from data model.
+ */
+package org.onosproject.yangutils.translator.tojava;
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java b/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
new file mode 100644
index 0000000..e9706ab
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/utils/io/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * File system utilities implementation.
+ */
+package org.onosproject.yangutils.utils.io.impl;
diff --git a/src/main/java/org/onosproject/yangutils/utils/io/package-info.java b/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
new file mode 100644
index 0000000..3cb930a
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/utils/io/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * File system utilities.
+ */
+package org.onosproject.yangutils.utils.io;
diff --git a/src/main/java/org/onosproject/yangutils/utils/package-info.java b/src/main/java/org/onosproject/yangutils/utils/package-info.java
new file mode 100644
index 0000000..44769eb
--- /dev/null
+++ b/src/main/java/org/onosproject/yangutils/utils/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 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.
+ */
+
+/**
+ * Utilities for YANG maven plugin.
+ */
+package org.onosproject.yangutils.utils;