Examples of DataAccess


Examples of org.geotools.data.DataAccess

        DataAccessFactory f = getGeoServer().getCatalog().getResourcePool().getDataStoreFactory(info);
       
        assertNotNull( f );
        assertTrue( f instanceof PropertyDataStoreFactory );
       
        DataAccess store = getGeoServer().getCatalog().getResourcePool().getDataStore(info);
               
        assertEquals( testDS.toURI().toString().toLowerCase(), store.getInfo().getSource().toString().replace("/./", "/").toLowerCase());
    }
View Full Code Here

Examples of org.geotools.data.DataAccess

    @SuppressWarnings("rawtypes")
    @Test
    public void testPutWithCalculation() throws Exception {
        DataStoreInfo dataStoreInfo = getCatalog().getDataStoreByName("sf","sf");
        String dataStoreId = dataStoreInfo.getId();
        DataAccess dataAccessBefore = dataStoreInfo.getDataStore(null);
        assertSame("ResourcePool DataStoreCache", dataAccessBefore, getCatalog().getResourcePool().getDataStoreCache().get( dataStoreId ));
       
        String clearLatLonBoundingBox =
              "<featureType>"
                + "<nativeBoundingBox>"
                  + "<minx>-180.0</minx>" + "<maxx>180.0</maxx>"
                  + "<miny>-90.0</miny>" + "<maxy>90.0</maxy>"
                  + "<crs>EPSG:4326</crs>"
                + "</nativeBoundingBox>"
                + "<latLonBoundingBox/>"
            + "</featureType>";
       
        String path = "/rest/workspaces/sf/datastores/sf/featuretypes/PrimitiveGeoFeature";
        MockHttpServletResponse response =
                putAsServletResponse(path, clearLatLonBoundingBox, "text/xml");
        assertEquals("Couldn't remove lat/lon bounding box:\n" + response.getOutputStreamContent(),
                200, response.getStatusCode());

        Document dom = getAsDOM(path + ".xml");
        assertXpathEvaluatesTo("0.0", "/featureType/latLonBoundingBox/minx", dom);
       
        // confirm ResourcePoool cache of DataStore is unchanged
        DataAccess dataAccessAfter = getCatalog().getDataStoreByName("sf","sf").getDataStore(null);
        assertSame( "ResourcePool DataStoreCache check 1", dataAccessBefore, dataAccessAfter );
        assertSame("ResourcePool DataStoreCache", dataAccessBefore, getCatalog().getResourcePool().getDataStoreCache().get( dataStoreId ));
       
        String updateNativeBounds =
                "<featureType>"
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

    bundleFile = bundle;
    fnDecorer = Internals.buildFileNameEncodingHelper(new SessionContext.SourcePrim(ctx));
  }

  private DataAccess getDataStream() throws IOException {
    DataAccess da = accessProvider.createReader(bundleFile, false);
    byte[] signature = new byte[6];
    if (da.length() > 6) {
      da.readBytes(signature, 0, 6);
      if (signature[0] == 'H' && signature[1] == 'G' && signature[2] == '1' && signature[3] == '0') {
        if (signature[4] == 'G' && signature[5] == 'Z') {
          return new InflaterDataAccess(da, 6, da.length() - 6);
        }
        if (signature[4] == 'B' && signature[5] == 'Z') {
          throw Internals.notImplemented();
        }
        if (signature[4] != 'U' || signature[5] != 'N') {
          throw new HgInvalidStateException(String.format("Bad bundle signature: %s",  String.valueOf(signature)));
        }
        // "...UN", fall-through
      } else {
        da.reset();
      }
    }
    return da;
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

  public void inspectChangelog(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      internalInspectChangelog(da, inspector);
    } catch (IOException ex) {
      throw new HgIOException("Failed to inspect changelog in the bundle", ex, bundleFile);
    } finally {
      if (da != null) {
        da.done();
      }
      lifecycleTearDown(lifecycle);
    }
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

  public void inspectManifest(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      if (da.isEmpty()) {
        return;
      }
      skipGroup(da); // changelog
      internalInspectManifest(da, inspector);
    } catch (IOException ex) {
      throw new HgIOException("Failed to inspect manifest in the bundle", ex, bundleFile);
    } finally {
      if (da != null) {
        da.done();
      }
      lifecycleTearDown(lifecycle);
    }
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

  public void inspectFiles(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      if (da.isEmpty()) {
        return;
      }
      skipGroup(da); // changelog
      if (da.isEmpty()) {
        return;
      }
      skipGroup(da); // manifest
      internalInspectFiles(da, inspector);
    } catch (IOException ex) {
      throw new HgIOException("Failed to inspect files in the bundle", ex, bundleFile);
    } finally {
      if (da != null) {
        da.done();
      }
      lifecycleTearDown(lifecycle);
    }
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

  public void inspectAll(Inspector inspector) throws HgIOException, HgRuntimeException {
    if (inspector == null) {
      throw new IllegalArgumentException();
    }
    final Lifecycle lifecycle = lifecycleSetUp(inspector);
    DataAccess da = null;
    try {
      da = getDataStream();
      internalInspectChangelog(da, inspector);
      if (flowControl.isStopped()) {
        return;
      }
      internalInspectManifest(da, inspector);
      if (flowControl.isStopped()) {
        return;
      }
      internalInspectFiles(da, inspector);
    } catch (IOException ex) {
      throw new HgIOException("Failed to inspect bundle", ex, bundleFile);
    } finally {
      if (da != null) {
        da.done();
      }
      lifecycleTearDown(lifecycle);
    }
  }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

      byte[] nb = new byte[80];
      da.readBytes(nb, 0, 80);
      int dataLength = len - 84 /* length field + 4 nodeids */;
      byte[] data = new byte[dataLength];
      da.readBytes(data, 0, dataLength);
      DataAccess slice = new ByteArrayDataAccess(data); // XXX in fact, may pass a slicing DataAccess.
      // Just need to make sure that we seek to proper location afterwards (where next GroupElement starts),
      // regardless whether that slice has read it or not.
      GroupElement ge = new GroupElement(nb, prevNodeid, slice);
      good2go = inspector.element(ge);
      slice.done(); // BADA doesn't implement done(), but it could (e.g. free array)
      /// and we'd better tell it we are not going to use it any more. However, it's important to ensure Inspector
      // implementations out there do not retain GroupElement.rawData()
      prevNodeid = ge.node();
      len = da.isEmpty() ? 0 : da.readInt();
    }
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

        boolean writeComplete = false;
        Nodeid deltaBase = ge.patchBase();
        if (deltaBase.isNull()) {
          // NOTE, can't use both parents isNull == true to empty prevRevContent
          // see build.gradle sample below why.
          prevRevContent = new DataAccess(); // empty data
          writeComplete = true;
          // if (writeComplete) would set baseRevision correctly,
        } else {
          Nodeid prevRevision = revisionSequence.size() > 0 ? revisionSequence.get(revisionSequence.size()-1) : Nodeid.NULL;
          if (!prevRevision.equals(deltaBase)) {
View Full Code Here

Examples of org.tmatesoft.hg.internal.DataAccess

    return new ByteArrayDataAccess(bos.toByteArray());
  }
 
  @Test
  public void testSeek() throws Exception {
    DataAccess zip = zip(testContent1);
    InflaterDataAccess ida = new InflaterDataAccess(zip, 0, zip.length(), -1, new Inflater(), new byte[25], null);
    ida.seek(20);
    final int bufferCapacity = 10;
    ByteBuffer chunk1 = ByteBuffer.allocate(bufferCapacity);
    ida.readBytes(chunk1);
    errorCollector.assertTrue(new ByteArraySlice(testContent1, 20, bufferCapacity).equalsTo(chunk1.array()));
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.