yangtools.git
10 years agoBUG-1346: fix wrong prefix generation 43/9143/3
Timotej Kubas [Fri, 18 Jul 2014 14:12:49 +0000 (16:12 +0200)]
BUG-1346: fix wrong prefix generation

Java promotion rules are slightly different than C, so the expression
got promoted to int, which obviously did the wrong thing. Add an
explicit cast to prevent it.

+test

Change-Id: Id9e708ca86b7267b84b2a3db5ad52aeef651763d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Timotej Kubas <tkubas@cisco.com>
10 years agoMerge "BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger."
Robert Varga [Fri, 18 Jul 2014 14:04:25 +0000 (14:04 +0000)]
Merge "BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger."

10 years agoBindingGeneratorUtil.computeDefaultSUID() should not modify lists 48/9148/1
Robert Varga [Fri, 18 Jul 2014 09:21:55 +0000 (11:21 +0200)]
BindingGeneratorUtil.computeDefaultSUID() should not modify lists

This prevents the utility from churning the lists passed in. Also
shares the comparator.

Change-Id: Iaded850b5b0fa98d79e4e4fdbed52175c669e8a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1388: fixed ClassTemplate to avoid unused import of BigInteger. 40/9140/1
Martin Vitez [Fri, 18 Jul 2014 08:43:36 +0000 (10:43 +0200)]
BUG-1388: fixed ClassTemplate to avoid unused import of BigInteger.

Change-Id: I88e3aa6c9456603360de2053b5a2bbeca4877aa7
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "BUG-1281: rework XmlStreamUtils a bit more"
Tony Tkacik [Thu, 17 Jul 2014 11:41:16 +0000 (11:41 +0000)]
Merge "BUG-1281: rework XmlStreamUtils a bit more"

10 years agoTurned off codec source code generation by default. 04/9104/1
Tony Tkacik [Thu, 17 Jul 2014 08:02:25 +0000 (10:02 +0200)]
Turned off codec source code generation by default.

Change-Id: Iad6eda63c109e3d813c704e2eda56b067c7d1688
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "Output generated codec source to files"
Tony Tkacik [Thu, 17 Jul 2014 07:17:22 +0000 (07:17 +0000)]
Merge "Output generated codec source to files"

10 years agoMerge "BUG-994: fix QName not sharing QNameModule"
Martin Vitez [Thu, 17 Jul 2014 07:02:03 +0000 (07:02 +0000)]
Merge "BUG-994: fix QName not sharing QNameModule"

10 years agoOutput generated codec source to files 31/7231/12
tpantelis [Sat, 10 May 2014 16:04:46 +0000 (12:04 -0400)]
Output generated codec source to files

- Added SourceCodeGenerator helper class that holds the generated
  field/method source code until outputGeneratedSource is called to
  generate the source for the entire class and output to a file
  under generated-sources.

- Modified TransformerGenerator and JavassistUtils to use the
  SourceCodeGenerator.

- Other pom changes to eliminate Eclipse errors.

Change-Id: Id910161569835d0cf9659ddf806e21f2545c713b
Signed-off-by: tpantelis <tpanteli@brocade.com>
10 years agoBUG 1359 - to make mdsal karaf features work 99/9099/1
Surekha Bejgam [Wed, 16 Jul 2014 23:54:19 +0000 (16:54 -0700)]
BUG 1359 - to make mdsal karaf features work

Signed-off-by: Surekha Bejgam <sbejgam@cisco.com>
10 years agoBUG-994: fix QName not sharing QNameModule 90/9090/1
Robert Varga [Wed, 16 Jul 2014 18:18:18 +0000 (20:18 +0200)]
BUG-994: fix QName not sharing QNameModule

Fixes the most obvious offender. With this patch >105000 QNameModule
instances are eliminated, bringing down the base memory use by about 8MB.

Change-Id: I63cd091ee9ce4292d0ad8066d01bf0a6120802b8
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1371: improved parser handling of invalid yang list key. 56/9056/1
Martin Vitez [Wed, 16 Jul 2014 11:34:58 +0000 (13:34 +0200)]
BUG-1371: improved parser handling of invalid yang list key.

Change-Id: I7036ce4e97b14c22604dc396a2612c1f2fd62ca6
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "BUG-1091: sever the NormalizedNode/Node relationship"
Tony Tkacik [Wed, 16 Jul 2014 07:51:56 +0000 (07:51 +0000)]
Merge "BUG-1091: sever the NormalizedNode/Node relationship"

10 years agoMerge "Modifications RpcResultBuilder class"
Tony Tkacik [Wed, 16 Jul 2014 07:50:20 +0000 (07:50 +0000)]
Merge "Modifications RpcResultBuilder class"

