Package org.apache.ws.jaxme.xs.parser.impl

Examples of org.apache.ws.jaxme.xs.parser.impl.LocSAXException


       throws SAXException {
    super(pParent, pSimpleType);
    isSimple = true;
    XsNCName myName = pSimpleType.getName();
    if (myName == null) {
      throw new LocSAXException("Invalid simple type: Missing 'name' attribute.",
                                   pSimpleType.getLocator());
    }
    XsESchema schema = pSimpleType.getXsESchema();
    this.name = new XsQName(schema.getTargetNamespace(), myName.toString(), schema.getTargetNamespacePrefix());
    xsAnnotation = pSimpleType.getAnnotation();
View Full Code Here


      throws SAXException {
    super(pParent, pComplexType);
    isSimple = false;
    XsNCName myName = pComplexType.getName();
    if (myName == null) {
      throw new LocSAXException("Invalid complex type: Missing 'name' attribute.",
                                   pComplexType.getLocator());
    }
    XsESchema schema = pComplexType.getXsESchema();
    this.name = new XsQName(schema.getTargetNamespace(), myName.toString(), schema.getTargetNamespacePrefix());
    xsAnnotation = pComplexType.getAnnotation();
View Full Code Here

  protected XSTypeImpl(XSObject pParent, XsTSimpleRestrictionType pRestriction)
      throws SAXException {
    super(pParent, pRestriction);
    XsQName myName = pRestriction.getBase();
    if (myName == null) {
      throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute.",
                                   pRestriction.getLocator());
    }
    XSType type = getXSSchema().getType(myName);
    if (type == null) {
      throw new LocSAXException("Invalid 'restriction': Unknown 'base' type " + myName,
                                   pRestriction.getLocator());
    }
    type.validate();
    if (type.isSimple()) {
      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is simple." +
                                   " It ought to be a complex type with simple content: ",
                                   pRestriction.getLocator());
    }
    XSComplexType myComplexType = type.getComplexType();
    if (!myComplexType.hasSimpleContent()) {
      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is complex," +
                                   " but doesn't have simple content: ", pRestriction.getLocator());
    }
    XSObjectFactory factory = pParent.getXSSchema().getXSObjectFactory();
    if (myComplexType.isExtension()) {
      XSType extendedType = myComplexType.getSimpleContent().getType();
      extendedType.validate();
      XSSimpleType extendedSimpleType = extendedType.getSimpleType();
 
      XSSimpleType mySimpleType;
      if (extendedSimpleType.isAtomic()) {
        mySimpleType = factory.newXSAtomicType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isList()) {
        mySimpleType = factory.newXSListType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isUnion()) {
        mySimpleType = factory.newXSUnionType(this, extendedType, pRestriction);
      } else {
        throw new LocSAXException("Unknown restriction type: " + extendedType,
                              pRestriction.getLocator());
      }

      simpleType = mySimpleType;
      //was: setSimpleType( extendedType.getSimpleType() );
View Full Code Here

        if (list == null) {
          XsEUnion union = myXsTSimpleType.getUnion();
          if (union == null) {
            XsERestriction restriction = myXsTSimpleType.getRestriction();
            if (restriction == null) {
              throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
                  myXsTSimpleType.getLocator());
            }
            XsQName myName = restriction.getBase();
            XSType restrictedType;         
            if (myName == null) {
              XsTLocalSimpleType baseType = restriction.getSimpleType();
              if (baseType == null) {
                throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
                    restriction.getLocator());
              } else {
                restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
              }
            } else {
              restrictedType = getXSSchema().getType(myName);
              if (restrictedType == null) {
                throw new LocSAXException("Unknown base type: " + myName,
                    restriction.getLocator());
              }
            }
            restrictedType.validate();
            if (!restrictedType.isSimple()) {
              throw new LocSAXException("The restricted type " + myName + " is complex.",
                  restriction.getLocator());
            }
            XSSimpleType baseType = restrictedType.getSimpleType();
            if (baseType.isAtomic()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
            } else if (baseType.isList()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
            } else if (baseType.isUnion()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, restrictedType, restriction);
            } else {
              throw new LocSAXException("Unknown restriction type: " + baseType, restriction.getLocator());
            }
          } else {
            mySimpleType = getXSSchema().getXSObjectFactory().newXSUnionType(this, union);
          }
        } else {
          mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, list);
        }
      }
      else {
        mySimpleType = getSimpleType();
      }
     
      this.simpleType = mySimpleType;
    } else {
      XSComplexTypeImpl myComplexType;
      XsTComplexType myXsTComplexType = (XsTComplexType) getXsObject();
      XsESimpleContent simpleContent = myXsTComplexType.getSimpleContent();
      if (simpleContent == null) {
        XsEComplexContent complexContent = myXsTComplexType.getComplexContent();
        if (complexContent == null) {
          XsTTypeDefParticle particle = myXsTComplexType.getTypeDefParticle();
          if (particle == null) {
            myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType);
          } else if (particle instanceof XsESequence) {
            myComplexType = new XSSequenceComplexTypeImpl(this, myXsTComplexType, (XsESequence) particle);
          } else if (particle instanceof XsEChoice) {
            myComplexType = new XSChoiceComplexTypeImpl(this, myXsTComplexType, (XsEChoice) particle);
          } else if (particle instanceof XsTAll) {
            myComplexType = new XSAllComplexTypeImpl(this, myXsTComplexType, (XsTAll) particle);
          } else if (particle instanceof XsTGroupRef) {
            XsTGroupRef groupRef = (XsTGroupRef) particle;
            XsQName myName = groupRef.getRef();
            if (myName == null) {
              throw new LocSAXException("Missing 'ref' attribute", groupRef.getLocator());
            }
            XSGroup group = getXSSchema().getGroup(myName);
            if (group == null) {
              throw new LocSAXException("Unknown group: " + myName, getLocator());
            }
            group.validate();
            myComplexType = new XSGroupComplexTypeImpl(this, myXsTComplexType, group);
          } else {
            throw new IllegalStateException("Invalid particle: " + particle.getClass().getName());
View Full Code Here

      simpleContent = pSimpleContent;
      XsTSimpleExtensionType extension = simpleContent.getExtension();
      if (extension == null) {
        XsTSimpleRestrictionType restriction = simpleContent.getRestriction();
        if (restriction == null) {
          throw new LocSAXException("Invalid 'simpleContent', neither of the 'extension' or 'restriction' child elements are present.",
                                       simpleContent.getLocator());
        }
        XsQName restrictedTypesName = restriction.getBase();
        if (restrictedTypesName == null) {
          throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute.", restriction.getLocator());
        }
        restrictedType = getXSSchema().getType(restrictedTypesName);
        if (restrictedType == null) {
          throw new LocSAXException("Invalid 'restriction': The base type " + restrictedTypesName + " is unknown.",
                                     restriction.getLocator());
        }
        restrictedType.validate();
        extendedType = null;
        XSObjectFactory factory = pOwner.getXSSchema().getXSObjectFactory();
        XSType contentType = factory.newXSType(pOwner, restriction);
        simpleContentType = factory.newXSSimpleContentType(pOwner, contentType, restriction);
        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
      } else {
        XsQName extendedTypesName = extension.getBase();
        if (extendedTypesName == null) {
          throw new LocSAXException("Invalid 'extension': Missing 'base' attribute.",
                                       extension.getLocator());
        }
        extendedType = getXSSchema().getType(extendedTypesName);
        if (extendedType == null) {
          throw new LocSAXException("Invalid 'extension': Unknown 'base' type " + extendedTypesName,
                                       extension.getLocator());
        }
        extendedType.validate();
        restrictedType = null;
        XSAttributable[] inheritedAttributes;
        if (extendedType.isSimple()) {
          simpleContentType = getOwner().getXSSchema().getXSObjectFactory().newXSSimpleContentType(pOwner,
                                                                                     extendedType, extension);
          inheritedAttributes = new XSAttributable[0];
        } else {
          XSComplexType myComplexType = extendedType.getComplexType();
          if (!myComplexType.hasSimpleContent()) {
            throw new LocSAXException("Invalid 'extension': The base type " + extendedTypesName +
                                         " is neither a simple type nor a complex type with simple content.",
                                         extension.getLocator());
          }
          simpleContentType = myComplexType.getSimpleContent();
          inheritedAttributes = myComplexType.getAttributes();
View Full Code Here

        if (pGroup.getParticles().length == 0) {
          XsEChoice choice = (XsEChoice) pParticle;
          if (choice.getMinOccurs() == 0) {
            return XsComplexContentType.EMPTY;
          } else {
            throw new LocSAXException("Invalid choice: Neither child elements, nor 'minOccurs'=0", choice.getLocator());
          }
        } else {
        }
      } else if (pParticle instanceof XsESequence) {
        if (pGroup.getParticles().length == 0) {
View Full Code Here

      XsTExtensionType extension = complexContent.getExtension();
      if (extension == null) {
        XsTComplexRestrictionType restriction = complexContent.getRestriction();
        if (restriction == null) {
          // TODO: Restriction of the ur-type
          throw new LocSAXException("Neither of extension or restriction, aka restriction of the ur-type: Not implemented",
                                       complexContent.getLocator());
        }
        XsQName base = restriction.getBase();
        if (base == null) {
          throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute", getLocator());
        }
        XSType type = getXSSchema().getType(base);
        if (type == null) {
          throw new LocSAXException("Invalid 'restriction': Unknown base type " + base, getLocator());
        }
        if (type.isSimple()) {
          throw new LocSAXException("Invalid 'restriction': The base type " + getName() + " is simple.", getLocator());
        }
        XsTTypeDefParticle particle = restriction.getTypeDefParticle();

        XSGroup group = getGroupByParticle(particle);
        if (group == null) {
          // TODO: Restriction of the ur-type
          complexContentParticle = null;
        } else {
          complexContentParticle = new XSParticleImpl(group);
        }
        complexContentType = getContentTypeByParticle(particle, group);
        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
        restrictedType = type;
      } else {
        XsQName base = extension.getBase();
        if (base == null) {
          throw new LocSAXException("Invalid 'extension': Missing 'base' attribute", getLocator());
        }
        XSType type = getXSSchema().getType(base);
        if (type == null) {
          throw new LocSAXException("Invalid 'extension': Unknown base type " + base, getLocator());
        }
        if (type.isSimple()) {
          throw new LocSAXException("Invalid 'extension': The base type " + base + " is simple.", getLocator());
        }
        XSComplexType extendedComplexType = type.getComplexType();
        if (extendedComplexType.hasSimpleContent()) {
          throw new LocSAXException("Invalid 'extension': The base type " + base + " has simple content.",
                                       getLocator());
        }
        XsTTypeDefParticle particle = extension.getTypeDefParticle();
        XSGroup group = getGroupByParticle(particle);
        XsComplexContentType groupType = getContentTypeByParticle(particle, group);
View Full Code Here

  }

  public void validate() throws SAXException {
    super.validate();
    if (name == null  ||  name.length() == 0) {
      throw new LocSAXException("Missing or empty 'table' attribute.", getLocator());
    }
  }
View Full Code Here

            if ("table".equals(pQName.getLocalName())) {
              return new TableDetails(JaxMeJdbcSG.this, pParent);
            } else if ("connection".equals(pQName.getLocalName())) {
              return new ConnectionDetails(JaxMeJdbcSG.this, pParent);
            } else {
              throw new LocSAXException("Invalid element name: " + pQName, pLocator);
            }
          } else {
            return null;
          }
        }
View Full Code Here

          if (ex == null) { ex = e; }
        }
      }
      if (c == null) {
        if (ex == null) { ex = new ClassNotFoundException(); }
        throw new LocSAXException("Unable to load driver class " + pTableDetails.getDriver()
                                   + ": " + ex.getClass().getName() + ", " + ex.getMessage(),
                                   pTableDetails.getLocator());
      }
      log.fine(mName, "Connecting to database " + pTableDetails.getUrl() + " as " + pTableDetails.getUser());
      try {
        Connection conn = DriverManager.getConnection(pTableDetails.getUrl(), pTableDetails.getUser(),
                                                      pTableDetails.getPassword());
        if (conn == null) {
          throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
                                     + " as user " + pTableDetails.getUser()
                                     + ": DriverManager returned a null connection",
                                     pTableDetails.getLocator());
        }
        return conn;
      } catch (SQLException e) {
        throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
                                   + " as user " + pTableDetails.getUser()
                                   + ": SQL State = " + e.getSQLState() + ", error code = "
                                   + e.getErrorCode() + ", " + e.getMessage(),
                                   pTableDetails.getLocator(), e);
      }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.parser.impl.LocSAXException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.