Package io.keyko.nevermined.external
Class MetadataApiService
- java.lang.Object
-
- io.keyko.nevermined.external.MetadataApiService
-
public class MetadataApiService extends Object
Service for Metadata Integration
-
-
Field Summary
Fields Modifier and Type Field Description private static String
DDO_URI
private String
ddoEndpoint
private static org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Modifier Constructor Description private
MetadataApiService(String url)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DDO
createDDO(DDO ddo)
Registers a new DDO in Metadata ApiDDO
getDDO(String url)
Gets a DDO from an URLString
getDdoEndpoint()
DDO
getDDOUsingId(String id)
Gets a DDO from the DIDstatic MetadataApiService
getInstance(String url)
Builds an instance of MetadataApiServiceboolean
retireAssetDDO(String id)
Retire the asset ddo from Metadata Api.SearchResult
searchDDO(SearchQuery searchQuery)
Search all the DDOs that match the query passed as a parameterSearchResult
searchDDO(String param, int offset, int page)
Search all the DDOs that match the text passed as a parameterboolean
updateDDO(String id, DDO ddo)
Updates the metadata of a DDOboolean
validateMetadata(AssetMetadata metadata)
Check that the metadata has a valid formUrl.
-
-
-
Field Detail
-
log
private static final org.apache.logging.log4j.Logger log
-
DDO_URI
private static final String DDO_URI
- See Also:
- Constant Field Values
-
ddoEndpoint
private String ddoEndpoint
-
-
Constructor Detail
-
MetadataApiService
private MetadataApiService(String url)
Constructor- Parameters:
url
- the url of Metadata Api
-
-
Method Detail
-
getInstance
public static MetadataApiService getInstance(String url)
Builds an instance of MetadataApiService- Parameters:
url
- url of metadata api- Returns:
- MetadataApiService instance
-
getDdoEndpoint
public String getDdoEndpoint()
-
createDDO
public DDO createDDO(DDO ddo) throws DDOException
Registers a new DDO in Metadata Api- Parameters:
ddo
- the ddo- Returns:
- the created DDO
- Throws:
DDOException
- DDOException
-
getDDO
public DDO getDDO(String url) throws DDOException
Gets a DDO from an URL- Parameters:
url
- the url- Returns:
- the DDO
- Throws:
DDOException
- DDOException
-
getDDOUsingId
public DDO getDDOUsingId(String id) throws Exception
Gets a DDO from the DID- Parameters:
id
- the DID- Returns:
- the DDO
- Throws:
Exception
- Exception
-
updateDDO
public boolean updateDDO(String id, DDO ddo) throws Exception
Updates the metadata of a DDO- Parameters:
id
- the didddo
- the DDO- Returns:
- a flag that indicates if the update operation was executed correctly
- Throws:
Exception
- Exception
-
searchDDO
public SearchResult searchDDO(String param, int offset, int page) throws DDOException
Search all the DDOs that match the text passed as a parameter- Parameters:
param
- the criteriaoffset
- parameter to paginatepage
- parameter to paginate- Returns:
- a List of all the DDOs found
- Throws:
DDOException
- DDOException
-
searchDDO
public SearchResult searchDDO(SearchQuery searchQuery) throws DDOException
Search all the DDOs that match the query passed as a parameter- Parameters:
searchQuery
- the query- Returns:
- a List of all the DDOs found
- Throws:
DDOException
- DDOException
-
retireAssetDDO
public boolean retireAssetDDO(String id) throws DDOException
Retire the asset ddo from Metadata Api.- Parameters:
id
- the did- Returns:
- a flag that indicates if the retire operation was executed correctly
- Throws:
DDOException
- DDOException
-
validateMetadata
public boolean validateMetadata(AssetMetadata metadata) throws DDOException
Check that the metadata has a valid formUrl.- Parameters:
metadata
- the metadata of the DDO- Returns:
- a flag that indicates if the metadata is valid
- Throws:
DDOException
- DDOException
-
-