10 years agoBUG-1270: optimize SchemaPath creation for augmentations 42/9042/1
Robert Varga [Tue, 15 Jul 2014 22:15:55 +0000 (00:15 +0200)]
BUG-1270: optimize SchemaPath creation for augmentations

As it turns out, at least in one case we can use
SchemaPath.createChild(), which is much more efficient than the
Iterable-based constructor. Drop a FIXME to investigate whether we can
reuse an existing SchemaPath in the other case.

Change-Id: I1aae1c9855490a21bcda7ffe17d52e081cc7de1d
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: optimize SchemaPath creation 41/9041/1
Robert Varga [Tue, 15 Jul 2014 21:54:42 +0000 (23:54 +0200)]
BUG-1270: optimize SchemaPath creation

There is no need to instantiate temporary collections. Also
UnionTypeBuilder instantiated the same path over and over again. Fix all
the offenders.

Change-Id: Ie4ebe82dbc2902516459584c3386880c15fe063a
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: reuse QNameModule 40/9040/1
Robert Varga [Tue, 15 Jul 2014 21:52:33 +0000 (23:52 +0200)]
BUG-1270: reuse QNameModule

AugmentationSchemaBuilderImpl can reuse the QNameModule already exposed
from the Module, there is no need to instantiate a new, equivalent one.

Change-Id: I17bd5262e073baa27b089930702ed5780c10d79e
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: be smart about Restrictions 39/9039/1
Robert Varga [Tue, 15 Jul 2014 21:04:23 +0000 (23:04 +0200)]
BUG-1270: be smart about Restrictions

Restrictions are based on type definitions, which are constant. For base
types they always are. For extended types, they are usually empty.
Optimize memory usage by reusing the lists anchored in types and also by
having a singleton instance for the all-empty case.

Change-Id: Ie9773d7efb57d403a008b82716eb22d97fefb224
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: ExtendedType used empty ArrayList 38/9038/1
Robert Varga [Tue, 15 Jul 2014 20:41:02 +0000 (22:41 +0200)]
BUG-1270: ExtendedType used empty ArrayList

If the unknownNodes list is empty, do not retain it, but swap it for
Collections.emptyList(). Lowers memory overhead by not retaining an
empty ArrayList.

Change-Id: Ib2214613ebdbc394768b6db9543d2ef3504d1d53
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: BaseTypes should reuse QNameModule 36/9036/1
Robert Varga [Tue, 15 Jul 2014 20:23:40 +0000 (22:23 +0200)]
BUG-1270: BaseTypes should reuse QNameModule

This is a simple enough conversion, allowing us to get rid of some
duplicate QNameModule instances.

Change-Id: Ia4292ebb387c1c4a78710e588aa3aca6454fa2d9
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: improve QNameModule reuse 35/9035/1
Robert Varga [Tue, 15 Jul 2014 20:16:11 +0000 (22:16 +0200)]
BUG-1270: improve QNameModule reuse

This eliminates calls calls which were causing unneeded QNameModules to
be instantiated, reducing memory overhead.

Change-Id: I5faa53fa8a5f82ae8b87fde67c0e69271595ce94
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1281: rework XmlStreamUtils a bit more 24/9024/1
Robert Varga [Tue, 15 Jul 2014 11:05:30 +0000 (13:05 +0200)]
BUG-1281: rework XmlStreamUtils a bit more

This adds documentation to XmlStreamUtils and reworks the structure to
properly encapsulate the XmlCodecProvider.

Change-Id: I038f86b95f4205d452860fad9c9e38af61f48a2a
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1091: sever the NormalizedNode/Node relationship 16/9016/5
Robert Varga [Tue, 15 Jul 2014 11:07:55 +0000 (13:07 +0200)]
BUG-1091: sever the NormalizedNode/Node relationship

This clarifies the API intent.

Node and NormalizedNode both serve as abstract supertypes which are then
specialized. The artificial Node->NormalizedNode relationship creates
the illusion that NormalizedNode is a semantical sibling of SimpleNode
and CompositeNode -- which is simply not true.

Change-Id: I62f56bc70ee570e719fea7660b7ef36ee59072d6
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "Bug 865: Fixed incorrect conversion to new APIs."
Tony Tkacik [Tue, 15 Jul 2014 11:20:38 +0000 (11:20 +0000)]
Merge "Bug 865: Fixed incorrect conversion to new APIs."

10 years agoBug 865: Fixed incorrect conversion to new APIs. 15/9015/1
Tony Tkacik [Tue, 15 Jul 2014 10:42:37 +0000 (12:42 +0200)]
Bug 865: Fixed incorrect conversion to new APIs.

