Thank you very much for a quick answer. This helped me a lot.
Best regards,
Antti
On 11/08/2013 02:37 PM, Francesco Chicchiriccò wrote:
On 08/11/2013 12:34, Francesco Chicchiriccò wrote:
Hi,
sorry for jumping in only now in this thread: how did you generate
your Syncope project?
If via [1], you don't need to modify any POM for being able to
replace any Syncope class: as said by Massimiliano, you just need to
have same name and same package and the Maven WAR plugin [2] will
automagically replace your local copy with original version.
Coming to the actual subject of this e-mail ("Override UserDataBinder
update method") I'd say that a better, even though less practical at
first, alternative to what suggested (e.g. replacing
"core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java")
could be the following:
1. create your own my.package.ExtendedUserDataBinder that extends
UserDataBinder and @Override the update() method
2. edit core/src/main/resources/syncopeContext.xml and change
<context:component-scan
base-package="org.apache.syncope.core.rest.data"/>
with
<bean
class="org.apache.syncope.core.rest.data.DefaultAttributableTransformer"/>
<bean class="org.apache.syncope.core.rest.data.SchemaDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.ConnInstanceDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.ResourceDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.ConfigurationDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.RoleDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.PolicyDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.TaskDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.ReportDataBinder"/>
<bean class="org.apache.syncope.core.rest.data.NotificationDataBinder"/>
<bean id="userDataBinder" class="my.package.ExtendedUserDataBinder"/>
or, even better (just discovered), replace
<context:component-scan
base-package="org.apache.syncope.core.rest.data"/>
with
<context:component-scan base-package="org.apache.syncope.core.rest.data">
<context:exclude-filter type="regex"
expression="org.apache.syncope.core.rest.data.UserDataBinder" />
</context:component-scan>
<bean id="userDataBinder" class="my.package.ExtendedUserDataBinder"/>
HTH
Regards.
[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Syncope+project
[2] http://maven.apache.org/plugins/maven-war-plugin/overlays.html
On 08/11/2013 11:51, Antti Lankinen wrote:
I want to add some more "handling" (add certain role for certain
users) when updating user. So I need to override update method in
UserDataBinder class.
Maybe there is a "better" place where to do this ?
I added this in Syncoper core pom.xml. That's my overlay project,
where I have only the class which overrides UserDataBinder update
method.
<dependencies>
<dependency>
<groupId>fi.helsinki.itcenter.syncopecore</groupId>
<artifactId>syncopecoreoverlay</artifactId>
<version>1.0</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
....
</dependencies>
,Antti
On 11/08/2013 12:33 PM, Massimiliano Perrone wrote:
On 11/08/2013 11:08 AM, Antti Lankinen wrote:
Yes, the package is org.apache.syncope.core.rest.data.UserDataBinder.
Should I configure some of xml files (syncopeContext.xml) or
something else... ?
,Antti
No, because this is simple maven overlays build functionality.
So, starting with the assumption that to override UserDataBinder is
the right way, what's your exactly problem?
On 11/08/2013 11:53 AM, Massimiliano Perrone wrote:
On 11/08/2013 10:49 AM, Antti Lankinen wrote:
I also tried to override UserDataBinder class but syncope didn't
use my class.
,Antti
Sorry Antti, but this is impossible :) obviously in a right
configuration..
In your overlay, are you sure that the package of your class is:
./core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?
On 11/08/2013 11:45 AM, Massimiliano Perrone wrote:
Hi Antti, in line answer.
On 11/08/2013 10:38 AM, anttig wrote:
Hi,
I created overlay project where I have a class which extends
UserDataBinder
class update method.
My class is named UserDataBinderUpdate and it's in the same
package
structure as UserDataBinder.
I can see that my class is included in syncope.war file when I
build the
war.
But when I run Syncope and update user, original
UserDataBinder update
method is used and not the one which
I wrote.
So my question is, how to extend UserDataBinder class ?
Why you have created a UserDataBinderUpdate class instead to
override UserDataBinder class itself?
Kind regards,
Antti
--
Francesco Chicchiriccò
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/
--
Francesco Chicchiriccò
ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/