Package org.gdbms.engine.data.metadata

Examples of org.gdbms.engine.data.metadata.Metadata


    public long getRowCount() throws DriverException {
        return 1;
    }

    public Metadata getDataSourceMetadata() throws DriverException {
        return new Metadata() {
       
            public Boolean isReadOnly(int fieldId) throws DriverException {
                return true;
            }
       
View Full Code Here


    return new OperationLayerMemento(getName(),
      new Memento[] { source.getMemento() }, getSQL());
  }

    public Metadata getDataSourceMetadata() throws DriverException {
        return new Metadata() {
       
            public Boolean isReadOnly(int fieldId) throws DriverException {
                return true;
            }
       
View Full Code Here

    return new OperationLayerMemento(getName(), mementos, getSQL());
  }

    public Metadata getDataSourceMetadata() throws DriverException {
        return new Metadata() {
       
            public Boolean isReadOnly(int fieldId) throws DriverException {
                return true;
            }
       
View Full Code Here

        PrintWriter out;

        try {
            out = new PrintWriter(new FileOutputStream(file));

            Metadata metadata = dataWare.getDataSourceMetadata();

            String fieldRow = metadata.getFieldName(0);

            for (int i = 1; i < metadata.getFieldCount(); i++) {
                fieldRow += (";" + metadata.getFieldName(i));
            }

            out.println(fieldRow);

            for (int i = 0; i < dataWare.getRowCount(); i++) {
                String row = dataWare.getFieldValue(i, 0).getStringValue(this);

                for (int j = 1; j < metadata.getFieldCount(); j++) {
                    row += (";" + dataWare.getFieldValue(i, j).getStringValue(
                            this));
                }

                out.println(row);
View Full Code Here

    d2.start();
    d2.stop();

    d.start();
    d2.start();
    Metadata metadata = d.getDataSourceMetadata();
    Metadata modifiedMetadata = d2.getDataSourceMetadata();
    assertTrue(metadata.getFieldCount() == modifiedMetadata.getFieldCount());
    for (int i = 0; i < metadata.getFieldCount(); i++) {
      assertTrue(metadata.getFieldName(i).equals(
          modifiedMetadata.getFieldName(i)));
      assertTrue(metadata.getFieldType(i) == modifiedMetadata
          .getFieldType(i));
      assertTrue(metadata.isReadOnly(i).equals(
          modifiedMetadata.isReadOnly(i)));
    }

    d2.stop();
    d.stop();
  }
View Full Code Here

    private void testAddField(String dsName, String type) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        Metadata m = d.getDataSourceMetadata();
        int fc = m.getFieldCount();
        d.addField("extra", type);
        m = d.getDataSourceMetadata();
        assertTrue(fc + 1 == m.getFieldCount());
        assertTrue(m.getFieldName(fc).equals("extra"));
        assertTrue(m.getFieldType(fc) == Value.STRING);
        assertTrue(!in(m.getPrimaryKey(), "extra"));
        assertTrue(!m.isReadOnly(fc));
        d.rollBackTrans();
    }
View Full Code Here

    private void testDeleteField(String dsName) throws Exception {
        DataSource d = ds.getDataSource(dsName);

        d.beginTrans();
        Metadata m = d.getDataSourceMetadata();
        String fieldName = m.getFieldName(2);
        int fc = m.getFieldCount();
        d.removeField(1);
        assertTrue(fc - 1 == m.getFieldCount());
        assertTrue(fieldName.equals(m.getFieldName(1)));
        d.rollBackTrans();
    }
View Full Code Here

  protected DataSource getDataSource() {
    return dataSource;
  }

    public Metadata getMetadata() throws DriverException {
        Metadata dataSourceMetadata = dataSource.getDataSourceMetadata();
        String[] fieldNames = new String[dataSourceMetadata.getFieldCount()+1];
        fieldNames[0] = "geom";
        for (int i = 1; i < fieldNames.length; i++) {
            fieldNames[i] = dataSourceMetadata.getFieldName(i-1);
        }
       
        int[] fieldTypes = new int[fieldNames.length];
        fieldTypes[0] = PTTypes.GEOMETRY;
        for (int i = 1; i < fieldTypes.length; i++) {
            fieldTypes[i] = dataSourceMetadata.getFieldType(i-1);
        }
       
        return new DefaultMetadata(fieldTypes, fieldNames,
                null, null);
    }
View Full Code Here

        PrintWriter out;

        try {
            out = new PrintWriter(new FileOutputStream(file));

            Metadata metadata = dataWare.getDataSourceMetadata();
            String fieldRow = metadata.getFieldName(0);

            for (int i = 1; i < metadata.getFieldCount(); i++) {
                fieldRow += (";" + metadata.getFieldName(i));
            }

            out.println(fieldRow);

            for (int i = 0; i < dataWare.getRowCount(); i++) {
                String row = dataWare.getFieldValue(i, 0).getStringValue(this);

                for (int j = 1; j < metadata.getFieldCount(); j++) {
                    row += (";" +
                    dataWare.getFieldValue(i, j).getStringValue(this));
                }

                out.println(row);
View Full Code Here

    return new OperationLayerMemento(getName(),
      new Memento[0], getSQL());
  }

    public Metadata getDataSourceMetadata() throws DriverException {
        return new Metadata() {
       
            public Boolean isReadOnly(int fieldId) throws DriverException {
                return true;
            }
View Full Code Here

TOP

Related Classes of org.gdbms.engine.data.metadata.Metadata

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.