You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Dan Moore <mo...@yahoo.com> on 2004/10/14 22:23:46 UTC

working oracle psml in jetspeed 1.5

In order to get the PSML working in Oracle, from the 1.5 binary
distribution of Jetspeed, in addition to following the instructions
here regarding importing,
http://portals.apache.org/jetspeed-1/psml_db.html, I also had to make
some changes to class files and sql files.

You need both the src and binary distributions.  There's a diff of the
relevant files below.

Modify the java files:
Add _SEQ onto the value in setPrimaryKeyMethodInfo in each of the
org/apache/jetspeed/om/dbpsml/map/Jetspeed* files.

Modify the psml-db-oracle.sql file (from the src distribution):
Change each of the id columns to PSML_ID, in both places.
Change LOGIN_NAME to USER_NAME.
Remove each of the unique constraints on _NAME columns (login, role,
group).  (I'm not entirely certain about this, but I think if you need
to support multiple languages, you don't want that constraint.)

I tried following the directions to generate the sql files outlined in
http://portals.apache.org/jetspeed-1/psml_db.html to see if the
torque-schema fixed these issues, but didn't see any sql files
generated.

After making these changes, and putting the classes in the classpath, I
was able to able to import profiles and login successfully.

Have a nice day.
Dan

diff-------------------
diff change/JetspeedGroupProfileMapBuilder.java
orig/JetspeedGroupProfileMapBuilder.java
67c67
<         tMap.setPrimaryKeyMethodInfo("JETSPEED_GROUP_PROFILE_SEQ");
---
>         tMap.setPrimaryKeyMethodInfo("JETSPEED_GROUP_PROFILE");
diff change/JetspeedRoleProfileMapBuilder.java
orig/JetspeedRoleProfileMapBuilder.java
67c67
<         tMap.setPrimaryKeyMethodInfo("JETSPEED_ROLE_PROFILE_SEQ");
---
>         tMap.setPrimaryKeyMethodInfo("JETSPEED_ROLE_PROFILE");
diff change/JetspeedUserProfileMapBuilder.java
orig/JetspeedUserProfileMapBuilder.java
67c67
<         tMap.setPrimaryKeyMethodInfo("JETSPEED_USER_PROFILE_SEQ");
---
>         tMap.setPrimaryKeyMethodInfo("JETSPEED_USER_PROFILE");
Only in orig/: orig
diff change/psml-db-oracle.sql orig/psml-db-oracle.sql
25,26c25,26
<          PSML_ID INT NOT NULL,
<          USER_NAME VARCHAR2 (32) NOT NULL,
---
>          USER_ID INT NOT NULL,
>          LOGIN_NAME VARCHAR2 (32) NOT NULL,
31c31,32
<          PROFILE LONG RAW
---
>          PROFILE LONG RAW,
>          UNIQUE (LOGIN_NAME)
36c37
< PRIMARY KEY (PSML_ID);
---
> PRIMARY KEY (USER_ID);
48c49
<          PSML_ID INT NOT NULL,
---
>          GROUP_ID INT NOT NULL,
54c55,56
<          PROFILE LONG RAW
---
>          PROFILE LONG RAW,
>          UNIQUE (GROUP_NAME)
59c61
< PRIMARY KEY (PSML_ID);
---
> PRIMARY KEY (GROUP_ID);
71c73
<          PSML_ID INT NOT NULL,
---
>          ROLE_ID INT NOT NULL,
77c79,80
<          PROFILE LONG RAW
---
>          PROFILE LONG RAW,
>          UNIQUE (ROLE_NAME)
82c85
< PRIMARY KEY (PSML_ID);
---
> PRIMARY KEY (ROLE_ID);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: torque targets not called in dist (was Re: working oracle psml in jetspeed 1.5)

Posted by David Sean Taylor <da...@bluesunrise.com>.
Dan Moore wrote:

> --- David Sean Taylor <da...@bluesunrise.com> wrote:
> 
> 
>>Dan Moore wrote:
>>
>>
>>>Hi David.
>>>
>>>It's all working now.  I don't think I was changing my
>>>project.properties.  
>>>
>>
>>cool
>>
>>
>>>Thanks for your help.
>>>
>>>For posterity, what I did to generate working oracle Torque classes
>>
>>and
>>
>>>sql was:
>>>rm -rf jetspeed-1.5/
>>>jar -xf jetspeed-current-src.zip
>>>cd jetspeed-1.5/
>>>vi project.properties
>>>changed 'database' property to 'oracle'
>>>vi webapp/WEB-INF/conf/Torque.properties
>>>changed 'torque.database.default.adapter' to 'oracle'
>>>maven clean dist -Dmaven.test.skip=true
>>>cp target/jetspeed-1.5.jar ~/save
>>>maven torque:sql
>>>cp target/classes/sql/*.sql ~/save
>>>
>>
>>calling
>>
>>maven clean dist -Dmaven.test.skip=true
>>
>>should automatically call both torque:sql and torque:om
> 
> 
> Hrrm...
> 
> Well, when I called that, nothing was created in target/classes/sql. 
> In fact, after a 'maven clean dist -Dmaven.test.skip=true' these are
> the only sql files with psml in their name:
> 
> ./src/sql/external/psml-db-oracle.sql
> ./target/jetspeed-1.5/src/jetspeed-1.5/src/sql/external/psml-db-oracle.sql
> 

My mistake ... java:compile is not dependent on torque:sql
Try this:

maven clean torque:sql dist -Dmaven.test.skip=true


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


torque targets not called in dist (was Re: working oracle psml in jetspeed 1.5)

Posted by Dan Moore <mo...@yahoo.com>.
--- David Sean Taylor <da...@bluesunrise.com> wrote:

> Dan Moore wrote:
> 
> > Hi David.
> > 
> > It's all working now.  I don't think I was changing my
> > project.properties.  
> > 
> cool
> 
> > Thanks for your help.
> > 
> > For posterity, what I did to generate working oracle Torque classes
> and
> > sql was:
> > rm -rf jetspeed-1.5/
> > jar -xf jetspeed-current-src.zip
> > cd jetspeed-1.5/
> > vi project.properties
> > changed 'database' property to 'oracle'
> > vi webapp/WEB-INF/conf/Torque.properties
> > changed 'torque.database.default.adapter' to 'oracle'
> > maven clean dist -Dmaven.test.skip=true
> > cp target/jetspeed-1.5.jar ~/save
> > maven torque:sql
> > cp target/classes/sql/*.sql ~/save
> > 
> calling
> 
> maven clean dist -Dmaven.test.skip=true
> 
> should automatically call both torque:sql and torque:om

Hrrm...

Well, when I called that, nothing was created in target/classes/sql. 
In fact, after a 'maven clean dist -Dmaven.test.skip=true' these are
the only sql files with psml in their name:

./src/sql/external/psml-db-oracle.sql
./target/jetspeed-1.5/src/jetspeed-1.5/src/sql/external/psml-db-oracle.sql

And neither of these have the correct sql in them.

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: working oracle psml in jetspeed 1.5

Posted by David Sean Taylor <da...@bluesunrise.com>.
Dan Moore wrote:

> Hi David.
> 
> It's all working now.  I don't think I was changing my
> project.properties.  
> 
cool

> Thanks for your help.
> 
> For posterity, what I did to generate working oracle Torque classes and
> sql was:
> rm -rf jetspeed-1.5/
> jar -xf jetspeed-current-src.zip
> cd jetspeed-1.5/
> vi project.properties
> changed 'database' property to 'oracle'
> vi webapp/WEB-INF/conf/Torque.properties
> changed 'torque.database.default.adapter' to 'oracle'
> maven clean dist -Dmaven.test.skip=true
> cp target/jetspeed-1.5.jar ~/save
> maven torque:sql
> cp target/classes/sql/*.sql ~/save
> 
calling

maven clean dist -Dmaven.test.skip=true

should automatically call both torque:sql and torque:om

> I think you need to run both targets, the first to generate the
> classes, the second to generate the sql.
> 
> Thanks again for your help.
> 
> Dan
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
> 
> 
> 


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773 4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: working oracle psml in jetspeed 1.5

Posted by Dan Moore <mo...@yahoo.com>.
Hi David.

It's all working now.  I don't think I was changing my
project.properties.  

Thanks for your help.

For posterity, what I did to generate working oracle Torque classes and
sql was:
rm -rf jetspeed-1.5/
jar -xf jetspeed-current-src.zip
cd jetspeed-1.5/
vi project.properties
changed 'database' property to 'oracle'
vi webapp/WEB-INF/conf/Torque.properties
changed 'torque.database.default.adapter' to 'oracle'
maven clean dist -Dmaven.test.skip=true
cp target/jetspeed-1.5.jar ~/save
maven torque:sql
cp target/classes/sql/*.sql ~/save

I think you need to run both targets, the first to generate the
classes, the second to generate the sql.

Thanks again for your help.

Dan



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: working oracle psml in jetspeed 1.5

Posted by David Sean Taylor <da...@bluesunrise.com>.
Dan Moore wrote:

> Hi David,
> 
> --- David Sean Taylor <da...@bluesunrise.com> wrote:
> 
> 
>>Dan Moore wrote:
>>
>>
>>>In order to get the PSML working in Oracle, from the 1.5 binary
>>>distribution of Jetspeed, in addition to following the instructions
>>>here regarding importing,
>>>http://portals.apache.org/jetspeed-1/psml_db.html, I also had to
>>
>>make
>>
>>>some changes to class files and sql files.
>>>
>>>You need both the src and binary distributions.  There's a diff of
>>
>>the
>>
>>>relevant files below.
>>>
>>>Modify the java files:
>>>Add _SEQ onto the value in setPrimaryKeyMethodInfo in each of the
>>>org/apache/jetspeed/om/dbpsml/map/Jetspeed* files.
>>>
>>
>>The files that are you recommended for patching are not in the CVS.
>>They 
>>are Torque generated files.
>>
>>To use Oracle, or any other database besides Hypersonic with
>>Jetspeed-1, 
>>follow the steps here:
>>
>>http://portals.apache.org/jetspeed-1/database.html
> 
> 
> I'm certainly no Torque expert.  Thanks for the link.  I followed the
> instructions on that page.
> 
> I changed Torque.properties:
> torque.database.default.adapter=oracle
> 
Did you see step #1: edit project.properties ?
After doing that, run

maven torque:sql

just to see what your DDL looks like
Go to target/classes/sql/dbpsml-schema.sql
It should look something like this:
(disclaimer: im using 1.6-dev from the cvs head)

DROP TABLE JETSPEED_USER_PROFILE CASCADE CONSTRAINTS;
DROP SEQUENCE JETSPEED_USER_PROFILE_SEQ;

CREATE TABLE JETSPEED_USER_PROFILE
(
     PSML_ID NUMBER NOT NULL,
     USER_NAME VARCHAR2 (32) NOT NULL,
     MEDIA_TYPE VARCHAR2 (99),
     LANGUAGE VARCHAR2 (2),
     COUNTRY VARCHAR2 (2),
     PAGE VARCHAR2 (99),
     PROFILE LONG RAW,
     CONSTRAINT JETSPEED_USER_PROFILE_UNIQUE UNIQUE (USER_NAME, 
MEDIA_TYPE, LANGUAGE, COUNTRY, PAGE)
);

ALTER TABLE JETSPEED_USER_PROFILE
     ADD CONSTRAINT JETSPEED_USER_PROFILE_PK
PRIMARY KEY (PSML_ID);


CREATE SEQUENCE JETSPEED_USER_PROFILE_SEQ INCREMENT BY 1 START WITH 1 
NOMAXVALUE NOCYCLE NOCACHE ORDER;

> I didn't change the other config in Torque.properties yet--my database
> is down at the moment.  Does Torque need to connect to the db to
> generate the sql?  (I hope not.)

no

> 
> Anyway, maven dist did generate new sql files here:
> jetspeed-1.5/target/jetspeed-1.5/src/jetspeed-1.5/src/sql/external
> 
check the time stamp
i beleve even with 1.5 we started writing to the target/classes/sql 
directory
> 
> This sounds like a fantastic idea!  
> 
Any volunteers? ;)


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773 4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: working oracle psml in jetspeed 1.5

Posted by Dan Moore <mo...@yahoo.com>.
Hi David,

--- David Sean Taylor <da...@bluesunrise.com> wrote:

> Dan Moore wrote:
> 
> > In order to get the PSML working in Oracle, from the 1.5 binary
> > distribution of Jetspeed, in addition to following the instructions
> > here regarding importing,
> > http://portals.apache.org/jetspeed-1/psml_db.html, I also had to
> make
> > some changes to class files and sql files.
> > 
> > You need both the src and binary distributions.  There's a diff of
> the
> > relevant files below.
> > 
> > Modify the java files:
> > Add _SEQ onto the value in setPrimaryKeyMethodInfo in each of the
> > org/apache/jetspeed/om/dbpsml/map/Jetspeed* files.
> > 
> The files that are you recommended for patching are not in the CVS.
> They 
> are Torque generated files.
> 
> To use Oracle, or any other database besides Hypersonic with
> Jetspeed-1, 
> follow the steps here:
> 
> http://portals.apache.org/jetspeed-1/database.html

I'm certainly no Torque expert.  Thanks for the link.  I followed the
instructions on that page.

I changed Torque.properties:
torque.database.default.adapter=oracle

I didn't change the other config in Torque.properties yet--my database
is down at the moment.  Does Torque need to connect to the db to
generate the sql?  (I hope not.)

Anyway, maven dist did generate new sql files here:
jetspeed-1.5/target/jetspeed-1.5/src/jetspeed-1.5/src/sql/external

I couldn't find any others.  Unfortunately, these sql files do not use
the correct primary key.  Perhaps the torque-schema is incorrect?  I
don't know.  When I look at 
jetspeed-1.5/src/torque-schema/dbpsml-schema.xml, it certainly looks
like the columns are named correctly.

> I believe that the Jetspeed team has made things unnecessarily 
> complicated for end users to change their databsae. Asking people to
> dl 
> the source and recompile just to change the database is not user 
> friendly and a pain in the ass. Look at all the hell we've caused
> Dan.
> 
> Proposed solution:
> 
> Move the Torque generation into a separate sub-project of J1. Create
> a 
> jar for the OM-mapping for each database. Put each of these jars on
> the 
> distribution site with the release:
> 
> jetspeed-om-1.6-oracle.jar
> jetspeed-om-1.6-mysl.jar
> ...

This sounds like a fantastic idea!  

Thanks,
Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: working oracle psml in jetspeed 1.5

Posted by David Sean Taylor <da...@bluesunrise.com>.
Dan Moore wrote:

> In order to get the PSML working in Oracle, from the 1.5 binary
> distribution of Jetspeed, in addition to following the instructions
> here regarding importing,
> http://portals.apache.org/jetspeed-1/psml_db.html, I also had to make
> some changes to class files and sql files.
> 
> You need both the src and binary distributions.  There's a diff of the
> relevant files below.
> 
> Modify the java files:
> Add _SEQ onto the value in setPrimaryKeyMethodInfo in each of the
> org/apache/jetspeed/om/dbpsml/map/Jetspeed* files.
> 
The files that are you recommended for patching are not in the CVS. They 
are Torque generated files.

To use Oracle, or any other database besides Hypersonic with Jetspeed-1, 
follow the steps here:

http://portals.apache.org/jetspeed-1/database.html

I believe that the Jetspeed team has made things unnecessarily 
complicated for end users to change their databsae. Asking people to dl 
the source and recompile just to change the database is not user 
friendly and a pain in the ass. Look at all the hell we've caused Dan.

Proposed solution:

Move the Torque generation into a separate sub-project of J1. Create a 
jar for the OM-mapping for each database. Put each of these jars on the 
distribution site with the release:

jetspeed-om-1.6-oracle.jar
jetspeed-om-1.6-mysl.jar
...


-- 
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
[office] +01 707 773 4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org