manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1226420 - in /incubator/lcf/branches/CONNECTORS-353: ./ connectors/meridio/ connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/ connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawl...
Date Mon, 02 Jan 2012 13:58:03 GMT
Author: kwright
Date: Mon Jan  2 13:58:03 2012
New Revision: 1226420

URL: http://svn.apache.org/viewvc?rev=1226420&view=rev
Log:
Do the Meridio work, and generalize the ResourceProvider class somewhat

Added:
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/manifoldcf/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/manifoldcf/crawler/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/meridio/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/meridio/meridio-client-config.wsdd
      - copied unchanged from r1226360, incubator/lcf/branches/CONNECTORS-353/connectors/meridio/meridio-client-config.wsdd
Removed:
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/resouce/
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/meridio-client-config.wsdd
Modified:
    incubator/lcf/branches/CONNECTORS-353/build.xml
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/build.xml
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
    incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/meridiowrapper/MeridioWrapper.java
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java

Modified: incubator/lcf/branches/CONNECTORS-353/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/build.xml?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/build.xml (original)
+++ incubator/lcf/branches/CONNECTORS-353/build.xml Mon Jan  2 13:58:03 2012
@@ -1719,18 +1719,12 @@
         <copy todir="dist/connector-lib">
             <fileset dir="connectors/meridio/dist/lib"/>
         </copy>
-        <mkdir dir="dist/wsdd"/>
-        <copy todir="dist/wsdd">
-            <fileset dir="connectors/meridio/dist/wsdd"/>
-        </copy>
         <mkdir dir="dist/meridio-integration"/>
         <copy todir="dist/meridio-integration">
             <fileset dir="connectors/meridio/dist/integration"/>
         </copy>
         <replace file="dist/connectors.xml" token="&lt;!-- Add your authority connectors
here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;
 &lt;authorityconnector name=&quot;Meridio&quot; class=&quot;org.apache.manifoldcf.crawler.connectors.meridio.MeridioAuthority&quot;/&gt;"/>
         <replace file="dist/connectors.xml" token="&lt;!-- Add your repository connectors
here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;
 &lt;repositoryconnector name=&quot;Meridio&quot; class=&quot;org.apache.manifoldcf.crawler.connectors.meridio.MeridioConnector&quot;/&gt;"/>
-        <replace file="dist/example/properties.xml" token="&lt;!-- WSDD references
--&gt;" value="&lt;!-- WSDD references --&gt;&#0010;  &lt;property name=&quot;org.apache.manifoldcf.meridio.wsddpath&quot;
value=&quot;../wsdd/meridio-client-config.wsdd&quot;/&gt;"/>
-        <replace file="dist/multiprocess-example/properties.xml" token="&lt;!-- WSDD
references --&gt;" value="&lt;!-- WSDD references --&gt;&#0010;  &lt;property
name=&quot;org.apache.manifoldcf.meridio.wsddpath&quot; value=&quot;../wsdd/meridio-client-config.wsdd&quot;/&gt;"/>
     </target>
     
     <target name="deliver-meridio-connector-doc" depends="calculate-meridio-doc-condition"
