Examples of PType


Examples of org.apache.crunch.types.PType

    writer.close();
  }

  private void writeSequenceFileFromPCollection(final FileSystem fs, final Path path,
      final PCollection collection) throws IOException {
    final PType pType = collection.getPType();
    final Converter converter = pType.getConverter();
    final Class valueClass = converter.getValueClass();

    final SequenceFile.Writer writer = new SequenceFile.Writer(fs, fs.getConf(), path,
        NullWritable.class, valueClass);

    for (final Object o : collection.materialize()) {
      final Object value = pType.getOutputMapFn().map(o);
      writer.append(NullWritable.get(), value);
    }

    writer.close();
  }
View Full Code Here

Examples of org.apache.crunch.types.PType

    writer.close();
  }
 
  private void writeSequenceFileFromPCollection(final FileSystem fs, final Path path,
      final PCollection collection) throws IOException {
    final PType pType = collection.getPType();
    final Converter converter = pType.getConverter();
    final Class valueClass = converter.getValueClass();

    final SequenceFile.Writer writer = new SequenceFile.Writer(fs, fs.getConf(), path,
        NullWritable.class, valueClass);

    for (final Object o : collection.materialize()) {
      final Object value = pType.getOutputMapFn().map(o);
      writer.append(NullWritable.get(), value);
    }

    writer.close();
  }
View Full Code Here

Examples of org.apache.crunch.types.PType

    writer.close();
  }

  private void writeSequenceFileFromPCollection(final FileSystem fs, final Path path,
      final PCollection collection) throws IOException {
    final PType pType = collection.getPType();
    final Converter converter = pType.getConverter();
    final Class valueClass = converter.getValueClass();

    final SequenceFile.Writer writer = new SequenceFile.Writer(fs, fs.getConf(), path,
        NullWritable.class, valueClass);

    for (final Object o : collection.materialize()) {
      final Object value = pType.getOutputMapFn().map(o);
      writer.append(NullWritable.get(), value);
    }

    writer.close();
  }
View Full Code Here

Examples of org.apache.crunch.types.PType

    writer.close();
  }

  private void writeSequenceFileFromPCollection(final FileSystem fs, final Path path,
      final PCollection collection) throws IOException {
    final PType pType = collection.getPType();
    final Converter converter = pType.getConverter();
    final Class valueClass = converter.getValueClass();

    final SequenceFile.Writer writer = new SequenceFile.Writer(fs, fs.getConf(), path,
        NullWritable.class, valueClass);

    for (final Object o : collection.materialize()) {
      final Object value = pType.getOutputMapFn().map(o);
      writer.append(NullWritable.get(), value);
    }

    writer.close();
  }
View Full Code Here

Examples of org.apache.crunch.types.PType

    writer.close();
  }
 
  private void writeSequenceFileFromPCollection(final FileSystem fs, final Path path,
      final PCollection collection) throws IOException {
    final PType pType = collection.getPType();
    final Converter converter = pType.getConverter();
    final Class valueClass = converter.getValueClass();

    final SequenceFile.Writer writer = new SequenceFile.Writer(fs, fs.getConf(), path,
        NullWritable.class, valueClass);

    for (final Object o : collection.materialize()) {
      final Object value = pType.getOutputMapFn().map(o);
      writer.append(NullWritable.get(), value);
    }

    writer.close();
  }
View Full Code Here

Examples of org.objectweb.jorm.type.api.PType

      if (STN2FQTN[i][0].equals(name)) {
        return STN2FQTN[i][1];
      }
    }
    for (int i = 0; i < PTypeSpace.PREDEFINEDPTYPES.length; i++) {
      PType ptype = PTypeSpace.PREDEFINEDPTYPES[i];
      if (ptype.getJavaName().equals(name)
          || ptype.getJormName().equals(name)) {
        return ptype.getJavaName();
      }
    }
    return name;
  }
View Full Code Here

