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

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


    public Connection getConnection(TableDetails pTableDetails) throws SAXException {
      javax.naming.InitialContext ic;
      try {
        ic = new javax.naming.InitialContext();
      } catch (NamingException e) {
        throw new LocSAXException("Failed to create initial JNDI context: "
                                   + e.getClass().getName() + ", " + e.getMessage(),
                                   pTableDetails.getLocator(), e);
      }
      javax.sql.DataSource ds;
      try {
        ds = (javax.sql.DataSource) ic.lookup(pTableDetails.getDatasource());
      } catch (NamingException e) {
        throw new LocSAXException("Failed to lookup datasource " + pTableDetails.getDatasource()
                                   + ": " + e.getClass().getName() + ", " + e.getMessage(),
                                   pTableDetails.getLocator(), e);
      }
      try {
        Connection conn = ds.getConnection(pTableDetails.getUser(), pTableDetails.getPassword());
        if (conn == null) {
          throw new LocSAXException("Unable to connect to " + pTableDetails.getUrl()
                                     + " as user " + pTableDetails.getUser()
                                     + ": Datasource returned a null connection",
                                     pTableDetails.getLocator());
        }
        return conn;
      } catch (SQLException e) {
        throw new LocSAXException("Unable to connect to datasource " + pTableDetails.getUrl()
                                   + " as user " + pTableDetails.getUser()
                                   + ": SQL State = " + e.getSQLState() + ", error code = "
                                   + e.getErrorCode() + ", " + e.getMessage(),
                                   pTableDetails.getLocator(), e);
      }
View Full Code Here


  }

  public void add(XSType pType) throws SAXException {
    XsQName name = pType.getName();
    if (name == null) {
      throw new LocSAXException("A global type must have a 'name' attribute.", pType.getLocator());
    }
    if (types.containsKey(name)) {
      throw new LocSAXException("A global type " + name + " is already defined.", pType.getLocator());
    }
    types.put(name, pType);
    pType.setGlobal(true);
    addChild(pType);
  }
View Full Code Here

  }

  public void redefine(XSType pType) throws SAXException {
    XsQName name = pType.getName();
    if (name == null) {
      throw new LocSAXException("A global type must have a 'name' attribute.", pType.getLocator());
    }
    Object oldType = types.get(name);
    if (oldType == null) {
      throw new LocSAXException("The global type " + name + " cannot be redefined, as it doesn't yet exist.",
                                   pType.getLocator());
    }
    types.put(name, pType);
    pType.setGlobal(true);
    replace(oldType, pType);
View Full Code Here

  }

  public void add(XSGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global group must have a 'name' attribute.", pGroup.getLocator());
    }
    if (groups.containsKey(name)) {
      throw new LocSAXException("A global group " + name + " is already defined.", pGroup.getLocator());
    }
    groups.put(name, pGroup);
    addChild(pGroup);
    pGroup.setGlobal(true);
  }
View Full Code Here

  }

  public void redefine(XSGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global group must have a 'name' attribute.", pGroup.getLocator());
    }
    Object oldGroup = groups.get(name);
    if (oldGroup == null) {
      throw new LocSAXException("The global group " + name + " cannot be redefined, as it doesn't yet exist.",
                                   pGroup.getLocator());
    }
    groups.put(name, pGroup);
    replace(oldGroup, pGroup);
  }
View Full Code Here

  }

  public void add(XSAttributeGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
    }
    if (attributeGroups.containsKey(name)) {
      throw new LocSAXException("A global attribute group " + name + " is already defined.", pGroup.getLocator());
    }
    attributeGroups.put(name, pGroup);
    addChild(pGroup);
  }
View Full Code Here

  }

  public void redefine(XSAttributeGroup pGroup) throws SAXException {
    XsQName name = pGroup.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pGroup.getLocator());
    }
    Object oldGroup = attributeGroups.get(name);
    if (!attributeGroups.containsKey(name)) {
      throw new LocSAXException("The global attribute group " + name + " cannot be redefined, as it doesn't yet exist.",
                                   pGroup.getLocator());
    }
    attributeGroups.put(name, pGroup);
    replace(oldGroup, pGroup);
  }
View Full Code Here

  }

  public void add(XSAttribute pAttribute) throws SAXException {
    XsQName name = pAttribute.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute must have a 'name' attribute.", pAttribute.getLocator());
    }
    if (attributes.containsKey(name)) {
      throw new LocSAXException("A global attribute " + name + " is already defined.", pAttribute.getLocator());
    }
    attributes.put(name, pAttribute);
    addChild(pAttribute);
  }
View Full Code Here

  }

  public void add(XSElement pElement) throws SAXException {
    XsQName name = pElement.getName();
    if (name == null) {
      throw new LocSAXException("A global attribute group must have a 'name' attribute.", pElement.getLocator());
    }
    if (elements.containsKey(name)) {
      throw new LocSAXException("A global group " + name + " is already defined.", pElement.getLocator());
    }
    elements.put(name, pElement);
    addChild(pElement);
  }
View Full Code Here

  public XSListTypeImpl(XSType pOwner, XsEList pBaseList) throws SAXException {
    XsQName itemTypeName = pBaseList.getItemType();
    if (itemTypeName == null) {
      XsTLocalSimpleType simpleType = pBaseList.getSimpleType();
      if (simpleType == null) {
        throw new LocSAXException("You must either set the 'itemType' attribute or add a 'simpleType' element.",
                                   pBaseList.getLocator());
      }
      XSType type = pOwner.getXSSchema().getXSObjectFactory().newXSType(pOwner, simpleType);
      type.validate();
      itemType = type;
    } else {
      XSType type = pOwner.getXSSchema().getType(itemTypeName);
      if (type == null) {
        throw new LocSAXException("Unknown item type: " + itemTypeName, pBaseList.getLocator());
      }
      type.validate();
      if (!type.isSimple()) {
        throw new LocSAXException("The item type " + itemTypeName + " is complex.",
                                     pBaseList.getLocator());
      }
      itemType = type;
    }
  }
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.