Hi All,
@Component
description="This component will listen to change in event end date node")
@Service
@Reference
@Reference
@Activate
{
log.info("##In activate
Session
log.info("sessObj is live?"+sessObj
String
String path="/content";
Event
//Event
}
// TODO Auto-generated catch block
//log.info(le.getMessage
}
{
}
}
/*@Deactivate
* protected void deactivate
{
log.info("##In deactivate
{
}
// TODO Auto-generated catch block
}
}
{
session=null;
}
}*/
// TODO Auto-generated method stub
log.info("## In
log.info("eventsSize
Node
{
Event event = arg0.nextEvent
String
log.info("eventFiredPath
log.info("nodeObj is locked
}
}
}
}
/*public void run
// TODO Auto-generated method stub
log.info("## In run
}
*/
}
In Advance
Solved! Go to Solution.
Views
Replies
Total Likes
I think the issue is with the session that you are getting via ResourceResolverFactory.
Try Below :
// ResourceResolver resolver = resolverFactory.getAdministrativeResourceResolver(null); // Session sessObj = resolver.adaptTo(Session.class); session = repository.loginAdministrative(null); log.info("sessObj is live?"+session.isLive()); obsMgnr = session.getWorkspace().getObservationManager();
Views
Replies
Total Likes
Hi,
I see Event.NODE_ADDED is commented !!
Views
Replies
Total Likes
bsloki wrote...
Hi,
I see Event
. NODE_ADDED is commented!!
Anything
Views
Replies
Total Likes
Replace this
obsMgnr.addEventListener(
this,
Event.NODE_ADDED,
//Event.NODE_REMOVED,
path,
true,
null,
null,
false);
with
obsMgnr.addEventListener(
this,
Event.NODE_ADDED,
//Event.NODE_REMOVED,
path,
true,
null,
types,
false);
Basically, you have missed on what type of nodes these event should be triggered. its currently you are passing it as 'null' and I think that would be the reason it is not firing on any action
Views
Replies
Total Likes
I think the issue is with the session that you are getting via ResourceResolverFactory.
Try Below :
// ResourceResolver resolver = resolverFactory.getAdministrativeResourceResolver(null); // Session sessObj = resolver.adaptTo(Session.class); session = repository.loginAdministrative(null); log.info("sessObj is live?"+session.isLive()); obsMgnr = session.getWorkspace().getObservationManager();
Views
Replies
Total Likes
vdhim23 wrote...
I think the issue is with the session that you are getting via ResourceResolverFactory.
Try Below
:
//
resolver = ResourceResolver resolverFactory . getAdministrativeResourceResolver null); ( // Session
= resolver sessObj . adaptTo Session ( class); .
= repository session . loginAdministrative null); ( log.info("sessObj is live?"+session
. isLive )); (
= session obsMgnr . getWorkspace ) ( . getObservationManager ); (
Now seems to be
Session
Thanks,
Kishore
Views
Replies
Total Likes
GK@AEM wrote...
vdhim23 wrote...
I think the issue is with the session that you are getting via ResourceResolverFactory.
Try Below :
// ResourceResolver resolver = resolverFactory.getAdministrativeResourceResolver(null);
// Session sessObj = resolver.adaptTo(Session.class);
session = repository.loginAdministrative(null);
log.info("sessObj is live?"+session.isLive());
obsMgnr = session.getWorkspace().getObservationManager();
Now seems to be issue with getting session.Now events are getting fired.
i have another question, what is the difference between getting session object from resourceResolverFactory and getting from SlingRepository object?
ResourceResolver resObj = resolverFactory.getAdministrativeResourceResolver(null);
Session sessObj = resObj.adaptTo(Session.class);
session = repository.loginAdministrative(null); [repository is an object of type SlingRepositry object]
Thanks,
Kishore
What i understand as per the docs
resolverFactory.getAdministrativeResourceResolver(null)
Returns a new ResourceResolver instance with administrative privileges with further configuration taken from the given authenticationInfo map.
repository.loginAdministrative(null);
Returns a session to the default workspace which has administrative powers.
So ResourceResolver with administrative privileges provide an access over resources that you resolve via ResourceResolver, In that case you can get admin access over resource that get restricted via ACL.
Views
Replies
Total Likes
Hi,
There should not be any difference between these 2 approaches. Both return a new admin session.
kind regards,
Jörg
Views
Replies
Total Likes
Jörg Hoh wrote...
Hi,
There should not be any difference between these 2 approaches. Both return a new admin session.
kind regards,
Jörg
Thanks Jorg, But how can listener not fire in case of ResourceResolverFactory, but if we get the session via SlingRepository it works?
Views
Replies
Total Likes
Views
Likes
Replies