Package org.cishell.framework.data

Examples of org.cishell.framework.data.Data


     */
    public byte[] getData(String dataModelID, String format) {
        DataConversionService converter = (DataConversionService)
            ciContext.getService(DataConversionService.class.getName());
       
        Data dm = getDataModel(dataModelID);
        try {
      dm = converter.convert(dm, format);
    } catch (ConversionException e1) {
      dm = null;
    }
        byte[] data = null;
       
        if (dm != null && dm.getData() instanceof File) {
            File file = (File) dm.getData();
            if (file.exists()) {
                try {
                    FileInputStream in = new FileInputStream(file);
                    byte[] inData = new byte[(int)file.length()];
                   
View Full Code Here


    /**
     * @see org.cishell.remoting.service.framework.DataModelRegistry#getDataFormats(String)
     */
    public Vector getDataFormats(String dataModelID) {
        Data dm = getDataModel(dataModelID);
       
        String format = dm.getFormat();
        Vector v = new Vector();
       
        if (format != null){
            v.add(format);
        }
       
        //get implicit types from the java object
        if (dm.getData() != null && !(dm.getData() instanceof File)) {
            Class[] classes = dm.getData().getClass().getClasses();
            for (int i=0; i < classes.length; i++) {
                v.add(classes[i].getName());
            }
            v.add(dm.getData().getClass().getName());
        }
       
        return v;
    }
View Full Code Here

   
    /**
     * @see org.cishell.remoting.service.framework.DataModelRegistry#getDataModel(String)
     */
    public Data getDataModel(String dataModelID) {
        Data dm = (Data) registry.getObject(dataModelID);
       
        return dm == null ? NULL_DM : dm;
    }
View Full Code Here

   
    /**
     * @see org.cishell.remoting.service.framework.DataModelRegistry#getDataModel(String)
     */
    public Data getDataModel(String dataModelID) {
        Data dm = (Data) idToDMMap.get(dataModelID);
       
        if (dm == null) {
            dm = new RemoteDataModel(dataModelID);
            idToDMMap.put(dataModelID, dm);
        }
View Full Code Here

                        if (raw != null) {
                            FileOutputStream out = new FileOutputStream(file);
                            out.write(raw);
                            out.close();
                           
                            Data dm = new BasicData(new Hashtable(),
                                    file, inFormat);
                            try {
                dm = convert[0].convert(dm);
              } catch (ConversionException e) {
                dm = null;
              }
                           
                            if (dm != null) {
                                data = dm.getData();
                            }
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
View Full Code Here

  }

  public File saveData(Data sourceDatum, Converter converter, File targetFile)
      throws FileSaveException {
    try {
      Data convertedDatum = converter.convert(sourceDatum);
      saveTo((File) convertedDatum.getData(), targetFile);

      return targetFile;
    } catch (ConversionException e) {
      throw new FileSaveException(e.getMessage(), e);
    }
View Full Code Here

              catch (DatabaseCreationException e) {
                throw new AlgorithmExecutionException(e);
              } */
             
              // Wrap the new database.
              Data newDatabaseData = createOutDataFromDataSource(newDatabase);
             
              // Add the new out-data entry to our working list.
              resultSetsConvertedToNewDatabases.add(newDatabaseData);
            }
            while (sqlStatement.getMoreResults());
View Full Code Here

          keys.hasMoreElements();) {
        String key = keys.nextElement();
        labeledDatumMetadata.put(key, originalDatumMetadata.get(key));
      }

      Data labeledDatum =
        new BasicData(labeledDatumMetadata, datum.getData(), datum.getFormat());
      labeledDatumMetadata.put(DataProperty.LABEL, prefix + absoluteFile.getName());
      newData.add(labeledDatum);
    }
View Full Code Here

    for (Data datum : data) {
      Dictionary<String, Object> labeledDatumMetadata = datum.getMetadata();
      Object labelObject = labeledDatumMetadata.get(DataProperty.LABEL);

      if ((labelObject == null) || ("".equals(labelObject.toString()))) {
        Data dataParent = getParent(labeledDatumMetadata);

        if (!possibleParents.contains(dataParent)) {
          labeledDatumMetadata.put(DataProperty.LABEL, prefix + absoluteFile.getName());
        }
View Full Code Here

                    while (string != null) {
                        outString += string;
                        string = reader.readLine();
                    }
                   
                    Data dm = new BasicData(outString, String.class.getName());
                    dm.getMetadata().put(DataProperty.LABEL, "String for "+label);
                   
                    return new Data[]{dm};
                } else {
                  throw new AlgorithmExecutionException("File does not exist!");
                }
View Full Code Here

TOP

Related Classes of org.cishell.framework.data.Data

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.