From 65b21c680b3d3e045cea62060200563e115f7521 Mon Sep 17 00:00:00 2001 From: "fabio.sinibaldi" Date: Wed, 20 Mar 2019 16:53:00 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-publishing/gCat-Feeder-Suite@178635 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../catalogues/CataloguePlugin.java | 4 + .../catalogues/ckan/CkanPlugin.class | Bin 1553 -> 2004 bytes .../collectors/CollectorPlugin.java | 5 + .../model/ControllerConfiguration.java | 3 + .../catalogues/gCat/GCatController.java | 8 + .../catalogues/gCat/Interactions.java | 10 +- .../src/test/resources/empties.json | 7 + gCat-Controller/src/test/resources/full.json | 151 ++++++++++++++++++ .../src/test/resources/missingProfile.json | 123 ++++++++++++++ .../src/test/resources/noItem.json | 20 +++ .../catalogues/gCat/GCatController.class | Bin 12996 -> 13145 bytes .../catalogues/gCat/GCatPlugin.class | Bin 1338 -> 1789 bytes .../target/test-classes/empties.json | 7 + gCat-Controller/target/test-classes/full.json | 151 ++++++++++++++++++ .../target/test-classes/missingProfile.json | 123 ++++++++++++++ .../target/test-classes/noItem.json | 20 +++ .../catalogues/gCat/Interactions.class | Bin 3777 -> 3909 bytes .../gCatFeeder/service/ServiceConstants.java | 7 + .../engine/CatalogueControllersManager.java | 2 + .../service/engine/CollectorsManager.java | 3 + .../impl/CatalogueControllersManagerImpl.java | 80 ++++++++++ .../engine/impl/CollectorsManagerImpl.java | 83 ++++++++++ .../service/engine/impl/ExecutionTask.java | 7 +- .../service/model/CapabilitiesBean.java | 5 + .../gCatFeeder/service/rest/Capabilities.java | 74 +++++++++ .../gCatFeeder/service/rest/Executions.java | 3 + 26 files changed, 893 insertions(+), 3 deletions(-) create mode 100644 gCat-Controller/src/test/resources/empties.json create mode 100644 gCat-Controller/target/test-classes/empties.json create mode 100644 gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CatalogueControllersManagerImpl.java create mode 100644 gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CollectorsManagerImpl.java create mode 100644 gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/model/CapabilitiesBean.java create mode 100644 gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Capabilities.java diff --git a/catalogue-plugin-framework/src/main/java/org/gcube/data/publishing/gCatFeeder/catalogues/CataloguePlugin.java b/catalogue-plugin-framework/src/main/java/org/gcube/data/publishing/gCatFeeder/catalogues/CataloguePlugin.java index 3e111cc..c0cff67 100644 --- a/catalogue-plugin-framework/src/main/java/org/gcube/data/publishing/gCatFeeder/catalogues/CataloguePlugin.java +++ b/catalogue-plugin-framework/src/main/java/org/gcube/data/publishing/gCatFeeder/catalogues/CataloguePlugin.java @@ -10,4 +10,8 @@ public interface CataloguePlugin { public CatalogueController instantiateController(CatalogueInstanceDescriptor desc) throws ControllerInstantiationFault; + + public void init() throws Exception; + + public void initInScope() throws Exception; } diff --git a/ckan-controller-plugin/target/classes/org/gcube/data/publishing/gCatFeeder/catalogues/ckan/CkanPlugin.class b/ckan-controller-plugin/target/classes/org/gcube/data/publishing/gCatFeeder/catalogues/ckan/CkanPlugin.class index c3e6317eaeb9521c2b9f8283d8978005815e3a70..df3ef6fa282ff56ff107744deaf7864b79214555 100644 GIT binary patch delta 542 zcmbV}y-or_6ot>g!Y&I5Mhi7sOh`cR2Sl;4Q9~@W(x8Rq025f8o}+k@OjI%JG@S7uH#uY z8wsfAyH%SzyVQ)GH93{n9;f9iCQj^j!xGeKwc311hTtw6oRUmnYN?>B z9h0r#O)HXU@Tm=Y1ZfxuVM#qh13?Bcm8B3?Ibc2`dojEEi1k-h5hPTM{!EM+f{kC5 b`KihSEMjwfGZ;h`NHG{jmi2Ar9YX0F2%3@= delta 108 zcmcb@Kaoe^)W2Q(7#J8#7_`_Km>3!CCr@Nnoj8Geqr*F9rhbjdfsAUCxmc7YA7}Mq zRG%!wX2{4g*@f+@iX($0gDL|PgEUYt3j-sA3Sr3MsX0@7?++S?e^CU0byVb=h1 HnHV$ymG%_L diff --git a/collectors-plugin-framework/src/main/java/org/gcube/data/publishing/gCatfeeder/collectors/CollectorPlugin.java b/collectors-plugin-framework/src/main/java/org/gcube/data/publishing/gCatfeeder/collectors/CollectorPlugin.java index 09d17c7..557918c 100644 --- a/collectors-plugin-framework/src/main/java/org/gcube/data/publishing/gCatfeeder/collectors/CollectorPlugin.java +++ b/collectors-plugin-framework/src/main/java/org/gcube/data/publishing/gCatfeeder/collectors/CollectorPlugin.java @@ -21,4 +21,9 @@ public interface CollectorPlugin{ public DataCollector getCollector(); public ControllerConfiguration getPublisherControllerConfiguration(String catalogueType)throws CatalogueNotSupportedException;; + + + public void init() throws Exception; + + public void initInScope() throws Exception; } diff --git a/commons/src/main/java/org/gcube/data/publishing/gCatFeeder/model/ControllerConfiguration.java b/commons/src/main/java/org/gcube/data/publishing/gCatFeeder/model/ControllerConfiguration.java index 0e3dca1..55f622b 100644 --- a/commons/src/main/java/org/gcube/data/publishing/gCatFeeder/model/ControllerConfiguration.java +++ b/commons/src/main/java/org/gcube/data/publishing/gCatFeeder/model/ControllerConfiguration.java @@ -13,4 +13,7 @@ public class ControllerConfiguration { return onClash; } + public void setOnClash(PublishingPolicy onClash) { + this.onClash = onClash; + } } diff --git a/gCat-Controller/src/main/java/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.java b/gCat-Controller/src/main/java/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.java index 42026e7..3c5bef8 100644 --- a/gCat-Controller/src/main/java/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.java +++ b/gCat-Controller/src/main/java/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.java @@ -84,6 +84,14 @@ public class GCatController implements CatalogueController{ if(isCustomToken()) resetToken(); + + + // setting default configuration + config=new ControllerConfiguration(); + config.setOnClash(PublishingPolicy.UPDATE); + + + }catch(ControllerInstantiationFault e) { throw e; } diff --git a/gCat-Controller/src/test/java/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.java b/gCat-Controller/src/test/java/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.java index b2a10e7..afbf25a 100644 --- a/gCat-Controller/src/test/java/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.java +++ b/gCat-Controller/src/test/java/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.java @@ -64,14 +64,20 @@ public class Interactions { @Test public void duplicates() { try { - publish(getController(),"full.json"); - publish(getController(),"full.json"); + publish(getController(),"full.json"); + publish(getController(),"full.json"); }catch(Exception e) { Assert.fail(e.getMessage()); } } + @Test(expected=WrongObjectFormatException.class) + public void empties() throws CatalogueInteractionException, WrongObjectFormatException, PublicationException, ControllerInstantiationFault { + publish(getController(),"empties.json"); + } + + @Test(expected=PublicationException.class) public void missingProfile() throws CatalogueInteractionException, WrongObjectFormatException, PublicationException, ControllerInstantiationFault { publish(getController(),"missingProfile.json"); diff --git a/gCat-Controller/src/test/resources/empties.json b/gCat-Controller/src/test/resources/empties.json new file mode 100644 index 0000000..6940488 --- /dev/null +++ b/gCat-Controller/src/test/resources/empties.json @@ -0,0 +1,7 @@ +{ + "profile" : null, + "item" : null, + "resources" : [ + null, + null] +} \ No newline at end of file diff --git a/gCat-Controller/src/test/resources/full.json b/gCat-Controller/src/test/resources/full.json index e69de29..8fb66dd 100644 --- a/gCat-Controller/src/test/resources/full.json +++ b/gCat-Controller/src/test/resources/full.json @@ -0,0 +1,151 @@ +{ + "profile": "\r\n \r\n Field 1<\/fieldName>\r\n false<\/mandatory>\r\n String<\/dataType>\r\n \r\n Write something here<\/note>\r\n \r\n onFieldName<\/tagging>\r\n <\/metadatafield>\r\n \r\n Field 2<\/fieldName>\r\n false<\/mandatory>\r\n Boolean<\/dataType>\r\n true<\/defaultValue>\r\n Set true or false to the checkbox<\/note>\r\n \r\n <\/metadatafield>\r\n \r\n Field 3<\/fieldName>\r\n true<\/mandatory>\r\n String<\/dataType>\r\n A<\/defaultValue>\r\n A listbox of values<\/note>\r\n \r\n A3<\/vocabularyField>\r\n B3<\/vocabularyField>\r\n C3<\/vocabularyField>\r\n D3<\/vocabularyField>\r\n E3<\/vocabularyField>\r\n F3<\/vocabularyField>\r\n <\/vocabulary>\r\n \r\n onValue<\/tagging>\r\n <\/metadatafield>\r\n \r\n Field 4<\/fieldName>\r\n true<\/mandatory>\r\n Number<\/dataType>\r\n 4<\/defaultValue>\r\n \r\n <\/metadatafield>\r\n<\/metadataformat>", + "item": { + "license_title": "Creative Commons Attribution Share-Alike 4.0", + "maintainer": null, + "searchable": "true", + "relationships_as_object": [], + "private": true, + "maintainer_email": null, + "num_tags": 2, + "metadata_created": "2019-03-19T15:03:28.482434", + "metadata_modified": "2019-03-19T15:03:30.676258", + "author": "luca_frosini", + "author_email": "luca.frosini@gcube.ckan.org", + "state": "active", + "version": null, + "creator_user_id": "287b2eec-4cd7-4e50-817f-e6dce19995c7", + "type": "dataset", + "tags": [ + { + "vocabulary_id": null, + "state": "active", + "display_name": "Other", + "id": "8ca635e2-4f72-48ed-8460-6734e9070a00", + "name": "Other" + }, + { + "vocabulary_id": null, + "state": "active", + "display_name": "REST", + "id": "3d481290-b3cd-466f-8142-51608c616e60", + "name": "REST" + } + ], + "groups": [], + "license_id": "CC-BY-SA-4.0", + "extras": [ + { + "key": "FSKX_model_parameters:Input Parameter", + "value": "standard desviation of Temperatures( sdTemp): 2.9 °c( Double)" + }, + { + "key": "FSKX_model_parameters:Output Parameter", + "value": "" + }, + { + "key": "FSKX_model_scope:Hazard", + "value": "" + }, + { + "key": "FSKX_model_scope:Population", + "value": "" + }, + { + "key": "FSKX_model_scope:Product", + "value": "" + }, + { + "key": "Item URL", + "value": "http://data.d4science.org/ctlg/AGINFRAplusDev/my_first_restful_transaction_model" + }, + { + "key": "Model Author", + "value": "" + }, + { + "key": "Model Creator", + "value": "" + }, + { + "key": "Model ID", + "value": "" + }, + { + "key": "Model Language", + "value": "Other" + }, + { + "key": "Population", + "value": "Italian" + }, + { + "key": "ReadMe", + "value": "" + }, + { + "key": "Reference Description", + "value": "" + }, + { + "key": "Related Identifier", + "value": "" + }, + { + "key": "system:type", + "value": "My Profile" + } + ] + }, + "resources": [ + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model"}, + {"cache_last_updated":null, + "cache_url":null, + "mimetype_inner":null, + "hash":"", + "description":"", + "format":"", + "url":"https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==","created":"2019-03-19T14:33:45.724709","state":"active","last_modified":null,"mimetype":"application/pdf","url_type":null,"position":0,"revision_id":"ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size":null, + "datastore_active":false, + "resource_type":null, + "name":"RESTful Transaction Model"}, + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model2" + },null] +} \ No newline at end of file diff --git a/gCat-Controller/src/test/resources/missingProfile.json b/gCat-Controller/src/test/resources/missingProfile.json index e69de29..0f3824d 100644 --- a/gCat-Controller/src/test/resources/missingProfile.json +++ b/gCat-Controller/src/test/resources/missingProfile.json @@ -0,0 +1,123 @@ +{ + "profile": null, + "item": { + "license_title": "Creative Commons Attribution Share-Alike 4.0", + "maintainer": null, + "searchable": "true", + "relationships_as_object": [], + "private": true, + "maintainer_email": null, + "num_tags": 2, + "metadata_created": "2019-03-19T15:03:28.482434", + "metadata_modified": "2019-03-19T15:03:30.676258", + "author": "luca_frosini", + "author_email": "luca.frosini@gcube.ckan.org", + "state": "active", + "version": null, + "creator_user_id": "287b2eec-4cd7-4e50-817f-e6dce19995c7", + "type": "dataset", + "tags": [ + { + "vocabulary_id": null, + "state": "active", + "display_name": "Other", + "id": "8ca635e2-4f72-48ed-8460-6734e9070a00", + "name": "Other" + }, + { + "vocabulary_id": null, + "state": "active", + "display_name": "REST", + "id": "3d481290-b3cd-466f-8142-51608c616e60", + "name": "REST" + } + ], + "groups": [], + "license_id": "CC-BY-SA-4.0", + "extras": [ + { + "key": "FSKX_model_parameters:Input Parameter", + "value": "standard desviation of Temperatures( sdTemp): 2.9 °c( Double)" + }, + { + "key": "FSKX_model_parameters:Output Parameter", + "value": "" + }, + { + "key": "FSKX_model_scope:Hazard", + "value": "" + }, + { + "key": "FSKX_model_scope:Population", + "value": "" + }, + { + "key": "FSKX_model_scope:Product", + "value": "" + }, + { + "key": "Item URL", + "value": "http://data.d4science.org/ctlg/AGINFRAplusDev/my_first_restful_transaction_model" + }, + { + "key": "Model Author", + "value": "" + }, + { + "key": "Model Creator", + "value": "" + }, + { + "key": "Model ID", + "value": "" + }, + { + "key": "Model Language", + "value": "Other" + }, + { + "key": "Population", + "value": "Italian" + }, + { + "key": "ReadMe", + "value": "" + }, + { + "key": "Reference Description", + "value": "" + }, + { + "key": "Related Identifier", + "value": "" + }, + { + "key": "system:type", + "value": "SomeFakeProfile" + } + ] + }, + "resources": [ + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model" + }, + null + ] +} \ No newline at end of file diff --git a/gCat-Controller/src/test/resources/noItem.json b/gCat-Controller/src/test/resources/noItem.json index e69de29..3057d78 100644 --- a/gCat-Controller/src/test/resources/noItem.json +++ b/gCat-Controller/src/test/resources/noItem.json @@ -0,0 +1,20 @@ +{ + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model" + } \ No newline at end of file diff --git a/gCat-Controller/target/classes/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.class b/gCat-Controller/target/classes/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatController.class index 132f1ebc97aeafaa3147674ed0541c6041461f01..1825a954972d9e36853c7234aea891698ae9b699 100644 GIT binary patch delta 6289 zcmZ`-33yXg7XD9?<|XN)OA2j6fd*Pi=|b7jI-o6!ENxi}6rI691Fe<@+f-ph%OP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@=`MDFQnG9|JpV1m zqbY9fpMpxkp-h`)FlG)~zMaqi;8DiPNk@>S#|sOH1d($&43t z)r2(h)hHB(H0>z{8HPdvPPHM8pHr!^n7&YX<{*vu=#LzFA;^OiiU-3<5G4$5h*xGA z1H43Wz!=5>#Bg8rHD1SyUn>}kyG4~s!xQtrL-dUP2tLzg>k8-Ezu@xFRX>GTx+l&>PWNpIYZn^Go8Jfba zAR~z3Vq{B6KaJX0yE!y4q+VQc#9O*}Wn!7ERF=@txVw_{o{xrx$KrSJA?Q>chE7#U zn(6G88)`dITGP;|QnmD3S^M06zw?$x?wCGLe}&N!wSfaXmlbeh21i5UFCmP+x5hmg$*t z7XuUrQOY3@Rr2;KBzpOy(cw6;@=#D%MXjo4AGQfIio50Rs!fj*+3PlH=gzg_|QMAi(QZc{8YD!u(NpvI1e6Y?a6OHtQ;F zt!SVVUW-&+WU61MxT-8#!?dAAF^uJfRLuLxFWY#-9J*(^s+hQsZ^ME_k@EyEI9jgD z8!U=jm_=qe(!y#YqlOmF#vqxaEhKWe+gN!@TbP5qBkeM4wPEr!e6?c>Ugg$#x#y+$w`nbjIdQ&hUZslr1w)aqt8fSA z^qu(-yK5=(T0A;ga4L4kuHgq!!}L(Jttug=41X_5K&fA)BNxU)CmH(gf2nw@{MiY{ zW`SQ=z`Q~*!xN{*cmmfG&k@FB8E@I;I7=FEtu$hzoQ`K?1$Ijl zFZJfbc#{lG_+WMMLrf=Y+|?;C4&Wp@IH3QfdDYK~iG*0s4Hc74+9aRU?S!kVc8mON z$98j8@h16#CBJKSCtS50?B&4IH~5AFcYILyh`@MwJXpEEn swtMuD(LWqywayU#pdS0dOE&Q!L;c9z9rBa>ldbx}a4>%}J1`~iZ-|yJpa1{> diff --git a/gCat-Controller/target/classes/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatPlugin.class b/gCat-Controller/target/classes/org/gcube/data/publishing/gCataFeeder/catalogues/gCat/GCatPlugin.class index 263040c3779aef13b8a0b8626ca3a42349eaad6e..34c79c9d53b34ee5565a704300f14c631530cbae 100644 GIT binary patch delta 502 zcmbV|y-EW?6h^;ER?89**Ag{VAb@JyfTW zPIv*U1oKy{$3n?eJKVpHcw&WC1yl%TM+U}d<71uR{#+TJYT4s08tFI@k_`cx7~PaS zZqT53*5TCNB%B`XF?%ArZJ}t~O)V91BKth%%2Mlggz9i3tUJV-sWmLJH0HLWThwt( z>UNj^(6tfeawP~*#sYyi?D_}^ZvWtPJWlGrPEIBZy(*c=F1@$A62UTj3xxCOa})ZS;E1Jh_2Yi;;QqYSt@U42%q_KqX8J FY5;-)3~vAc diff --git a/gCat-Controller/target/test-classes/empties.json b/gCat-Controller/target/test-classes/empties.json new file mode 100644 index 0000000..6940488 --- /dev/null +++ b/gCat-Controller/target/test-classes/empties.json @@ -0,0 +1,7 @@ +{ + "profile" : null, + "item" : null, + "resources" : [ + null, + null] +} \ No newline at end of file diff --git a/gCat-Controller/target/test-classes/full.json b/gCat-Controller/target/test-classes/full.json index e69de29..8fb66dd 100644 --- a/gCat-Controller/target/test-classes/full.json +++ b/gCat-Controller/target/test-classes/full.json @@ -0,0 +1,151 @@ +{ + "profile": "\r\n \r\n Field 1<\/fieldName>\r\n false<\/mandatory>\r\n String<\/dataType>\r\n \r\n Write something here<\/note>\r\n \r\n onFieldName<\/tagging>\r\n <\/metadatafield>\r\n \r\n Field 2<\/fieldName>\r\n false<\/mandatory>\r\n Boolean<\/dataType>\r\n true<\/defaultValue>\r\n Set true or false to the checkbox<\/note>\r\n \r\n <\/metadatafield>\r\n \r\n Field 3<\/fieldName>\r\n true<\/mandatory>\r\n String<\/dataType>\r\n A<\/defaultValue>\r\n A listbox of values<\/note>\r\n \r\n A3<\/vocabularyField>\r\n B3<\/vocabularyField>\r\n C3<\/vocabularyField>\r\n D3<\/vocabularyField>\r\n E3<\/vocabularyField>\r\n F3<\/vocabularyField>\r\n <\/vocabulary>\r\n \r\n onValue<\/tagging>\r\n <\/metadatafield>\r\n \r\n Field 4<\/fieldName>\r\n true<\/mandatory>\r\n Number<\/dataType>\r\n 4<\/defaultValue>\r\n \r\n <\/metadatafield>\r\n<\/metadataformat>", + "item": { + "license_title": "Creative Commons Attribution Share-Alike 4.0", + "maintainer": null, + "searchable": "true", + "relationships_as_object": [], + "private": true, + "maintainer_email": null, + "num_tags": 2, + "metadata_created": "2019-03-19T15:03:28.482434", + "metadata_modified": "2019-03-19T15:03:30.676258", + "author": "luca_frosini", + "author_email": "luca.frosini@gcube.ckan.org", + "state": "active", + "version": null, + "creator_user_id": "287b2eec-4cd7-4e50-817f-e6dce19995c7", + "type": "dataset", + "tags": [ + { + "vocabulary_id": null, + "state": "active", + "display_name": "Other", + "id": "8ca635e2-4f72-48ed-8460-6734e9070a00", + "name": "Other" + }, + { + "vocabulary_id": null, + "state": "active", + "display_name": "REST", + "id": "3d481290-b3cd-466f-8142-51608c616e60", + "name": "REST" + } + ], + "groups": [], + "license_id": "CC-BY-SA-4.0", + "extras": [ + { + "key": "FSKX_model_parameters:Input Parameter", + "value": "standard desviation of Temperatures( sdTemp): 2.9 °c( Double)" + }, + { + "key": "FSKX_model_parameters:Output Parameter", + "value": "" + }, + { + "key": "FSKX_model_scope:Hazard", + "value": "" + }, + { + "key": "FSKX_model_scope:Population", + "value": "" + }, + { + "key": "FSKX_model_scope:Product", + "value": "" + }, + { + "key": "Item URL", + "value": "http://data.d4science.org/ctlg/AGINFRAplusDev/my_first_restful_transaction_model" + }, + { + "key": "Model Author", + "value": "" + }, + { + "key": "Model Creator", + "value": "" + }, + { + "key": "Model ID", + "value": "" + }, + { + "key": "Model Language", + "value": "Other" + }, + { + "key": "Population", + "value": "Italian" + }, + { + "key": "ReadMe", + "value": "" + }, + { + "key": "Reference Description", + "value": "" + }, + { + "key": "Related Identifier", + "value": "" + }, + { + "key": "system:type", + "value": "My Profile" + } + ] + }, + "resources": [ + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model"}, + {"cache_last_updated":null, + "cache_url":null, + "mimetype_inner":null, + "hash":"", + "description":"", + "format":"", + "url":"https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==","created":"2019-03-19T14:33:45.724709","state":"active","last_modified":null,"mimetype":"application/pdf","url_type":null,"position":0,"revision_id":"ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size":null, + "datastore_active":false, + "resource_type":null, + "name":"RESTful Transaction Model"}, + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model2" + },null] +} \ No newline at end of file diff --git a/gCat-Controller/target/test-classes/missingProfile.json b/gCat-Controller/target/test-classes/missingProfile.json index e69de29..0f3824d 100644 --- a/gCat-Controller/target/test-classes/missingProfile.json +++ b/gCat-Controller/target/test-classes/missingProfile.json @@ -0,0 +1,123 @@ +{ + "profile": null, + "item": { + "license_title": "Creative Commons Attribution Share-Alike 4.0", + "maintainer": null, + "searchable": "true", + "relationships_as_object": [], + "private": true, + "maintainer_email": null, + "num_tags": 2, + "metadata_created": "2019-03-19T15:03:28.482434", + "metadata_modified": "2019-03-19T15:03:30.676258", + "author": "luca_frosini", + "author_email": "luca.frosini@gcube.ckan.org", + "state": "active", + "version": null, + "creator_user_id": "287b2eec-4cd7-4e50-817f-e6dce19995c7", + "type": "dataset", + "tags": [ + { + "vocabulary_id": null, + "state": "active", + "display_name": "Other", + "id": "8ca635e2-4f72-48ed-8460-6734e9070a00", + "name": "Other" + }, + { + "vocabulary_id": null, + "state": "active", + "display_name": "REST", + "id": "3d481290-b3cd-466f-8142-51608c616e60", + "name": "REST" + } + ], + "groups": [], + "license_id": "CC-BY-SA-4.0", + "extras": [ + { + "key": "FSKX_model_parameters:Input Parameter", + "value": "standard desviation of Temperatures( sdTemp): 2.9 °c( Double)" + }, + { + "key": "FSKX_model_parameters:Output Parameter", + "value": "" + }, + { + "key": "FSKX_model_scope:Hazard", + "value": "" + }, + { + "key": "FSKX_model_scope:Population", + "value": "" + }, + { + "key": "FSKX_model_scope:Product", + "value": "" + }, + { + "key": "Item URL", + "value": "http://data.d4science.org/ctlg/AGINFRAplusDev/my_first_restful_transaction_model" + }, + { + "key": "Model Author", + "value": "" + }, + { + "key": "Model Creator", + "value": "" + }, + { + "key": "Model ID", + "value": "" + }, + { + "key": "Model Language", + "value": "Other" + }, + { + "key": "Population", + "value": "Italian" + }, + { + "key": "ReadMe", + "value": "" + }, + { + "key": "Reference Description", + "value": "" + }, + { + "key": "Related Identifier", + "value": "" + }, + { + "key": "system:type", + "value": "SomeFakeProfile" + } + ] + }, + "resources": [ + { + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model" + }, + null + ] +} \ No newline at end of file diff --git a/gCat-Controller/target/test-classes/noItem.json b/gCat-Controller/target/test-classes/noItem.json index e69de29..3057d78 100644 --- a/gCat-Controller/target/test-classes/noItem.json +++ b/gCat-Controller/target/test-classes/noItem.json @@ -0,0 +1,20 @@ +{ + "cache_last_updated": null, + "cache_url": null, + "mimetype_inner": null, + "hash": "", + "description": "", + "format": "", + "url": "https://data.d4science.org/shub/E_MHpyWDlKS2hPRGhKNk9ackxMY25pMDhZWEs1Z2dCTWEyNkNzbTdyMjZveDlON1RTWW9xa1FvVnprT3liSmRncA==", + "created": "2019-03-19T14:33:45.724709", + "state": "active", + "last_modified": null, + "mimetype": "application/pdf", + "url_type": null, + "position": 0, + "revision_id": "ad5fbd19-fe67-4141-ad44-cf41d90b95fb", + "size": null, + "datastore_active": false, + "resource_type": null, + "name": "RESTful Transaction Model" + } \ No newline at end of file diff --git a/gCat-Controller/target/test-classes/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.class b/gCat-Controller/target/test-classes/org/gcube/data/publishing/gCatFeeder/catalogues/gCat/Interactions.class index 5027aec8e66af5157591e302645513de8951270b..912f015eeef6c137fdee163dc3e9bcb4be5f75f2 100644 GIT binary patch delta 323 zcmX|6KTE@K6ucK~6MyNi3jKo!T1CM@C>;a`!Ntj~6o;l7(^}J-+9cI!@Ik8cgsDmysWC%pXn2T9b7%AQQ9*7a4-z~WIRn5i5&hg z_t`a?l4Q`r)iR7l^iS zO3-oCzxhv0H2K|favshyNMXswIXWhM!ol5Qgd)iv#s;g z;5D63IZ$ZuNEhgYCwhZi{?fbJ6Ss*hS}35+rEIn4IolJo9?>>%FPjZ10BMk57q(zg cJYWFI%XAtcx)!QfuAzrh9VdkC`Q;yKR4tq#p4^!ckvW<1FD6TCQF=m9AiHAI_Q4TA zpaTbyd=TD#=&wEF=mp0NkLnwy761*Tw1=9~CB=XR^f6FA@6M5^Im1vTh6|+1xgw#e G4Ez^@4L)%I diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/ServiceConstants.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/ServiceConstants.java index 01985be..3942108 100644 --- a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/ServiceConstants.java +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/ServiceConstants.java @@ -12,4 +12,11 @@ public class ServiceConstants { public static final String EXECUTION_ID_PARAMETER="executionId"; } + public static interface Capabilities{ + public static final String PATH="capabilities"; + + public static final String COLLECTORS_PATH="collectors"; + + public static final String CATALOGUES_PATH="catalogues"; + } } diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CatalogueControllersManager.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CatalogueControllersManager.java index fe6f68a..bb89ad8 100644 --- a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CatalogueControllersManager.java +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CatalogueControllersManager.java @@ -14,4 +14,6 @@ public interface CatalogueControllersManager { public void init() throws InternalError; + + public void initInScope() throws InternalError; } diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CollectorsManager.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CollectorsManager.java index 1e7c6a9..bd52811 100644 --- a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CollectorsManager.java +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/CollectorsManager.java @@ -12,4 +12,7 @@ public interface CollectorsManager { public CollectorPlugin getPluginById(String collectorId) throws CollectorNotFound; public void init() throws InternalError; + + + public void initInScope() throws InternalError; } diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CatalogueControllersManagerImpl.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CatalogueControllersManagerImpl.java new file mode 100644 index 0000000..5d54bf8 --- /dev/null +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CatalogueControllersManagerImpl.java @@ -0,0 +1,80 @@ +package org.gcube.data.publishing.gCatFeeder.service.engine.impl; + +import java.util.Map.Entry; +import java.util.ServiceLoader; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import javax.inject.Singleton; + +import org.gcube.data.publishing.gCatFeeder.catalogues.CataloguePlugin; +import org.gcube.data.publishing.gCatFeeder.service.engine.CatalogueControllersManager; +import org.gcube.data.publishing.gCatFeeder.service.model.fault.CataloguePluginNotFound; +import org.gcube.data.publishing.gCatFeeder.service.model.fault.InternalError; +import org.gcube.data.publishing.gCatFeeder.utils.ContextUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +public class CatalogueControllersManagerImpl implements CatalogueControllersManager { + + private static final Logger log= LoggerFactory.getLogger(CatalogueControllersManagerImpl.class); + + + private ServiceLoader cataloguePluginsLoader = null; + + private ConcurrentHashMap availablePlugins=null; + + + public CatalogueControllersManagerImpl() { + //load plugins + log.debug("Loading catalogue plugins..."); + cataloguePluginsLoader=ServiceLoader.load(CataloguePlugin.class); + for(CataloguePlugin plugin:cataloguePluginsLoader) { + log.debug("Loading {} ",plugin.getClass()); + log.debug("Descriptor {} ",plugin.getDescriptor()); + availablePlugins.put(plugin.getDescriptor().getId(), plugin); + } + log.trace("Loaded {} catalogue plugins ",availablePlugins.size()); + } + + + + @Override + public Set getAvailableControllers() { + return availablePlugins.keySet(); + } + + @Override + public CataloguePlugin getPluginById(String pluginId) throws CataloguePluginNotFound { + if(availablePlugins.containsKey(pluginId)) return availablePlugins.get(pluginId); + else throw new CataloguePluginNotFound("Catalogue plugin "+pluginId+" not available."); + } + + @Override + public void init() throws InternalError { + log.trace("Static initialization..."); + for(Entry entry:availablePlugins.entrySet()) { + log.debug("Static initialization for : {} ",entry.getKey()); + try { + entry.getValue().init(); + }catch(Throwable t) { + log.error("Unexpected exception while initializing {} ",entry.getKey(),t); + } + } + } + + @Override + public void initInScope() throws InternalError { + log.trace("Initialization under scope {} ",ContextUtils.getCurrentScope()); + for(Entry entry:availablePlugins.entrySet()) { + log.debug("Scope initialization for : {} ",entry.getKey()); + try { + entry.getValue().initInScope(); + }catch(Throwable t) { + log.error("Unexpected exception while initializing {} ",entry.getKey(),t); + } + } + } + +} diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CollectorsManagerImpl.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CollectorsManagerImpl.java new file mode 100644 index 0000000..debdbdf --- /dev/null +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/CollectorsManagerImpl.java @@ -0,0 +1,83 @@ +package org.gcube.data.publishing.gCatFeeder.service.engine.impl; + +import java.util.ServiceLoader; +import java.util.Set; +import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; + +import javax.inject.Singleton; + +import org.gcube.data.publishing.gCatFeeder.catalogues.CataloguePlugin; +import org.gcube.data.publishing.gCatFeeder.service.engine.CollectorsManager; +import org.gcube.data.publishing.gCatFeeder.service.model.fault.CataloguePluginNotFound; +import org.gcube.data.publishing.gCatFeeder.service.model.fault.CollectorNotFound; +import org.gcube.data.publishing.gCatFeeder.service.model.fault.InternalError; +import org.gcube.data.publishing.gCatFeeder.utils.ContextUtils; +import org.gcube.data.publishing.gCatfeeder.collectors.CollectorPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Singleton +public class CollectorsManagerImpl implements CollectorsManager { + + + private static final Logger log= LoggerFactory.getLogger(CollectorsManagerImpl.class); + + + private ServiceLoader collectorPluginsLoader = null; + + private ConcurrentHashMap availablePlugins=null; + + + public CollectorsManagerImpl() { + //load plugins + log.debug("Loading collector plugins..."); + collectorPluginsLoader=ServiceLoader.load(CollectorPlugin.class); + for(CollectorPlugin plugin:collectorPluginsLoader) { + log.debug("Loading {} ",plugin.getClass()); + log.debug("Descriptor {} ",plugin.getDescriptor()); + availablePlugins.put(plugin.getDescriptor().getName(), plugin); + } + log.trace("Loaded {} collector plugins ",availablePlugins.size()); + } + + + @Override + public Set getAvailableCollectors() { + return availablePlugins.keySet(); + } + + @Override + public CollectorPlugin getPluginById(String collectorId) throws CollectorNotFound { + if(availablePlugins.containsKey(collectorId)) return availablePlugins.get(collectorId); + else throw new CollectorNotFound("Collector plugin "+collectorId+" not available."); + } + + @Override + public void init() throws InternalError { + log.trace("Static initialization..."); + for(Entry entry:availablePlugins.entrySet()) { + log.debug("Static initialization for : {} ",entry.getKey()); + try { + entry.getValue().init(); + }catch(Throwable t) { + log.error("Unexpected exception while initializing {} ",entry.getKey(),t); + } + } + } + + + @Override + public void initInScope() throws InternalError { + log.trace("Initialization under scope {} ",ContextUtils.getCurrentScope()); + for(Entry entry:availablePlugins.entrySet()) { + log.debug("Scope initialization for : {} ",entry.getKey()); + try { + entry.getValue().initInScope(); + }catch(Throwable t) { + log.error("Unexpected exception while initializing {} ",entry.getKey(),t); + } + } + } + +} diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/ExecutionTask.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/ExecutionTask.java index 9abdc21..f08073b 100644 --- a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/ExecutionTask.java +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/engine/impl/ExecutionTask.java @@ -1,6 +1,5 @@ package org.gcube.data.publishing.gCatFeeder.service.engine.impl; -import java.io.File; import java.io.Serializable; import java.time.Instant; import java.util.Set; @@ -11,7 +10,9 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.data.publishing.gCatFeeder.catalogues.CatalogueController; import org.gcube.data.publishing.gCatFeeder.catalogues.CataloguePlugin; import org.gcube.data.publishing.gCatFeeder.catalogues.model.PublishReport; +import org.gcube.data.publishing.gCatFeeder.catalogues.model.faults.CatalogueInteractionException; import org.gcube.data.publishing.gCatFeeder.catalogues.model.faults.ControllerInstantiationFault; +import org.gcube.data.publishing.gCatFeeder.catalogues.model.faults.PublicationException; import org.gcube.data.publishing.gCatFeeder.catalogues.model.faults.WrongObjectFormatException; import org.gcube.data.publishing.gCatFeeder.model.CatalogueFormatData; import org.gcube.data.publishing.gCatFeeder.model.CatalogueInstanceDescriptor; @@ -184,6 +185,10 @@ public class ExecutionTask implements Runnable { PublishReport itemReport=controller.publishItem(item); }catch(WrongObjectFormatException e) { catalogueReport.getPublishedRecords().add(new PublishReport(false,"Wrong format : "+e.getMessage())); + } catch (CatalogueInteractionException e) { + catalogueReport.getPublishedRecords().add(new PublishReport(false,"Error while communicating with catalogue : "+e.getMessage())); + } catch (PublicationException e) { + catalogueReport.getPublishedRecords().add(new PublishReport(false,"Publication error : "+e.getMessage())); } } diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/model/CapabilitiesBean.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/model/CapabilitiesBean.java new file mode 100644 index 0000000..e4e3061 --- /dev/null +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/model/CapabilitiesBean.java @@ -0,0 +1,5 @@ +package org.gcube.data.publishing.gCatFeeder.service.model; + +public class CapabilitiesBean { + +} diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Capabilities.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Capabilities.java new file mode 100644 index 0000000..8f92931 --- /dev/null +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Capabilities.java @@ -0,0 +1,74 @@ +package org.gcube.data.publishing.gCatFeeder.service.rest; + +import java.util.ArrayList; +import java.util.Collection; + +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.gcube.data.publishing.gCatFeeder.catalogues.model.CataloguePluginDescriptor; +import org.gcube.data.publishing.gCatFeeder.service.GCatFeederManager; +import org.gcube.data.publishing.gCatFeeder.service.ServiceConstants; +import org.gcube.data.publishing.gCatFeeder.service.engine.CatalogueControllersManager; +import org.gcube.data.publishing.gCatFeeder.service.engine.CollectorsManager; +import org.gcube.data.publishing.gCatfeeder.collectors.model.PluginDescriptor; +import org.gcube.smartgears.annotations.ManagedBy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@ManagedBy(GCatFeederManager.class) +@Path(ServiceConstants.Executions.PATH) +public class Capabilities { + + private static final Logger log= LoggerFactory.getLogger(Capabilities.class); + + + @Inject + private CatalogueControllersManager catalogues; + + @Inject + private CollectorsManager collectors; + + + @GET + @Produces(MediaType.APPLICATION_JSON) + @Path(ServiceConstants.Capabilities.COLLECTORS_PATH) + public Response getCollectorCapabilities() { + try { + ArrayList toReturn=new ArrayList<>(); + for(String s:collectors.getAvailableCollectors()) { + toReturn.add(collectors.getPluginById(s).getDescriptor()); + } + GenericEntity> entity=new GenericEntity>(toReturn) {}; + return Response.ok(entity).build(); + }catch(Throwable t) { + log.warn("Unexpected Exception ",t); + throw new WebApplicationException("Unexpected Exception.", t,Response.Status.INTERNAL_SERVER_ERROR); + } + } + + + + @GET + @Produces(MediaType.APPLICATION_JSON) + @Path(ServiceConstants.Capabilities.CATALOGUES_PATH) + public Response getCataloguesCapabilities() { + try { + ArrayList toReturn=new ArrayList<>(); + for(String s:catalogues.getAvailableControllers()) { + toReturn.add(catalogues.getPluginById(s).getDescriptor()); + } + GenericEntity> entity=new GenericEntity>(toReturn) {}; + return Response.ok(entity).build(); + }catch(Throwable t) { + log.warn("Unexpected Exception ",t); + throw new WebApplicationException("Unexpected Exception.", t,Response.Status.INTERNAL_SERVER_ERROR); + } + } +} diff --git a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Executions.java b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Executions.java index 6a042f5..691f207 100644 --- a/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Executions.java +++ b/gCat-Feeder/src/main/java/org/gcube/data/publishing/gCatFeeder/service/rest/Executions.java @@ -13,6 +13,7 @@ import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.gcube.data.publishing.gCatFeeder.service.GCatFeederManager; import org.gcube.data.publishing.gCatFeeder.service.ServiceConstants; import org.gcube.data.publishing.gCatFeeder.service.engine.FeederEngine; import org.gcube.data.publishing.gCatFeeder.service.model.ExecutionDescriptor; @@ -21,9 +22,11 @@ import org.gcube.data.publishing.gCatFeeder.service.model.ExecutionRequest; import org.gcube.data.publishing.gCatFeeder.service.model.fault.ElementNotFound; import org.gcube.data.publishing.gCatFeeder.service.model.fault.InvalidRequest; import org.gcube.data.publishing.gCatFeeder.service.model.fault.PersistenceError; +import org.gcube.smartgears.annotations.ManagedBy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@ManagedBy(GCatFeederManager.class) @Path(ServiceConstants.Executions.PATH) public class Executions {