incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1032532 - in /incubator/lcf/trunk: ./ modules/ modules/connectors/nullauthority/ modules/connectors/nullauthority/connector/ modules/connectors/nullauthority/connector/src/ modules/connectors/nullauthority/connector/src/main/ modules/conne...
Date Mon, 08 Nov 2010 10:24:39 GMT
Author: kwright
Date: Mon Nov  8 10:24:38 2010
New Revision: 1032532

URL: http://svn.apache.org/viewvc?rev=1032532&view=rev
Log:
Add a null authority connector, to facilitate authority tests. CONNECTORS-124.

Added:
    incubator/lcf/trunk/modules/connectors/nullauthority/
    incubator/lcf/trunk/modules/connectors/nullauthority/build.xml   (with props)
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/
    incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
  (with props)
Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/modules/build.xml

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1032532&r1=1032531&r2=1032532&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Mon Nov  8 10:24:38 2010
@@ -3,6 +3,10 @@ $Id$
 
 ======================= Trunk (not yet released) =======================
 
+CONNECTORS-124: Add a null authority connector, so authority tests can be
+written.
+(Karl Wright)
+
 CONNECTORS-109: Hooked up user-defined functions in Derby to perform the needed
 regular expression matching and grouping.
 (Karl Wright)

Modified: incubator/lcf/trunk/modules/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/build.xml?rev=1032532&r1=1032531&r2=1032532&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/build.xml (original)
+++ incubator/lcf/trunk/modules/build.xml Mon Nov  8 10:24:38 2010
@@ -28,6 +28,8 @@
         <delete dir="connectors/memex/lib"/>
         <ant dir="connectors/meridio" target="clean"/>
         <delete dir="connectors/meridio/lib"/>
+        <ant dir="connectors/nullauthority" target="clean"/>
+        <delete dir="connectors/nullauthority/lib"/>
         <ant dir="connectors/nulloutput" target="clean"/>
         <delete dir="connectors/nulloutput/lib"/>
         <ant dir="connectors/rss" target="clean"/>
@@ -222,6 +224,17 @@
         <ant dir="connectors/meridio"/>
     </target>
 
+    <target name="build-nullauthority-connector" depends="build-framework">
+        <mkdir dir="connectors/nullauthority/lib"/>
+        <copy todir="connectors/nulloutput/lib">
+            <fileset dir="framework/lib"/>
+        </copy>
+        <copy todir="connectors/nullauthority/lib">
+            <fileset dir="framework/build/jar"/>
+        </copy>
+        <ant dir="connectors/nullauthority"/>
+    </target>
+
     <target name="build-nulloutput-connector" depends="build-framework">
         <mkdir dir="connectors/nulloutput/lib"/>
         <copy todir="connectors/nulloutput/lib">
@@ -459,6 +472,13 @@
         </copy>
     </target>
 
+    <target name="calculate-nullauthority-condition" depends="build-nullauthority-connector">
+        <available file="connectors/nullauthority/dist" type="dir" property="nullauthority.exists"/>
+        <condition property="nullauthority.include">
+            <isset property="nullauthority.exists"/>
+        </condition>
+    </target>
+
     <target name="calculate-nulloutput-condition" depends="build-nulloutput-connector">
         <available file="connectors/nulloutput/dist" type="dir" property="nulloutput.exists"/>
         <condition property="nulloutput.include">
@@ -466,6 +486,13 @@
         </condition>
     </target>
 
+    <target name="deliver-nullauthority-connector" depends="calculate-nullauthority-condition"
if="nullauthority.include">
+        <mkdir dir="dist/lib"/>
+        <copy todir="dist/lib">
+            <fileset dir="connectors/nullauthority/dist/lib"/>
+        </copy>
+    </target>
+
     <target name="deliver-nulloutput-connector" depends="calculate-nulloutput-condition"
if="nulloutput.include">
         <mkdir dir="dist/lib"/>
         <copy todir="dist/lib">
@@ -636,6 +663,14 @@
         <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;"/>
     </target>
 
+    <target name="deliver-nullauthority-example" depends="deliver-framework-example,build-nullauthority-connector,calculate-nullauthority-condition"
if="nullauthority.include">
+        <mkdir dir="dist/example/connector-lib"/>
+        <copy todir="dist/example/connector-lib">
+            <fileset dir="connectors/nullauthority/dist/lib"/>
+        </copy>
+        <replace file="dist/example/connectors.xml" token="&lt;!-- Add your authority
connectors here --&gt;" value="&lt;!-- Add your authority connectors here --&gt;&#0010;
 &lt;authorityconnector name=&quot;Null&quot; class=&quot;org.apache.manifoldcf.authorities.authorities.nullauthority.NullAuthority&quot;/&gt;"/>
+    </target>
+
     <target name="deliver-nulloutput-example" depends="deliver-framework-example,build-nulloutput-connector,calculate-nulloutput-condition"