Change-Id: I585e4d9142dc261317661c4442c771db791a46de
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "BUG-1347: fixed bug in generation constraints for decimal64 type."
Tony Tkacik [Tue, 15 Jul 2014 09:46:17 +0000 (09:46 +0000)]
Merge "BUG-1347: fixed bug in generation constraints for decimal64 type."

10 years agoMerge "Bug 865: Removed uses of packageNameFromModule"
Martin Vitez [Tue, 15 Jul 2014 09:37:35 +0000 (09:37 +0000)]
Merge "Bug 865: Removed uses of packageNameFromModule"

10 years agoMerge "Bug 1366: Fallback scenario for IdentityCodec to work without schema."
Martin Vitez [Tue, 15 Jul 2014 09:36:49 +0000 (09:36 +0000)]
Merge "Bug 1366: Fallback scenario for IdentityCodec to work without schema."

10 years agoMerge "API Cleanup: Moved package name computation to BindingMapping."
Martin Vitez [Tue, 15 Jul 2014 09:35:37 +0000 (09:35 +0000)]
Merge "API Cleanup: Moved package name computation to BindingMapping."

10 years agoBug 865: Removed uses of packageNameFromModule 13/9013/1
Tony Tkacik [Tue, 15 Jul 2014 09:14:52 +0000 (11:14 +0200)]
Bug 865: Removed uses of packageNameFromModule

Change-Id: I49d16e69943777acb34ac904ce2559302d0ac39c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "BUG-1344: Implemented getOriginal() for DataSchemaNode."
Tony Tkacik [Tue, 15 Jul 2014 09:13:38 +0000 (09:13 +0000)]
Merge "BUG-1344: Implemented getOriginal() for DataSchemaNode."

10 years agoBug 1366: Fallback scenario for IdentityCodec to work without schema. 12/9012/1
Tony Tkacik [Tue, 15 Jul 2014 09:10:33 +0000 (11:10 +0200)]
Bug 1366: Fallback scenario for IdentityCodec to work without schema.

Change-Id: Ife4c3c15db1397829c5b5a46575785121bf41ed1
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoAPI Cleanup: Moved package name computation to BindingMapping. 11/9011/1
Tony Tkacik [Tue, 15 Jul 2014 09:02:39 +0000 (11:02 +0200)]
API Cleanup: Moved package name computation to BindingMapping.

Change-Id: I8e9016c4cadd7bee36ec440b960891503b645f4a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "Eliminate the use of java.util.Stack"
Martin Vitez [Tue, 15 Jul 2014 07:42:49 +0000 (07:42 +0000)]
Merge "Eliminate the use of java.util.Stack"

10 years agoBUG-1344: Implemented getOriginal() for DataSchemaNode. 42/8942/2
Martin Vitez [Fri, 11 Jul 2014 12:11:03 +0000 (14:11 +0200)]
BUG-1344: Implemented getOriginal() for DataSchemaNode.

For nodes which were added by uses method getOriginal returns original node definition from grouping.
If node wasn't added by uses returns null.
Added tests.

Change-Id: Ib75ac2d9dbbd69d68a8e99333fe005f095fce90a
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoEliminate the use of java.util.Stack 85/8685/2
Robert Varga [Sun, 13 Jul 2014 15:41:14 +0000 (17:41 +0200)]
Eliminate the use of java.util.Stack

It is a synchronized entity, which we use in contexts which are limited
to a single thread. Use Deque<> for interfaces and a combination of
LinkedList implementation.

Signed-off-by: Robert Varga <rovarga@cisco.com>
Change-Id: I76956d52ee7ebb332267b0c13bb129aa9974b884

10 years agoFixed yangtools feature file and consolodated 62/8962/1
Ed Warnicke [Thu, 10 Jul 2014 13:59:22 +0000 (08:59 -0500)]
Fixed yangtools feature file and consolodated

Change-Id: I3eb47439ad1f2baa25977be69516334df9279a3d
Signed-off-by: Ed Warnicke <eaw@cisco.com>
10 years agoMerge "Added RpcResultBuilder class"
Tony Tkacik [Fri, 11 Jul 2014 11:33:02 +0000 (11:33 +0000)]
Merge "Added RpcResultBuilder class"

10 years agoDeprecated moved XmlDocumentUtils methods. 37/8937/1
Tony Tkacik [Fri, 11 Jul 2014 10:55:09 +0000 (12:55 +0200)]
Deprecated moved XmlDocumentUtils methods.

Change-Id: I155203a176034741510261877be0b04d5931777b
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "BUG-1281: introduce XML event stream writer"
Tony Tkacik [Fri, 11 Jul 2014 10:03:55 +0000 (10:03 +0000)]
Merge "BUG-1281: introduce XML event stream writer"

