You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ace.apache.org by ghania ferrag <gf...@yahoo.ca> on 2013/09/18 22:55:47 UTC
Upload Artifact to ACE repository using ACE REST client
Hi every one,
I’m working on new WEB UI that use ACE rest client to communicate with ACE server.
Now I need to add Artifacts or bundles to repository. I did put the artifacts, that I want to add, somewhere where I can reference with a URL and use the REST client API to add the metadata for the artifact(s).
I’m following the user guide of Client REST Api http://ace.apache.org/user-doc/restapi.html, and I’m having the following error when I tried to upload a new Artifact [Error 400 Could not add entity of type artifact].
Here is the JSON that I’m sending to upload new artifact
{"attributes":{"artifactName":"js-1.7R2-osgi", "artifactDescription":"uploaded package js-1.7R2-osgi.jar", "url":"file:///C:/proj-test/upload/js-1.7R2-osgi.jar", "Bundle-Name":"bn", "Bundle-SymbolicName":"bsn", "Bundle-Version":"1.0"
}, "tags":{}}
Anyone have an idea what I’m missing here? Also what we have to set in the processorPid property?
Thank you very much in advance for your response,
Ghania
Re: Upload Artifact to ACE repository using ACE REST client
Posted by ghania ferrag <gf...@yahoo.ca>.
Hi Marcel,
Thank you very much for your prompt response and the explanation.
The BundleHelperImpl helped me a lot to understand the way Ace add and organize artifacts.
With you help, now it is working, thank you so much for your response.
My Best Regards,
Ghania
________________________________
De : Marcel Offermans <ma...@luminis.nl>
À : users@ace.apache.org; ghania ferrag <gf...@yahoo.ca>
Envoyé le : mercredi 18 Septembre 2013 17h10
Objet : Re: Upload Artifact to ACE repository using ACE REST client
Hello Ghania,
On Sep 18, 2013, at 22:55 PM, ghania ferrag <gf...@yahoo.ca> wrote:
> I’m working on new WEB UI that use ACE rest client to communicate with ACE server.
> Now I need to add Artifacts or bundles to repository. I did put the artifacts, that I want to add, somewhere where I can reference with a URL and use the REST client API to add the metadata for the artifact(s).
> I’m following the user guide of Client REST Api http://ace.apache.org/user-doc/restapi.html, and I’m having the following error when I tried to upload a new Artifact [Error 400 Could not add entity of type artifact].
>
> Here is the JSON that I’m sending to upload new artifact
> {"attributes":{
> "artifactName":"js-1.7R2-osgi",
> "artifactDescription":"uploaded package js-1.7R2-osgi.jar",
> "url":"file:///C:/proj-test/upload/js-1.7R2-osgi.jar",
> "Bundle-Name":"bn",
> "Bundle-SymbolicName":"bsn",
> "Bundle-Version":"1.0"
> }, "tags":{}}
>
> Anyone have an idea what I’m missing here? Also what we have to set in the processorPid property?
> Thank you very much in advance for your response,
Yes. Since ACE can store many different types of "artifacts" one thing you must always supply is a specific mimetype.
We have an ArtifactRecognizer that has a method called extractMetadata() and is implemented for every type of artifact we support. So in this case, if you look in BundleHelperImpl you will see what attributes it extracts from a bundle. One of which is:
metadata.put(ArtifactHelper.KEY_MIMETYPE, MIMETYPE);
The constants evaluate to: "mimetype", "application/vnd.osgi.bundle".
That same piece of code also answers your question about what to set in the processorPid property (an empty string is fine).
Greetings, Marcel
Re: Upload Artifact to ACE repository using ACE REST client
Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Ghania,
On Sep 18, 2013, at 22:55 PM, ghania ferrag <gf...@yahoo.ca> wrote:
> I’m working on new WEB UI that use ACE rest client to communicate with ACE server.
> Now I need to add Artifacts or bundles to repository. I did put the artifacts, that I want to add, somewhere where I can reference with a URL and use the REST client API to add the metadata for the artifact(s).
> I’m following the user guide of Client REST Api http://ace.apache.org/user-doc/restapi.html, and I’m having the following error when I tried to upload a new Artifact [Error 400 Could not add entity of type artifact].
>
> Here is the JSON that I’m sending to upload new artifact
> {"attributes":{
> "artifactName":"js-1.7R2-osgi",
> "artifactDescription":"uploaded package js-1.7R2-osgi.jar",
> "url":"file:///C:/proj-test/upload/js-1.7R2-osgi.jar",
> "Bundle-Name":"bn",
> "Bundle-SymbolicName":"bsn",
> "Bundle-Version":"1.0"
> }, "tags":{}}
>
> Anyone have an idea what I’m missing here? Also what we have to set in the processorPid property?
> Thank you very much in advance for your response,
Yes. Since ACE can store many different types of "artifacts" one thing you must always supply is a specific mimetype.
We have an ArtifactRecognizer that has a method called extractMetadata() and is implemented for every type of artifact we support. So in this case, if you look in BundleHelperImpl you will see what attributes it extracts from a bundle. One of which is:
metadata.put(ArtifactHelper.KEY_MIMETYPE, MIMETYPE);
The constants evaluate to: "mimetype", "application/vnd.osgi.bundle".
That same piece of code also answers your question about what to set in the processorPid property (an empty string is fine).
Greetings, Marcel