You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2010/03/25 14:02:43 UTC

svn commit: r927379 - in /incubator/lcf/trunk/modules: connectors/meridio/ connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/ connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/ framework/core/org/apache/l...

Author: kwright
Date: Thu Mar 25 13:02:42 2010
New Revision: 927379

URL: http://svn.apache.org/viewvc?rev=927379&view=rev
Log:
Redo property access so that:
(1) you can use either -D switches or property.ini parameters, for most properties;
(2) SharePoint and Meridio wsdd's are done this way also;
(3) Lock Manager implementation is configurable by means of property as well.

Modified:
    incubator/lcf/trunk/modules/connectors/meridio/build.xml
    incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioAuthority.java
    incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java
    incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java
    incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/LockClean.java
    incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/interfaces/LockManagerFactory.java
    incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/lockmanager/LockManager.java
    incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java

Modified: incubator/lcf/trunk/modules/connectors/meridio/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/meridio/build.xml?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/meridio/build.xml (original)
+++ incubator/lcf/trunk/modules/connectors/meridio/build.xml Thu Mar 25 13:02:42 2010
@@ -110,7 +110,7 @@
 
     <target name="compile-xsds" depends="classcreate-xsds,precompile-check" if="canBuild">
         <mkdir dir="build/xsdclasses"/>
-        <javac srcdir="build/xsdjava" destdir="build/xsdclasses" target="1.5" source="1.4">
+        <javac srcdir="build/xsdjava" destdir="build/xsdclasses" target="1.5" source="1.5">
             <classpath>
                 <fileset dir="lib" includes="*.jar"/>
             </classpath>
@@ -119,7 +119,7 @@
 
     <target name="doc" depends="precompile-check,compile-wsdls,compile-xsds" if="canBuild">
         <mkdir dir="doc"/>
-        <javadoc destdir="doc" source="1.4">
+        <javadoc destdir="doc" source="1.5">
             <classpath>
                 <fileset dir="lib" includes="*.jar"/>
                 <pathelement location="build/wsdljava"/>

Modified: incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioAuthority.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioAuthority.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioAuthority.java (original)
+++ incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioAuthority.java Thu Mar 25 13:02:42 2010
@@ -25,6 +25,7 @@ import org.apache.lcf.crawler.connectors
 import org.apache.lcf.crawler.connectors.meridio.RMDataSet.RMDataSet;
 import org.tempuri.GroupResult;
 import org.apache.lcf.authorities.system.Logging;
+import org.apache.lcf.authorities.system.LCF;
 import org.apache.lcf.authorities.interfaces.AuthorizationResponse;
 
 import org.apache.commons.httpclient.protocol.Protocol;