10 years agoModifications RpcResultBuilder class 58/8958/4
tpantelis [Thu, 10 Jul 2014 06:43:58 +0000 (02:43 -0400)]
Modifications RpcResultBuilder class

Added some new methods to RpcResultBuilder based on migration of
controller code to use it.

Change-Id: I522c76691a7885aa16a1324fe7bb49548018b8dd
Signed-off-by: tpantelis <tpanteli@brocade.com>
10 years agoBUG-1347: fixed bug in generation constraints for decimal64 type. 25/8925/1
Martin Vitez [Thu, 10 Jul 2014 13:51:32 +0000 (15:51 +0200)]
BUG-1347: fixed bug in generation constraints for decimal64 type.

Added test.

Change-Id: I52a539ea7c5ff6b36b9bc362660188f9627bff7d
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge "BUG-1342: fixed bug in resolving augments with target added by uses."
Tony Tkacik [Fri, 11 Jul 2014 07:53:52 +0000 (07:53 +0000)]
Merge "BUG-1342: fixed bug in resolving augments with target added by uses."

10 years agoMerge "Bug 1352: Fixed issue when ModificationSnapshot was not updated during schema...
Tony Tkacik [Thu, 10 Jul 2014 18:18:35 +0000 (18:18 +0000)]
Merge "Bug 1352: Fixed issue when ModificationSnapshot was not updated during schema context update."

10 years agoBug 1352: Fixed issue when ModificationSnapshot was not updated during schema context... 04/8904/1
Tony Tkacik [Thu, 10 Jul 2014 16:34:40 +0000 (18:34 +0200)]
Bug 1352: Fixed issue when ModificationSnapshot was not updated during schema context update.

Change-Id: I4dac124485c05cd771a717d3a692042a5b90b183
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoBUG-1281: introduce XML event stream writer 51/8851/5
Robert Varga [Tue, 8 Jul 2014 23:30:47 +0000 (01:30 +0200)]
BUG-1281: introduce XML event stream writer

Unlike the current DOM approach, XMLStreamWriter-driven approach allows
use to plug various backends without needing memory for intermediate
representation.

Change-Id: Ic37b570a78c681faebfcbfe573b811a121188628
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoAdded RpcResultBuilder class 15/8915/4
tpantelis [Wed, 9 Jul 2014 15:29:02 +0000 (11:29 -0400)]
Added RpcResultBuilder class

Added a DSL-like builder class for creating RpcResult instances. This class will
deprecate the static Rpcs and RpcErrors classes in the controller.

Also added more javadocs to the RpcResult and RpcError interfaces.

Change-Id: I30cffc68419ed493035ba5fef466096bcec9df70
Signed-off-by: tpantelis <tpanteli@brocade.com>
10 years agoBUG-1342: fixed bug in resolving augments with target added by uses. 61/8861/1
Martin Vitez [Wed, 9 Jul 2014 13:41:49 +0000 (15:41 +0200)]
BUG-1342: fixed bug in resolving augments with target added by uses.

Change-Id: I6b822ffa31d20946cbb9323f6d4f73c86cb15dcb
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoFixing typo in log message 72/8872/1
Kiran Agrahara Sreenivasa [Wed, 9 Jul 2014 12:58:58 +0000 (05:58 -0700)]
Fixing typo in log message

Change-Id: I6fc546f7319c13b09db1754dce5e6d49446531f3
Signed-off-by: Kiran Agrahara Sreenivasa <kkoushik@brocade.com>
10 years agoBUG-865: do not use InstanceIdentifier.getPath() 50/8850/1
Robert Varga [Tue, 8 Jul 2014 22:01:01 +0000 (00:01 +0200)]
BUG-865: do not use InstanceIdentifier.getPath()

The method was only used to speed up an ArrayList, which in turn was only
ever used for debugging. Instead of using a precodintion which forces us
to do this, just track the offset of the offending entry. If we find
ourselves in the error territory, we can then take getPathArguments(),
limit it to proper size and print it out.

Change-Id: I3c1786fe77cef005a6463c22b5be8bb8672c26bb
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "Bug 1339: Decreased anyxml warning to debug."
Tony Tkacik [Wed, 9 Jul 2014 10:38:13 +0000 (10:38 +0000)]
Merge "Bug 1339: Decreased anyxml warning to debug."

10 years agoMerge "Bug 1331 - Generate SPIs and yangs to target/generated-sources/ subfolders"
Tony Tkacik [Wed, 9 Jul 2014 08:47:04 +0000 (08:47 +0000)]
Merge "Bug 1331 - Generate SPIs and yangs to target/generated-sources/ subfolders"

