Package org.objectweb.speedo.generation.api

Examples of org.objectweb.speedo.generation.api.SpeedoXMLError


      String furl = "file://" + dir + "/";
      logger.log(BasicLevel.DEBUG,
          "Adding URL to compiler class loader: " + furl);
      addURL(new URL(furl));
    } catch (MalformedURLException e) {
      throw new SpeedoXMLError(e);
    }
  }
View Full Code Here


        } else if (tag.equals("property")) { //tag property
            Node n, v;
          n = node.getAttributes().getNamedItem("name");
          v = node.getAttributes().getNamedItem("value");
          if ((n == null) || (v == null)) {
            throw new SpeedoXMLError("Attribute name or value for tag property requested.");
          }
          n.getNodeValue();
          v.getNodeValue();
        }
        return o;
View Full Code Here

        }
        Class pclassJorm = manager.getClass(sc.getFQName());
        pName = getClassNameDef(pclassJorm);

        if (classJorm == null) {
            throw new SpeedoXMLError("Class '" + clas.name + "' not defined in JORM metadata");
        }

        // Comparison from JDO
        clas.jormclass = classJorm;
        for (Iterator efield = clas.fields.values().iterator(); efield.hasNext();) {
            SpeedoField field = (SpeedoField) efield.next();
            String fieldName = field.name;

            // Fields with this persistent modifier shouldn't stay in JDO Metadata
            if (field.persistenceStatus == SpeedoField.NONE)
                continue;

            TypedElement tElem = classJorm.getTypedElement(fieldName);
            if (tElem == null) {
                throw new SpeedoXMLError("Field '" + fieldName
                    + "' not defined in JORM metadata of the class '"
                    + clas.getFQName() + "'");
            }

            // for application identity key fields have to be compared
            if (field.primaryKey) {
                boolean found = false;
                for (Iterator it = pName.iterateField(); it.hasNext() && !found;) {
                    found = fieldName.equals(it.next());
                }
                if (!found) {
                    throw new SpeedoXMLError("Field '" + fieldName
                        + "' not defined in Class NameDef's Fields of the class '"
                        + clas.getFQName() + "'");
                }
            }

            if (tElem instanceof GenClassRef && field.jdoTuple == null)
                throw new SpeedoXMLError("field '" + fieldName + "' should be a tuple in JDO metadata of the class '" + clas.getFQName() + "'");
        }

        // Comparison from JORM
        for (Iterator jormfield = classJorm.getFields().iterator(); jormfield.hasNext();) {
            TypedElement te = (TypedElement) jormfield.next();
            String fieldName = te.getName();
            if (!clas.fields.containsKey(fieldName)
                    && !isContainerIdField(classJorm, te, clas))
                throw new SpeedoXMLError("Field '" + fieldName + "' of the class '"
                            + clas.getFQName() + "' is not defined in the '"
                            + clas.moPackage.xmlDescriptor.xmlFile
                            + "' file (found: " + clas.fields.keySet() + ").");
        }
View Full Code Here

        SpeedoClass c = new SpeedoClass();
        Node n = null;
        //attribute name (compulsory)
        n = node.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag class requested.");
        c.name = c.nameForQuery = n.getNodeValue();

        //attribute identity-type
        n = node.getAttributes().getNamedItem("identity-type");
        if (n != null)
View Full Code Here

    private Object treatDataStoreId(Node node, Object mo) throws SpeedoException {
        SpeedoIdentity ident = new SpeedoIdentity(); //default strategy is native
        //attribute strategy
        Node n = node.getAttributes().getNamedItem("strategy");
        if (n == null)
            throw new SpeedoXMLError("Attribute strategy for tag datastore-identity requested.");
        ident.strategy = SpeedoIdentity.getStrategy(n.getNodeValue());

        //attribute sequence
        n = node.getAttributes().getNamedItem("sequence");
        if (n != null)
View Full Code Here

    Node n = null;

        //attribut name (compulsory)
        n = node.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag field requested.");
        String name = n.getNodeValue();
        if(name.indexOf(".") != -1){
           
        }
        f.name = n.getNodeValue();
View Full Code Here

    private Object treatPackage(Node node, Object mo) throws SpeedoException {
        SpeedoPackage p = new SpeedoPackage();
        //attribute name (compulsory)
        Node n = node.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag package requested.");
        p.name = n.getNodeValue();
        ((SpeedoXMLDescriptor) mo).add(p, true, logger);
        logger.log(BasicLevel.DEBUG, "New package: name= " + p.name);
        return p;
    }
View Full Code Here

        Node n = null;
       
        //attribute name (compulsory)
        n = node.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag sequence requested.");
        s.name = n.getNodeValue();

        //attribute datastore-sequence
        n = node.getAttributes().getNamedItem("datastore-sequence");
        if (n != null)
            s.datastoreName = n.getNodeValue();
         
        //attribute factory-class
        n = node.getAttributes().getNamedItem("factory-class");
        if (n != null) {
            s.factoryClass = n.getNodeValue();
        }

        //attribute strategy (compulsory)
        n = node.getAttributes().getNamedItem("strategy");
        if (n == null) {
            throw new SpeedoXMLError("Attribute strategy for tag sequence requested.");
        }
        s.strategy = SpeedoSequence.strategyToByte(n.getNodeValue());

        ((SpeedoPackage) mo).addSequence(s);
        if (debug) {
View Full Code Here

        Node n = null;
       
        //<!ATTLIST sequence name CDATA #REQUIRED>
        n = seqNode.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag sequence requested.");
        s.name = n.getNodeValue();
        p.addSequence(s);

        //<!ATTLIST sequence datastore-sequence CDATA #IMPLIED>
        n = seqNode.getAttributes().getNamedItem("datastore-sequence");
        if (n != null)
            s.datastoreName = n.getNodeValue();
         
        //<!ATTLIST sequence factory-class CDATA #IMPLIED>
        n = seqNode.getAttributes().getNamedItem("factory-class");
        if (n != null) {
            s.factoryClass = n.getNodeValue();
        }

        //<!ATTLIST sequence strategy (nontransactional|contiguous|noncontiguous) #REQUIRED>
        n = seqNode.getAttributes().getNamedItem("strategy");
        if (n == null) {
            throw new SpeedoXMLError("Attribute strategy for tag sequence requested.");
        }
        s.strategy = SpeedoSequence.strategyToByte(n.getNodeValue());
       
        //<!ELEMENT sequence (extension*)>
        Map seqChildren = groupChildrenByName(seqNode);
View Full Code Here

    Node n = null;

        //attribut name (compulsory)
        n = indexNode.getAttributes().getNamedItem("name");
        if (n == null)
            throw new SpeedoXMLError("Attribute name for tag index requested.");
        si.name = n.getNodeValue();
       
        //attribute unique
        n = indexNode.getAttributes().getNamedItem("unique");
        if (n != null)
             si.unique = Boolean.valueOf(n.getNodeValue()).booleanValue();

        //attribute table (compulsory)
        n = indexNode.getAttributes().getNamedItem("table");
        if (n == null)
            throw new SpeedoXMLError("Attribute table for tag index requested.");
        si.table = n.getNodeValue();
       
        //add the SpeedoIndex to the SpeedoTable
        boolean linked = false;
        //test the main table
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.generation.api.SpeedoXMLError

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.