incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1226410 - in /incubator/lcf/branches/CONNECTORS-353: ./ connectors/sharepoint/ connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/ connectors/sharepoint/connector/src/main/resource/org/ connec...
Date Mon, 02 Jan 2012 13:20:05 GMT
Author: kwright
Date: Mon Jan  2 13:20:04 2012
New Revision: 1226410

URL: http://svn.apache.org/viewvc?rev=1226410&view=rev
Log:
Write a ResourceProvider, and move SharePoint wsdd's into the resource area.

Added:
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/manifoldcf/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/manifoldcf/crawler/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/sharepoint/
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/sharepoint/sharepoint-client-config.wsdd
      - copied unchanged from r1226360, incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/sharepoint-client-config.wsdd
Removed:
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/sharepoint-client-config.wsdd
Modified:
    incubator/lcf/branches/CONNECTORS-353/build.xml
    incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/build.xml
    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=1226410&r1=1226409&r2=1226410&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/build.xml (original)
+++ incubator/lcf/branches/CONNECTORS-353/build.xml Mon Jan  2 13:20:04 2012
@@ -1875,17 +1875,11 @@
         <copy todir="dist/connector-lib">
             <fileset dir="connectors/sharepoint/dist/lib"/>
         </copy>
-        <mkdir dir="dist/wsdd"/>
-        <copy todir="dist/wsdd">
-            <fileset dir="connectors/sharepoint/dist/wsdd"/>
-        </copy>
         <mkdir dir="dist/sharepoint-integration"/>
         <copy todir="dist/sharepoint-integration">
             <fileset dir="connectors/sharepoint/dist/integration"/>
         </copy>
         <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;SharePoint&quot; class=&quot;org.apache.manifoldcf.crawler.connectors.sharepoint.SharePointRepository&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.sharepoint.wsddpath&quot;
value=&quot;../wsdd/sharepoint-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.sharepoint.wsddpath&quot; value=&quot;../wsdd/sharepoint-client-config.wsdd&quot;/&gt;"/>
     </target>
     
     <target name="deliver-sharepoint-connector-doc" depends="calculate-sharepoint-doc-condition"
if="sharepoint-doc.include">

Modified: incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/build.xml?rev=1226410&r1=1226409&r2=1226410&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/build.xml (original)
+++ incubator/lcf/branches/CONNECTORS-353/connectors/sharepoint/build.xml Mon Jan  2 13:20:04
2012
@@ -120,7 +120,7 @@
         <mkdir dir="build/jar"/>
         <jar destfile="build/jar/mcf-sharepoint-connector.jar">
         	<fileset dir="build/connector/classes"/>
-          <!-- fileset dir="connector/src/main/resource"/ -->
+          <fileset dir="connector/src/main/resource"/>
         </jar>
     </target>
     
@@ -129,11 +129,6 @@
         <jar destfile="build/jar/mcf-sharepoint-wsdlstub.jar" basedir="build/wsdlclasses"/>
     </target>
 
-    <target name="wsdd" depends="precompile-check" if="canBuild">
-        <mkdir dir="dist/wsdd"/>
-        <copy todir="dist/wsdd" file="sharepoint-client-config.wsdd"/>
-    </target>
-
     <target name="integration">
         <mkdir dir="dist/integration"/>
         <copy todir="dist/integration">
@@ -160,7 +155,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/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=1226410&r1=1226409&r2=1226410&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:20:04 2012
@@ -20,6 +20,11 @@ package org.apache.manifoldcf.crawler.co
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+
+import java.io.InputStream;
 
 import javax.xml.soap.*;
 
@@ -37,6 +42,23 @@ import org.apache.commons.httpclient.Htt
 import org.apache.axis.EngineConfiguration;
 import org.apache.axis.configuration.FileProvider;
 
+import javax.xml.namespace.QName;
+
+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;
+
 /**
 *
 * @author Michael Cummings
@@ -76,7 +98,7 @@ public class SPSProxyHelper {
     this.userName = userName;
     this.password = password;
     this.myFactory = myFactory;
-    this.configuration = new FileProvider(configFileName);
+    this.configuration = new ResourceProvider(configFileName);
     this.connectionManager = connectionManager;
   }
 
@@ -2101,4 +2123,168 @@ 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
+  {
+    private WSDDDeployment deployment = null;
+
+    private String resourceName;
+
+    /**
+     * Constructor setting the resource name.
+     */
+    public ResourceProvider(String resourceName) 
+    {
+      this.resourceName = resourceName;
+    }
+
+    public WSDDDeployment getDeployment() {
+        return deployment;
+    }
+
+    public void configureEngine(AxisEngine engine)
+      throws ConfigurationException
+    {
+      try
+      {
+        InputStream resourceStream = getClass().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/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=1226410&r1=1226409&r2=1226410&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:20:04 2012
@@ -189,11 +189,8 @@ public class SharePointRepository extend
 
       fileBaseUrl = serverUrl + encodedServerLocation;
 
-      File sharepointWSDDLocation = ManifoldCF.getFileProperty(wsddPathProperty);
-      if (sharepointWSDDLocation == null)
-        throw new ManifoldCFException("SharePoint wsdd location path (property "+wsddPathProperty+")
must be specified!");
-
-      proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName,
password, myFactory, sharepointWSDDLocation.toString(),
+      proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName,
password,
+        myFactory, "sharepoint-client-config.wsdd",
         connectionManager );
     }
   }



Mime
View raw message