10 years agoMerge "BUG-579: improve code readability in RestconfUtils."
Tony Tkacik [Wed, 9 Jul 2014 07:50:08 +0000 (07:50 +0000)]
Merge "BUG-579: improve code readability in RestconfUtils."

10 years agoBug 1339: Decreased anyxml warning to debug. 40/8840/1
Tony Tkacik [Wed, 9 Jul 2014 07:25:33 +0000 (09:25 +0200)]
Bug 1339: Decreased anyxml warning to debug.

Change-Id: I9f21f1fd181229a6b3dccd7aa7dc9c53ab4e5db0
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
10 years agoMerge "BUG-1304: rework BindingGeneratorImpl from xtend to java"
Tony Tkacik [Tue, 8 Jul 2014 16:46:31 +0000 (16:46 +0000)]
Merge "BUG-1304: rework BindingGeneratorImpl from xtend to java"

10 years agoBug 1331 - Generate SPIs and yangs to target/generated-sources/ subfolders 93/8793/1
Tomas Olvecky [Tue, 8 Jul 2014 12:44:40 +0000 (14:44 +0200)]
Bug 1331 - Generate SPIs and yangs to target/generated-sources/ subfolders

Instead of putting SPIs to target/generated-resources and yangs to target/yangs
use standard target-generated-sources/{spi,yang}
This change allows IDEs with auto detection capabilities to pick
up all resources that will be packaged into JAR with correct path.

Change-Id: If9f0367732baddf66e22135ccf3a59124455335f
Signed-off-by: Tomas Olvecky <tolvecky@cisco.com>
10 years agoBUG-1210: refactored imports handling in parser. 92/8492/7
Martin Vitez [Tue, 1 Jul 2014 11:51:34 +0000 (13:51 +0200)]
BUG-1210: refactored imports handling in parser.

Currently builder for module has no information about imported modules. This causes overhead because before resolving any of imported nodes
(uses, typedef, identities, augment path, deviation path...) parser needs to search whole collection of available modules to find target
module of imported node.

This patch adds information about imported modules to ModuleBuilder, so they can be available without search. Searching is performed only
once when resolving imports.

Change-Id: Ifcd4e995431165820c142e486da0466edc6abca0
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoMerge changes I9886ddb7,I851fa16e,I3b7b0bf5,Ib7f2ce87,I7d0cf295,I35ae6fcb,I14c86257...
Tony Tkacik [Tue, 8 Jul 2014 09:10:55 +0000 (09:10 +0000)]
Merge changes I9886ddb7,I851fa16e,I3b7b0bf5,Ib7f2ce87,I7d0cf295,I35ae6fcb,I14c86257,Ic4af26d7

* changes:
  LazyNodeToNodeMap: use a ArrayDeque instead of a Stack
  XmlTreeBuilder: ensure thread safety
  NodeFactory: use an ArrayDeque instead of a Stack
  NodeUtils: Use an ArrayDeque instead of a Stack
  Optimize YangParserListenerImpl logging
  BUG-865: migrate to Optional<>
  Refactor SchemaPathStack
  Migrate the conceptual stack into a utility class

10 years agoBUG-1170: removed hardcoding of test build directory. 82/8782/1
Martin Vitez [Tue, 8 Jul 2014 06:56:03 +0000 (08:56 +0200)]
BUG-1170: removed hardcoding of test build directory.

Change-Id: I1410b84d7a7a1f9720e0414cf799f42f90b1ed16
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoBUG-579: improve code readability in RestconfUtils. 56/8656/2
Martin Vitez [Fri, 4 Jul 2014 08:06:22 +0000 (10:06 +0200)]
BUG-579: improve code readability in RestconfUtils.

Change-Id: Ia7d06c95f4237a2f6a1b64cc9c7d612bac8df413
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoLazyNodeToNodeMap: use a ArrayDeque instead of a Stack 59/8759/1
Robert Varga [Mon, 7 Jul 2014 21:07:59 +0000 (23:07 +0200)]
LazyNodeToNodeMap: use a ArrayDeque instead of a Stack

The thread safety feature is not needed and it should be faster.

Change-Id: I9886ddb7bdc69d27e489f5bff1cced5876d32aaa
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoXmlTreeBuilder: ensure thread safety 58/8758/1
Robert Varga [Mon, 7 Jul 2014 21:05:14 +0000 (23:05 +0200)]
XmlTreeBuilder: ensure thread safety

Having a static field is a multi-threading show-stopper. Propagate the
state required via method argumets instead. Also convert Stack to
ArrayDeque.