if="nulloutput.include">
         <mkdir dir="dist/example/connector-lib"/>
         <copy todir="dist/example/connector-lib">
@@ -681,7 +716,7 @@
         <replace file="dist/example/connectors.xml" token="&lt;!-- Add your repository
connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;
 &lt;repositoryconnector name=&quot;Web&quot; class=&quot;org.apache.manifoldcf.crawler.connectors.webcrawler.WebcrawlerConnector&quot;/&gt;"/>
     </target>
 
-    <target name="deliver-example" depends="deliver-framework-example,deliver-activedirectory-example,deliver-documentum-example,deliver-filesystem-example,deliver-filenet-example,deliver-gts-example,deliver-jcifs-example,deliver-jdbc-example,deliver-livelink-example,deliver-memex-example,deliver-meridio-example,deliver-nulloutput-example,deliver-rss-example,deliver-sharepoint-example,deliver-solr-example,deliver-webcrawler-example">
+    <target name="deliver-example" depends="deliver-framework-example,deliver-activedirectory-example,deliver-documentum-example,deliver-filesystem-example,deliver-filenet-example,deliver-gts-example,deliver-jcifs-example,deliver-jdbc-example,deliver-livelink-example,deliver-memex-example,deliver-meridio-example,deliver-nullauthority-example,deliver-nulloutput-example,deliver-rss-example,deliver-sharepoint-example,deliver-solr-example,deliver-webcrawler-example">
         <!-- Build a manifest file.  There doesn't seem to be any good way to do this
automatically in ant without developing my own
         custom task, so I've hard coded all the class path libs. -->
         <mkdir dir="build/example"/>
@@ -790,7 +825,7 @@
 
     <target name="run-tests" depends="run-filesystem-tests,run-sharepoint-tests"/>
     
-    <target name="deliver-open-connectors" depends="deliver-activedirectory-connector,deliver-filesystem-connector,deliver-rss-connector,deliver-webcrawler-connector,deliver-jdbc-connector"/>
+    <target name="deliver-open-connectors" depends="deliver-nullauthority-connector,deliver-activedirectory-connector,deliver-filesystem-connector,deliver-rss-connector,deliver-webcrawler-connector,deliver-jdbc-connector"/>
     
     <target name="deliver-output-connectors" depends="deliver-gts-connector,deliver-solr-connector,deliver-nulloutput-connector"/>
     

Added: incubator/lcf/trunk/modules/connectors/nullauthority/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/nullauthority/build.xml?rev=1032532&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/nullauthority/build.xml (added)
+++ incubator/lcf/trunk/modules/connectors/nullauthority/build.xml Mon Nov  8 10:24:38 2010
@@ -0,0 +1,40 @@
+<project default="all">
+
+    <target name="clean">
+        <delete dir="build"/>
+        <delete dir="dist"/>
+        <delete dir="doc"/>
+    </target>
+
+    <target name="doc">
+        <mkdir dir="doc"/>
+        <javadoc destdir="doc" source="1.4">
+            <classpath>
+                <fileset dir="lib" includes="*.jar"/>
+            </classpath>
+            <fileset dir="connector/src/main/java" includes="**/*.java"/>
+        </javadoc>
+    </target>
+
+    <target name="compile-connector">
+        <mkdir dir="build/connector/classes"/>
+        <javac srcdir="connector/src/main/java" destdir="build/connector/classes" target="1.5"
source="1.4" debug="true" debuglevel="lines,vars,source">
+            <classpath>
+                <fileset dir="lib" includes="*.jar"/>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="jar-connector" depends="compile-connector">
+        <mkdir dir="build/jar"/>
+        <jar destfile="build/jar/mcf-nullauthority-connector.jar" basedir="build/connector/classes"/>
+    </target>
+
+    <target name="lib" depends="jar-connector">
+        <mkdir dir="dist/lib"/>
+        <copy todir="dist/lib" file="build/jar/mcf-nullauthority-connector.jar"/>
+    </target>
+
+    <target name="all" depends="lib,doc"/>
+    
+</project>

