Repository: airavata
Updated Branches:
  refs/heads/develop b85d3dbc5 -> 273d074ac


http://git-wip-us.apache.org/repos/asf/airavata/blob/273d074a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
----------------------------------------------------------------------
diff --git 
a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html 
b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
index 5065c95..80384c8 100644
--- a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
+++ b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
@@ -77,11 +77,13 @@ considered as a group in it's own right for implementation 
ease</p>
 </td></tr>
 <tr><td><code>FULL_TEXT</code></td><td><code>2</code></td><td>
 </td></tr>
-<tr><td><code>PRRENT_ENTITY_ID</code></td><td><code>3</code></td><td>
+<tr><td><code>PARRENT_ENTITY_ID</code></td><td><code>3</code></td><td>
 </td></tr>
-<tr><td><code>CREATED_TIME</code></td><td><code>4</code></td><td>
+<tr><td><code>PERMISSION_TYPE_ID</code></td><td><code>4</code></td><td>
 </td></tr>
-<tr><td><code>UPDATED_TIME</code></td><td><code>5</code></td><td>
+<tr><td><code>CREATED_TIME</code></td><td><code>5</code></td><td>
+</td></tr>
+<tr><td><code>UPDATED_TIME</code></td><td><code>6</code></td><td>
 </td></tr>
 </table></div>
 <div class="definition"><h3 id="Enum_SearchCondition">Enumeration: 
SearchCondition</h3>
@@ -224,8 +226,9 @@ regarding the user.</p>
 
<tr><td>7</td><td>description</td><td><code>string</code></td><td></td><td>optional</td><td></td></tr>
 
<tr><td>8</td><td>binaryData</td><td><code>binary</code></td><td></td><td>optional</td><td></td></tr>
 
<tr><td>9</td><td>fullText</td><td><code>string</code></td><td></td><td>optional</td><td></td></tr>
-<tr><td>10</td><td>createdTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
-<tr><td>11</td><td>updatedTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
+<tr><td>10</td><td>originalEntityCreationTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
+<tr><td>11</td><td>createdTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
+<tr><td>12</td><td>updatedTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
 </table><br/><p>Entity object which is used to register an entity in the 
system.</p>
 <li><b>entityId</b> : Entity id provided by the client</li>
 <li><b>domainId</b> : Domain id</li>
@@ -236,8 +239,10 @@ regarding the user.</p>
 <li>description : Short description for the entity</li>
 <li>binaryData : Any information stored in binary format</li>
 <li>fullText : A string which will be considered for full text search</li>
-<li>createdTime : If client provides this value then the system will use it if 
not the current time will be set</li>
-<li>updatedTime : If client provides this value then the system will use it if 
not the current time will be set</li>
+<li><b>originalEntityCreationTime</b> : When registering old records what is 
the original entity creation time. If not
+set will be default to current time</li>
+<li>createdTime : Will be set by the system</li>
+<li>updatedTime : Will be set by the system</li>
 
 <br/></div><div class="definition"><h3 id="Struct_PermissionType">Struct: 
PermissionType</h3>
 <table class="table-bordered table-striped 
table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
 value</th></thead>

http://git-wip-us.apache.org/repos/asf/airavata/blob/273d074a/modules/sharing-registry/sharing-service-docs/index.html
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-service-docs/index.html 
b/modules/sharing-registry/sharing-service-docs/index.html
index d7a7868..0364025 100644
--- a/modules/sharing-registry/sharing-service-docs/index.html
+++ b/modules/sharing-registry/sharing-service-docs/index.html
@@ -7,17 +7,40 @@
 <div class="container-fluid">
     <h2>Welcome to Airavata Sharing Registry Service Documentation</h2>
 
-    <p>Airavata Data Sharing Registry Service is a general purpose 
<em>Collaborative User Space Management Component</em> that can solve
+    <p>Airavata Data Sharing Registry Service is a general purpose 
<b>Collaborative Workspace Management Component</b>
+        that can solve
         your Scientific Data Management requirements related to sharing and 
access controlling.</p>
 
+    <p><span style="color: red; ">N.B. This component is under active 
development and this document will keep on evolving</span>
+    </p>
+
     <div>
         <ul><a href="#getting-started">Getting Started</a></ul>
         <ul><a href="./api-docs/index.html" target="_blank">API Docs</a></ul>
     </div>
     <div id="#getting-started">
