gatein SVN: r5290 - in components/wsrp/trunk/producer/src: test/java/org/gatein/wsrp/producer/handlers/processors and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-11-26 06:12:13 -0500 (Fri, 26 Nov 2010)
New Revision: 5290
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java
components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
Log:
- GTNWSRP-175: Properly deal with wildcard in MIME type requests.
- GNTWSRP-176: Stop looking for next possible matches if we've found one already.
- Updated and added more tests.
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java 2010-11-26 10:18:30 UTC (rev 5289)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/handlers/processors/RequestProcessor.java 2010-11-26 11:12:13 UTC (rev 5290)
@@ -211,16 +211,44 @@
MarkupType markupType = null;
// Get the MIME type to use
+ // todo: MIME type resolution should really be done in common... maybe as part of GTNCOMMON-14?
for (String desiredMIMEType : desiredMIMETypes)
{
- for (MarkupType type : markupTypes)
+ desiredMIMEType = desiredMIMEType.trim();
+
+ // first deal with full wildcards
+ if ("*".equals(desiredMIMEType) || "*/*".equals(desiredMIMEType))
{
- if (desiredMIMEType.equals(type.getMimeType()))
+ markupType = markupTypes.get(0);
+ break;
+ }
+ else
+ {
+ MediaType mt = MediaType.create(desiredMIMEType);
+ String superType = mt.getType().getName();
+ String subType = mt.getSubtype().getName();
+ boolean isWildcard = "*".equals(subType);
+
+ for (MarkupType type : markupTypes)
{
- markupType = type;
- break;
+ if (isWildcard && type.getMimeType().startsWith(superType))
+ {
+ markupType = type;
+ break;
+ }
+ else if (desiredMIMEType.equals(type.getMimeType()))
+ {
+ markupType = type;
+ break;
+ }
}
}
+
+ // if we've found a match, do not examine the other possible matches
+ if (markupType != null)
+ {
+ break;
+ }
}
// no MIME type was found: error!
Modified: components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java
===================================================================
--- components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2010-11-26 10:18:30 UTC (rev 5289)
+++ components/wsrp/trunk/producer/src/test/java/org/gatein/wsrp/producer/handlers/processors/MimeResponseProcessorTestCase.java 2010-11-26 11:12:13 UTC (rev 5290)
@@ -72,8 +72,87 @@
assertEquals("namespace", processor.invocation.getWindowContext().getNamespace());
}
+ public void testShouldProperlyHandleWildCardsInRequestedMimeTypes() throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, ModifyRegistrationRequired, UnsupportedWindowState, InvalidRegistration
+ {
+ List<String> mimeTypes = new ArrayList<String>(1);
+ mimeTypes.add("*/*");
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(MockHttpSession.createMockSession()), MockHttpServletResponse.createMockResponse());
+
+ MimeResponseProcessor processor = new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+
+ assertEquals(TestProducerHelper.PORTLET_MIME_TYPE, processor.markupRequest.getMediaType());
+
+ mimeTypes = new ArrayList<String>(1);
+ mimeTypes.add("*");
+
+ processor = new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+
+ assertEquals(TestProducerHelper.PORTLET_MIME_TYPE, processor.markupRequest.getMediaType());
+
+ mimeTypes = new ArrayList<String>(1);
+ mimeTypes.add("text/*");
+
+ processor = new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+
+ assertEquals(TestProducerHelper.PORTLET_MIME_TYPE, processor.markupRequest.getMediaType());
+
+ mimeTypes = new ArrayList<String>(1);
+ mimeTypes.add("image/*");
+
+ try
+ {
+ new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+ fail("Should have failed on unsupported MIME type");
+ }
+ catch (UnsupportedMimeType unsupportedMimeType)
+ {
+ // expected
+ }
+ }
+
+ public void testShouldReturnFirstMimeTypeMatching() throws OperationFailed, UnsupportedMode, InvalidHandle, MissingParameters, UnsupportedMimeType, ModifyRegistrationRequired, UnsupportedWindowState, InvalidRegistration
+ {
+ List<String> mimeTypes = new ArrayList<String>(2);
+ mimeTypes.add("text/xml");
+ mimeTypes.add("text/*");
+
+ ServletAccess.setRequestAndResponse(MockHttpServletRequest.createMockRequest(MockHttpSession.createMockSession()), MockHttpServletResponse.createMockResponse());
+
+ MimeResponseProcessor processor = new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+
+ assertEquals("text/xml", processor.markupRequest.getMediaType());
+
+ mimeTypes = new ArrayList<String>(2);
+ mimeTypes.add("image/*");
+ mimeTypes.add("text/*");
+
+ processor = new RenderRequestProcessor(new TestProducerHelper(), WSRPTypeFactory.createGetMarkup(null,
+ WSRPTypeFactory.createPortletContext(PORTLET_HANDLE),
+ WSRPTypeFactory.createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION, "foo", "ns"), null,
+ WSRPTypeFactory.createMarkupParams(false, WSRPConstants.getDefaultLocales(), mimeTypes, WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE)));
+
+ assertEquals(TestProducerHelper.PORTLET_MIME_TYPE, processor.markupRequest.getMediaType());
+ }
+
private static class TestProducerHelper implements ProducerHelper
{
+ static final String PORTLET_MIME_TYPE = MediaType.TEXT_HTML.getValue();
+
public Portlet getPortletWith(PortletContext portletContext, Registration registration) throws InvalidHandle, PortletInvokerException
{
return new Portlet()
@@ -109,7 +188,8 @@
windowStateNames.add(WSRPConstants.NORMAL_WINDOW_STATE);
List<MarkupType> markupTypes = new ArrayList<MarkupType>(1);
- markupTypes.add(WSRPTypeFactory.createMarkupType(MediaType.TEXT_HTML.getValue(), modeNames, windowStateNames, locales));
+ markupTypes.add(WSRPTypeFactory.createMarkupType(PORTLET_MIME_TYPE, modeNames, windowStateNames, locales));
+ markupTypes.add(WSRPTypeFactory.createMarkupType("text/xml", modeNames, windowStateNames, locales));
return WSRPTypeFactory.createPortletDescription(PORTLET_HANDLE, markupTypes);
}
14 years, 1 month
gatein SVN: r5289 - epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-26 05:18:30 -0500 (Fri, 26 Nov 2010)
New Revision: 5289
Added:
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java
Modified:
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
Log:
JBEPP-681: Improve logging in PicketLink IDM integration layer
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -22,6 +22,9 @@
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
import org.exoplatform.services.organization.GroupHandler;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.Attribute;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.impl.api.SimpleAttribute;
@@ -35,10 +38,10 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+
/*
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
*/
@@ -73,16 +76,50 @@
final public Group createGroupInstance()
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createGroupInstance",
+ null
+ );
+ }
return new ExtGroup();
}
public void createGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createGroup",
+ new Object[]{
+ "broadcast", broadcast
+ }
+ );
+ }
addChild(null, group, broadcast);
}
public void addChild(Group parent, Group child, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "addChild",
+ new Object[]{
+ "parent", parent,
+ "child", child,
+ "broadcast", broadcast
+ }
+ );
+ }
+
org.picketlink.idm.api.Group parentGroup = null;
String childPLGroupName = getPLIDMGroupName(child.getGroupName());
@@ -148,6 +185,19 @@
public void saveGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveGroup",
+ new Object[]{
+ "group", group,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (broadcast)
{
preSave(group, false);
@@ -161,6 +211,19 @@
public Group removeGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeGroup",
+ new Object[]{
+ "group", group,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (broadcast)
{
preDelete(group);
@@ -228,6 +291,19 @@
public Collection findGroupByMembership(String userName, String membershipType) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupsByMembership",
+ new Object[]{
+ "userName", membershipType
+ }
+ );
+ }
+
+
Collection<org.picketlink.idm.api.Role> allRoles = new HashSet();
try
@@ -272,25 +348,84 @@
}
// UI has hardcoded casts to List
- return new LinkedList<Group>(exoGroups);
+ Collection result = new LinkedList<Group>(exoGroups);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupByMembership",
+ result
+ );
+ }
+
+ return result;
}
//
public Group findGroupById(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
org.picketlink.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
if (jbidGroup == null)
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ null
+ );
+ }
+
return null;
}
- return convertGroup(jbidGroup);
+ Group result = convertGroup(jbidGroup);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ result
+ );
+ }
+
+ return result;
+
}
public Collection findGroups(Group parent) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroups",
+ new Object[]{
+ "parent", parent
+ }
+ );
+ }
+
org.picketlink.idm.api.Group jbidGroup = null;
if (parent == null)
@@ -396,6 +531,16 @@
Collections.sort(results);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroups",
+ results
+ );
+ }
+
return results;
}
@@ -403,6 +548,19 @@
public Collection findGroupsOfUser(String user) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ new Object[]{
+ "user", user
+ }
+ );
+ }
+
+
if (user == null)
{
// julien : integration bug
@@ -415,6 +573,17 @@
// at org.exoplatform.organization.webui.component.GroupManagement.isMemberOfGroup(GroupManagement.java:72)
// at org.exoplatform.organization.webui.component.GroupManagement.isAdministrator(GroupManagement.java:125)
// at org.exoplatform.organization.webui.component.UIGroupExplorer.<init>(UIGroupExplorer.java:57)
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ Collections.emptyList()
+ );
+ }
+
return Collections.emptyList();
}
@@ -439,12 +608,32 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ exoGroups
+ );
+ }
+
return exoGroups;
}
public Collection getAllGroups() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getAllGroups",
+ null
+ );
+ }
+
Set<org.picketlink.idm.api.Group> plGroups = new HashSet<org.picketlink.idm.api.Group>();
try
@@ -490,7 +679,19 @@
}
// UI has hardcoded casts to List
- return new LinkedList<Group>(exoGroups);
+ Collection result = new LinkedList<Group>(exoGroups);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getAllGroups",
+ result
+ );
+ }
+
+ return result;
}
@@ -529,6 +730,18 @@
protected Group convertGroup(org.picketlink.idm.api.Group jbidGroup) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "convertGroup",
+ new Object[]{
+ "jbidGroup", jbidGroup
+ }
+ );
+ }
+
Map<String, Attribute> attrs = new HashMap();
try
@@ -562,6 +775,16 @@
// Resolve full ID
String id = getGroupId(jbidGroup, null);
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getGroupId",
+ id
+ );
+ }
+
exoGroup.setId(id);
// child of root
@@ -575,6 +798,16 @@
exoGroup.setParentId(id.substring(0, id.lastIndexOf("/")));
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "convertGroup",
+ exoGroup
+ );
+ }
+
return exoGroup;
}
@@ -589,6 +822,20 @@
private String getGroupId(org.picketlink.idm.api.Group jbidGroup,
List<org.picketlink.idm.api.Group> processed) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getGroupId",
+ new Object[]{
+ "jbidGroup", jbidGroup,
+ "processed", processed
+ }
+ );
+ }
+
+
// Check in cache
if (getIntegrationCache() != null)
{
@@ -633,6 +880,10 @@
// Check if there is cross reference so we ended in a loop and break the process.
if (parents.size() > 0 && processed.contains(parents.iterator().next()))
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("Detected looped relationship between groups!!!");
+ }
processed.remove(processed.size() - 1);
return CYCLIC_ID;
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -21,10 +21,14 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.services.organization.User;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.SortOrder;
import org.picketlink.idm.api.query.UserQuery;
import org.picketlink.idm.api.query.UserQueryBuilder;
+
import java.util.List;
/*
@@ -32,6 +36,8 @@
*/
public class IDMUserListAccess implements ListAccess<User>
{
+ private static Logger log = LoggerFactory.getLogger(IDMUserListAccess.class);
+
private final UserDAOImpl userDAO;
private final PicketLinkIDMService idmService;
@@ -54,6 +60,19 @@
public User[] load(int index, int length) throws Exception, IllegalArgumentException
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "load",
+ new Object[]{
+ "index", index,
+ "length", length
+ }
+ );
+ }
+
userQueryBuilder.page(index, length);
UserQuery query = userQueryBuilder.sort(SortOrder.ASCENDING).createQuery();
List<org.picketlink.idm.api.User> users = idmService.getIdentitySession().list(query);
@@ -67,21 +86,55 @@
exoUsers[i] = UserDAOImpl.getPopulatedUser(user.getId(), idmService.getIdentitySession());
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "load",
+ exoUsers
+ );
+ }
+
return exoUsers;
}
public int getSize() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getSize",
+ null
+ );
+ }
+
+ int result;
+
if (countAll)
{
- return idmService.getIdentitySession().getPersistenceManager().getUserCount();
+ result = idmService.getIdentitySession().getPersistenceManager().getUserCount();
}
else
{
userQueryBuilder.page(0, 0);
UserQuery query = userQueryBuilder.sort(SortOrder.ASCENDING).createQuery();
- return idmService.getIdentitySession().execute(query).size();
+ result = idmService.getIdentitySession().execute(query).size();
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getSize",
+ result
+ );
+ }
+
+ return result;
+
}
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -149,15 +149,17 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, id);
-
- if (log.isLoggable(Level.FINER))
+ if (ioNode != null)
{
+ ioNode.put(NODE_OBJECT_KEY, id);
- log.finer(this.toString() + "GateIn group id cached. PLIDM group id: " + pLIDMId +
- "GateIn group id: " + id + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn group id cached. PLIDM group id: " + pLIDMId +
+ "GateIn group id: " + id + ";namespace=" + ns);
+ }
}
-
}
/**
@@ -201,14 +203,16 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, rootGroup);
-
- if (log.isLoggable(Level.FINER))
+ if (ioNode != null)
{
+ ioNode.put(NODE_OBJECT_KEY, rootGroup);
- log.finer(this.toString() + "GateIn root group stored in cache" + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn root group stored in cache" + ";namespace=" + ns);
+ }
}
-
}
/**
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -26,12 +26,14 @@
import org.exoplatform.services.organization.MembershipHandler;
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.User;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.Role;
import org.picketlink.idm.api.RoleType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -74,6 +76,19 @@
public void createMembership(Membership m, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createMembership",
+ new Object[]{
+ "membership", m,
+ "broadcast", broadcast,
+ }
+ );
+ }
+
if (broadcast)
{
preSave(m, true);
@@ -90,6 +105,21 @@
public void linkMembership(User user, Group g, MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "linkMembership",
+ new Object[]{
+ "user", user,
+ "group", g,
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (g == null)
{
throw new InvalidNameException("Can not create membership record for " + user.getUserName()
@@ -154,7 +184,20 @@
public void saveMembership(Membership m, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveMembership",
+ new Object[]{
+ "membership", m,
+ "broadcast", broadcast
+ }
+ );
+ }
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
String groupId =
@@ -222,7 +265,20 @@
public Membership removeMembership(String id, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembership",
+ new Object[]{
+ "id", id,
+ "broadcast", broadcast
+ }
+ );
+ }
+
Membership m = new MembershipImpl(id);
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
@@ -308,6 +364,20 @@
public Collection removeMembershipByUser(String userName, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembershipByUser",
+ new Object[]{
+ "userName", userName,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
Collection<Role> roles = new HashSet();
try
@@ -388,6 +458,22 @@
public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
{
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndType",
+ new Object[]{
+ "userName", userName,
+ "groupId", groupId,
+ "type", type,
+ }
+ );
+ }
+
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(groupId));
String gid =
@@ -437,6 +523,8 @@
hasMembership = true;
}
+ Membership result = null;
+
if (hasMembership)
{
@@ -446,16 +534,51 @@
m.setUserName(userName);
m.setMembershipType(type);
- return m;
+ result = m;
}
- return null;
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserGroupAndType",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByUserAndGroup(String userName, String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ new Object[]{
+ "userName", userName,
+ "groupId", groupId,
+ }
+ );
+ }
+
if (userName == null)
{
// julien fix : if user name is null, need to check if we do need to return a special group
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ Collections.emptyList()
+ );
+ }
+
return Collections.emptyList();
}
@@ -515,11 +638,36 @@
}
//TODO: Exo UI has hardcoded casts to List
- return new LinkedList(memberships);
+ Collection result = new LinkedList(memberships);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByUser(String userName) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByUser",
+ new Object[]{
+ "userName", userName
+ }
+ );
+ }
+
+
Collection<Role> roles = new HashSet();
try
@@ -577,7 +725,19 @@
}
- return new LinkedList(memberships);
+ Collection result = new LinkedList(memberships);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByUser",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByGroup(Group group) throws Exception
@@ -587,6 +747,18 @@
public Collection findMembershipsByGroupId(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByGroup",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(groupId));
String gid =
@@ -656,11 +828,34 @@
Collections.sort(results);
}
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByGroupId",
+ results
+ );
+ }
+
return results;
}
public Membership findMembership(String id) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ new Object[]{
+ "id", id
+ }
+ );
+ }
+
Membership m = new MembershipImpl(id);
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
@@ -675,6 +870,15 @@
if (isCreateMembership(m.getMembershipType()) &&
getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ m
+ );
+ }
return m;
}
}
@@ -690,6 +894,16 @@
if (isAssociationMapped() && getAssociationMapping().equals(m.getMembershipType()) &&
getIdentitySession().getRelationshipManager().isAssociatedByKeys(groupId, m.getUserName()))
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ m
+ );
+ }
+
return m;
}
}
@@ -700,6 +914,15 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ null
+ );
+ }
return null;
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -157,4 +157,14 @@
return userName.compareTo(m.getUserName());
}
+
+ @Override
+ public String toString()
+ {
+ return "MembershipImpl{" +
+ "membershipType='" + membershipType + '\'' +
+ ", userName='" + userName + '\'' +
+ ", groupId='" + groupId + '\'' +
+ '}';
+ }
}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -22,6 +22,7 @@
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.MembershipTypeHandler;
import org.exoplatform.services.organization.impl.MembershipTypeImpl;
+import org.gatein.common.logging.LogLevel;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.IdentitySession;
@@ -71,6 +72,20 @@
public MembershipType createMembershipType(MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createMembershipType",
+ new Object[]{
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
Date now = new Date();
mt.setCreatedDate(now);
mt.setModifiedDate(now);
@@ -83,6 +98,18 @@
public MembershipType saveMembershipType(MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveMembershipType",
+ new Object[]{
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
Date now = new Date();
mt.setModifiedDate(now);
updateMembershipType(mt);
@@ -91,6 +118,18 @@
public MembershipType findMembershipType(String name) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipType",
+ new Object[]{
+ "name", name
+ }
+ );
+ }
+
RoleType rt = getIdentitySession().getRoleManager().getRoleType(name);
MembershipType mt = null;
@@ -101,11 +140,35 @@
populateMembershipType(mt);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipType",
+ mt
+ );
+ }
+
return mt;
}
public MembershipType removeMembershipType(String name, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembershipType",
+ new Object[]{
+ "name", name,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
MembershipType mt = findMembershipType(name);
if (mt != null)
@@ -119,6 +182,15 @@
public Collection findMembershipTypes() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipTypes",
+ null
+ );
+ }
Collection<RoleType> rts = getIdentitySession().getRoleManager().findRoleTypes();
@@ -131,6 +203,16 @@
mts.add(mt);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipTypes",
+ mts
+ );
+ }
+
return mts;
}
Copied: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java (from rev 5282, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -0,0 +1,106 @@
+package org.exoplatform.services.organization.idm;
+
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/*
+* JBoss, a division of Red Hat
+* Copyright 2010, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+/**
+ * Some helper methods
+ */
+public class Tools
+{
+ public static void logMethodIn(Logger log, LogLevel level, String methodName, Object[] args)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' called with arguments: ");
+
+ if (args != null)
+ {
+ for (Object arg : args)
+ {
+ if (arg != null && arg instanceof Object[])
+ {
+ sb.append(Arrays.toString((Object[])arg))
+ .append("; ");
+ }
+ else
+ {
+ sb.append(arg)
+ .append("; ");
+ }
+ }
+ }
+ else
+ {
+ sb.append(args);
+ }
+
+ log.log(level, sb.toString());
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application code): ", t);
+ }
+
+ }
+
+ public static void logMethodOut(Logger log, LogLevel level, String methodName, Object result)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' returning object: ");
+
+ if (result != null && result instanceof Collection)
+ {
+ sb.append("Collection of size: ").append(((Collection)result).size());
+ }
+ else
+ {
+ if (result != null)
+ {
+ sb.append("[").append(result.getClass().getCanonicalName()).append("]");
+ }
+ sb.append(result);
+ }
+
+ log.log(level, sb.toString());
+
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application code): ", t);
+ }
+ }
+
+}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2010-11-26 10:18:30 UTC (rev 5289)
@@ -28,6 +28,7 @@
import org.exoplatform.services.organization.UserEventListener;
import org.exoplatform.services.organization.UserHandler;
import org.exoplatform.services.organization.impl.UserImpl;
+import org.gatein.common.logging.LogLevel;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.Attribute;
@@ -122,6 +123,20 @@
public void createUser(User user, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createUser",
+ new Object[]{
+ "user", user,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
IdentitySession session = service_.getIdentitySession();
if (broadcast)
{
@@ -149,6 +164,20 @@
public void saveUser(User user, boolean broadcast) throws Exception
{
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveUser",
+ new Object[]{
+ "user", user,
+ "broadcast", broadcast
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
if (broadcast)
{
@@ -165,6 +194,20 @@
public User removeUser(String userName, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeUser",
+ new Object[]{
+ "userName", userName,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
IdentitySession session = service_.getIdentitySession();
org.picketlink.idm.api.User foundUser = null;
@@ -223,15 +266,49 @@
//
public User findUserByName(String userName) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUserByName",
+ new Object[]{
+ "userName", userName,
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
User user = getPopulatedUser(userName, session);
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findUserByName",
+ user
+ );
+ }
+
return user;
}
public LazyPageList getUserPageList(int pageSize) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getUserPagetList",
+ new Object[]{
+ "pageSize", pageSize
+ }
+ );
+ }
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
return new LazyPageList(new IDMUserListAccess(this, service_, qb, pageSize, true), pageSize);
@@ -245,9 +322,32 @@
//
public boolean authenticate(String username, String password) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ new Object[]{
+ "userName", username,
+ "password", "****"
+ }
+ );
+ }
+
User user = findUserByName(username);
if (user == null)
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ false
+ );
+ }
+
return false;
}
@@ -279,12 +379,35 @@
userImpl.setLastLoginTime(Calendar.getInstance().getTime());
saveUser(userImpl, false);
}
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ authenticated
+ );
+ }
+
return authenticated;
}
public LazyPageList findUsers(Query q) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsers",
+ new Object[]{
+ "q", q
+ }
+ );
+ }
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
if (q.getUserName() != null)
@@ -319,6 +442,19 @@
public LazyPageList findUsersByGroup(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsersByGroup",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
org.picketlink.idm.api.Group jbidGroup = null;
@@ -339,6 +475,18 @@
public User findUserByEmail(String email) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUserByEmail",
+ new Object[]{
+ "findUserByEmail", email
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
@@ -363,6 +511,16 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findUserByEmail",
+ user
+ );
+ }
+
return user;
}
14 years, 1 month
gatein SVN: r5288 - epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-26 05:13:55 -0500 (Fri, 26 Nov 2010)
New Revision: 5288
Added:
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
Modified:
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
Log:
JBEPP-683: Performance improvements in PicketLink IDM integration
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-26 10:11:16 UTC (rev 5287)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
@@ -212,6 +212,7 @@
try
{
getIdentitySession().getPersistenceManager().removeGroup(jbidGroup, true);
+
}
catch (Exception e)
{
@@ -588,9 +589,26 @@
private String getGroupId(org.picketlink.idm.api.Group jbidGroup,
List<org.picketlink.idm.api.Group> processed) throws Exception
{
+ // Check in cache
+ if (getIntegrationCache() != null)
+ {
+ String cachedId = getIntegrationCache().getGtnGroupId(getCacheNS(), jbidGroup.getKey());
+ if (cachedId != null)
+ {
+ return cachedId;
+ }
+ }
+
if (jbidGroup.equals(getRootGroup()))
{
- return "";
+ String calculatedId = "";
+
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId);
+ }
+
+ return calculatedId;
}
if (processed == null)
@@ -628,8 +646,16 @@
"defined by type mappings or just place it under root /");
}
- return obtainMappedId(jbidGroup, gtnGroupName);
+ String calculatedId = obtainMappedId(jbidGroup, gtnGroupName);
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId);
+ }
+
+ return calculatedId;
+
+
}
processed.add(jbidGroup);
@@ -648,13 +674,27 @@
// mappings or connect it to the root
else
{
- return obtainMappedId(jbidGroup, gtnGroupName);
+ String calculatedId = obtainMappedId(jbidGroup, gtnGroupName);
+
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId);
+ }
+
+ return calculatedId;
}
}
- return parentGroupId + "/" + gtnGroupName;
+ String calculatedId = parentGroupId + "/" + gtnGroupName;
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId);
+ }
+
+ return calculatedId;
+
}
/**
@@ -761,8 +801,61 @@
return service_.getIdentitySession();
}
- private org.picketlink.idm.api.Group getRootGroup() throws Exception
+ private IntegrationCache getIntegrationCache()
{
+ // TODO: refactor to remove cast. For now to avoid adding new config option and share existing cache instannce
+ // TODO: it should be there.
+ return ((PicketLinkIDMServiceImpl)service_).getIntegrationCache();
+ }
+
+ /**
+ * Returns namespace to be used with integration cache
+ * @return
+ */
+ private String getCacheNS()
+ {
+ // TODO: refactor to remove cast. For now to avoid adding new config option and share existing cache instannce
+ // TODO: it should be there.
+ return ((PicketLinkIDMServiceImpl)service_).getRealmName();
+ }
+
+
+ /**
+ * Returns mock of PLIDM group representing "/" group. This method uses cache and delegates to obtainRootGroup().
+ *
+ * @return
+ * @throws Exception
+ */
+ protected org.picketlink.idm.api.Group getRootGroup() throws Exception
+ {
+ org.picketlink.idm.api.Group rootGroup = null;
+
+ if (getIntegrationCache() != null)
+ {
+ rootGroup = getIntegrationCache().getRootGroup(getCacheNS());
+ }
+
+ if (rootGroup == null)
+ {
+ rootGroup = obtainRootGroup();
+
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().putRootGroup(getCacheNS(), rootGroup);
+ }
+ }
+
+ return rootGroup;
+
+ }
+
+ /**
+ * Obtains PLIDM group representing "/" group. If such group doens't exist it creates one.
+ * @return
+ * @throws Exception
+ */
+ protected org.picketlink.idm.api.Group obtainRootGroup() throws Exception
+ {
org.picketlink.idm.api.Group rootGroup = null;
try
{
Copied: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java (from rev 5221, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java)
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java (rev 0)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2010-11-26 10:13:55 UTC (rev 5288)
@@ -0,0 +1,241 @@
+package org.exoplatform.services.organization.idm;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.CacheStatus;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.User;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/*
+* JBoss, a division of Red Hat
+* Copyright 2010, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+/**
+ * Provides cache for some data used in integration layer between PicketLink IDM and GateIn
+ */
+public class IntegrationCache
+{
+ private static Logger log = Logger.getLogger(IntegrationCache.class.getName());
+
+ private Cache cache;
+
+ public static final String NODE_GTN_GROUP_ID = "NODE_GTN_GROUP_ID";
+
+ public static final String NODE_PLIDM_ROOT_GROUP = "NODE_PLIDM_ROOT_GROUP";
+
+ public static final String NULL_NS_NODE = "GTN_IC_COMMON_NS";
+
+ public static final String MAIN_ROOT = "NODE_GTN_ORG_SERVICE_INT_CACHE_MAIN_ROOT";
+
+ public static final String NODE_OBJECT_KEY = "object";
+
+ private Fqn getRootNode()
+ {
+ return Fqn.fromString("/" + MAIN_ROOT);
+ }
+
+ private Fqn getNamespacedFqn(String ns)
+ {
+ String namespace = ns != null ? ns : NULL_NS_NODE;
+ namespace = namespace.replaceAll("/", "_");
+ return Fqn.fromString(getRootNode() + "/" + namespace);
+ }
+
+ private Fqn getFqn(String ns, String node, Object o)
+ {
+ return Fqn.fromString(getNamespacedFqn(ns) + "/" + node + "/" + o);
+ }
+
+ private Fqn getFqn(String ns, String node)
+ {
+ return Fqn.fromString(getNamespacedFqn(ns) + "/" + node);
+ }
+
+ public void initialize(InputStream jbossCacheConfiguration)
+ {
+ CacheFactory factory = new DefaultCacheFactory();
+
+ if (jbossCacheConfiguration == null)
+ {
+ throw new IllegalArgumentException("JBoss Cache configuration InputStream is null");
+ }
+
+ this.cache = factory.createCache(jbossCacheConfiguration);
+
+ this.cache.create();
+ this.cache.start();
+
+ }
+
+ public void initialize(Cache cache)
+ {
+ this.cache = cache;
+
+ CacheStatus status = cache.getCacheStatus();
+
+ if (status.createAllowed())
+ {
+ this.cache.create();
+ }
+ if (status.startAllowed())
+ {
+ this.cache.start();
+ }
+
+ }
+
+ Cache getCache()
+ {
+ return cache;
+ }
+
+
+ public void invalidate(String ns)
+ {
+
+ boolean success = cache.getRoot().removeChild(getNamespacedFqn(ns));
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating namespace:" + ns + "; success=" + success);
+ }
+ }
+
+ public void invalidateAll()
+ {
+ boolean success = cache.getRoot().removeChild(getRootNode());
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Invalidating whole cache - success=" + success);
+ }
+ }
+
+ /**
+ * Store gatein group id
+ * @param ns
+ * @param pLIDMId
+ * @param id
+ */
+ void putGtnGroupId(String ns, String pLIDMId, String id)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_GTN_GROUP_ID, pLIDMId);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, id);
+
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn group id cached. PLIDM group id: " + pLIDMId +
+ "GateIn group id: " + id + ";namespace=" + ns);
+ }
+
+ }
+
+ /**
+ * Retrieve gatein group id
+ * @param ns
+ * @param pLIDMId
+ * @return
+ */
+ String getGtnGroupId(String ns, String pLIDMId)
+ {
+
+ Fqn nodeFqn = getFqn(ns, NODE_GTN_GROUP_ID, pLIDMId);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ String id = (String)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && id != null)
+ {
+ log.finer(this.toString() + "GateIn group id found in cache. PLIDM group id: " + pLIDMId +
+ "GateIn group id: " + id + ";namespace=" + ns);
+ }
+
+ return id;
+ }
+
+ return null;
+
+ }
+
+ /**
+ * Store PLIDM root group
+ * @param ns
+ * @param rootGroup
+ */
+ void putRootGroup(String ns, Group rootGroup)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_PLIDM_ROOT_GROUP);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.put(NODE_OBJECT_KEY, rootGroup);
+
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn root group stored in cache" + ";namespace=" + ns);
+ }
+
+ }
+
+ /**
+ * Retrieve PLIDM root group
+ * @param ns
+ * @return
+ */
+ Group getRootGroup(String ns)
+ {
+ Fqn nodeFqn = getFqn(ns, NODE_PLIDM_ROOT_GROUP);
+
+ Node node = getCache().getRoot().getChild(nodeFqn);
+
+ if (node != null)
+ {
+ Group rootGroup = (Group)node.get(NODE_OBJECT_KEY);
+
+ if (log.isLoggable(Level.FINER) && rootGroup != null)
+ {
+ log.finer(this.toString() + "GateIn root group found in cache" + ";namespace=" + ns);
+ }
+
+ return rootGroup;
+ }
+
+ return null;
+
+ }
+
+}
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java 2010-11-26 10:11:16 UTC (rev 5287)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMCacheService.java 2010-11-26 10:13:55 UTC (rev 5288)
@@ -51,6 +51,8 @@
public class PicketLinkIDMCacheService
{
+ private final List<IntegrationCache> integrationCache = new LinkedList<IntegrationCache>();
+
private final List<APICacheProvider> apiCacheProviders = new LinkedList<APICacheProvider>();
private final List<IdentityStoreCacheProvider> storeCacheProviders = new LinkedList<IdentityStoreCacheProvider>();
@@ -59,6 +61,16 @@
{
}
+ public void register(IntegrationCache cacheProvider)
+ {
+
+ if (cacheProvider != null)
+ {
+ integrationCache.add(cacheProvider);
+ }
+
+ }
+
public void register(APICacheProvider cacheProvider)
{
@@ -101,6 +113,11 @@
@Impact(ImpactType.WRITE)
public void invalidateAll()
{
+ for (IntegrationCache cacheProvider : integrationCache)
+ {
+ cacheProvider.invalidateAll();
+ }
+
for (APICacheProvider cacheProvider : apiCacheProviders)
{
cacheProvider.invalidateAll();
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-11-26 10:11:16 UTC (rev 5287)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
@@ -76,7 +76,7 @@
}
- public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws Exception
+ public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws Exception
{
String[] ids = groupId.split("/");
String name = ids[ids.length - 1];
Modified: epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2010-11-26 10:11:16 UTC (rev 5287)
+++ epp/portal/branches/EPP_5_1_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2010-11-26 10:13:55 UTC (rev 5288)
@@ -26,6 +26,9 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.database.HibernateService;
import org.exoplatform.services.naming.InitialContextInitializer;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.DefaultCacheFactory;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.IdentitySessionFactory;
import org.picketlink.idm.api.cfg.IdentityConfiguration;
@@ -75,6 +78,8 @@
private IdentityConfiguration identityConfiguration;
+ private IntegrationCache integrationCache;
+
private PicketLinkIDMServiceImpl()
{
}
@@ -125,13 +130,31 @@
{
InputStream configStream = confManager.getInputStream(apiCacheConfig.getValue());
+ // Create common JBoss Cache instance
+ CacheFactory factory = new DefaultCacheFactory();
+ if (configStream == null)
+ {
+ throw new IllegalArgumentException("JBoss Cache configuration InputStream is null");
+ }
+
+ Cache cache = factory.createCache(configStream);
+
+ cache.create();
+ cache.start();
+
+ configStream.close();
+
+ // PLIDM API cache
JBossCacheAPICacheProviderImpl apiCacheProvider = new JBossCacheAPICacheProviderImpl();
- apiCacheProvider.initialize(configStream);
+ apiCacheProvider.initialize(cache);
picketLinkIDMCache.register(apiCacheProvider);
identityConfiguration.getIdentityConfigurationRegistry().register(apiCacheProvider, "apiCacheProvider");
- configStream.close();
+ //Integration cache
+ integrationCache = new IntegrationCache();
+ integrationCache.initialize(cache);
+ picketLinkIDMCache.register(apiCacheProvider);
}
if (storeCacheConfig != null)
@@ -192,4 +215,14 @@
}
return getIdentitySessionFactory().getCurrentIdentitySession(realm);
}
+
+ public IntegrationCache getIntegrationCache()
+ {
+ return integrationCache;
+ }
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
}
14 years, 1 month
gatein SVN: r5287 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-11-26 05:11:16 -0500 (Fri, 26 Nov 2010)
New Revision: 5287
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html 2010-11-26 09:59:34 UTC (rev 5286)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_012_AddSomeUsersIntoGroupInCaseAfterCommaHasSpace.html 2010-11-26 10:11:16 UTC (rev 5287)
@@ -102,6 +102,11 @@
<td>root, john, demo</td>
</tr>
<tr>
+ <td>echo</td>
+ <td>-- http://jira.exoplatform.org/browse/SELEGEN-37 --</td>
+ <td></td>
+</tr>
+<tr>
<td>waitForElementPresent</td>
<td>membership</td>
<td></td>
14 years, 1 month
gatein SVN: r5286 - epp/portal/branches/EPP_5_1_Branch.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-11-26 04:59:34 -0500 (Fri, 26 Nov 2010)
New Revision: 5286
Modified:
epp/portal/branches/EPP_5_1_Branch/pom.xml
Log:
JBEPP-665: Upgrade to PicketLink 1.1.7.GA
Modified: epp/portal/branches/EPP_5_1_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_Branch/pom.xml 2010-11-26 07:04:12 UTC (rev 5285)
+++ epp/portal/branches/EPP_5_1_Branch/pom.xml 2010-11-26 09:59:34 UTC (rev 5286)
@@ -47,7 +47,7 @@
<org.gatein.common.version>2.0.3-GA</org.gatein.common.version>
<org.gatein.wci.version>2.0.2-GA</org.gatein.wci.version>
<org.gatein.pc.version>2.2.0-GA</org.gatein.pc.version>
- <org.picketlink.idm>1.1.7.CR01</org.picketlink.idm>
+ <org.picketlink.idm>1.1.7.GA</org.picketlink.idm>
<org.gatein.wsrp.version>2.0.0-CR02</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.3-GA</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
14 years, 1 month
gatein SVN: r5285 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-11-26 02:04:12 -0500 (Fri, 26 Nov 2010)
New Revision: 5285
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_37_ManageNavigationOfGroup.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_49_ChangeApplicationWhenEditPagePropertiesOfNode.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_37_ManageNavigationOfGroup.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_37_ManageNavigationOfGroup.html 2010-11-26 06:32:42 UTC (rev 5284)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_37_ManageNavigationOfGroup.html 2010-11-26 07:04:12 UTC (rev 5285)
@@ -118,12 +118,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[@id='UIAddGroupNavigationGrid']/table[1]/tbody/tr/td[2]/a</td>
+ <td>//div[@id='UIAddGroupNavigationGrid']/table[2]/tbody/tr/td[2]/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[@id='UIAddGroupNavigationGrid']/table[1]/tbody/tr/td[2]/a</td>
+ <td>//div[@id='UIAddGroupNavigationGrid']/table[2]/tbody/tr/td[2]/a</td>
<td></td>
</tr>
<tr>
@@ -138,12 +138,12 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>Operations</td>
+ <td>Organization</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>Operations</td>
+ <td>Organization</td>
<td></td>
</tr>
<tr>
@@ -153,12 +153,12 @@
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[@id='UIGroupNavigationGrid']/table[2]/tbody/tr/td[3]/a[3]</td>
+ <td>link=Delete Navigation</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[@id='UIGroupNavigationGrid']/table[2]/tbody/tr/td[3]/a[3]</td>
+ <td>link=Delete Navigation</td>
<td></td>
</tr>
<tr>
@@ -173,12 +173,12 @@
</tr>
<tr>
<td>waitForTextNotPresent</td>
- <td>Operations</td>
+ <td>Organization</td>
<td></td>
</tr>
<tr>
<td>verifyTextNotPresent</td>
- <td>Operations</td>
+ <td>Organization</td>
<td></td>
</tr>
<tr>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_49_ChangeApplicationWhenEditPagePropertiesOfNode.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_49_ChangeApplicationWhenEditPagePropertiesOfNode.html 2010-11-26 06:32:42 UTC (rev 5284)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_49_ChangeApplicationWhenEditPagePropertiesOfNode.html 2010-11-26 07:04:12 UTC (rev 5285)
@@ -503,7 +503,7 @@
</tr>
<tr>
<td>mouseOver</td>
- <td>//div[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/div[2]</td>
+ <td>//div/div/div[2]/div/div/div/div/div/div/div[2]</td>
<td>Test_SNF_PRL_49</td>
</tr>
<tr>
@@ -538,17 +538,17 @@
</tr>
<tr>
<td>mouseOver</td>
- <td>//div[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/div[2]</td>
+ <td>//div/div/div[2]/div/div/div/div/div/div/div[2]</td>
<td>Test_SNF_PRL_49</td>
</tr>
<tr>
<td>waitForElementPresent</td>
- <td>//div[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/a[2]</td>
+ <td>//div/div/div[2]/div/div/div/div/div/div/a[2]</td>
<td></td>
</tr>
<tr>
<td>click</td>
- <td>//div[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/a[2]</td>
+ <td>//div/div/div[2]/div/div/div/div/div/div/a[2]</td>
<td></td>
</tr>
<tr>
14 years, 1 month
gatein SVN: r5284 - in epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules: PortalDevelopment and 1 other directory.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-11-26 01:32:42 -0500 (Fri, 26 Nov 2010)
New Revision: 5284
Added:
epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/LocalizationConfiguration.xml
Modified:
epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment.xml
epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml
epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/WSRP.xml
Log:
JBEPP-517: Added LocalizationConfiguration as per GTNPORTAL-1694
Modified: epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml 2010-11-25 22:40:51 UTC (rev 5283)
+++ epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/DefaultPortalNavigationConfiguration.xml 2010-11-26 06:32:42 UTC (rev 5284)
@@ -127,97 +127,7 @@
</para>
<programlisting language="XML" role="XML"><xi:include href="../../extras/PortalDevelopment_DefaultPortalNavigationConfiguration/pages.xml" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <!-- Replaced code pages.xml with code from GateIn commit r3831 (as per instruction from theute)
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<page-set
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0"
-xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0">
-<page>
-<name>homepage</name>
-<title>Home Page</title>
-<access-permissions>Everyone</access-permissions>
-<edit-permission>*:/platform/administrators</edit-permission>
-<portlet-application>
-<portlet>
-<application-ref>web</application-ref>
-<portlet-ref>HomePagePortlet</portlet-ref>
-<preferences>
-<preference>
-<name>template</name>
-<value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
-<read-only>false</read-only>
-</preference>
-</preferences>
-</portlet>
-<title>Home Page portlet</title>
-<access-permissions>Everyone</access-permissions>
-<show-info-bar>false</show-info-bar>
-<show-application-state>false</show-application-state>
-<show-application-mode>false</show-application-mode>
-</portlet-application>
-</page>
-<page>
-<name>groupnavigation</name>
-<title>Group Navigation</title>
-<access-permissions>*:/platform/users</access-permissions>
-<edit-permission>*:/platform/administrators</edit-permission>
-<portlet-application>
-<portlet>
-<application-ref>exoadmin</application-ref>
-<portlet-ref>GroupNavigationPortlet</portlet-ref>
-</portlet>
-<title>Group Navigation</title>
-<access-permissions>Everyone</access-permissions>
-<show-info-bar>false</show-info-bar>
-</portlet-application>
-</page>
-<page>
-<name>portalnavigation</name>
-<title>Portal Navigation</title>
-<access-permissions>*:/platform/users</access-permissions>
-<edit-permission>*:/platform/administrators</edit-permission>
-<portlet-application>
-<portlet>
-<application-ref>exoadmin</application-ref>
-<portlet-ref>PortalNavigationPortlet</portlet-ref>
-</portlet>
-<title>Portal Navigation</title>
-<access-permissions>Everyone</access-permissions>
-<show-info-bar>false</show-info-bar>
-</portlet-application>
-</page>
-<page>
-<name>register</name>
-<title>Register</title>
-<access-permissions>*:/platform/guests</access-permissions>
-<edit-permission>*:/platform/administrators</edit-permission>
-<portlet-application>
-<portlet>
-<application-ref>exoadmin</application-ref>
-<portlet-ref>RegisterPortlet</portlet-ref>
-</portlet>
-<title>Register Account</title>
-<access-permissions>*:/platform/guests</access-permissions>
-<show-info-bar>false</show-info-bar>
-</portlet-application>
-</page>
-<page>
-<name>sitemap</name>
-<title>Site Map</title>
-<access-permissions>Everyone</access-permissions>
-<edit-permission>*:/platform/administrators</edit-permission>
-<portlet-application>
-<portlet>
-<application-ref>web</application-ref>
-<portlet-ref>SiteMapPortlet</portlet-ref>
-</portlet>
-<title>SiteMap</title>
-<access-permissions>Everyone</access-permissions>
-<show-info-bar>false</show-info-bar>
-</portlet-application>
-</page>
-</page-set> -->
+
</listitem>
</varlistentry>
</variablelist>
Added: epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/LocalizationConfiguration.xml
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/LocalizationConfiguration.xml (rev 0)
+++ epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment/LocalizationConfiguration.xml 2010-11-26 06:32:42 UTC (rev 5284)
@@ -0,0 +1,279 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
+%BOOK_ENTITIES;
+]>
+<chapter id="chap-Reference_Guide-Localization_Configuration">
+ <title>Localization Configuration - PLEASE REVIEW</title>
+ <section id="sect-Reference_Guide-Portal_Development-Pluggable_Locale_Policy">
+ <title>Pluggable Locale Policy</title>
+
+ <para>
+ Every request processed by every portlet is invoked within a context of the current <literal>Locale</literal>.
+ </para>
+ <para>
+ The current <literal>Locale</literal> can be retrieved by calling the <literal>getLocale()</literal> method of <literal>javax.portlet.PortletRequest</literal> interface.
+ </para>
+ <para>
+ The exact algorithm for determining the current <literal>Locale</literal> is not specified by Portlet Specification. Portlet containers implement this the way they deem most appropriate.
+ </para>
+ <para>
+ In &PRODUCT; each portal instance has a default language which can be used to present content for new users. Another option is to use each user’s browser language preference, provided it matches one of the available localizations that &PRODUCT; supports, and only fallback to portal default language if no match is found.
+ </para>
+ <para>
+ Every user, while visiting a portal, has an option to change the language of the user interface by using a Language chooser.
+ The choice can be remembered for the duration of the session, or it can be remembered for a longer period using a browser cookie,
+ or - for registered and logged-in users - it can be saved into user’s profile.
+ </para>
+ <para>So, we can see that there is more than one way to determine the <literal>Locale</literal> to be used for displaying a portal page
+ to the user. For this reason the mechanism for determining the current <literal>Locale</literal> of the request
+ is pluggable in &PRODUCT;, so the exact algorithm can be customized.
+ </para>
+
+ <section>
+ <title>LocalePolicy API</title>
+
+ <para>Customization is achieved by using LocalePolicy API, which is a simple API consisting of one interface,
+ and one class:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><literal>org.exoplatform.services.resources.LocalePolicy</literal> interface</para>
+ </listitem>
+ <listitem>
+ <para><literal>org.exoplatform.services.resources.LocaleContextInfo</literal> class</para>
+ </listitem>
+ </itemizedlist>
+
+ <para><literal>LocalePolicy</literal> interface defines a single method that’s invoked on the installed
+ <literal>LocalePolicy</literal> service implementation:
+ </para>
+
+<programlisting language="Java" role="Java"><![CDATA[public interface LocalePolicy
+ {
+ public Locale determineLocale(LocaleContextInfo localeContext);
+ }]]>
+</programlisting>
+ <para><literal>Locale</literal> returned by determineLocale() method is the <literal>Locale</literal>
+ that will be returned to portlets when they call <literal>javax.portlet.PortletRequest.getLocale()</literal> method.
+ </para>
+ <para>The returned <literal>Locale</literal> has to be one of the locales supported by portal,
+ otherwise it will fallback to portal-default <literal>Locale</literal>.
+ </para>
+
+ <para>The supported locales are listed in <filename>gatein.ear/02portal.war/WEB-INF/conf/common/locales-config.xml</filename> file
+ as described in <xref linkend="sect-Reference_Guide-Internationalization_Configuration-Locales_Configuration"/> .
+ </para>
+
+ <para>The <literal>determineLocale()</literal> method takes a parameter of type <literal>LocaleContextInfo</literal>,
+ which represents a compilation of preferred locales from different sources - user’s profile, portal default,
+ browser language settings, current session, browser cookie … All these different sources of <literal>Locale</literal>
+ configuration or preference are used as input to <literal>LocalePolicy</literal> implementation
+ that decides which <literal>Locale</literal> should be used.
+ </para>
+
+ </section>
+ <section>
+ <title>Default <literal>LocalePolicy</literal></title>
+ <para>By default, <literal>org.exoplatform.portal.application.localization.DefaultLocalePolicyService</literal> - an implementation
+ of <literal>LocalePolicy</literal> - is installed to provide the default behaviour.
+ This, however, can easily be extended and overriden. A completely new implementation can also be written from scratch.
+ </para>
+ <para><literal>DefaultLocalePolicyService</literal> treats logged-in users slightly differently than anonymous users.
+ Logged-in users have a profile that can contain language preference, while anonymous users don't.
+ </para>
+ <para>Here is an algorithm used for anonymous users.</para>
+ <procedure>
+ <title>An algorithm for anonymous users</title>
+ <step>
+ <para>
+ Iterate over <literal>LocaleContextInfo</literal> properties in the following order:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><literal>cookieLocales</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>sessionLocale</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>browserLocales</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>portalLocale</literal></para>
+ </listitem>
+ </itemizedlist>
+ </step>
+ <step>
+ <para>Get each property's value - if it's a collection, get the first value.
+ </para>
+ </step>
+ <step>
+ <para>If value is one of the supported locales return it as a result.
+ </para>
+ </step>
+ <step>
+ <para>If value is not in the supported locales set, try to remove country information,
+ and check if a language matching locale is in the list of supported locales.
+ If so, return it as a result.
+ </para>
+ </step>
+ <step>
+ <para>Otherwise, continue with the next property.
+ </para>
+ </step>
+ </procedure>
+ <para>If no supported locale is found the return locale eventually defaults to <literal>portalLocale</literal>.
+ </para>
+ <para>The algorithm for logged-in users is virtually the same except that the first <literal>Locale</literal>
+ source checked is user's profile.</para>
+ <procedure>
+ <title>An algorithm for logged-in users</title>
+ <step>
+ <para>
+ Iterate over <literal>LocaleContextInfo</literal> properties in the following order:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><literal>userProfile</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>cookieLocales</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>sessionLocale</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>browserLocales</literal></para>
+ </listitem>
+ <listitem>
+ <para><literal>portalLocale</literal></para>
+ </listitem>
+ </itemizedlist>
+ </step>
+ <step>
+ <para>The rest is the same as for anonymous users ...</para>
+ </step>
+ </procedure>
+
+ </section>
+ <section>
+ <title>Custom <literal>LocalePolicy</literal></title>
+ <para>The easiest way to customize the <literal>LocalePolicy</literal> is to extend <literal>DefaultLocalePolicyService</literal>.
+ The study of its source code will be required. There is ample JavaDoc that provides thorough information.
+ Most customizations will involve simply overriding one or more of its protected methods.
+ </para>
+ <para>
+ An example of a customization is an already provided <literal>NoBrowserLocalePolicyService</literal>.
+ By overriding just one method, it skips any use of browser language preference.
+ </para>
+<programlisting language="Java" role="Java"><![CDATA[public class NoBrowserLocalePolicyService extends DefaultLocalePolicyService
+ {
+ /**
+ * Override super method with no-op.
+ *
+ * @param context locale context info available to implementations in order to determine appropriate Locale
+ * @return null
+ */
+ @Override
+ protected Locale getLocaleConfigFromBrowser(LocaleContextInfo context)
+ {
+ return null;
+ }
+ }]]>
+</programlisting>
+ </section>
+
+ <section>
+ <title>LocalePolicy Configuration</title>
+
+ <para>The <literal>LocalePolicy</literal> framework is enabled for portlets by configuring LocalizationLifecycle class in portal's webui configuration file:
+ <filename>gatein.ear/02portal.war/WEB-INF/webui-configuration.xml</filename>:</para>
+
+<programlisting language="XML" role="XML"><![CDATA[ <application-lifecycle-listeners>
+ ...
+ <listener>org.exoplatform.portal.application.localization.LocalizationLifecycle</listener>
+ </application-lifecycle-listeners>]]>
+</programlisting>
+
+ <para>The default <literal>LocalePolicy</literal> implementation is installed as GateIn Kernel portal service via
+ <filename>gatein.ear/lib/exo.portal.webui.portal-VERSION.jar/conf/portal/configuration.xml</filename>.
+ </para>
+ <para>The following fragment is responsible for installing the service:
+ </para>
+<programlisting language="XML" role="XML"><![CDATA[ <component>
+ <key>org.exoplatform.services.resources.LocalePolicy</key>
+ <type>org.exoplatform.portal.application.localization.DefaultLocalePolicyService</type>
+</component>]]>
+</programlisting>
+ <para>Besides implementing <literal>LocalePolicy</literal>, the service class also needs to implement
+ <literal>org.picocontainer.Startable</literal> interface in order to get installed.
+ </para>
+ <para>This configuration file should not be changed. The configuration in it can be overriden by placing it into portal's .war file:
+ <filename>gatein.ear/02portal.war/WEB-INF/conf/configuration.xml</filename> (usually as another file included into this one).
+ </para>
+ </section>
+
+ <section>
+ <title>Keeping non-bridged resources in sync with current Locale</title>
+ <para>In portals all the resources that are not portlets themselves but are accessed through portlets - reading
+ data through <literal>PortletRequest</literal>, and writing to <literal>PortletResponse</literal> - are
+ referred to as 'bridged'. Any resources that are accessed directly, bypassing portal filters and servlets,
+ are referred to as 'non-bridged'.
+ </para>
+ <para>Non-bridged servlets, and .jsps have no access to <literal>PortalRequest</literal>. They don't use
+ <literal>PortletRequest.getLocale()</literal> to determine current <literal>Locale</literal>.
+ Instead, they use <literal>ServletRequest.getLocale()</literal> which is subject to precise semantics
+ defined by Servlet specification - it reflects browser's language preference.
+ </para>
+ <para>In other words, non-bridged resources don't have a notion of current <literal>Locale</literal>
+ in the same sense that portlets do. The result is that when mixing portlets and non-bridged resources there
+ may be a localization mismatch - an inconsistency in the language used by different resources composing your portal
+ page.
+ </para>
+ <para>This problem is addressed by <literal>LocalizationFilter</literal>. This is a filter that changes the behaviour
+ of <literal>ServletRequest.getLocale()</literal> method so that it behaves the same way as
+ <literal>PortletRequest.getLocale()</literal>. That way even localization of servlets, and .jsps
+ accessed in a non-bridged manner can stay in sync with portlet localization.
+ </para>
+ <para><literal>LocalizationFilter</literal> is installed through portal's web.xml file: <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename>
+ </para>
+<programlisting language="XML" role="XML"><![CDATA[ <filter>
+ <filter-name>LocalizationFilter</filter-name>
+ <filter-class>org.exoplatform.portal.application.localization.LocalizationFilter</filter-class>
+</filter>
+
+...
+
+<filter-mapping>
+ <filter-name>LocalizationFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+</filter-mapping>]]>
+</programlisting>
+ <para>There is a tiny limitation with this mechanism in that it is unable to determine the current portal,
+ and consequently its default language. As a result the portalLocale defaults to <literal>English</literal>, but can be configured
+ to something else by using filter's <literal>PortalLocale</literal> init param. For example:
+ </para>
+<programlisting language="XML" role="XML"><![CDATA[ <filter>
+ <filter-name>LocalizationFilter</filter-name>
+ <filter-class>org.exoplatform.portal.application.localization.LocalizationFilter</filter-class>
+ <init-param>
+ <param-name>PortalLocale</param-name>
+ <param-value>fr_FR</param-value>
+ </init-param>
+</filter> ]]>
+</programlisting>
+ <para>By default, <literal>LocalizationFilter</literal> is applied very broadly to cover all the resources automatically.
+ &PRODUCT; uses some non-bridged .jsps that require <literal>LocalizationFilter</literal>, so narrowing
+ the mapping to *.jsp is enough for &PRODUCT; to still function correctly. Additionally deployed portlets,
+ and portal applications, however, may require broader mapping to cover their non-bridged resources.
+ </para>
+ <para>Narrowing the mapping might improve performance. This is something to consider, when optimizing for speed.
+ </para>
+ </section>
+ </section>
+</chapter>
\ No newline at end of file
Modified: epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment.xml
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment.xml 2010-11-25 22:40:51 UTC (rev 5283)
+++ epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/PortalDevelopment.xml 2010-11-26 06:32:42 UTC (rev 5284)
@@ -11,9 +11,11 @@
<xi:include href="PortalDevelopment/DefaultPortalPermissionConfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="PortalDevelopment/DefaultPortalNavigationConfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="PortalDevelopment/InternationalizationConfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="PortalDevelopment/LocalizationConfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!--DOC NOTE: LocalizationConfiguration.xml added to satisfy JBEPP-685/GTNPORTAL-1694 -->
<xi:include href="PortalDevelopment/RTLFramework.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="PortalDevelopment/XMLResourceBundles.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="PortalDevelopment/JavascriptInterApplicationCommunication.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<!--<xi:include href="PortalDevelopment/JavascriptConfiguration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
- <!--JavaScript Configuration section removed as per instruction from Thomas Heute-->
+ <!-- DOC NOTE: JavaScript Configuration section removed as per instruction from Thomas Heute-->
</part>
Modified: epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/WSRP.xml
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/WSRP.xml 2010-11-25 22:40:51 UTC (rev 5283)
+++ epp/docs/branches/EPP_5_1_Branch/Reference_Guide/en-US/modules/WSRP.xml 2010-11-26 06:32:42 UTC (rev 5284)
@@ -1171,7 +1171,7 @@
The full service description includes which <classname>RegistrationPolicy</classname> (and <classname>RegistrationPropertyValidator</classname> if needed) to use, as well as required registration property descriptions for which consumers must provide acceptable values to successfully register.
</para>
<para>
- WSDL URLs to access &PRODUCT_NAME;'s WSRP producer are now displayed in either in WSRP 1 or WSRP 2 mode.</para>
+ WSDL URLs to access &PRODUCT;'s WSRP producer are now displayed in either in WSRP 1 or WSRP 2 mode.</para>
</section>
14 years, 1 month
gatein SVN: r5283 - portal/trunk.
by do-not-reply@jboss.org
Author: bdaw
Date: 2010-11-25 17:40:51 -0500 (Thu, 25 Nov 2010)
New Revision: 5283
Modified:
portal/trunk/pom.xml
Log:
GTNPORTAL-1696 Upgrade PicketLink IDM jars to 1.1.7.GA
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-11-25 22:25:16 UTC (rev 5282)
+++ portal/trunk/pom.xml 2010-11-25 22:40:51 UTC (rev 5283)
@@ -47,7 +47,7 @@
<org.gatein.common.version>2.0.3-GA</org.gatein.common.version>
<org.gatein.wci.version>2.0.2-GA</org.gatein.wci.version>
<org.gatein.pc.version>2.2.0-GA</org.gatein.pc.version>
- <org.picketlink.idm>1.1.7.CR01</org.picketlink.idm>
+ <org.picketlink.idm>1.1.7.GA</org.picketlink.idm>
<org.gatein.wsrp.version>2.0.0-CR02</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.3-GA</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
14 years, 1 month
gatein SVN: r5282 - portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm.
by do-not-reply@jboss.org
Author: bdaw
Date: 2010-11-25 17:25:16 -0500 (Thu, 25 Nov 2010)
New Revision: 5282
Added:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
Log:
GTNPORTAL-1695 - Improve logging in PicketLink IDM integration layer
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -22,6 +22,9 @@
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
import org.exoplatform.services.organization.GroupHandler;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.Attribute;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.impl.api.SimpleAttribute;
@@ -35,10 +38,10 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+
/*
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
*/
@@ -73,16 +76,50 @@
final public Group createGroupInstance()
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createGroupInstance",
+ null
+ );
+ }
return new ExtGroup();
}
public void createGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createGroup",
+ new Object[]{
+ "broadcast", broadcast
+ }
+ );
+ }
addChild(null, group, broadcast);
}
public void addChild(Group parent, Group child, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "addChild",
+ new Object[]{
+ "parent", parent,
+ "child", child,
+ "broadcast", broadcast
+ }
+ );
+ }
+
org.picketlink.idm.api.Group parentGroup = null;
String childPLGroupName = getPLIDMGroupName(child.getGroupName());
@@ -148,6 +185,19 @@
public void saveGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveGroup",
+ new Object[]{
+ "group", group,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (broadcast)
{
preSave(group, false);
@@ -161,6 +211,19 @@
public Group removeGroup(Group group, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeGroup",
+ new Object[]{
+ "group", group,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (broadcast)
{
preDelete(group);
@@ -228,6 +291,19 @@
public Collection findGroupByMembership(String userName, String membershipType) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupsByMembership",
+ new Object[]{
+ "userName", membershipType
+ }
+ );
+ }
+
+
Collection<org.picketlink.idm.api.Role> allRoles = new HashSet();
try
@@ -272,25 +348,84 @@
}
// UI has hardcoded casts to List
- return new LinkedList<Group>(exoGroups);
+ Collection result = new LinkedList<Group>(exoGroups);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupByMembership",
+ result
+ );
+ }
+
+ return result;
}
//
public Group findGroupById(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
org.picketlink.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
if (jbidGroup == null)
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ null
+ );
+ }
+
return null;
}
- return convertGroup(jbidGroup);
+ Group result = convertGroup(jbidGroup);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupById",
+ result
+ );
+ }
+
+ return result;
+
}
public Collection findGroups(Group parent) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroups",
+ new Object[]{
+ "parent", parent
+ }
+ );
+ }
+
org.picketlink.idm.api.Group jbidGroup = null;
if (parent == null)
@@ -396,6 +531,16 @@
Collections.sort(results);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroups",
+ results
+ );
+ }
+
return results;
}
@@ -403,6 +548,19 @@
public Collection findGroupsOfUser(String user) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ new Object[]{
+ "user", user
+ }
+ );
+ }
+
+
if (user == null)
{
// julien : integration bug
@@ -415,6 +573,17 @@
// at org.exoplatform.organization.webui.component.GroupManagement.isMemberOfGroup(GroupManagement.java:72)
// at org.exoplatform.organization.webui.component.GroupManagement.isAdministrator(GroupManagement.java:125)
// at org.exoplatform.organization.webui.component.UIGroupExplorer.<init>(UIGroupExplorer.java:57)
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ Collections.emptyList()
+ );
+ }
+
return Collections.emptyList();
}
@@ -439,12 +608,32 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findGroupsOfUser",
+ exoGroups
+ );
+ }
+
return exoGroups;
}
public Collection getAllGroups() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getAllGroups",
+ null
+ );
+ }
+
Set<org.picketlink.idm.api.Group> plGroups = new HashSet<org.picketlink.idm.api.Group>();
try
@@ -490,7 +679,19 @@
}
// UI has hardcoded casts to List
- return new LinkedList<Group>(exoGroups);
+ Collection result = new LinkedList<Group>(exoGroups);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getAllGroups",
+ result
+ );
+ }
+
+ return result;
}
@@ -529,6 +730,18 @@
protected Group convertGroup(org.picketlink.idm.api.Group jbidGroup) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "convertGroup",
+ new Object[]{
+ "jbidGroup", jbidGroup
+ }
+ );
+ }
+
Map<String, Attribute> attrs = new HashMap();
try
@@ -562,6 +775,16 @@
// Resolve full ID
String id = getGroupId(jbidGroup, null);
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getGroupId",
+ id
+ );
+ }
+
exoGroup.setId(id);
// child of root
@@ -575,6 +798,16 @@
exoGroup.setParentId(id.substring(0, id.lastIndexOf("/")));
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "convertGroup",
+ exoGroup
+ );
+ }
+
return exoGroup;
}
@@ -589,6 +822,20 @@
private String getGroupId(org.picketlink.idm.api.Group jbidGroup,
List<org.picketlink.idm.api.Group> processed) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getGroupId",
+ new Object[]{
+ "jbidGroup", jbidGroup,
+ "processed", processed
+ }
+ );
+ }
+
+
// Check in cache
if (getIntegrationCache() != null)
{
@@ -633,6 +880,10 @@
// Check if there is cross reference so we ended in a loop and break the process.
if (parents.size() > 0 && processed.contains(parents.iterator().next()))
{
+ if (log.isTraceEnabled())
+ {
+ log.trace("Detected looped relationship between groups!!!");
+ }
processed.remove(processed.size() - 1);
return CYCLIC_ID;
}
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -21,10 +21,14 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.services.organization.User;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.SortOrder;
import org.picketlink.idm.api.query.UserQuery;
import org.picketlink.idm.api.query.UserQueryBuilder;
+
import java.util.List;
/*
@@ -32,6 +36,8 @@
*/
public class IDMUserListAccess implements ListAccess<User>
{
+ private static Logger log = LoggerFactory.getLogger(IDMUserListAccess.class);
+
private final UserDAOImpl userDAO;
private final PicketLinkIDMService idmService;
@@ -54,6 +60,19 @@
public User[] load(int index, int length) throws Exception, IllegalArgumentException
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "load",
+ new Object[]{
+ "index", index,
+ "length", length
+ }
+ );
+ }
+
userQueryBuilder.page(index, length);
UserQuery query = userQueryBuilder.sort(SortOrder.ASCENDING).createQuery();
List<org.picketlink.idm.api.User> users = idmService.getIdentitySession().list(query);
@@ -67,21 +86,55 @@
exoUsers[i] = UserDAOImpl.getPopulatedUser(user.getId(), idmService.getIdentitySession());
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "load",
+ exoUsers
+ );
+ }
+
return exoUsers;
}
public int getSize() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getSize",
+ null
+ );
+ }
+
+ int result;
+
if (countAll)
{
- return idmService.getIdentitySession().getPersistenceManager().getUserCount();
+ result = idmService.getIdentitySession().getPersistenceManager().getUserCount();
}
else
{
userQueryBuilder.page(0, 0);
UserQuery query = userQueryBuilder.sort(SortOrder.ASCENDING).createQuery();
- return idmService.getIdentitySession().execute(query).size();
+ result = idmService.getIdentitySession().execute(query).size();
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "getSize",
+ result
+ );
+ }
+
+ return result;
+
}
}
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IntegrationCache.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -149,15 +149,17 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, id);
-
- if (log.isLoggable(Level.FINER))
+ if (ioNode != null)
{
+ ioNode.put(NODE_OBJECT_KEY, id);
- log.finer(this.toString() + "GateIn group id cached. PLIDM group id: " + pLIDMId +
- "GateIn group id: " + id + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn group id cached. PLIDM group id: " + pLIDMId +
+ "GateIn group id: " + id + ";namespace=" + ns);
+ }
}
-
}
/**
@@ -201,14 +203,16 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, rootGroup);
-
- if (log.isLoggable(Level.FINER))
+ if (ioNode != null)
{
+ ioNode.put(NODE_OBJECT_KEY, rootGroup);
- log.finer(this.toString() + "GateIn root group stored in cache" + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "GateIn root group stored in cache" + ";namespace=" + ns);
+ }
}
-
}
/**
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -26,12 +26,14 @@
import org.exoplatform.services.organization.MembershipHandler;
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.User;
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.Role;
import org.picketlink.idm.api.RoleType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -74,6 +76,19 @@
public void createMembership(Membership m, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createMembership",
+ new Object[]{
+ "membership", m,
+ "broadcast", broadcast,
+ }
+ );
+ }
+
if (broadcast)
{
preSave(m, true);
@@ -90,6 +105,21 @@
public void linkMembership(User user, Group g, MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "linkMembership",
+ new Object[]{
+ "user", user,
+ "group", g,
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
+
if (g == null)
{
throw new InvalidNameException("Can not create membership record for " + user.getUserName()
@@ -154,7 +184,20 @@
public void saveMembership(Membership m, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveMembership",
+ new Object[]{
+ "membership", m,
+ "broadcast", broadcast
+ }
+ );
+ }
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
String groupId =
@@ -222,7 +265,20 @@
public Membership removeMembership(String id, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembership",
+ new Object[]{
+ "id", id,
+ "broadcast", broadcast
+ }
+ );
+ }
+
Membership m = new MembershipImpl(id);
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
@@ -308,6 +364,20 @@
public Collection removeMembershipByUser(String userName, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembershipByUser",
+ new Object[]{
+ "userName", userName,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
Collection<Role> roles = new HashSet();
try
@@ -388,6 +458,22 @@
public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
{
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndType",
+ new Object[]{
+ "userName", userName,
+ "groupId", groupId,
+ "type", type,
+ }
+ );
+ }
+
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(groupId));
String gid =
@@ -437,6 +523,8 @@
hasMembership = true;
}
+ Membership result = null;
+
if (hasMembership)
{
@@ -446,16 +534,51 @@
m.setUserName(userName);
m.setMembershipType(type);
- return m;
+ result = m;
}
- return null;
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserGroupAndType",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByUserAndGroup(String userName, String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ new Object[]{
+ "userName", userName,
+ "groupId", groupId,
+ }
+ );
+ }
+
if (userName == null)
{
// julien fix : if user name is null, need to check if we do need to return a special group
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ Collections.emptyList()
+ );
+ }
+
return Collections.emptyList();
}
@@ -515,11 +638,36 @@
}
//TODO: Exo UI has hardcoded casts to List
- return new LinkedList(memberships);
+ Collection result = new LinkedList(memberships);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipByUserAndGroup",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByUser(String userName) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByUser",
+ new Object[]{
+ "userName", userName
+ }
+ );
+ }
+
+
Collection<Role> roles = new HashSet();
try
@@ -577,7 +725,19 @@
}
- return new LinkedList(memberships);
+ Collection result = new LinkedList(memberships);
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByUser",
+ result
+ );
+ }
+
+ return result;
}
public Collection findMembershipsByGroup(Group group) throws Exception
@@ -587,6 +747,18 @@
public Collection findMembershipsByGroupId(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByGroup",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
String plGroupName = getPLIDMGroupName(getGroupNameFromId(groupId));
String gid =
@@ -656,11 +828,34 @@
Collections.sort(results);
}
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipsByGroupId",
+ results
+ );
+ }
+
return results;
}
public Membership findMembership(String id) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ new Object[]{
+ "id", id
+ }
+ );
+ }
+
Membership m = new MembershipImpl(id);
String plGroupName = getPLIDMGroupName(getGroupNameFromId(m.getGroupId()));
@@ -675,6 +870,15 @@
if (isCreateMembership(m.getMembershipType()) &&
getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ m
+ );
+ }
return m;
}
}
@@ -690,6 +894,16 @@
if (isAssociationMapped() && getAssociationMapping().equals(m.getMembershipType()) &&
getIdentitySession().getRelationshipManager().isAssociatedByKeys(groupId, m.getUserName()))
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ m
+ );
+ }
+
return m;
}
}
@@ -700,6 +914,15 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembership",
+ null
+ );
+ }
return null;
}
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -157,4 +157,14 @@
return userName.compareTo(m.getUserName());
}
+
+ @Override
+ public String toString()
+ {
+ return "MembershipImpl{" +
+ "membershipType='" + membershipType + '\'' +
+ ", userName='" + userName + '\'' +
+ ", groupId='" + groupId + '\'' +
+ '}';
+ }
}
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -22,6 +22,7 @@
import org.exoplatform.services.organization.MembershipType;
import org.exoplatform.services.organization.MembershipTypeHandler;
import org.exoplatform.services.organization.impl.MembershipTypeImpl;
+import org.gatein.common.logging.LogLevel;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.IdentitySession;
@@ -71,6 +72,20 @@
public MembershipType createMembershipType(MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createMembershipType",
+ new Object[]{
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
Date now = new Date();
mt.setCreatedDate(now);
mt.setModifiedDate(now);
@@ -83,6 +98,18 @@
public MembershipType saveMembershipType(MembershipType mt, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveMembershipType",
+ new Object[]{
+ "membershipType", mt,
+ "broadcast", broadcast
+ }
+ );
+ }
Date now = new Date();
mt.setModifiedDate(now);
updateMembershipType(mt);
@@ -91,6 +118,18 @@
public MembershipType findMembershipType(String name) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipType",
+ new Object[]{
+ "name", name
+ }
+ );
+ }
+
RoleType rt = getIdentitySession().getRoleManager().getRoleType(name);
MembershipType mt = null;
@@ -101,11 +140,35 @@
populateMembershipType(mt);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipType",
+ mt
+ );
+ }
+
return mt;
}
public MembershipType removeMembershipType(String name, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeMembershipType",
+ new Object[]{
+ "name", name,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
MembershipType mt = findMembershipType(name);
if (mt != null)
@@ -119,6 +182,15 @@
public Collection findMembershipTypes() throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findMembershipTypes",
+ null
+ );
+ }
Collection<RoleType> rts = getIdentitySession().getRoleManager().findRoleTypes();
@@ -131,6 +203,16 @@
mts.add(mt);
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findMembershipTypes",
+ mts
+ );
+ }
+
return mts;
}
Added: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Tools.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -0,0 +1,106 @@
+package org.exoplatform.services.organization.idm;
+
+import org.gatein.common.logging.LogLevel;
+import org.gatein.common.logging.Logger;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+/*
+* JBoss, a division of Red Hat
+* Copyright 2010, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+/**
+ * Some helper methods
+ */
+public class Tools
+{
+ public static void logMethodIn(Logger log, LogLevel level, String methodName, Object[] args)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' called with arguments: ");
+
+ if (args != null)
+ {
+ for (Object arg : args)
+ {
+ if (arg != null && arg instanceof Object[])
+ {
+ sb.append(Arrays.toString((Object[])arg))
+ .append("; ");
+ }
+ else
+ {
+ sb.append(arg)
+ .append("; ");
+ }
+ }
+ }
+ else
+ {
+ sb.append(args);
+ }
+
+ log.log(level, sb.toString());
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application code): ", t);
+ }
+
+ }
+
+ public static void logMethodOut(Logger log, LogLevel level, String methodName, Object result)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' returning object: ");
+
+ if (result != null && result instanceof Collection)
+ {
+ sb.append("Collection of size: ").append(((Collection)result).size());
+ }
+ else
+ {
+ if (result != null)
+ {
+ sb.append("[").append(result.getClass().getCanonicalName()).append("]");
+ }
+ sb.append(result);
+ }
+
+ log.log(level, sb.toString());
+
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application code): ", t);
+ }
+ }
+
+}
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2010-11-25 19:19:13 UTC (rev 5281)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2010-11-25 22:25:16 UTC (rev 5282)
@@ -28,6 +28,7 @@
import org.exoplatform.services.organization.UserEventListener;
import org.exoplatform.services.organization.UserHandler;
import org.exoplatform.services.organization.impl.UserImpl;
+import org.gatein.common.logging.LogLevel;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.picketlink.idm.api.Attribute;
@@ -122,6 +123,20 @@
public void createUser(User user, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "createUser",
+ new Object[]{
+ "user", user,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
IdentitySession session = service_.getIdentitySession();
if (broadcast)
{
@@ -149,6 +164,20 @@
public void saveUser(User user, boolean broadcast) throws Exception
{
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "saveUser",
+ new Object[]{
+ "user", user,
+ "broadcast", broadcast
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
if (broadcast)
{
@@ -165,6 +194,20 @@
public User removeUser(String userName, boolean broadcast) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "removeUser",
+ new Object[]{
+ "userName", userName,
+ "broadcast", broadcast
+ }
+ );
+ }
+
+
IdentitySession session = service_.getIdentitySession();
org.picketlink.idm.api.User foundUser = null;
@@ -223,15 +266,49 @@
//
public User findUserByName(String userName) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUserByName",
+ new Object[]{
+ "userName", userName,
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
User user = getPopulatedUser(userName, session);
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findUserByName",
+ user
+ );
+ }
+
return user;
}
public LazyPageList getUserPageList(int pageSize) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "getUserPagetList",
+ new Object[]{
+ "pageSize", pageSize
+ }
+ );
+ }
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
return new LazyPageList(new IDMUserListAccess(this, service_, qb, pageSize, true), pageSize);
@@ -245,9 +322,32 @@
//
public boolean authenticate(String username, String password) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ new Object[]{
+ "userName", username,
+ "password", "****"
+ }
+ );
+ }
+
User user = findUserByName(username);
if (user == null)
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ false
+ );
+ }
+
return false;
}
@@ -279,12 +379,35 @@
userImpl.setLastLoginTime(Calendar.getInstance().getTime());
saveUser(userImpl, false);
}
+
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "authenticate",
+ authenticated
+ );
+ }
+
return authenticated;
}
public LazyPageList findUsers(Query q) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsers",
+ new Object[]{
+ "q", q
+ }
+ );
+ }
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
if (q.getUserName() != null)
@@ -319,6 +442,19 @@
public LazyPageList findUsersByGroup(String groupId) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsersByGroup",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
+
UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
org.picketlink.idm.api.Group jbidGroup = null;
@@ -339,6 +475,18 @@
public User findUserByEmail(String email) throws Exception
{
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUserByEmail",
+ new Object[]{
+ "findUserByEmail", email
+ }
+ );
+ }
+
IdentitySession session = service_.getIdentitySession();
@@ -363,6 +511,16 @@
}
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodOut(
+ log,
+ LogLevel.TRACE,
+ "findUserByEmail",
+ user
+ );
+ }
+
return user;
}
14 years, 1 month
gatein SVN: r5281 - exo/portal/branches/3.1.x.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-11-25 14:19:13 -0500 (Thu, 25 Nov 2010)
New Revision: 5281
Modified:
exo/portal/branches/3.1.x/pom.xml
Log:
EXOGTN-188 : Upgrade cf versions to current SNAPSHOTs
Modified: exo/portal/branches/3.1.x/pom.xml
===================================================================
--- exo/portal/branches/3.1.x/pom.xml 2010-11-25 17:54:46 UTC (rev 5280)
+++ exo/portal/branches/3.1.x/pom.xml 2010-11-25 19:19:13 UTC (rev 5281)
@@ -37,10 +37,10 @@
<name>GateIn - Portal</name>
<properties>
- <org.exoplatform.kernel.version>2.2.6-CR02</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.3.6-CR02</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.1.6-CR02</org.exoplatform.ws.version>
- <org.exoplatform.jcr.version>1.12.6-CR02</org.exoplatform.jcr.version>
+ <org.exoplatform.kernel.version>2.2.6-GA-SNAPSHOT</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.6-GA-SNAPSHOT</org.exoplatform.core.version>
+ <org.exoplatform.ws.version>2.1.6-GA-SNAPSHOT</org.exoplatform.ws.version>
+ <org.exoplatform.jcr.version>1.12.6-GA-SNAPSHOT</org.exoplatform.jcr.version>
<org.jibx.version>1.2.1</org.jibx.version>
<org.shindig.version>1.0-r790473-Patch04</org.shindig.version>
<nl.captcha.simplecaptcha.version>1.1.1-GA-Patch01</nl.captcha.simplecaptcha.version>
14 years, 1 month