Skip to content

Commit

Permalink
SAK-32184 Remove redundant -pack projects. (sakaiproject#3912)
Browse files Browse the repository at this point in the history
* SAK-32184 Remove redundant -pack projects.

Make most -impl projects of type sakai-component which means we have
less modules in the build and our build is smaller.

There were some references left to the -impl projects from things other than -pack projects. These have been refactored, either by moving the code, removing the unused dependency or in a couple of cases re-writing a tiny bit of code.
When deploying don’t create lots of small files which slows down the deployment for me.
  • Loading branch information
buckett authored Feb 23, 2017
1 parent 6ac4ef3 commit 2a888a3
Show file tree
Hide file tree
Showing 350 changed files with 282 additions and 2,417 deletions.
5 changes: 4 additions & 1 deletion announcement/announcement-impl/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
<url>http://www.sakaiproject.org/</url>
</organization>
<inceptionYear>2003</inceptionYear>
<packaging>jar</packaging>
<packaging>sakai-component</packaging>

<properties>
<deploy.target>components</deploy.target>
</properties>
<dependencies>
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
Expand Down
46 changes: 0 additions & 46 deletions announcement/announcement-impl/pack/pom.xml

This file was deleted.

1 change: 0 additions & 1 deletion announcement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<modules>
<module>announcement-api/api</module>
<module>announcement-impl/impl</module>
<module>announcement-impl/pack</module>
<module>announcement-tool/tool</module>
</modules>

Expand Down
32 changes: 0 additions & 32 deletions archive/import-pack/pom.xml

This file was deleted.

6 changes: 0 additions & 6 deletions archive/import-pack/src/webapp/WEB-INF/components.xml

This file was deleted.

1 change: 0 additions & 1 deletion archive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<modules>
<module>archive-tool/tool</module>
<module>import-handlers/announcement-handlers</module>
<module>import-pack</module>
</modules>
<dependencyManagement>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion assignment/assignment-impl/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<url>http://sakaiproject.org/</url>
</organization>
<inceptionYear>2003</inceptionYear>
<packaging>jar</packaging>
<packaging>sakai-component</packaging>

<dependencies>
<dependency>
Expand Down
32 changes: 0 additions & 32 deletions assignment/assignment-impl/pack/pom.xml

This file was deleted.

10 changes: 5 additions & 5 deletions assignment/assignment-tool/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>sakai-assignment-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sakai-assignment-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sakai-assignment-bundles</artifactId>
Expand Down Expand Up @@ -117,6 +112,11 @@
<groupId>org.sakaiproject.scheduler</groupId>
<artifactId>scheduler-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import org.sakaiproject.assignment.api.AssignmentContent;
import org.sakaiproject.assignment.api.AssignmentService;
import org.sakaiproject.assignment.api.AssignmentSubmission;
import org.sakaiproject.assignment.impl.BaseAssignmentService;
import org.sakaiproject.assignment.impl.MySecurityAdvisor;
import org.sakaiproject.authz.api.SecurityAdvisor;
import org.sakaiproject.authz.api.SecurityService;
import org.sakaiproject.component.api.ServerConfigurationService;
Expand Down Expand Up @@ -484,10 +482,12 @@ public Map<String, Object> getAssignDataForAnnouncement(EntityView view,
}
try {
// enable permission to view possible draft assignment
securityService.pushAdvisor(new MySecurityAdvisor(sessionManager
.getCurrentSessionUserId(),
SecurityAdvisor securityAdvisor = createSecurityAdvisor(
sessionManager.getCurrentSessionUserId(),
AssignmentService.SECURE_ADD_ASSIGNMENT,
BaseAssignmentService.getContextReference(context)));
assignmentService.assignmentReference(null, context)
);
securityService.pushAdvisor(securityAdvisor);

Assignment a = assignmentService.getAssignment(assignmentService
.assignmentReference(context, assignmentId));
Expand Down Expand Up @@ -597,6 +597,15 @@ public Map<String, Object> getAssignDataForAnnouncement(EntityView view,
return assignData;
}

private SecurityAdvisor createSecurityAdvisor(String currentUserId, String requiredFunction, String requiredReference) {
return (userId, function, reference) -> currentUserId.equals(userId) &&
requiredFunction.equals(function) &&
requiredReference.equals(reference)
? SecurityAdvisor.SecurityAdvice.ALLOWED
: SecurityAdvisor.SecurityAdvice.PASS
;
}

@EntityCustomAction(action = "deepLinkWithPermissions", viewKey = EntityView.VIEW_LIST)
public Map<String, String> getAssignmentDeepLinks(EntityView view,
Map<String, Object> params) {
Expand Down Expand Up @@ -900,11 +909,11 @@ public Map<String, String> getProperties(String reference) {

if (!"null".equals(submissionId)) {
props.put("security.assignment.ref", submissionId);
SecurityAdvisor subAdv = new MySecurityAdvisor(
SecurityAdvisor subAdv = createSecurityAdvisor(
sessionManager.getCurrentSessionUserId(),
AssignmentService.SECURE_ACCESS_ASSIGNMENT_SUBMISSION,
submissionId);
SecurityAdvisor subAdv2 = new MySecurityAdvisor(
SecurityAdvisor subAdv2 = createSecurityAdvisor(
sessionManager.getCurrentSessionUserId(),
AssignmentService.SECURE_GRADE_ASSIGNMENT_SUBMISSION,
assignment.getReference());
Expand Down
1 change: 0 additions & 1 deletion assignment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<module>assignment-api/api</module>
<module>assignment-bundles</module>
<module>assignment-impl/impl</module>
<module>assignment-impl/pack</module>
<module>assignment-tool/tool</module>
</modules>

Expand Down
8 changes: 4 additions & 4 deletions basiclti/basiclti-blis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>basiclti-api</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>basiclti-impl</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>portlet-util</artifactId>
Expand Down Expand Up @@ -80,6 +76,10 @@
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>

<!-- for the entityprovider -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
import org.tsugi.pox.IMSPOXRequest;

import org.sakaiproject.lti.api.LTIService;
import org.sakaiproject.util.foorm.SakaiFoorm;
import org.sakaiproject.util.foorm.FoormUtil;

/**
* Notes:
Expand Down Expand Up @@ -123,8 +121,6 @@ public class ServiceServlet extends HttpServlet {
private static Logger M_log = LoggerFactory.getLogger(ServiceServlet.class);
private static ResourceLoader rb = new ResourceLoader("blis");

protected static SakaiFoorm foorm = new SakaiFoorm();

protected static LTIService ltiService = null;

private final String returnHTML =
Expand Down Expand Up @@ -506,7 +502,7 @@ protected void processSetting(HttpServletRequest request, HttpServletResponse re
} else {
Map<String,Object> content = null;
String contentStr = pitch.getProperty("contentKey");
Long contentKey = foorm.getLongKey(contentStr);
Long contentKey = SakaiBLTIUtil.getLongKey(contentStr);
if ( contentKey >= 0 ) content = ltiService.getContentDao(contentKey, siteId);
if ( content != null ) {
if ( "basic-lti-savesetting".equals(lti_message_type) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.sakaiproject.component.cover.ServerConfigurationService;
import org.sakaiproject.lti.api.LTIService;
import org.sakaiproject.util.ResourceLoader;
import org.sakaiproject.util.foorm.SakaiFoorm;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
Expand All @@ -76,8 +75,6 @@ public class LTI2Service extends HttpServlet {
private static Logger M_log = LoggerFactory.getLogger(LTI2Service.class);
private static ResourceLoader rb = new ResourceLoader("blis");

protected static SakaiFoorm foorm = new SakaiFoorm();

protected static LTIService ltiService = null;

protected String resourceUrl = null;
Expand Down Expand Up @@ -231,7 +228,7 @@ protected ToolConsumer getToolConsumerProfile(Map<String, Object> deploy, String
// Not yet supported in Sakai
// consumer.addCapability(SakaiBLTIUtil.CANVAS_PLACEMENTS_ACCOUNTNAVIGATION);

if ( foorm.getLong(deploy.get(LTIService.LTI_ALLOWCONTENTITEM)) > 0 ) {
if ( SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ALLOWCONTENTITEM)) > 0 ) {
consumer.addCapability(LTI2Messages.CONTENT_ITEM_SELECTION_REQUEST);
// Not yet supported in Sakai
// consumer.addCapability(SakaiBLTIUtil.SAKAI_CONTENTITEM_SELECTANY);
Expand All @@ -242,19 +239,19 @@ protected ToolConsumer getToolConsumerProfile(Map<String, Object> deploy, String
consumer.addCapability(SakaiBLTIUtil.CANVAS_PLACEMENTS_CONTENTIMPORT);
}

if (foorm.getLong(deploy.get(LTIService.LTI_SENDEMAILADDR)) > 0 ) {
if (SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_SENDEMAILADDR)) > 0 ) {
consumer.allowEmail();
}

if (foorm.getLong(deploy.get(LTIService.LTI_SENDNAME)) > 0 ) {
if (SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_SENDNAME)) > 0 ) {
consumer.allowName();
}

List<Service_offered> services = consumer.getService_offered();
services.add(StandardServices.LTI2Registration(serverUrl + LTI2_PATH + SVC_tc_registration + "/" + profile_id));

String allowOutcomes = ServerConfigurationService.getString(SakaiBLTIUtil.BASICLTI_OUTCOMES_ENABLED, SakaiBLTIUtil.BASICLTI_OUTCOMES_ENABLED_DEFAULT);
if ("true".equals(allowOutcomes) && foorm.getLong(deploy.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
if ("true".equals(allowOutcomes) && SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
consumer.allowResult();

services.add(LTI2ResultItem);
Expand All @@ -263,12 +260,12 @@ protected ToolConsumer getToolConsumerProfile(Map<String, Object> deploy, String
}

String allowRoster = ServerConfigurationService.getString(SakaiBLTIUtil.BASICLTI_ROSTER_ENABLED, SakaiBLTIUtil.BASICLTI_ROSTER_ENABLED_DEFAULT);
if ("true".equals(allowRoster) && foorm.getLong(deploy.get(LTIService.LTI_ALLOWROSTER)) > 0 ) {
if ("true".equals(allowRoster) && SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ALLOWROSTER)) > 0 ) {
services.add(SakaiLTI2Services.BasicRoster(serverUrl+LTI1_PATH));
}

String allowSettings = ServerConfigurationService.getString(SakaiBLTIUtil.BASICLTI_SETTINGS_ENABLED, SakaiBLTIUtil.BASICLTI_SETTINGS_ENABLED_DEFAULT);
if ("true".equals(allowSettings) && foorm.getLong(deploy.get(LTIService.LTI_ALLOWSETTINGS)) > 0 ) {
if ("true".equals(allowSettings) && SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ALLOWSETTINGS)) > 0 ) {
consumer.allowSettings();

services.add(SakaiLTI2Services.BasicSettings(serverUrl+LTI1_PATH));
Expand Down Expand Up @@ -298,10 +295,10 @@ public void registerToolProviderProfile(HttpServletRequest request,HttpServletRe
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
Long deployKey = foorm.getLong(deploy.get(LTIService.LTI_ID));
Long deployKey = SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ID));

// See if we can even register...
Long reg_state = foorm.getLong(deploy.get(LTIService.LTI_REG_STATE));
Long reg_state = SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_REG_STATE));
String key = null;
String secret = null;
String new_secret = null;
Expand Down Expand Up @@ -630,9 +627,9 @@ public void handleSettingsRequest(HttpServletRequest request,HttpServletResponse
ltiService.filterContent(content, tool);

// Check settings to see if we are allowed to do this
if (foorm.getLong(content.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ||
foorm.getLong(tool.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
// Good news
if (SakaiBLTIUtil.getLong(content.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ||
SakaiBLTIUtil.getLong(tool.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
// Good news
} else {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
doErrorJSON(request,response, jsonRequest, "Item does not allow tool settings", null);
Expand Down Expand Up @@ -678,7 +675,7 @@ public void handleSettingsRequest(HttpServletRequest request,HttpServletResponse

// Check settings to see if we are allowed to do this
if ( deploy != null ) {
if (foorm.getLong(deploy.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
if (SakaiBLTIUtil.getLong(deploy.get(LTIService.LTI_ALLOWOUTCOMES)) > 0 ) {
// Good news
} else {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
Expand Down
Loading

0 comments on commit 2a888a3

Please sign in to comment.