-        <h3>Getting started with Java client</h3>
+        <h3>Getting started with the Java client</h3>
+
+        <div>
+            <ol start="0">
+                <li><a href="#requirements">Requirements</a></li>
+                <li><a href="#thrift-client">Create a thrift client</a></li>
+                <li><a href="#create-domain">Create a Domain</a></li>
+                <li><a href="#create-users">Create Users</a></li>
+                <li><a href="#create-groups">Create Groups</a></li>
+                <li><a href="#assign-users-to-group">Assign Users to a 
Group</a></li>
+                <li><a href="#assign-groups-to-group">Assign Groups to a 
Group</a></li>
+                <li><a href="#create-permission-types">Create Permission Types 
for your Domain</a></li>
+                <li><a href="#create-entity-types">Create Entity Types for 
your Domain</a></li>
+                <li><a href="#create-entities">Create Entities</a></li>
+                <li><a href="#sharing-entities">Share Entities</a></li>
+                <li><a href="#checking-user-has-access">Checking User has 
Permission</a></li>
+                <li><a href="#search-entities">Searching Entities</a></li>
+            </ol>
+        </div>
+        <br/>
 
-        <div class="definition">
+        <div class="definition" id="requirements">
             <h4>0. Required maven dependencies</h4>
             <pre>
                 &lt;dependency&gt;
@@ -34,11 +57,11 @@
             </pre>
         </div>
 
-        <div class="definition">
+        <div class="definition" id="thrift-client">
             <h4>1. Creating the thrift client</h4>
             <pre>
                 //should use the correct host name and port here
-                String serverHost = "gw56.iu.xsede.org";
+                String serverHost = "localhost";
                 int serverPort = 7878;
 
                 TTransport transport = new TSocket(serverHost, serverPort);
@@ -48,7 +71,7 @@
             </pre>
         </div>
 
-        <div class="definition">
+        <div class="definition" id="create-domain">
             <h4>2. Create a domain</h4>
             <pre>
                 Domain domain = new Domain();
@@ -62,32 +85,237 @@
             </pre>
         </div>
 
-        <div class="definition">
-            <h4>2. Create User</h4>
+        <div class="definition" id="create-users">
+            <h4>2. Create Users</h4>
             <pre>
-                User user = new User();
+                User user1 = new User();
+                String userName = "test-user-1";
+                String userId1 =  "test-user-1";
                 //required
-                user.setUserName("test-user");
+                user1.setUserId(userId1);
                 //required
-                user.setDomainId(domainId);
+                user.setUserName(userName);
                 //required
-                user.setFirstName("John");
+                user1.setDomainId(domainId);
                 //required
-                user.setLastName("Doe");
+                user1.setFirstName("John");
                 //required
-                user.setEmail("john....@abc.com");
+                user1.setLastName("Doe");
+                //required
+                user1.setEmail("john....@abc.com");
                 //optional - this should be bytes of the users image icon
-                byte[] icon = new byte[10];
-                user.setIcon(icon);
+                //byte[] icon = new byte[10];
+                //user1.setIcon(icon);
+
+                sharingServiceClient.createUser(user1);
+
+                //Similarly create two more users user2 and user3.
+                    .
+                    .
+                    .
+            </pre>
+        </div>
+
+        <div class="definition" id="create-groups">
+            <h4>3. Create User Groups</h4>
+            <pre>
+                UserGroup userGroup1 = new UserGroup();
+                //required
+                userGroup1.setGroupId("test-group-1");
+                //required
+                userGroup1.setDomainId(domainId);
+                //required
+                userGroup1.setName("test-group-1");
+                //optional
+                userGroup1.setDescription("test group description");
+                //required
+                userGroup1.setOwnerId("test-user-1");
+                //required
+                userGroup1.setGroupType(GroupType.USER_LEVEL_GROUP);
 
-                //can be manually set. otherwise will be set to the current 
time by the system
-                user.setCreatedTime(System.currentTimeMillis());
-                user.setUpdatedTime(System.currentTimeMillis());
+                sharingServiceClient.createGroup(userGroup1);
 
-                //will be of form &lt;domainId&gt;:&lt;userName&gt;
-                String userId = sharingServiceClient.createUser(user);
+                //Similarly create another group "userGroup2" with the owner 
being "test-user-2".
+                    .
+                    .
+                    .
+            </pre>
+        </div>
+
+        <div class="definition" id="assign-users-to-group">
+            <h4>4. Assign Users to a Group</h4>
+            <pre>
+                sharingServiceClient.addUsersToGroup(domainId, 
Arrays.asList("test-user-3"), "test-group-2");
             </pre>
         </div>
