Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97B4CB7CE for ; Mon, 2 Jan 2012 13:58:31 +0000 (UTC) Received: (qmail 19253 invoked by uid 500); 2 Jan 2012 13:58:31 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 19209 invoked by uid 500); 2 Jan 2012 13:58:31 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 19201 invoked by uid 99); 2 Jan 2012 13:58:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2012 13:58:30 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=5.0 tests=ALL_TRUSTED,FILL_THIS_FORM_FRAUD_PHISH,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2012 13:58:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4F50723888CD; Mon, 2 Jan 2012 13:58:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120102135804.4F50723888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ - - - - - - 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 @@ - - - - - @@ -211,7 +206,7 @@ - + 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 List 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 ); } }