Hi Tony,

I see a problem here with the custom-container pom. If we are going to specify 
rave-core and rave-web provided then these jars are not going to be copied to 
generated war. Is the custom-container have all the rave core code in the 
project itself. 

Thanks
Raminder
On Feb 17, 2012, at 10:30 AM, Carlucci, Tony wrote:

> Project Structure:
> 
> rave-custom/
>     pom.xml
>     custom-container/   # this has our overlay code for basically everything 
> but shindig
>     custom-shindig/     # this has our overlay code for shindig only (like 
> the shindig.properties, etc)
>     custom-portal/      # only has a pom.xml to deploy our custom war files 
> via cargo
> 
> =============
> root pom.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
>    <modelVersion>4.0.0</modelVersion>
> 
>    <groupId>org.custom.portal</groupId>
>    <artifactId>custom-master</artifactId>
>    <name>custom Master Project</name>
>    <description>custom Master Project</description>
>    <packaging>pom</packaging>
>    <version>1.0.0</version>
> 
>    <parent>
>        <groupId>org.apache.rave</groupId>
>        <artifactId>rave-project</artifactId>
>        <version>0.9-incubating-SNAPSHOT</version>
>    </parent>
> 
>    <repositories>
>        <repository>
>            <id>apache-snapshots</id>
>            <name>Apache Software Foundation Snapshots</name>
>            <url>https://repository.apache.org/content/groups/snapshots</url>
>            <snapshots>
>                <enabled>true</enabled>
>            </snapshots>
>        </repository>
>    </repositories>
> 
>    <properties>
>        <rave.version>0.9-incubating-SNAPSHOT</rave.version>
>        <shindig.version>3.0.0-beta4</shindig.version>
>        <cargo.version>1.1.0</cargo.version>
>        <!-- if you want a remote debugging on a different a address override 
> on command line with -Dcargo.debug.address=xxxx -->
>        <cargo.debug.address>8000</cargo.debug.address>
>        <!-- if you want to start remote debugging session suspended  override 
> on command line with -Dcargo.debug.suspend=y -->
>        <cargo.debug.suspend>n</cargo.debug.suspend>
>        <javaagent/>
>    </properties>
> 
>    <dependencyManagement>
>        <dependencies>
>            <dependency>
>                <groupId>org.apache.rave</groupId>
>                <artifactId>rave-portal</artifactId>
>                <version>${rave.version}</version>
>                <type>war</type>
>            </dependency>
>            <dependency>
>                <groupId>org.apache.rave</groupId>
>                <artifactId>rave-shindig</artifactId>
>                <version>${rave.version}</version>
>                <type>war</type>
>            </dependency>
>        </dependencies>
>    </dependencyManagement>
> 
>    <modules>
>        <module>custom-container</module>
>        <module>custom-shindig</module>
>        <module>custom-portal</module>
>    </modules>
> </project>
> 
> =========================
> custom-container/pom.xml:
> 
> <project xmlns="http://maven.apache.org/POM/4.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/maven-v4_0_0.xsd";>
> 
>    <modelVersion>4.0.0</modelVersion>
> 
>    <parent>
>        <groupId>org.custom.portal</groupId>
>        <artifactId>custom-master</artifactId>
>        <version>1.0.0</version>
>    </parent>
> 
>    <groupId>org.custom.portal</groupId>
>    <artifactId>custom-container</artifactId>
>    <name>custom::Portal Container</name>
>    <description>custom Portal Container context</description>
>    <packaging>war</packaging>
> 
>    <dependencies>
>        <dependency>
>            <groupId>org.apache.rave</groupId>
>            <artifactId>rave-portal</artifactId>
>            <type>war</type>
>            <exclusions>
>                <exclusion>
>                    <groupId>org.apache.tomcat</groupId>
>                    <artifactId>jasper-el</artifactId>
>                </exclusion>
>                <exclusion>
>                    <groupId>org.apache.tomcat</groupId>
>                    <artifactId>el-api</artifactId>
>                </exclusion>
>                <exclusion>
>                    <groupId>org.glassfish.web</groupId>
>                    <artifactId>jstl-impl</artifactId>
>                </exclusion>
>            </exclusions>
>        </dependency>
>        <dependency>
>            <groupId>org.apache.rave</groupId>
>            <artifactId>rave-core</artifactId>
>            <version>${rave.version}</version>
>            <type>jar</type>
>            <scope>provided</scope>            
>        </dependency>
>        <dependency>
>            <groupId>org.apache.rave</groupId>
>            <artifactId>rave-commons</artifactId>
>            <version>${rave.version}</version>
>            <type>jar</type>
>            <scope>provided</scope>
>        </dependency>
>        <dependency>
>            <groupId>org.apache.rave</groupId>
>            <artifactId>rave-web</artifactId>
>            <version>${rave.version}</version>
>            <type>jar</type>
>            <scope>provided</scope>            
>        </dependency>
> 
>        <!-- Default database -->
>        <dependency>
>            <groupId>com.h2database</groupId>
>            <artifactId>h2</artifactId>
>        </dependency>
> 
>        <dependency>
>            <groupId>org.slf4j</groupId>
>            <artifactId>slf4j-log4j12</artifactId>
>            <scope>provided</scope>
>        </dependency>
> 
>        <!-- test dependencies -->
>        <dependency>
>            <groupId>org.easymock</groupId>
>            <artifactId>easymock</artifactId>
>            <scope>test</scope>
>        </dependency>
>        <dependency>
>            <groupId>org.springframework</groupId>
>            <artifactId>spring-test</artifactId>
>        </dependency>
> 
>    </dependencies>
> </project>
> 
>> -----Original Message-----
>> From: Raminderjeet Singh [mailto:[email protected]]
>> Sent: Friday, February 17, 2012 10:04 AM
>> To: [email protected]
>> Subject: Re: Extend Person model as Rave-Extension
>> 
>> Thanks Tony,
>> 
>> I tried the same and it works well for me if i am doing all this in 
>> rave-core itself
>> but not as overlay. Can you share the overlay part of you project pom?
>> 
>> Raminder
>> 
>> On Feb 17, 2012, at 9:36 AM, Carlucci, Tony wrote:
>> 
>>> Hi Raminder, we've been working on extending the User for our internal
>> implementation.  It's still in the early stages but here is what I've done 
>> so far
>> (all code is done in our overlay):
>>> 
>>> 1) Create a Custom user:
>>> 
>>> package org.custom.portal.model;
>>> 
>>> @Entity
>>> public class CustomUser extends org.apache.rave.model.User {
>>>     @Transient
>>>               private String employeeNumber;
>>>     @Transient
>>>     private String jobTitle;
>>>     @Transient
>>>     private String building;
>>>     ...
>>>               // other custom user attributes
>>> }
>>> 
>>> Our custom fields are marked Transient as they are populated from a read-
>> only data source (LDAP) and we don't plan on allowing updates to them via
>> Rave.
>>> 
>>> 
>>> 2) Create a new CustomUserRepository interface:
>>> 
>>> public interface CustomUserRepository {
>>>       CustomUser getByEmployeeNumber(String employeeNumber);
>>>       // ...  other custom function signatures
>>> }
>>> 
>>> 3) Create a new DefaultCustomUserRepository class with "userRepository"
>> as the bean name that is marked as @Primary to override the default Rave
>> userRepository implemenation (DefaultUserRepository).  This custom class
>> will get injected into any Spring Bean that needs a "userRepository" like
>> UserService.
>>> 
>>> @Repository(value="userRepository")
>>> @Primary
>>> @Transactional
>>> public class DefaultCustomUserRepository extends JpaUserRepository
>> implements CustomUserRepository {
>>> 
>>>      @Override
>>>      public CustomUser getByEmployeeNumber(String employeeNumber) {
>>>           ...
>>>      }
>>> 
>>>      // custom code that fetches the new user data fields from our LDAP
>> server
>>>      private CustomUser getCustomUserFromLDAP(String employeeNumber)
>> {
>>>           ...
>>>      }
>>> }
>>> 
>>> 4) Overlay core-applicationContext.xml with our version that includes
>> component scans of our custom packages:
>>> ...
>>>   <!-- component scan custom code -->
>>>   <context:component-scan base-
>> package="org.custom.portal.repository"/>
>>> ...
>>> 
>>> 5) Overlay applicationContext.xml to reference our core-
>> applicationContext.xml file:
>>> ...
>>>   <import resource="classpath*:org/custom/portal/core-
>> applicationContext.xml"/>
>>>   <import resource="classpath*:org/apache/rave/web-
>> applicationContext.xml"/>
>>>   <import resource="classpath*:org/apache/rave/opensocial-provider-
>> applicationContext.xml"/>
>>>   <import resource="classpath*:org/apache/rave/w3c-provider-
>> applicationContext.xml"/>
>>> ...
>>> 
>>> Again we are still in the early stages of this work so things may change 
>>> over
>> time but this should give you enough of a starting point.
>>> 
>>> Tony
>>> 
>>> 
>>>> -----Original Message-----
>>>> From: Raminderjeet Singh [mailto:[email protected]]
>>>> Sent: Thursday, February 16, 2012 3:30 PM
>>>> To: [email protected]
>>>> Subject: Extend Person model as Rave-Extension
>>>> 
>>>> Hi Devs,
>>>> 
>>>> I am trying to extend the person object to add new data fields using rave-
>>>> vanilla-extension. War overlay works fine for new services like
>>>> (CustomUserService) and web components but it does not overlay
>>>> dependency artifact jars. I tried to overlay rave-core jar only in a 
>>>> separate
>>>> project but was not successful to extend user model. I can add my code to
>>>> rave-core itself and it works well. Any ideas how can i make this work from
>>>> rave-extensions? I think this use case will be true for any custom portals
>>>> based on Rave. I added my sample code in rave-vanilla-extension sandbox.
>> I
>>>> created RAVE-447 for this also.
>>>> 
>>>> Thanks
>>>> Raminder
> 

Reply via email to