manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1209894 - in /incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main: java/org/apache/manifoldcf/crawler/connectors/alfresco/ resource/org/apache/manifoldcf/crawler/connectors/alfresco/
Date Sat, 03 Dec 2011 11:55:53 GMT
Author: piergiorgio
Date: Sat Dec  3 11:55:52 2011
New Revision: 1209894

URL: http://svn.apache.org/viewvc?rev=1209894&view=rev
Log:
now the Alfresco Connector is provided with default values for the configuration

Modified:
    incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
    incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
    incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html

Modified: incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java?rev=1209894&r1=1209893&r2=1209894&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
(original)
+++ incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoConfig.java
Sat Dec  3 11:55:52 2011
@@ -23,4 +23,12 @@ public class AlfrescoConfig {
   /** Path of the context of the Alfresco Web Services API */
   public static final String PATH_PARAM = "path";
   
+  //default values
+  public static final String USERNAME_DEFAULT_VALUE = "admin";
+  public static final String PASSWORD_DEFAULT_VALUE = "admin";
+  public static final String PROTOCOL_DEFAULT_VALUE = "http";
+  public static final String SERVER_DEFAULT_VALUE = "localhost";
+  public static final String PORT_DEFAULT_VALUE = "8080";
+  public static final String PATH_DEFAULT_VALUE = "/alfresco/api";
+  
 }

Modified: incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java?rev=1209894&r1=1209893&r2=1209894&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
(original)
+++ incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/alfresco/AlfrescoRepositoryConnector.java
Sat Dec  3 11:55:52 2011
@@ -449,6 +449,37 @@ public class AlfrescoRepositoryConnector
   @Override
   public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out,
       ConfigParams parameters) throws ManifoldCFException, IOException {
+    
+    String username = parameters.getParameter(AlfrescoConfig.USERNAME_PARAM);
+    if (StringUtils.isEmpty(username)) {
+      parameters.setParameter(AlfrescoConfig.USERNAME_PARAM, AlfrescoConfig.USERNAME_DEFAULT_VALUE);
+    }
+
+    String password = parameters.getParameter(AlfrescoConfig.PASSWORD_PARAM);
+    if (StringUtils.isEmpty(password)) {
+      parameters.setParameter(AlfrescoConfig.PASSWORD_PARAM, AlfrescoConfig.PASSWORD_DEFAULT_VALUE);
+    }
+    
+    String protocol = parameters.getParameter(AlfrescoConfig.PROTOCOL_PARAM);
+    if (StringUtils.isEmpty(protocol)) {
+      parameters.setParameter(AlfrescoConfig.PROTOCOL_PARAM, AlfrescoConfig.PROTOCOL_DEFAULT_VALUE);
+    }
+    
+    String server = parameters.getParameter(AlfrescoConfig.SERVER_PARAM);
+    if (StringUtils.isEmpty(server)) {
+      parameters.setParameter(AlfrescoConfig.SERVER_PARAM, AlfrescoConfig.SERVER_DEFAULT_VALUE);
+    }
+    
+    String port = parameters.getParameter(AlfrescoConfig.PORT_PARAM);
+    if (StringUtils.isEmpty(port)) {
+      parameters.setParameter(AlfrescoConfig.PORT_PARAM, AlfrescoConfig.PORT_DEFAULT_VALUE);
+    }
+    
+    String path = parameters.getParameter(AlfrescoConfig.PATH_PARAM);
+    if (StringUtils.isEmpty(path)) {
+      parameters.setParameter(AlfrescoConfig.PATH_PARAM, AlfrescoConfig.PATH_DEFAULT_VALUE);
+    }
+    
     outputResource(VIEW_CONFIG_FORWARD, out, parameters);
   }
 
