NodeIdRepresentation { public void modifyResource(final String resourceName, final long nodeId, final InputStream newValue) throws JaxRxException { synchronized (resourceName) { Session session = null; Database database = null; NodeWriteTrx wtx = null; boolean abort = false; if (WorkerHelper.checkExistingResource(mStoragePath, resourceName)) { try { database = Databases.openDatabase(mStoragePath); session = database.getSession(new SessionConfiguration.Builder( resourceName).build()); wtx = session.beginNodeWriteTrx(); if (wtx.moveTo(nodeId).hasMoved()) { final long parentKey = wtx.getParentKey(); wtx.remove(); wtx.moveTo(parentKey); WorkerHelper.shredInputStream(wtx, newValue, Insert.ASFIRSTCHILD); } else { throw new JaxRxException(404, NOTFOUND); } } catch (final SirixException exc) { abort = true; throw new JaxRxException(exc); } finally { try { WorkerHelper.closeWTX(abort, wtx, session, database); } catch (final SirixException exce) { throw new JaxRxException(exce); } } } else { throw new JaxRxException(404, "Requested resource not found"); } } } NodeIdRepresentation(final File storagePath); StreamingOutput getResource(final String resourceName,
			final long nodeId, final Map<QueryParameter, String> queryParams); StreamingOutput getResourceByAT(final String resourceName,
			final long nodeId, final Map<QueryParameter, String> queryParams,
			final IDAccessType accessType); StreamingOutput performQueryOnResource(final String resourceName,
			final long nodeId, final String query,
			final Map<QueryParameter, String> queryParams); void deleteResource(final String resourceName, final long nodeId); void modifyResource(final String resourceName, final long nodeId,
			final InputStream newValue); void addSubResource(final String resourceName, final long nodeId,
			final InputStream input, final IDAccessType type);  }
@Test public final void testModifyResource() throws JaxRxException, SirixException { final InputStream inputStream = new ByteArrayInputStream( "<testNode/>".getBytes()); long lastRevision = sirix.getLastRevision(RESOURCENAME); ridWorker.modifyResource(RESOURCENAME, NODEIDTOMODIFY, inputStream); assertEquals("Test modify resource", sirix.getLastRevision(RESOURCENAME), ++lastRevision); }