Restructured javadocs build to make groupings more manageable in the light of mavan-javadoc-plugin's silly treatment of package lists.

Change-Id: I771db3399bf8f0463927b2720ff43f862d7f2d68
diff --git a/docs/external-apis b/docs/external-apis
new file mode 100644
index 0000000..4e18664
--- /dev/null
+++ b/docs/external-apis
@@ -0,0 +1,3 @@
+org.onosproject
+org.onosproject.*
+org.onosproject.rest
\ No newline at end of file
diff --git a/docs/external-excludes b/docs/external-excludes
new file mode 100644
index 0000000..6baf542
--- /dev/null
+++ b/docs/external-excludes
@@ -0,0 +1,48 @@
+*.impl
+*.impl.*
+
+org.onlab.jdvue*
+org.onlab.stc*
+
+org.onlab.thirdparty
+org.onosproject.provider*
+org.onosproject.rest
+org.onosproject.cli*
+org.onosproject.tvue
+org.onosproject.foo
+org.onosproject.mobility
+org.onosproject.proxyarp
+org.onosproject.fwd
+org.onosproject.ifwd
+org.onosproject.optical
+org.onosproject.config
+org.onosproject.calendar
+org.onosproject.sdnip*
+org.onosproject.oecfg
+org.onosproject.metrics
+org.onosproject.store.*
+org.onosproject.openflow*
+org.onosproject.common*
+org.onosproject.routing*
+org.onosproject.bgprouter
+org.onosproject.intentperf
+org.onosproject.maven
+org.onosproject.cordfabric*
+org.onosproject.driver*
+org.onosproject.segmentrouting*
+org.onosproject.reactive*
+org.onosproject.distributedprimitives*
+org.onosproject.messagingperf*
+org.onosproject.virtualbng*
+org.onosproject.election*
+org.onosproject.demo*
+org.onosproject.xosintegration*
+org.onosproject.app.vtn*
+org.onosproject.ovsdb*
+org.onosproject.pcep*
+org.onosproject.aaa
+org.onosproject.acl*
+org.onosproject.cip*
+org.onos.acl*
+org.onosproject.vtn*
+org.onosproject.flowanalyzer
diff --git a/docs/external-incubator-apis b/docs/external-incubator-apis
new file mode 100644
index 0000000..1e3bd7a
--- /dev/null
+++ b/docs/external-incubator-apis
@@ -0,0 +1,2 @@
+org.onosproject.exp
+org.onosproject.incubator.*
diff --git a/docs/external.xml b/docs/external.xml
index 19c82b1..1f02054 100644
--- a/docs/external.xml
+++ b/docs/external.xml
@@ -49,27 +49,21 @@
                 <version>2.10.1</version>
                 <configuration>
                     <show>package</show>
-                    <excludePackageNames>org.onlab.thirdparty:*.impl:*.impl.*:org.onosproject.provider.*:org.onosproject.rest:org.onosproject.cli*:org.onosproject.tvue:org.onosproject.foo:org.onosproject.mobility:org.onosproject.proxyarp:org.onosproject.fwd:org.onosproject.ifwd:org.onosproject.optical:org.onosproject.config:org.onosproject.calendar:org.onosproject.sdnip*:org.onosproject.oecfg:org.onosproject.metrics:org.onosproject.store.*:org.onosproject.openflow.*:org.onosproject.common.*:org.onosproject.net.group.impl:org.onosproject.routing*:org.onosproject.bgprouter:org.onosproject.intentperf:org.onosproject.maven:org.onosproject.cordfabric*:org.onosproject.driver*:org.onosproject.segmentrouting*:org.onosproject.reactive*:org.onosproject.distributedprimitives*:org.onosproject.messagingperf*.org.onosproject.virtualbng*.org.onosproject.election*:org.onosproject.demo*:org.onlab.jdvue*:org.onlab.stc*:org.onosproject.xosintegration*:org.onosproject.app.vtn*:org.onosproject.ovsdb*:org.onosproject.aaa:org.onosproject.acl*:org.onosproject.flowanalyzer</excludePackageNames>
+                    <excludePackageNames>@external-excludes</excludePackageNames>
                     <docfilessubdirs>true</docfilessubdirs>
                     <doctitle>ONOS Java API (1.3.0-SNAPSHOT)</doctitle>
                     <groups>
                         <group>
                             <title>Network Model &amp; Services</title>
