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 2014/12/20 22:09:03 UTC

svn commit: r1647052 - in /manifoldcf/branches/CONNECTORS-1119: connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/ connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/ framework/...

Author: kwright
Date: Sat Dec 20 21:09:03 2014
New Revision: 1647052

URL: http://svn.apache.org/r1647052
Log:
Start adding email notification connector

Added:
    manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/
    manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/
    manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java   (with props)
    manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java   (with props)
Modified:
    manifoldcf/branches/CONNECTORS-1119/framework/buildfiles/connector-build.xml
    manifoldcf/branches/CONNECTORS-1119/framework/example-common/connectors.xml

Added: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java?rev=1647052&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java (added)
+++ manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java Sat Dec 20 21:09:03 2014
@@ -0,0 +1,110 @@
+/**
+* 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.crawler.notifications.email;
+
+
+/**
+* Parameters data for the Email notification connector.
+*/
+public class EmailConfig {
+
+  /**
+  * Username
+  */
+  public static final String USERNAME_PARAM = "username";
+
+  /**
+  * Password
+  */
+  public static final String PASSWORD_PARAM = "password";
+
+  /**
+  * Protocol
+  */
+  public static final String PROTOCOL_PARAM = "protocol";
+
+  /**
+  * Server name
+  */
+  public static final String SERVER_PARAM = "server";
+
+  /**
+  * Port
+  */
+  public static final String PORT_PARAM = "port";
+
+  /**
+  * URL template
+  */
+  public static final String URL_PARAM = "url";
+  
+  // Protocol options
+  
+  public static final String PROTOCOL_IMAP = "IMAP";
+  public static final String PROTOCOL_IMAPS = "IMAP-SSL";
+  public static final String PROTOCOL_POP3 = "POP3";
+  public static final String PROTOCOL_POP3S = "POP3-SSL";
+  
+  // Protocol providers
+  
+  public static final String PROTOCOL_IMAP_PROVIDER = "imap";
+  public static final String PROTOCOL_IMAPS_PROVIDER = "imaps";
+  public static final String PROTOCOL_POP3_PROVIDER = "pop3";
+  public static final String PROTOCOL_POP3S_PROVIDER = "pop3s";
+  
+  // Default values and various other constants
+  
+  public static final String PROTOCOL_DEFAULT_VALUE = "IMAP";
+  public static final String PORT_DEFAULT_VALUE = "";
+  public static final String[] BASIC_METADATA = {"To","From","Subject","Body","Date","Encoding of Attachment","MIME type of attachment"};
+  public static final String[] BASIC_SEARCHABLE_ATTRIBUTES = {"To","From","Subject","Body","Date"};
+
+  // Specification nodes
+  
+  public static final String NODE_PROPERTIES = "properties";
+  public static final String NODE_METADATA = "metadata";
+  public static final String NODE_FILTER = "filter";
+  public static final String NODE_FOLDER = "folder";
+  
+  public static final String ATTRIBUTE_NAME = "name";
+  public static final String ATTRIBUTE_VALUE = "value";
+
+  // Metadata field names
+  
+  public static final String EMAIL_SUBJECT = "subject";
+  public static final String EMAIL_FROM = "from";
+  public static final String EMAIL_TO = "to";
+  public static final String EMAIL_BODY = "body";
+  public static final String EMAIL_DATE = "date";
+  public static final String EMAIL_ATTACHMENT_ENCODING = "encoding of attachment";
+  public static final String EMAIL_ATTACHMENT_MIMETYPE = "mime type of attachment";
+  public static final String EMAIL_VERSION = "1.0";
+  
+  // Mime types
+  
+  public static final String MIMETYPE_TEXT_PLAIN = "text/plain";
+  public static final String MIMETYPE_HTML = "text/html";
+  
+  // Fields
+  
+  public static final String ENCODING_FIELD = "encoding";
+  public static final String MIMETYPE_FIELD = "mimetype";
+  //public static final String TO = "To";
+  
+
+}
\ No newline at end of file

