From c95c32376f18cd51125aca1730c97f760774a342 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 25 May 2016 20:24:59 +0200 Subject: [PATCH 01/23] Use c3p0 connection manager for database connection manager #RB-205 --- .classpath | 3 ++- etc/ivy/ivy.xml | 1 + .../bazaar/service/AttachmentsResource.java | 4 ++-- .../acis/bazaar/service/BazaarService.java | 22 +++++++++--------- .../acis/bazaar/service/CommentsResource.java | 6 ++--- .../bazaar/service/ComponentsResource.java | 10 ++++---- .../acis/bazaar/service/ProjectsResource.java | 14 +++++------ .../bazaar/service/RequirementsResource.java | 23 +++++++++---------- .../acis/bazaar/service/UsersResource.java | 6 ++--- .../notification/ActivityDispatcher.java | 2 +- .../service/notification/EmailDispatcher.java | 2 +- 11 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.classpath b/.classpath index 8cb89f87..d455cd68 100755 --- a/.classpath +++ b/.classpath @@ -3,6 +3,7 @@ + @@ -53,4 +54,4 @@ - + \ No newline at end of file diff --git a/etc/ivy/ivy.xml b/etc/ivy/ivy.xml index 85b97057..4b692144 100755 --- a/etc/ivy/ivy.xml +++ b/etc/ivy/ivy.xml @@ -13,6 +13,7 @@ + diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java index 73aef03e..ebbebc50 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java @@ -89,7 +89,7 @@ public HttpResponse createAttachment(@ApiParam(value = "Attachment type", allowa if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Requirement requirement = dalFacade.getRequirementById(attachmentToCreate.getRequirementId(), internalUserId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_ATTACHMENT, String.valueOf(requirement.getProjectId()), dalFacade); @@ -157,7 +157,7 @@ public HttpResponse deleteAttachment(@PathParam("attachmentId") int attachmentId if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); // TODO check requirement Requirement requirement = dalFacade.getRequirementById(attachmentId, internalUserId); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java index 43b9cbe4..324551a2 100755 --- a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java @@ -21,14 +21,13 @@ package de.rwth.dbis.acis.bazaar.service; import com.fasterxml.jackson.core.JsonProcessingException; -import com.google.gson.Gson; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; +import com.mchange.v2.c3p0.ComboPooledDataSource; import com.mysql.jdbc.exceptions.jdbc4.CommunicationsException; import de.rwth.dbis.acis.bazaar.service.dal.DALFacade; import de.rwth.dbis.acis.bazaar.service.dal.DALFacadeImpl; -import de.rwth.dbis.acis.bazaar.service.dal.entities.Activity; import de.rwth.dbis.acis.bazaar.service.dal.entities.User; import de.rwth.dbis.acis.bazaar.service.exception.BazaarException; import de.rwth.dbis.acis.bazaar.service.exception.ErrorCode; @@ -45,7 +44,6 @@ import i5.las2peer.restMapper.MediaType; import i5.las2peer.restMapper.RESTMapper; import i5.las2peer.restMapper.annotations.Version; -import i5.las2peer.security.Context; import i5.las2peer.security.UserAgent; import io.swagger.annotations.*; import io.swagger.jaxrs.Reader; @@ -57,10 +55,8 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import java.io.Serializable; import java.net.HttpURLConnection; import java.sql.Connection; -import java.sql.DriverManager; import java.sql.SQLException; import java.util.*; @@ -112,6 +108,7 @@ public class BazaarService extends Service { private Vtor vtor; private List functionRegistrators; private NotificationDispatcher notificationDispatcher; + private ComboPooledDataSource dbConnectionPool; /** * This method is needed for every RESTful application in LAS2peer. @@ -135,7 +132,11 @@ public BazaarService() throws Exception { Locale locale = new Locale(lang, country); Localization.getInstance().setResourceBundle(ResourceBundle.getBundle("i18n.Translation", locale)); - Class.forName("com.mysql.jdbc.Driver").newInstance(); + dbConnectionPool = new ComboPooledDataSource(); + dbConnectionPool.setDriverClass( "com.mysql.jdbc.Driver"); + dbConnectionPool.setJdbcUrl(dbUrl); + dbConnectionPool.setUser(dbUserName); + dbConnectionPool.setPassword(dbPassword); functionRegistrators = new ArrayList(); functionRegistrators.add(new BazaarFunctionRegistrator() { @@ -143,7 +144,7 @@ public BazaarService() throws Exception { public void registerFunction(EnumSet functions) throws BazaarException { DALFacade dalFacade = null; try { - dalFacade = createConnection(); + dalFacade = getDBConnection(); AuthorizationManager.SyncPrivileges(dalFacade); } catch (CommunicationsException commEx) { ExceptionHandler.getInstance().convertAndThrowException(commEx, ExceptionLocation.BAZAARSERVICE, ErrorCode.DB_COMM, Localization.getInstance().getResourceBundle().getString("error.db_comm")); @@ -245,7 +246,7 @@ private void registerUserAtFirstLogin() throws Exception { DALFacade dalFacade = null; try { - dalFacade = createConnection(); + dalFacade = getDBConnection(); Integer userIdByLAS2PeerId = dalFacade.getUserIdByLAS2PeerId(agent.getId()); if (userIdByLAS2PeerId == null) { User.Builder userBuilder = User.geBuilder(agent.getEmail()); @@ -265,8 +266,8 @@ private void registerUserAtFirstLogin() throws Exception { } } - public DALFacade createConnection() throws Exception { - Connection dbConnection = DriverManager.getConnection(dbUrl, dbUserName, dbPassword); + public DALFacade getDBConnection() throws Exception { + Connection dbConnection = dbConnectionPool.getConnection(); return new DALFacadeImpl(dbConnection, SQLDialect.MYSQL); } @@ -276,7 +277,6 @@ public void closeConnection(DALFacade dalFacade) { if (dbConnection != null) { try { dbConnection.close(); - System.out.println("Database connection closed!"); } catch (SQLException ignore) { System.out.println("Could not close db connection!"); } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java index 66286949..dc004fc9 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java @@ -76,7 +76,7 @@ public HttpResponse getComment(@PathParam("commentId") int commentId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Comment comment = dalFacade.getCommentById(commentId); Requirement requirement = dalFacade.getRequirementById(comment.getRequirementId(), internalUserId); @@ -138,7 +138,7 @@ public HttpResponse createComment(@ApiParam(value = "Comment entity as JSON", re } Gson gson = new Gson(); Comment commentToCreate = gson.fromJson(comment, Comment.class); - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Requirement requirement = dalFacade.getRequirementById(commentToCreate.getRequirementId(), internalUserId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_COMMENT, String.valueOf(requirement.getProjectId()), dalFacade); @@ -220,7 +220,7 @@ public HttpResponse deleteComment(@PathParam("commentId") int commentId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Comment commentToDelete = dalFacade.getCommentById(commentId); Requirement requirement = dalFacade.getRequirementById(commentToDelete.getRequirementId(), internalUserId); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java index f54c11b4..15855346 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java @@ -75,7 +75,7 @@ public HttpResponse getComponent(@PathParam("componentId") int componentId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Component componentToReturn = dalFacade.getComponentById(componentId); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); if (dalFacade.isComponentPublic(componentId)) { @@ -140,7 +140,7 @@ public HttpResponse createComponent(@ApiParam(value = "Component entity as JSON" if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_COMPONENT, String.valueOf(componentToCreate.getProjectId()), dalFacade); if (!authorized) { @@ -195,7 +195,7 @@ public HttpResponse updateComponent(@PathParam("componentId") int componentId, if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Modify_COMPONENT, dalFacade); if (!authorized) { @@ -248,7 +248,7 @@ public HttpResponse deleteComponent(@PathParam("componentId") int componentId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Component componentToDelete = dalFacade.getComponentById(componentId); Project project = dalFacade.getProjectById(componentToDelete.getProjectId()); @@ -320,7 +320,7 @@ public HttpResponse getRequirementsByComponent(@PathParam("componentId") int com if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); if (dalFacade.getComponentById(componentId) == null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.NOT_FOUND, String.format(Localization.getInstance().getResourceBundle().getString("error.resource.notfound"), "component")); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java index 2f42b5a5..ce67c6e7 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java @@ -83,7 +83,7 @@ public HttpResponse getProjects( if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); List projects; if (agent.getLoginName().equals("anonymous")) { // return only public projects @@ -128,7 +128,7 @@ public HttpResponse getProject(@PathParam("projectId") int projectId) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } long userId = ((UserAgent) getActiveAgent()).getId(); - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); if (dalFacade.isProjectPublic(projectId)) { boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Read_PUBLIC_PROJECT, String.valueOf(projectId), dalFacade); @@ -189,7 +189,7 @@ public HttpResponse createProject(@ApiParam(value = "Project entity as JSON", re Vtor vtor = bazaarService.getValidators(); vtor.validate(projectToCreate); if (vtor.hasViolations()) ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_PROJECT, dalFacade); if (!authorized) { @@ -248,7 +248,7 @@ public HttpResponse updateProject(@PathParam("projectId") int projectId, if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Modify_PROJECT, dalFacade); if (!authorized) { @@ -285,7 +285,7 @@ public HttpResponse updateProject(@PathParam("projectId") int projectId, // // TODO: check if user can delete this project // String resultJSON = "{\"success\" : \"true\"}"; // try { -// createConnection(); +// getDBConnection(); // dalFacade.delePR(projectToCreate); // } catch (BazaarException bex) { // resultJSON = ExceptionHandler.getInstance().toJSON(bex); @@ -336,7 +336,7 @@ public HttpResponse getComponentsByProject( if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); if (dalFacade.getProjectById(projectId) == null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.NOT_FOUND, String.format(Localization.getInstance().getResourceBundle().getString("error.resource.notfound"), "component")); @@ -405,7 +405,7 @@ public HttpResponse getRequirementsByProject(@PathParam("projectId") int project if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); if (dalFacade.getProjectById(projectId) == null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.NOT_FOUND, String.format(Localization.getInstance().getResourceBundle().getString("error.resource.notfound"), "ressource")); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java index 1d031af7..83386228 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java @@ -4,7 +4,6 @@ import com.google.gson.Gson; import de.rwth.dbis.acis.bazaar.service.dal.DALFacade; import de.rwth.dbis.acis.bazaar.service.dal.entities.*; -import de.rwth.dbis.acis.bazaar.service.dal.helpers.CreationStatus; import de.rwth.dbis.acis.bazaar.service.dal.helpers.PageInfo; import de.rwth.dbis.acis.bazaar.service.dal.helpers.Pageable; import de.rwth.dbis.acis.bazaar.service.exception.BazaarException; @@ -79,7 +78,7 @@ public HttpResponse getRequirement(@PathParam("requirementId") int requirementId if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); RequirementEx requirement = dalFacade.getRequirementById(requirementId, internalUserId); if (dalFacade.isRequirementPublic(requirementId)) { @@ -138,7 +137,7 @@ public HttpResponse createRequirement(@ApiParam(value = "Requirement entity as J } // TODO: check whether the current user may create a new requirement // TODO: check whether all required parameters are entered - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Gson gson = new Gson(); Requirement requirementToCreate = gson.fromJson(requirement, Requirement.class); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); @@ -220,7 +219,7 @@ public HttpResponse updateRequirement(@PathParam("requirementId") int requiremen if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Modify_REQUIREMENT, dalFacade); if (!authorized) { @@ -274,7 +273,7 @@ public HttpResponse deleteRequirement(@PathParam("requirementId") int requiremen if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); RequirementEx requirementToDelete = dalFacade.getRequirementById(requirementId, internalUserId); Project project = dalFacade.getProjectById(requirementToDelete.getProjectId()); @@ -329,7 +328,7 @@ public HttpResponse addUserToDevelopers(@PathParam("requirementId") int requirem } // TODO: check whether the current user may create a new requirement // TODO: check whether all required parameters are entered - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_DEVELOP, dalFacade); if (!authorized) { @@ -384,7 +383,7 @@ public HttpResponse removeUserFromDevelopers(@PathParam("requirementId") int req } // TODO: check whether the current user may create a new requirement // TODO: check whether all required parameters are entered - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Delete_DEVELOP, dalFacade); if (!authorized) { @@ -438,7 +437,7 @@ public HttpResponse addUserToFollowers(@PathParam("requirementId") int requireme } // TODO: check whether the current user may create a new requirement // TODO: check whether all required parameters are entered - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_FOLLOW, dalFacade); if (!authorized) { @@ -492,7 +491,7 @@ public HttpResponse removeUserFromFollowers(@PathParam("requirementId") int requ if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Delete_FOLLOW, dalFacade); if (!authorized) { @@ -551,7 +550,7 @@ public HttpResponse addVote(@PathParam("requirementId") int requirementId, vtor.addViolation(new Violation("Direction can only be \"up\" or \"down\"", direction, direction)); ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Create_VOTE, dalFacade); if (!authorized) { @@ -608,7 +607,7 @@ public HttpResponse removeVote(@PathParam("requirementId") int requirementId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); boolean authorized = new AuthorizationManager().isAuthorized(internalUserId, PrivilegeEnum.Delete_VOTE, dalFacade); if (!authorized) { @@ -668,7 +667,7 @@ public HttpResponse getComments(@PathParam("requirementId") int requirementId, Vtor vtor = bazaarService.getValidators(); vtor.validate(pageInfo); if (vtor.hasViolations()) ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); //Todo use requirement's projectId for serurity context, not the one sent from client Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java index 77cb7313..a8dbf876 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java @@ -70,7 +70,7 @@ public HttpResponse getUser(@PathParam("userId") int userId) { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); User user = dalFacade.getUserById(userId); Gson gson = new Gson(); return new HttpResponse(gson.toJson(user), HttpURLConnection.HTTP_OK); @@ -124,7 +124,7 @@ public HttpResponse updateUser(@PathParam("userId") int userId, if (vtor.hasViolations()) { ExceptionHandler.getInstance().handleViolations(vtor.getViolations()); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(useragentId); if(!internalUserId.equals(userId)) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.AUTHORIZATION, @@ -171,7 +171,7 @@ public HttpResponse getCurrentUser() { if (registratorErrors != null) { ExceptionHandler.getInstance().throwException(ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, registratorErrors); } - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Integer internalUserId = dalFacade.getUserIdByLAS2PeerId(userId); User user = dalFacade.getUserById(internalUserId); Gson gson = new Gson(); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java index 1d69777b..d8656252 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java @@ -40,7 +40,7 @@ public void sendActivityOverRMI(Service service, Date creationTime, Activity.Act Activity.DataType parentDataTyp, int userId) { DALFacade dalFacade = null; try { - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); Gson gson = new Gson(); Activity.Builder activityBuilder = Activity.getBuilder(); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java index 9b0a8ac4..9e2c3efa 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java @@ -35,7 +35,7 @@ public void sendEmailNotification(Date creationTime, Activity.ActivityAction act int dataId, Activity.DataType dataType, int userId) { DALFacade dalFacade = null; try { - dalFacade = bazaarService.createConnection(); + dalFacade = bazaarService.getDBConnection(); List recipients = new ArrayList<>(); if (dataType.equals(Activity.DataType.REQUIREMENT)) { From 80694e50a4efff8e72945f61ab6e94613e5445da Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 May 2016 17:08:31 +0200 Subject: [PATCH 02/23] Remove the creator of a notification from the email recipients --- .../service/notification/EmailDispatcher.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java index 9e2c3efa..858e1e41 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java @@ -9,10 +9,7 @@ import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Properties; +import java.util.*; /** * Created by martin on 15.02.2016. @@ -48,6 +45,14 @@ public void sendEmailNotification(Date creationTime, Activity.ActivityAction act } else if (dataType.equals(Activity.DataType.PROJECT)) { recipients = dalFacade.getRecipientListForProject(dataId); } + // delete the user who created the activity + Iterator recipientsIterator = recipients.iterator(); + while(recipientsIterator.hasNext()) { + User recipient = recipientsIterator.next(); + if (recipient.getId() == userId) { + recipientsIterator.remove(); + } + } if (!recipients.isEmpty()) { // generate mail From 20c1cf9ae912006d62f9b01e6a96dfe67c599553 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 May 2016 17:58:42 +0200 Subject: [PATCH 03/23] Added more activities and realized email notification #RB-302 --- src/i18n/Translation_en.properties | 2 ++ .../dbis/acis/bazaar/service/RequirementsResource.java | 9 +++++++-- .../dbis/acis/bazaar/service/dal/entities/Activity.java | 3 ++- .../bazaar/service/notification/ActivityDispatcher.java | 4 +++- .../bazaar/service/notification/EmailDispatcher.java | 3 +++ .../service/notification/NotificationDispatcherImp.java | 2 +- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/i18n/Translation_en.properties b/src/i18n/Translation_en.properties index 6e51fa06..cdf0a064 100644 --- a/src/i18n/Translation_en.properties +++ b/src/i18n/Translation_en.properties @@ -51,6 +51,7 @@ error.resource.notfound=$s not found. # email fields. english only at the moment. email.subject.requirement.created=New Requirement: email.subject.requirement.updated=Updated Requirement: +email.subject.requirement.realized=Realized Requirement: email.subject.comment.created=New Comment to Requirement: email.subject.comment.updated=Updated Comment to Requirement: email.subject.component.created=New Component: @@ -60,6 +61,7 @@ email.subject.project.updated=Updated Project: email.bodytext.greeting=Hello, email.bodytext.requirement.created=a new requirement that you may be interested in was created: email.bodytext.requirement.updated=a requirement that you may be interested in was updated: +email.bodytext.requirement.realized=a requirement that you may be interested in was realized: email.bodytext.comment.created=a new comment that you may be interested in was posted: email.bodytext.comment.updated=a comment that you may be interested in was updated: email.bodytext.component.created=a new component that you may be interested in was created: diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java index 83386228..a1acafbe 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java @@ -230,8 +230,13 @@ public HttpResponse updateRequirement(@PathParam("requirementId") int requiremen } dalFacade.follow(internalUserId, requirementToUpdate.getId()); RequirementEx updatedRequirement = dalFacade.modifyRequirement(requirementToUpdate, internalUserId); - bazaarService.getNotificationDispatcher().dispatchNotification(this, updatedRequirement.getLastupdated_time(), Activity.ActivityAction.UPDATE, updatedRequirement.getId(), - Activity.DataType.REQUIREMENT, updatedRequirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); + if(requirementToUpdate.getRealized() == null) { + bazaarService.getNotificationDispatcher().dispatchNotification(this, updatedRequirement.getLastupdated_time(), Activity.ActivityAction.UPDATE, updatedRequirement.getId(), + Activity.DataType.REQUIREMENT, updatedRequirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); + } else { + bazaarService.getNotificationDispatcher().dispatchNotification(this, updatedRequirement.getLastupdated_time(), Activity.ActivityAction.REALIZE, updatedRequirement.getId(), + Activity.DataType.REQUIREMENT, updatedRequirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); + } return new HttpResponse(gson.toJson(updatedRequirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) { diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java index 3db3da89..0cac55e9 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java @@ -139,6 +139,7 @@ public enum DataType { public enum ActivityAction { CREATE, UPDATE, - DELETE + DELETE, + REALIZE } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java index d8656252..46429d5d 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java @@ -58,7 +58,9 @@ public void sendActivityOverRMI(Service service, Date creationTime, Activity.Act parentResourcePath = "projects"; Component component = dalFacade.getComponentById(dataId); frontendResourcePath = "projects" + "/" + component.getProjectId() + "/" + "components" + "/" + String.valueOf(dataId); - } else if (dataType.equals(Activity.DataType.REQUIREMENT)) { + } else if (dataType.equals(Activity.DataType.REQUIREMENT) || dataType.equals(Activity.DataType.VOTE) || + dataType.equals(Activity.DataType.DEVELOP) || + (dataType.equals(Activity.DataType.FOLLOW) && parentDataTyp.equals(Activity.DataType.REQUIREMENT))) { resourcePath = "requirements"; parentResourcePath = "components"; RequirementEx requirement = dalFacade.getRequirementById(dataId, userId); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java index 858e1e41..192dd004 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java @@ -99,6 +99,9 @@ public void sendEmailNotification(Date creationTime, Activity.ActivityAction act } else if (activityAction == Activity.ActivityAction.UPDATE) { subject = Localization.getInstance().getResourceBundle().getString("email.subject.requirement.updated"); bodytext = Localization.getInstance().getResourceBundle().getString("email.bodytext.requirement.updated"); + } else if (activityAction == Activity.ActivityAction.REALIZE) { + subject = Localization.getInstance().getResourceBundle().getString("email.subject.requirement.realized"); + bodytext = Localization.getInstance().getResourceBundle().getString("email.bodytext.requirement.realized"); } RequirementEx requirement = dalFacade.getRequirementById(dataId, userId); objectName = requirement.getTitle(); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java index e73c4107..e2f722e8 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java @@ -37,7 +37,7 @@ public void dispatchNotification(final Service service, final Date creationTime, // }); executorService.execute(new Runnable() { public void run() { - if (emailDispatcher != null && (activityAction == Activity.ActivityAction.CREATE || activityAction == Activity.ActivityAction.UPDATE)) { + if (emailDispatcher != null && (activityAction != Activity.ActivityAction.DELETE)) { emailDispatcher.sendEmailNotification(creationTime, activityAction, dataId, dataType, userId); } } From 9e1643df0e2462ecf57b2a23676345d8a81abcb9 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 May 2016 18:03:33 +0200 Subject: [PATCH 04/23] Format ivy file --- etc/ivy/ivy.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/ivy/ivy.xml b/etc/ivy/ivy.xml index 4b692144..0d64994d 100755 --- a/etc/ivy/ivy.xml +++ b/etc/ivy/ivy.xml @@ -13,7 +13,7 @@ - + From a1f11975f308740be2aee844405be626cc8e34c7 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 May 2016 18:06:40 +0200 Subject: [PATCH 05/23] Removed whitespace in code --- src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java index 324551a2..632c3af6 100755 --- a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java @@ -133,7 +133,7 @@ public BazaarService() throws Exception { Localization.getInstance().setResourceBundle(ResourceBundle.getBundle("i18n.Translation", locale)); dbConnectionPool = new ComboPooledDataSource(); - dbConnectionPool.setDriverClass( "com.mysql.jdbc.Driver"); + dbConnectionPool.setDriverClass("com.mysql.jdbc.Driver"); dbConnectionPool.setJdbcUrl(dbUrl); dbConnectionPool.setUser(dbUserName); dbConnectionPool.setPassword(dbPassword); From 8659788acd4be9ef6cd16c3d830edbe07218c7bf Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 31 May 2016 23:16:05 +0200 Subject: [PATCH 06/23] Renamed method and renamed activity actions. --- .../bazaar/service/AttachmentsResource.java | 4 +- .../acis/bazaar/service/BazaarService.java | 6 +-- .../acis/bazaar/service/CommentsResource.java | 6 +-- .../bazaar/service/ComponentsResource.java | 10 ++-- .../acis/bazaar/service/ProjectsResource.java | 14 +++--- .../bazaar/service/RequirementsResource.java | 46 +++++++++---------- .../acis/bazaar/service/UsersResource.java | 6 +-- .../bazaar/service/dal/entities/Activity.java | 13 ++++-- .../notification/ActivityDispatcher.java | 4 +- .../NotificationDispatcherImp.java | 3 +- 10 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java index ebbebc50..f1d1c3db 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/AttachmentsResource.java @@ -110,7 +110,7 @@ public HttpResponse createAttachment(@ApiParam(value = "Attachment type", allowa BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -180,7 +180,7 @@ public HttpResponse deleteAttachment(@PathParam("attachmentId") int attachmentId BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java index 632c3af6..787a6294 100755 --- a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java @@ -151,7 +151,7 @@ public void registerFunction(EnumSet functions) throws BazaarExc } catch (Exception ex) { ExceptionHandler.getInstance().convertAndThrowException(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, Localization.getInstance().getResourceBundle().getString("error.privilige_sync")); } finally { - closeConnection(dalFacade); + closeDBConnection(dalFacade); } } }); @@ -262,7 +262,7 @@ private void registerUserAtFirstLogin() throws Exception { } catch (Exception ex) { ExceptionHandler.getInstance().convertAndThrowException(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, Localization.getInstance().getResourceBundle().getString("error.first_login")); } finally { - closeConnection(dalFacade); + closeDBConnection(dalFacade); } } @@ -271,7 +271,7 @@ public DALFacade getDBConnection() throws Exception { return new DALFacadeImpl(dbConnection, SQLDialect.MYSQL); } - public void closeConnection(DALFacade dalFacade) { + public void closeDBConnection(DALFacade dalFacade) { if (dalFacade == null) return; Connection dbConnection = dalFacade.getConnection(); if (dbConnection != null) { diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java index dc004fc9..938ca00c 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/CommentsResource.java @@ -105,7 +105,7 @@ public HttpResponse getComment(@PathParam("commentId") int commentId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -168,7 +168,7 @@ public HttpResponse createComment(@ApiParam(value = "Comment entity as JSON", re BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -245,7 +245,7 @@ public HttpResponse deleteComment(@PathParam("commentId") int commentId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java index 15855346..4fff9be3 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/ComponentsResource.java @@ -103,7 +103,7 @@ public HttpResponse getComponent(@PathParam("componentId") int componentId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -157,7 +157,7 @@ public HttpResponse createComponent(@ApiParam(value = "Component entity as JSON" BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -220,7 +220,7 @@ public HttpResponse updateComponent(@PathParam("componentId") int componentId, BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -281,7 +281,7 @@ public HttpResponse deleteComponent(@PathParam("componentId") int componentId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -352,7 +352,7 @@ public HttpResponse getRequirementsByComponent(@PathParam("componentId") int com BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java index ce67c6e7..42355527 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/ProjectsResource.java @@ -100,7 +100,7 @@ public HttpResponse getProjects( BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -156,7 +156,7 @@ public HttpResponse getProject(@PathParam("projectId") int projectId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -210,7 +210,7 @@ public HttpResponse createProject(@ApiParam(value = "Project entity as JSON", re BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -273,7 +273,7 @@ public HttpResponse updateProject(@PathParam("projectId") int projectId, BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -294,7 +294,7 @@ public HttpResponse updateProject(@PathParam("projectId") int projectId, // resultJSON = ExceptionHandler.getInstance().toJSON(bazaarException); // // } finally { -// closeConnection(); +// closeDBConnection(); // } // // return resultJSON; @@ -366,7 +366,7 @@ public HttpResponse getComponentsByProject( BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -435,7 +435,7 @@ public HttpResponse getRequirementsByProject(@PathParam("projectId") int project BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java index a1acafbe..6ced2098 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java @@ -106,7 +106,7 @@ public HttpResponse getRequirement(@PathParam("requirementId") int requirementId BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -181,7 +181,7 @@ public HttpResponse createRequirement(@ApiParam(value = "Requirement entity as J BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -250,7 +250,7 @@ public HttpResponse updateRequirement(@PathParam("requirementId") int requiremen BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -303,7 +303,7 @@ public HttpResponse deleteRequirement(@PathParam("requirementId") int requiremen BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -342,8 +342,8 @@ public HttpResponse addUserToDevelopers(@PathParam("requirementId") int requirem dalFacade.wantToDevelop(internalUserId, requirementId); dalFacade.follow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.CREATE, requirement.getId(), - Activity.DataType.DEVELOP, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.DEVELOP, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); Gson gson = new Gson(); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { @@ -358,7 +358,7 @@ public HttpResponse addUserToDevelopers(@PathParam("requirementId") int requirem BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -397,8 +397,8 @@ public HttpResponse removeUserFromDevelopers(@PathParam("requirementId") int req dalFacade.notWantToDevelop(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.DELETE, requirement.getId(), - Activity.DataType.DEVELOP, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNDEVELOP, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) { @@ -412,7 +412,7 @@ public HttpResponse removeUserFromDevelopers(@PathParam("requirementId") int req BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -451,8 +451,8 @@ public HttpResponse addUserToFollowers(@PathParam("requirementId") int requireme dalFacade.follow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.CREATE, requirement.getId(), - Activity.DataType.FOLLOW, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.FOLLOW, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) { @@ -466,7 +466,7 @@ public HttpResponse addUserToFollowers(@PathParam("requirementId") int requireme BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -505,8 +505,8 @@ public HttpResponse removeUserFromFollowers(@PathParam("requirementId") int requ dalFacade.unFollow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.DELETE, requirement.getId(), - Activity.DataType.FOLLOW, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNFOLLOW, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) { @@ -520,7 +520,7 @@ public HttpResponse removeUserFromFollowers(@PathParam("requirementId") int requ BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -566,8 +566,8 @@ public HttpResponse addVote(@PathParam("requirementId") int requirementId, dalFacade.follow(internalUserId, requirementId); } Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.CREATE, requirement.getId(), - Activity.DataType.VOTE, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.VOTE, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); Gson gson = new Gson(); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { @@ -582,7 +582,7 @@ public HttpResponse addVote(@PathParam("requirementId") int requirementId, BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -621,8 +621,8 @@ public HttpResponse removeVote(@PathParam("requirementId") int requirementId) { dalFacade.unVote(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.DELETE, requirement.getId(), - Activity.DataType.VOTE, requirementId, Activity.DataType.REQUIREMENT, internalUserId); + bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNVOTE, requirement.getId(), + Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { if (bex.getErrorCode() == ErrorCode.AUTHORIZATION) { @@ -636,7 +636,7 @@ public HttpResponse removeVote(@PathParam("requirementId") int requirementId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -703,7 +703,7 @@ public HttpResponse getComments(@PathParam("requirementId") int requirementId, BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java index a8dbf876..830ac5fb 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/UsersResource.java @@ -86,7 +86,7 @@ public HttpResponse getUser(@PathParam("userId") int userId) { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -144,7 +144,7 @@ public HttpResponse updateUser(@PathParam("userId") int userId, BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } @@ -188,7 +188,7 @@ public HttpResponse getCurrentUser() { BazaarException bazaarException = ExceptionHandler.getInstance().convert(ex, ExceptionLocation.BAZAARSERVICE, ErrorCode.UNKNOWN, ""); return new HttpResponse(ExceptionHandler.getInstance().toJSON(bazaarException), HttpURLConnection.HTTP_INTERNAL_ERROR); } finally { - bazaarService.closeConnection(dalFacade); + bazaarService.closeDBConnection(dalFacade); } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java b/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java index 0cac55e9..673280e5 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/dal/entities/Activity.java @@ -130,16 +130,19 @@ public enum DataType { COMPONENT, REQUIREMENT, COMMENT, - ATTACHMENT, - VOTE, - FOLLOW, - DEVELOP + ATTACHMENT } public enum ActivityAction { CREATE, UPDATE, DELETE, - REALIZE + REALIZE, + VOTE, + UNVOTE, + DEVELOP, + UNDEVELOP, + FOLLOW, + UNFOLLOW } } diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java index 46429d5d..d8656252 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/ActivityDispatcher.java @@ -58,9 +58,7 @@ public void sendActivityOverRMI(Service service, Date creationTime, Activity.Act parentResourcePath = "projects"; Component component = dalFacade.getComponentById(dataId); frontendResourcePath = "projects" + "/" + component.getProjectId() + "/" + "components" + "/" + String.valueOf(dataId); - } else if (dataType.equals(Activity.DataType.REQUIREMENT) || dataType.equals(Activity.DataType.VOTE) || - dataType.equals(Activity.DataType.DEVELOP) || - (dataType.equals(Activity.DataType.FOLLOW) && parentDataTyp.equals(Activity.DataType.REQUIREMENT))) { + } else if (dataType.equals(Activity.DataType.REQUIREMENT)) { resourcePath = "requirements"; parentResourcePath = "components"; RequirementEx requirement = dalFacade.getRequirementById(dataId, userId); diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java index e2f722e8..c6c495cb 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/NotificationDispatcherImp.java @@ -37,7 +37,8 @@ public void dispatchNotification(final Service service, final Date creationTime, // }); executorService.execute(new Runnable() { public void run() { - if (emailDispatcher != null && (activityAction != Activity.ActivityAction.DELETE)) { + if (emailDispatcher != null && (activityAction == Activity.ActivityAction.CREATE || activityAction == Activity.ActivityAction.UPDATE || + activityAction == Activity.ActivityAction.REALIZE)) { emailDispatcher.sendEmailNotification(creationTime, activityAction, dataId, dataType, userId); } } From 28a3770af9fec619ad4731b902926cc8e54218ca Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 1 Jun 2016 17:24:37 +0200 Subject: [PATCH 07/23] Improve email text once again --- src/i18n/Translation_en.properties | 20 +++++++++---------- .../service/notification/EmailDispatcher.java | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/i18n/Translation_en.properties b/src/i18n/Translation_en.properties index cdf0a064..8033af34 100644 --- a/src/i18n/Translation_en.properties +++ b/src/i18n/Translation_en.properties @@ -59,14 +59,14 @@ email.subject.component.updated=Updated Component: email.subject.project.created=New Project: email.subject.project.updated=Updated Project: email.bodytext.greeting=Hello, -email.bodytext.requirement.created=a new requirement that you may be interested in was created: -email.bodytext.requirement.updated=a requirement that you may be interested in was updated: -email.bodytext.requirement.realized=a requirement that you may be interested in was realized: -email.bodytext.comment.created=a new comment that you may be interested in was posted: -email.bodytext.comment.updated=a comment that you may be interested in was updated: -email.bodytext.component.created=a new component that you may be interested in was created: -email.bodytext.component.updated=a component that you may be interested in was updated: -email.bodytext.project.created=a new project that you may be interested in was created: -email.bodytext.project.updated=a project that you may be interested in was updated: -email.bodytext.footer1=This email was sent automatically by Requirements Bazaar. +email.bodytext.requirement.created=a new requirement that might may be interested in was created: +email.bodytext.requirement.updated=a requirement that you might be interested in was updated: +email.bodytext.requirement.realized=a requirement that you might be interested in was realized: +email.bodytext.comment.created=a new comment that you might be interested in was posted: +email.bodytext.comment.updated=a comment that you might be interested in was updated: +email.bodytext.component.created=a new component that you might be interested in was created: +email.bodytext.component.updated=a component that you might be interested in was updated: +email.bodytext.project.created=a new project that you might be interested in was created: +email.bodytext.project.updated=a project that you might be interested in was updated: +email.bodytext.footer1=This email was automatically sent by Requirements Bazaar. email.bodytext.footer2=To change your email notification settings, please go to your profile settings on Requirements Bazaar. \ No newline at end of file diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java index 192dd004..0842d827 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/notification/EmailDispatcher.java @@ -131,7 +131,7 @@ public void sendEmailNotification(Date creationTime, Activity.ActivityAction act String text = greeting; text = text.concat("\r\n\r\n"); text = text.concat(bodytext); - text = text.concat(" " + dataUrl); + text = text.concat("\r\n" + dataUrl); text = text.concat("\r\n\r\n"); text = text.concat(footer1); text = text.concat("\r\n"); From e63a5b9db5163e181805f5bdcd0ade90eff880e1 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 1 Jun 2016 23:50:52 +0200 Subject: [PATCH 08/23] Fixed notification creation date for vote, develop and follow --- .../acis/bazaar/service/RequirementsResource.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java index 6ced2098..2ebb0c46 100644 --- a/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/RequirementsResource.java @@ -25,6 +25,7 @@ import javax.ws.rs.*; import java.net.HttpURLConnection; import java.util.Arrays; +import java.util.Date; import java.util.EnumSet; import java.util.List; @@ -342,7 +343,7 @@ public HttpResponse addUserToDevelopers(@PathParam("requirementId") int requirem dalFacade.wantToDevelop(internalUserId, requirementId); dalFacade.follow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.DEVELOP, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.DEVELOP, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); Gson gson = new Gson(); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); @@ -397,7 +398,7 @@ public HttpResponse removeUserFromDevelopers(@PathParam("requirementId") int req dalFacade.notWantToDevelop(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNDEVELOP, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.UNDEVELOP, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { @@ -451,7 +452,7 @@ public HttpResponse addUserToFollowers(@PathParam("requirementId") int requireme dalFacade.follow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.FOLLOW, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.FOLLOW, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { @@ -505,7 +506,7 @@ public HttpResponse removeUserFromFollowers(@PathParam("requirementId") int requ dalFacade.unFollow(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNFOLLOW, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.UNFOLLOW, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { @@ -566,7 +567,7 @@ public HttpResponse addVote(@PathParam("requirementId") int requirementId, dalFacade.follow(internalUserId, requirementId); } Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.VOTE, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.VOTE, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); Gson gson = new Gson(); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); @@ -621,7 +622,7 @@ public HttpResponse removeVote(@PathParam("requirementId") int requirementId) { dalFacade.unVote(internalUserId, requirementId); Requirement requirement = dalFacade.getRequirementById(requirementId, internalUserId); Gson gson = new Gson(); - bazaarService.getNotificationDispatcher().dispatchNotification(this, requirement.getLastupdated_time(), Activity.ActivityAction.UNVOTE, requirement.getId(), + bazaarService.getNotificationDispatcher().dispatchNotification(this, new Date(), Activity.ActivityAction.UNVOTE, requirement.getId(), Activity.DataType.REQUIREMENT, requirement.getComponents().get(0).getId(), Activity.DataType.COMPONENT, internalUserId); return new HttpResponse(gson.toJson(requirement), HttpURLConnection.HTTP_OK); } catch (BazaarException bex) { From 2e6c4cc1559f01313f83d7193fd20f4925eeb2e4 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 2 Jun 2016 11:10:01 +0200 Subject: [PATCH 09/23] Change jooq configuration to dev settings --- bin/JOOQGeneration/reqbaz_generation_info.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/JOOQGeneration/reqbaz_generation_info.xml b/bin/JOOQGeneration/reqbaz_generation_info.xml index fca6d2ee..894f9875 100644 --- a/bin/JOOQGeneration/reqbaz_generation_info.xml +++ b/bin/JOOQGeneration/reqbaz_generation_info.xml @@ -3,9 +3,9 @@ com.mysql.jdbc.Driver - jdbc:mysql://beckmann.informatik.rwth-aachen.de:3306/reqbazdev - bazaardevel - 2gdtrf54ZT&T + jdbc:mysql://localhost:3306/reqbaz + root + reqbaz @@ -20,7 +20,7 @@ - reqbazdev + reqbaz - + - + + dest="${ivy.jar.file}" usetimestamp="true" skipexisting="true"/> - + @@ -62,24 +61,22 @@ - - - - - - - - - + - + + + + + + + + + - - - + @@ -87,103 +84,170 @@ - - + + - + - + - - + + + destdir="${tmp.classes}" + classpathref="libraries" + debug="on" + encoding="UTF-8" + includeantruntime="false" + /> - + + destdir="${tmp.junit}" + classpath="${tmp.classes}:${lib.junit}" + classpathref="libraries" + debug="on" + encoding="UTF-8" + includeantruntime="false" + /> - + - - - - - - - + + + + + #!/bin/bash + + # this script is autogenerated by 'ant startscripts' + # it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project + # pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh + + java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'${service.name}.${service.class}@${service.version}\',\'${service.passphrase}\'\) startWebConnector interactive + + :: this script is autogenerated by 'ant startscripts' + :: it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project + :: pls execute it from the bin folder of your deployment by double-clicking on it + + %~d0 + cd %~p0 + cd .. + set BASE=%CD% + set CLASSPATH="%BASE%/lib/*;" + + java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('${service.name}.${service.class}@${service.version}','${service.passphrase}') startWebConnector interactive + + pause + + + + + + + - - + + + - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + author="true" + version="true" + use="true" + source="1.7" + windowtitle="Service Documentation" + failonerror="yes" + encoding="utf8" + classpath="${tmp.classes}" + classpathref="libraries" + > - + - - + + - - + + @@ -208,77 +272,52 @@ - - + + - - - - - - - - - - - - - + + + + + - - -agent-service-${service.name}.xml;${service.password} -agent-user-${las2peer_user.name}.xml;${las2peer_user.password} - + + + agent-user-${las2peer_user.name}.xml;${las2peer_user.password} + - - + - - - - - - - - + + + + + - - - - - - - + + + + + - - - - - - - - - + + + + + + + + @@ -286,9 +325,8 @@ agent-user-${las2peer_user.name}.xml;${las2peer_user.password} - - + + + - - - + \ No newline at end of file diff --git a/etc/ant_configuration/service.properties b/etc/ant_configuration/service.properties index e5514a37..78df629a 100755 --- a/etc/ant_configuration/service.properties +++ b/etc/ant_configuration/service.properties @@ -1,5 +1,41 @@ -service.version=0.2 -service.name=de.rwth.dbis.acis.bazaar.service -service.path=de/rwth/dbis/acis/bazaar/service -service.class=BazaarService -service.password=SampleServicePass +service.0.version=0.2 +service.0.name=de.rwth.dbis.acis.bazaar.service +service.0.path=de/rwth/dbis/acis/bazaar/service +service.0.class=BazaarService +service.0.dependencies= + +service.1.version=0.2 +service.1.name=de.rwth.dbis.acis.bazaar.service +service.1.path=de/rwth/dbis/acis/bazaar/service +service.1.class=ProjectsResource +service.1.dependencies= + +service.2.version=0.2 +service.2.name=de.rwth.dbis.acis.bazaar.service +service.2.path=de/rwth/dbis/acis/bazaar/service +service.2.class=ComponentsResource +service.2.dependencies= + +service.3.version=0.2 +service.3.name=de.rwth.dbis.acis.bazaar.service +service.3.path=de/rwth/dbis/acis/bazaar/service +service.3.class=RequirementsResource +service.3.dependencies= + +service.4.version=0.2 +service.4.name=de.rwth.dbis.acis.bazaar.service +service.4.path=de/rwth/dbis/acis/bazaar/service +service.4.class=CommentsResource +service.4.dependencies= + +service.5.version=0.2 +service.5.name=de.rwth.dbis.acis.bazaar.service +service.5.path=de/rwth/dbis/acis/bazaar/service +service.5.class=AttachmentsResource +service.5.dependencies= + +service.6.version=0.2 +service.6.name=de.rwth.dbis.acis.bazaar.service +service.6.path=de/rwth/dbis/acis/bazaar/service +service.6.class=UsersResource +service.6.dependencies= diff --git a/etc/ivy/ivy.xml b/etc/ivy/ivy.xml index 92717d4f..69587541 100755 --- a/etc/ivy/ivy.xml +++ b/etc/ivy/ivy.xml @@ -1,21 +1,27 @@ + + + + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/etc/las2peer.policy b/etc/las2peer.policy new file mode 100644 index 00000000..5daae47c --- /dev/null +++ b/etc/las2peer.policy @@ -0,0 +1,59 @@ +// This is the policy file used for las2peer sandboxing. +// If you want a service to have access to the file system or +// open network ports add the respective rights below. + +// THE SANDBOX IS DISABLED BY DEFAULT! +// If you want to deploy las2peer it's strongly recommended to comment out or delete the following lines. +// This enables sandboxing and protects your system from malicious file access and networking operations. +// If you experience issues please check the logs for blocked permissions and whitelist them in this file. +grant { + permission java.security.AllPermission; +}; + +// example: This entry gives read and write access to a local directory called 'localdir' +// in your LAS2peer installation directory. +//grant { +// permission java.io.FilePermission "localdir", "read, write"; // the directory itself +// permission java.io.FilePermission "localdir${/}-", "read, write"; // all files and subdirectories inside +//}; + +// las2peer related files +grant { + // las2peer file read permissions + permission java.io.FilePermission "etc", "read"; + permission java.io.FilePermission "etc${/}-", "read"; + permission java.io.FilePermission "config", "read"; + permission java.io.FilePermission "config${/}-", "read"; + permission java.io.FilePermission "properties", "read"; + permission java.io.FilePermission "properties${/}-", "read"; + permission java.io.FilePermission "lib", "read"; + permission java.io.FilePermission "lib${/}-", "read"; + permission java.io.FilePermission "service", "read"; + permission java.io.FilePermission "service${/}-", "read"; + + // las2peer file write permissions + permission java.io.FilePermission "log", "read, write, delete"; + permission java.io.FilePermission "log${/}-", "read, write, delete"; + permission java.io.FilePermission "node-storage", "read, write, delete"; + permission java.io.FilePermission "node-storage${/}-", "read, write, delete"; + + // las2peer network permissions + // allow local ports from 8000 to 9999 to be used as server ports + permission java.net.SocketPermission "localhost:8000-9999", "listen"; + // the following portrange is reserved for JUnit tests + permission java.net.SocketPermission "localhost:14500-14599", "listen"; + // allow connections to any remote host + permission java.net.SocketPermission "*", "connect,accept"; +}; + +// Linux system file permissions +grant { + permission java.io.FilePermission "/dev/random", "read"; + permission java.io.FilePermission "/dev/urandom", "read"; +}; + +// pastry permissions +grant { + permission java.io.FilePermission "${java.io.tmpdir}", "read"; + permission java.io.FilePermission "user.params", "read"; +}; diff --git a/src/test/de/rwth/dbis/acis/bazaar/service/TestBase.java b/src/test/de/rwth/dbis/acis/bazaar/service/TestBase.java index 777a58d7..d88f4164 100644 --- a/src/test/de/rwth/dbis/acis/bazaar/service/TestBase.java +++ b/src/test/de/rwth/dbis/acis/bazaar/service/TestBase.java @@ -20,538 +20,8 @@ package de.rwth.dbis.acis.bazaar.service; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.gson.Gson; -import de.rwth.dbis.acis.bazaar.service.exception.BazaarException; -import de.rwth.dbis.acis.bazaar.service.exception.ErrorCode; -import i5.las2peer.p2p.LocalNode; -import i5.las2peer.persistency.MalformedXMLException; -import i5.las2peer.restMapper.data.Pair; -import i5.las2peer.security.ServiceAgent; -import i5.las2peer.security.UserAgent; -import i5.las2peer.testing.MockAgentFactory; -import i5.las2peer.webConnector.WebConnector; -import i5.las2peer.webConnector.client.ClientResponse; -import i5.las2peer.webConnector.client.MiniClient; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; - -import org.apache.commons.lang3.text.StrSubstitutor; -import org.junit.*; - - +// TODO: update tests, see older revison public abstract class TestBase { - private static final String HTTP_ADDRESS = "http://127.0.0.1"; - private static final int HTTP_PORT = WebConnector.DEFAULT_HTTP_PORT; - - private static LocalNode node; - private static WebConnector connector; - private static ByteArrayOutputStream logStream; - - protected static UserAgent testAgent; - protected static String testPass; - - private static final String testServiceClass = "de.rwth.dbis.acis.bazaar.service.BazaarService"; - - private static final String mainPath = "bazaar/"; - - /** - * Called before the tests start. - * - * Sets up the node and initializes connector and users that can be used - * throughout the tests. - * - * @throws Exception - */ - public static void startServer() throws Exception { - - // start node - node = LocalNode.newNode(); - node.storeAgent(testAgent); - node.launch(); - - ServiceAgent testService = ServiceAgent.generateNewAgent( - testServiceClass, "a pass"); - testService.unlockPrivateKey("a pass"); - - node.registerReceiver(testService); - - // start connector - logStream = new ByteArrayOutputStream(); - - connector = new WebConnector(true, HTTP_PORT, false, 1000); - connector.setSocketTimeout(10000); - connector.setLogStream(new PrintStream(logStream)); - connector.start(node); - Thread.sleep(1000); // wait a second for the connector to become ready - connector.updateServiceList(); - // avoid timing errors: wait for the repository manager to get all - // services before continuing - try { - System.out.println("waiting.."); - Thread.sleep(10000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - - protected static UserAgent getAgent() throws MalformedXMLException, IOException - { - testPass = "adamspass"; - return MockAgentFactory.getAdam(); - } - - /** - * Called after the tests have finished. Shuts down the server and prints - * out the connector log file for reference. - * - * @throws Exception - */ - @AfterClass - public static void shutDownServer() throws Exception { - - connector.stop(); - node.shutDown(); - - connector = null; - node = null; - - LocalNode.reset(); - - System.out.println("Connector-Log:"); - System.out.println("--------------"); - - System.out.println(logStream.toString()); - - } - - protected void login(MiniClient c) throws UnsupportedEncodingException { - c.setLogin(Long.toString(testAgent.getId()), testPass); - } - - private MiniClient getClient() { - MiniClient c = new MiniClient(); - c.setAddressPort(HTTP_ADDRESS, HTTP_PORT); - return c; - } - - - protected void assertAccessDenied(ClientResponse response) { - assertThat(response,is(notNullValue())); - BazaarException bazaarException = new Gson().fromJson(response.getResponse(), BazaarException.class); - assertThat(bazaarException.getErrorCode(),is(ErrorCode.AUTHORIZATION)); - } - - public ClientResponse test_addUserToDevelopers(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/developers"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_addUserToFollowers(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/followers"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_addVote(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/vote"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_createAttachment(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/attachments"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_createComment(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/comments"), params.getContentParam(), "application/json", "*/*", new Pair[]{}); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_createComponent(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components"), params.getContentParam(), "application/json", "*/*", new Pair[]{}); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_createProject(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects"), params.getContentParam(), "application/json", "*/*", new Pair[]{}); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_createRequirement(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("POST", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements"), params.getContentParam(), "application/json", "*/*", new Pair[]{}); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_deleteAttachment(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/attachments/{attachmentId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_deleteComment(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/comments/{commentId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_deleteComponent(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_deleteRequirement(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getComments(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/comments"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getComponent(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getComponents(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/components"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getProject(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_modifyProject(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("PUT", mainPath + substitutor.replace("projects/{projectId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; - }; - - public ClientResponse test_getProjects(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getRequirement(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getRequirementsByComponent(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_getRequirementsByProject(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("projects/{projectId}/requirements"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - - public ClientResponse test_getUser(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("GET", mainPath + substitutor.replace("users/{userId}"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_removeUserFromDevelopers(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/developers"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_removeUserFromFollowers(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/followers"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - - public ClientResponse test_removeVote(BazaarRequestParams params) { - MiniClient c = getClient(); - - try { - login(c); - StrSubstitutor substitutor = new StrSubstitutor(params.getQueryParams(), "{", "}"); - ClientResponse result = c.sendRequest("DELETE", mainPath + substitutor.replace("projects/{projectId}/components/{componentId}/requirements/{requirementId}/vote"), params.getContentParam()); - return result; - } catch (Exception e) { - e.printStackTrace(); - fail("Exception: " + e); - } - return null; -}; - } From 0d0f808b866a543d3aaf0a8a391ef98d51b0f335 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 23 Jun 2016 15:13:02 +0200 Subject: [PATCH 16/23] Set startscripts --- bin/start_network.bat | 21 +++++++++------------ bin/start_network.sh | 8 +++----- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bin/start_network.bat b/bin/start_network.bat index 667c378a..d3caabd5 100755 --- a/bin/start_network.bat +++ b/bin/start_network.bat @@ -1,14 +1,11 @@ -:: this script is autogenerated by 'ant startscripts' - :: it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project - :: pls execute it from the bin folder of your deployment by double-clicking on it +:: this script starts a las2peer node providing the example service of this project +:: pls execute it from the bin folder of your deployment by double-clicking on it - %~d0 - cd %~p0 - cd .. - set BASE=%CD% - set CLASSPATH="%BASE%/lib/*;" +%~d0 +cd %~p0 +cd .. +set BASE=%CD% +set CLASSPATH="%BASE%/lib/*;" - java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('${service.name}.${service.class}@${service.version}','${service.passphrase}') startWebConnector interactive - - pause - \ No newline at end of file +java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('de.rwth.dbis.acis.bazaar.service.BazaarService@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.UsersResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2','SampleServicePass') startWebConnector interactive +pause diff --git a/bin/start_network.sh b/bin/start_network.sh index 49588cf8..ff9f802c 100755 --- a/bin/start_network.sh +++ b/bin/start_network.sh @@ -1,8 +1,6 @@ #!/bin/bash - # this script is autogenerated by 'ant startscripts' - # it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project - # pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh +# this script starts a las2peer node providing the example service of this project +# pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh - java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'${service.name}.${service.class}@${service.version}\',\'${service.passphrase}\'\) startWebConnector interactive - \ No newline at end of file +java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'de.rwth.dbis.acis.bazaar.service.BazaarService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.UsersResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ProjectsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ComponentsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.RequirementsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.AttachmentsService@0.2\',\'SampleServicePass\'\) startWebConnector interactive From 0c484a5ec50a5b8c02d17ffa9acc667c93a957e9 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 23 Jun 2016 15:13:24 +0200 Subject: [PATCH 17/23] Changed ant all --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index 4ec38832..b6f66e5a 100755 --- a/build.xml +++ b/build.xml @@ -303,7 +303,7 @@ - + From 475210267e4ad44a4800551f087c34a5ff349627 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 23 Jun 2016 17:51:09 +0200 Subject: [PATCH 18/23] Include i18n into jar file again --- build.xml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/build.xml b/build.xml index b6f66e5a..66562cec 100755 --- a/build.xml +++ b/build.xml @@ -164,6 +164,7 @@ + @@ -172,6 +173,7 @@ + @@ -180,6 +182,7 @@ + @@ -188,6 +191,7 @@ + @@ -196,6 +200,7 @@ + @@ -204,6 +209,7 @@ + @@ -212,6 +218,7 @@ + @@ -317,13 +324,13 @@ - - - - - - - + + + + + + + From 8d33886c00171573c47228f6e50115b0d13e0521 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 23 Jun 2016 17:51:53 +0200 Subject: [PATCH 19/23] Remove old swagger endpoint --- .../acis/bazaar/service/BazaarService.java | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java index 93a7f9f3..88e4f237 100755 --- a/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java +++ b/src/main/de/rwth/dbis/acis/bazaar/service/BazaarService.java @@ -282,36 +282,4 @@ public void closeDBConnection(DALFacade dalFacade) { if (dalFacade == null) return; dalFacade.close(); } - - /** - * Returns the API documentation of all annotated resources - * for purposes of Swagger documentation. - * - * @return The resource's documentation. - */ - @GET - @Path("/swagger.json") - @Produces(MediaType.APPLICATION_JSON) - public HttpResponse getSwaggerJSON() { - Set> classes = new HashSet>(); - classes.add(this.getClass()); - classes.add(UsersResource.class); - classes.add(ProjectsResource.class); - classes.add(ComponentsResource.class); - classes.add(RequirementsResource.class); - classes.add(CommentsResource.class); - classes.add(AttachmentsResource.class); - Swagger swagger = new Reader(new Swagger()).read(classes); - if (swagger == null) { - return new HttpResponse("Swagger API declaration not available!", HttpURLConnection.HTTP_NOT_FOUND); - } - swagger.getDefinitions().clear(); - try { - return new HttpResponse(Json.mapper().writeValueAsString(swagger), HttpURLConnection.HTTP_OK); - } catch (JsonProcessingException e) { - e.printStackTrace(); - return new HttpResponse(e.getMessage(), HttpURLConnection.HTTP_INTERNAL_ERROR); - } - } - } From b9e09229ea20d3005ddedc73455e2a3f4b83c531 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 23 Jun 2016 18:13:17 +0200 Subject: [PATCH 20/23] Corrected linux start script --- bin/start_network.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/start_network.sh b/bin/start_network.sh index ff9f802c..dfec5673 100755 --- a/bin/start_network.sh +++ b/bin/start_network.sh @@ -3,4 +3,4 @@ # this script starts a las2peer node providing the example service of this project # pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh -java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'de.rwth.dbis.acis.bazaar.service.BazaarService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.UsersResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ProjectsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ComponentsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.RequirementsService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.AttachmentsService@0.2\',\'SampleServicePass\'\) startWebConnector interactive +java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'de.rwth.dbis.acis.bazaar.service.BazaarService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.UsersResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2\',\'SampleServicePass\'\) startWebConnector interactive From ea41e7f71e077bfd715c53d65e06ec36d04a9980 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 24 Jun 2016 12:52:36 +0200 Subject: [PATCH 21/23] Change ant targets --- build.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.xml b/build.xml index 66562cec..5c41cfaf 100755 --- a/build.xml +++ b/build.xml @@ -85,7 +85,7 @@ - + @@ -161,7 +161,7 @@ - + @@ -313,7 +313,7 @@ - + Date: Fri, 24 Jun 2016 13:06:15 +0200 Subject: [PATCH 22/23] Add new useragentgenerator and serviceagentgenerator --- bin/start_ServiceAgentGenerator.bat | 14 ++++++++++++++ bin/start_ServiceAgentGenerator.sh | 6 ++++++ bin/start_UserAgentGenerator.bat | 14 ++++++++++++++ bin/start_UserAgentGenerator.sh | 6 ++++++ 4 files changed, 40 insertions(+) create mode 100644 bin/start_ServiceAgentGenerator.bat create mode 100644 bin/start_ServiceAgentGenerator.sh create mode 100644 bin/start_UserAgentGenerator.bat create mode 100644 bin/start_UserAgentGenerator.sh diff --git a/bin/start_ServiceAgentGenerator.bat b/bin/start_ServiceAgentGenerator.bat new file mode 100644 index 00000000..914f27c0 --- /dev/null +++ b/bin/start_ServiceAgentGenerator.bat @@ -0,0 +1,14 @@ +@echo off + +cd %~dp0 +cd .. +set BASE=%CD% +set CLASSPATH="%BASE%/lib/*;" + +if "%~2"=="" ( + echo Syntax error! + echo. + echo Usage: start_ServiceAgentGenerator service.canonical.class.name service.password +) else ( + java -cp %CLASSPATH% i5.las2peer.tools.ServiceAgentGenerator %1 %2 +) diff --git a/bin/start_ServiceAgentGenerator.sh b/bin/start_ServiceAgentGenerator.sh new file mode 100644 index 00000000..4dd84813 --- /dev/null +++ b/bin/start_ServiceAgentGenerator.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# this scripts generates a xml file for the specified ServiceClass with the desired ServicePass +# pls run the script form the root folder of your deployment, e. g. ./bin/start_ServiceAgentGenerator.sh + +java -cp "lib/*" i5.las2peer.tools.ServiceAgentGenerator "$@" diff --git a/bin/start_UserAgentGenerator.bat b/bin/start_UserAgentGenerator.bat new file mode 100644 index 00000000..4cf7360e --- /dev/null +++ b/bin/start_UserAgentGenerator.bat @@ -0,0 +1,14 @@ +@echo off + +cd %~dp0 +cd .. +set BASE=%CD% +set CLASSPATH="%BASE%/lib/*" + +if "%~2"=="" ( + echo Syntax error! + echo. + echo Usage: start_UserAgentGenerator user.name user.password user.mail +) else ( + java -cp %CLASSPATH% i5.las2peer.tools.UserAgentGenerator %2 %1 %3 +) \ No newline at end of file diff --git a/bin/start_UserAgentGenerator.sh b/bin/start_UserAgentGenerator.sh new file mode 100644 index 00000000..2356a671 --- /dev/null +++ b/bin/start_UserAgentGenerator.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# this scripts generates an user agent as xml file in order to upload it via the startup folder +# pls run the script form the root folder of your deployment, e. g. ./bin/start_UserAgentGenerator.sh + +java -cp "lib/*" i5.las2peer.tools.UserAgentGenerator "$@" From 79ce7bc2f2c67d16483893d4feffef5ec4680b68 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 24 Jun 2016 13:22:00 +0200 Subject: [PATCH 23/23] Corrected startscripts generation --- bin/start_network.bat | 21 ++++++++++++--------- bin/start_network.sh | 8 +++++--- build.xml | 6 +++--- etc/ant_configuration/service.properties | 7 +++++++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/bin/start_network.bat b/bin/start_network.bat index d3caabd5..9a9ca6c9 100755 --- a/bin/start_network.bat +++ b/bin/start_network.bat @@ -1,11 +1,14 @@ -:: this script starts a las2peer node providing the example service of this project -:: pls execute it from the bin folder of your deployment by double-clicking on it +:: this script is autogenerated by 'ant startscripts' + :: it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project + :: pls execute it from the bin folder of your deployment by double-clicking on it -%~d0 -cd %~p0 -cd .. -set BASE=%CD% -set CLASSPATH="%BASE%/lib/*;" + %~d0 + cd %~p0 + cd .. + set BASE=%CD% + set CLASSPATH="%BASE%/lib/*;" -java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('de.rwth.dbis.acis.bazaar.service.BazaarService@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.UsersResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2','SampleServicePass') startService('de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2','SampleServicePass') startWebConnector interactive -pause + java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('de.rwth.dbis.acis.bazaar.service.BazaarService@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2','Passphrase') startService('de.rwth.dbis.acis.bazaar.service.UsersResource@0.2','Passphrase') startWebConnector interactive + + pause + \ No newline at end of file diff --git a/bin/start_network.sh b/bin/start_network.sh index dfec5673..1a930896 100755 --- a/bin/start_network.sh +++ b/bin/start_network.sh @@ -1,6 +1,8 @@ #!/bin/bash -# this script starts a las2peer node providing the example service of this project -# pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh + # this script is autogenerated by 'ant startscripts' + # it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project + # pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh -java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'de.rwth.dbis.acis.bazaar.service.BazaarService@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.UsersResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2\',\'SampleServicePass\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2\',\'SampleServicePass\'\) startWebConnector interactive + java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'de.rwth.dbis.acis.bazaar.service.BazaarService@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ProjectsResource@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.ComponentsResource@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.RequirementsResource@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.CommentsResource@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.AttachmentsResource@0.2\',\'Passphrase\'\) startService\(\'de.rwth.dbis.acis.bazaar.service.UsersResource@0.2\',\'Passphrase\'\) startWebConnector interactive + \ No newline at end of file diff --git a/build.xml b/build.xml index 5c41cfaf..bcd74601 100755 --- a/build.xml +++ b/build.xml @@ -142,7 +142,7 @@ # it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project # pls execute it from the root folder of your deployment, e. g. ./bin/start_network.sh - java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'${service.name}.${service.class}@${service.version}\',\'${service.passphrase}\'\) startWebConnector interactive + java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService\(\'${service.0.name}.${service.0.class}@${service.0.version}\',\'${service.0.passphrase}\'\) startService\(\'${service.1.name}.${service.1.class}@${service.1.version}\',\'${service.1.passphrase}\'\) startService\(\'${service.2.name}.${service.2.class}@${service.2.version}\',\'${service.2.passphrase}\'\) startService\(\'${service.3.name}.${service.3.class}@${service.3.version}\',\'${service.3.passphrase}\'\) startService\(\'${service.4.name}.${service.4.class}@${service.4.version}\',\'${service.4.passphrase}\'\) startService\(\'${service.5.name}.${service.5.class}@${service.5.version}\',\'${service.5.passphrase}\'\) startService\(\'${service.6.name}.${service.6.class}@${service.6.version}\',\'${service.6.passphrase}\'\) startWebConnector interactive :: this script is autogenerated by 'ant startscripts' :: it starts a LAS2peer node providing the service '${service.name}.${service.class}' of this project @@ -154,7 +154,7 @@ set BASE=%CD% set CLASSPATH="%BASE%/lib/*;" - java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('${service.name}.${service.class}@${service.version}','${service.passphrase}') startWebConnector interactive + java -cp %CLASSPATH% i5.las2peer.tools.L2pNodeLauncher -p 9011 uploadStartupDirectory startService('${service.0.name}.${service.0.class}@${service.0.version}','${service.0.passphrase}') startService('${service.1.name}.${service.1.class}@${service.1.version}','${service.1.passphrase}') startService('${service.2.name}.${service.2.class}@${service.2.version}','${service.2.passphrase}') startService('${service.3.name}.${service.3.class}@${service.3.version}','${service.3.passphrase}') startService('${service.4.name}.${service.4.class}@${service.4.version}','${service.4.passphrase}') startService('${service.5.name}.${service.5.class}@${service.5.version}','${service.5.passphrase}') startService('${service.6.name}.${service.6.class}@${service.6.version}','${service.6.passphrase}') startWebConnector interactive pause @@ -310,7 +310,7 @@ - + diff --git a/etc/ant_configuration/service.properties b/etc/ant_configuration/service.properties index 78df629a..603a3ed9 100755 --- a/etc/ant_configuration/service.properties +++ b/etc/ant_configuration/service.properties @@ -2,40 +2,47 @@ service.0.version=0.2 service.0.name=de.rwth.dbis.acis.bazaar.service service.0.path=de/rwth/dbis/acis/bazaar/service service.0.class=BazaarService +service.0.passphrase=Passphrase service.0.dependencies= service.1.version=0.2 service.1.name=de.rwth.dbis.acis.bazaar.service service.1.path=de/rwth/dbis/acis/bazaar/service service.1.class=ProjectsResource +service.1.passphrase=Passphrase service.1.dependencies= service.2.version=0.2 service.2.name=de.rwth.dbis.acis.bazaar.service service.2.path=de/rwth/dbis/acis/bazaar/service service.2.class=ComponentsResource +service.2.passphrase=Passphrase service.2.dependencies= service.3.version=0.2 service.3.name=de.rwth.dbis.acis.bazaar.service service.3.path=de/rwth/dbis/acis/bazaar/service service.3.class=RequirementsResource +service.3.passphrase=Passphrase service.3.dependencies= service.4.version=0.2 service.4.name=de.rwth.dbis.acis.bazaar.service service.4.path=de/rwth/dbis/acis/bazaar/service service.4.class=CommentsResource +service.4.passphrase=Passphrase service.4.dependencies= service.5.version=0.2 service.5.name=de.rwth.dbis.acis.bazaar.service service.5.path=de/rwth/dbis/acis/bazaar/service service.5.class=AttachmentsResource +service.5.passphrase=Passphrase service.5.dependencies= service.6.version=0.2 service.6.name=de.rwth.dbis.acis.bazaar.service service.6.path=de/rwth/dbis/acis/bazaar/service service.6.class=UsersResource +service.6.passphrase=Passphrase service.6.dependencies=