@Test public void testRequiredPathParameterWrite() { try { Properties parameters = new Properties(); FileStorageConnector connector = new FileStorageConnector(parameters); connector.write(null, null, parameters); fail("Should not allow null path parameter"); } catch (Exception ex) { } }
@Override public void write(Exportable artifact, UnitOfWork transaction, Properties parameters) throws Exception { ArgCheck.isNotNull(parameters); String filePath = getFilePath(parameters); ArgCheck.isNotEmpty(filePath); ArgCheck.isNotNull(artifact, "artifact"); ArgCheck.isNotNull(transaction, "transaction"); File destFile = new File(getPath(), filePath); byte[] contents = artifact.export(transaction, parameters); FileUtils.write(contents, destFile); setDownloadable(destFile.getAbsolutePath()); }
FileStorageConnector implements StorageConnector { @Override public void write(Exportable artifact, UnitOfWork transaction, Properties parameters) throws Exception { ArgCheck.isNotNull(parameters); String filePath = getFilePath(parameters); ArgCheck.isNotEmpty(filePath); ArgCheck.isNotNull(artifact, "artifact"); ArgCheck.isNotNull(transaction, "transaction"); File destFile = new File(getPath(), filePath); byte[] contents = artifact.export(transaction, parameters); FileUtils.write(contents, destFile); setDownloadable(destFile.getAbsolutePath()); } }
FileStorageConnector implements StorageConnector { @Override public void write(Exportable artifact, UnitOfWork transaction, Properties parameters) throws Exception { ArgCheck.isNotNull(parameters); String filePath = getFilePath(parameters); ArgCheck.isNotEmpty(filePath); ArgCheck.isNotNull(artifact, "artifact"); ArgCheck.isNotNull(transaction, "transaction"); File destFile = new File(getPath(), filePath); byte[] contents = artifact.export(transaction, parameters); FileUtils.write(contents, destFile); setDownloadable(destFile.getAbsolutePath()); } FileStorageConnector(Properties parameters); }
FileStorageConnector implements StorageConnector { @Override public void write(Exportable artifact, UnitOfWork transaction, Properties parameters) throws Exception { ArgCheck.isNotNull(parameters); String filePath = getFilePath(parameters); ArgCheck.isNotEmpty(filePath); ArgCheck.isNotNull(artifact, "artifact"); ArgCheck.isNotNull(transaction, "transaction"); File destFile = new File(getPath(), filePath); byte[] contents = artifact.export(transaction, parameters); FileUtils.write(contents, destFile); setDownloadable(destFile.getAbsolutePath()); } FileStorageConnector(Properties parameters); @Override StorageConnectorId getId(); @Override Set<Descriptor> getDescriptors(); String getPath(); String getFilePath(Properties parameters); @Override InputStream read(Properties parameters); @Override void write(Exportable artifact, UnitOfWork transaction, Properties parameters); @Override boolean refresh(); @Override StorageTree<String> browse(); @Override void dispose(); }
FileStorageConnector implements StorageConnector { @Override public void write(Exportable artifact, UnitOfWork transaction, Properties parameters) throws Exception { ArgCheck.isNotNull(parameters); String filePath = getFilePath(parameters); ArgCheck.isNotEmpty(filePath); ArgCheck.isNotNull(artifact, "artifact"); ArgCheck.isNotNull(transaction, "transaction"); File destFile = new File(getPath(), filePath); byte[] contents = artifact.export(transaction, parameters); FileUtils.write(contents, destFile); setDownloadable(destFile.getAbsolutePath()); } FileStorageConnector(Properties parameters); @Override StorageConnectorId getId(); @Override Set<Descriptor> getDescriptors(); String getPath(); String getFilePath(Properties parameters); @Override InputStream read(Properties parameters); @Override void write(Exportable artifact, UnitOfWork transaction, Properties parameters); @Override boolean refresh(); @Override StorageTree<String> browse(); @Override void dispose();  }