+
+        <div class="definition" id="assign-groups-to-group">
+            <h4>5. Assign groups to a group</h4>
+            <pre>
+                sharingServiceClient.addChildGroupsToParentGroup(domainId, 
Arrays.asList("test-group-2"), "test-group-1");
+
+                /********************************************/
+                /*              test-group-1                */
+                /*                 /     \                  */
+                /*                /       \                 */
+                /*        test-user-1   test-group-2        */
+                /*                        /        \        */
+                /*                 test-user-2  test-user-3 */
+                /********************************************/
+            </pre>
+        </div>
+
+        <div class="definition" id="create-permission-types">
+            <h4>6. Create Permission types for your Domain</h4>
+            <pre>
+                PermissionType permissionType1 = new PermissionType();
+                //required
+                permissionType1.setPermissionTypeId("READ");
+                //required
+                permissionType1.setDomainId(domainId);
+                //required
+                permissionType1.setName("READ");
+                //optional
+                permissionType1.setDescription("READ description");
+                sharingServiceClient.createPermissionType(permissionType1);
+
+                PermissionType permissionType2 = new PermissionType();
+                permissionType2.setPermissionTypeId("WRITE");
+                permissionType2.setDomainId(domainId);
+                permissionType2.setName("WRITE");
+                permissionType2.setDescription("WRITE description");
+                sharingServiceClient.createPermissionType(permissionType2);
+            </pre>
+        </div>
+
+        <div class="definition" id="create-entity-types">
+            <h4>7. Create Entity Types for your Domain</h4>
+            <pre>
+                EntityType entityType1 = new EntityType();
+                //required
+                entityType1.setEntityTypeId("PROJECT");
+                //required
+                entityType1.setDomainId(domainId);
+                //required
+                entityType1.setName("PROJECT");
+                //optional
+                entityType1.setDescription("PROJECT entity type description");
+                sharingServiceClient.createEntityType(entityType1);
+
+                EntityType entityType2 = new EntityType();
+                entityType2.setEntityTypeId("EXPERIMENT");
+                entityType2.setDomainId(domainId);
+                entityType2.setName("EXPERIMENT");
+                entityType2.setDescription("EXPERIMENT entity type");
+                sharingServiceClient.createEntityType(entityType2);
+            </pre>
+        </div>
+
+        <div class="definition" id="create-entities">
+            <h4>8. Create Entities</h4>
+            <pre>
+                Entity entity1 = new Entity();
+                //required
+                entity1.setEntityId("test-project-1");
+                //required
+                entity1.setDomainId(domainId);
+                //required
+                entity1.setEntityTypeId("PROJECT");
+                //required
+                entity1.setOwnerId("test-user-1");
+                //required
+                entity1.setName("test-project-1");
+                //optional
+                entity1.setDescription("test project 1 description");
+                //optional
+                entity1.setFullText("test project 1 stampede gaussian 
seagrid");
+                //optional - If not set this will be default to current system 
time
+                
entity1.setOriginalEntityCreationTime(System.currentTimeMillis());
+
+                Entity entity2 = new Entity();
+                entity2.setEntityId("test-experiment-1");
+                entity2.setDomainId(domainId);
+                entity2.setEntityTypeId("EXPERIMENT");
+                entity2.setOwnerId("test-user-1");
+                entity2.setName("test-experiment-1");
+                entity2.setDescription("test experiment 1 description");
+                entity2.setParentEntityId("test-project-1");
+                entity2.setFullText("test experiment 1 benzene");
+                sharingServiceClient.createEntity(entity2);
+
+                Entity entity3 = new Entity();
+                entity3.setEntityId("test-experiment-2");
+                entity3.setDomainId(domainId);
+                entity3.setEntityTypeId("EXPERIMENT");
+                entity3.setOwnerId("test-user-1");
+                entity3.setName("test-experiment-2");
+                entity3.setDescription("test experiment 2 description");
+                entity3.setParentEntityId("test-project-1");
+                entity3.setFullText("test experiment 1 3-methyl 1-butanol");
+                sharingServiceClient.createEntity(entity3);
+            </pre>
+        </div>
+
+        <div class="definition" id="sharing-entities">
+        <h4>9. Share Entities with Users and Groups</h4>
+            <pre>
+                sharingServiceClient.shareEntityWithUsers(domainId, 
"test-project-1", Arrays.asList("test-user-2"), "WRITE", true);
+                sharingServiceClient.shareEntityWithGroups(domainId, 
"test-experiment-2", Arrays.asList("test-group-2"), "READ", true);
+
+                
/**********************************************************************/
+                /*          test-project-1 (OWNER:test-user-1, 
WRITE:test-user-2)     */
+                /*             /                        \                      
       */
+                /*    test-experiment-1          test-experiment-2             
       */
+                /*   (OWNER:test-user-1)     (OWNER:test-user-1, 
READ:test-group-2)   */
+                
/**********************************************************************/
+            </pre>
+        </div>
+
+        <div class="definition" id="checking-user-has-access">
+            <h4>9. Checking whether a User has Permission to access an Entity 
with specified Permission</h4>
+            <pre>
+                //test-project-1 is explicitly shared with test-user-2 with 
WRITE permission
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-2", 
"test-project-1", "WRITE"));
+
+                //test-user-2 has WRITE permission to test-experiment-1 and 
test-experiment-2 indirectly
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-2", 
"test-experiment-1", "WRITE"));
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-2", 
"test-experiment-2", "WRITE"));
+
+                //test-user-2 does not have READ permission to 
test-experiment-1 and test-experiment-2
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-2", 
"test-experiment-1", "READ"));
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-2", 
"test-experiment-2", "READ"));
+
+                //test-user-3 does not have READ permission to test-project-1
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-3", 
"test-project-1", "READ"));
+
+                //test-experiment-2 is shared with test-group-2 with READ 
permission. Therefore test-user-3 has READ permission
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-3", 
"test-experiment-2", "READ"));
+
+                //test-user-3 does not have WRITE permission to 
test-experiment-2
+                
System.out.println(sharingServiceClient.userHasAccess(domainId, "test-user-3", 
"test-experiment-2", "WRITE"));
+            </pre>
+        </div>
+
+        <div class="definition" id="search-entities">
+            <h4>10. Searching Entities</h4>
+            <pre>
+                ArrayList<SearchCriteria> filters = new ArrayList<>();
+                SearchCriteria searchCriteria = new SearchCriteria();
+                searchCriteria.setSearchCondition(SearchCondition.LIKE);
+                searchCriteria.setValue("experiment");
+                searchCriteria.setSearchField(EntitySearchField.NAME);
+                filters.add(searchCriteria);
+
+                searchCriteria = new SearchCriteria();
+                searchCriteria.setSearchCondition(SearchCondition.EQUAL);
+                searchCriteria.setValue("READ");
+                
searchCriteria.setSearchField(EntitySearchField.PERMISSION_TYPE_ID);
+                filters.add(searchCriteria);
+
+                
System.out.println(sharingServiceClient.searchEntities(domainId, "test-user-2", 
"EXPERIMENT", filters, 0, -1).size());
+            </pre>
+        </div>
+
     </div>
 </div>
 </body>

