
aponnusa wrote...
Hi Monika,
Are you using a new resourceType or using social/activitystreams/components/hbs/activitystreams. If you are using social/activitystreams/components/hbs/activitystreams, then we might have to assign priority so that your custom component gets the preference. Add this code in your Factory
@Overridepublic int getPriority() {return 10;}
Next steps, Did you check if your bundle is active in OSGI System Console (/system/console/bundles) and your factory active at (/system/console/components)
If nothing helped, can you share your code. (We can try locally and see if something else is wrong)
Thanks
Hi
I am using the new resouceType
So I have my component class
public class CustomSocialComponent extends AbstractActivityStream implements SocialComponent { public CustomSocialComponent(Resource resource, ClientUtilities clientUtils, SocialActivityManager socialAcm) { super(resource, clientUtils, socialAcm); } public CustomSocialComponent(Resource resource,ClientUtilities clientUtils, QueryRequestInfo queryRequestInfo,SocialActivityManager socialAcm) { super(resource, clientUtils, queryRequestInfo, socialAcm); } @Override public int getTotalSize() { return 0; }in which I am just trying to override one of the attrubte of the JSON response.
My Custom Factory class for this is
@Component(name = "Custom Social Component Factory") @Service public class CustomSocialComponentFactory extends AbstractSocialComponentFactory implements SocialComponentFactory { @Reference private SocialActivityManager socialAcm; @Override public SocialComponent getSocialComponent(Resource resource) { return new CustomSocialComponent(resource, this.getClientUtilities(resource.getResourceResolver()),socialAcm); } @Override public SocialComponent getSocialComponent(Resource resource, SlingHttpServletRequest request) { return new CustomSocialComponent(resource, this.getClientUtilities(request),this.getQueryRequestInfo(request),socialAcm); } @Override public SocialComponent getSocialComponent(Resource resource, ClientUtilities clientUtils, QueryRequestInfo queryRequestInfo) { return new CustomSocialComponent(resource, clientUtils,queryRequestInfo,socialAcm); } @Override public int getPriority() { return 10; } @Override public String getSupportedResourceType() { return "apps/customsocial/components/social/activitystreams"; }After deploying code I see my factory in "satisfied" state in /system/console/components
But if I add immediate=true in component annotations, it deploy as "active" state
@Component(immediate=true,metatype = true).
Somehow, I am feeling that I am not extending and implementing the correct classes for activitystreams, I tried extending the comment component, and I was able to call the Custom class.
The way "CommentSocialComponentFactory" is exposed, is there any class for ActivityStream as well?
Also in documentation, only Interfaces are specified in ActivityStream components API, but if I look into Java Editor(eclipse), I could see AbstractActivityStream class exposed.
Are there not any Abstract classes available for this components, which can be used to extend.
Let me know if If I am doing something wrong.