portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r471845 - in /portals/jetspeed-2/trunk/components/serializer: maven.xml src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
Date Mon, 06 Nov 2006 19:48:16 GMT
Author: taylor
Date: Mon Nov  6 11:48:15 2006
New Revision: 471845

URL: http://svn.apache.org/viewvc?view=rev&rev=471845
Log:
updating serializer to run from command line in build and use a JNDI name for the database
connection based off standard jetspeed properties

Modified:
    portals/jetspeed-2/trunk/components/serializer/maven.xml
    portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java

Modified: portals/jetspeed-2/trunk/components/serializer/maven.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/maven.xml?view=diff&rev=471845&r1=471844&r2=471845
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/maven.xml (original)
+++ portals/jetspeed-2/trunk/components/serializer/maven.xml Mon Nov  6 11:48:15 2006
@@ -25,15 +25,23 @@
         <copy todir='${maven.build.dir}/classes'>
           <fileset dir="../../etc/db-ojb/"/>
         </copy>                      
-        <java classname="org.apache.jetspeed.serializer.JetspeedImporter" fork="yes">
+        <java classname="org.apache.jetspeed.serializer.JetspeedSerializerApplication"
fork="yes">
           <classpath>
             <path refid="maven.dependency.classpath"/>
             <pathelement path="${maven.build.dest}"/>
-            <pathelement path="${org.apache.jetspeed.production.jdbc.drivers.path}"/>
           
+            <pathelement path="${org.apache.jetspeed.production.jdbc.drivers.path}"/>
                         
           </classpath>
+            <arg line="-O USER -E export.xml -b ../../src/webapp/WEB-INF/assembly/boot/
-c ../../src/webapp/WEB-INF/assembly/"/>  
+            <sysproperty key="org.apache.jetspeed.database.url" value="${org.apache.jetspeed.production.database.url}"/>
+            <sysproperty key="org.apache.jetspeed.database.driver" value="${org.apache.jetspeed.production.database.driver}"/>
+            <sysproperty key="org.apache.jetspeed.database.user" value="${org.apache.jetspeed.production.database.user}"/>
+            <sysproperty key="org.apache.jetspeed.database.password" value="${org.apache.jetspeed.production.database.password}"/>
           
         </java>
     </goal>
 	<preGoal name='importer'>
         <attainGoal name="java:compile" />		
 	</preGoal>				
+    <goal name='test2'>
+        <echo message="${org.apache.jetspeed.production.jdbc.drivers.path}"/>
+    </goal>
 </project>

Modified: portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java?view=diff&rev=471845&r1=471844&r2=471845
==============================================================================
--- portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
(original)
+++ portals/jetspeed-2/trunk/components/serializer/src/java/org/apache/jetspeed/serializer/JetspeedSerializerApplication.java
Mon Nov  6 11:48:15 2006
@@ -15,83 +15,16 @@
  */
 package org.apache.jetspeed.serializer;
 
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.security.Principal;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.prefs.Preferences;
 
