taylor 2002/07/23 14:18:32
Modified: build build.xml
docs/site changes.html psml_db.html
src/java/org/apache/jetspeed/services/psmlmanager
CastorPsmlManagerService.java PsmlImporter.java
src/java/org/apache/jetspeed/services/psmlmanager/db
DatabasePsmlManagerService.java
webapp/WEB-INF/conf JetspeedResources.properties
webapp/WEB-INF/db jetspeed.properties
xdocs changes.xml psml_db.xml
Log:
- Updated PsmlImporter to run from command line only. Run "ant import"
- Importer now supports exporting both ways (file system to db, db to file system)
- Updated docs for new PSML import-export process
Revision Changes Path
1.153 +2 -9 jakarta-jetspeed/build/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/build/build.xml,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- build.xml 23 Jul 2002 04:54:36 -0000 1.152
+++ build.xml 23 Jul 2002 21:18:31 -0000 1.153
@@ -868,21 +868,14 @@
<target name="import" depends="compile"
description="Import PSML">
- <junit printsummary="yes" haltonfailure="yes" haltonerror="yes" fork="yes">
-
+ <java fork="true"
classname="org.apache.jetspeed.services.psmlmanager.PsmlImporter" >
<classpath>
<pathelement location="${build.dest.dir}"/>
<path refid="classpath"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${hsql.jar}"/>
</classpath>
-
- <formatter type="plain" usefile="false"/>
-
- <!-- JUnit unit tests -->
- <test name="org.apache.jetspeed.services.psmlmanager.TestPsmlImporter"/>
-
- </junit>
+ </java>
</target>
<!-- =================================================================== -->
1.32 +5 -0 jakarta-jetspeed/docs/site/changes.html
Index: changes.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- changes.html 23 Jul 2002 05:33:59 -0000 1.31
+++ changes.html 23 Jul 2002 21:18:32 -0000 1.32
@@ -130,6 +130,11 @@
-->
</ul>
<li>
+ Update - 2002/07/23 - Updated PsmlImporter to run from command line only. Run
"ant import" (DST)
+ - Importer now supports exporting both ways (file system to
db, db to file system) (DST)
+ - Updated docs for new PSML
import-export process (DST)
+</li>
+ <li>
Fix - 2002/07/22 - Fixed bug #8830 to complete PSML page-level security (with
Scott Weaver's patch). (DST)
- Localized page-level security error messages (DST)
- As example, Added "user-only"
security-ref to group/apache/page/news page. (DST)
1.11 +176 -14 jakarta-jetspeed/docs/site/psml_db.html
Index: psml_db.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/psml_db.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- psml_db.html 17 Jul 2002 07:07:23 -0000 1.10
+++ psml_db.html 23 Jul 2002 21:18:32 -0000 1.11
@@ -421,8 +421,10 @@
<tr><td>
<blockquote>
<p>
- To switch to the Database PSML Manager, the following
settings
- will need to be modified in the
JetspeedResources.properties. Here are the default settings:
+ To switch to the Database PSML Manager, modify the
PSML Manager settings in the JetspeedResources.properties.
+ You can select your active PSML Manager service by uncommenting it.
There can only be one PSML Service active.
+ The default is the file-based service:
'CastorPsmlManagerService'. If you uncomment one service, you must comment the other
service.
+ Here are the default setting:
</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
@@ -435,8 +437,6 @@
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
@@ -448,12 +448,8 @@
</table>
</div>
<p>
- To use the Database PSML service, comment out the 1st line
(CastorPsmlManagerService) and then
- uncomment the 2nd and 3rd line. The 3rd line sets the
DatabasePsmlManagerService as the default service.
- The 2nd line enables the PsmlImporter, which is run the very first
time that you start the DatabasePsmlManagerService.
- It imports all the PSML files located in the WEB-INF/psml directory
tree into the database.
- The importer is only ran once, the first time that the Database PSML
Manager detects that the database is empty.
- This is what your entries should look to use the Database PSML
service:
+ To switch to the Database PSML service, you will need to change the settings
in the JetspeedResources.properties.
+ Comment out the default, file-based PSML service:
</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
@@ -466,7 +462,29 @@
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>
+ And then un-comment the Database PSML service:
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
@@ -478,6 +496,56 @@
</tr>
</table>
</div>
+ <p>
+ Next you will need to select the appropriate Importer Service.
+ When exporting from the file system to the database, choose
the File-based service to manage the importing.
+ Its the PsmlImportManager service that manages the import
process, actually exporting from its datastore to the consumer datastore.
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>
+ Finally, run the import process. From the /build directory,
type:
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+ant import
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
</blockquote>
</p>
</td></tr>
@@ -492,10 +560,104 @@
<tr><td>
<blockquote>
<p>
- This feature is implemented, but has not yet been enabled.
- In order to run it, you will need to modify the
CastorPsmlManagerService to import on startup.
- Reference the Database PSML Manager for an example of how to
do this.
+ You may need export your PSML from the database to the file
system.
+ Here are the steps to do so.
+ Choose the File-based PSML manager:
</p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>
+ Next you will need to select the Database PSML service as your
Importer Service.
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>
+ Choose the location on your file system where you'd like to
export to:
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+services.PsmlManager.root=/tmp/psml7
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>
+ Finally, run the import process. From the /build directory,
type:
+ </p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+ant import
+ </pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ </table>
+ </div>
</blockquote>
</p>
</td></tr>
1.26 +28 -5
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
Index: CastorPsmlManagerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- CastorPsmlManagerService.java 5 Jul 2002 03:38:03 -0000 1.25
+++ CastorPsmlManagerService.java 23 Jul 2002 21:18:32 -0000 1.26
@@ -193,12 +193,25 @@
//If the rootDir does not exist, treat it as context relative
if ( !rootDir.exists() )
{
- this.rootDir = new File(conf.getServletContext().getRealPath(root));
+ try
+ {
+ this.rootDir = new File(conf.getServletContext().getRealPath(root));
+ }
+ catch (Exception e)
+ {
+ // this.rootDir = new File("./webapp" + this.rootDir.toString());
+ }
}
//If it is still missing, try to create it
if (!rootDir.exists())
{
- rootDir.mkdirs();
+ try
+ {
+ rootDir.mkdirs();
+ }
+ catch (Exception e)
+ {
+ }
}
// get default extension
@@ -765,7 +778,7 @@
{
File base = this.rootDir;
String path = mapLocatorToFile((ProfileLocator)profile);
- //Log.info("PSML-Man: calculated resource:" + path);
+ Log.debug("PSML-Man: calculated resource:" + path);
File file = new File(base, path);
String name = file.getAbsolutePath();
@@ -779,7 +792,16 @@
filePath.mkdirs();
if (template.getName() != null)
{
- FileCopy.copy( template.getName(), name );
+ try
+ {
+ File source = new File(template.getName());
+ if (source.exists())
+ {
+ FileCopy.copy( template.getName(), name );
+ }
+ }
+ catch (Exception e)
+ {}
}
else
{
@@ -790,6 +812,7 @@
catch (Exception e)
{
Log.error("Failed to save document: " , e);
+ e.printStackTrace();
}
return doc;
}
1.11 +99 -43
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlImporter.java
Index: PsmlImporter.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlImporter.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- PsmlImporter.java 23 Jul 2002 04:54:36 -0000 1.10
+++ PsmlImporter.java 23 Jul 2002 21:18:32 -0000 1.11
@@ -77,7 +77,6 @@
import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.util.Log;
-import javax.servlet.ServletConfig;
/**
* Reads all PSML files from the file system and imports them into PSML DB
@@ -91,72 +90,128 @@
{
}
- public void run(ServletConfig conf)
+ public static void main(String args[])
+ {
+ System.out.println("***** PSML Importer *****");
+
+ //
+ // initialize and bootstrap services
+ //
+ try
+ {
+ TurbineConfig config = new TurbineConfig( "./webapp",
"/WEB-INF/conf/TurbineResources.properties");
+ config.init();
+ }
+ catch (Exception e)
+ {
+ String msg = "PSML Importer: error initializing Turbine configuration";
+ Log.error(msg, e);
+ System.out.println(msg);
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ //
+ // get a handle to the exporter service
+ //
+ PsmlManagerService exporterService = null;
+ PsmlManagerService importerService = null;
+
+ try
+ {
+ exporterService =
(PsmlManagerService)TurbineServices.getInstance().getService("PsmlImportManager");
+ }
+ catch (org.apache.turbine.services.InstantiationException e)
+ {
+ String msg = "PSML Importer: error loading Psml Exporter Service";
+ Log.error(msg, e);
+ System.out.println(msg);
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ //
+ // get a handle to the importer service
+ //
+ try
+ {
+ importerService = PsmlManager.getService();
+ }
+ catch (org.apache.turbine.services.InstantiationException e)
+ {
+ String msg = "PSML Importer: error loading Psml Importer Service";
+ Log.error(msg, e);
+ System.out.println(msg);
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ if
(exporterService.getClass().getName().equals(importerService.getClass().getName()))
+ {
+ String msg = "PSML Importer Error: Importer Class cannot equal Exporter
Class.";
+ Log.error(msg);
+ System.out.println(msg);
+ System.exit(0);
+ }
+
+ PsmlImporter importer = new PsmlImporter();
+ boolean ran = importer.run(exporterService, importerService);
+
+ if (ran)
+ {
+ System.out.println("**** PSML Importer - completed");
+ }
+
+ System.exit(1);
+
+ }
+
+ public boolean run(PsmlManagerService exporterService,
+ PsmlManagerService importerService)
{
String msg;
int count = 0;
try
{
if (alreadyImported())
- return;
+ return false;
- PsmlManagerService fileService = null;
- try
- {
- fileService = (PsmlManagerService)
- TurbineServices.getInstance().getService("PsmlImportManager");
- if (null == fileService)
- return;
- }
- catch(org.apache.turbine.services.InstantiationException ie)
- {
- Log.info("PSMLImporter disabled");
- return;
- }
+ msg = "Running with Importer Service: " + importerService.getClass();
+ System.out.println(msg);
+ Log.info(msg);
- msg = "Running PSMLImporter...";
+ msg = "Running with Exporter Service: " + exporterService.getClass();
System.out.println(msg);
Log.info(msg);
+
QueryLocator locator = new QueryLocator(QueryLocator.QUERY_ALL);
- count = fileService.export(PsmlManager.getService(), locator);
+ count = exporterService.export(importerService, locator);
}
catch (Exception e)
{
System.out.println("Error importing: " + e.toString());
Log.error("Error importing: " , e);
e.printStackTrace();
+ return false;
}
msg = "PSMLImporter completed. Exported " + count + " profiles";
System.out.println(msg);
Log.info(msg);
+ return true;
}
- private void dumpProfile(Profile profile)
- {
- JetspeedUser user = profile.getUser();
- Group group = profile.getGroup();
- Role role = profile.getRole();
- if (profile.getAnonymous() == true)
- System.out.println("ANON USER");
- System.out.println("RESOURCE = " + profile.getName());
- if (null != user)
- System.out.println("USER = " + user.getUserName() );
- if (null != group)
- System.out.println("GROUP = " + group.getName() );
- if (null != role)
- System.out.println("ROLE = " + role.getName() );
- System.out.println("MEDIA TYPE = " + profile.getMediaType());
- System.out.println("LANGUAGE = " + profile.getLanguage());
- System.out.println("COUNTRY = " + profile.getCountry());
- System.out.println("----------------------");
- }
- private boolean alreadyImported()
+ /*
+ * Check to see if import has already completed.
+ * Only considers a "onetime" import, checking for the "admin" user.
+ *
+ * @return true if import was already ran.
+ */
+ public boolean alreadyImported()
{
try
{
-System.out.println("starting import...");
JetspeedUser user = JetspeedSecurity.getUser("admin");
QueryLocator ql = new QueryLocator(QueryLocator.QUERY_USER);
ql.setUser(user);
@@ -176,10 +231,11 @@
}
catch (JetspeedSecurityException e)
{
- Log.error("Error detecting database on import: " , e);
- System.out.println("Error detecting database on import: " +
e.toString());
+ String msg = "Failed to run import: Database Access Error detecting
database on import: ";
+ Log.error(msg, e);
+ System.out.println(msg + e.toString());
+ return true;
}
- return false;
}
}
1.19 +4 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java
Index: DatabasePsmlManagerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DatabasePsmlManagerService.java 23 Jul 2002 04:54:36 -0000 1.18
+++ DatabasePsmlManagerService.java 23 Jul 2002 21:18:32 -0000 1.19
@@ -1082,6 +1082,7 @@
profile.setLanguage(entity.getLanguage());
profile.setCountry(entity.getCountry());
profile.setName(entity.getPage());
+ profile.setDocument(getPSMLDocument(entity.getPage(), portlets));
}
catch (JetspeedSecurityException e)
{
@@ -1112,6 +1113,7 @@
profile.setLanguage(entity.getLanguage());
profile.setCountry(entity.getCountry());
profile.setName(entity.getPage());
+ profile.setDocument(getPSMLDocument(entity.getPage(), portlets));
}
catch (JetspeedSecurityException e)
{
@@ -1142,6 +1144,7 @@
profile.setLanguage(entity.getLanguage());
profile.setCountry(entity.getCountry());
profile.setName(entity.getPage());
+ profile.setDocument(getPSMLDocument(entity.getPage(), portlets));
}
catch (JetspeedSecurityException e)
{
1.82 +28 -7
jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties
Index: JetspeedResources.properties
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedResources.properties,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- JetspeedResources.properties 4 Jul 2002 00:01:10 -0000 1.81
+++ JetspeedResources.properties 23 Jul 2002 21:18:32 -0000 1.82
@@ -337,13 +337,34 @@
#########################################
# PSMLManager Service #
#########################################
-# to use the databaase PSML service, comment out the 1st line
(CastorPsmlManagerService as PsmlManager)
-# and uncomment the 3rd line to enable the DatabasePsmlManagerService
-# (for the default system, it will be necessary to run the PSMLImporter once)
-# to run the importer, uncomment the 2nd and 3rd lines, and then you can optionally
re-comment the PsmlImportManager when done
+# Select your PSML Manager service by uncommenting it. The default is
'CastorPsmlManagerService'
+# If you uncomment one service, you must comment-out the other service
+########################################################################################################
+
+########################################################################################################
+# To use the File-based PSML service, select (uncomment) this service (this is the
default setting):
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+########################################################################################################
+########################################################################################################
+# To use the DB-PSML service, select (uncomment) this service, and comment out the
above service:
+#
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+########################################################################################################
+
+#########################################
+# PSMLImportManager Service #
+#########################################
+# Select your PSML Import Manager service by uncommenting it. The default is
'CastorPsmlManagerService'
+# If you uncomment one importer service, you must comment-out the other service
+# You must run the importer manually. From the build directory, type 'ant import'
+# the PsmlImportManager is the service which will export the psml from its
datastore to the current
+# PsmlManager's datastore. The PsmlImportManager and PsmlManager should never be
the same.
+########################################################################################################
+
+# Select this service to import from File System to the Database (make sure that
DatabasePsmlManagerService is selected above)
+services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+
+# Select this service to import from the Database to the File System (make sure
that CastorPsmlManagerService is selected above)
+#
services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
services.PsmlManager.root=/WEB-INF/psml
services.PsmlManager.ext=.psml
1.17 +1 -1 jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties
Index: jetspeed.properties
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- jetspeed.properties 23 Jul 2002 04:54:36 -0000 1.16
+++ jetspeed.properties 23 Jul 2002 21:18:32 -0000 1.17
@@ -1,4 +1,4 @@
#Hypersonic SQL database
-#Mon Jul 22 18:59:57 PDT 2002
+#Tue Jul 23 12:35:23 PDT 2002
version=1.4
modified=yes
1.52 +6 -1 jakarta-jetspeed/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- changes.xml 23 Jul 2002 05:33:59 -0000 1.51
+++ changes.xml 23 Jul 2002 21:18:32 -0000 1.52
@@ -24,6 +24,11 @@
-->
</ul>
<li>
+ Update - 2002/07/23 - Updated PsmlImporter to run from command line only. Run
"ant import" (DST)
+ - Importer now supports exporting both ways (file system to
db, db to file system) (DST)
+ - Updated docs for new PSML
import-export process (DST)
+</li>
+<li>
Fix - 2002/07/22 - Fixed bug #8830 to complete PSML page-level security (with
Scott Weaver's patch). (DST)
- Localized page-level security error messages (DST)
- As example, Added "user-only"
security-ref to group/apache/page/news page. (DST)
1.5 +51 -15 jakarta-jetspeed/xdocs/psml_db.xml
Index: psml_db.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/psml_db.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- psml_db.xml 17 Jul 2002 06:29:32 -0000 1.4
+++ psml_db.xml 23 Jul 2002 21:18:32 -0000 1.5
@@ -169,34 +169,70 @@
</section>
<section name="Converting from PSML files to a PSML Database">
<p>
- To switch to the Database PSML Manager, the following
settings
- will need to be modified in the
JetspeedResources.properties. Here are the default settings:
+ To switch to the Database PSML Manager, modify the
PSML Manager settings in the JetspeedResources.properties.
+ You can select your active PSML Manager service by uncommenting it.
There can only be one PSML Service active.
+ The default is the file-based service:
'CastorPsmlManagerService'. If you uncomment one service, you must comment the other
service.
+ Here are the default setting:
</p>
- <source>
+ <source>
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
</source>
<p>
- To use the Database PSML service, comment out the 1st line
(CastorPsmlManagerService) and then
- uncomment the 2nd and 3rd line. The 3rd line sets the
DatabasePsmlManagerService as the default service.
- The 2nd line enables the PsmlImporter, which is run the very first
time that you start the DatabasePsmlManagerService.
- It imports all the PSML files located in the WEB-INF/psml directory
tree into the database.
- The importer is only ran once, the first time that the Database PSML
Manager detects that the database is empty.
- This is what your entries should look to use the Database PSML
service:
+ To switch to the Database PSML service, you will need to change the settings
in the JetspeedResources.properties.
+ Comment out the default, file-based PSML service:
</p>
<source>
#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
-services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+ </source>
+ <p>
+ And then un-comment the Database PSML service:
+ </p>
+ <source>
services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
</source>
+ <p>
+ Next you will need to select the appropriate Importer Service.
+ When exporting from the file system to the database, choose
the File-based service to manage the importing.
+ Its the PsmlImportManager service that manages the import
process, actually exporting from its datastore to the consumer datastore.
+ </p>
+ <source>
+services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+ </source>
+ <p>
+ Finally, run the import process. From the /build directory,
type:
+ </p>
+ <source>
+ant import
+ </source>
</section>
<section name="Converting from a PSML Database to PSML files">
<p>
- This feature is implemented, but has not yet been enabled.
- In order to run it, you will need to modify the
CastorPsmlManagerService to import on startup.
- Reference the Database PSML Manager for an example of how to
do this.
+ You may need export your PSML from the database to the file
system.
+ Here are the steps to do so.
+ Choose the File-based PSML manager:
</p>
+ <source>
+services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.CastorPsmlManagerService
+#services.PsmlManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+ </source>
+ <p>
+ Next you will need to select the Database PSML service as your
Importer Service.
+ </p>
+ <source>
+services.PsmlImportManager.classname=org.apache.jetspeed.services.psmlmanager.db.DatabasePsmlManagerService
+ </source>
+ <p>
+ Choose the location on your file system where you'd like to
export to:
+ </p>
+ <source>
+services.PsmlManager.root=/tmp/psml7
+ </source>
+ <p>
+ Finally, run the import process. From the /build directory,
type:
+ </p>
+ <source>
+ant import
+ </source>
</section>
<section name="PSML Database Maintance">
<p>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>