private void WireUpInheritanceRelationships(AvroNode n) { if (n.classNode != null && !n.classNode.Equals(string.Empty)) { AvroClassNode cn = (AvroClassNode)n.classNode; IClassNode iface = null; try { iface = (IClassNode)GetNode(n.fullName); } catch (NameResolutionException e) { Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new IllegalStateException("When reading protocol buffer node " + n.fullName + " does not exist. Full record is " + n, e); Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } foreach (string impl in cn.implFullNames) { try { iface.PutImpl((IClassNode)GetNode(impl)); } catch (NameResolutionException e) { Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new IllegalStateException("When reading protocol buffer node " + n + " refers to non-existent implementation:" + impl); Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (InvalidCastException e) { Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); try { var ex = new IllegalStateException( "When reading protocol buffer node " + n + " found implementation" + GetNode(impl) + " which is not a ClassNode!"); Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (NameResolutionException ne) { Utilities.Diagnostics.Exceptions.Caught(ne, Level.Error, LOGGER); var ex = new IllegalStateException( "Got 'cant happen' exception when producing error message for " + e); Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } } } } }
private INode RegisterClass(Type type) { INode node = GetAlreadyBoundNode(type); if (node != null) { return(node); } node = BuildPathToNode(type); IClassNode classNode = node as IClassNode; if (classNode != null) { Type baseType = type.BaseType; if (baseType != null) { IClassNode n = (IClassNode)GetAlreadyBoundNode(baseType); if (n != null) { n.PutImpl(classNode); } else { Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Error in finding Node for BaseType"), LOGGER); } } foreach (Type interf in ReflectionUtilities.GetInterfaces(type, false)) { IClassNode n = (IClassNode)GetAlreadyBoundNode(ReflectionUtilities.EnsureInterfaceType(interf)); if (n != null) { n.PutImpl(classNode); } else { Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Error in finding Node for Interface"), LOGGER); } } } return(node); }