@@ -545,20 +576,24 @@ public class AlfrescoRepositoryConnector
       throws ManifoldCFException {
 
     String username = variableContext.getParameter(AlfrescoConfig.USERNAME_PARAM);
-    if (StringUtils.isNotEmpty(username))
+    if (StringUtils.isNotEmpty(username)) {
       parameters.setParameter(AlfrescoConfig.USERNAME_PARAM, username);
+    }
 
     String password = variableContext.getParameter(AlfrescoConfig.PASSWORD_PARAM);
-    if (StringUtils.isNotEmpty(password))
+    if (StringUtils.isNotEmpty(password)) {
       parameters.setParameter(AlfrescoConfig.PASSWORD_PARAM, password);
-
+    }
+    
     String protocol = variableContext.getParameter(AlfrescoConfig.PROTOCOL_PARAM);
-    if (StringUtils.isNotEmpty(protocol))
+    if (StringUtils.isNotEmpty(protocol)) {
       parameters.setParameter(AlfrescoConfig.PROTOCOL_PARAM, protocol);
-
+    }
+    
     String server = variableContext.getParameter(AlfrescoConfig.SERVER_PARAM);
-    if (StringUtils.isNotEmpty(server) && !StringUtils.contains(server, '/'))
+    if (StringUtils.isNotEmpty(server) && !StringUtils.contains(server, '/')) {
       parameters.setParameter(AlfrescoConfig.SERVER_PARAM, server);
+    }
     
     String port = variableContext.getParameter(AlfrescoConfig.PORT_PARAM);
     if (StringUtils.isNotEmpty(port)){
@@ -571,9 +606,9 @@ public class AlfrescoRepositoryConnector
     }
     
     String path = variableContext.getParameter(AlfrescoConfig.PATH_PARAM);
-    if (StringUtils.isNotEmpty(path))
+    if (StringUtils.isNotEmpty(path)) {
       parameters.setParameter(AlfrescoConfig.PATH_PARAM, path);
-    
+    }
     return null;
   }
 

Modified: incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html?rev=1209894&r1=1209893&r2=1209894&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html
(original)
+++ incubator/lcf/branches/CONNECTORS-287/connectors/alfresco/connector/src/main/resource/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration.html
Sat Dec  3 11:55:52 2011
@@ -28,7 +28,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input type="text" name="username" value="${USERNAME}" />
+			<input id="username" type="text" name="username" value="${USERNAME}" />
 		</td>
 	</tr>
 	<tr>
@@ -38,7 +38,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<input type="password" name="password" value="${PASSWORD}" />
+			<input id="password" type="password" name="password" value="${PASSWORD}" />
 		</td>
 	</tr>
 	<tr>
@@ -48,7 +48,7 @@
 			</nobr>
 		</td>
 		<td class="value">
-			<select name="protocol">
+			<select id="protocol" name="protocol">
 			  <option value="http">http</option>
 			  <option value="https">https</option>
 			</select>
@@ -61,7 +61,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input name="server" type="text" size="32" value="${SERVER}"/>
+        <input id="server" name="server" type="text" size="32" value="${SERVER}"/>
     </td>
   </tr>
   <tr>
@@ -71,7 +71,7 @@
       </nobr>
     </td>
     <td class="value">
-        <input name="port" type="text" size="5" value="${PORT}" />
+        <input id="port" name="port" type="text" size="5" value="${PORT}" />
     </td>
   </tr>
   <tr>
@@ -81,17 +81,50 @@
       </nobr>
     </td>
     <td class="value">
-        <input name="path" type="text" size="32" value="${PATH}" />
+        <input id="path" name="path" type="text" size="32" value="${PATH}" />
     </td>
   </tr>
 </table>
 
 <script type="text/javascript">
+
+var username = "${USERNAME}";
+var password = "${PASSWORD}";
+var server = "${SERVER}";
+var port = "${PORT}";
+var path = "${PATH}";
+
+if(username==null || username==""){
+  var usernameInput = document.getElementById("username");
+  usernameInput.value = "admin";
+}
+
+if(password==null || password==""){
+  var passwordInput = document.getElementById("password");
+  passwordInput.value = "admin";
+}
+
 var protocol = "${PROTOCOL}";
+var protocolSelect = document.getElementById("protocol");
 if(protocol=="https"){
-  var protocolSelect = document.getElementById("protocol");
   protocolSelect.options[1].selected = true;
 } else {
   protocolSelect.options[0].selected = true;
 }
+
+if(server==null || server==""){
+  var serverInput = document.getElementById("server");
+  serverInput.value = "localhost";
+}
+
+if(port==null || port==""){
+  var portInput = document.getElementById("port");
+  portInput.value = "8080";
+}
+
+if(path==null || path==""){
+  var pathInput = document.getElementById("path");
+  pathInput.value = "/alfresco/api";
+}
+
 </script>
\ No newline at end of file



Mime
View raw message