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/03 15:16:36 UTC
svn commit: r1499387 - in /manifoldcf/trunk: ./
connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/
connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/
connectors/jira/connec...
Author: kwright
Date: Wed Jul 3 13:16:35 2013
New Revision: 1499387
URL: http://svn.apache.org/r1499387
Log:
Fix for CONNECTORS-729.
Modified:
manifoldcf/trunk/CHANGES.txt
manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraConfig.java
manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java
manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_en_US.properties
manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_ja_JP.properties
manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.html
manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.js
manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/viewConfiguration_jira.html
manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration-save.PNG
manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration.PNG
Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Jul 3 13:16:35 2013
@@ -3,6 +3,10 @@ $Id$
======================= 1.3-dev =====================
+CONNECTORS-729: Break up Jira URL into components, with proper
+javascript checking.
+(Karl Wright)
+
CONNECTORS-744: Use background threads in HDFS output connector.
(Karl Wright)
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraConfig.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraConfig.java?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraConfig.java (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraConfig.java Wed Jul 3 13:16:35 2013
@@ -27,9 +27,20 @@ public class JiraConfig {
public static final String CLIENT_ID_PARAM = "clientid";
public static final String CLIENT_SECRET_PARAM = "clientsecret";
- public static final String JIRAURL_TOKEN_PARAM = "jiraurl";
- public static final String REPOSITORY_ID_DEFAULT_VALUE = "jira";
+ 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 JIRA_QUERY_PARAM = "jiraquery";
+
+ 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/";
+
public static final String JIRA_QUERY_DEFAULT = "ORDER BY createdDate Asc";
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java Wed Jul 3 13:16:35 2013
@@ -57,8 +57,6 @@ import java.util.Map.Entry;
public class JiraRepositoryConnector extends BaseRepositoryConnector {
protected final static String ACTIVITY_READ = "read document";
- public final static String ACTIVITY_FETCH = "fetch";
- protected static final String RELATIONSHIP_CHILD = "child";
/** Deny access token for default authority */
private final static String defaultAuthorityDenyToken = "DEAD_AUTHORITY";
@@ -110,16 +108,18 @@ public class JiraRepositoryConnector ext
*/
private static final String VIEW_SPEC_FORWARD = "viewSpecification_jira.html";
- /**
- * Endpoint server name
- */
- protected String server = "jira";
+ // 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;
- protected String jiraurl = null;
public JiraRepositoryConnector() {
super();
@@ -133,7 +133,7 @@ public class JiraRepositoryConnector ext
*/
@Override
public String[] getActivitiesList() {
- return new String[]{ACTIVITY_FETCH, ACTIVITY_READ};
+ return new String[]{ACTIVITY_READ};
}
/**
@@ -153,7 +153,7 @@ public class JiraRepositoryConnector ext
*/
@Override
public String[] getBinNames(String documentIdentifier) {
- return new String[]{server};
+ return new String[]{jirahost};
}
/**
@@ -167,9 +167,12 @@ public class JiraRepositoryConnector ext
lastSessionFetch = -1L;
}
+ jiraprotocol = null;
+ jirahost = null;
+ jiraport = null;
+ jirapath = null;
clientid = null;
clientsecret = null;
- jiraurl = null;
}
/**
@@ -186,9 +189,12 @@ public class JiraRepositoryConnector ext
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);
- jiraurl = params.getParameter(JiraConfig.JIRAURL_TOKEN_PARAM);
}
/**
@@ -209,100 +215,59 @@ public class JiraRepositoryConnector ext
}
}
- protected class CheckConnectionThread extends Thread {
-
- protected Throwable exception = null;
-
- public CheckConnectionThread() {
- super();
- setDaemon(true);
- }
-
- public void run() {
- try {
- session.getRepositoryInfo();
- } catch (Throwable e) {
- this.exception = e;
- }
- }
-
- public Throwable getException() {
- return exception;
- }
- }
-
- protected void checkConnection() throws ManifoldCFException, ServiceInterruption {
- getSession();
- CheckConnectionThread t = new CheckConnectionThread();
- try {
- t.start();
- t.join();
- Throwable thr = t.getException();
- if (thr != null) {
- if (thr instanceof IOException) {
- throw (IOException) thr;
- } else if (thr instanceof RuntimeException) {
- throw (RuntimeException) thr;
- } else {
- throw (Error) thr;
- }
- }
- return;
- } catch (InterruptedException e) {
- t.interrupt();
- throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
- ManifoldCFException.INTERRUPTED);
- } catch (java.net.SocketTimeoutException e) {
- Logging.connectors.warn("JIRA: Socket timeout: " + e.getMessage(), e);
- handleIOException(e);
- } catch (InterruptedIOException e) {
- t.interrupt();
- throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
- ManifoldCFException.INTERRUPTED);
- } catch (IOException e) {
- Logging.connectors.warn("JIRA: Error checking repository: " + e.getMessage(), e);
- handleIOException(e);
- }
- }
/**
* Set up a session
*/
- protected void getSession() throws ManifoldCFException, ServiceInterruption {
+ protected JiraSession getSession() throws ManifoldCFException, ServiceInterruption {
if (session == null) {
// Check for parameter validity
- if (StringUtils.isEmpty(clientid)) {
- throw new ManifoldCFException("Parameter " + JiraConfig.CLIENT_ID_PARAM
+ if (StringUtils.isEmpty(jiraprotocol)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_PROTOCOL_PARAM
+ " required but not set");
}
if (Logging.connectors.isDebugEnabled()) {
- Logging.connectors.debug("JIRA: Clientid = '" + clientid + "'");
+ Logging.connectors.debug("JIRA: jiraprotocol = '" + jiraprotocol + "'");
}
- if (StringUtils.isEmpty(clientsecret)) {
- throw new ManifoldCFException("Parameter " + JiraConfig.CLIENT_SECRET_PARAM
+ if (StringUtils.isEmpty(jirahost)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_HOST_PARAM
+ " required but not set");
}
if (Logging.connectors.isDebugEnabled()) {
- Logging.connectors.debug("JIRA: Clientsecret = '" + clientsecret + "'");
+ Logging.connectors.debug("JIRA: jirahost = '" + jirahost + "'");
}
- if (StringUtils.isEmpty(jiraurl)) {
- throw new ManifoldCFException("Parameter " + JiraConfig.JIRAURL_TOKEN_PARAM
+ if (Logging.connectors.isDebugEnabled()) {
+ Logging.connectors.debug("JIRA: jiraport = '" + jiraport + "'");
+ }
+
+ if (StringUtils.isEmpty(jirapath)) {
+ throw new ManifoldCFException("Parameter " + JiraConfig.JIRA_PATH_PARAM
+ " required but not set");
}
if (Logging.connectors.isDebugEnabled()) {
- Logging.connectors.debug("JIRA: jiraurl = '" + jiraurl + "'");
+ Logging.connectors.debug("JIRA: jirapath = '" + jirapath + "'");
+ }
+
+ if (Logging.connectors.isDebugEnabled()) {
+ Logging.connectors.debug("JIRA: Clientid = '" + clientid + "'");
}
+ if (Logging.connectors.isDebugEnabled()) {
+ Logging.connectors.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
@@ -337,7 +302,7 @@ public class JiraRepositoryConnector ext
*/
@Override
public String[] getRelationshipTypes() {
- return new String[]{RELATIONSHIP_CHILD};
+ return new String[]{};
}
/**
@@ -348,25 +313,37 @@ public class JiraRepositoryConnector ext
* @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);
- String jiraurl = parameters.getParameter(JiraConfig.JIRAURL_TOKEN_PARAM);
- if (clientid == null) {
- clientid = StringUtils.EMPTY;
- }
+ 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 (clientsecret == null) {
- clientsecret = StringUtils.EMPTY;
- }
-
- if (jiraurl == null) {
- jiraurl = StringUtils.EMPTY;
+ 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);
- newMap.put("JIRAURL", jiraurl);
}
/**
@@ -458,22 +435,33 @@ public class JiraRepositoryConnector ext
*/
@Override
public String processConfigurationPost(IThreadContext threadContext,
- IPostParameters variableContext, ConfigParams parameters)
- throws ManifoldCFException {
+ IPostParameters variableContext, ConfigParams parameters)
+ throws ManifoldCFException {
- String clientid = variableContext.getParameter(JiraConfig.CLIENT_ID_PARAM);
- if (clientid != null) {
+ 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(JiraConfig.CLIENT_SECRET_PARAM);
+ String clientsecret = variableContext.getParameter("clientsecret");
if (clientsecret != null) {
- parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, clientsecret);
- }
-
- String jiraurl = variableContext.getParameter(JiraConfig.JIRAURL_TOKEN_PARAM);
- if (jiraurl != null) {
- parameters.setParameter(JiraConfig.JIRAURL_TOKEN_PARAM, jiraurl);
+ if (!clientsecret.equals(EXISTING_VALUE_PASSWORD))
+ parameters.setObfuscatedParameter(JiraConfig.CLIENT_SECRET_PARAM, clientsecret);
}
return null;
@@ -720,8 +708,7 @@ public class JiraRepositoryConnector ext
i++;
}
- getSession();
- GetSeedsThread t = new GetSeedsThread(jiraDriveQuery);
+ GetSeedsThread t = new GetSeedsThread(getSession(), jiraDriveQuery);
try {
t.start();
boolean wasInterrupted = false;
@@ -752,126 +739,16 @@ public class JiraRepositoryConnector ext
throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
ManifoldCFException.INTERRUPTED);
} catch (java.net.SocketTimeoutException e) {
- Logging.connectors.warn("JIRA: Socket timeout adding seed documents: " + e.getMessage(), e);
handleIOException(e);
} catch (InterruptedIOException e) {
t.interrupt();
- throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
- ManifoldCFException.INTERRUPTED);
- } catch (IOException e) {
- Logging.connectors.warn("JIRA: Error adding seed documents: " + e.getMessage(), e);
- handleIOException(e);
- }
- }
-
- protected class GetSeedsThread extends Thread {
-
- protected Throwable exception = null;
- protected final String jiraDriveQuery;
- protected final XThreadStringBuffer seedBuffer;
-
- public GetSeedsThread(String jiraDriveQuery) {
- super();
- this.jiraDriveQuery = jiraDriveQuery;
- this.seedBuffer = new XThreadStringBuffer();
- setDaemon(true);
- }
-
- @Override
- public void run() {
- try {
- session.getSeeds(seedBuffer, jiraDriveQuery);
- seedBuffer.signalDone();
- } catch (Throwable e) {
- this.exception = e;
- }
- }
-
- public XThreadStringBuffer getBuffer() {
- return seedBuffer;
- }
-
- public void finishUp()
- throws InterruptedException, IOException {
- seedBuffer.abandon();
- join();
- Throwable thr = exception;
- if (thr != null) {
- if (thr instanceof IOException)
- throw (IOException) thr;
- else if (thr instanceof RuntimeException)
- throw (RuntimeException) thr;
- else if (thr instanceof Error)
- throw (Error) thr;
- else
- throw new RuntimeException("Unhandled exception of type: "+thr.getClass().getName(),thr);
- }
- }
- }
-
- protected JiraIssue getIssue(String issueID)
- throws ManifoldCFException, ServiceInterruption {
- getSession();
- GetIssueThread t = new GetIssueThread(issueID);
- try {
- t.start();
- t.join();
- Throwable thr = t.getException();
- if (thr != null) {
- if (thr instanceof IOException) {
- throw (IOException) thr;
- } else if (thr instanceof RuntimeException) {
- throw (RuntimeException) thr;
- } else {
- throw (Error) thr;
- }
- }
- } catch (InterruptedException e) {
- t.interrupt();
- throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
- ManifoldCFException.INTERRUPTED);
- } catch (java.net.SocketTimeoutException e) {
- Logging.connectors.warn("JIRA: Socket timeout getting object: " + e.getMessage(), e);
handleIOException(e);
- } catch (InterruptedIOException e) {
- t.interrupt();
- throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
- ManifoldCFException.INTERRUPTED);
} catch (IOException e) {
- Logging.connectors.warn("JIRA: Error getting object: " + e.getMessage(), e);
handleIOException(e);
}
- return t.getResponse();
}
- protected class GetIssueThread extends Thread {
-
- protected final String nodeId;
- protected Throwable exception = null;
- protected JiraIssue response = null;
-
- public GetIssueThread(String nodeId) {
- super();
- setDaemon(true);
- this.nodeId = nodeId;
- }
-
- public void run() {
- try {
- response = session.getIssue(nodeId);
- } catch (Throwable e) {
- this.exception = e;
- }
- }
- public JiraIssue getResponse() {
- return response;
- }
-
- public Throwable getException() {
- return exception;
- }
- }
/**
* Process a set of documents. This is the method that should cause each
@@ -1096,10 +973,177 @@ public class JiraRepositoryConnector ext
throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
ManifoldCFException.INTERRUPTED);
}
+ Logging.connectors.warn("JIRA: IO exception: "+e.getMessage(), e);
long currentTime = System.currentTimeMillis();
throw new ServiceInterruption("IO exception: "+e.getMessage(), e, currentTime + 300000L,
currentTime + 3 * 60 * 60000L,-1,false);
}
+ // 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, ServiceInterruption {
+ 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);
+ }
+ }
+
+ protected static class GetSeedsThread extends Thread {
+
+ protected Throwable exception = null;
+ protected final JiraSession session;
+ protected final String jiraDriveQuery;
+ protected final XThreadStringBuffer seedBuffer;
+
+ public GetSeedsThread(JiraSession session, String jiraDriveQuery) {
+ super();
+ this.session = session;
+ this.jiraDriveQuery = jiraDriveQuery;
+ this.seedBuffer = new XThreadStringBuffer();
+ setDaemon(true);
+ }
+
+ @Override
+ public void run() {
+ try {
+ session.getSeeds(seedBuffer, jiraDriveQuery);
+ seedBuffer.signalDone();
+ } catch (Throwable e) {
+ this.exception = e;
+ }
+ }
+
+ public XThreadStringBuffer getBuffer() {
+ return seedBuffer;
+ }
+
+ public void finishUp()
+ throws InterruptedException, IOException {
+ seedBuffer.abandon();
+ join();
+ Throwable thr = exception;
+ if (thr != null) {
+ if (thr instanceof IOException)
+ throw (IOException) thr;
+ else if (thr instanceof RuntimeException)
+ throw (RuntimeException) thr;
+ else if (thr instanceof Error)
+ throw (Error) thr;
+ else
+ throw new RuntimeException("Unhandled exception of type: "+thr.getClass().getName(),thr);
+ }
+ }
+ }
+
+ protected JiraIssue getIssue(String issueID)
+ throws ManifoldCFException, ServiceInterruption {
+ GetIssueThread t = new GetIssueThread(getSession(), issueID);
+ try {
+ t.start();
+ t.finishUp();
+ } 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);
+ }
+ return t.getResponse();
+ }
+
+ protected static class GetIssueThread extends Thread {
+
+ protected final JiraSession session;
+ protected final String nodeId;
+ protected Throwable exception = null;
+ protected JiraIssue response = null;
+
+ public GetIssueThread(JiraSession session, String nodeId) {
+ super();
+ setDaemon(true);
+ this.session = session;
+ this.nodeId = nodeId;
+ }
+
+ public void run() {
+ try {
+ response = session.getIssue(nodeId);
+ } catch (Throwable e) {
+ this.exception = e;
+ }
+ }
+
+ public JiraIssue getResponse() {
+ return response;
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+
}
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java Wed Jul 3 13:16:35 2013
@@ -76,8 +76,6 @@ public class JiraSession {
private ClientConnectionManager connectionManager;
private HttpClient httpClient;
- private final static String apiPost = "/rest/api/2/";
-
/**
* Constructor. Create a session.
*/
@@ -193,7 +191,7 @@ public class JiraSession {
private void getRest(String rightside, JiraJSONResponse response) throws IOException {
- final HttpRequestBase method = new HttpGet(URLbase + apiPost + rightside);
+ final HttpRequestBase method = new HttpGet(URLbase + rightside);
method.addHeader("Accept", "application/json");
try {
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_en_US.properties?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_en_US.properties (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_en_US.properties Wed Jul 3 13:16:35 2013
@@ -16,21 +16,21 @@
JiraRepositoryConnector.Server=Server
JiraRepositoryConnector.JiraQuery=Seed Query
JiraRepositoryConnector.Security=Security
-JiraRepositoryConnector.ClientSecret=Client Secret
-JiraRepositoryConnector.JiraUrlColon=JiraUrl:
-JiraRepositoryConnector.JiraUrl=JiraUrl
+JiraRepositoryConnector.JiraProtocolColon=JIRA protocol:
+JiraRepositoryConnector.JiraHostColon=JIRA host:
+JiraRepositoryConnector.JiraPortColon=JIRA port:
+JiraRepositoryConnector.JiraRESTAPIPathColon=JIRA REST API path:
JiraRepositoryConnector.ClientIDColon=Client ID (Optional):
-JiraRepositoryConnector.ClientID=Client ID
JiraRepositoryConnector.ClientSecretColon=Client Secret (Optional):
+JiraRepositoryConnector.JiraHostMustNotBeNull=JIRA host must not be null
+JiraRepositoryConnector.JiraHostMustNotIncludeSlash=JIRA host must not include a '/' character
+JiraRepositoryConnector.JiraPortMustBeAnInteger=JIRA port must be an integer
+JiraRepositoryConnector.JiraPathMustNotBeNull=JIRA path must not be null
+JiraRepositoryConnector.JiraPathMustBeginWithASlash=JIRA path must begin with a '/' character
-
-JiraRepositoryConnector.JiraUrlMustNotBeNull=Jira URL must not be null
-JiraRepositoryConnector.ClientSecretMustNotBeNull=Client Secret must not be null
-JiraRepositoryConnector.ClientMustNotBeNull=Client must not be null
-
+JiraRepositoryConnector.JiraQueryColon=JIRA query:
JiraRepositoryConnector.SeedQueryCannotBeNull=Seed query cannot be null
-JiraRepositoryConnector.JiraQueryColon=Jira Query:
JiraRepositoryConnector.NoAccessTokensPresent=No access tokens present
JiraRepositoryConnector.Add=Add
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_ja_JP.properties?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_ja_JP.properties (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/jira/common_ja_JP.properties Wed Jul 3 13:16:35 2013
@@ -16,21 +16,21 @@
JiraRepositoryConnector.Server=Server
JiraRepositoryConnector.JiraQuery=Seed Query
JiraRepositoryConnector.Security=Security
-JiraRepositoryConnector.ClientSecret=Client Secret
-JiraRepositoryConnector.JiraUrlColon=JiraUrl:
-JiraRepositoryConnector.JiraUrl=JiraUrl
-JiraRepositoryConnector.ClientIDColon=Client ID:
-JiraRepositoryConnector.ClientID=Client ID
-JiraRepositoryConnector.ClientSecretColon=Client Secret:
-
-
-JiraRepositoryConnector.JiraUrlMustNotBeNull=Jira URL must not be null
-JiraRepositoryConnector.ClientSecretMustNotBeNull=Client Secret must not be null
-JiraRepositoryConnector.ClientMustNotBeNull=Client must not be null
+JiraRepositoryConnector.JiraProtocolColon=JIRA protocol:
+JiraRepositoryConnector.JiraHostColon=JIRA host:
+JiraRepositoryConnector.JiraPortColon=JIRA port:
+JiraRepositoryConnector.JiraRESTAPIPathColon=JIRA REST API path:
+JiraRepositoryConnector.ClientIDColon=Client ID (Optional):
+JiraRepositoryConnector.ClientSecretColon=Client Secret (Optional):
+JiraRepositoryConnector.JiraHostMustNotBeNull=JIRA host must not be null
+JiraRepositoryConnector.JiraHostMustNotIncludeSlash=JIRA host must not include a '/' character
+JiraRepositoryConnector.JiraPortMustBeAnInteger=JIRA port must be an integer
+JiraRepositoryConnector.JiraPathMustNotBeNull=JIRA path must not be null
+JiraRepositoryConnector.JiraPathMustBeginWithASlash=JIRA path must begin with a '/' character
+JiraRepositoryConnector.JiraQueryColon=JIRA query:
JiraRepositoryConnector.SeedQueryCannotBeNull=Seed query cannot be null
-JiraRepositoryConnector.JiraQueryColon=Jira Query:
JiraRepositoryConnector.NoAccessTokensPresent=No access tokens present
JiraRepositoryConnector.Add=Add
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.html?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.html (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.html Wed Jul 3 13:16:35 2013
@@ -18,47 +18,82 @@
#if($TabName == $ResourceBundle.getString('JiraRepositoryConnector.Server'))
<table class="displaytable">
+ <tr><td class="separator" colspan="2"><hr/></td></tr>
+
<tr>
- <td class="separator" colspan="2">
- <hr />
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.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('JiraRepositoryConnector.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('JiraRepositoryConnector.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('JiraRepositoryConnector.JiraUrl'))
- </nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraRESTAPIPathColon'))</nobr>
</td>
<td class="value">
- <input type="text" id="jiraurl" name="jiraurl" value="$Encoder.attributeEscape($JIRAURL)" />
+ <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('JiraRepositoryConnector.ClientID'))
- </nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientIDColon'))</nobr>
</td>
<td class="value">
- <input type="text" id="clientid" name="clientid" value="$Encoder.attributeEscape($CLIENTID)" />
+ <input size="16" type="text" id="clientid" name="clientid" value="$Encoder.attributeEscape($CLIENTID)" />
</td>
</tr>
<tr>
<td class="description">
- <nobr>
- $Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientSecret'))
- </nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientSecretColon'))</nobr>
</td>
<td class="value">
- <input type="password" id="clientsecret" name="clientsecret" value="$Encoder.attributeEscape($CLIENTSECRET)" />
+ <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)" />
-<input type="hidden" name="jiraurl" value="$Encoder.attributeEscape($JIRAURL)" />
#end
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.js
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.js?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.js (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/editConfiguration_jira_server.js Wed Jul 3 13:16:35 2013
@@ -19,34 +19,73 @@
<!--
function checkConfig()
{
+ if (editconnection.jiraport.value != "" && !isInteger(editconnection.jiraport.value))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPortMustBeAnInteger'))");
+ editconnection.jiraport.focus();
+ return false;
+ }
+
+ if (editconnection.jirahost.value != "" && editconnection.jirahost.value.indexOf("/") != -1)
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraHostMustNotIncludeSlash'))");
+ editconnection.jirahost.focus();
+ return false;
+ }
+
+ if (editconnection.jirapath.value != "" && !editconnection.jirapath.value.startsWith("/"))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPathMustBeginWithASlash'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
return true;
}
function checkConfigForSave()
{
- if (editconnection.jiraurl.value == "")
+ if (editconnection.jirahost.value == "")
{
- alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraUrlMustNotBeNull'))");
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraHostMustNotBeNull'))");
SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.Server'))");
- editconnection.jsonauth.focus();
+ editconnection.jirahost.focus();
return false;
}
- /* -- allow anonymous access
- if (editconnection.clientid.value == "")
+
+ if (editconnection.jirahost.value != "" && editconnection.jirahost.value.indexOf("/") != -1)
{
- alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientMustNotBeNull'))");
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraHostMustNotIncludeSlash'))");
SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.Server'))");
- editconnection.key.focus();
+ editconnection.jirahost.focus();
return false;
}
- if (editconnection.clientsecret.value == "")
+
+ if (editconnection.jiraport.value != "" && !isInteger(editconnection.jiraport.value))
{
- alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientSecretMustNotBeNull'))");
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPortMustBeAnInteger'))");
SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.Server'))");
- editconnection.secret.focus();
+ editconnection.jiraport.focus();
return false;
- }*/
+ }
+
+ if (editconnection.jirapath.value == "")
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPathMustNotBeNull'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.Server'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
+ if (editconnection.jirapath.value != "" && !editconnection.jirapath.value.startsWith("/"))
+ {
+ alert("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPathMustBeginWithASlash'))");
+ SelectTab("$Encoder.bodyJavascriptEscape($ResourceBundle.getString('JiraRepositoryConnector.Server'))");
+ editconnection.jirapath.focus();
+ return false;
+ }
+
return true;
}
//-->
Modified: manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/viewConfiguration_jira.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/viewConfiguration_jira.html?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/viewConfiguration_jira.html (original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/jira/viewConfiguration_jira.html Wed Jul 3 13:16:35 2013
@@ -16,28 +16,59 @@
-->
<table class="displaytable">
+
<tr>
<td class="description">
- <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientIDColon'))</nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraProtocolColon'))</nobr>
</td>
<td class="value">
- <nobr>$Encoder.bodyEscape($CLIENTID)</nobr>
+ <nobr>$Encoder.bodyEscape($JIRAPROTOCOL)</nobr>
</td>
</tr>
+
<tr>
<td class="description">
- <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientSecretColon'))</nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraHostColon'))</nobr>
</td>
<td class="value">
- <nobr>********</nobr>
+ <nobr>$Encoder.bodyEscape($JIRAHOST)</nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraPortColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($JIRAPORT)</nobr>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="description">
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.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('JiraRepositoryConnector.ClientIDColon'))</nobr>
+ </td>
+ <td class="value">
+ <nobr>$Encoder.bodyEscape($CLIENTID)</nobr>
</td>
</tr>
<tr>
<td class="description">
- <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.JiraUrlColon'))</nobr>
+ <nobr>$Encoder.bodyEscape($ResourceBundle.getString('JiraRepositoryConnector.ClientSecretColon'))</nobr>
</td>
<td class="value">
- <nobr>$Encoder.bodyEscape($JIRAURL)</nobr>
+ <nobr>********</nobr>
</td>
</tr>
</table>
Modified: manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration-save.PNG
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration-save.PNG?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
Binary files - no diff available.
Modified: manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration.PNG
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/site/src/documentation/resources/images/en_US/jira-repository-connection-configuration.PNG?rev=1499387&r1=1499386&r2=1499387&view=diff
==============================================================================
Binary files - no diff available.