-import javax.security.auth.Subject;
-
-import javolution.xml.XMLBinding;
-import javolution.xml.XMLObjectWriter;
-
-import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.capabilities.Capabilities;
-import org.apache.jetspeed.capabilities.Capability;
-import org.apache.jetspeed.capabilities.Client;
-import org.apache.jetspeed.capabilities.MediaType;
-import org.apache.jetspeed.capabilities.MimeType;
-import org.apache.jetspeed.components.ComponentManager;
-import org.apache.jetspeed.components.SpringComponentManager;
-import org.apache.jetspeed.engine.JetspeedEngineConstants;
-import org.apache.jetspeed.profiler.Profiler;
-import org.apache.jetspeed.profiler.rules.PrincipalRule;
-import org.apache.jetspeed.profiler.rules.ProfilingRule;
-import org.apache.jetspeed.profiler.rules.RuleCriterion;
-import org.apache.jetspeed.security.BasePrincipal;
-import org.apache.jetspeed.security.Group;
-import org.apache.jetspeed.security.GroupManager;
-import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.PermissionManager;
-import org.apache.jetspeed.security.Role;
-import org.apache.jetspeed.security.RoleManager;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.security.UserManager;
-import org.apache.jetspeed.security.om.InternalPermission;
-import org.apache.jetspeed.security.om.InternalPrincipal;
-import org.apache.jetspeed.security.spi.PasswordCredentialProvider;
-import org.apache.jetspeed.serializer.objects.JSCapabilities;
-import org.apache.jetspeed.serializer.objects.JSCapability;
-import org.apache.jetspeed.serializer.objects.JSClient;
-import org.apache.jetspeed.serializer.objects.JSClientCapabilities;
-import org.apache.jetspeed.serializer.objects.JSClientMimeTypes;
-import org.apache.jetspeed.serializer.objects.JSClients;
-import org.apache.jetspeed.serializer.objects.JSGroup;
-import org.apache.jetspeed.serializer.objects.JSGroups;
-import org.apache.jetspeed.serializer.objects.JSMediaType;
-import org.apache.jetspeed.serializer.objects.JSMediaTypes;
-import org.apache.jetspeed.serializer.objects.JSMimeType;
-import org.apache.jetspeed.serializer.objects.JSMimeTypes;
-import org.apache.jetspeed.serializer.objects.JSNameValuePairs;
-import org.apache.jetspeed.serializer.objects.JSPermission;
-import org.apache.jetspeed.serializer.objects.JSPermissions;
-import org.apache.jetspeed.serializer.objects.JSPrincipalRule;
-import org.apache.jetspeed.serializer.objects.JSPrincipalRules;
-import org.apache.jetspeed.serializer.objects.JSProfilingRule;
-import org.apache.jetspeed.serializer.objects.JSProfilingRules;
-import org.apache.jetspeed.serializer.objects.JSRole;
-import org.apache.jetspeed.serializer.objects.JSRoles;
-import org.apache.jetspeed.serializer.objects.JSRuleCriterion;
-import org.apache.jetspeed.serializer.objects.JSRuleCriterions;
-import org.apache.jetspeed.serializer.objects.JSSnapshot;
-import org.apache.jetspeed.serializer.objects.JSUser;
-import org.apache.jetspeed.serializer.objects.JSUserAttributes;
-import org.apache.jetspeed.serializer.objects.JSUserGroups;
-import org.apache.jetspeed.serializer.objects.JSUserRoles;
-import org.apache.jetspeed.serializer.objects.JSUserUsers;
-import org.apache.jetspeed.serializer.objects.JSUsers;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
+import org.apache.jetspeed.components.jndi.JNDIComponent;
+import org.apache.jetspeed.components.jndi.TyrexJNDIComponent;
 
 /**
  * Jetspeed Serializer Application
@@ -102,8 +35,8 @@
  * invoke with (optional) parameters as
  * <p>-p propertyFilename : overwrite the default filename defined in System.getProperty
JetSpeed.Serializer.Configuration 
  * <p>-a ApplicationPath : overwrite the default ./ or ApplicationPath property in
properties file)
- * <p>-b bootPath : one or more file filer statements (seperated by , ) overwrite the
default assembly/boot/*.xml or bootPath  property in properties file)  
- * <p>-c configPath : one or more file filer statements (seperated by , ) overwrite
the default assembly/*.xml or configPath property in properties file)
+ * <p>-b bootPath : directory to Spring boot files,   overwrite the default assembly/boot/
or bootPath  property in properties file)  
+ * <p>-c configPath : directory to Spring config files,   overwrite the default assembly/
or configPath property in properties file)
  * 
  * <p>-o optionstring : overwrite defrault "ALL,REPLACE"
  * <p>optionstring: 
@@ -126,7 +59,7 @@
  */
 public class JetspeedSerializerApplication
 {
-    
+    public static final String JNDI_DS_NAME = "jetspeed";    
     
     public static void main(String[] args)
     {
@@ -164,7 +97,7 @@
           else if (args[n].equals("-I")) { doImport = true; fileName = args[++n];}
           else if (args[n].equals("-N")) name = args[++n];
           else if (args[n].equals("-O")) options = args[++n];
-          else throw new IllegalArgumentException("Unknown argument.");
+          else throw new IllegalArgumentException("Unknown argument: " + args[n]);
         }
 
         
@@ -213,8 +146,28 @@
         if (bootConfigFiles == null) bootConfigFiles = "assembly/boot/*.xml";
         if (configFiles == null) configFiles = "assembly/*.xml";
 
-        
+        bootConfigFiles = bootConfigFiles + "*.xml";
+        configFiles = configFiles + "*.xml";
+     
         // ok - we are ready to rumble....
+        try
+        {
+            BoundDBCPDatasourceComponent datasourceComponent;        
+            JNDIComponent jndi = new TyrexJNDIComponent();
+            
+            String url = System.getProperty("org.apache.jetspeed.database.url");
+            String driver = System.getProperty("org.apache.jetspeed.database.driver");
+            String user = System.getProperty("org.apache.jetspeed.database.user");
+            String password = System.getProperty("org.apache.jetspeed.database.password");
+            datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver,
url, 20, 5000,
+                    GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
+            datasourceComponent.start();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            System.exit(1);
+        }
         
         /** create the instruction map */
         
@@ -305,4 +258,4 @@
             return s;
         }
 
-}
+}
\ No newline at end of file



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


Mime
View raw message