From 913fa3c9c0d128130b41ad452b44448b579b1668 Mon Sep 17 00:00:00 2001 From: lucio Date: Wed, 16 Sep 2020 11:03:06 +0200 Subject: [PATCH] commit for release --- .classpath | 1 - .settings/org.eclipse.jdt.core.prefs | 2 ++ CHANGELOG.md | 11 ++++++ FUNDING.md | 26 ++++++++++++++ changelog.xml | 8 ----- descriptor.xml | 31 ----------------- pom.xml | 2 +- profile.xml | 26 -------------- .../storagehub/client/dsl/ItemContainer.java | 6 ++++ .../client/proxies/DefaultItemManager.java | 34 +++++++++++++++++++ .../client/proxies/ItemManagerClient.java | 2 ++ .../java/org/gcube/data/access/fs/Items.java | 23 ++++++------- 12 files changed, 93 insertions(+), 79 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 FUNDING.md delete mode 100644 changelog.xml delete mode 100644 descriptor.xml delete mode 100644 profile.xml diff --git a/.classpath b/.classpath index d31a016..d157da0 100644 --- a/.classpath +++ b/.classpath @@ -22,7 +22,6 @@ - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 8445b6b..db24ee7 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -7,7 +7,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a9e5ba4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [v1.2.1] - [2020-07-17] + +### Feature + +method for description update added diff --git a/FUNDING.md b/FUNDING.md new file mode 100644 index 0000000..6fa9eac --- /dev/null +++ b/FUNDING.md @@ -0,0 +1,26 @@ +# Acknowledgments + +The projects leading to this software have received funding from a series of European Union programmes including: + +- the Sixth Framework Programme for Research and Technological Development + - [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260). +- the Seventh Framework Programme for research, technological development and demonstration + - [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488); + - [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019); + - [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465); + - [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644); + - [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754). +- the H2020 research and innovation programme + - [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024); + - [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119); + - [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142); + - [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182); + - [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680); + - [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610); + - [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001); + - [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194); + - [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914); + - [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091); + - [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650); + - [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409); + - [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042); \ No newline at end of file diff --git a/changelog.xml b/changelog.xml deleted file mode 100644 index 5ec5533..0000000 --- a/changelog.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - restore method with destination folder added - - - First Release - - \ No newline at end of file diff --git a/descriptor.xml b/descriptor.xml deleted file mode 100644 index de14c48..0000000 --- a/descriptor.xml +++ /dev/null @@ -1,31 +0,0 @@ - - servicearchive - - tar.gz - - / - - - . - / - true - - README - LICENSE - changelog.xml - profile.xml - - 755 - true - - - - - target/${build.finalName}.jar - /${artifactId} - - - diff --git a/pom.xml b/pom.xml index 1db8bab..15e16c1 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.gcube.common storagehub-client-library - 1.2.0 + 1.2.1 storagehub-client-library diff --git a/profile.xml b/profile.xml deleted file mode 100644 index 91c49e4..0000000 --- a/profile.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Service - - ${description} - Common - ${artifactId} - 1.0.0 - - - ${artifactId} - ${version} - - ${groupId} - ${artifactId} - ${version} - - - ${build.finalName}.jar - - - - - - diff --git a/src/main/java/org/gcube/common/storagehub/client/dsl/ItemContainer.java b/src/main/java/org/gcube/common/storagehub/client/dsl/ItemContainer.java index 71891ff..1bc1300 100644 --- a/src/main/java/org/gcube/common/storagehub/client/dsl/ItemContainer.java +++ b/src/main/java/org/gcube/common/storagehub/client/dsl/ItemContainer.java @@ -97,6 +97,12 @@ public abstract class ItemContainer { invalidateItem(); } + public void setDescription(String description) throws StorageHubException { + itemclient.setDescription(this.getId(), description); + invalidateItem(); + } + + public void setVisible() throws StorageHubException { itemclient.setHidden(this.getId(), false); invalidateItem(); diff --git a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java index 213e59e..01a65f6 100644 --- a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java +++ b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java @@ -1310,6 +1310,40 @@ public class DefaultItemManager implements ItemManagerClient { } } + + @Override + public String setDescription(String id, String description) throws StorageHubException { + Call call = new Call() { + @Override + public String call(GXWebTargetAdapterRequest manager) throws Exception { + Objects.requireNonNull(id, "id cannot be null"); + Objects.requireNonNull(description, "description cannot be null"); + + + GXWebTargetAdapterRequest myManager = manager.path(id) + .path("description"); + + GXInboundResponse response = myManager.put(Entity.json(description)); + + if (response.isErrorResponse()) { + if (response.hasException()) + throw response.getException(); + else + throw new BackendGenericError("HTTP error code is "+response.getHTTPCode()); + } + + return response.getSource().readEntity(String.class); + } + }; + try { + return delegate.make(call); + }catch(StorageHubException e) { + throw e; + }catch(Exception e1) { + throw new RuntimeException(e1); + } + } + @Override public String setMetadata(String id, Metadata metadata) throws StorageHubException { diff --git a/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java b/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java index b1234ad..8b75ea7 100644 --- a/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java +++ b/src/main/java/org/gcube/common/storagehub/client/proxies/ItemManagerClient.java @@ -85,6 +85,8 @@ public interface ItemManagerClient { String setMetadata(String id,Metadata metadata) throws StorageHubException; String setHidden(String id,Boolean value) throws StorageHubException; + + String setDescription(String id,String description) throws StorageHubException; String createGcubeItem(String parentId, GCubeItem item) throws StorageHubException; diff --git a/src/test/java/org/gcube/data/access/fs/Items.java b/src/test/java/org/gcube/data/access/fs/Items.java index 6e775a9..8d0b76e 100644 --- a/src/test/java/org/gcube/data/access/fs/Items.java +++ b/src/test/java/org/gcube/data/access/fs/Items.java @@ -10,6 +10,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; +import java.util.Set; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; @@ -33,8 +34,8 @@ public class Items { @BeforeClass public static void setUp(){ - SecurityTokenProvider.instance.set("cf9eb57b-62c0-485d-ae56-d8a32b882808-843339462"); - ScopeProvider.instance.set("/d4science.research-infrastructures.eu"); + SecurityTokenProvider.instance.set("b7c80297-e4ed-42ab-ab42-fdc0b8b0eabf-98187548"); + ScopeProvider.instance.set("/gcube"); } @@ -51,15 +52,11 @@ public class Items { public void forceDelete() throws Exception{ StorageHubClient shc = new StorageHubClient(); + //shc.open("41b904cd-128a-4121-8fd7-82498187ca06").asFolder().getAnchestors().getItems().forEach(i -> System.out.println(i.getTitle())); + shc.open("7ac99eea-d768-4864-a248-6d4ccf43d931").asFile().setDescription("new descr"); - - long count = shc.getTotalItemCount(); - - long volume = shc.getTotalVolume(); - - System.out.println("items are "+count+" volume "+volume); - + } @Test @@ -117,8 +114,8 @@ public class Items { StorageHubClient shc = new StorageHubClient(); FileContainer file = null; - try(InputStream is = new FileInputStream(new File("/home/lucio/Downloads/.richiesta speroni.pdf"))){ - file = shc.getWSRoot().uploadFile(is, ".richiesta speroni.pdf", "test"); + try(InputStream is = new FileInputStream(new File("/home/lucio/Downloads/_upwelling_index.py"))){ + file = shc.getWSRoot().uploadFile(is, "._upwelling_index.py", "test"); } @@ -343,7 +340,9 @@ public class Items { } } - + + + /* static String baseUrl="http://workspace-repository1-d.d4science.org/storagehub";