X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fdom%2Fserializer%2Fimpl%2FLazyGeneratedCodecRegistry.java;h=cabb1bc4e2c5359582bc95e1e30514f557801b64;hp=39bd0816f50fb63e68bbbdb85ca7cbdce74812b6;hb=9212fed678702583f4a555641208cf1c7b45b829;hpb=5b4fe76e48ced1146c26421aa163626a36bc09c9 diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/LazyGeneratedCodecRegistry.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/LazyGeneratedCodecRegistry.java index 39bd0816f5..cabb1bc4e2 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/LazyGeneratedCodecRegistry.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/dom/serializer/impl/LazyGeneratedCodecRegistry.java @@ -175,7 +175,7 @@ public class LazyGeneratedCodecRegistry implements // }); return ret; } catch (Exception e) { - LOG.error("Could not find augmentable for {}", augmentation, e); + LOG.debug("Could not find augmentable for {} using {}", augmentation, augmentation.getClassLoader(), e); return null; } } @@ -233,7 +233,7 @@ public class LazyGeneratedCodecRegistry implements // if (typeToClass.containsKey(typeRef)) { return; } - LOG.info("Binding Class {} encountered.", cls); + LOG.trace("Binding Class {} encountered.", cls); WeakReference weakRef = new WeakReference<>(cls); typeToClass.put(typeRef, weakRef); if (Augmentation.class.isAssignableFrom(cls)) { @@ -250,7 +250,7 @@ public class LazyGeneratedCodecRegistry implements // if (typeToClass.containsKey(typeRef)) { return; } - LOG.info("Binding Class {} encountered.", cls); + LOG.trace("Binding Class {} encountered.", cls); WeakReference weakRef = new WeakReference<>((Class) cls); typeToClass.put(typeRef, weakRef); } @@ -389,8 +389,10 @@ public class LazyGeneratedCodecRegistry implements // public void onModuleContextAdded(SchemaContext schemaContext, Module module, ModuleContext context) { pathToType.putAll(context.getChildNodes()); qnamesToIdentityMap.putAll(context.getIdentities()); - for(Entry identity : context.getIdentities().entrySet()) { - typeToQname.put(new ReferencedTypeImpl(identity.getValue().getPackageName(), identity.getValue().getName()),identity.getKey()); + for (Entry identity : context.getIdentities().entrySet()) { + typeToQname.put( + new ReferencedTypeImpl(identity.getValue().getPackageName(), identity.getValue().getName()), + identity.getKey()); } captureCases(context.getCases(), schemaContext); } @@ -947,12 +949,12 @@ public class LazyGeneratedCodecRegistry implements // @Override public Class deserialize(QName input) { Type type = qnamesToIdentityMap.get(input); - if(type == null) { + if (type == null) { return null; } ReferencedTypeImpl typeref = new ReferencedTypeImpl(type.getPackageName(), type.getName()); WeakReference softref = typeToClass.get(typeref); - if(softref == null) { + if (softref == null) { return null; } return softref.get(); @@ -963,12 +965,12 @@ public class LazyGeneratedCodecRegistry implements // checkArgument(BaseIdentity.class.isAssignableFrom(input)); bindingClassEncountered(input); QName qname = identityQNames.get(input); - if(qname != null) { + if (qname != null) { return qname; } ConcreteType typeref = Types.typeForClass(input); qname = typeToQname.get(typeref); - if(qname != null) { + if (qname != null) { identityQNames.put(input, qname); } return qname; @@ -980,4 +982,26 @@ public class LazyGeneratedCodecRegistry implements // return serialize((Class) input); } } + + public boolean isCodecAvailable(Class cls) { + if (containerCodecs.containsKey(cls)) { + return true; + } + if (identifierCodecs.containsKey(cls)) { + return true; + } + if (choiceCodecs.containsKey(cls)) { + return true; + } + if (caseCodecs.containsKey(cls)) { + return true; + } + if (augmentableCodecs.containsKey(cls)) { + return true; + } + if (augmentationCodecs.containsKey(cls)) { + return true; + } + return false; + } } \ No newline at end of file