http://git-wip-us.apache.org/repos/asf/airavata/blob/273d074a/modules/sharing-registry/thrift_models/sharing_cpi.thrift
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/thrift_models/sharing_cpi.thrift 
b/modules/sharing-registry/thrift_models/sharing_cpi.thrift
index f180738..7dd0775 100644
--- a/modules/sharing-registry/thrift_models/sharing_cpi.thrift
+++ b/modules/sharing-registry/thrift_models/sharing_cpi.thrift
@@ -48,7 +48,7 @@ service SharingRegistryService {
     /**
      <p>API method to register a user in the system</p>
     */
-    string registerUser(1: required sharing_models.User user) throws (1: 
sharing_models.SharingRegistryException sre)
+    string createUser(1: required sharing_models.User user) throws (1: 
sharing_models.SharingRegistryException sre)
     /**
      <p>API method to update existing user</p>
     */
@@ -62,7 +62,7 @@ service SharingRegistryService {
     */
     sharing_models.User getUser(1: required string domainId, 2: required 
string userId) throws (1: sharing_models.SharingRegistryException sre)
     /**
-     <p>API method to get a list of users in a specific domain Users will be 
reverse sorted based on the created time.</p>
+     <p>API method to get a list of users in a specific domain.</p>
      <li>domainId : Domain id</li>
      <li>offset : Starting result number</li>
      <li>limit : Number of max results to be sent</li>
@@ -86,7 +86,7 @@ service SharingRegistryService {
     */
     sharing_models.UserGroup getGroup(1: required string domainId, 2: required 
string groupId) throws (1: sharing_models.SharingRegistryException sre)
     /**
-     <p>API method to get groups in a domainId. Results are reverse sorted 
based on created time.</p>
+     <p>API method to get groups in a domainId.</p>
     */
     list<sharing_models.UserGroup> getGroups(1: required string domainId, 2: 
required i32 offset, 3: required i32 limit)
 
@@ -99,11 +99,11 @@ service SharingRegistryService {
     */
     bool removeUsersFromGroup(1: required string domainId, 2: required 
list<string> userIds, 3: required string groupId) throws (1: 
sharing_models.SharingRegistryException sre);
     /**
-     <p>API method to get list of child users in a group. Only the direct 
members will be returned. Results are reverse time sorted based on creation 
time</p>
+     <p>API method to get list of child users in a group. Only the direct 
members will be returned.</p>
     */
     list<sharing_models.User> getGroupMembersOfTypeUser(1: string domainId, 2: 
required string groupId, 3: required i32 offset, 4: required i32 limit) throws 
(1: sharing_models.SharingRegistryException sre);
     /**
-     <p>API method to get list of child groups in a group. Only the direct 
members will be returned. Results are reverse time sorted based on creation 
time</p>
+     <p>API method to get list of child groups in a group. Only the direct 
members will be returned.</p>
     */
     list<sharing_models.UserGroup> getGroupMembersOfTypeGroup(1: required 
string domainId, 2: required string groupId, 3: required i32 offset, 4: 
required i32 limit) throws (1: sharing_models.SharingRegistryException sre);
     /**
@@ -132,7 +132,7 @@ service SharingRegistryService {
     */
     sharing_models.EntityType getEntityType(1: required string domainId, 2: 
required string entityTypeId) throws (1: 
sharing_models.SharingRegistryException sre)
     /**
-     <p>API method to get entity types in a domainId. Results are reverse time 
sorted based on creation time</p>
+     <p>API method to get entity types in a domainId.</p>
     */
     list<sharing_models.EntityType> getEntityTypes(1: required string 
domainId, 2: required i32 offset, 3: required i32 limit) throws (1: 
sharing_models.SharingRegistryException sre);
 
@@ -140,7 +140,7 @@ service SharingRegistryService {
     /**
      <p>API method to register new entity</p>
     */
-    string registerEntity(1: required sharing_models.Entity entity) throws (1: 
sharing_models.SharingRegistryException sre)
+    string createEntity(1: required sharing_models.Entity entity) throws (1: 
sharing_models.SharingRegistryException sre)
     /**
      <p>API method to update entity</p>
     */
@@ -183,7 +183,7 @@ service SharingRegistryService {
     */
     sharing_models.PermissionType getPermissionType(1: required string 
domainId, 2: required string permissionTypeId) throws (1: 
sharing_models.SharingRegistryException sre)
     /**
-     <p>API method to get list of permission types in a given domainId. 
Results are reverse time sorted based on creation time</p>
+     <p>API method to get list of permission types in a given domainId.</p>
     */
     list<sharing_models.PermissionType> getPermissionTypes(1: required string 
domainId, 2: required i32 offset, 3: required i32 limit) throws (1: 
sharing_models.SharingRegistryException sre)
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/273d074a/modules/sharing-registry/thrift_models/sharing_models.thrift
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/thrift_models/sharing_models.thrift 
b/modules/sharing-registry/thrift_models/sharing_models.thrift
index d4d15c4..e34dc93 100644
--- a/modules/sharing-registry/thrift_models/sharing_models.thrift
+++ b/modules/sharing-registry/thrift_models/sharing_models.thrift
@@ -158,7 +158,8 @@ enum EntitySearchField {
     NAME,
     DESCRIPTION,
     FULL_TEXT,
-    PRRENT_ENTITY_ID,
+    PARRENT_ENTITY_ID,
+    PERMISSION_TYPE_ID,
     CREATED_TIME,
     UPDATED_TIME
 }
@@ -202,8 +203,10 @@ struct SearchCriteria {
 * <li>description : Short description for the entity</li>
 * <li>binaryData : Any information stored in binary format</li>
 * <li>fullText : A string which will be considered for full text search</li>
-* <li>createdTime : If client provides this value then the system will use it 
if not the current time will be set</li>
-* <li>updatedTime : If client provides this value then the system will use it 
if not the current time will be set</li>
+* <li><b>originalEntityCreationTime</b> : When registering old records what is 
the original entity creation time. If not
+* set will be default to current time</li>
+* <li>createdTime : Will be set by the system</li>
+* <li>updatedTime : Will be set by the system</li>
 **/
 struct Entity {
     1: optional string entityId,
@@ -215,8 +218,9 @@ struct Entity {
     7: optional string description,
     8: optional binary binaryData,
     9: optional string fullText,
-    10: optional i64 createdTime,
-    11: optional i64 updatedTime
+    10: optional i64 originalEntityCreationTime,
+    11: optional i64 createdTime,
+    12: optional i64 updatedTime
 }
 
 /**

Reply via email to