* @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#login(org.apache.cocoon.portal.coplet.CopletInstanceData)
*/
public void login(CopletInstanceData coplet) {
super.login(coplet);
final CopletData copletData = coplet.getCopletData();
// get the producer
final String producerId = (String) copletData.getAttribute("producer-id");
if ( producerId == null ) {
// if the producer can't be found, we simply return
this.getLogger().error("Producer not configured in wsrp coplet " + copletData.getId());
return;
}
final Producer producer = consumerEnvironment.getProducerRegistry().getProducer(producerId);
if ( producer == null ) {
// if the producer can't be found, we simply return
this.getLogger().error("Producer with id " + producerId + " not found.");
return;
}
// get the wsrp user and store it as an attribute on the instance
final String currentUserID = this.service.getComponentManager().getProfileManager().getUser().getUserName();
User user = this.consumerEnvironment.getUserRegistry().getUser(currentUserID);
if ( user == null ) {
// create a new user
user = new UserImpl(currentUserID);
user.setUserContext(this.userContextProvider.createUserContext(currentUserID));
this.consumerEnvironment.getUserRegistry().addUser(user);
}
coplet.setTemporaryAttribute(ATTRIBUTE_NAME_USER, user);
// get the portlet handle
final String portletHandle = (String) copletData.getAttribute("portlet-handle");
if ( portletHandle == null ) {
// if the portlet handle can't be found, we simply return
this.getLogger().error("Portlet handle not configured in wsrp coplet " + copletData.getId());
return;
}
// get the wsrp portlet
final PortletKey portletKey = new PortletKeyImpl(portletHandle, producerId);