Propchange: incubator/lcf/trunk/modules/connectors/nullauthority/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/nullauthority/build.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java?rev=1032532&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
(added)
+++ incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
Mon Nov  8 10:24:38 2010
@@ -0,0 +1,162 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.authorities.authorities.nullauthority;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.Logging;
+import org.apache.manifoldcf.authorities.system.ManifoldCF;
+
+import java.io.*;
+import java.util.*;
+
+/** This is the null authority implementation, which simply returns the user name as the
single access token.
+* This is useful for situations where all the documents are being indexed using forced acls,
and a demonstration of
+* security is desired.  It's also quite useful for testing.
+*/
+public class NullAuthority extends org.apache.manifoldcf.authorities.authorities.BaseAuthorityConnector
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  /** This is the active directory global deny token.  This should be ingested with all documents.
*/
+  private static final String globalDenyToken = "DEAD_AUTHORITY";
+  
+  private static final AuthorizationResponse unreachableResponse = new AuthorizationResponse(new
String[]{globalDenyToken},
+    AuthorizationResponse.RESPONSE_UNREACHABLE);
+
+  /** Constructor.
+  */
+  public NullAuthority()
+  {
+  }
+
+  // All methods below this line will ONLY be called if a connect() call succeeded
+  // on this instance!
+
+  /** Check connection for sanity.
+  */
+  public String check()
+    throws ManifoldCFException
+  {
+    return super.check();
+  }
+
+  /** Obtain the access tokens for a given user name.
+  *@param userName is the user name or identifier.
+  *@return the response tokens (according to the current authority).
+  * (Should throws an exception only when a condition cannot be properly described within
the authorization response object.)
+  */
+  public AuthorizationResponse getAuthorizationResponse(String userName)
+    throws ManifoldCFException
+  {
+    String[] tokens = new String[]{userName};
+    return new AuthorizationResponse(tokens,AuthorizationResponse.RESPONSE_OK);
+  }
+
+  /** Obtain the default access tokens for a given user name.
+  *@param userName is the user name or identifier.
+  *@return the default response tokens, presuming that the connect method fails.
+  */
+  public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
+  {
+    // The default response if the getConnection method fails, which should never happen.
+    return unreachableResponse;
+  }
+
+  // UI support methods.
+  //
+  // These support methods are involved in setting up authority connection configuration
information. The configuration methods cannot assume that the
+  // current authority object is connected.  That is why they receive a thread context argument.
+    
+  /** Output the configuration header section.
+  * This method is called in the head section of the connector's configuration page.  Its
purpose is to add the required tabs to the list, and to output any
+  * javascript methods that might be needed by the configuration editing HTML.
+  *@param threadContext is the local thread context.
+  *@param out is the output to which any HTML should be sent.
+  *@param parameters are the configuration parameters, as they currently exist, for this
connection being configured.
+  *@param tabsArray is an array of tab names.  Add to this array any tab names that are specific
to the connector.
+  */
+  public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams
parameters, ArrayList tabsArray)
+    throws ManifoldCFException, IOException
+  {
+    out.print(
+"<script type=\"text/javascript\">\n"+
+"<!--\n"+
+"function checkConfig()\n"+
+"{\n"+
+"  return true;\n"+
+"}\n"+
+"\n"+
+"function checkConfigForSave()\n"+
+"{\n"+
+"  return true;\n"+
+"}\n"+
+"\n"+
+"//-->\n"+
+"</script>\n"
+    );
+  }
+  
+  /** Output the configuration body section.
+  * This method is called in the body section of the authority connector's configuration
page.  Its purpose is to present the required form elements for editing.
+  * The coder can presume that the HTML that is output from this configuration will be within
appropriate <html>, <body>, and <form> tags.  The name of the
+  * form is "editconnection".
+  *@param threadContext is the local thread context.
+  *@param out is the output to which any HTML should be sent.
+  *@param parameters are the configuration parameters, as they currently exist, for this
connection being configured.
+  *@param tabName is the current tab name.
+  */
+  public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, ConfigParams
parameters, String tabName)
+    throws ManifoldCFException, IOException
+  {
+    // Does nothing
+  }
+  
+  /** Process a configuration post.
+  * This method is called at the start of the authority connector's configuration page, whenever
there is a possibility that form data for a connection has been
+  * posted.  Its purpose is to gather form information and modify the configuration parameters
accordingly.
+  * The name of the posted form is "editconnection".
+  *@param threadContext is the local thread context.
+  *@param variableContext is the set of variables available from the post, including binary
file post information.
+  *@param parameters are the configuration parameters, as they currently exist, for this
connection being configured.
+  *@return null if all is well, or a string error message if there is an error that should
prevent saving of the connection (and cause a redirection to an error page).
+  */
+  public String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext,
ConfigParams parameters)
+    throws ManifoldCFException
+  {
+    return null;
+  }
+  
+  /** View configuration.
+  * This method is called in the body section of the authority connector's view configuration
page.  Its purpose is to present the connection information to the user.
+  * The coder can presume that the HTML that is output from this configuration will be within
appropriate <html> and <body> tags.
+  *@param threadContext is the local thread context.
+  *@param out is the output to which any HTML should be sent.
+  *@param parameters are the configuration parameters, as they currently exist, for this
connection being configured.
+  */
+  public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, ConfigParams
parameters)
+    throws ManifoldCFException, IOException
+  {
+    // Does nothing
+  }
+
+}
+
+

Propchange: incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/nullauthority/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/nullauthority/NullAuthority.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message