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 2013/07/04 14:37:11 UTC
svn commit: r1499733 [1/2] - in /manifoldcf/branches/CONNECTORS-731: ./
connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/
connectors/documentum/connector/src/main/java/org/apache/manifoldc...
Author: kwright
Date: Thu Jul 4 12:37:10 2013
New Revision: 1499733
URL: http://svn.apache.org/r1499733
Log:
Create JIRA authority.
Added:
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js (with props)
manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html (with props)
Modified:
manifoldcf/branches/CONNECTORS-731/build.xml
manifoldcf/branches/CONNECTORS-731/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
manifoldcf/branches/CONNECTORS-731/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java
manifoldcf/branches/CONNECTORS-731/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java
manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
manifoldcf/branches/CONNECTORS-731/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
manifoldcf/branches/CONNECTORS-731/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java
manifoldcf/branches/CONNECTORS-731/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnector.java
manifoldcf/branches/CONNECTORS-731/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java
Modified: manifoldcf/branches/CONNECTORS-731/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/build.xml?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/build.xml (original)
+++ manifoldcf/branches/CONNECTORS-731/build.xml Thu Jul 4 12:37:10 2013
@@ -1681,6 +1681,11 @@
<param name="connector-label" value="Jira"/>
<param name="connector-class" value="org.apache.manifoldcf.crawler.connectors.jira.JiraRepositoryConnector"/>
</antcall>
+ <antcall target="general-add-authority-connector">
+ <param name="connector-name" value="jira"/>
+ <param name="connector-label" value="Jira"/>
+ <param name="connector-class" value="org.apache.manifoldcf.authorities.authorities.jira.JiraAuthorityConnector"/>
+ </antcall>
</target>
<target name="deliver-jira-connector-doc" depends="calculate-jira-doc-condition" if="jira-doc.include">
Modified: manifoldcf/branches/CONNECTORS-731/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/activedirectory/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/activedirectory/ActiveDirectoryAuthority.java Thu Jul 4 12:37:10 2013
@@ -63,14 +63,6 @@ public class ActiveDirectoryAuthority ex
/** The length of time in milliseconds that the connection remains idle before expiring. Currently 5 minutes. */
private static final long expirationInterval = 300000L;
- /** 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);
- private static final AuthorizationResponse userNotFoundResponse = new AuthorizationResponse(new String[]{globalDenyToken},
- AuthorizationResponse.RESPONSE_USERNOTFOUND);
-
/** Constructor.
*/
public ActiveDirectoryAuthority()
@@ -318,7 +310,7 @@ public class ActiveDirectoryAuthority ex
if (domainController == null)
{
// No domain controller found for the user, so return "user not found".
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
// Look up connection parameters
@@ -326,7 +318,7 @@ public class ActiveDirectoryAuthority ex
if (dcParams == null)
{
// No domain controller, even though it's mentioned in a rule
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
// Use the complete fqn if the field is the "userPrincipalName"
@@ -361,7 +353,7 @@ public class ActiveDirectoryAuthority ex
//Get DistinguishedName (for this method we are using DomainPart as a searchBase ie: DC=qa-ad-76,DC=metacarta,DC=com")
String searchBase = getDistinguishedName(ctx, userPart, domainsb.toString(), userACLsUsername);
if (searchBase == null)
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
//specify the LDAP search filter
String searchFilter = "(objectClass=user)";
@@ -412,7 +404,7 @@ public class ActiveDirectoryAuthority ex
}
if (theGroups.size() == 0)
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
// All users get certain well-known groups
theGroups.add("S-1-1-0");
@@ -431,12 +423,12 @@ public class ActiveDirectoryAuthority ex
catch (NameNotFoundException e)
{
// This means that the user doesn't exist
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
catch (NamingException e)
{
// Unreachable
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
}
@@ -448,7 +440,7 @@ public class ActiveDirectoryAuthority ex
public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
{
// The default response if the getConnection method fails
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
// UI support methods.
Modified: manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java Thu Jul 4 12:37:10 2013
@@ -51,13 +51,8 @@ public class AuthorityConnector extends
protected boolean useSystemAcls = true;
// Documentum has no "deny" tokens, and its document acls cannot be empty, so no local authority deny token is required.
- // However, it is felt that we need to be suspenders-and-belt, so here is the deny token.
+ // However, it is felt that we need to be suspenders-and-belt, so we use the deny token.
// The documentum tokens are of the form xxx:yyy, so they cannot collide with the standard deny token.
- protected static final String denyToken = "DEAD_AUTHORITY";
-
- protected static final AuthorizationResponse unreachableResponse = new AuthorizationResponse(new String[]{denyToken},AuthorizationResponse.RESPONSE_UNREACHABLE);
- protected static final AuthorizationResponse userNotFoundResponse = new AuthorizationResponse(new String[]{denyToken},AuthorizationResponse.RESPONSE_USERNOTFOUND);
- protected static final AuthorizationResponse userUnauthorizedResponse = new AuthorizationResponse(new String[]{denyToken},AuthorizationResponse.RESPONSE_USERUNAUTHORIZED);
/** Cache manager. */
protected ICacheManager cacheManager = null;
@@ -528,7 +523,7 @@ public class AuthorityConnector extends
{
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("DCTM: No user found for username '" + strUserName + "'");
- response = userNotFoundResponse;
+ response = RESPONSE_USERNOTFOUND;
return;
}
@@ -536,7 +531,7 @@ public class AuthorityConnector extends
{
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("DCTM: User found for username '" + strUserName + "' but the account is not active.");
- response = userUnauthorizedResponse;
+ response = RESPONSE_USERUNAUTHORIZED;
return;
}
@@ -741,7 +736,7 @@ public class AuthorityConnector extends
if (noSession)
{
Logging.authorityConnectors.warn("DCTM: Transient error checking authorization: "+e.getMessage(),e);
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
session = null;
lastSessionFetch = -1L;
@@ -820,7 +815,7 @@ public class AuthorityConnector extends
if (noSession)
{
Logging.authorityConnectors.warn("DCTM: Transient error checking authorization: "+e.getMessage(),e);
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
session = null;
lastSessionFetch = -1L;
@@ -835,7 +830,7 @@ public class AuthorityConnector extends
{
Logging.authorityConnectors.warn("DCTM: Transient error checking authorization: "+e.getMessage(),e);
// Transient: Treat as if user does not exist, not like credentials invalid.
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
throw new ManifoldCFException(e.getMessage(),e);
}
@@ -848,7 +843,7 @@ public class AuthorityConnector extends
@Override
public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
{
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
protected static String insensitiveMatch(boolean insensitive, String field, String value)
Modified: manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java Thu Jul 4 12:37:10 2013
@@ -65,7 +65,7 @@ public class DCTM extends org.apache.man
/** Documentum has no "deny" tokens, and its document acls cannot be empty, so no local authority deny token is required.
* However, it is felt that we need to be suspenders-and-belt, so here is the deny token.
* The documentum tokens are of the form xxx:yyy, so they cannot collide with the standard deny token. */
- private static final String denyToken = "DEAD_AUTHORITY";
+ private static final String denyToken = GLOBAL_DENY_TOKEN;
protected class GetSessionThread extends Thread
{
Modified: manifoldcf/branches/CONNECTORS-731/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/filenet/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filenet/FilenetConnector.java Thu Jul 4 12:37:10 2013
@@ -104,7 +104,7 @@ public class FilenetConnector extends or
protected String docURIPrefix = null;
/** Deny access token for default authority */
- private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
+ private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
protected class GetSessionThread extends Thread
{
Modified: manifoldcf/branches/CONNECTORS-731/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jcifs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharedrive/SharedDriveConnector.java Thu Jul 4 12:37:10 2013
@@ -121,7 +121,7 @@ public class SharedDriveConnector extend
private NtlmPasswordAuthentication pa;
/** Deny access token for default authority */
- private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
+ private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
/** Constructor.
*/
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java Thu Jul 4 12:37:10 2013
@@ -0,0 +1,465 @@
+/* $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.jira;
+
+import org.apache.manifoldcf.core.common.*;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Date;
+import java.util.Set;
+import java.util.Iterator;
+import org.apache.manifoldcf.authorities.system.Logging;
+import org.apache.manifoldcf.authorities.authorities.BaseAuthorityConnector;
+import org.apache.manifoldcf.authorities.interfaces.AuthorizationResponse;
+import org.apache.manifoldcf.core.interfaces.ConfigParams;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
+import org.apache.manifoldcf.core.interfaces.IPostParameters;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import java.util.Map.Entry;
+
+/** Jira Authority Connector. This connector verifies user existence against Jira.
+ */
+public class JiraAuthorityConnector extends BaseAuthorityConnector {
+
+ /** Deny access token for default authority */
+ private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
+
+ // Configuration tabs
+ private static final String JIRA_SERVER_TAB_PROPERTY = "JiraRepositoryConnector.Server";
+
+ // Template names for configuration
+ /**
+ * Forward to the javascript to check the configuration parameters
+ */
+ private static final String EDIT_CONFIG_HEADER_FORWARD = "editConfiguration_jira_server.js";
+ /**
+ * Server tab template
+ */
+ private static final String EDIT_CONFIG_FORWARD_SERVER = "editConfiguration_jira_server.html";
+
+ /**
+ * Forward to the HTML template to view the configuration parameters
+ */
+ private static final String VIEW_CONFIG_FORWARD = "viewConfiguration_jira.html";
+
+ // Session data
+ protected JiraSession session = null;
+ protected long lastSessionFetch = -1L;
+ protected static final long timeToRelease = 300000L;
+
+ // Parameter data
+ protected String jiraprotocol = null;
+ protected String jirahost = null;
+ protected String jiraport = null;
+ protected String jirapath = null;
+ protected String clientid = null;
+ protected String clientsecret = null;
+
+ public JiraAuthorityConnector() {
+ super();
+ }
+
+ /**
+ * Close the connection. Call this before discarding the connection.
+ */
+ @Override
+ public void disconnect() throws ManifoldCFException {
+ if (session != null) {
+ session.close();
+ session = null;
+ lastSessionFetch = -1L;
+ }
+
+ jiraprotocol = null;
+ jirahost = null;
+ jiraport = null;
+ jirapath = null;
+ clientid = null;
+ clientsecret = null;
+ }
+
+ /**
+ * This method create a new JIRA session for a JIRA
+ * repository, if the repositoryId is not provided in the configuration, the
+ * connector will retrieve all the repositories exposed for this endpoint
+ * the it will start to use the first one.
+ *
+ * @param configParameters is the set of configuration parameters, which in
+ * this case describe the target appliance, basic auth configuration, etc.
+ * (This formerly came out of the ini file.)
+ */
+ @Override
+ public void connect(ConfigParams configParams) {
+ super.connect(configParams);
+
+ jiraprotocol = params.getParameter(JiraConfig.JIRA_PROTOCOL_PARAM);
+ jirahost = params.getParameter(JiraConfig.JIRA_HOST_PARAM);
+ jiraport = params.getParameter(JiraConfig.JIRA_PORT_PARAM);
+ jirapath = params.getParameter(JiraConfig.JIRA_PATH_PARAM);
+ clientid = params.getParameter(JiraConfig.CLIENT_ID_PARAM);
+ clientsecret = params.getObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM);
+ }
+
+ /**
+ * Test the connection. Returns a string describing the connection
+ * integrity.
+ *
+ * @return the connection's status as a displayable string.
+ */
+ @Override
+ public String check() throws ManifoldCFException {
+ try {
+ checkConnection();
+ return super.check();
+ } catch (ManifoldCFException e) {
+ return "Connection failed: " + e.getMessage();
+ }
+ }
+
+
+ /**
+ * Set up a session
+ */
+ protected JiraSession getSession() throws ManifoldCFException {
+ if (session == null) {
+ // Check for parameter validity
+
+ if (StringUtils.isEmpty(jiraprotocol)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_PROTOCOL_PARAM
+ + " required but not set");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: jiraprotocol = '" + jiraprotocol + "'");
+ }
+
+ if (StringUtils.isEmpty(jirahost)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_HOST_PARAM
+ + " required but not set");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: jirahost = '" + jirahost + "'");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: jiraport = '" + jiraport + "'");
+ }
+
+ if (StringUtils.isEmpty(jirapath)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_PATH_PARAM
+ + " required but not set");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: jirapath = '" + jirapath + "'");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: Clientid = '" + clientid + "'");
+ }
+
+ if (Logging.authorityConnectors.isDebugEnabled()) {
+ Logging.authorityConnectors.debug("JIRA: Clientsecret = '" + clientsecret + "'");
+ }
+
+ String jiraurl = jiraprotocol + "://" + jirahost + (StringUtils.isEmpty(jiraport)?"":":"+jiraport) + jirapath;
+ session = new JiraSession(clientid, clientsecret, jiraurl);
+
+ }
+ lastSessionFetch = System.currentTimeMillis();
+ return session;
+ }
+
+ @Override
+ public void poll() throws ManifoldCFException {
+ if (lastSessionFetch == -1L) {
+ return;
+ }
+
+ long currentTime = System.currentTimeMillis();
+ if (currentTime >= lastSessionFetch + timeToRelease) {
+ session.close();
+ session = null;
+ lastSessionFetch = -1L;
+ }
+ }
+
+ /**
+ * Fill in a Server tab configuration parameter map for calling a Velocity
+ * template.
+ *
+ * @param newMap is the map to fill in
+ * @param parameters is the current set of configuration parameters
+ */
+ private static void fillInServerConfigurationMap(Map<String, Object> newMap, ConfigParams parameters) {
+ String jiraprotocol = parameters.getParameter(JiraConfig.JIRA_PROTOCOL_PARAM);
+ String jirahost = parameters.getParameter(JiraConfig.JIRA_HOST_PARAM);
+ String jiraport = parameters.getParameter(JiraConfig.JIRA_PORT_PARAM);
+ String jirapath = parameters.getParameter(JiraConfig.JIRA_PATH_PARAM);
+ String clientid = parameters.getParameter(JiraConfig.CLIENT_ID_PARAM);
+ String clientsecret = parameters.getObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM);
+
+ if (jiraprotocol == null)
+ jiraprotocol = JiraConfig.JIRA_PROTOCOL_DEFAULT;
+ if (jirahost == null)
+ jirahost = JiraConfig.JIRA_HOST_DEFAULT;
+ if (jiraport == null)
+ jiraport = JiraConfig.JIRA_PORT_DEFAULT;
+ if (jirapath == null)
+ jirapath = JiraConfig.JIRA_PATH_DEFAULT;
+
+ if (clientid == null)
+ clientid = JiraConfig.CLIENT_ID_DEFAULT;
+ if (clientsecret == null)
+ clientsecret = JiraConfig.CLIENT_SECRET_DEFAULT;
+ else {
+ if (clientsecret.length() > 0)
+ clientsecret = EXISTING_VALUE_PASSWORD;
+ }
+
+ newMap.put("JIRAPROTOCOL", jiraprotocol);
+ newMap.put("JIRAHOST", jirahost);
+ newMap.put("JIRAPORT", jiraport);
+ newMap.put("JIRAPATH", jirapath);
+ newMap.put("CLIENTID", clientid);
+ newMap.put("CLIENTSECRET", clientsecret);
+ }
+
+ /**
+ * View configuration. This method is called in the body section of the
+ * 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.
+ */
+ @Override
+ public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out,
+ Locale locale, ConfigParams parameters) throws ManifoldCFException, IOException {
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+
+ // Fill in map from each tab
+ fillInServerConfigurationMap(paramMap, parameters);
+
+ Messages.outputResourceWithVelocity(out,locale,VIEW_CONFIG_FORWARD,paramMap);
+ }
+
+ /**
+ *
+ * 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.
+ */
+ @Override
+ public void outputConfigurationHeader(IThreadContext threadContext,
+ IHTTPOutput out, Locale locale, ConfigParams parameters, List<String> tabsArray)
+ throws ManifoldCFException, IOException {
+ // Add the Server tab
+ tabsArray.add(Messages.getString(locale, JIRA_SERVER_TAB_PROPERTY));
+ // Map the parameters
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+
+ // Fill in the parameters from each tab
+ fillInServerConfigurationMap(paramMap, parameters);
+
+ // Output the Javascript - only one Velocity template for all tabs
+ Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_HEADER_FORWARD,paramMap);
+ }
+
+ @Override
+ public void outputConfigurationBody(IThreadContext threadContext,
+ IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName)
+ throws ManifoldCFException, IOException {
+
+
+ // Call the Velocity templates for each tab
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+ // Set the tab name
+ paramMap.put("TabName", tabName);
+
+ // Server tab
+ // Fill in the parameters
+ fillInServerConfigurationMap(paramMap, parameters);
+ Messages.outputResourceWithVelocity(out,locale,EDIT_CONFIG_FORWARD_SERVER,paramMap);
+ }
+
+ /**
+ * Process a configuration post. This method is called at the start of the
+ * 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).
+ *
+ */
+ @Override
+ public String processConfigurationPost(IThreadContext threadContext,
+ IPostParameters variableContext, ConfigParams parameters)
+ throws ManifoldCFException {
+
+ String jiraprotocol = variableContext.getParameter("jiraprotocol");
+ if (jiraprotocol != null)
+ parameters.setParameter(JiraConfig.JIRA_PROTOCOL_PARAM, jiraprotocol);
+
+ String jirahost = variableContext.getParameter("jirahost");
+ if (jirahost != null)
+ parameters.setParameter(JiraConfig.JIRA_HOST_PARAM, jirahost);
+
+ String jiraport = variableContext.getParameter("jiraport");
+ if (jiraport != null)
+ parameters.setParameter(JiraConfig.JIRA_PORT_PARAM, jiraport);
+
+ String jirapath = variableContext.getParameter("jirapath");
+ if (jirapath != null)
+ parameters.setParameter(JiraConfig.JIRA_PATH_PARAM, jirapath);
+
+ String clientid = variableContext.getParameter("clientid");
+ if (clientid != null)
+ parameters.setParameter(JiraConfig.CLIENT_ID_PARAM, clientid);
+
+ String clientsecret = variableContext.getParameter("clientsecret");
+ if (clientsecret != null) {
+ if (!clientsecret.equals(EXISTING_VALUE_PASSWORD))
+ parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, clientsecret);
+ }
+
+ return null;
+ }
+
+ /** Obtain the access tokens for a given Active Directory 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.)
+ */
+ @Override
+ public AuthorizationResponse getAuthorizationResponse(String userName)
+ throws ManifoldCFException {
+ // MHL
+ return null;
+ }
+
+ /** 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.
+ */
+ @Override
+ public AuthorizationResponse getDefaultAuthorizationResponse(String userName) {
+ return RESPONSE_UNREACHABLE;
+ }
+
+ private static void handleIOException(IOException e)
+ throws ManifoldCFException {
+ if (!(e instanceof java.net.SocketTimeoutException) && (e instanceof InterruptedIOException)) {
+ throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
+ ManifoldCFException.INTERRUPTED);
+ }
+ Logging.authorityConnectors.warn("JIRA: IO exception: "+e.getMessage(), e);
+ throw new ManifoldCFException("IO exception: "+e.getMessage(), e);
+ }
+
+ // Background threads
+
+ protected static class CheckConnectionThread extends Thread {
+
+ protected final JiraSession session;
+ protected Throwable exception = null;
+
+ public CheckConnectionThread(JiraSession session) {
+ super();
+ this.session = session;
+ setDaemon(true);
+ }
+
+ public void run() {
+ try {
+ session.getRepositoryInfo();
+ } catch (Throwable e) {
+ this.exception = e;
+ }
+ }
+
+ public void finishUp()
+ throws InterruptedException, IOException {
+ join();
+ Throwable thr = exception;
+ if (thr != null) {
+ if (thr instanceof IOException) {
+ throw (IOException) thr;
+ } else if (thr instanceof RuntimeException) {
+ throw (RuntimeException) thr;
+ } else {
+ throw (Error) thr;
+ }
+ }
+ }
+ }
+
+ protected void checkConnection() throws ManifoldCFException {
+ CheckConnectionThread t = new CheckConnectionThread(getSession());
+ try {
+ t.start();
+ t.finishUp();
+ return;
+ } catch (InterruptedException e) {
+ t.interrupt();
+ throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
+ ManifoldCFException.INTERRUPTED);
+ } catch (java.net.SocketTimeoutException e) {
+ handleIOException(e);
+ } catch (InterruptedIOException e) {
+ t.interrupt();
+ handleIOException(e);
+ } catch (IOException e) {
+ handleIOException(e);
+ }
+ }
+
+}
+
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraAuthorityConnector.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java Thu Jul 4 12:37:10 2013
@@ -0,0 +1,40 @@
+/* $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.jira;
+
+/** Parameters for Jira Authority.
+ */
+public class JiraConfig {
+
+ public static final String CLIENT_ID_PARAM = "clientid";
+ public static final String CLIENT_SECRET_PARAM = "clientsecret";
+ public static final String JIRA_PROTOCOL_PARAM = "jiraprotocol";
+ public static final String JIRA_HOST_PARAM = "jirahost";
+ public static final String JIRA_PORT_PARAM = "jiraport";
+ public static final String JIRA_PATH_PARAM = "jirapath";
+
+ public static final String CLIENT_ID_DEFAULT = "";
+ public static final String CLIENT_SECRET_DEFAULT = "";
+ public static final String JIRA_PROTOCOL_DEFAULT = "http";
+ public static final String JIRA_HOST_DEFAULT = "";
+ public static final String JIRA_PORT_DEFAULT = "";
+ public static final String JIRA_PATH_DEFAULT = "/rest/api/2/";
+
+}
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraConfig.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java Thu Jul 4 12:37:10 2013
@@ -0,0 +1,46 @@
+/* $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.jira;
+
+import org.json.simple.JSONObject;
+
+/** An instance of this class represents a Jira JSON object, and the parser hooks
+* needed to understand it.
+*
+* If we needed streaming anywhere, this would implement org.json.simple.parser.ContentHandler,
+* where we would extract the data from a JSON event stream. But since we don't need that
+* functionality, instead we're just going to accept an already-parsed JSONObject.
+*
+* This class is meant to be overridden (selectively) by derived classes.
+*/
+public class JiraJSONResponse {
+
+ protected JSONObject object = null;
+
+ public JiraJSONResponse() {
+ }
+
+ /** Receive a parsed JSON object.
+ */
+ public void acceptJSONObject(JSONObject object) {
+ this.object = object;
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java Thu Jul 4 12:37:10 2013
@@ -0,0 +1,222 @@
+/* $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.jira;
+
+import org.apache.manifoldcf.core.common.*;
+import org.apache.manifoldcf.core.interfaces.KeystoreManagerFactory;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+
+import java.io.Reader;
+import java.io.Writer;
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLEncoder;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.client.HttpClient;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.util.EntityUtils;
+import org.apache.http.params.BasicHttpParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.params.CoreConnectionPNames;
+import org.apache.http.client.params.ClientPNames;
+import org.apache.http.client.HttpRequestRetryHandler;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.conn.ssl.AllowAllHostnameVerifier;
+import org.apache.http.params.CoreProtocolPNames;
+
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.json.simple.JSONArray;
+
+/**
+ *
+ * @author andrew
+ */
+public class JiraSession {
+
+ private final String URLbase;
+ private final String clientId;
+ private final String clientSecret;
+
+ private ClientConnectionManager connectionManager;
+ private HttpClient httpClient;
+
+ /**
+ * Constructor. Create a session.
+ */
+ public JiraSession(String clientId, String clientSecret, String URLbase)
+ throws ManifoldCFException {
+ this.URLbase = URLbase;
+ this.clientId = clientId;
+ this.clientSecret = clientSecret;
+
+ int socketTimeout = 900000;
+ int connectionTimeout = 60000;
+
+ javax.net.ssl.SSLSocketFactory httpsSocketFactory = KeystoreManagerFactory.getTrustingSecureSocketFactory();
+ SSLSocketFactory myFactory = new SSLSocketFactory(new InterruptibleSocketFactory(httpsSocketFactory,connectionTimeout),
+ new AllowAllHostnameVerifier());
+ Scheme myHttpsProtocol = new Scheme("https", 443, myFactory);
+
+ PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
+ localConnectionManager.setMaxTotal(1);
+ connectionManager = localConnectionManager;
+ // Set up protocol registry
+ connectionManager.getSchemeRegistry().register(myHttpsProtocol);
+
+ BasicHttpParams params = new BasicHttpParams();
+ params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,true);
+ params.setIntParameter(CoreProtocolPNames.WAIT_FOR_CONTINUE,socketTimeout);
+ params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
+ params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,false);
+ params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,connectionTimeout);
+ params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeout);
+ params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
+ DefaultHttpClient localHttpClient = new DefaultHttpClient(connectionManager,params);
+ // No retries
+ localHttpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
+ {
+ public boolean retryRequest(
+ IOException exception,
+ int executionCount,
+ HttpContext context)
+ {
+ return false;
+ }
+
+ });
+ localHttpClient.setRedirectStrategy(new DefaultRedirectStrategy());
+ if (clientId != null)
+ {
+ localHttpClient.getCredentialsProvider().setCredentials(
+ AuthScope.ANY,
+ new UsernamePasswordCredentials(clientId,clientSecret));
+ }
+
+ httpClient = localHttpClient;
+ }
+
+ /**
+ * Close session.
+ */
+ public void close() {
+ httpClient = null;
+ if (connectionManager != null)
+ connectionManager.shutdown();
+ connectionManager = null;
+ }
+
+ private static JSONObject convertToJSON(HttpResponse httpResponse)
+ throws IOException {
+ HttpEntity entity = httpResponse.getEntity();
+ if (entity != null) {
+ InputStream is = entity.getContent();
+ try {
+ String charSet = EntityUtils.getContentCharSet(entity);
+ if (charSet == null)
+ charSet = "utf-8";
+ Reader r = new InputStreamReader(is,charSet);
+ return (JSONObject)JSONValue.parse(r);
+ } finally {
+ is.close();
+ }
+ }
+ return null;
+ }
+
+ private static String convertToString(HttpResponse httpResponse)
+ throws IOException {
+ HttpEntity entity = httpResponse.getEntity();
+ if (entity != null) {
+ InputStream is = entity.getContent();
+ try {
+ String charSet = EntityUtils.getContentCharSet(entity);
+ if (charSet == null)
+ charSet = "utf-8";
+ char[] buffer = new char[65536];
+ Reader r = new InputStreamReader(is,charSet);
+ Writer w = new StringWriter();
+ try {
+ while (true) {
+ int amt = r.read(buffer);
+ if (amt == -1)
+ break;
+ w.write(buffer,0,amt);
+ }
+ } finally {
+ w.flush();
+ }
+ return w.toString();
+ } finally {
+ is.close();
+ }
+ }
+ return "";
+ }
+
+ private void getRest(String rightside, JiraJSONResponse response) throws IOException {
+
+ final HttpRequestBase method = new HttpGet(URLbase + rightside);
+ method.addHeader("Accept", "application/json");
+
+ try {
+ HttpResponse httpResponse = httpClient.execute(method);
+ int resultCode = httpResponse.getStatusLine().getStatusCode();
+ if (resultCode != 200)
+ throw new IOException("Unexpected result code "+resultCode+": "+convertToString(httpResponse));
+ JSONObject jo = convertToJSON(httpResponse);
+ response.acceptJSONObject(jo);
+ } finally {
+ method.abort();
+ }
+ }
+
+ /**
+ * Obtain repository information.
+ */
+ public Map<String, String> getRepositoryInfo() throws IOException {
+ HashMap<String, String> statistics = new HashMap<String, String>();
+ /*
+ JiraQueryResults qr = new JiraQueryResults();
+ getRest("search?maxResults=1&jql=", qr);
+ statistics.put("Total Issues", qr.getTotal().toString());
+ */
+ return statistics;
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java Thu Jul 4 12:37:10 2013
@@ -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.authorities.authorities.jira;
+
+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.authorities.authorities.jira.common";
+ public static final String DEFAULT_PATH_NAME="org.apache.manifoldcf.authorities.authorities.jira";
+
+ /** 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-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/Messages.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties Thu Jul 4 12:37:10 2013
@@ -0,0 +1,29 @@
+# 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.
+
+JiraAuthorityConnector.Server=Server
+
+JiraAuthorityConnector.JiraProtocolColon=JIRA protocol:
+JiraAuthorityConnector.JiraHostColon=JIRA host:
+JiraAuthorityConnector.JiraPortColon=JIRA port:
+JiraAuthorityConnector.JiraRESTAPIPathColon=JIRA REST API path:
+JiraAuthorityConnector.ClientIDColon=Client ID (Optional):
+JiraAuthorityConnector.ClientSecretColon=Client Secret (Optional):
+JiraAuthorityConnector.JiraHostMustNotBeNull=JIRA host must not be null
+JiraAuthorityConnector.JiraHostMustNotIncludeSlash=JIRA host must not include a '/' character
+JiraAuthorityConnector.JiraPortMustBeAnInteger=JIRA port must be an integer
+JiraAuthorityConnector.JiraPathMustNotBeNull=JIRA path must not be null
+JiraAuthorityConnector.JiraPathMustBeginWithASlash=JIRA path must begin with a '/' character
+
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_en_US.properties
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties Thu Jul 4 12:37:10 2013
@@ -0,0 +1,28 @@
+# 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.
+
+JiraAuthorityConnector.Server=Server
+
+JiraAuthorityConnector.JiraProtocolColon=JIRA protocol:
+JiraAuthorityConnector.JiraHostColon=JIRA host:
+JiraAuthorityConnector.JiraPortColon=JIRA port:
+JiraAuthorityConnector.JiraRESTAPIPathColon=JIRA REST API path:
+JiraAuthorityConnector.ClientIDColon=Client ID (Optional):
+JiraAuthorityConnector.ClientSecretColon=Client Secret (Optional):
+JiraAuthorityConnector.JiraHostMustNotBeNull=JIRA host must not be null
+JiraAuthorityConnector.JiraHostMustNotIncludeSlash=JIRA host must not include a '/' character
+JiraAuthorityConnector.JiraPortMustBeAnInteger=JIRA port must be an integer
+JiraAuthorityConnector.JiraPathMustNotBeNull=JIRA path must not be null
+JiraAuthorityConnector.JiraPathMustBeginWithASlash=JIRA path must begin with a '/' character
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/jira/common_ja_JP.properties
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html Thu Jul 4 12:37:10 2013
@@ -0,0 +1,99 @@
+<!--
+ 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.
+-->
+
+#if($TabName == $ResourceBundle.getString('JiraAuthorityConnector.Server'))
+
+<table class="displaytable">
+ <tr><td class="separator" colspan="2"><hr/></td></tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraProtocolColon'))</nobr>
+ </td>
+ <td class="value">
+ <select size="2" name="jiraprotocol"/>
+#if($JIRAPROTOCOL == 'http')
+ <option value="http" selected="true">http</option>
+#else
+ <option value="http">http</option>
+#end
+#if($JIRAPROTOCOL == 'https')
+ <option value="https" selected="true">https</option>
+#else
+ <option value="https">https</option>
+#end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraHostColon'))</nobr>
+ </td>
+ <td class="value">
+ <input size="32" type="text" id="jirahost" name="jirahost" value="$Encoder.attributeEscape($JIRAHOST)" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPortColon'))</nobr>
+ </td>
+ <td class="value">
+ <input size="5" type="text" id="jiraport" name="jiraport" value="$Encoder.attributeEscape($JIRAPORT)" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraRESTAPIPathColon'))</nobr>
+ </td>
+ <td class="value">
+ <input size="32" type="text" id="jirapath" name="jirapath" value="$Encoder.attributeEscape($JIRAPATH)" />
+ </td>
+ </tr>
+
+ <tr><td class="separator" colspan="2"><hr/></td></tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.ClientIDColon'))</nobr>
+ </td>
+ <td class="value">
+ <input size="16" type="text" id="clientid" name="clientid" value="$Encoder.attributeEscape($CLIENTID)" />
+ </td>
+ </tr>
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.ClientSecretColon'))</nobr>
+ </td>
+ <td class="value">
+ <input size="16" type="password" id="clientsecret" name="clientsecret" value="$Encoder.attributeEscape($CLIENTSECRET)" />
+ </td>
+ </tr>
+</table>
+
+#else
+
+<input type="hidden" name="jiraprotocol" value="$Encoder.attributeEscape($JIRAPROTOCOL)" />
+<input type="hidden" name="jirahost" value="$Encoder.attributeEscape($JIRAHOST)" />
+<input type="hidden" name="jiraport" value="$Encoder.attributeEscape($JIRAPORT)" />
+<input type="hidden" name="jirapath" value="$Encoder.attributeEscape($JIRAPATH)" />
+<input type="hidden" name="clientid" value="$Encoder.attributeEscape($CLIENTID)" />
+<input type="hidden" name="clientsecret" value="$Encoder.attributeEscape($CLIENTSECRET)" />
+
+#end
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.html
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js Thu Jul 4 12:37:10 2013
@@ -0,0 +1,92 @@
+<!--
+ 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.
+-->
+
+<script type="text/javascript">
+<!--
+function checkConfig()
+{
+ if (editconnection.jiraport.value != "" && !isInteger(editconnection.jiraport.value))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPortMustBeAnInteger'))");
+ editconnection.jiraport.focus();
+ return false;
+ }
+
+ if (editconnection.jirahost.value != "" && editconnection.jirahost.value.indexOf("/") != -1)
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraHostMustNotIncludeSlash'))");
+ editconnection.jirahost.focus();
+ return false;
+ }
+
+ if (editconnection.jirapath.value != "" && !editconnection.jirapath.value.startsWith("/"))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPathMustBeginWithASlash'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
+ return true;
+}
+
+function checkConfigForSave()
+{
+
+ if (editconnection.jirahost.value == "")
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraHostMustNotBeNull'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.Server'))");
+ editconnection.jirahost.focus();
+ return false;
+ }
+
+ if (editconnection.jirahost.value != "" && editconnection.jirahost.value.indexOf("/") != -1)
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraHostMustNotIncludeSlash'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.Server'))");
+ editconnection.jirahost.focus();
+ return false;
+ }
+
+ if (editconnection.jiraport.value != "" && !isInteger(editconnection.jiraport.value))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPortMustBeAnInteger'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.Server'))");
+ editconnection.jiraport.focus();
+ return false;
+ }
+
+ if (editconnection.jirapath.value == "")
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPathMustNotBeNull'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.Server'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
+ if (editconnection.jirapath.value != "" && !editconnection.jirapath.value.startsWith("/"))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPathMustBeginWithASlash'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraAuthorityConnector.Server'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
+ return true;
+}
+//-->
+</script>
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/editConfiguration_jira_server.js
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html?rev=1499733&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html (added)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html Thu Jul 4 12:37:10 2013
@@ -0,0 +1,75 @@
+<!--
+ 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.
+-->
+
+<table class="displaytable">
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraProtocolColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($JIRAPROTOCOL)</nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraHostColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($JIRAHOST)</nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraPortColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($JIRAPORT)</nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.JiraRESTAPIPathColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($JIRAPATH)</nobr>
+ </td>
+ </tr>
+
+ <tr><td class="separator" colspan="2"><hr/></td></tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.ClientIDColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($CLIENTID)</nobr>
+ </td>
+ </tr>
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraAuthorityConnector.ClientSecretColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>********</nobr>
+ </td>
+ </tr>
+</table>
+
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/jira/viewConfiguration_jira.html
------------------------------------------------------------------------------
svn:keywords = Id
Modified: manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java Thu Jul 4 12:37:10 2013
@@ -89,11 +89,6 @@ public class LivelinkAuthority extends o
// Livelink does not have "deny" permissions, and there is no such thing as a document with no tokens, so it is safe to not have a local "deny" token.
// However, people feel that a suspenders-and-belt approach is called for, so this restriction has been added.
// Livelink tokens are numbers, "SYSTEM", or "GUEST", so they can't collide with the standard form.
- private static final String denyToken = "DEAD_AUTHORITY";
- private static final AuthorizationResponse unreachableResponse = new AuthorizationResponse(new String[]{denyToken},
- AuthorizationResponse.RESPONSE_UNREACHABLE);
- private static final AuthorizationResponse userNotFoundResponse = new AuthorizationResponse(new String[]{denyToken},
- AuthorizationResponse.RESPONSE_USERNOTFOUND);
/** Constructor.
*/
@@ -446,14 +441,14 @@ public class LivelinkAuthority extends o
{
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("Livelink: Livelink user '"+domainAndUser+"' does not exist");
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
if (status != 0)
{
Logging.authorityConnectors.warn("Livelink: User '"+domainAndUser+"' GetUserInfo error # "+Integer.toString(status)+" "+llServer.getErrors());
// The server is probably down.
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
int deleted = userObject.toInteger("Deleted");
@@ -462,7 +457,7 @@ public class LivelinkAuthority extends o
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("Livelink: Livelink user '"+domainAndUser+"' has been deleted");
// Since the user cannot become undeleted, then this should be treated as 'user does not exist'.
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
int privs = userObject.toInteger("UserPrivileges");
if ((privs & LAPI_USERS.PRIV_PERM_WORLD) == LAPI_USERS.PRIV_PERM_WORLD)
@@ -476,7 +471,7 @@ public class LivelinkAuthority extends o
{
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("Livelink: Livelink error looking up user rights for '"+domainAndUser+"' - user does not exist");
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
if (status != 0)
@@ -485,7 +480,7 @@ public class LivelinkAuthority extends o
// right error code, so just stuff it in the log.
Logging.authorityConnectors.warn("Livelink: For user '"+domainAndUser+"', ListRights error # "+Integer.toString(status)+" "+llServer.getErrors());
// An error code at this level has to indicate a suddenly unreachable authority
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
// Go through the individual objects, and get their IDs. These id's will be the access tokens
@@ -549,7 +544,7 @@ public class LivelinkAuthority extends o
catch (ServiceInterruption e)
{
Logging.authorityConnectors.warn("Livelink: Server seems to be down: "+e.getMessage(),e);
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
}
@@ -561,7 +556,7 @@ public class LivelinkAuthority extends o
public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
{
// The default response if the getConnection method fails
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
// UI support methods.
Modified: manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkConnector.java Thu Jul 4 12:37:10 2013
@@ -95,7 +95,7 @@ public class LivelinkConnector extends o
private final static String ACTIVITY_FETCH = "fetch document";
/** Deny access token for default authority */
- private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
+ private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
// Livelink does not have "deny" permissions, and there is no such thing as a document with no tokens, so it is safe to not have a local "deny" token.
// However, people feel that a suspenders-and-belt approach is called for, so this restriction has been added.
Modified: manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioAuthority.java Thu Jul 4 12:37:10 2013
@@ -73,15 +73,6 @@ public class MeridioAuthority extends or
final private static int MANAGE_DOCUMENT_PRIVILEGE = 17;
- /** Deny access token for Meridio. All tokens begin with "U" or with "G", except the blanket "READ_ALL" that I create.
- * However, we currently have code in the field, so I will continue ot use "DEAD_AUTHORITY" for that reason.
- */
- private final static String denyToken = "DEAD_AUTHORITY";
-
- private final static AuthorizationResponse unreachableResponse = new AuthorizationResponse(new String[]{denyToken},AuthorizationResponse.RESPONSE_UNREACHABLE);
- private final static AuthorizationResponse userNotFoundResponse = new AuthorizationResponse(new String[]{denyToken},AuthorizationResponse.RESPONSE_USERNOTFOUND);
-
-
/** Constructor.
*/
public MeridioAuthority() {}
@@ -551,7 +542,7 @@ public class MeridioAuthority extends or
{
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("Meridio: User '" + userName + "' does not exist");
- return userNotFoundResponse;
+ return RESPONSE_USERNOTFOUND;
}
if (Logging.authorityConnectors.isDebugEnabled())
Logging.authorityConnectors.debug("Meridio: Found user - the User Id for '" + userName +
@@ -677,7 +668,7 @@ public class MeridioAuthority extends or
@Override
public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
{
- return unreachableResponse;
+ return RESPONSE_UNREACHABLE;
}
// UI support methods.
Modified: manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/meridio/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/meridio/MeridioConnector.java Thu Jul 4 12:37:10 2013
@@ -71,7 +71,7 @@ public class MeridioConnector extends or
protected String urlVersionBase = null;
/** Deny access token for Meridio */
- private final static String denyToken = "DEAD_AUTHORITY";
+ private final static String denyToken = GLOBAL_DENY_TOKEN;
/** Deny access token for Active Directory, which is what we expect to be in place for forced acls */
private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
Modified: manifoldcf/branches/CONNECTORS-731/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1499733&r1=1499732&r2=1499733&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java Thu Jul 4 12:37:10 2013
@@ -126,7 +126,7 @@ public class SharePointRepository extend
}
/** Deny access token for default authority */
- private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
+ private final static String defaultAuthorityDenyToken = GLOBAL_DENY_TOKEN;
/** Constructor.
*/