Change-Id: I851fa16e648c0eb94ddc19f8ae9809b977c68564
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoNodeFactory: use an ArrayDeque instead of a Stack 57/8757/1
Robert Varga [Mon, 7 Jul 2014 21:00:39 +0000 (23:00 +0200)]
NodeFactory: use an ArrayDeque instead of a Stack

Thread safety is not needed and it's likely to be faster.

Change-Id: I3b7b0bf5f16f5e5c587baacb40f403723775034b
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoNodeUtils: Use an ArrayDeque instead of a Stack 56/8756/1
Robert Varga [Mon, 7 Jul 2014 20:55:50 +0000 (22:55 +0200)]
NodeUtils: Use an ArrayDeque instead of a Stack

Thread-safety is not needed and it's likely to be faster.

Change-Id: Ib7f2ce87056d134fe8e7fc9695ec46da22058c8a
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoOptimize YangParserListenerImpl logging 55/8755/1
Robert Varga [Mon, 7 Jul 2014 20:44:53 +0000 (22:44 +0200)]
Optimize YangParserListenerImpl logging

- make util methods static
- do not use string concat in warnings
- do not concat strings for trace

Change-Id: I7d0cf2958df5fb54b159c205ee33f75afe2fe23a
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-865: migrate to Optional<> 54/8754/1
Robert Varga [Mon, 7 Jul 2014 20:34:23 +0000 (22:34 +0200)]
BUG-865: migrate to Optional<>

Change-Id: I35ae6fcb9b4a1445d06d4688ffea38b828f1a3c8
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoRefactor SchemaPathStack 53/8753/1
Robert Varga [Mon, 7 Jul 2014 20:25:17 +0000 (22:25 +0200)]
Refactor SchemaPathStack

With proper encapsulation it becomes clear how SchemaPaths can be
directly applied. Do just that, using
SchemaPath.createChild()/getParent() and use a Deque (backed by a
LinkedList) instead of an explicit Stack.

Change-Id: I14c86257c10228acd9d113f382f9fb891d6033b6
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMigrate the conceptual stack into a utility class 52/8752/1
Robert Varga [Mon, 7 Jul 2014 19:56:17 +0000 (21:56 +0200)]
Migrate the conceptual stack into a utility class

Introduces SchemaPathStack -- which is precisely what the concept is.
This hides away the implementation details, so they can be refactored as
needed.

Change-Id: Ic4af26d7fa3ed5fce04227b6c5963b542f0575ad
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoIntroduce moduleQName for sharing 51/8751/1
Robert Varga [Mon, 7 Jul 2014 19:33:28 +0000 (21:33 +0200)]
Introduce moduleQName for sharing

If we stire namespace/revision/prefix in a QName, we are able to create
related QNames using a utility method, which will automatically share
the resulting QNameModule.

Change-Id: I53fbf10cf853cb3a4b265fd1f9823f604f148e73
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoEncapsulate SchemaPath creation 50/8750/1
Robert Varga [Mon, 7 Jul 2014 12:46:49 +0000 (14:46 +0200)]
Encapsulate SchemaPath creation

When we look at actualPath, we always want the SchemaPath -- so let's do
precisely that.

Change-Id: Ibe65adfb841cd1422b3fbc6945b3a87a3cdce62d
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoUpdate ParserListenerUtils to use SchemaPath 49/8749/1
Robert Varga [Mon, 7 Jul 2014 12:39:46 +0000 (14:39 +0200)]
Update ParserListenerUtils to use SchemaPath

Instead of relying on Stack<QName>, take a SchemaPath, which makes the
operations more efficient.

Change-Id: I18fcf20f5c164be53bae3487768cab472502ec74
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoReuse last QName in ParserListener 32/8732/1
Robert Varga [Mon, 7 Jul 2014 12:01:38 +0000 (14:01 +0200)]
Reuse last QName in ParserListener

Given a base QName, a new QName can be costructed such that it shares
its QNameModule. Take advantage of that.

Change-Id: I155b55a0384c90dca65dda6222a186041c691250
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoUse global well-known QNames 31/8731/1
Robert Varga [Mon, 7 Jul 2014 11:54:01 +0000 (13:54 +0200)]
Use global well-known QNames

Basetypes define QNames for all the base types, so no need to create
them all over again.

Change-Id: I732a8a9694b9aedf72bd0a78bb7ed62c1f98a3ed
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1304: rework BindingGeneratorImpl from xtend to java 78/8678/4
Martin Vitez [Fri, 4 Jul 2014 13:22:02 +0000 (15:22 +0200)]
BUG-1304: rework BindingGeneratorImpl from xtend to java

Change-Id: Idc09bca749951fb8c075b9ffb291c2a6a362dbe2
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoOptimize ParserListenerUtils() 84/8684/1
Robert Varga [Fri, 4 Jul 2014 15:26:03 +0000 (17:26 +0200)]
Optimize ParserListenerUtils()

