Package org.objectweb.speedo.metadata

Examples of org.objectweb.speedo.metadata.SpeedoExtension


    public void visitExtension(SpeedoExtension se) throws SpeedoException {
        debug = logger.isLoggable(BasicLevel.DEBUG);
    if (se.owner instanceof SpeedoTuple) {
      SpeedoField sf = ((SpeedoTuple) se.owner).moField;
      SpeedoExtension oldse = sf.getExtensionByKey(se.key);
      if (oldse != null) {
        //The extension already exist on the SpeedoField
        if ((se.value == null && oldse.value!= null)
          || se.value != null && !se.value.equals(oldse.value)) {
          //different value ==> exception
View Full Code Here


    sc.setSuperClassName(supersc.getFQName());
    if (debug) {
      logger.log(BasicLevel.DEBUG, "class " + sc.getFQName()
          + " extends " + sc.getSuperClassName());
    }
    SpeedoExtension se = sc.getExtensionByKey(INHERITANCE_MAPPING);
    if (se == null) {
      se = new SpeedoExtension(VENDOR_NAME,
          INHERITANCE_MAPPING,
          DEFAULT_INHERITANCE_MAPPING, sc);
      sc.addExtension(se);
    }
    //Assign identifier information to all familly member
View Full Code Here

    super.visitClass(sc);
  }

  private List findExtensions(SpeedoClass sc, String[] keynames) {
    ArrayList res = new ArrayList();
    SpeedoExtension se;
    for(int i=0; i<keynames.length; i++) {
      se = sc.getExtensionByKey(keynames[i]);
      if (se != null) {
        res.add(se);
      }
View Full Code Here

    return res;
  }

  private void assignExtension(List extensions, SpeedoClass sc) {
    for(int i=extensions.size()-1; i>=0; i--) {
      SpeedoExtension se = (SpeedoExtension) extensions.get(i);
      sc.addExtension(
        new SpeedoExtension(se.vendorName, se.key, se.value, sc));
    }
  }
View Full Code Here

     */
    private void checkExtension(SpeedoField sf,
                                SpeedoField reverse,
                                String ext1,
                                String ext2) throws SpeedoException {
        SpeedoExtension se1 = sf.getExtension(SpeedoProperties.VENDOR_NAME, ext1);
        if (se1 == null) {
            return;
        }
        SpeedoExtension se2 = reverse.getExtension(SpeedoProperties.VENDOR_NAME, ext2);
        if (se2 == null) {
            //define the extension on the reverse field with the same value
            se2 = new SpeedoExtension(SpeedoProperties.VENDOR_NAME, ext2, se1.value, reverse);
            reverse.addExtension(se2);
            logger.log(BasicLevel.DEBUG, "add the extension(" + ext2
                    + ", " + se1.value +") on the " + reverse.getSourceDesc());
        } else if (!se2.value.equals(se1.value)) {
            throw new SpeedoException(
View Full Code Here

        sf.visibility = Constants.ACC_PUBLIC;
        sf.name = "speedo" + SpeedoVersion.toString(sc.version.strategy);
        //  equivalent for long in ASM
        sf.type = "J";
        //create a speedo extension for the sql name
        SpeedoExtension se = new SpeedoExtension("speedo","sql-name", sf.name.toUpperCase(), sf);
        sf.addExtension(se);
        sc.add(sf, true, logger);
      }
    }
    super.visitClass(sc);
View Full Code Here

     * @param sc a class requiring a sequence for the identifier.
     */
    private SpeedoSequence createSpeedoSequenceFromExtension(final SpeedoClass sc) {
        if (sc.identity.sequenceName == null) {
            //compute the name of the sequence
            SpeedoExtension se = sc.getExtensionByKey(SQL_SEQ_NAME);
            if (se == null) { //no extension for the name of the sequence
                if (sc.mainTable != null) {
                    if (debug) {
                        logger.log(BasicLevel.DEBUG, "Sequence name computed from the table name.");
                    }
View Full Code Here

  }

  public void visitField(SpeedoField sf) throws SpeedoException {
    super.visitField(sf);
    if (sf.type.startsWith("Ljava/sql/")) {
      SpeedoExtension se = new SpeedoExtension();
      se.vendorName = SpeedoProperties.VENDOR_NAME;
      se.key = SpeedoProperties.FIELD_CONVERTER;
      se.value = "org.objectweb.speedo.lib.Sql";
      se.value += sf.type.substring(10, sf.type.length()-1);
      se.value += "FieldMapping";
      logger.log(BasicLevel.DEBUG, "Use the converter '" + se.value
          + "' for the field '" + sf.name + "'");
      sf.addExtension(se);
    } else if (sf.type.startsWith("Ljava/util/Locale")) {
      SpeedoExtension se = new SpeedoExtension();
      se.vendorName = SpeedoProperties.VENDOR_NAME;
      se.key = SpeedoProperties.FIELD_CONVERTER;
      se.value = "org.objectweb.speedo.lib.LocaleFieldMapping";
      logger.log(BasicLevel.DEBUG, "Use the converter '" + se.value
          + "' for the field '" + sf.name + "'");
View Full Code Here

    }
   
    public void visitField(SpeedoField sf) throws SpeedoException {
        super.visitField(sf);
        //Cascade delete
    SpeedoExtension se = sf.getExtension(
      SpeedoProperties.VENDOR_NAME,
      SpeedoProperties.CASCADE_DELETE);
    //set the isCascadeDelete attribute
    sf.isCascadeDelete = se != null
      && ("true".equalsIgnoreCase(se.value)
View Full Code Here

      sm.keyType = keyfield.type();
    }

    // Add the SQL_NAME extension for the index field if it is specified
    // for the key field
    SpeedoExtension _se = keyfield.getExtensionByKey(SQL_NAME);
    if (_se != null) {
      _se = new SpeedoExtension(_se.vendorName, INDEX, _se.value, sf);
      sf.addExtension(_se);
    }

    // Add the SQL_TYPE extension for the index field if it is specified
    // for the key field
    _se = keyfield.getExtensionByKey(SQL_TYPE);
    if (_se != null) {
      _se = new SpeedoExtension(_se.vendorName, INDEX_TYPE, _se.value, sf);
      sf.addExtension(_se);
    }
    super.visitExtension(se);
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.metadata.SpeedoExtension

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.