if="meridio-doc.include">

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/meridio/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/meridio/build.xml?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/meridio/build.xml (original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/meridio/build.xml Mon Jan  2 13:58:03
2012
@@ -175,11 +175,6 @@
         <jar destfile="build/jar/mcf-meridio-xsdstub.jar" basedir="build/xsdclasses"/>
     </target>
 
-    <target name="wsdd" depends="precompile-check" if="canBuild">
-        <mkdir dir="dist/wsdd"/>
-        <copy todir="dist/wsdd" file="meridio-client-config.wsdd"/>
-    </target>
-    
     <target name="integration">
         <mkdir dir="dist/integration"/>
         <copy todir="dist/integration">
@@ -211,7 +206,7 @@
         </copy>
     </target>
 
-    <target name="build" depends="lib,wsdd,integration"/>
+    <target name="build" depends="lib,integration"/>
     <target name="build-tests">
       <mkdir dir="build/test-jar"/>
     </target>

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
(original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
Mon Jan  2 13:58:03 2012
@@ -221,16 +221,13 @@ 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
         *================================================================*/
-        File meridioWSDDLocation = ManifoldCF.getFileProperty(wsddPathProperty);
-        if (meridioWSDDLocation == null)
-          throw new ManifoldCFException("Meridio wsdd location path (property "+wsddPathProperty+")
must be specified!");
-
         meridio_ = new MeridioWrapper(Logging.authorityConnectors, DmwsURL, RmwsURL, MetaCartawsURL,
           DMWSProxyHost, DMWSProxyPort, RMWSProxyHost, RMWSProxyPort, MetaCartaWSProxyHost,
MetaCartaWSProxyPort,
           UserName, Password,
           InetAddress.getLocalHost().getHostName(),
           myFactory,
-          meridioWSDDLocation.toString());
+          getClass(),
+          "meridio-client-config.wsdd");
       }
       catch (UnknownHostException unknownHostException)
       {

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
(original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
Mon Jan  2 13:58:03 2012
@@ -183,10 +183,6 @@ 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
         *================================================================*/
-        File meridioWSDDLocation = ManifoldCF.getFileProperty(wsddPathProperty);
-        if (meridioWSDDLocation == null)
-          throw new ManifoldCFException("Meridio wsdd location path (property "+wsddPathProperty+")
must be specified!");
-
         meridio_ = new MeridioWrapper(Logging.connectors, DmwsURL, RmwsURL, null,
           params.getParameter("DMWSProxyHost"),
           params.getParameter("DMWSProxyPort"),
@@ -199,7 +195,8 @@ public class MeridioConnector extends or
           params.getObfuscatedParameter("Password"),
           InetAddress.getLocalHost().getHostName(),
           myFactory,
-          meridioWSDDLocation.toString());
+          getClass(),
+          "meridio-client-config.wsdd");
       }
       catch (UnknownHostException unknownHostException)
       {

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/meridiowrapper/MeridioWrapper.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/meridiowrapper/MeridioWrapper.java?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/meridiowrapper/MeridioWrapper.java
(original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/meridiowrapper/MeridioWrapper.java
Mon Jan  2 13:58:03 2012
@@ -38,10 +38,25 @@ import org.apache.axis.holders.*;
 import org.apache.axis.message.*;
 import org.apache.log4j.Logger;
 
+import javax.xml.namespace.QName;
+
 import org.apache.commons.httpclient.protocol.ProtocolFactory;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.axis.EngineConfiguration;
-import org.apache.axis.configuration.FileProvider;
+import org.apache.axis.AxisEngine;
+import org.apache.axis.ConfigurationException;
+import org.apache.axis.Handler;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.components.logger.LogFactory;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDDocument;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.encoding.TypeMappingRegistry;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.utils.Admin;
+import org.apache.axis.utils.Messages;
+import org.apache.axis.utils.XMLUtils;
+import org.w3c.dom.Document;
 
 import org.exolab.castor.xml.MarshalException;
 import org.exolab.castor.xml.ValidationException;
@@ -156,6 +171,7 @@ public class MeridioWrapper
     String password,
     String clientWorkstation,
     ProtocolFactory protocolFactory,
+    Class resourceClass,
     String engineConfigurationFile
   )
     throws RemoteException
@@ -163,7 +179,7 @@ public class MeridioWrapper
     // Initialize local instance variables
     oLog = log;
     this.protocolFactory = protocolFactory;
-    this.engineConfiguration = new FileProvider(engineConfigurationFile);
+    this.engineConfiguration = new ResourceProvider(resourceClass,engineConfigurationFile);
     this.connectionManager = new MultiThreadedHttpConnectionManager();
     this.connectionManager.getParams().setMaxTotalConnections(1);
     this.clientWorkstation = clientWorkstation;
@@ -2138,5 +2154,170 @@ public class MeridioWrapper
     }
   }
 
+  /** Implementation of EngineConfiguration that we'll use to get the wsdd file from a
+  * local resource.
+  */
+  protected static class ResourceProvider implements WSDDEngineConfiguration
+  {
+    private WSDDDeployment deployment = null;
+
+    private Class resourceClass;
+    private String resourceName;
+
+    /**
+     * Constructor setting the resource name.
+     */
+    public ResourceProvider(Class resourceClass, String resourceName) 
+    {
+      this.resourceClass = resourceClass;
+      this.resourceName = resourceName;
+    }
+
+    public WSDDDeployment getDeployment() {
+        return deployment;
+    }
+
+    public void configureEngine(AxisEngine engine)
+      throws ConfigurationException
+    {
+      try
+      {
+        InputStream resourceStream = resourceClass.getResourceAsStream(resourceName);
+        if (resourceStream == null)
+          throw new ConfigurationException("Resource not found: '"+resourceName+"'");
+        try
+        {
+          WSDDDocument doc = new WSDDDocument(XMLUtils.newDocument(resourceStream));
+          deployment = doc.getDeployment();
+
+          deployment.configureEngine(engine);
+          engine.refreshGlobalOptions();
+        }
+        finally
+        {
+          resourceStream.close();
+        }
+      }
+      catch (ConfigurationException e)
+      {
+        throw e;
+      }
+      catch (Exception e)
+      {
+        throw new ConfigurationException(e);
+      }
+    }
+
+    public void writeEngineConfig(AxisEngine engine)
+      throws ConfigurationException
+    {
+      // Do nothing
+    }
+
+    /**
+     * retrieve an instance of the named handler
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public Handler getHandler(QName qname) throws ConfigurationException
+    {
+      return deployment.getHandler(qname);
+    }
+
+    /**
+     * retrieve an instance of the named service
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public SOAPService getService(QName qname) throws ConfigurationException
+    {
+      SOAPService service = deployment.getService(qname);
+      if (service == null)
+      {
+        throw new ConfigurationException(Messages.getMessage("noService10",
+          qname.toString()));
+      }
+      return service;
+    }
+
+    /**
+     * Get a service which has been mapped to a particular namespace
+     * 
+     * @param namespace a namespace URI
+     * @return an instance of the appropriate Service, or null
+     */
+    public SOAPService getServiceByNamespaceURI(String namespace)
+      throws ConfigurationException
+    {
+      return deployment.getServiceByNamespaceURI(namespace);
+    }
+
+    /**
+     * retrieve an instance of the named transport
+     * @param qname XXX
+     * @return XXX
+     * @throws ConfigurationException XXX
+     */
+    public Handler getTransport(QName qname) throws ConfigurationException
+    {
+      return deployment.getTransport(qname);
+    }
+
+    public TypeMappingRegistry getTypeMappingRegistry()
+        throws ConfigurationException
+    {
+      return deployment.getTypeMappingRegistry();
+    }
+
+    /**
+     * Returns a global request handler.
+     */
+    public Handler getGlobalRequest() throws ConfigurationException
+    {
+      return deployment.getGlobalRequest();
+    }
+
+    /**
+     * Returns a global response handler.
+     */
+    public Handler getGlobalResponse() throws ConfigurationException
+    {
+      return deployment.getGlobalResponse();
+    }
+
+    /**
+     * Returns the global configuration options.
+     */
+    public Hashtable getGlobalOptions() throws ConfigurationException
+    {
+      WSDDGlobalConfiguration globalConfig = deployment.getGlobalConfiguration();
+            
+      if (globalConfig != null)
+        return globalConfig.getParametersTable();
+
+      return null;
+    }
+
+    /**
+     * Get an enumeration of the services deployed to this engine
+     */
+    public Iterator getDeployedServices() throws ConfigurationException
+    {
+      return deployment.getDeployedServices();
+    }
+
+    /**
+     * Get a list of roles that this engine plays globally.  Services
+     * within the engine configuration may also add additional roles.
+     *
+     * @return a <code>List</code> of the roles for this engine
+     */
+    public List getRoles()
+    {
+      return deployment.getRoles();
+    }
+  }
 
 }

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
(original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
Mon Jan  2 13:58:03 2012
@@ -40,7 +40,6 @@ import org.apache.commons.httpclient.pro
 import org.apache.commons.httpclient.protocol.ProtocolFactory;
 import org.apache.commons.httpclient.HttpConnectionManager;
 import org.apache.axis.EngineConfiguration;
-import org.apache.axis.configuration.FileProvider;
 
 import javax.xml.namespace.QName;
 
@@ -86,7 +85,8 @@ public class SPSProxyHelper {
   * @param userName
   * @param password
   */
-  public SPSProxyHelper( String serverUrl, String serverLocation, String decodedServerLocation,
String userName, String password, ProtocolFactory myFactory, String configFileName, HttpConnectionManager
connectionManager )
+  public SPSProxyHelper( String serverUrl, String serverLocation, String decodedServerLocation,
String userName, String password,
+    ProtocolFactory myFactory, Class resourceClass, String configFileName, HttpConnectionManager
connectionManager )
   {
     this.serverUrl = serverUrl;
     this.serverLocation = serverLocation;
@@ -98,7 +98,7 @@ public class SPSProxyHelper {
     this.userName = userName;
     this.password = password;
     this.myFactory = myFactory;
-    this.configuration = new ResourceProvider(configFileName);
+    this.configuration = new ResourceProvider(resourceClass,configFileName);
     this.connectionManager = connectionManager;
   }
 
@@ -2126,17 +2126,19 @@ public class SPSProxyHelper {
   /** Implementation of EngineConfiguration that we'll use to get the wsdd file from a
   * local resource.
   */
-  protected static class ResourceProvider implements org.apache.axis.WSDDEngineConfiguration
+  protected static class ResourceProvider implements WSDDEngineConfiguration
   {
     private WSDDDeployment deployment = null;
 
+    private Class resourceClass;
     private String resourceName;
 
     /**
      * Constructor setting the resource name.
      */
-    public ResourceProvider(String resourceName) 
+    public ResourceProvider(Class resourceClass, String resourceName) 
     {
+      this.resourceClass = resourceClass;
       this.resourceName = resourceName;
     }
 
@@ -2149,7 +2151,7 @@ public class SPSProxyHelper {
     {
       try
       {
-        InputStream resourceStream = getClass().getResourceAsStream(resourceName);
+        InputStream resourceStream = resourceClass.getResourceAsStream(resourceName);
         if (resourceStream == null)
           throw new ConfigurationException("Resource not found: '"+resourceName+"'");
         try

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1226420&r1=1226419&r2=1226420&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
(original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Mon Jan  2 13:58:03 2012
@@ -190,7 +190,7 @@ public class SharePointRepository extend
       fileBaseUrl = serverUrl + encodedServerLocation;
 
       proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName,
password,
-        myFactory, "sharepoint-client-config.wsdd",
+        myFactory, getClass(), "sharepoint-client-config.wsdd",
         connectionManager );
     }
   }



Mime
View raw message