Permalink
Browse files

Merge remote branch 'ieb/master'

  • Loading branch information...
codders committed Sep 17, 2009
2 parents 35f7d7d + 478cf6f commit 8eca4214f88bd7ef1495f18e2e6457ce9c9a7cff
Showing with 2,000 additions and 503 deletions.
  1. +1 −1 slingtests/osgikernel/app-bundles/pom.xml
  2. +8 −4 slingtests/osgikernel/bundles/activity/pom.xml
  3. +7 −10 ...kernel/bundles/activity/src/main/java/org/sakaiproject/kernel/activity/ActivityCreateServlet.java
  4. +63 −47 ...ernel/bundles/activity/src/main/java/org/sakaiproject/kernel/activity/ActivityEventProcessor.java
  5. +4 −0 ...kernel/bundles/activity/src/main/java/org/sakaiproject/kernel/api/activity/ActivityConstants.java
  6. +1 −0 slingtests/osgikernel/bundles/activity/src/main/resources/SLING-INF/var/activity/README.txt
  7. +1 −0 ...gtests/osgikernel/bundles/activity/src/main/resources/SLING-INF/var/activity/templates/README.txt
  8. +2 −2 slingtests/osgikernel/bundles/connections/pom.xml
  9. +2 −2 slingtests/osgikernel/bundles/discussion/pom.xml
  10. +6 −0 .../bundles/discussion/src/main/java/org/sakaiproject/kernel/api/discussion/DiscussionConstants.java
  11. +20 −4 ...el/bundles/discussion/src/main/java/org/sakaiproject/kernel/api/discussion/DiscussionManager.java
  12. +40 −0 ...rnel/bundles/discussion/src/main/java/org/sakaiproject/kernel/api/discussion/DiscussionTypes.java
  13. +25 −34 ...ests/osgikernel/bundles/discussion/src/main/java/org/sakaiproject/kernel/api/discussion/Post.java
  14. +18 −0 ...ssion/src/main/java/org/sakaiproject/kernel/discussion/DiscussionInitialPostPropertyProvider.java
  15. +43 −3 ...el/bundles/discussion/src/main/java/org/sakaiproject/kernel/discussion/DiscussionManagerImpl.java
  16. +62 −0 ...gikernel/bundles/discussion/src/main/java/org/sakaiproject/kernel/discussion/DiscussionRoute.java
  17. +124 −0 ...ikernel/bundles/discussion/src/main/java/org/sakaiproject/kernel/discussion/DiscussionRouter.java
  18. +18 −0 .../java/org/sakaiproject/kernel/discussion/searchresults/DiscussionInitialPostPropertyProvider.java
  19. +0 −7 ...gikernel/bundles/discussion/src/main/resources/SLING-INF/content/var/discussion/initialposts.json
  20. +1 −1 ...iscussion/src/main/resources/SLING-INF/content/var/search/discussions/initialdiscussionposts.json
  21. +1 −1 ...rnel/bundles/discussion/src/main/resources/SLING-INF/content/var/search/discussions/threaded.json
  22. +18 −0 ...rnel/bundles/discussion/src/test/java/org/sakaiproject/kernel/discussion/DiscussionUtilsTest.java
  23. +6 −0 slingtests/osgikernel/bundles/email-outgoing/pom.xml
  24. +6 −3 ...dles/email-outgoing/src/main/java/org/sakaiproject/kernel/email/outgoing/EmailMessageHandler.java
  25. +80 −54 ...l-outgoing/src/main/java/org/sakaiproject/kernel/email/outgoing/OutgoingEmailMessageListener.java
  26. +58 −0 .../email-outgoing/src/test/java/org/sakaiproject/kernel/email/outgoing/EmailMessageHandlerTest.java
  27. +24 −14 ...tgoing/src/test/java/org/sakaiproject/kernel/email/outgoing/OutgoingEmailMessageListenerTest.java
  28. +11 −8 ...ikernel/bundles/messaging/src/main/java/org/sakaiproject/kernel/api/message/MessageConstants.java
  29. +28 −6 ...undles/messaging/src/main/java/org/sakaiproject/kernel/message/MessageSearchPropertyProvider.java
  30. +7 −8 ...bundles/messaging/src/main/java/org/sakaiproject/kernel/message/MessageSearchResultProcessor.java
  31. +1 −1 ...ts/osgikernel/bundles/messaging/src/main/java/org/sakaiproject/kernel/message/MessageServlet.java
  32. +4 −2 ...ikernel/bundles/messaging/src/main/java/org/sakaiproject/kernel/message/MessagingServiceImpl.java
  33. +1 −0 ...essaging/src/main/java/org/sakaiproject/kernel/message/chat/ChatMessageSearchResultProcessor.java
  34. +1 −1 ...sts/osgikernel/bundles/messaging/src/main/resources/SLING-INF/content/_user/message/chat/all.json
  35. +1 −1 .../osgikernel/bundles/messaging/src/main/resources/SLING-INF/content/_user/message/chat/unread.json
  36. +37 −0 ...undles/messaging/src/test/java/org/sakaiproject/kernel/message/listener/MessageRouteImplTest.java
  37. +28 −0 ...ndles/messaging/src/test/java/org/sakaiproject/kernel/message/listener/MessageRoutesImplTest.java
  38. +77 −0 ...les/messaging/src/test/java/org/sakaiproject/kernel/message/listener/MessageSentListenerTest.java
  39. +1 −1 slingtests/osgikernel/bundles/personal/pom.xml
  40. +29 −24 ...osgikernel/bundles/personal/src/main/java/org/sakaiproject/kernel/api/personal/PersonalUtils.java
  41. +126 −0 ...bundles/presence/src/main/java/org/sakaiproject/kernel/presence/servlets/PresenceUserServlet.java
  42. +4 −0 .../osgikernel/bundles/proxy/src/main/java/org/sakaiproject/kernel/api/proxy/ProxyClientService.java
  43. +14 −3 .../osgikernel/bundles/proxy/src/main/java/org/sakaiproject/kernel/proxy/ProxyClientServiceImpl.java
  44. +4 −7 ...ikernel/bundles/proxy/src/main/java/org/sakaiproject/kernel/proxy/velocity/JcrResourceLoader.java
  45. +35 −4 ...ikernel/bundles/proxy/src/test/java/org/sakaiproject/kernel/proxy/ProxyClientServiceImplTest.java
  46. +1 −1 slingtests/osgikernel/bundles/search/src/main/java/org/sakaiproject/kernel/search/SearchServlet.java
  47. +59 −7 .../apache/sling/jcr/jackrabbit/server/impl/security/dynamic/DynamicPrincipalManagerFactoryImpl.java
  48. +30 −2 ...rc/main/java/org/apache/sling/jcr/jackrabbit/server/security/dynamic/DynamicPrincipalManager.java
  49. +1 −1 slingtests/osgikernel/bundles/site/src/main/java/org/sakaiproject/kernel/site/SiteServiceImpl.java
  50. +207 −209 ...osgikernel/bundles/site/src/main/java/org/sakaiproject/kernel/site/servlet/CreateSiteServlet.java
  51. +1 −0 ...bundles/site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_navigation/content
  52. +2 −1 ...site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_pages/a-short-history.json
  53. +3 −1 ...les/site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_pages/all-members.json
  54. +3 −1 ...dles/site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_pages/contact-us.json
  55. +3 −1 ...es/site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_pages/introduction.json
  56. +3 −1 ...les/site/src/main/resources/SLING-INF/content/templates/interdisciplinary/_pages/latest-news.json
  57. +1 −0 ...gikernel/bundles/site/src/main/resources/SLING-INF/content/templates/template/_navigation/content
  58. +3 −1 ...gikernel/bundles/site/src/main/resources/SLING-INF/content/templates/template/_pages/welcome.json
  59. +4 −0 slingtests/osgikernel/bundles/site/src/main/resources/SLING-INF/nodetypes/site.cnd
  60. +2 −2 slingtests/osgikernel/bundles/sling/api/pom.xml
  61. +1 −1 slingtests/osgikernel/bundles/sling/resource/pom.xml
  62. +18 −0 ...rnel/bundles/user/src/main/java/org/sakaiproject/kernel/user/owner/OwnerPrincipalManagerImpl.java
  63. +18 −2 ...ests/osgikernel/bundles/version/src/main/java/org/sakaiproject/kernel/version/VersionService.java
  64. +59 −14 ...ikernel/bundles/version/src/main/java/org/sakaiproject/kernel/version/impl/GetVersionServlet.java
  65. +21 −0 ...kernel/bundles/version/src/main/java/org/sakaiproject/kernel/version/impl/VersionServiceImpl.java
  66. +6 −0 ...ries/testutils/src/main/java/org/sakaiproject/kernel/testutils/easymock/AbstractEasyMockTest.java
  67. +16 −3 slingtests/osgikernel/libraries/utils/src/main/java/org/sakaiproject/kernel/util/JcrUtils.java
  68. +90 −0 .../osgikernel/libraries/utils/src/main/java/org/sakaiproject/kernel/util/MultiValueInputStream.java
  69. +222 −0 slingtests/osgikernel/libraries/utils/src/test/java/org/sakaiproject/kernel/util/JcrUtilsTest.java
  70. +114 −0 ...ikernel/libraries/utils/src/test/java/org/sakaiproject/kernel/util/MultiValueInputStreamTest.java
  71. +1 −0 slingtests/osgikernel/pom.xml
  72. +2 −2 slingtests/osgikernel/testscripts/SlingRuby/sling/message.rb
  73. +61 −0 slingtests/osgikernel/testscripts/SlingRuby/tests/send-email-message.rb
