Author: kwright
Date: Thu Oct 24 15:15:28 2013
New Revision: 1535407
URL: http://svn.apache.org/r1535407
Log:
Hook up authgroups into repository connections
Modified:
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editconnection.jsp
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listconnections.jsp
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewconnection.jsp
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
Modified:
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editconnection.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editconnection.jsp?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editconnection.jsp
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editconnection.jsp
Thu Oct 24 15:15:28 2013
@@ -32,7 +32,7 @@
IRepositoryConnectionManager connMgr =
RepositoryConnectionManagerFactory.make(threadContext);
// Also get the list of available connectors
IConnectorManager connectorManager =
ConnectorManagerFactory.make(threadContext);
- IAuthorityConnectionManager authConnectionManager =
AuthorityConnectionManagerFactory.make(threadContext);
+ IAuthorityGroupManager authGroupManager =
AuthorityGroupManagerFactory.make(threadContext);
// Figure out what the current tab name is.
String tabName = variableContext.getParameter("tabname");
@@ -422,10 +422,10 @@
</td>
</tr>
<tr>
- <td
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityColon")%></nobr></td>
+ <td
class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityGroupColon")%></nobr></td>
<td class="value" colspan="4">
<%
- IAuthorityConnection[] set2 =
authConnectionManager.getAllConnections();
+ IAuthorityGroup[] set2 = authGroupManager.getAllGroups();
int i = 0;
%>
<select name="authorityname" size="1">
@@ -433,7 +433,7 @@
<%
while (i < set2.length)
{
- IAuthorityConnection row = set2[i++];
+ IAuthorityGroup row = set2[i++];
String thisAuthorityName = row.getName();
String thisDescription = row.getDescription();
if (thisDescription == null || thisDescription.length() == 0)
Modified:
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listconnections.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listconnections.jsp?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listconnections.jsp
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listconnections.jsp
Thu Oct 24 15:15:28 2013
@@ -75,7 +75,11 @@
<td class="separator" colspan="6"><hr/></td>
</tr>
<tr class="headerrow">
- <td class="columnheader"></td><td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Name")%></td><td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Description")%></td><td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.ConnectionType")%></td><td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Authority")%></td>
+ <td class="columnheader"></td>
+ <td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Name")%></td>
+ <td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Description")%></td>
+ <td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.ConnectionType")%></td>
+ <td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.AuthorityGroup")%></td>
<td
class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Max")%></td>
</tr>
<%
Modified:
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewconnection.jsp
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewconnection.jsp?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewconnection.jsp
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewconnection.jsp
Thu Oct 24 15:15:28 2013
@@ -134,7 +134,7 @@
<td class="description"
colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.MaxConnectionsColon")%></nobr></td><td
class="value"
colspan="1"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(Integer.toString(maxCount))%></td>
</tr>
<tr>
- <td class="description"
colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.AuthorityColon")%></nobr></td><td
class="value"
colspan="3"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(authorityName)%></nobr></td>
+ <td class="description"
colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.AuthorityGroupColon")%></nobr></td><td
class="value"
colspan="3"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(authorityName)%></nobr></td>
</tr>
<tr>
<td class="separator" colspan="4"><hr/></td>
Modified:
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
Thu Oct 24 15:15:28 2013
@@ -57,9 +57,12 @@ public class RepositoryConnectionManager
protected final static String nameField = "connectionname"; // Changed
this to work around constraint bug in postgresql
protected final static String descriptionField = "description";
protected final static String classNameField = "classname";
- protected final static String authorityNameField = "authorityname";
protected final static String maxCountField = "maxcount";
protected final static String configField = "configxml";
+ protected final static String groupNameField = "groupname";
+
+ // Discontinued fields
+ protected final static String authorityNameField = "authorityname";
protected static Random random = new Random();
@@ -93,7 +96,7 @@ public class RepositoryConnectionManager
throws ManifoldCFException
{
// First, get the authority manager table name and name column
- IAuthorityConnectionManager authMgr =
AuthorityConnectionManagerFactory.make(threadContext);
+ IAuthorityGroupManager authMgr =
AuthorityGroupManagerFactory.make(threadContext);
// Always use a loop, and no transaction, as we may need to retry due to
upgrade
while (true)
@@ -106,15 +109,57 @@ public class RepositoryConnectionManager
map.put(nameField,new
ColumnDescription("VARCHAR(32)",true,false,null,null,false));
map.put(descriptionField,new
ColumnDescription("VARCHAR(255)",false,true,null,null,false));
map.put(classNameField,new
ColumnDescription("VARCHAR(255)",false,false,null,null,false));
- map.put(authorityNameField,new
ColumnDescription("VARCHAR(32)",false,true,
- authMgr.getTableName(),authMgr.getAuthorityNameColumn(),false));
+ map.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,true,
+ authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
map.put(maxCountField,new
ColumnDescription("BIGINT",false,false,null,null,false));
map.put(configField,new
ColumnDescription("LONGTEXT",false,true,null,null,false));
performCreate(map,null);
}
else
{
- // Upgrade code would go here, if needed.
+ // Upgrade code
+ ColumnDescription cd = (ColumnDescription)existing.get(groupNameField);
+ if (cd == null)
+ {
+ Map addMap = new HashMap();
+ addMap.put(groupNameField,new
ColumnDescription("VARCHAR(32)",false,true,
+ authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
+ performAlter(addMap,null,null,null);
+ }
+ // Get rid of the authorityName field. When we do this we need to
copy into the group name
+ // field, adding groups if they don't yet exist first
+ cd = (ColumnDescription)existing.get(authorityNameField);
+ if (cd != null)
+ {
+ ArrayList params = new ArrayList();
+ IResultSet set = performQuery("SELECT
"+nameField+","+authorityNameField+" FROM "+getTableName(),null,null,null);
+ for (int i = 0 ; i < set.getRowCount() ; i++)
+ {
+ IResultRow row = set.getRow(i);
+ String repoName = (String)row.getValue(nameField);
+ String authName = (String)row.getValue(authorityNameField);
+ if (authName != null && authName.length() > 0)
+ {
+ IAuthorityGroup gp = authMgr.load(authName);
+ if (gp == null)
+ {
+ // Create an authority group with this name
+ gp = authMgr.create();
+ gp.setName(authName);
+ authMgr.save(gp);
+ }
+ Map<String,String> map = new HashMap<String,String>();
+ map.put(groupNameField,authName);
+ params.clear();
+ String query = buildConjunctionClause(params,new
ClauseDescription[]{
+ new UnitaryClause(nameField,repoName)});
+ performUpdate(map," WHERE "+query,params,null);
+ }
+ }
+ List<String> deleteList = new ArrayList<String>();
+ deleteList.add(authorityNameField);
+ performAlter(null,null,deleteList,null);
+ }
}
// Install dependent tables.
@@ -122,7 +167,7 @@ public class RepositoryConnectionManager
throttleSpecManager.install(getTableName(),nameField);
// Index management
- IndexDescription authorityIndex = new IndexDescription(false,new
String[]{authorityNameField});
+ IndexDescription authorityIndex = new IndexDescription(false,new
String[]{groupNameField});
IndexDescription classIndex = new IndexDescription(false,new
String[]{classNameField});
// Get rid of indexes that shouldn't be there
@@ -368,7 +413,7 @@ public class RepositoryConnectionManager
HashMap values = new HashMap();
values.put(descriptionField,object.getDescription());
values.put(classNameField,object.getClassName());
- values.put(authorityNameField,object.getACLAuthority());
+ values.put(groupNameField,object.getACLAuthority());
values.put(maxCountField,new
Long((long)object.getMaxConnections()));
String configXML = object.getConfigParams().toXML();
values.put(configField,configXML);
@@ -507,10 +552,10 @@ public class RepositoryConnectionManager
}
/** Return true if the specified authority name is referenced.
- *@param authorityName is the authority name.
+ *@param groupName is the group name.
*@return true if referenced, false otherwise.
*/
- public boolean isReferenced(String authorityName)
+ public boolean isReferenced(String groupName)
throws ManifoldCFException
{
StringSetBuffer ssb = new StringSetBuffer();
@@ -518,7 +563,7 @@ public class RepositoryConnectionManager
StringSet localCacheKeys = new StringSet(ssb);
ArrayList params = new ArrayList();
String query = buildConjunctionClause(params,new ClauseDescription[]{
- new UnitaryClause(authorityNameField,authorityName)});
+ new UnitaryClause(groupNameField,groupName)});
IResultSet set = performQuery("SELECT "+nameField+" FROM
"+getTableName()+" WHERE "+query,params,
localCacheKeys,null);
return set.getRowCount() > 0;
@@ -867,7 +912,7 @@ public class RepositoryConnectionManager
rc.setName(name);
rc.setDescription((String)row.getValue(descriptionField));
rc.setClassName((String)row.getValue(classNameField));
- rc.setACLAuthority((String)row.getValue(authorityNameField));
+ rc.setACLAuthority((String)row.getValue(groupNameField));
rc.setMaxConnections((int)((Long)row.getValue(maxCountField)).longValue());
String xml = (String)row.getValue(configField);
if (xml != null && xml.length() > 0)
Modified:
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
Thu Oct 24 15:15:28 2013
@@ -223,7 +223,7 @@ listconnections.ListOfRepositoryConnecti
listconnections.Name=Name
listconnections.Description=Description
listconnections.ConnectionType=Connection Type
-listconnections.Authority=Authority
+listconnections.AuthorityGroup=Authority Group
listconnections.Max=Max
listconnections.AddNewConnection=Add new connection
listconnections.View=View
@@ -236,7 +236,7 @@ listconnections.uninstalled=(uninstalled
editconnection.ApacheManifoldCFEditConnection=Apache ManifoldCF: Edit
Connection
editconnection.EditAConnection=Edit a Connection
editconnection.ConnectionTypeColon=Connection type:
-editconnection.AuthorityColon=Authority:
+editconnection.AuthorityGroupColon=Authority group:
editconnection.Cancel=Cancel
editconnection.CancelConnectionEditing=Cancel connection editing
editconnection.NameColon=Name:
@@ -273,7 +273,7 @@ viewconnection.NameColon=Name:
viewconnection.DescriptionColon=Description:
viewconnection.ConnectionTypeColon=Connection type:
viewconnection.MaxConnectionsColon=Max connections:
-viewconnection.AuthorityColon=Authority:
+viewconnection.AuthorityGroupColon=Authority group:
viewconnection.ThrottlingColon=Throttling:
viewconnection.NoThrottles=No throttles
viewconnection.ConnectionStatusColon=Connection status:
Modified:
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties?rev=1535407&r1=1535406&r2=1535407&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
(original)
+++
manifoldcf/branches/CONNECTORS-792/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
Thu Oct 24 15:15:28 2013
@@ -223,7 +223,7 @@ listconnections.ListOfRepositoryConnecti
listconnections.Name=åå
listconnections.Description=説æ
listconnections.ConnectionType=ã³ãã¯ã·ã§ã³ã¿ã¤ã
-listconnections.Authority=権é
+listconnections.AuthorityGroup=Authority Group
listconnections.Max=æå¤§å¤
listconnections.AddNewConnection=æ°ããã³ãã¯ã·ã§ã³ã追å
listconnections.View=表示
@@ -236,7 +236,7 @@ listconnections.uninstalled=ï¼ã¢
editconnection.ApacheManifoldCFEditConnection=Apache
ManifoldCFï¼ã³ãã¯ã·ã§ã³ãç·¨é
editconnection.EditAConnection=ã³ãã¯ã·ã§ã³ãç·¨é
editconnection.ConnectionTypeColon=ã³ãã¯ã·ã§ã³ã¿ã¤ãï¼
-editconnection.AuthorityColon=権éï¼
+editconnection.AuthorityGroupColon=Authority group:
editconnection.Cancel=ãã£ã³ã»ã«
editconnection.CancelConnectionEditing=ã³ãã¯ã·ã§ã³ã®ç·¨éããã£ã³ã»ã«
editconnection.NameColon=ååï¼
@@ -273,7 +273,7 @@ viewconnection.NameColon=ååï�
viewconnection.DescriptionColon=説æï¼
viewconnection.ConnectionTypeColon=ã³ãã¯ã·ã§ã³ã¿ã¤ãï¼
viewconnection.MaxConnectionsColon=æå¤§ã³ãã¯ã·ã§ã³æ°ï¼
-viewconnection.AuthorityColon=権éï¼
+viewconnection.AuthorityGroupColon=Authority group:
viewconnection.ThrottlingColon=ã¹ããããªã³ã°ï¼
viewconnection.NoThrottles=ã¹ããããªã³ã°ãªã
viewconnection.ConnectionStatusColon=ã³ãã¯ã·ã§ã³ã®ç¶æ
ï¼