ace-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Willem Janssen <janwillem.jans...@luminis.eu>
Subject Re: Problem with ArtifactRecognizer for custom artifacts
Date Wed, 26 Jul 2017 11:17:06 GMT

> On 25 Jul 2017, at 11:11, Simon Huebner <simon.huebner@ise.fraunhofer.de> wrote:
> 
> Hello,
> 
> as far as I understood the ArtifactRecognizer try to recognize the mime of a given artifact.
> So if i add  myartifact.custom to ACE it should call recognize on MyArtifactHelper, but
no method’s where called.
> Or where does the mime matching happens? I use the ArtifactRecognizer and Helper from
the docs.

Presuming your ArtifactRecognizer is registered correctly as OSGi service, all recognizers
are
called once you try to add an artifact to the artifact repository. It either calls the `canHandle`
or `recognize` method (depending on whether a mime type is known in advance).

It is hard to tell why your code isn’t being called, but the obvious suspects are:

- is there an exception thrown from the code that you are unaware of (what do the
  logs mention, i.e., `log 1` in the shell);
- is your bundle started (is the `start` method of your activator being called);
- are you perhaps using a mime type for which another ArtifactRecognizer exists?
  (ACE has three default recognizers: `application/xml:osgi-autoconf`,
  `application/vnd.osgi.bundle` and `application/vnd.apache.ace.useradmin`).

Hope this helps,

Regards,

  Jan Willem

> 
> Kind regards,
> Simon
> 
> 
> On 12/07/17 15:10, Jan Willem Janssen wrote:
>> Hi,
>> 
>>> On 11 Jul 2017, at 14:20, Simon Huebner <simon.huebner@ise.fraunhofer.de>
wrote:
>>> 
>>> Hello,
>>> 
>>> i am currently trying to add an resource processor for an custom artifact, following
the docs (they are outdated) under:
>>> https://ace.apache.org/docs/adding-custom-artifact-types.html
>>> 
>>> I written a bundle with an Activator and a class implements ArtifactRecognizer,
ArtifactHelper.
>>> Currently we are running an ACE 2.1.0 allinone server. The bundle was installed
and started over the gogo shell.
>>> If i add a custom artifact over the ui, it seams the recognizer is not called
for a custom artifact. None off my debug outputs where logged.
>>> ACE shows an error: "Artifact <> not recognized!"
>>> 
>>> I think I'm doing something wrong in the Activator, here is the start method:
>>> 
>>> @Override
>>> public void start(BundleContext context) throws Exception {
>>>    String[] services = {ArtifactRecognizer.class.getName(), ArtifactHelper.class.getName()};
>>> 
>>>    MyArtifactHelper recognizer = new MyArtifactHelper();
>>>    Hashtable<String, String> properties = new Hashtable<String, String>();
>>>    properties.put(ArtifactObject.KEY_MIMETYPE, MyArtifactHelper.MIMETYPE);
>>> 
>>>    context.registerService(
>>>        services,
>>>        recognizer,
>>>        properties
>>>    );
>>> }
>>> 
>>> I have a processor as well, but as i understand this is not necessary at these
place.
>>> Can anyone help me, or has a guide with more details?
>> There’s nothing wrong with your Activator: you provide the right service interfaces
and
>> the right properties. My guess is that the problem is in MyArtifactHelper. Would
you be
>> able to share that one as well? If not, you should verify that:
>> 
>> 1) the `canHandle`, `canUse` methods both check for the right MIME type;
>> 2) the `extractMetaData` sets the right constants, at least;
>>    - ArtifactObject.KEY_PROCESSOR_PID (fill this with the name of the resource
>>      processor that should be used to handle your resource in a deployment package);
>>    - ArtifactObject.KEY_MIMETYPE (fill this with `MyArtifactHelper.MIMETYPE`);
>>    - ArtifactObject.KEY_ARTIFACT_NAME (fill this with a unique name for your artifacts
>>      so that you can recognise it in the OBR).
>>    should be set and returned.
>> 
>> Hope this helps,
>> 
>> --
>> Met vriendelijke groeten | Kind regards
>> 
>> Jan Willem Janssen | Software Architect
>> +31 631 765 814
>> 
>> 
>> My world is something with Amdatu and Apache
>> 
>> Luminis Technologies
>> John F. Kennedylaan 32
>> 7314 PS  Apeldoorn
>> +31 88 586 46 25
>> 
>> https://www.luminis.eu
>> 
>> KvK (CoC) 09 16 28 93
>> BTW (VAT) NL8170.94.441.B.01
>> 
> 
> --
> Simon Huebner, B.Sc.
> Information Technology
> Fraunhofer-Institut für Solare Energiesysteme ISE
> Heidenhofstrasse 2, 79110 Freiburg, Germany
> Phone: +49(0)761/4588-5695  Fax: +49(0)761/4588-9123
> simon.huebner@ise.fraunhofer.de
> http://www.ise.fraunhofer.de
> 

--
Met vriendelijke groeten | Kind regards

Jan Willem Janssen | Software Architect
+31 631 765 814


My world is something with Amdatu and Apache

Luminis Technologies
John F. Kennedylaan 32
7314 PS  Apeldoorn
+31 88 586 46 25

https://www.luminis.eu

KvK (CoC) 09 16 28 93
BTW (VAT) NL8170.94.441.B.01


Mime
View raw message