Propchange: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/EmailConfig.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java?rev=1647052&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java (added)
+++ manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java Sat Dec 20 21:09:03 2014
@@ -0,0 +1,141 @@
+/* $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.crawler.notifications.email;
+
+import java.util.Locale;
+import java.util.Map;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+
+public class Messages extends org.apache.manifoldcf.ui.i18n.Messages
+{
+  public static final String DEFAULT_BUNDLE_NAME="org.apache.manifoldcf.crawler.notifications.email.common";
+  public static final String DEFAULT_PATH_NAME="org.apache.manifoldcf.crawler.notifications.email";
+  
+  /** Constructor - do no instantiate
+  */
+  protected Messages()
+  {
+  }
+  
+  public static String getString(Locale locale, String messageKey)
+  {
+    return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+  }
+
+  public static String getAttributeString(Locale locale, String messageKey)
+  {
+    return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+  }
+
+  public static String getBodyString(Locale locale, String messageKey)
+  {
+    return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+  }
+
+  public static String getAttributeJavascriptString(Locale locale, String messageKey)
+  {
+    return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+  }
+
+  public static String getBodyJavascriptString(Locale locale, String messageKey)
+  {
+    return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, null);
+  }
+
+  public static String getString(Locale locale, String messageKey, Object[] args)
+  {
+    return getString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+  }
+
+  public static String getAttributeString(Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+  }
+  
+  public static String getBodyString(Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+  }
+
+  public static String getAttributeJavascriptString(Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+  }
+
+  public static String getBodyJavascriptString(Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyJavascriptString(DEFAULT_BUNDLE_NAME, locale, messageKey, args);
+  }
+
+  // More general methods which allow bundlenames and class loaders to be specified.
+  
+  public static String getString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getString(Messages.class, bundleName, locale, messageKey, args);
+  }
+
+  public static String getAttributeString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeString(Messages.class, bundleName, locale, messageKey, args);
+  }
+
+  public static String getBodyString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyString(Messages.class, bundleName, locale, messageKey, args);
+  }
+  
+  public static String getAttributeJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getAttributeJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+  }
+
+  public static String getBodyJavascriptString(String bundleName, Locale locale, String messageKey, Object[] args)
+  {
+    return getBodyJavascriptString(Messages.class, bundleName, locale, messageKey, args);
+  }
+
+  // Resource output
+  
+  public static void outputResource(IHTTPOutput output, Locale locale, String resourceKey,
+    Map<String,String> substitutionParameters, boolean mapToUpperCase)
+    throws ManifoldCFException
+  {
+    outputResource(output,Messages.class,DEFAULT_PATH_NAME,locale,resourceKey,
+      substitutionParameters,mapToUpperCase);
+  }
+  
+  public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+    Map<String,String> substitutionParameters, boolean mapToUpperCase)
+    throws ManifoldCFException
+  {
+    outputResourceWithVelocity(output,Messages.class,DEFAULT_BUNDLE_NAME,DEFAULT_PATH_NAME,locale,resourceKey,
+      substitutionParameters,mapToUpperCase);
+  }
+
+  public static void outputResourceWithVelocity(IHTTPOutput output, Locale locale, String resourceKey,
+    Map<String,Object> contextObjects)
+    throws ManifoldCFException
+  {
+    outputResourceWithVelocity(output,Messages.class,DEFAULT_BUNDLE_NAME,DEFAULT_PATH_NAME,locale,resourceKey,
+      contextObjects);
+  }
+  
+}
+

Propchange: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: manifoldcf/branches/CONNECTORS-1119/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/notifications/email/Messages.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: manifoldcf/branches/CONNECTORS-1119/framework/buildfiles/connector-build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/buildfiles/connector-build.xml?rev=1647052&r1=1647051&r2=1647052&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/buildfiles/connector-build.xml (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/buildfiles/connector-build.xml Sat Dec 20 21:09:03 2014
@@ -885,6 +885,25 @@
     <target name="general-add-transformation-connector" depends="general-add-transformation-connector-commented,general-add-transformation-connector-non-commented,general-add-transformation-connector-proprietary-commented,general-add-transformation-connector-proprietary-non-commented">
     </target>
 
+    <target name="general-add-notification-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
+        <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;!--notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
+    </target>
+
+    <target name="general-add-notification-connector-non-commented" depends="general-connector-runnable-check" if="is-runnable">
+        <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
+    </target>
+
+    <target name="general-add-notification-connector-proprietary-commented" depends="general-connector-proprietary-runnable-check" unless="is-proprietary-runnable">
+        <replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;!--notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
+    </target>
+
+    <target name="general-add-notification-connector-proprietary-non-commented" depends="general-connector-proprietary-runnable-check" if="is-proprietary-runnable">
+        <replace file="${mcf-dist}/connectors-proprietary.xml" token="&lt;!-- Add your notification connectors here --&gt;" value="&lt;!-- Add your notification connectors here --&gt;&#0010;  &lt;notificationconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/&gt;"/>
+    </target>
+
+    <target name="general-add-notification-connector" depends="general-add-notification-connector-commented,general-add-notification-connector-non-commented,general-add-notification-connector-proprietary-commented,general-add-notification-connector-proprietary-non-commented">
+    </target>
+
     <target name="general-add-repository-connector-commented" depends="general-connector-runnable-check" unless="is-runnable">
         <replace file="${mcf-dist}/connectors.xml" token="&lt;!-- Add your repository connectors here --&gt;" value="&lt;!-- Add your repository connectors here --&gt;&#0010;  &lt;!--repositoryconnector name=&quot;${connector-label}&quot; class=&quot;${connector-class}&quot;/--&gt;"/>
     </target>

Modified: manifoldcf/branches/CONNECTORS-1119/framework/example-common/connectors.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/example-common/connectors.xml?rev=1647052&r1=1647051&r2=1647052&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/example-common/connectors.xml (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/example-common/connectors.xml Sat Dec 20 21:09:03 2014
@@ -36,5 +36,7 @@
     <!-- Add your authority connectors here -->
     
     <!-- Add your repository connectors here -->
-    
+
+    <!-- Add your notification connectors here -->
+
 </connectors>