@@ -258,7 +258,7 @@
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.0.5-sakai-SNAPSHOT</version>
+ <version>2.0.6-sakai-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
@@ -39,8 +39,7 @@
<Bundle-Category>sakai-kernel</Bundle-Category>
<Export-Package>org.sakaiproject.kernel.api.activity</Export-Package>
<Private-Package>org.sakaiproject.kernel.activity.*</Private-Package>
-<!-- <Sling-Initial-Content>SLING-INF/content</Sling-Initial-Content>
--->
+ <Sling-Initial-Content>SLING-INF/content</Sling-Initial-Content>
</instructions>
</configuration>
</plugin>
@@ -88,7 +87,6 @@
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
- <version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -118,5 +116,11 @@
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>0.9.0</version>
</dependency>
+ <dependency>
+ <groupId>org.sakaiproject.kernel</groupId>
+ <artifactId>org.sakaiproject.kernel.testutils</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-</project>
+</project>
@@ -18,6 +18,9 @@
package org.sakaiproject.kernel.activity;
import static org.sakaiproject.kernel.api.activity.ActivityConstants.ACTOR_PROPERTY;
+import static org.sakaiproject.kernel.api.activity.ActivityConstants.REQUEST_PARAM_APPLICATION_ID;
+import static org.sakaiproject.kernel.api.activity.ActivityConstants.REQUEST_PARAM_TEMPLATE_ID;
+import static org.sakaiproject.kernel.api.activity.ActivityConstants.ACTIVITY_STORE_NAME;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -65,7 +68,6 @@
* interface="org.osgi.service.event.EventAdmin"
*/
public class ActivityCreateServlet extends SlingAllMethodsServlet {
- private static final String ACTIVITY_STORE_NAME = "activity";
private static final long serialVersionUID = 1375206766455341437L;
private static final Logger LOG = LoggerFactory.getLogger(ActivityCreateServlet.class);
private EventAdmin eventAdmin;
@@ -85,14 +87,14 @@ protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse
}
// Let's perform some validation on the request parameters. Do we have the minimum
// required?
- RequestParameter applicationId = request.getRequestParameter("applicationId");
- if (applicationId == null || "".equals(applicationId.getString())) {
+ RequestParameter applicationId = request.getRequestParameter(REQUEST_PARAM_APPLICATION_ID);
+ if (applicationId == null || "".equals(applicationId.toString())) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
"The applicationId parameter must not be null");
return;
}
- RequestParameter templateId = request.getRequestParameter("templateId");
- if (templateId == null || "".equals(templateId.getString())) {
+ RequestParameter templateId = request.getRequestParameter(REQUEST_PARAM_TEMPLATE_ID);
+ if (templateId == null || "".equals(templateId.toString())) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
"The templateId parameter must not be null");
return;
@@ -134,30 +136,25 @@ protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse
// Wrapper which needs to remove the .activity selector from RequestPathInfo to avoid
// an infinite loop.
final RequestPathInfo wrappedPathInfo = new RequestPathInfo() {
- @Override
public String getSuffix() {
return requestPathInfo.getSuffix();
}
- @Override
public String[] getSelectors() {
// TODO Probably should just *remove* the ".activity" selector from array
return new String[0];
}
- @Override
public String getSelectorString() {
// TODO Probably should just *remove* the ".activity" selector from string
return null;
}
- @Override
public String getResourcePath() {
// LOG.debug("requestPathInfo.getResourcePath()=" + resourcePath);
return activityItemPath;
}
- @Override
public String getExtension() {
return requestPathInfo.getExtension();
}
@@ -59,11 +59,10 @@
protected SlingRepository slingRepository;
- @Override
public void handleEvent(Event event) {
LOG.debug("handleEvent(Event {})", event);
final String activityItemPath = (String) event.getProperty("activityItemPath");
- LOG.debug("activityItemPath={}", activityItemPath);
+ LOG.info("Processing activity: {}", activityItemPath);
Session session = null;
try {
session = slingRepository.loginAdministrative(null);
@@ -72,57 +71,15 @@ public void handleEvent(Event event) {
// process activity
// hints will be attached to the activity as to where we need to deliver
// for example: connections, siteA, siteB
+ // from Nico: /sites/siteid/activityFeed.json
// Let's try the the simpler connections case first
String actor = activity.getProperty(ACTOR_PROPERTY).getString();
if (actor == null || "".equals(actor)) { // we must know the actor
throw new IllegalStateException("Could not determine actor of activity: "
+ activity);
}
- // get the users connected to the actor and distribute to them
- String activityFeedPath = null;
- List<String> connections = connectionManager.getConnectedUsers(actor,
- ConnectionState.ACCEPTED);
- if (connections == null || connections.size() <= 0) {
- LOG.debug("{} acted but has no connections; nothing to do.", actor);
- } else { // actor has connections
- for (String connection : connections) {
- // deliver to each connection
- LOG.debug("{} acted; delivering activity to connection: {}", new Object[] {
- actor, connection });
- activityFeedPath = PathUtils.toInternalHashedPath(_USER_PRIVATE, connection,
- "/activityFeed");
- LOG.debug("activityFeedPath for connection {}={}", new Object[] { connection,
- activityFeedPath });
- // ensure the activityFeed node with the proper type
- Node activityFeedNode = JcrUtils.deepGetOrCreateNode(session,
- activityFeedPath);
- if (activityFeedNode.isNew()) {
- activityFeedNode.setProperty(
- JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY,
- ActivityConstants.ACTIVITY_FEED_RESOURCE_TYPE);
- session.save();
- }
- // activityFeed exists, let's continue with delivery
- final String deliveryPath = PathUtils.toInternalHashedPath(activityFeedPath,
- UUID.randomUUID().toString(), "");
- LOG.debug("final deliveryPath={}", deliveryPath);
- final String parentPath = deliveryPath.substring(0, deliveryPath
- .lastIndexOf("/"));
- // ensure the parent path exists before we copy source activity
- final Node parentNode = JcrUtils.deepGetOrCreateNode(session, parentPath);
- if (parentNode.isNew()) {
- session.save();
- }
- // now copy the activity from the store to the feed
- session.getWorkspace().copy(activity.getPath(), deliveryPath);
- // next let's create a source property to refer back to the original item
- // in the ActivityStore
- Node feedItem = (Node) session.getItem(deliveryPath);
- feedItem.setProperty(SOURCE_PROPERTY, activity.getPath());
- session.save();
- }
- }
-
+ // TODO assume we were passed the connections hint; need to check
+ deliverActivityToConnections(session, activity, actor);
} else {
LOG.error("Could not process activity: {}", activityItemPath);
throw new Error("Could not process activity: " + activityItemPath);
@@ -139,6 +96,65 @@ public void handleEvent(Event event) {
}
+ private void deliverActivityToConnections(Session session, Node activity, String actor)
+ throws RepositoryException {
+ LOG.debug("deliverActivityToConnections(Session {}, Node {}, String {})",
+ new Object[] { session, activity, actor });
+ // get the users connected to the actor and distribute to them
+ String activityFeedPath = null;
+ List<String> connections = connectionManager.getConnectedUsers(actor,
+ ConnectionState.ACCEPTED);
+ if (connections == null || connections.size() <= 0) {
+ LOG.debug("{} acted but has no connections; nothing to do.", actor);
+ } else { // actor has connections
+ for (String connection : connections) {
+ // deliver to each connection
+ LOG.debug("{} acted; delivering activity to connection: {}", new Object[] {
+ actor, connection });
+ // /_user/private is a BigStore, get the hashed path
+ activityFeedPath = PathUtils.toInternalHashedPath(_USER_PRIVATE, connection,
+ "/activityFeed");
+ deliverActivityToFeed(session, activity, activityFeedPath);
+ }
+ }
+ }
+
+ private void deliverActivityToFeed(Session session, Node activity,
+ String activityFeedPath) throws RepositoryException {
+ // ensure the activityFeed node with the proper type
+ Node activityFeedNode = JcrUtils.deepGetOrCreateNode(session, activityFeedPath);
+ if (activityFeedNode.isNew()) {
+ activityFeedNode.setProperty(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY,
+ ActivityConstants.ACTIVITY_FEED_RESOURCE_TYPE);
+ session.save();
+ }
+ // activityFeed exists, let's continue with delivery
+ // activityFeed is a BigStore, get the hashed (real) path
+ final String deliveryPath = PathUtils.toInternalHashedPath(activityFeedPath, UUID
+ .randomUUID().toString(), "");
+ // ensure the parent path exists before we copy source activity
+ final String parentPath = deliveryPath.substring(0, deliveryPath.lastIndexOf("/"));
+ final Node parentNode = JcrUtils.deepGetOrCreateNode(session, parentPath);
+ if (parentNode.isNew()) {
+ session.save();
+ }
+ // now copy the activity from the store to the feed
+ copyActivityItem(session, activity.getPath(), deliveryPath);
+ }
+
+ private void copyActivityItem(Session session, String source, String destination)
+ throws RepositoryException {
+ LOG.debug("copyActivityItem(Session {}, String {}, String {})", new Object[] {
+ session, source, destination });
+ // now copy the activity from the source to the destination
+ session.getWorkspace().copy(source, destination);
+ // next let's create a source property to refer back to the original item
+ // in the ActivityStore
+ Node feedItem = (Node) session.getItem(destination);
+ feedItem.setProperty(SOURCE_PROPERTY, source);
+ session.save();
+ }
+
protected void bindSlingRepository(SlingRepository slingRepository) {
this.slingRepository = slingRepository;
}
@@ -21,6 +21,10 @@
*
*/
public interface ActivityConstants {
+ public static final String REQUEST_PARAM_APPLICATION_ID = "applicationId";
+ public static final String REQUEST_PARAM_TEMPLATE_ID = "templateId";
+ public static final String ACTIVITY_STORE_NAME = "activity";
+
/**
* JCR folder name for templates.
*/
@@ -106,7 +106,7 @@
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.0.5-sakai-SNAPSHOT</version>
+ <version>2.0.6-sakai-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- servlet -->
@@ -168,4 +168,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
-</project>
+</project>
@@ -122,7 +122,7 @@
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.0.5-sakai-SNAPSHOT</version>
+ <version>2.0.6-sakai-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- servlet -->
@@ -184,4 +184,4 @@
<scope>provided</scope>
</dependency>
</dependencies>
-</project>
+</project>
@@ -40,6 +40,10 @@
* Holds the value of people who editted this message.
*/
public static final String PROP_EDITEDBY = "sakai:editedby";
+ /**
+ * Holds the profile info for the editters.
+ */
+ public static final String PROP_EDITEDBYPROFILES = "sakai:editedbyprofiles";
/**
* Holds the ID of the message we want to reply on.
@@ -57,4 +61,6 @@
*/
public static final String PROP_NOTIFICATION = "sakai:notification";
+ public static final String PROP_NOTIFY_ADDRESS = "sakai:notificationaddress";
+
}
@@ -25,12 +25,28 @@
public interface DiscussionManager {
/**
* Goes trough the repository to look for a message with an id and a marker.
- * @param messageId The ID of the message to look for.
- * @param marker The marker it should have.
+ *
+ * @param messageId
+ * The ID of the message to look for.
+ * @param marker
+ * The marker it should have.
* @param session
- * @param path An optional path where you want to look in.
+ * @param path
+ * An optional path where you want to look in.
* @return
* @throws MessagingException
*/
- public Node findMessage(String messageId, String marker, Session session, String path) throws MessagingException;
+ public Node findMessage(String messageId, String marker, Session session, String path)
+ throws MessagingException;
+
+ /**
+ * Looks in the entire repository to find a sakai/settings file of a certain type and
+ * marker.
+ *
+ * @param marker
+ * @param session
+ * @param type
+ * @return
+ */
+ public Node findSettings(String marker, Session session, String type);
}
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Sakai Foundation (SF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The SF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+package org.sakaiproject.kernel.api.discussion;
+
+public enum DiscussionTypes {
+ discussion, comment;
+
+ // TODO: IMHO, hasValue should not do things like this. We have an enum, and we are
+ // encouraging abuse of the enum since Discssion DiScUsSiOn are all ok, but wont be
+ // searchable, and can't be coerced into the DiscussionType I would rather using
+ // DiscussionTypes.valueOf(string) and catch
+ // the InvalidArgumentException
+
+
+ public static boolean hasValue(String s) {
+ DiscussionTypes[] types = values();
+ for (DiscussionTypes t : types) {
+ if (t.name().equalsIgnoreCase(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Oops, something went wrong.

0 comments on commit 8eca421

Please sign in to comment.