-                            <packages>
-                                org.onosproject:org.onosproject.*:org.onosproject.rest
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Utilities</title>
-                            <packages>
-                                org.onlab.*
-                            </packages>
+                            <packages>@external-apis</packages>
                         </group>
                         <group>
                             <title>Incubator for Network Model &amp; Services</title>
-                            <packages>
-                                org.onosproject.exp:org.onosproject.incubator.*
-                            </packages>
+                            <packages>@external-incubator-apis</packages>
+                        </group>
+                        <group>
+                            <title>Utilities</title>
+                            <packages>@utils</packages>
                         </group>
                     </groups>
                 </configuration>
diff --git a/docs/internal-apis b/docs/internal-apis
new file mode 100644
index 0000000..9d8079a
--- /dev/null
+++ b/docs/internal-apis
@@ -0,0 +1,4 @@
+org.onosproject
+org.onosproject.*
+org.onosproject.rest
+org.onosproject.security
diff --git a/docs/internal-apps b/docs/internal-apps
new file mode 100644
index 0000000..0bba4fe
--- /dev/null
+++ b/docs/internal-apps
@@ -0,0 +1,26 @@
+org.onosproject.app.*
+
+org.onos.acl*
+org.onosproject.acl*
+org.onosproject.aaa
+org.onosproject.fwd
+org.onosproject.flowanalyzer
+org.onosproject.mobility
+org.onosproject.proxyarp
+org.onosproject.calendar
+org.onosproject.olt*
+org.onosproject.optical*
+org.onosproject.sdnip
+org.onosproject.sdnip.*
+org.onosproject.config
+org.onosproject.routing
+org.onosproject.routing*
+org.onosproject.bgprouter
+org.onosproject.segmentrouting*
+org.onosproject.reactive.routing*
+org.onosproject.messagingperf
+org.onosproject.virtualbng*
+org.onosproject.cordfabric*
+org.onosproject.xosintegration*
+org.onosproject.cip*
+org.onosproject.vtn*
diff --git a/docs/internal-core b/docs/internal-core
new file mode 100644
index 0000000..8f24282
--- /dev/null
+++ b/docs/internal-core
@@ -0,0 +1,7 @@
+*.impl
+*.impl.*
+
+org.onosproject.json
+org.onosproject.json.*
+:org.onosproject.common.*
+org.onosproject.security.*
diff --git a/docs/internal-drivers b/docs/internal-drivers
new file mode 100644
index 0000000..fb2dea4
--- /dev/null
+++ b/docs/internal-drivers
@@ -0,0 +1,2 @@
+org.onosproject.driver
+org.onosproject.driver.*
diff --git a/docs/internal-excludes b/docs/internal-excludes
new file mode 100644
index 0000000..9876cce
--- /dev/null
+++ b/docs/internal-excludes
@@ -0,0 +1,5 @@
+org.onlab.jdvue*
+org.onlab.stc*
+org.onlab.thirdparty
+org.onosproject.oecfg
+org.onosproject.maven
diff --git a/docs/internal-gui-rest-cli b/docs/internal-gui-rest-cli
new file mode 100644
index 0000000..7b529c0
--- /dev/null
+++ b/docs/internal-gui-rest-cli
@@ -0,0 +1,4 @@
+org.onosproject.ui.impl*
+org.onosproject.rest.*
+org.onosproject.cli*
+org.onosproject.codec.impl
diff --git a/docs/internal-incubator b/docs/internal-incubator
new file mode 100644
index 0000000..619bbb9
--- /dev/null
+++ b/docs/internal-incubator
@@ -0,0 +1,9 @@
+org.onosproject.incubator.net.impl
+org.onosproject.incubator.store.impl
+org.onosproject.incubator.net.resource.label.impl
+org.onosproject.incubator.store.resource.impl
+org.onosproject.incubator.net.tunnel.impl
+org.onosproject.incubator.store.tunnel.impl
+org.onosproject.incubator.net.config.impl
+org.onosproject.incubator.net.domain.impl
+org.onosproject.incubator.store.config.impl
diff --git a/docs/internal-incubator-apis b/docs/internal-incubator-apis
new file mode 100644
index 0000000..df9ddbc
--- /dev/null
+++ b/docs/internal-incubator-apis
@@ -0,0 +1 @@
+org.onosproject.incubator*
diff --git a/docs/internal-netconf b/docs/internal-netconf
new file mode 100644
index 0000000..40c159f
--- /dev/null
+++ b/docs/internal-netconf
@@ -0,0 +1 @@
+org.onosproject.provider.netconf*
diff --git a/docs/internal-openflow b/docs/internal-openflow
new file mode 100644
index 0000000..c84cf13
--- /dev/null
+++ b/docs/internal-openflow
@@ -0,0 +1,2 @@
+org.onosproject.openflow.*
+org.onosproject.provider.of.*
diff --git a/docs/internal-ovsdb b/docs/internal-ovsdb
new file mode 100644
index 0000000..4b4ccb7
--- /dev/null
+++ b/docs/internal-ovsdb
@@ -0,0 +1,2 @@
+org.onosproject.provider.ovsdb*
+org.onosproject.ovsdb*
diff --git a/docs/internal-pcep b/docs/internal-pcep
new file mode 100644
index 0000000..8d10514
--- /dev/null
+++ b/docs/internal-pcep
@@ -0,0 +1,2 @@
+org.onosproject.pcep*
+org.onosproject.pcepio*
diff --git a/docs/internal-providers b/docs/internal-providers
new file mode 100644
index 0000000..832fb24
--- /dev/null
+++ b/docs/internal-providers
@@ -0,0 +1 @@
+org.onosproject.provider.*
diff --git a/docs/internal-stores b/docs/internal-stores
new file mode 100644
index 0000000..13c0043
--- /dev/null
+++ b/docs/internal-stores
@@ -0,0 +1 @@
+org.onosproject.store.*
diff --git a/docs/internal-test-apps b/docs/internal-test-apps
new file mode 100644
index 0000000..bc5276c
--- /dev/null
+++ b/docs/internal-test-apps
@@ -0,0 +1,7 @@
+org.onosproject.metrics.*
+org.onosproject.demo*
+org.onosproject.election*
+org.onosproject.distributedprimitives*
+org.onosproject.intentperf*
+org.onosproject.messagingperf*
+org.onosproject.optical.testapp*
diff --git a/docs/internal.xml b/docs/internal.xml
new file mode 100644
index 0000000..bcb1215
--- /dev/null
+++ b/docs/internal.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2014 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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <prerequisites>
+        <maven>3.0.0</maven>
+    </prerequisites>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos</artifactId>
+        <version>1.3.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>onos-docs</artifactId>
+    <packaging>pom</packaging>
+
+    <description>ONOS Java API documentation</description>
+
+    <modules>
+        <module>..</module>
+    </modules>
+
+    <url>http://onosproject.org/</url>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.10.3</version>
+                <configuration>
+                    <show>package</show>
+                    <docfilessubdirs>true</docfilessubdirs>
+                    <doctitle>ONOS Java API (1.3.0-SNAPSHOT)</doctitle>
+                    <excludePackageNames>@internal-excludes</excludePackageNames>
+                    <groups>
+                        <group>
+                            <title>Network Model &amp; Services</title>
+                            <packages>@internal-apis</packages>
+                        </group>
+                        <group>
+                            <title>Incubator for Network Model &amp; Services</title>
+                            <packages>@internal-incubator-apis</packages>
+                        </group>
+                        <group>
+                            <title>Core Subsystems</title>
+                            <packages>@internal-core</packages>
+                        </group>
+                        <group>
+                            <title>Distributed Stores</title>
+                            <packages>@internal-stores</packages>
+                        </group>
+                        <group>
+                            <title>Incubator for Core Subsystems &amp; Distributed Stores</title>
+                            <packages>@internal-incubator</packages>
+                        </group>
+                        <group>
+                            <title>OpenFlow Providers &amp; Controller</title>
+                            <packages>@internal-openflow</packages>
+                        </group>
+                        <group>
+                            <title>NetConf Providers</title>
+                            <packages>@internal-netconf</packages>
+                        </group>
+                        <group>
+                            <title>OVSDB Providers</title>
+                            <packages>@internal-ovsdb</packages>
+                        </group>
+                        <group>
+                            <title>PCEP Providers</title>
+                            <packages>@internal-pcep</packages>
+                        </group>
+                        <group>
+                            <title>Other Providers</title>
+                            <packages>@internal-providers</packages>
+                        </group>
+                        <group>
+                            <title>Built-in Device Drivers</title>
+                            <packages>@internal-drivers</packages>
+                        </group>
+                        <group>
+                            <title>Utilities</title>
+                            <packages>@utils</packages>
+                        </group>
+                        <group>
+                            <title>GUI, REST &amp; Command-Line</title>
+                            <packages>@internal-gui-rest-cli</packages>
+                        </group>
+                        <group>
+                            <title>Builtin Applications</title>
+                            <packages>@internal-apps</packages>
+                        </group>
+                        <group>
+                            <title>Test Instrumentation &amp; Applications</title>
+                            <packages>@internal-test-apps</packages>
+                        </group>
+                    </groups>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/docs/pom.xml b/docs/pom.xml
deleted file mode 100644
index e9faaa9..0000000
--- a/docs/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ Copyright 2014 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/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <prerequisites>
-        <maven>3.0.0</maven>
-    </prerequisites>
-
-    <parent>
-        <groupId>org.onosproject</groupId>
-        <artifactId>onos</artifactId>
-        <version>1.3.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>onos-docs</artifactId>
-    <packaging>pom</packaging>
-
-    <description>ONOS Java API documentation</description>
-
-    <modules>
-        <module>..</module>
-    </modules>
-
-    <url>http://onosproject.org/</url>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.10.1</version>
-                <configuration>
-                    <show>package</show>
-                    <docfilessubdirs>true</docfilessubdirs>
-                    <doctitle>ONOS Java API (1.3.0-SNAPSHOT)</doctitle>
-                    <groups>
-                        <group>
-                            <title>Network Model &amp; Services</title>
-                            <packages>
-                                org.onosproject:org.onosproject.*:org.onosproject.rest:org.onosproject.security
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Incubator for Network Model &amp; Services</title>
-                            <packages>
-                                org.onosproject.exp:org.onosproject.incubator.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Core Subsystems</title>
-                            <packages>
-                                org.onosproject.impl:org.onosproject.core.impl:org.onosproject.cluster.impl:org.onosproject.net.device.impl:org.onosproject.net.link.impl:org.onosproject.net.host.impl:org.onosproject.net.topology.impl:org.onosproject.net.packet.impl:org.onosproject.net.flow.impl:org.onosproject.net.*.impl:org.onosproject.event.impl:org.onosproject.net.intent.impl*:org.onosproject.net.proxyarp.impl:org.onosproject.mastership.impl:org.onosproject.net.resource.impl:org.onosproject.net.newresource.impl:org.onosproject.json:org.onosproject.json.*:org.onosproject.provider.host.impl:org.onosproject.provider.lldp.impl:org.onosproject.net.statistic.impl:org.onosproject.app.impl:org.onosproject.common.*:org.onosproject.net.group.impl:org.onosproject.cfg.impl:org.onosproject.net.driver.impl:org.onosproject.net.flowobjective.impl*:org.onosproject.net.flowext.impl:org.onosproject.net.tunnel.impl:org.onosproject.security.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Distributed Stores</title>
-                            <packages>
-                                org.onosproject.store.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Incubator for Core Subsystems &amp; Distributed Stores</title>
-                            <packages>
-                                org.onosproject.incubator.net.impl:org.onosproject.incubator.store.impl:org.onosproject.incubator.net.resource.label.impl:org.onosproject.incubator.store.resource.impl:org.onosproject.incubator.net.tunnel.impl:org.onosproject.incubator.store.tunnel.impl:org.onosproject.incubator.net.config.impl:org.onosproject.incubator.net.domain.impl:org.onosproject.incubator.store.config.impl
-                            </packages>
-                        </group>
-                        <group>
-                            <title>OpenFlow Providers &amp; Controller</title>
-                            <packages>
-                                org.onosproject.provider.of.*:org.onosproject.openflow.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>NetConf Providers</title>
-                            <packages>
-                                org.onosproject.provider.netconf:org.onosproject.provider.netconf*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>OVSDB Providers</title>
-                            <packages>
-                                org.onosproject.provider.ovsdb*:org.onosproject.ovsdb*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Other Providers</title>
-                            <packages>
-                                org.onosproject.provider.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Built-in Device Drivers</title>
-                            <packages>
-                                org.onosproject.driver:org.onosproject.driver.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Utilities</title>
-                            <packages>
-                                org.onlab.*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>GUI, REST &amp; Command-Line</title>
-                            <packages>
-                                org.onosproject.ui.impl*:org.onosproject.rest*:org.onosproject.cli:org.onosproject.rest.*:org.onosproject.cli.*:org.onosproject.codec.impl
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Builtin Applications</title>
-                            <packages>
-                                org.onosproject.app.*:org.onosproject.acl*:org.onosproject.aaa:org.onosproject.fwd:org.onosproject.flowanalyzer:org.onosproject.mobility:org.onosproject.proxyarp:org.onosproject.calendar:org.onosproject.optical:org.onosproject.optical.*:org.onosproject.sdnip:org.onosproject.sdnip.*:org.onosproject.config:org.onosproject.routing:org.onosproject.routing*:org.onosproject.bgprouter:org.onosproject.segmentrouting:org.onosproject.segmentrouting.*:org.onosproject.reactive.routing*:org.onosproject.messagingperf:org.onosproject.virtualbng:org.onosproject.cordfabric*:org.onosproject.xosintegration*:org.onosproject.pcep*
-                            </packages>
-                        </group>
-                        <group>
-                            <title>Test Instrumentation &amp; Applications</title>
-                            <packages>
-                                org.onosproject.metrics.*:org.onosproject.demo*:org.onosproject.election*:org.onosproject.distributedprimitives*:org.onosproject.intentperf*:org.onosproject.messagingperf*:org.onosproject.optical.testapp*
-                            </packages>
-                        </group>
-                    </groups>
-                    <excludePackageNames>org.onlab.thirdparty:org.onosproject.oecfg:org.onosproject.maven:org.onlab.jdvue*:org.onlab.stc*</excludePackageNames>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
diff --git a/docs/utils b/docs/utils
new file mode 100644
index 0000000..b4efc06
--- /dev/null
+++ b/docs/utils
@@ -0,0 +1 @@
+org.onlab.*
diff --git a/tools/build/onos-build-docs b/tools/build/onos-build-docs
index fcdd3f7..10feacc 100755
--- a/tools/build/onos-build-docs
+++ b/tools/build/onos-build-docs
@@ -8,13 +8,35 @@
 
 apidocs=onos-apidocs-${ONOS_VERSION%~*}
 
-set -e -x
+function expandList {
+    list="";
+    while read line; do
+        [ -n "$line" ] && list="$list:$line"
+    done < $1
+    echo "${list#:*}"
+}
+
+function processPom {
+    cp $1 aux-$1
+    egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
+        packages="$(expandList $line)"
+        sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
+        mv aux-$1.aux aux-$1
+    done
+}
+
+set -e
+
+trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
 rm -fr $ONOS_ROOT/docs/target
 
 cd $ONOS_ROOT/docs
-mvn -f external.xml javadoc:aggregate
+processPom external.xml
+mvn -f aux-external.xml javadoc:aggregate
+
 cd target && mv site/apidocs $apidocs
 tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp
 
 cd $ONOS_ROOT/docs
-mvn -f pom.xml javadoc:aggregate
+processPom internal.xml
+mvn -f aux-internal.xml javadoc:aggregate