cmda-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xingwei...@apache.org
Subject [40/51] [partial] incubator-cmda git commit: Add frontend and backend
Date Tue, 08 Sep 2015 22:49:49 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/LICENSE
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/LICENSE b/ApacheCMDA-Backend/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/ApacheCMDA-Backend/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/NOTICE
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/NOTICE b/ApacheCMDA-Backend/NOTICE
new file mode 100644
index 0000000..c0c89f8
--- /dev/null
+++ b/ApacheCMDA-Backend/NOTICE
@@ -0,0 +1,6 @@
+Apache Climate Model Diagnostic Analyzer 
+Copyright 2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/README.md
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/README.md b/ApacheCMDA-Backend/README.md
new file mode 100644
index 0000000..e6d7f06
--- /dev/null
+++ b/ApacheCMDA-Backend/README.md
@@ -0,0 +1,568 @@
+<b>Released under a Dual Licensing / JPL</b>
+Climate Model Analysis APIs Version 1.0	
+=================
+JPL has provided a repository of web services for multi-aspect physics-based and phenomenon-oriented phenomenon-oriented climate model performance evaluation and diagnosis through the comprehensive and synergistic use of multiple observational data, reanalysis data, and model outputs. This Climate Model Analysis Project will help you learn the available web services, how to use them, and help you design your climate analytics workflows.
+
+Controllers expect all non-id fields found in the entities (found in /models)
+Unless otherwise noted, POST = Create, PUT = Update, DELETE = Delete 
+
+Service URL:
+------------
+[http://einstein.sv.cmu.edu:9034/climate][1]
+
+
+Overview:
+---------
+Currently we are providing APIs in 5 categores:
+
+**Category 1: Manage User**<br/>
+   - [Get user by Id](#1)<br/>
+   - [Add a user](#2)<br/>
+   - [Update a user](#3)<br/>
+   - [Delete a user](#4)<br/>
+
+**Category 2: Manage Climate Services**<br/>
+   - [Get a climate service by service name](#5)<br/>
+   - [Get all climate services](#6)<br/>
+   - [Add a climate service](#7)<br/>
+   - [Update a climate service by service Id](#8)<br/>
+   - [Update a climate service by service name](#9)<br/>
+   - [Delete a climate service by service Id](#10)<br/>
+   
+**Category 3: Manage Service Configuration**<br/>
+   - [Get a service configuration by service Id](#11)<br/>
+   - [Get all service configurations created by a user](#12)<br/>
+   - [Add a service configuration](#13)<br/>
+   - [Update a service configuration by service Id](#14)<br/>
+   - [Delete a service configuration](#15)<br/>
+    
+**Category 4: Manage Climate Service Parameters**<br/>
+   - [Get all service parameters](#16)<br/>
+   - [Get a single pamameter by name](#17)<br/>
+   - [Get a single pamameter by Id](#18)<br/>
+   - [Add a service parameter](#19)</br>
+   - [Update a service parameter by Id](#20)</br>
+   - [Update a service parameter by name](#21)</br>
+   - [Delete a service parameter](#22)</br>
+
+**Category 5: Manage Service Configuration Item**<br/>
+   - [Get a service configuration item by Id](#23)<br/>
+   - [Get a service configuration item by a service configuration](#24)<br/>
+   - [Get a service configuration item by parameter name](#25)<br/>
+   - [Add a service configuration item](#26)<br/>
+   - [Update a service configuration item by Id](#27)<br/>
+   - [Delete a service configuration item](#28)<br/>
+
+**Category 6: Manage Dataset**<br/>
+   - [Get a dataset by Id](#29)<br/>
+   - [Get all datasets](#30)<br/>
+   - [Add a dataset](#31)<br/>
+   - [Update a dataset by Id](#32)<br/>
+   - [Delete a dataset](#33)<br/>
+
+**Category 7: Manage Instrument**<br/>
+   - [Get a instrument by Id](#29)<br/>
+   - [Get all instruments](#30)<br/>
+   - [Add a instrument](#31)<br/>
+   - [Update a instrument by Id](#32)<br/>
+   - [Delete a instrument](#33)<br/>
+   
+Detailed Usages:
+----------------
+Note: all TimeStamps are in Unix epoch time format to millisecond. Conversion from readable timestamp format to Unix epoch timestamp can be found in http://www.epochconverter.com
+
+####Manage User
+1. <a name="1"></a>**GET USER BY ID**
+    - **Purpose**: Query a specific user using user's Id.
+    - **Method**: GET
+    - **URL**: /users/:id
+    - **Semantics**: 
+        - **id**: Existing user's id.
+    - **Sample Usages**:
+      - **Sample request**: /users/1
+          
+      - **Sample result**: {"id":1,"firstName":"John","lastName":"Watson"}
+      
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+      
+2. <a name="2"></a>**ADD A USER**
+    - **Purpose**: Add a new user to the system.
+    - **Method**: POST
+    - **URL**: /users/add
+    - **Semantics**:  As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+      - **firstName** (string, not null): First name
+      - **lastName** (string, not null): Last name
+    - **Sample Usages**:
+      - **Sample request**: {"firstName":"John","lastName":"Watson"}
+          
+      - **Sample result**: 1
+               
+      - **Result**: HTTP 201 if the new user has been successfully added to the database, with the ID of the newly created object in the response body, HTTP 400 if failed.
+      
+3. <a name="3"></a>**UPDATE A USER**
+    - **Purpose**: Update a user's profile in the system.
+    - **Method**: PUT
+    - **URL**: /users/update/:id
+    - **Semantics**:As a PUT method, the API cannot be directly executed through a web browser.  Instead, it may be executed through Rails, JQuery, Python, BASH, etc.  
+      - **id**: A existing user's id.
+    - **Sample Usages**:
+      - **Sample request**: PUT /users/update/3   {"firstName":"Mary"}
+          
+      - **Sample result**: Return message "User updated"
+      
+      - **Result**: HTTP 201 if the user has been successfully updated, HTTP 400 if the id is wrong
+           
+4. <a name="4"></a>**DELETE A USER**
+    - **Purpose**: Delete a user from the system.
+    - **Method**: DELETE
+    - **URL**: /users/delete/:id
+    - **Semantics**: 
+        - **id**: Existing user id.
+    - **Sample Usages**: 
+      - **Sample request**: /users/delete/1
+      - **Sample result**: "User is deleted"
+      - **Result**: HTTP 201 if the user has been successfully deleted.
+  
+####Manage Climate Services                
+5. <a name="5"></a>**GET CLIMATE	SERVICE BY SERVICE NAME**
+    - **Purpose**: Query for climate service using service name. If there are multiple services with the same name, all will be returned. 
+    - **Method**: GET
+    - **URL**: /climate/getClimateService/:name/json
+    - **Semantics**:
+        - **name**: Existing service name.
+    - **Sample Usages**:
+      - **Sample json request**: /climate/getClimateService/testName/json
+      - **Sample json result**: 
+      {"id":30,"rootServiceId":1,"user":{"id":31,"firstName":"John","lastName":"Watson"},"name":"testName","purpose":"For testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used only for testing","createTime":"Feb 26, 2015 4:14:44 PM","versionNo":"1"}		
+      - **Result**: HTTP 200 if returned successfully, HTTP 404 if not found.
+      
+6. <a name="5"></a>**GET A CLIMATE	SERVICE BY ID**
+    - **Purpose**: Query for climate service using service ID. Result will be unique.
+    - **Method**: GET
+    - **URL**: /climate/getClimateService/id/:id
+    - **Semantics**:
+        - **id**: Id of an existing service.
+    - **Sample Usages**:
+      - **Sample json request**: /climate/getClimateService/id/30
+      - **Sample json result**: 
+			 {"id":30,"rootServiceId":1,"user":{"id":31,"firstName":"John","lastName":"Watson"},"name":"testName","purpose":"For testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used only for testing","createTime":"Feb 26, 2015 4:14:44 PM","versionNo":"1"}
+      - **Result**: HTTP 200 if returned successfully, HTTP 404 if not found.
+      
+6. <a name="6"></a>**GET ALL CLIMATE SERVICE**
+    - **Purpose**: Query all climate services.
+    - **Method**: GET
+    - **URL**: /climate/getAllClimateServices/json
+    - **Semantics**:
+    
+    - **Sample Usages**: 
+      - **Sample json request**: /climate/getAllClimateServices/json
+      - **Sample json result**: [{"id":33,"rootServiceId":0,"user":{"id":33,"firstName":"John","lastName":"Watson"},"name":"NightVale","purpose":"","url":"","scenario":"","createTime":"Feb 26, 2015 4:20:31 PM","versionNo":""},{"id":34,"rootServiceId":1,"user":{"id":33,"firstName":"John","lastName":"Watson"},"name":"testName","purpose":"For testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used only for testing","createTime":"Feb 26, 2015 4:20:31 PM","versionNo":"1"}]
+[{"climateServiceName":"testName","purpose":"For testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used only for testing","creatorId":"admin","createTime":"2014/12/18 19:37","versionNo":"1","rootServiceId":"1"}]
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+7. <a name="7"></a>**ADD A CLIMATE SERVICE**
+    - **Purpose**: Add a new climate service to the system.
+    - **Method**: POST
+    - **URL**: /climate/addClimateService
+    - **Semantics**: As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+        - **name** (string, not null): Non existing unique name of the climate service
+        - **creatorId** (string, not null): ID of the creator
+        - **purpose** (string, optional): Purpose of the climate service
+        - **url** (string, optional): Url linked to the configuration page of a certian climate service
+        - **scenario** (string, optional): Scenario in which the climate service could be used
+      
+        - **createTime** (string, default to current time): Time the climate service is created, defaults to current time
+        - **versionNo** (double, optional): Version number of the service
+        - **rootServiceId** (int, optional): Root service id of the service        
+    - **Sample Usages**:
+      - **Command Line Example**: 
+          1. Prepare input sensor type metadata in a json string:
+              - {"creatorId":"24","name":"testName","purpose":"For testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used only for testing","versionNo":"1","rootServiceId":"1"}
+          2. curl -H "Content-Type: application/json" -d @climateService.json "http://einstein.sv.cmu.edu:9008/addClimateService"
+      - **Result**: HTTP 201 if the climate service metadata has been successfully added to the database, with the content body returning the ID of the new service as Gson formatted string. HTTP 400 if failed.
+
+8. <a name="8"></a>**UPDATE A CLIMATE SERVICE BY SERVICE ID**
+    - **Purpose**: Update a climate service using service id.
+    - **Method**: PUT
+    - **URL**: /climate/updateClimateService/id/:id
+    - **Semantics**: 
+        - **id**: Existing service id.
+        - **name** (string, not null): Non existing unique name of the climate service
+        - **creatorId** (string, not null): ID of the creator
+        - **purpose** (string, optional): Purpose of the climate service
+        - **url** (string, optional): Url linked to the configuration page of a certian climate service
+        - **scenario** (string, optional): Scenario in which the climate service could be used
+      
+        - **createTime** (string, default to current time): Time the climate service is created, defaults to current time
+        - **versionNo** (double, optional): Version number of the service
+        - **rootServiceId** (int, optional): Root service id of the service  
+    - **Sample Usages**:
+      - /climate/updateClimateService/id/20      
+      - **Result**: HTTP 200 if the climate service has been successfully updated to the database.
+      
+9. <a name="9"></a>**UPDATE A CLIMATE SERVICE BY SERVICE NAME**
+    - **Purpose**: Update a climate service using service name. If there are multiple, only the first climate service is changed. (The above interface is recommended)
+    - **Method**: PUT
+    - **URL**: /climate/updateClimateService/name/:oldName
+    - **Semantics**: 
+      - **oldname**: Existing service name.
+        - **name** (string, not null): New name of the climate service
+        - **creatorId** (string, not null): ID of the creator
+        - **purpose** (string, optional): Purpose of the climate service
+        - **url** (string, optional): Url linked to the configuration page of a certian climate service
+        - **scenario** (string, optional): Scenario in which the climate service could be used
+      
+        - **createTime** (string, default to current time): Time the climate service is created, defaults to current time
+        - **versionNo** (double, optional): Version number of the service
+        - **rootServiceId** (int, optional): Root service id of the service 
+    - **Sample Usages**:
+      - http://einstein.sv.cmu.edu:9008/updateClimateService/name/testName
+      - **Result**: HTTP 200 if the climate service has been successfully updated to the database.
+      
+10. <a name="10"></a>**DELETE A CLIMATE SERVICE BY SERVICE ID**
+    - **Purpose**: Delete a service from the system.
+    - **Method**: DELETE
+    - **URL**: /climate/deleteClimateService/:id
+    - **Semantics**:
+        - **id**: Existing service id.
+    - **Sample Usages**: 
+      - /climate/deleteClimateService/20
+      - **Result**: HTTP 200 if returned successfully, HTTP 404 if not found.
+
+####Manage Service Configuration
+11. <a name="11"></a>**GET A SERVICE CONFIGURATION BY SERVICE CONFIGURATION ID**
+    - **Purpose**: Query a specific climate service configuration using service id. 
+    - **Method**: GET
+    - **URL**: /climate/getServiceConfiguration/id/:id/json
+    - **Semantics**:
+        - **id**: Existing service configuration id.
+    - **Sample Usages**: 
+      - /climate/getServiceConfiguration/id/1/json       
+      - **Sample json result**: <br/>
+          {"id":1,"climateservice":{"id":5,"rootServiceId":0,"user":{"id":1,"firstName":"John","lastName":"Watson"},"name":"ServiceByName","purpose":"testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used for testing","createTime":"Feb 26, 2015 11:20:46 AM","versionNo":"1"},"user":{"id":1,"firstName":"John","lastName":"Watson"}}
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+12. <a name="12"></a>**GET ALL SERVICE CONFIGURATIONS CREATED BY A USER**
+    - **Purpose**: Query all service configurations created by a certain user using the user's id. 
+    - **Method**: GET
+    - **URL**: /climate/getAllServiceConfigurationsByUserId/:userId/json
+    - **Semantics**:
+        - **userId**: Existing user's id.
+    - **Sample Usages**: 
+      - /climate/getAllServiceConfigurationsByUserId/5/json      
+      - **Sample json result**: <br/>
+          [{"id":1,"climateservice":{"id":5,"rootServiceId":0,"user":{"id":1,"firstName":"John","lastName":"Watson"},"name":"ServiceByName","purpose":"testing","url":"http://einstein.sv.cmu.edu:9008/forTesting","scenario":"Used for testing","createTime":"Feb 26, 2015 11:20:46 AM","versionNo":"1"},"user":{"id":1,"firstName":"John","lastName":"Watson"}}
+          ......]
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+ 
+13. <a name="13"></a>**ADD A SERVICE CONFIGURATION**
+    - **Purpose**: Add a new service configuration to the system. 
+    - **Method**: POST
+    - **URL**: /climate/addServiceConfiguration
+    - **Semantics**: As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+        - **serviceId**: Existing service id.
+        - **userId**: Existing user id.
+        - **runTime**: The runtime of this service configuration.
+    - **Sample Usages**: 
+      - **Sample json request**: <br/>
+      {"serviceId":2,"userId":5,"runTime":"01/02/2015 9:20:00"}  
+      - **Result**: HTTP 201 if the service configuration has been successfully added to the database, HTTP 400 if failed.
+      
+14. <a name="14"></a>**UPDATE A SERVICE CONFIGURATION BY SERVICE CONFIGURATION ID**
+    - **Purpose**: Update a service configuration using specific service id in the system. 
+    - **Method**: PUT
+    - **URL**: /climate/updateServiceConfiguration/id/:id
+    - **Semantics**:
+        - **id**: Existing service configuration id.
+    - **Sample Usages**: 
+      - /climate/updateServiceConfiguration/id/1
+      - **Sample json request**:  
+      {"serviceId":2,"userId":4,"runTime":"01/03/2015 9:20:20"}                
+      - **Result**: HTTP 201 if the service configuration has been successfully updated, HTTP 400 if failed.
+
+15. <a name="15"></a>**DELETE A SERVICE CONFIGURATION**
+    - **Purpose**: Delete a service configuration from the system. 
+    - **Method**: DELETE
+    - **URL**: /climate/deleteServiceConfiguration/:id
+    - **Semantics**:
+        - **id**: Existing service id.
+    - **Sample Usages**: <br/>
+      -  /climate/deleteServiceConfiguration/1       
+      - **Result**: HTTP 200 if returned successfully, HTTP 404 if not found. 
+ 
+###Manage Climate Service Parameters     
+16. <a name="16"></a>**GET ALL SERVICE PARAMETERS**
+    - **Purpose**: Query all service parameters.
+    - **Method**: GET
+    - **URL**: /parameter/getAllParameters/json
+    - **Semantics**:
+    - **Sample Usages**:  
+      - **Sample json request**: http://einstein.sv.cmu.edu:9000/getAllServiceParameter/json
+      - **Sample json result**: [{"serviceId":"2","parameterDataType":"testType","parameterRange":"testrange","parameterEnumeration":"number","parameterRule":"rule","parameterPurpose":"purpose"}]
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+17. <a name="17"></a>**GET A SINGLE PARAMETER BY NAME**
+    - **Purpose**: Query a specific service parameter using name.
+    - **Method**: GET
+    - **URL**: /parameter/getParameter/name/:name/json
+    - **Semantics**:
+      - **name**: Existing parameter name.
+    - **Sample Usages**:  
+      - **Sample json request**: http://einstein.sv.cmu.edu:9000/getAllServiceParameter/json
+      - **Sample json result**: [{"serviceId":"2","parameterDataType":"testType","parameterRange":"testrange","parameterEnumeration":"number","parameterRule":"rule","parameterPurpose":"purpose"}]
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+18. <a name="18"></a>**GET A SINGLE PARAMETER BY ID**
+    - **Purpose**: Query a specific service parameter using id.
+    - **Method**: GET
+    - **URL**: /parameter/getParameter/id/:id/json
+    - **Semantics**:
+      - **id**: Existing parameter id.
+    - **Sample Usages**:  
+      - **Sample json request**: http://einstein.sv.cmu.edu:9000/getAllServiceParameter/json
+      - **Sample json result**: [{"serviceId":"2","parameterDataType":"testType","parameterRange":"testrange","parameterEnumeration":"number","parameterRule":"rule","parameterPurpose":"purpose"}]
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+            
+19. <a name="19"></a>**ADD SERVICE PARAMETER**
+    - **Purpose**: Add a service parameter to the system.
+    - **Method**: POST
+    - **URL**: /parameter/addParameter
+    - **Semantics**: As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+        - **serviceId** (int, not null): Unique id of service
+        - **parameterDataType** (string, optional): Data Type of the parameter
+        - **parameterRange** (string, optional): Range of the parameter
+        - **parameterEnumeration** (string, optional): Parameter enumeration 
+        - **parameterRule** (string, optional): Parameter rule
+        - **parameterPurpose** (string, optional): Parameter purpose
+    - **Sample Usages**:
+      - **Command Line Example**: 
+          1. Prepare input sensor type metadata in a json file:
+              - "serviceParameter.json" file contains: {"serviceId":"2","parameterDataType":"testType","parameterRange":"testrange","parameterEnumeration":"number","parameterRule":"rule","parameterPurpose":"purpose"}
+          2. curl -H "Content-Type: application/json" -d @executionLog.json "http://einstein.sv.cmu.edu:9008/addServiceParameter"
+      - **Result**: HTTP 201 if the climate service metadata has been successfully added to the database, HTTP 400 if failed.
+
+20. <a name="20"></a>**UPDATE A SERVICE PARAMETER BY ID**
+    - **Purpose**: Update a service parameter using id to the system.
+    - **Method**: PUT
+    - **URL**: /parameter/updateParameter/id/:id
+    - **Semantics**: 
+        - **id**: Existing parameter id.
+    - **Sample Usages**:
+      - **Command Line Example**: 
+          1. Prepare input sensor type metadata in a json file:
+              - "climateService.json" file contains: {"climateServiceName": "testName", "purpose": "Test only"}
+          2. curl -H "Content-Type: application/json" -d @climateService.json "http://einstein.sv.cmu.edu:9008/updateClimateService"
+      - **Result**: HTTP 200 if the parameter has been successfully updated to the database.
+      
+21. <a name="21"></a>**UPDATE A SERVICE PARAMETER BY NAME**
+    - **Purpose**: Update a service parameter using name to the system.
+    - **Method**: PUT
+    - **URL**: /parameter/updateParameter/name/:oldName
+    - **Semantics**: 
+        - **oldName**: Existing parameter name.
+    - **Sample Usages**:
+      - **Command Line Example**: 
+          1. Prepare input sensor type metadata in a json file:
+              - "climateService.json" file contains: {"climateServiceName": "testName", "purpose": "Test only"}
+          2. curl -H "Content-Type: application/json" -d @climateService.json "http://einstein.sv.cmu.edu:9008/updateClimateService"
+      - **Result**: HTTP 200 if the parameter has been successfully updated to the database.
+
+22. <a name="22"></a>**DELETE A SERVICE PARAMTER**
+    - **Purpose**: Delete a service parameter using the name from the system. 
+    - **Method**: DELETE
+    - **URL**: /parameter/deleteParameter/name/:name
+    - **Semantics**:
+        - **name**: Existing parameter id.
+    - **Sample Usages**: 
+      - /parameter/deleteParameter/name/parameterName 
+      - **Result**: HTTP 200 if returned successfully, HTTP 404 if not found.
+
+###Manage Service Configuration Item
+23. <a name="23"></a>**GET A SERVICE CONFIGURATION ITEM BY ID**
+    - **Purpose**: Query a specific service configuration item using id.
+    - **Method**: GET
+    - **URL**: /climate/serviceConfigItemById/:id
+    - **Semantics**: 
+        - **id**: Existing service configuration item id.
+    - **Sample Usages**:
+      - **Sample request**: 
+          
+      - **Sample result**: 
+      
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+24. <a name="24"></a>**GET A SERVICE CONFIGURATION ITEM BY A SERVICE CONFIGURATION**
+    - **Purpose**: Query a specific service configuration item using one service configuration id.
+    - **Method**: GET
+    - **URL**: /climate/serviceConfigItemByServiceConfig/:serviceConfigId
+    - **Semantics**: 
+        - **serviceConfigId**: Existing service configuration id.
+    - **Sample Usages**:
+      - **Sample request**: 
+          
+      - **Sample result**: 
+      
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+      
+25. <a name="25"></a>**GET A SERVICE CONFIGURATION ITEM BY PARAMETER NAME**
+    - **Purpose**: Query a specific service configuration item using parameter name.
+    - **Method**: GET
+    - **URL**: /climate/serviceConfigItemByParamName/:param
+    - **Semantics**: 
+        - **param**: Existing parameter name.
+    - **Sample Usages**:
+      - **Sample request**: 
+          
+      - **Sample result**: 
+      
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+      
+26. <a name="26"></a>**ADD A SERVICE CONFIGURATION ITEM**
+    - **Purpose**: Add a new service configuration item to the system.
+    - **Method**: POST
+    - **URL**: /climate/addServiceConfigItem
+    - **Semantics**:  As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+      - **userId**:
+      - **serviceId**:    
+    - **Sample Usages**:
+      - **Sample request**: 
+          
+      - **Sample result**: 
+               
+      - **Result**: HTTP 201 if the new service configuration item has been successfully added to the database, HTTP 400 if failed.
+      
+27. <a name="27"></a>**UPDATE A SERVICE CONFIGURATION ITEM BY ID**
+    - **Purpose**: Update a service configuration item in the system.
+    - **Method**: PUT
+    - **URL**: /climate/updateServiceConfigItem/id/:id
+    - **Semantics**:As a PUT method, the API cannot be directly executed through a web browser.  Instead, it may be executed through Rails, JQuery, Python, BASH, etc.  
+      - **id**: Existing service configuration item id.
+    - **Sample Usages**:
+      - **Sample request**: 
+          
+      - **Sample result**:
+      
+      - **Result**: HTTP 201 if the service configuration item has been successfully updated, HTTP 400 if the id is wrong
+           
+28. <a name="28"></a>**DELETE A SERVICE CONFIGURATION ITEM**
+    - **Purpose**: Delete a service configuration item from the system.
+    - **Method**: DELETE
+    - **URL**: /climate/deleteServiceConfigItem/:id
+    - **Semantics**: 
+        - **id**: Existing service configuration item id.
+    - **Sample Usages**: 
+      - **Sample request**: http://einstein.sv.cmu.edu:9000/getSensorReading/androidAccelerometer/1395247329000/json
+      - **Sample result**: {"timestamp":1368568896000,"sensorName":"sensor1","value":518}
+      - **Result**: HTTP 201 if the service configuration item has been successfully deleted.
+
+###Manage Dataset
+29. <a name="29"></a>**GET A DATASET BY ID**
+    - **Purpose**: Query a specific dataset using id.
+    - **Method**: GET
+    - **URL**: /dataset/getDataset/id/:id/json
+    - **Semantics**: 
+        - **id**: Existing dataset id.
+    - **Sample Usages**:
+      - **Sample request**:
+      - **Sample result**:
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+30. <a name="30"></a>**GET ALL DATASETS**
+    - **Purpose**: Query all datasets.
+    - **Method**: GET
+    - **URL**: /dataset/getAllDatasets/json
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**:
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+31. <a name="31"></a>**ADD A DATASET**
+    - **Purpose**: Add a new dataset to the system.
+    - **Method**: POST
+    - **URL**: /dataset/addDataset
+    - **Semantics**: As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+    	- **instrumentId**: Existing instrument id.
+    	- **ServiesId**: List of existing services id.
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+32. <a name="32"></a>**UPDATE A DATASET BY ID**
+    - **Purpose**: Update a dataset using dataset id.
+    - **Method**: PUT
+    - **URL**: /dataset/updateDataset/id/:id
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+      
+ 32. <a name="33"></a>**DELETE A DATASET BY ID**
+    - **Purpose**: Delete a dataset using dataset id.
+    - **Method**: DELETE
+    - **URL**: /dataset/deleteDataset/id/:id
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+###Manage Instrument
+33. <a name="33"></a>**GET A INSTRUMENT BY ID**
+    - **Purpose**: Query a specific instrument using id.
+    - **Method**: GET
+    - **URL**: /instrument/getInstrument/id/:id/json
+    - **Semantics**: 
+        - **id**: Existing instrument id.
+    - **Sample Usages**:
+      - **Sample request**:
+      - **Sample result**:
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+34. <a name="34"></a>**GET ALL INSTRUMENTS**
+    - **Purpose**: Query all instruments.
+    - **Method**: GET
+    - **URL**: /instrument/getAllInstruments/json
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**:
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+35. <a name="35"></a>**ADD A INSTRUMENT**
+    - **Purpose**: Add a new instrument to the system.
+    - **Method**: POST
+    - **URL**: /instrument/addInstrument
+    - **Semantics**: As a POST method, the API cannot be directly executed through a web browser. Instead, it may be executed through Rails, JQuery, Python, BASH, etc.
+    	- **instrumentId**: Existing instrument id.
+    	- **ServiesId**: List of existing services id.
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+36. <a name="36"></a>**UPDATE A INSTRUMENT BY ID**
+    - **Purpose**: Update a instrument using instrument id.
+    - **Method**: PUT
+    - **URL**: /instrument/updateInstrument/id/:id
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+37. <a name="37"></a>**DELETE A INSTRUMENT BY ID**
+    - **Purpose**: Delete a instrument using instrument id.
+    - **Method**: DELETE
+    - **URL**: /instrument/deleteInstrument/id/:id
+    - **Semantics**:
+    - **Sample Usages**:
+      - **Sample request**: 
+      - **Sample result**: 
+      - **Result**: HTTP 200 if successful, HTTP 404 if failed.
+
+[1]: http://einstein.sv.cmu.edu:9034/climate "The Application Server running in the Smart Spaces Lab, CMUSV"
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/activator
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/activator b/ApacheCMDA-Backend/activator
new file mode 100755
index 0000000..59c131b
--- /dev/null
+++ b/ApacheCMDA-Backend/activator
@@ -0,0 +1,334 @@
+#!/bin/bash
+
+###  ------------------------------- ###
+###  Helper methods for BASH scripts ###
+###  ------------------------------- ###
+
+realpath () {
+(
+  TARGET_FILE="$1"
+
+  cd $(dirname "$TARGET_FILE")
+  TARGET_FILE=$(basename "$TARGET_FILE")
+
+  COUNT=0
+  while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ]
+  do
+      TARGET_FILE=$(readlink "$TARGET_FILE")
+      cd $(dirname "$TARGET_FILE")
+      TARGET_FILE=$(basename "$TARGET_FILE")
+      COUNT=$(($COUNT + 1))
+  done
+
+  if [ "$TARGET_FILE" == "." -o "$TARGET_FILE" == ".." ]; then
+    cd "$TARGET_FILE"
+    TARGET_FILEPATH=
+  else
+    TARGET_FILEPATH=/$TARGET_FILE
+  fi
+
+  # make sure we grab the actual windows path, instead of cygwin's path.
+  if ! is_cygwin; then
+    echo "$(pwd -P)/$TARGET_FILE"
+  else
+    echo $(cygwinpath "$(pwd -P)/$TARGET_FILE")
+  fi
+)
+}
+
+# TODO - Do we need to detect msys?
+
+# Uses uname to detect if we're in the odd cygwin environment.
+is_cygwin() {
+  local os=$(uname -s)
+  case "$os" in
+    CYGWIN*) return 0 ;;
+    *)  return 1 ;;
+  esac
+}
+
+# This can fix cygwin style /cygdrive paths so we get the
+# windows style paths.
+cygwinpath() {
+  local file="$1"
+  if is_cygwin; then
+    echo $(cygpath -w $file)
+  else
+    echo $file
+  fi
+}
+
+# Make something URI friendly
+make_url() {
+  url="$1"
+  local nospaces=${url// /%20}
+  if is_cygwin; then
+    echo "/${nospaces//\\//}"
+  else
+    echo "$nospaces"
+  fi
+}
+
+# Detect if we should use JAVA_HOME or just try PATH.
+get_java_cmd() {
+  if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]];  then
+    echo "$JAVA_HOME/bin/java"
+  else
+    echo "java"
+  fi
+}
+
+echoerr () {
+  echo 1>&2 "$@"
+}
+vlog () {
+  [[ $verbose || $debug ]] && echoerr "$@"
+}
+dlog () {
+  [[ $debug ]] && echoerr "$@"
+}
+execRunner () {
+  # print the arguments one to a line, quoting any containing spaces
+  [[ $verbose || $debug ]] && echo "# Executing command line:" && {
+    for arg; do
+      if printf "%s\n" "$arg" | grep -q ' '; then
+        printf "\"%s\"\n" "$arg"
+      else
+        printf "%s\n" "$arg"
+      fi
+    done
+    echo ""
+  }
+
+  exec "$@"
+}
+addJava () {
+  dlog "[addJava] arg = '$1'"
+  java_args=( "${java_args[@]}" "$1" )
+}
+addApp () {
+  dlog "[addApp] arg = '$1'"
+  sbt_commands=( "${app_commands[@]}" "$1" )
+}
+addResidual () {
+  dlog "[residual] arg = '$1'"
+  residual_args=( "${residual_args[@]}" "$1" )
+}
+addDebugger () {
+  addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
+}
+addConfigOpts () {
+  dlog "[addConfigOpts] arg = '$*'"
+  for item in $*
+  do
+    addJava "$item"
+  done
+}
+# a ham-fisted attempt to move some memory settings in concert
+# so they need not be messed around with individually.
+get_mem_opts () {
+  local mem=${1:-1024}
+  local meta=$(( $mem / 4 ))
+  (( $meta > 256 )) || meta=256
+  (( $meta < 1024 )) || meta=1024
+
+  # default is to set memory options but this can be overridden by code section below
+  memopts="-Xms${mem}m -Xmx${mem}m"
+  if [[ "${java_version}" > "1.8" ]]; then
+    extmemopts="-XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=${meta}m"
+  else
+    extmemopts="-XX:PermSize=64m -XX:MaxPermSize=${meta}m"
+  fi
+
+  if [[ "${java_opts}" == *-Xmx* ]] || [[ "${java_opts}" == *-Xms* ]] || [[ "${java_opts}" == *-XX:MaxPermSize* ]] || [[ "${java_opts}" == *-XX:ReservedCodeCacheSize* ]] || [[ "${java_opts}" == *-XX:MaxMetaspaceSize* ]]; then
+    # if we detect any of these settings in ${java_opts} we need to NOT output our settings.
+    # The reason is the Xms/Xmx, if they don't line up, cause errors.
+    memopts=""
+    extmemopts=""
+  fi
+
+  echo "${memopts} ${extmemopts}"
+}
+require_arg () {
+  local type="$1"
+  local opt="$2"
+  local arg="$3"
+  if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then
+    die "$opt requires <$type> argument"
+  fi
+}
+is_function_defined() {
+  declare -f "$1" > /dev/null
+}
+
+# If we're *not* running in a terminal, and we don't have any arguments, then we need to add the 'ui' parameter
+detect_terminal_for_ui() {
+  [[ ! -t 0 ]] && [[ "${#residual_args}" == "0" ]] && {
+    addResidual "ui"
+  }
+  # SPECIAL TEST FOR MAC
+  [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]] && [[ "${#residual_args}" == "0" ]] && {
+    echo "Detected MAC OSX launched script...."
+    echo "Swapping to UI"
+    addResidual "ui"
+  }
+}
+
+# Processes incoming arguments and places them in appropriate global variables.  called by the run method.
+process_args () {
+  while [[ $# -gt 0 ]]; do
+    case "$1" in
+       -h|-help) usage; exit 1 ;;
+    -v|-verbose) verbose=1 && shift ;;
+      -d|-debug) debug=1 && shift ;;
+           -mem) require_arg integer "$1" "$2" && app_mem="$2" && shift 2 ;;
+     -jvm-debug) 
+        if echo "$2" | grep -E ^[0-9]+$ > /dev/null; then 
+            addDebugger "$2" && shift 
+        else
+            addDebugger 9999
+        fi 
+        shift ;;
+     -java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;;
+            -D*) addJava "$1" && shift ;;
+            -J*) addJava "${1:2}" && shift ;;
+              *) addResidual "$1" && shift ;;
+    esac
+  done
+
+  is_function_defined process_my_args && {
+    myargs=("${residual_args[@]}")
+    residual_args=()
+    process_my_args "${myargs[@]}"
+  }
+}
+
+# Actually runs the script.
+run() {
+  # TODO - check for sane environment
+
+  # process the combined args, then reset "$@" to the residuals
+  process_args "$@"
+  detect_terminal_for_ui
+  set -- "${residual_args[@]}"
+  argumentCount=$#
+
+  #check for jline terminal fixes on cygwin
+  if is_cygwin; then
+    stty -icanon min 1 -echo > /dev/null 2>&1
+    addJava "-Djline.terminal=jline.UnixTerminal"
+    addJava "-Dsbt.cygwin=true"
+  fi
+
+  # run sbt
+  execRunner "$java_cmd" \
+    "-Dactivator.home=$(make_url "$activator_home")" \
+    $(get_mem_opts $app_mem) \
+    ${java_opts[@]} \
+    ${java_args[@]} \
+    -jar "$app_launcher" \
+    "${app_commands[@]}" \
+    "${residual_args[@]}"
+    
+  local exit_code=$?
+  if is_cygwin; then
+    stty icanon echo > /dev/null 2>&1
+  fi
+  exit $exit_code
+}
+
+# Loads a configuration file full of default command line options for this script.
+loadConfigFile() {
+  cat "$1" | sed '/^\#/d'
+}
+
+###  ------------------------------- ###
+###  Start of customized settings    ###
+###  ------------------------------- ###
+usage() {
+ cat <<EOM
+Usage: $script_name <command> [options]
+
+  Command:
+  ui                 Start the Activator UI
+  new [name] [template-id]  Create a new project with [name] using template [template-id]
+  list-templates     Print all available template names
+  -h | -help         Print this message
+
+  Options:
+  -v | -verbose      Make this runner chattier
+  -d | -debug        Set sbt log level to debug
+  -mem <integer>     Set memory options (default: $sbt_mem, which is $(get_mem_opts $sbt_mem))
+  -jvm-debug <port>  Turn on JVM debugging, open at the given port.
+
+  # java version (default: java from PATH, currently $(java -version 2>&1 | grep version))
+  -java-home <path>  Alternate JAVA_HOME
+
+  # jvm options and output control
+  -Dkey=val          Pass -Dkey=val directly to the java runtime
+  -J-X               Pass option -X directly to the java runtime
+                     (-J is stripped)
+
+  # environment variables (read from context)
+  JAVA_OPTS          Environment variable, if unset uses ""
+  SBT_OPTS           Environment variable, if unset uses ""
+  ACTIVATOR_OPTS     Environment variable, if unset uses ""
+
+In the case of duplicated or conflicting options, the order above
+shows precedence: environment variables lowest, command line options highest.
+EOM
+}
+
+###  ------------------------------- ###
+###  Main script                     ###
+###  ------------------------------- ###
+
+declare -a residual_args
+declare -a java_args
+declare -a app_commands
+declare -r real_script_path="$(realpath "$0")"
+declare -r activator_home="$(realpath "$(dirname "$real_script_path")")"
+declare -r app_version="1.2.12"
+
+declare -r app_launcher="${activator_home}/activator-launch-${app_version}.jar"
+declare -r script_name=activator
+declare -r java_cmd=$(get_java_cmd)
+declare -r java_opts=( "${ACTIVATOR_OPTS[@]}" "${SBT_OPTS[@]}" "${JAVA_OPTS[@]}" "${java_opts[@]}" )
+userhome="$HOME"
+if is_cygwin; then
+  # cygwin sets home to something f-d up, set to real windows homedir
+  userhome="$USERPROFILE"
+fi
+declare -r activator_user_home_dir="${userhome}/.activator"
+declare -r java_opts_config_home="${activator_user_home_dir}/activatorconfig.txt"
+declare -r java_opts_config_version="${activator_user_home_dir}/${app_version}/activatorconfig.txt"
+
+# Now check to see if it's a good enough version
+declare -r java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+if [[ "$java_version" == "" ]]; then
+  echo
+  echo No java installations was detected.
+  echo Please go to http://www.java.com/getjava/ and download
+  echo
+  exit 1
+elif [[ ! "$java_version" > "1.6" ]]; then
+  echo
+  echo The java installation you have is not up to date
+  echo Activator requires at least version 1.6+, you have
+  echo version $java_version
+  echo
+  echo Please go to http://www.java.com/getjava/ and download
+  echo a valid Java Runtime and install before running Activator.
+  echo
+  exit 1
+fi
+
+# if configuration files exist, prepend their contents to the java args so it can be processed by this runner
+# a "versioned" config trumps one on the top level
+if [[ -f "$java_opts_config_version" ]]; then
+  addConfigOpts $(loadConfigFile "$java_opts_config_version")
+elif [[ -f "$java_opts_config_home" ]]; then
+  addConfigOpts $(loadConfigFile "$java_opts_config_home")
+fi
+
+run "$@"

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/activator-launch-1.2.12.jar
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/activator-launch-1.2.12.jar b/ApacheCMDA-Backend/activator-launch-1.2.12.jar
new file mode 100644
index 0000000..4a8963c
Binary files /dev/null and b/ApacheCMDA-Backend/activator-launch-1.2.12.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/activator-sbt-echo-akka-shim.sbt
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/activator-sbt-echo-akka-shim.sbt b/ApacheCMDA-Backend/activator-sbt-echo-akka-shim.sbt
new file mode 100644
index 0000000..c11e0b2
--- /dev/null
+++ b/ApacheCMDA-Backend/activator-sbt-echo-akka-shim.sbt
@@ -0,0 +1 @@
+echoSettings
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/activator.bat
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/activator.bat b/ApacheCMDA-Backend/activator.bat
new file mode 100755
index 0000000..d078287
--- /dev/null
+++ b/ApacheCMDA-Backend/activator.bat
@@ -0,0 +1,227 @@
+@REM activator launcher script
+@REM
+@REM Envioronment:
+@REM JAVA_HOME - location of a JDK home dir (optional if java on path)
+@REM CFG_OPTS  - JVM options (optional)
+@REM Configuration:
+@REM activatorconfig.txt found in the ACTIVATOR_HOME or ACTIVATOR_HOME/ACTIVATOR_VERSION
+@setlocal enabledelayedexpansion
+
+@echo off
+
+set "var1=%~1"
+if defined var1 (
+  if "%var1%"=="help" (
+    echo.
+    echo Usage activator [options] [command]
+    echo.
+    echo Commands:
+    echo ui                 Start the Activator UI
+    echo new [name] [template-id]  Create a new project with [name] using template [template-id]
+    echo list-templates     Print all available template names
+    echo help               Print this message
+    echo.
+    echo Options:
+    echo -jvm-debug [port]  Turn on JVM debugging, open at the given port.  Defaults to 9999 if no port given.
+    echo.
+    echo Environment variables ^(read from context^):
+    echo JAVA_OPTS          Environment variable, if unset uses ""
+    echo SBT_OPTS           Environment variable, if unset uses ""
+    echo ACTIVATOR_OPTS     Environment variable, if unset uses ""
+    echo.
+    goto :end
+  )
+)
+
+if "%ACTIVATOR_HOME%"=="" (
+	set "ACTIVATOR_HOME=%~dp0"
+	@REM remove trailing "\" from path
+	set ACTIVATOR_HOME=!ACTIVATOR_HOME:~0,-1!
+)
+
+set ERROR_CODE=0
+set APP_VERSION=1.2.12
+set ACTIVATOR_LAUNCH_JAR=activator-launch-%APP_VERSION%.jar
+
+rem Detect if we were double clicked, although theoretically A user could
+rem manually run cmd /c
+for %%x in (%cmdcmdline%) do if %%~x==/c set DOUBLECLICKED=1
+
+rem FIRST we load a config file of extra options (if there is one)
+set "CFG_FILE_HOME=%UserProfile%\.activator\activatorconfig.txt"
+set "CFG_FILE_VERSION=%UserProfile%\.activator\%APP_VERSION%\activatorconfig.txt"
+set CFG_OPTS=
+if exist %CFG_FILE_VERSION% (
+  FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_VERSION%") DO (
+    set DO_NOT_REUSE_ME=%%i
+    rem ZOMG (Part #2) WE use !! here to delay the expansion of
+    rem CFG_OPTS, otherwise it remains "" for this loop.
+    set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
+  )
+)
+if "%CFG_OPTS%"=="" (
+  if exist %CFG_FILE_HOME% (
+    FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE_HOME%") DO (
+      set DO_NOT_REUSE_ME=%%i
+      rem ZOMG (Part #2) WE use !! here to delay the expansion of
+      rem CFG_OPTS, otherwise it remains "" for this loop.
+      set CFG_OPTS=!CFG_OPTS! !DO_NOT_REUSE_ME!
+    )
+  )
+)
+
+rem We use the value of the JAVACMD environment variable if defined
+set _JAVACMD=%JAVACMD%
+
+if "%_JAVACMD%"=="" (
+  if not "%JAVA_HOME%"=="" (
+    if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
+
+    rem if there is a java home set we make sure it is the first picked up when invoking 'java'
+    SET "PATH=%JAVA_HOME%\bin;%PATH%"
+  )
+)
+
+if "%_JAVACMD%"=="" set _JAVACMD=java
+
+rem Detect if this java is ok to use.
+for /F %%j in ('"%_JAVACMD%" -version  2^>^&1') do (
+  if %%~j==Java set JAVAINSTALLED=1
+)
+
+rem Detect the same thing about javac
+if "%_JAVACCMD%"=="" (
+  if not "%JAVA_HOME%"=="" (
+    if exist "%JAVA_HOME%\bin\javac.exe" set "_JAVACCMD=%JAVA_HOME%\bin\javac.exe"
+  )
+)
+if "%_JAVACCMD%"=="" set _JAVACCMD=javac
+for /F %%j in ('"%_JAVACCMD%" -version 2^>^&1') do (
+  if %%~j==javac set JAVACINSTALLED=1
+)
+
+rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
+set JAVAOK=true
+if not defined JAVAINSTALLED set JAVAOK=false
+if not defined JAVACINSTALLED set JAVAOK=false
+
+if "%JAVAOK%"=="false" (
+  echo.
+  echo A Java JDK is not installed or can't be found.
+  if not "%JAVA_HOME%"=="" (
+    echo JAVA_HOME = "%JAVA_HOME%"
+  )
+  echo.
+  echo Please go to
+  echo   http://www.oracle.com/technetwork/java/javase/downloads/index.html
+  echo and download a valid Java JDK and install before running Activator.
+  echo.
+  echo If you think this message is in error, please check
+  echo your environment variables to see if "java.exe" and "javac.exe" are
+  echo available via JAVA_HOME or PATH.
+  echo.
+  if defined DOUBLECLICKED pause
+  exit /B 1
+)
+
+rem Check what Java version is being used to determine what memory options to use
+for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
+    set JAVA_VERSION=%%g
+)
+
+rem Strips away the " characters
+set JAVA_VERSION=%JAVA_VERSION:"=%
+
+rem TODO Check if there are existing mem settings in JAVA_OPTS/CFG_OPTS and use those instead of the below
+for /f "delims=. tokens=1-3" %%v in ("%JAVA_VERSION%") do (
+    set MAJOR=%%v
+    set MINOR=%%w
+    set BUILD=%%x
+
+    set META_SIZE=-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M
+    if "!MINOR!" LSS "8" (
+      set META_SIZE=-XX:PermSize=64M -XX:MaxPermSize=256M
+    )
+
+    set MEM_OPTS=!META_SIZE!
+ )
+
+rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
+set _JAVA_OPTS=%JAVA_OPTS%
+if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=%CFG_OPTS%
+
+set DEBUG_OPTS=
+
+rem Loop through the arguments, building remaining args in args variable
+set args=
+:argsloop
+if not "%~1"=="" (
+  rem Checks if the argument contains "-D" and if true, adds argument 1 with 2 and puts an equal sign between them.
+  rem This is done since batch considers "=" to be a delimiter so we need to circumvent this behavior with a small hack.
+  set arg1=%~1
+  if "!arg1:~0,2!"=="-D" (
+   	set "args=%args% "%~1"="%~2""
+    shift
+    shift
+    goto argsloop
+  )
+
+  if "%~1"=="-jvm-debug" (
+    if not "%~2"=="" (
+      rem This piece of magic somehow checks that an argument is a number
+      for /F "delims=0123456789" %%i in ("%~2") do (
+        set var="%%i"
+      )
+      if defined var (
+        rem Not a number, assume no argument given and default to 9999
+        set JPDA_PORT=9999
+      ) else (
+        rem Port was given, shift arguments
+        set JPDA_PORT=%~2
+        shift
+      )
+    ) else (
+      set JPDA_PORT=9999
+    )
+    shift
+
+    set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=!JPDA_PORT!
+    goto argsloop
+  )
+  rem else
+  set "args=%args% "%~1""
+  shift
+  goto argsloop
+)
+
+:run
+
+if "!args!"=="" (
+  if defined DOUBLECLICKED (
+    set CMDS="ui"
+  ) else set CMDS=!args!
+) else set CMDS=!args!
+
+rem We add a / in front, so we get file:///C: instead of file://C:
+rem Java considers the later a UNC path.
+rem We also attempt a solid effort at making it URI friendly.
+rem We don't even bother with UNC paths.
+set JAVA_FRIENDLY_HOME_1=/!ACTIVATOR_HOME:\=/!
+set JAVA_FRIENDLY_HOME=/!JAVA_FRIENDLY_HOME_1: =%%20!
+
+rem Checks if the command contains spaces to know if it should be wrapped in quotes or not
+set NON_SPACED_CMD=%_JAVACMD: =%
+if "%_JAVACMD%"=="%NON_SPACED_CMD%" %_JAVACMD% %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS%
+if NOT "%_JAVACMD%"=="%NON_SPACED_CMD%" "%_JAVACMD%" %DEBUG_OPTS% %MEM_OPTS% %ACTIVATOR_OPTS% %SBT_OPTS% %_JAVA_OPTS% "-Dactivator.home=%JAVA_FRIENDLY_HOME%" -jar "%ACTIVATOR_HOME%\%ACTIVATOR_LAUNCH_JAR%" %CMDS%
+
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+
+@endlocal
+
+exit /B %ERROR_CODE%

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/app/.DS_Store
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/app/.DS_Store b/ApacheCMDA-Backend/app/.DS_Store
new file mode 100644
index 0000000..01d5243
Binary files /dev/null and b/ApacheCMDA-Backend/app/.DS_Store differ

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/app/Global.java
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/app/Global.java b/ApacheCMDA-Backend/app/Global.java
new file mode 100644
index 0000000..7d2921a
--- /dev/null
+++ b/ApacheCMDA-Backend/app/Global.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.hibernate3.HibernateExceptionTranslator;
+import org.springframework.orm.jpa.JpaTransactionManager;
+
+import play.Application;
+import play.GlobalSettings;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+/**
+ * Application wide behaviour. We establish a Spring application context for the dependency injection system and
+ * configure Spring Data.
+ */
+public class Global extends GlobalSettings {
+
+    /**
+     * The name of the persistence unit we will be using.
+     */
+    static final String DEFAULT_PERSISTENCE_UNIT = "default";
+    
+    /**
+     * Declare the application context to be used - a Java annotation based application context requiring no XML.
+     */
+    final private AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
+
+    /**
+     * Sync the context lifecycle with Play's.
+     */
+    @Override
+    public void onStart(final Application app) {
+        super.onStart(app);
+
+        // AnnotationConfigApplicationContext can only be refreshed once, but we do it here even though this method
+        // can be called multiple times. The reason for doing during startup is so that the Play configuration is
+        // entirely available to this application context.
+        ctx.register(SpringDataJpaConfiguration.class);
+        ctx.scan("controllers", "models");
+        ctx.refresh();
+
+        // This will construct the beans and call any construction lifecycle methods e.g. @PostConstruct
+        ctx.start();
+    }
+
+    /**
+     * Sync the context lifecycle with Play's.
+     */
+    @Override
+    public void onStop(final Application app) {
+        // This will call any destruction lifecycle methods and then release the beans e.g. @PreDestroy
+        ctx.close();
+
+        super.onStop(app);
+    }
+
+    /**
+     * Controllers must be resolved through the application context. There is a special method of GlobalSettings
+     * that we can override to resolve a given controller. This resolution is required by the Play router.
+     */
+    @Override
+    public <A> A getControllerInstance(Class<A> aClass) {
+        return ctx.getBean(aClass);
+    }
+
+    /**
+     * This configuration establishes Spring Data concerns including those of JPA.
+     */
+    @Configuration
+    @EnableJpaRepositories("models")
+    public static class SpringDataJpaConfiguration {
+
+        @Bean
+        public EntityManagerFactory entityManagerFactory() {
+            return Persistence.createEntityManagerFactory(DEFAULT_PERSISTENCE_UNIT);
+        }
+
+        @Bean
+        public HibernateExceptionTranslator hibernateExceptionTranslator() {
+            return new HibernateExceptionTranslator();
+        }
+
+        @Bean
+        public JpaTransactionManager transactionManager() {
+            return new JpaTransactionManager();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/app/controllers/BookChapterPublicationController.java
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/app/controllers/BookChapterPublicationController.java b/ApacheCMDA-Backend/app/controllers/BookChapterPublicationController.java
new file mode 100644
index 0000000..3fc81e2
--- /dev/null
+++ b/ApacheCMDA-Backend/app/controllers/BookChapterPublicationController.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package controllers;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.persistence.PersistenceException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.gson.Gson;
+
+import models.BookChapterPublication;
+import models.BookChapterPublicationRepository;
+import models.User;
+import models.UserRepository;
+import play.mvc.Controller;
+import play.mvc.Result;
+
+/**
+ * The main set of web services.
+ */
+@Named
+@Singleton
+public class BookChapterPublicationController extends Controller {
+	private final BookChapterPublicationRepository bookChapterPublicationRepository;
+    private final UserRepository userRepository;
+	
+	// We are using constructor injection to receive a repository to support our desire for immutability.
+    @Inject
+    public BookChapterPublicationController(final BookChapterPublicationRepository BookChapterPublicationRepository,
+    		final UserRepository userRepository) {
+        this.bookChapterPublicationRepository = BookChapterPublicationRepository;
+        this.userRepository = userRepository;
+    }
+    
+    public Result addBookChapterPublication() {
+    	JsonNode json = request().body().asJson();
+    	if (json == null) {
+    		System.out.println("BookChapterPublication not saved, expecting Json data");
+			return badRequest("BookChapterPublication not saved, expecting Json data");
+    	}
+
+    	//Parse JSON file
+    	String paperTitle = json.findPath("paperTitle").asText();
+    	long authorId = json.findPath("authorId").asLong();
+		String publicationChannel = json.findPath("publicationChannel").asText();
+		int year = json.findPath("year").asInt();
+		String bookName = json.findPath("bookName").asText();
+    	String editorName = json.findPath("editorName").asText();
+		String time = json.findPath("time").asText();
+		
+		try {
+			User author = userRepository.findOne(authorId);
+			BookChapterPublication BookChapterPublication = new BookChapterPublication(paperTitle, author, publicationChannel,
+					year, bookName, editorName, time);
+			BookChapterPublication savedBookChapterPublication = bookChapterPublicationRepository.save(BookChapterPublication);
+			
+			System.out.println("BookChapterPublication saved: " + savedBookChapterPublication.getBookName());
+			return created(new Gson().toJson(savedBookChapterPublication.getId()));
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println(pe.getClass().toString());
+			System.out.println("BookChapterPublication not saved: " + bookName);
+			return badRequest("BookChapterPublication not saved: " + bookName);
+		}			
+    }
+    
+    public Result deleteBookChapterPublication(Long id) {
+    	BookChapterPublication BookChapterPublication = bookChapterPublicationRepository.findOne(id);
+    	if (BookChapterPublication == null) {
+    		System.out.println("BookChapterPublication not found with id: " + id);
+			return notFound("BookChapterPublication not found with id: " + id);
+    	}
+    	
+    	bookChapterPublicationRepository.delete(BookChapterPublication);
+    	System.out.println("BookChapterPublication is deleted: " + id);
+		return ok("BookChapterPublication is deleted: " + id);
+    }
+    
+    public Result updateBookChapterPublication(long id) {
+    	JsonNode json = request().body().asJson();
+    	if (json == null) {
+    		System.out.println("BookChapterPublication not updated, expecting Json data");
+			return badRequest("BookChapterPublication not updated, expecting Json data");
+    	}
+
+    	//Parse JSON file
+    	String paperTitle = json.findPath("paperTitle").asText();
+    	long authorId = json.findPath("authorId").asLong();
+		String publicationChannel = json.findPath("publicationChannel").asText();
+		int year = json.findPath("year").asInt();
+		String bookName = json.findPath("bookName").asText();
+    	String editorName = json.findPath("editorName").asText();
+		String time = json.findPath("time").asText();
+		
+		try {
+			User author = userRepository.findOne(authorId);
+			
+			BookChapterPublication BookChapterPublication = bookChapterPublicationRepository.findOne(id);
+			BookChapterPublication.setPaperTitle(paperTitle);
+			BookChapterPublication.setAuthor(author);
+			BookChapterPublication.setPublicationChannel(publicationChannel);
+			BookChapterPublication.setYear(year);
+			BookChapterPublication.setBookName(bookName);
+			BookChapterPublication.setEditorName(editorName);
+			BookChapterPublication.setTime(time);
+			
+			BookChapterPublication savedBookChapterPublication = bookChapterPublicationRepository.save(BookChapterPublication);
+			
+			System.out.println("BookChapterPublication updated: " + savedBookChapterPublication.getBookName());
+			return created("BookChapterPublication updated: " + savedBookChapterPublication.getBookName());
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println("BookChapterPublication not updated: " + id);
+			return badRequest("BookChapterPublication not updated: " + id);
+		}			
+    }
+    
+    public Result getBookChapterPublication(Long id, String format) {
+    	if (id < 0) {
+    		System.out.println("id is negative!");
+			return badRequest("id is negative!");
+    	}
+    	
+    	BookChapterPublication BookChapterPublication = bookChapterPublicationRepository.findOne(id);
+    	if (BookChapterPublication == null) {
+    		System.out.println("BookChapterPublication not found with id: " + id);
+			return notFound("BookChapterPublication not found with id: " + id);
+    	}
+    	
+    	String result = new String();
+    	if (format.equals("json")) {
+    		result = new Gson().toJson(BookChapterPublication);
+    	}
+    	
+    	return ok(result);
+    }
+    
+    public Result getAllBookChapterPublications(String format) {
+    	
+    	String result = new String();
+    	
+    	if (format.equals("json")) {
+    		result = new Gson().toJson(bookChapterPublicationRepository.findAll());
+    	}
+    			
+    	return ok(result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/app/controllers/BookPublicationController.java
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/app/controllers/BookPublicationController.java b/ApacheCMDA-Backend/app/controllers/BookPublicationController.java
new file mode 100644
index 0000000..ab34cd4
--- /dev/null
+++ b/ApacheCMDA-Backend/app/controllers/BookPublicationController.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package controllers;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.persistence.PersistenceException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.gson.Gson;
+
+import models.BookPublication;
+import models.BookPublicationRepository;
+import models.User;
+import models.UserRepository;
+import play.mvc.Controller;
+import play.mvc.Result;
+
+/**
+ * The main set of web services.
+ */
+@Named
+@Singleton
+public class BookPublicationController extends Controller {
+	private final BookPublicationRepository bookPublicationRepository;
+    private final UserRepository userRepository;
+	
+	// We are using constructor injection to receive a repository to support our desire for immutability.
+    @Inject
+    public BookPublicationController(final BookPublicationRepository bookPublicationRepository,
+    		final UserRepository userRepository) {
+        this.bookPublicationRepository = bookPublicationRepository;
+        this.userRepository = userRepository;
+    }
+    
+    public Result addBookPublication() {
+    	JsonNode json = request().body().asJson();
+    	if (json == null) {
+    		System.out.println("BookPublication not saved, expecting Json data");
+			return badRequest("BookPublication not saved, expecting Json data");
+    	}
+
+    	//Parse JSON file
+    	String paperTitle = json.findPath("paperTitle").asText();
+    	long authorId = json.findPath("authorId").asLong();
+		String publicationChannel = json.findPath("publicationChannel").asText();
+		int year = json.findPath("year").asInt();
+		String bookName = json.findPath("bookName").asText();
+    	String publisherLocation = json.findPath("publisherLocation").asText();
+		String time = json.findPath("time").asText();
+		String pages = json.findPath("pages").asText();
+		
+		try {
+			User author = userRepository.findOne(authorId);
+			BookPublication bookPublication = new BookPublication(paperTitle, author, publicationChannel,
+					year, bookName, publisherLocation, time, pages);
+			BookPublication savedBookPublication = bookPublicationRepository.save(bookPublication);
+			
+			System.out.println("BookPublication saved: " + savedBookPublication.getBookName());
+			return created(new Gson().toJson(savedBookPublication.getId()));
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println(pe.getClass().toString());
+			System.out.println("BookPublication not saved: " + bookName);
+			return badRequest("BookPublication not saved: " + bookName);
+		}			
+    }
+    
+    public Result deleteBookPublicationById(Long id) {
+    	BookPublication bookPublication = bookPublicationRepository.findOne(id);
+    	if (bookPublication == null) {
+    		System.out.println("BookPublication not found with id: " + id);
+			return notFound("BookPublication not found with id: " + id);
+    	}
+    	
+    	bookPublicationRepository.delete(bookPublication);
+    	System.out.println("BookPublication is deleted: " + id);
+		return ok("BookPublication is deleted: " + id);
+    }
+    
+    public Result updateBookPublicationById(long id) {
+    	JsonNode json = request().body().asJson();
+    	if (json == null) {
+    		System.out.println("BookPublication not updated, expecting Json data");
+			return badRequest("BookPublication not updated, expecting Json data");
+    	}
+
+    	//Parse JSON file
+    	String paperTitle = json.findPath("paperTitle").asText();
+    	long authorId = json.findPath("authorId").asLong();
+		String publicationChannel = json.findPath("publicationChannel").asText();
+		int year = json.findPath("year").asInt();
+		String bookName = json.findPath("bookName").asText();
+    	String publisherLocation = json.findPath("publisherLocation").asText();
+		String time = json.findPath("time").asText();
+		String pages = json.findPath("pages").asText();
+		
+		try {
+			User author = userRepository.findOne(authorId);
+			
+			BookPublication bookPublication = bookPublicationRepository.findOne(id);
+			bookPublication.setPaperTitle(paperTitle);
+			bookPublication.setAuthor(author);
+			bookPublication.setPublicationChannel(publicationChannel);
+			bookPublication.setYear(year);
+			bookPublication.setBookName(bookName);
+			bookPublication.setPublisherLocation(publisherLocation);
+			bookPublication.setTime(time);
+			bookPublication.setPages(pages);
+			
+			BookPublication savedBookPublication = bookPublicationRepository.save(bookPublication);
+			
+			System.out.println("BookPublication updated: " + savedBookPublication.getBookName());
+			return created("BookPublication updated: " + savedBookPublication.getBookName());
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println("BookPublication not updated: " + id);
+			return badRequest("BookPublication not updated: " + id);
+		}			
+    }
+    
+    public Result getBookPublicationById(Long id, String format) {
+    	if (id < 0) {
+    		System.out.println("id is negative!");
+			return badRequest("id is negative!");
+    	}
+    	
+    	BookPublication bookPublication = bookPublicationRepository.findOne(id);
+    	if (bookPublication == null) {
+    		System.out.println("BookPublication not found with id: " + id);
+			return notFound("BookPublication not found with id: " + id);
+    	}
+    	
+    	String result = new String();
+    	if (format.equals("json")) {
+    		result = new Gson().toJson(bookPublication);
+    	}
+    	
+    	return ok(result);
+    }
+    
+    public Result getAllBookPublications(String format) {
+    	
+    	String result = new String();
+    	
+    	if (format.equals("json")) {
+    		result = new Gson().toJson(bookPublicationRepository.findAll());
+    	}
+    			
+    	return ok(result);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cmda/blob/37774c92/ApacheCMDA-Backend/app/controllers/BugReportController.java
----------------------------------------------------------------------
diff --git a/ApacheCMDA-Backend/app/controllers/BugReportController.java b/ApacheCMDA-Backend/app/controllers/BugReportController.java
new file mode 100644
index 0000000..e9b83e0
--- /dev/null
+++ b/ApacheCMDA-Backend/app/controllers/BugReportController.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package controllers;
+
+import java.util.Date;
+
+import play.mvc.*;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.inject.Inject;
+import javax.persistence.PersistenceException;
+
+import models.BugReport;
+import models.BugReportRepository;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.gson.Gson;
+
+/**
+ * The main set of web services.
+ */
+@Named
+@Singleton
+public class BugReportController extends Controller {
+	
+	static private int solved = 1;
+	static private int unsolved = 0;
+	
+	private final BugReportRepository bugReportRepository;
+	
+	@Inject
+	public BugReportController(final BugReportRepository bugReportRepository) {
+		this.bugReportRepository = bugReportRepository;
+	}
+	
+	public Result addBugReport() {
+		JsonNode json = request().body().asJson();
+		if (json == null) {
+			System.out.println("Bug Report not saved, expecting Json data");
+			return badRequest("Bug Report not saved, expecting Json data");
+		}
+		String title = json.findPath("title").asText();
+		String email = json.findPath("email").asText();
+		String name = json.findPath("name").asText();
+		String organization = json.findPath("organization").asText();
+		String description = json.findPath("description").asText();
+		int solved = json.findPath("solved").asInt();
+		long creationDateNumber = json.findPath("creationDate").asLong();
+		long updateDateNumber = json.findPath("updateDate").asLong();
+		Date creationDate = new Date(creationDateNumber);
+		Date updateDate = new Date(updateDateNumber);
+		try {
+			BugReport bugReport = new BugReport(title, email, name,
+					organization, description, solved, creationDate, updateDate);
+			BugReport savedBugReport = bugReportRepository.save(bugReport);
+			System.out.println("Service Configuration saved: "
+					+ savedBugReport.getId());
+			return created(new Gson().toJson(savedBugReport.getId()));
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println("Service Configuration not created");
+			return badRequest("Service Configuration not created");
+		}
+
+	}
+	
+	public Result updateBugReportById(long id) {
+		if (id < 0) {
+			System.out.println("id is negative!");
+			return badRequest("id is negative!");
+		}
+		JsonNode json = request().body().asJson();
+		if (json == null) {
+			System.out
+					.println("Service Configuration not saved, expecting Json data");
+			return badRequest("Service Configuration not saved, expecting Json data");
+		}
+
+		String title = json.findPath("title").asText();
+		String email = json.findPath("email").asText();
+		String name = json.findPath("name").asText();
+		String organization = json.findPath("organization").asText();
+		String description = json.findPath("description").asText();
+		int solved = json.findPath("solved").asInt();
+		long creationDateNumber = json.findPath("creationDate").asLong();
+		long updateDateNumber = json.findPath("updateDate").asLong();
+		Date creationDate = new Date(creationDateNumber);
+		Date updateDate = new Date(updateDateNumber);
+
+		try {
+			BugReport bugReport = bugReportRepository.findOne(id);
+			bugReport.setDescription(description);
+			bugReport.setEmail(email);
+			bugReport.setName(name);
+			bugReport.setOrganization(organization);
+			bugReport.setSolved(solved);
+			bugReport.setTitle(title);
+			bugReport.setCreationDate(creationDate);
+			bugReport.setUpdateDate(updateDate);
+
+			BugReport savedBugReport = bugReportRepository.save(bugReport);
+			System.out.println("Service Configuration updated: "
+					+ savedBugReport.getId());
+			return created("Service Configuration updated: "
+					+ savedBugReport.getId());
+		} catch (PersistenceException pe) {
+			pe.printStackTrace();
+			System.out.println("Service Configuration not saved: " + id);
+			return badRequest("Service Configuration not saved: " + id);
+		}
+	}
+
+	
+    public Result deleteBugReport(long id) {
+    	if (id < 0) {
+    		System.out.println("id is negative!");
+			return badRequest("id is negative!");
+    	}
+    	BugReport bugReport = bugReportRepository.findOne(id);
+    	if (bugReport == null) {
+    		System.out.println("Service Configuration not found with id: " + id);
+			return notFound("Service Configuration not found with id: " + id);
+    	}
+    	
+    	bugReportRepository.delete(bugReport);
+    	System.out.println("Service Configuration is deleted: " + id);
+		return ok("Service Configuration is deleted: " + id);
+    }
+    public Result getBugReport(long id, String format) {
+    	BugReport bugReport = bugReportRepository.findOne(id);
+    	if (bugReport == null) {
+    		System.out.println("Service Configuration not found with name: " + id);
+			return notFound("Service Configuration not found with name: " + id);
+    	}
+    	
+    	String result = new String();
+    	if (format.equals("json")) {
+    		result = new Gson().toJson(bugReport);
+    	}
+    	
+    	return ok(result);
+    }
+    
+    public Result getAllBugReports() {
+    	try {
+    		Iterable<BugReport> bugReports =  bugReportRepository.findAll();
+    		String result = new String();
+    		result = new Gson().toJson(bugReports);
+    		return ok(result);
+    	} catch (Exception e) {
+    		return badRequest("Service Configurations not found");
+    	}
+    }
+    
+    public Result getAllUnsolvedBugReports() {
+    	try {
+    		Iterable<BugReport> bugReports =  bugReportRepository.findAllBySolved(unsolved);
+    		String result = new String();
+    		result = new Gson().toJson(bugReports);
+    		return ok(result);
+    	} catch (Exception e) {
+    		return badRequest("Service Configurations not found");
+    	}
+    }
+    
+    public Result getAllSolvedBugReports() {
+    	try {
+    		Iterable<BugReport> bugReports =  bugReportRepository.findAllBySolved(solved);
+    		String result = new String();
+    		result = new Gson().toJson(bugReports);
+    		return ok(result);
+    	} catch (Exception e) {
+    		return badRequest("Service Configurations not found");
+    	}
+    }
+	
+}
\ No newline at end of file


Mime
View raw message