@@ -44,6 +45,9 @@ public class MeridioAuthority extends or
 {
   public static final String _rcsid = "@(#)$Id$";
 
+  // Properties we need
+  public final static String wsddPathProperty = "org.apache.lcf.meridio.wsddpath";
+
   private MeridioWrapper meridio_       = null;  // A handle to the Meridio Java API Wrapper
 
   // URLs initialized by 'connect' code
@@ -209,9 +213,9 @@ public class MeridioAuthority extends or
         * Now try and login to Meridio; the wrapper's constructor can be
         * used as it calls the Meridio login method
         *================================================================*/
-        String meridioWSDDLocation = System.getProperty("org.apache.lcf.meridio.wsddpath");
+        String meridioWSDDLocation = LCF.getProperty(wsddPathProperty);
         if (meridioWSDDLocation == null)
-          throw new LCFException("Meridio wsdd location path (property org.apache.lcf.meridio.wsddpath) must be specified!");
+          throw new LCFException("Meridio wsdd location path (property "+wsddPathProperty+") must be specified!");
 
         meridio_ = new MeridioWrapper(Logging.authorityConnectors, DmwsURL, RmwsURL, MetaCartawsURL,
           DMWSProxyHost, DMWSProxyPort, RMWSProxyHost, RMWSProxyPort, MetaCartaWSProxyHost, MetaCartaWSProxyPort,

Modified: incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/meridio/connector/org/apache/lcf/crawler/connectors/meridio/MeridioConnector.java Thu Mar 25 13:02:42 2010
@@ -29,6 +29,7 @@ import org.apache.lcf.crawler.connectors
 import org.apache.lcf.crawler.connectors.meridio.meridiowrapper.MeridioWrapper;
 import org.apache.lcf.crawler.interfaces.*;
 import org.apache.lcf.crawler.system.Logging;
+import org.apache.lcf.crawler.system.LCF;
 
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.protocol.ProtocolFactory;
@@ -62,6 +63,9 @@ public class MeridioConnector extends or
 {
   public static final String _rcsid = "@(#)$Id$";
 
+  // Properties we need
+  public final static String wsddPathProperty = "org.apache.lcf.meridio.wsddpath";
+
   // This is the base url to use.
   protected String urlBase = null;
   protected String urlVersionBase = null;
@@ -190,9 +194,9 @@ public class MeridioConnector extends or
         * Now try and login to Meridio; the wrapper's constructor can be
         * used as it calls the Meridio login method
         *================================================================*/
-        String meridioWSDDLocation = System.getProperty("org.apache.lcf.meridio.wsddpath");
+        String meridioWSDDLocation = LCF.getProperty(wsddPathProperty);
         if (meridioWSDDLocation == null)
-          throw new LCFException("Meridio wsdd location path (property org.apache.lcf.meridio.wsddpath) must be specified!");
+          throw new LCFException("Meridio wsdd location path (property "+wsddPathProperty+") must be specified!");
 
         meridio_ = new MeridioWrapper(Logging.connectors, DmwsURL, RmwsURL, null,
           params.getParameter("DMWSProxyHost"),

Modified: incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ incubator/lcf/trunk/modules/connectors/sharepoint/connector/org/apache/lcf/crawler/connectors/sharepoint/SharePointRepository.java Thu Mar 25 13:02:42 2010
@@ -52,6 +52,9 @@ public class SharePointRepository extend
 {
   public static final String _rcsid = "@(#)$Id$";
 
+  // Properties we need
+  public final static String wsddPathProperty = "org.apache.lcf.sharepoint.wsddpath";
+
   // Activities we log
   public final static String ACTIVITY_FETCH = "fetch";
 
@@ -184,9 +187,9 @@ public class SharePointRepository extend
 
       fileBaseUrl = serverUrl + encodedServerLocation;
 
-      String sharepointWSDDLocation = System.getProperty("org.apache.lcf.sharepoint.wsddpath");
+      String sharepointWSDDLocation = LCF.getProperty(wsddPathProperty);
       if (sharepointWSDDLocation == null)
-        throw new LCFException("SharePoint wsdd location path (property org.apache.lcf.sharepoint.wsddpath) must be specified!");
+        throw new LCFException("SharePoint wsdd location path (property "+wsddPathProperty+") must be specified!");
 
       proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName, password, myFactory, sharepointWSDDLocation,
         connectionManager );

Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/LockClean.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/LockClean.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/LockClean.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/LockClean.java Thu Mar 25 13:02:42 2010
@@ -39,7 +39,7 @@ public class LockClean
     }
 
     LCF.initializeEnvironment();
-    String synchDir = LCF.getProperty(LCF.synchDirectoryProperty);
+    String synchDir = LCF.getProperty(org.apache.lcf.core.lockmanager.LockManager.synchDirectoryProperty);
     if (synchDir != null)
     {
       // Recursively clean up the contents of the synch directory.

Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/interfaces/LockManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/interfaces/LockManagerFactory.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/interfaces/LockManagerFactory.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/interfaces/LockManagerFactory.java Thu Mar 25 13:02:42 2010
@@ -18,6 +18,8 @@
 */
 package org.apache.lcf.core.interfaces;
 
+import org.apache.lcf.core.system.LCF;
+
 public class LockManagerFactory
 {
   public static final String _rcsid = "@(#)$Id$";
@@ -38,8 +40,37 @@ public class LockManagerFactory
     Object x = context.get(lockManager);
     if (x == null || !(x instanceof ILockManager))
     {
-      x = new org.apache.lcf.core.lockmanager.LockManager();
-      context.save(lockManager,x);
+      String implementationClass = LCF.getProperty(LCF.lockManagerImplementation);
+      if (implementationClass == null)
+        implementationClass = "org.apache.lcf.core.lockmanager.LockManager";
+      try
+      {
+        Class c = Class.forName(implementationClass);
+        x = c.newInstance();
+        if (!(x instanceof ILockManager))
+          throw new LCFException("Lock manager class "+implementationClass+" does not implement ILockManager",LCFException.SETUP_ERROR);
+        context.save(lockManager,x);
+      }
+      catch (ClassNotFoundException e)
+      {
+        throw new LCFException("Lock manager class "+implementationClass+" could not be found: "+e.getMessage(),e,LCFException.SETUP_ERROR);
+      }
+      catch (ExceptionInInitializerError e)
+      {
+        throw new LCFException("Lock manager class "+implementationClass+" could not be instantiated: "+e.getMessage(),e,LCFException.SETUP_ERROR);
+      }
+      catch (LinkageError e)
+      {
+        throw new LCFException("Lock manager class "+implementationClass+" could not be linked: "+e.getMessage(),e,LCFException.SETUP_ERROR);
+      }
+      catch (InstantiationException e)
+      {
+        throw new LCFException("Lock manager class "+implementationClass+" could not be instantiated: "+e.getMessage(),e,LCFException.SETUP_ERROR);
+      }
+      catch (IllegalAccessException e)
+      {
+        throw new LCFException("Lock manager class "+implementationClass+" had no public default initializer: "+e.getMessage(),e,LCFException.SETUP_ERROR);
+      }
     }
     return (ILockManager)x;
   }

Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/lockmanager/LockManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/lockmanager/LockManager.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/lockmanager/LockManager.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/lockmanager/LockManager.java Thu Mar 25 13:02:42 2010
@@ -31,6 +31,9 @@ public class LockManager implements ILoc
 {
   public static final String _rcsid = "@(#)$Id$";
 
+  /** Synchronization directory property - local to this implementation of ILockManager */
+  public static final String synchDirectoryProperty = "org.apache.lcf.synchdirectory";
+
   // These are the lock/section types, in order of escalation
   protected final static int TYPE_READ = 1;
   protected final static int TYPE_WRITENONEX = 2;
@@ -50,7 +53,11 @@ public class LockManager implements ILoc
   public LockManager()
     throws LCFException
   {
-    synchDirectory = LCF.getProperty(LCF.synchDirectoryProperty);
+    synchDirectory = LCF.getProperty(synchDirectoryProperty);
+    if (synchDirectory == null)
+      throw new LCFException("Property "+synchDirectoryProperty+" must be set!",LCFException.SETUP_ERROR);
+    if (!new File(synchDirectory).isDirectory())
+      throw new LCFException("Property "+synchDirectoryProperty+" must point to an existing, writeable directory!",LCFException.SETUP_ERROR);
   }
 
 

Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java?rev=927379&r1=927378&r2=927379&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/system/LCF.java Thu Mar 25 13:02:42 2010
@@ -63,22 +63,34 @@ public class LCF
   // System property names
   public static final String lcfConfigFileProperty = "org.apache.lcf.configfile";
 
-  // Property file property names
+  // System property/property file property names
+  
+  // Database access properties
+  /** Database name property */
   public static final String masterDatabaseNameProperty = "org.apache.lcf.database.name";
+  /** Database user name property */
   public static final String masterDatabaseUsernameProperty = "org.apache.lcf.database.username";
+  /** Database password property */
   public static final String masterDatabasePasswordProperty = "org.apache.lcf.database.password";
 
+  // Database connection pooling properties
+  /** Maximum open database handles property */
   public static final String databaseHandleMaxcountProperty = "org.apache.lcf.database.maxhandles";
+  /** Database handle timeout property */
   public static final String databaseHandleTimeoutProperty = "org.apache.lcf.database.handletimeout";
 
-  public static final String synchDirectoryProperty = "org.apache.lcf.synchdirectory";
+  // Log configuration properties
+  /** Location of log configuration file */
   public static final String logConfigFileProperty = "org.apache.lcf.logconfigfile";
   
-
-  /** Hack for BPA */
+  // Implementation class properties
+  /** Lock manager implementation class */
+  public static final String lockManagerImplementation = "org.apache.lcf.lockmanagerclass";
+  
+  // The following are system integration properties
+  /** Script to invoke when configuration changes, if any */
   public static final String configSignalCommandProperty = "org.apache.lcf.configuration.change.command";
-
-  /** Maintenance signal file */
+  /** File to look for to block access to UI during database maintenance */
   public static final String maintenanceFileSignalProperty = "org.apache.lcf.database.maintenanceflag";
 
   /** Initialize environment.
@@ -168,13 +180,16 @@ public class LCF
     }
   }
 
-  /** Read a property.
+  /** Read a property, either from the system properties, or from the local property file image.
   *@param s is the property name.
-  *@return the property value, as an object.
+  *@return the property value, as a string.
   */
   public static final String getProperty(String s)
   {
-    return localProperties.getProperty(s);
+    String rval = System.getProperty(s);
+    if (rval == null)
+      rval = localProperties.getProperty(s);
+    return rval;
   }
 
   /** Attempt to make sure a path is a folder