Fórum
Hook plugin - Pretty basic - Overriding a service
Juan José Fuentes, modificado 13 Anos atrás.
Hook plugin - Pretty basic - Overriding a service
Junior Member Postagens: 48 Data de Entrada: 16/07/10 Postagens Recentes
Hi,
I'm trying to create a simple hook plugin, NOT a portlet plugin with hook capabilities, and override two methods of UserLocalService. I'm using Liferay IDE and Liferay 6.0.4 Tomcat bundle.
Steps:
- Create hook plugin project
- Create new hook to the UserLocalService using the wizard from the IDE. The liferay-hook.xml ends like this:
- The class ExtUserLocalService is the only .java file in the project and is coded like this:
- Attach the project to the server instance
With these steps, everything seems to go well- The hook seems to be deployed without any problems. In fact, the application folder inside the "webapps" folder has the correct structure and has all the files I think it should have. But when I create a new user, that is the moment when this method should be called, nothing appears in the console. Debugging, I can see that this method isn't called at all, but the original...
My question is: Is there something I'm missing? An additional step to hook a service?
I'm trying to create a simple hook plugin, NOT a portlet plugin with hook capabilities, and override two methods of UserLocalService. I'm using Liferay IDE and Liferay 6.0.4 Tomcat bundle.
Steps:
- Create hook plugin project
- Create new hook to the UserLocalService using the wizard from the IDE. The liferay-hook.xml ends like this:
<!--?xml version="1.0"?-->
<hook>
<service>
<service-type>com.liferay.portal.service.UserLocalService</service-type>
<service-impl>com.test.service.ExtUserLocalService</service-impl>
</service>
</hook>
- The class ExtUserLocalService is the only .java file in the project and is coded like this:
package com.test.service;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.service.UserLocalServiceWrapper;
import com.liferay.portal.service.UserLocalService;
public class ExtUserLocalService extends UserLocalServiceWrapper {
/* (non-Java-doc)
* @see com.liferay.portal.service.UserLocalServiceWrapper#UserLocalServiceWrapper(UserLocalService userLocalService)
*/
public ExtUserLocalService(UserLocalService userLocalService) {
super(userLocalService);
}
@Override
public void addDefaultRoles(long userId) throws PortalException, SystemException {
super.addDefaultRoles(userId);
System.out.println("--------------------");
System.out.println("Entering here!!");
System.out.println("--------------------");
}
}
- Attach the project to the server instance
With these steps, everything seems to go well- The hook seems to be deployed without any problems. In fact, the application folder inside the "webapps" folder has the correct structure and has all the files I think it should have. But when I create a new user, that is the moment when this method should be called, nothing appears in the console. Debugging, I can see that this method isn't called at all, but the original...
My question is: Is there something I'm missing? An additional step to hook a service?
Yousri BENDIABDALLAH, modificado 13 Anos atrás.
RE: Hook plugin - Pretty basic - Overriding a service
Junior Member Postagens: 70 Data de Entrada: 11/04/08 Postagens Recentes
Kieran Brady, modificado 13 Anos atrás.
RE: Hook plugin - Pretty basic - Overriding a service (Resposta)
New Member Postagens: 5 Data de Entrada: 17/11/10 Postagens RecentesJuan José Fuentes:
Hi,
I'm trying to create a simple hook plugin, NOT a portlet plugin with hook capabilities, and override two methods of UserLocalService.
...
My question is: Is there something I'm missing? An additional step to hook a service?
I was trying something similar, but made assumptions about what methods would be called in UserLocalService. Copying the example hook I can now see my own implementation being called for the getUserById method. I have a setup exactly like yours (although using 6.0.6).
Hope this helps.
chano zamora lozano, modificado 13 Anos atrás.
RE: Hook plugin - Pretty basic - Overriding a service
New Member Mensagem: 1 Data de Entrada: 01/05/10 Postagens Recentes
Hi Juan!
I have the same problem, Did you solve the problem?
Thanks in advanced
I have the same problem, Did you solve the problem?
Thanks in advanced
Juan José Fuentes, modificado 13 Anos atrás.
RE: Hook plugin - Pretty basic - Overriding a service
Junior Member Postagens: 48 Data de Entrada: 16/07/10 Postagens Recentes
Hi chano!
Yes, we solved it. We could fix the problem referring to the example Kieran said.
Additionaly, we've encountered several behaviors in the deployment of service hooks that were not expected. Just be sure that Liferay is actually using the hook if you are deploying a service hook. Sometimes Liferay says it will not undeploy a previous service hook.
Yes, we solved it. We could fix the problem referring to the example Kieran said.
Additionaly, we've encountered several behaviors in the deployment of service hooks that were not expected. Just be sure that Liferay is actually using the hook if you are deploying a service hook. Sometimes Liferay says it will not undeploy a previous service hook.
Laxman Rana, modificado 12 Anos atrás.
RE: Hook plugin - Pretty basic - Overriding a service
Junior Member Postagens: 38 Data de Entrada: 01/03/12 Postagens Recentes
@juan..
can u help me in this question...
http://www.liferay.com/community/forums/-/message_boards/view_message/13039798
can u help me in this question...
http://www.liferay.com/community/forums/-/message_boards/view_message/13039798