Examples of org.objectweb.jorm.type.api.PType

            Class clazz,
            SpeedoField sp,
            ClassMapping cm,
            JormMIMappingBuilder mb)throws SpeedoException, PException {
        SpeedoExtension se = sp.getExtensionByKey(SpeedoProperties.FIELD_CONVERTER);
        PType ptype = null;
        String className = null;
        if (se != null) {
            try {
                UserFieldMapping ufm = (UserFieldMapping)
                        java.lang.Class.forName(se.value).newInstance();
                ptype = getPrimitivePType(ufm.getStorageType().getName());
                if (ptype == null) {
                    className = ufm.getStorageType().getName();
                }
            } catch (Exception e) {
                throw new SpeedoException(
                        "Impossible to instanciate the UserFieldMapping class '"
                        + se.value + "' for the field '" + sp.name
                        + "' of the class '" + sc.getFQName() + "':", e);
            }
        } else {
            Type type = Type.getType(sp.type);
            ptype = getPrimitivePType(type);
            if (ptype == null) {
                className = type.getClassName();
            }
        }
        if (ptype == null) {
            if (isPersistentClass(className, sc.moPackage.name, manager)) {
                //JM of a reference field will be defined later.
                return;
            } else {
                logger.log(BasicLevel.INFO, "The field '" + sc.getFQName()
                    + "." + sp.name + " is managed as a Serialized field.");
                ptype = PTypeSpace.SERIALIZED;
            }
        }
        logger.log(BasicLevel.DEBUG, "primitive field: " + sp.name + " / javatype: " + ptype.getJavaName());
        se = sp.getExtensionByKey(SpeedoProperties.SIZE);
        int size = PType.NOSIZE;
        if (se != null) {
            try {
                size = Integer.parseInt(se.value);
View Full Code Here

Examples of org.objectweb.jorm.type.api.PType

                            "required for the multivalued field '" + sp.name
                            + "' of the class '" + sc.getFQName()
                            + "' in the .jdo file '"
                            + sc.moPackage.xmlDescriptor.xmlFile + "'");
                }
                PType type = getPrimitivePType(innerType);
              if (type == null && !isPersistentClass(innerType, sc.moPackage.name, manager)) {
                logger.log(BasicLevel.INFO, "The field '" + sc.getFQName()
                        + "." + sp.name + " is managed as a Serialized field.");
                type = PTypeSpace.SERIALIZED;
              }
              if (debug) {
          logger.log(BasicLevel.DEBUG, "GenClass reference field: "
              + sp.name + " / javatype: " + javatype
              + " / innerType: " + innerType
            + " / ptype=" + (type == null ? null : type.getJavaName()));
              }
                GenClassRef gcr = clazz.createGenClassRef(sp.name, javatype);
                GenClassMapping gcm = null;
                ClassRef cr = null;
                SpeedoClass tsc = null;
View Full Code Here

Examples of org.objectweb.jorm.type.api.PType

        if (sm.keyType == null) {
            throw new SpeedoException(
                "It is required to define a key-type for the Map field'"
                + sf.name + "' of the class '" + sf.moClass.getFQName() +"' ");
        }
        PType res = getPrimitivePType((String) sm.keyType);
      boolean isPersistClass = isPersistentClass(
          (String) sm.keyType, sf.moClass.moPackage.name, manager);
      if (res == null && !isPersistClass) {
        logger.log(BasicLevel.INFO, "The field '" + sf.moClass.getFQName()
                + "." + sf.name + " is managed as a Serialized field.");
View Full Code Here

Examples of org.objectweb.jorm.type.api.PType

        case Type.LONG:
            return PTypeSpace.LONG;
        case Type.DOUBLE:
            return PTypeSpace.DOUBLE;
        case Type.ARRAY:
        PType innerType = getPrimitivePType(t.getElementType());
        if (innerType !=null) {
          if (innerType == PTypeSpace.CHAR) {
            return PTypeSpace.CHARARRAY;
          } else if (innerType == PTypeSpace.BYTE) {
            return PTypeSpace.BYTEARRAY;
          } else {
            return PTypeSpace.SERIALIZED;
          }
        }
        return null;
        case Type.OBJECT:
      default:
            String cn = t.getClassName();
          PType res = getPrimitivePType(cn);
          if (res == null && !isPersistentClass(cn, null, manager)) {
                return PTypeSpace.SERIALIZED;
            } else {
              return res;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.