private void validateNodeType(NodeTypeData nodeType) throws RepositoryException
   {
      if (nodeType == null)
      {
         throw new RepositoryException("NodeType object " + nodeType + " is null");
      }

      if (nodeType.getName() == null)
      {
         throw new RepositoryException("NodeType implementation class " + nodeType.getClass().getName()
            + " is not supported in this method");
      }

      for (InternalQName sname : nodeType.getDeclaredSupertypeNames())
      {
         if (!nodeType.getName().equals(Constants.NT_BASE) && nodeType.getName().equals(sname))
         {
            throw new RepositoryException("Invalid super type name" + sname.getAsString());
         }
      }

      for (PropertyDefinitionData pdef : nodeType.getDeclaredPropertyDefinitions())
      {
         if (!pdef.getDeclaringNodeType().equals(nodeType.getName()))
         {
            throw new RepositoryException("Invalid declared node type in property definitions with name "
               + pdef.getName().getAsString() + " not registred");
         }
         
         // validate default values
         try
         {
            validateValueDefaults(pdef.getRequiredType(), pdef.getDefaultValues());
         }
         catch (ValueFormatException e)
         {
            throw new ValueFormatException("Default value is incompatible with Property type "
               + PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
               + " in nodetype " + nodeType.getName().getAsString(), e);
         }
         
         try
         {
            validateValueConstraints(pdef.getRequiredType(), pdef.getValueConstraints());
         }
         catch (ValueFormatException e)
         {
            throw new ValueFormatException("Constraints is incompatible with Property type "
               + PropertyType.nameFromValue(pdef.getRequiredType()) + " of " + pdef.getName().getAsString()
               + " in nodetype " + nodeType.getName().getAsString(), e);
         }
      }

      for (NodeDefinitionData cndef : nodeType.getDeclaredChildNodeDefinitions())
      {
         if (!cndef.getDeclaringNodeType().equals(nodeType.getName()))
         {
            throw new RepositoryException("Invalid declared node type in child node definitions with name "
               + cndef.getName().getAsString() + " not registred");
         }
      }
   }
private void validateNodeType ( NodeTypeData nodeType ) throws RepositoryException { if ( nodeType == null ) { throw new RepositoryException ( "NodeType object " + nodeType + " is null" ) ; } if ( nodeType . getName ( ) == null ) { throw new RepositoryException ( "NodeType implementation class " + nodeType . getClass ( ) . getName ( ) + " is not supported in this method" ) ; } for ( InternalQName sname : nodeType . getDeclaredSupertypeNames ( ) ) { if ( ! nodeType . getName ( ) . equals ( Constants . NT_BASE ) && nodeType . getName ( ) . equals ( sname ) ) { throw new RepositoryException ( "Invalid super type name" + sname . getAsString ( ) ) ; } } for ( PropertyDefinitionData pdef : nodeType . getDeclaredPropertyDefinitions ( ) ) { if ( ! pdef . getDeclaringNodeType ( ) . equals ( nodeType . getName ( ) ) ) { throw new RepositoryException ( "Invalid declared node type in property definitions with name " + pdef . getName ( ) . getAsString ( ) + " not registred" ) ; } try { validateValueDefaults ( pdef . getRequiredType ( ) , pdef . getDefaultValues ( ) ) ; } catch ( ValueFormatException e ) { throw new ValueFormatException ( "Default value is incompatible with Property type " + PropertyType . nameFromValue ( pdef . getRequiredType ( ) ) + " of " + pdef . getName ( ) . getAsString ( ) + " in nodetype " + nodeType . getName ( ) . getAsString ( ) , e ) ; } try { validateValueConstraints ( pdef . getRequiredType ( ) , pdef . getValueConstraints ( ) ) ; } catch ( ValueFormatException e ) { throw new ValueFormatException ( "Constraints is incompatible with Property type " + PropertyType . nameFromValue ( pdef . getRequiredType ( ) ) + " of " + pdef . getName ( ) . getAsString ( ) + " in nodetype " + nodeType . getName ( ) . getAsString ( ) , e ) ; } } for ( NodeDefinitionData cndef : nodeType . getDeclaredChildNodeDefinitions ( ) ) { if ( ! cndef . getDeclaringNodeType ( ) . equals ( nodeType . getName ( ) ) ) { throw new RepositoryException ( "Invalid declared node type in child node definitions with name " + cndef . getName ( ) . getAsString ( ) + " not registred" ) ; } } }
Check according the JSR-170