- instanceof check implies null check
- use direct return instead of a break when returning things

Change-Id: Ibcd9198a3505da72d2abb90ce348f2ddf2e1e35b
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-865: eliminate the use of YangTypesConverter 77/8677/2
Robert Varga [Fri, 4 Jul 2014 13:00:25 +0000 (15:00 +0200)]
BUG-865: eliminate the use of YangTypesConverter

Uses BaseTypes instead.

Change-Id: I7c1f71f986813872a5680147e87c800f9764b868
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoEliminate use of String.split() 76/8676/2
Robert Varga [Fri, 4 Jul 2014 12:57:10 +0000 (14:57 +0200)]
Eliminate use of String.split()

Another round of optimizations, centered about not instantiating
implicit pattern matchers, but rather using Splitters.

Change-Id: I9ebba19fd9f211e7fa55e9bb55e35ae5e2a7b379
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoOptimize string operations 62/8662/2
Robert Varga [Fri, 4 Jul 2014 10:26:30 +0000 (12:26 +0200)]
Optimize string operations

This removes the excessive splitting and string replacement with proper
splitters. We also add better length/range constraint validation.

Change-Id: Ia69d29a307cc23b22bf282ed17e9f585a41ae336
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-865: do not use obsolete contructors 61/8661/1
Robert Varga [Fri, 4 Jul 2014 08:34:26 +0000 (10:34 +0200)]
BUG-865: do not use obsolete contructors

This removes the use of obsoleted constructors exposed from model API.

Change-Id: Ia537614855a7d4677bbb39b1d3bf9da984d23187
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-865: Do not use QName constructor 59/8659/2
Robert Varga [Fri, 4 Jul 2014 08:05:03 +0000 (10:05 +0200)]
BUG-865: Do not use QName constructor

Change-Id: I7842fc9f0f2e4164504ba0f8aed8267eae1581b5
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "Bug 560: Fixed incoherent API implementation."
Tony Tkacik [Fri, 4 Jul 2014 08:04:38 +0000 (08:04 +0000)]
Merge "Bug 560: Fixed incoherent API implementation."

10 years agoBUG-579: Remove the dependency on GeneratedTOBuilderImpl to break a package cycle. 53/8653/1
Martin Vitez [Fri, 4 Jul 2014 07:31:01 +0000 (09:31 +0200)]
BUG-579: Remove the dependency on GeneratedTOBuilderImpl to break a package cycle.

Change-Id: Ibcdd7bcb0cdf44d5d7ef30105624bede15bcd50e
Signed-off-by: Martin Vitez <mvitez@cisco.com>
10 years agoUse CharMatcher in packageNameForGeneratedType() 44/8644/2
Robert Varga [Thu, 3 Jul 2014 21:43:03 +0000 (23:43 +0200)]
Use CharMatcher in packageNameForGeneratedType()

Instead of performing up to two string copies, use a single replacement
pass, taking into account two characters using a CharMatcher.

Change-Id: I305d384eff2da5d0bfb3b1b820270f4480a800a4
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoOptimize BindingMapping.toCamelCase() 43/8643/2
Robert Varga [Thu, 3 Jul 2014 21:38:47 +0000 (23:38 +0200)]
Optimize BindingMapping.toCamelCase()

Instead of replacing characters, we use a CharMatcher in the Splitter.
This elides the need to copy strings and search them multiple times.

Change-Id: Iff0e580f927a5f983a3eb6e2e3b318f33a1b2217
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: optimize Builders with QName(Module) 42/8642/2
Robert Varga [Thu, 3 Jul 2014 20:45:43 +0000 (22:45 +0200)]
BUG-1270: optimize Builders with QName(Module)

Now that we are exposing QNameModule, we can optimize QName
instantiation heavily by passing parent QName and QNameModule instances,
so they will get massively reused.

Change-Id: If67883ea3873a55b563136b743a7453c365475a9
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: use QNameModule where possible 41/8641/2
Robert Varga [Thu, 3 Jul 2014 20:28:43 +0000 (22:28 +0200)]
BUG-1270: use QNameModule where possible

This converts a couple of callsites, which will hopefully result in more
sharing.

Change-Id: If77948d6cf16b56d3d05eeb5a6dc37d20b0ab1ae
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBug 560: Fixed incoherent API implementation. 54/8654/1
Lukas Sedlak [Fri, 4 Jul 2014 06:41:30 +0000 (08:41 +0200)]
Bug 560: Fixed incoherent API implementation.

Fixed bug in getRpcServiceClassFor method. Now method follows API contract and will return class
for specified module namespace and module revision.

Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
10 years agoBUG-1270: expose QName.create(QNameModule, String) 40/8640/1
Robert Varga [Thu, 3 Jul 2014 20:27:38 +0000 (22:27 +0200)]
BUG-1270: expose QName.create(QNameModule, String)

We have had the constructor to go with this a long time ago, expose it
via a static factory method.

Change-Id: If198764ba51ada19527b484b420ad843236fbcf3
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1270: introduce getQNameModule() 29/8529/4
Robert Varga [Tue, 1 Jul 2014 21:41:32 +0000 (23:41 +0200)]
BUG-1270: introduce getQNameModule()

Introduces a new getNsRevision() method, which returns a reusable
QNameModule instance.

Change-Id: Ie3590c245494143fe2c6d2d37766f29ecc4e4d9a
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoDo not use "".equals(String) 39/8639/1
Robert Varga [Thu, 3 Jul 2014 21:17:59 +0000 (23:17 +0200)]
Do not use "".equals(String)

This is an ugly shorthand for String.isEmpty(), so let's not use it.

Change-Id: I6f00cc0676f982e99690294a11e703832b404977
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoReuse a single QNameModule for NULL 38/8638/1
Robert Varga [Thu, 3 Jul 2014 21:08:14 +0000 (23:08 +0200)]
Reuse a single QNameModule for NULL

QNameModules with null namespace/revision are an easy pick -- reuse a
single instance for all of them.

Change-Id: I1f519ad5a46c82da3daf17122087af89c97e5df8
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoOptimize BuilderUtils 37/8637/1
Robert Varga [Thu, 3 Jul 2014 20:54:38 +0000 (22:54 +0200)]
Optimize BuilderUtils

- reuse Date(0L)
- skip empty strings in SLASH_SPLITTER
- check just the first character to determine if XPath is absolute

Change-Id: Ia4a4d30ebe5e4d2e3866761a4393ebf564f6cf38
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-865: do not use QName constructor 10/8610/1
Robert Varga [Thu, 3 Jul 2014 12:33:07 +0000 (14:33 +0200)]
BUG-865: do not use QName constructor

This is a mas replace of 'new QName()'.

Change-Id: I810be523769f13b7eb10a2161e28499d17aa1378
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoMerge "BUG-1119: optimize length and range checks in generated sources."
Tony Tkacik [Thu, 3 Jul 2014 11:59:46 +0000 (11:59 +0000)]
Merge "BUG-1119: optimize length and range checks in generated sources."

10 years agoMerge "BUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUti...
Tony Tkacik [Thu, 3 Jul 2014 11:55:58 +0000 (11:55 +0000)]
Merge "BUG-597: removed dependency on GeneratedTOBuilderImpl from BindingGeneratorUtil to break a package cycle."

10 years agoMerge "BUG-865: fixed formatting of pom.xml"
Tony Tkacik [Thu, 3 Jul 2014 11:54:28 +0000 (11:54 +0000)]
Merge "BUG-865: fixed formatting of pom.xml"

10 years agoMerge "BUG-1143: binding-generator-impl: tests refactoring."
Tony Tkacik [Thu, 3 Jul 2014 11:52:17 +0000 (11:52 +0000)]
Merge "BUG-1143: binding-generator-impl: tests refactoring."

10 years agoMerge "BUG-1288: improve InstanceIdentifier API"
Tony Tkacik [Thu, 3 Jul 2014 11:08:52 +0000 (11:08 +0000)]
Merge "BUG-1288: improve InstanceIdentifier API"

10 years agoBUG-1288: improve InstanceIdentifier API 00/8600/1
Robert Varga [Thu, 3 Jul 2014 09:04:37 +0000 (11:04 +0200)]
BUG-1288: improve InstanceIdentifier API

Introduces getLastPathArgument and getReversePathArguments, which are
useful for some users, who open-code the equivalent methods.

Also removes the use of deprecated constructor, opting for an Iterables
utility class for intering instantiation.

Change-Id: I364e41dc7efdd1b3c56d03e626c8671b2c20ae8d
Signed-off-by: Robert Varga <rovarga@cisco.com>
10 years agoBUG-1275: optimize AugmentationSchemaProxy for lookup speed 62/8562/1
Robert Varga [Wed, 2 Jul 2014 16:42:18 +0000 (18:42 +0200)]
BUG-1275: optimize AugmentationSchemaProxy for lookup speed

This patch uses ImmutableMap to bias the map from creation speed to
lookup performance. Also, in the lookup path we perform a single lookup,
and check the null result, instead of contains() followed by a lookup.

Change-Id: Iba50dc5fae7ef87da79072be4936690587f46018
Signed-off-by: Robert Varga <rovarga@cisco.com>