|
|
|
| Resource type | Description | Metric URI |
|---|---|---|
| Databases | Generated for users who create a new database or connect an existing database. | http://www.gria.org/sla/metric/activity/ogsadai/db |
| Database roles | Generated for each database role that is created. | http://www.gria.org/sla/metric/activity/ogsadai/role |
| Database subscriptions | Generated for the user who subscribes to a database role. | http://www.gria.org/sla/metric/activity/ogsadai/subscription |
| Database subscribers | Generated for the owner of a database role when somebody subscribes to it. | http://www.gria.org/sla/metric/resource/ogsadai/subscriber |
User A has been given permission by the service provider to create databases. He wants to create a new database, create some tables in that database, and then give User B read/write access to those tables.
User A calls createDatabase.
User A calls subscribe on his administrative role so he can create a table.
User A calls perform on his subscription, creating a table.
User A gives User B permission to subscribe to his Read/Write role.
User B calls subscribe on the Read/Write role.
User B executes some queries on his Read/Write subscription.
At the end of this example, the usage for the two users is as follows:
In some situations the service provider may wish to charge or constrain differently for different databases or database roles. For example, he may want to make read-only access to a database free while charging for read/write access.
This can be implemented through the use of custom metric URIs. There are two places where a custom URI can be entered:
When a user subscribes to a database role that uses custom metric URIs he generates one usage report for the standard subscription metric (http://www.gria.org/sla/metric/activity/ogsadai/subscription) and one for the custom metric. This is different from subscribing to a role without a custom metric URI, where the user would only generate a usage report for the standard subscription metric.
Providing a custom metric URI when creating a new database will assign similar metric URIs to the three automatically generated database roles. These URIs are generated using the same rules as username generation - the three postfixes are appended onto the end of the metric URI for each of the three roles.
For example, supposing you keep the default values for the username postfixes (eg, ".a" for the administrative role and ".r" for the read-only role), and specify a metric URI http://www.test.com/metric/test_database, the following metric URIs would be generated for the three roles:
SLA templates can be created to constrain on any of the above metrics. Several example sections of SLA templates are given below. See the GRIA user documentation for information on constructing full SLA template XML documents.
When inserted into the <constraints> section of an SLA template, this capacity constaint will limit the user to creating only one database. The user may still subscribe to other databases, and other users may subscribe to his database.
<constraint type='INSTANTANEOUS'>
<metric type='ACTIVITY'>
<uri>http://www.gria.org/sla/metric/activity/ogsadai/db</uri>
<description>
<description>database</description>
</description>
<units type='DECIMAL'>
<instantaneous>database</instantaneous>
</units>
</metric>
<bound>LE</bound>
<private>false</private>
<limit>1.0</limit>
<contention>1.0</contention>
<repeating>false</repeating>
</constraint>
When inserted into the <constraints> section of an SLA template, these capacity constraints will allow the user to subscribe to three database roles, and have one person subscribe to any roles he creates. The user can create an unlimited number of databases.
<constraint type='INSTANTANEOUS'>
<metric type='ACTIVITY'>
<uri>http://www.gria.org/sla/metric/activity/ogsadai/subscription</uri>
<description>
<description>subscription</description>
</description>
<units type='DECIMAL'>
<instantaneous>subscription</instantaneous>
</units>
</metric>
<bound>LE</bound>
<private>false</private>
<limit>3.0</limit>
<contention>1.0</contention>
<repeating>false</repeating>
</constraint>
<constraint type='INSTANTANEOUS'>
<metric type='RESOURCE'>
<uri>http://www.gria.org/sla/metric/resource/ogsadai/subscriber</uri>
<description>
<description>subscriber</description>
</description>
<units type='DECIMAL'>
<instantaneous>subscriber</instantaneous>
</units>
</metric>
<bound>LE</bound>
<private>false</private>
<limit>1.0</limit>
<contention>1.0</contention>
<repeating>false</repeating>
</constraint>
The GRIA OGSA-DAI plugin comes pre-installed with the GRIA 5.3 client.
Visit the URL of the GRIA OGSA-DAI Service you wish to access and drag the wsdl link from the webpage in to the service view of the client.
Connecting to an OGSA-DAI Service from Client
If you are running the GRIA OGSA-DAI 1.0 client drag the OGSA-DAI Service legacy link, otherwise use the OGSA-DAI Service link. It is most likely that you are using a 5.2 client.
This feature allows you to expose existing databases containing existing data to users of the GRIA OGSA-DAI service. To use this feature you need to have been given access to the connect-database PBAC role on the OGSA-DAI service. See the Access Control section for more information.
Before starting you should ensure that the OGSA-DAI service is listed in your client. If it does not exist you can add it by either left clicking on the "Services" menu item and selecting "Add a service", or dragging the service's WSDL link onto the "Services" entry.
Right click on the OGSA-DAI service and select "Connect existing resource".

This will open a dialog box where you can enter the details of the database you wish to connect. You are able to enter the JDBC URL of any type of database here, and also a short description of the database. No checks as to the validity of the JDBC URL are made.

Once you have connected you data resource you are able to add roles. Right click on the connected data resource and select "Connect role".
Enter a description plus the username and password of the role on your database.
After clicking "OK", the role you have created is added to the list.
See the Access Control section to learn how you can control which users have permission to subscribe to your new data resource role.
This feature allows you to create new data resources which you can either subscribe to and use yourself, or give permission for others to use. To create new data resource you need to have been given access to the create-dataresource PBAC role on the OGSA-DAI service. See the Access Control section for more information.
Before starting you should ensure that the OGSA-DAI service is listed in your client. If it does not exist you can add it by either left clicking on the "Services" entry and selecting "Add a service", or dragging the service's WSDL link into the client.
Right click on the OGSA-DAI service and select "Create new dataresource".
Enter a description and press ok.
The database and its three roles have now been created.
See the Access Control section to learn how you can control which users have permission to subscribe to your new data resources.
Getting a subscription to a database role allows you to execute queries (perform documents) on it. By default you are allowed to subscribe to roles created by yourself. To be able to subscribe to roles created by other people, they need to have given you the client PBAC role on their resource. See the Access Control section for more information.
If you have been given access to a role and it does not appear in your client, try right clicking on the OGSA-DAI service and selecting "Discover existing resources".
Before starting you should ensure that the OGSA-DAI service is listed in your client. If it does not exist you can add it by either left clicking on the "Services" menu item and selecting "Add a service", or dragging the service's WSDL link into the client.

Right click on the role you wish to subscribe to and select "Subscribe". You will be asked to enter a short description for the subscription.
The subscription is now listed in your client. You can execute SQL queries on it directly from the client by right clicking on it and selecting one of "Execute query" or "Execute update" entries. Note this only works on SQL Database types of data resources.
This feature allows you to permit another user to execute database queries using your subscription. Note that the delegate only gets access to a subset of methods on your subscription:
| Action | Owner | Delegate |
|---|---|---|
| Executing perform documents | Permitted | Permitted |
| Running SELECT queries | Permitted | Permitted |
| Running UPDATE queries | Permitted | Permitted |
| Viewing and editing access control lists | Permitted | Denied |
| Destroying the resource | Permitted | Denied |
| Renaming the resource | Permitted | Denied |
Left click on the database subscription that you wish to delegate access to, and select "Access control list".

Now add a new access control rule for the "delegate" role. In the screenshot below we are adding a rule such that everyone is considered a delegate to this subscription, and will be able to run perform documents on it.

The GRIA client allows you to destroy any of the resources for which you have the owner PBAC role. To do this simply right click on the resource and select "Destroy".


When destroying a data resource that was created by the OGSA-DAI service (ie. by using the create new data resource feature), all tables and data in that database will be removed from the RDBMS.
Destroying a data resource that already existed (and was configured using the connect existing database feature) will only remove the link between the OGSA-DAI service and the back-end, and will leave the data intact.
Destroying a database will cause all roles and subscriptions on the database to be destroyed in addition to the database resource itself.
Destroying a role resource will also destroy any subscriptions that use that role.
Note you cannot destroy roles that were automatically created by the OGSA-DAI service. These roles exist until the database that they belong to is destroyed.
Removing a subscription resource will prevent any further queries from being run using that subscription.
The GRIA OGSA-DAI service makes use of functions written in the plpgsql language. Before using the GRIA OGSA-DAI service, you need to enable this language in the template database.
Due to a limitation of PostgreSQL, it is not possible to automatically set the correct permissions on new tables on databases created by the OGSA-DAI service. After executing a CREATE TABLE command, you are required to execute the following function:
SELECT grant_access_to_table(table_name);
For example, to create a table named testtable, you should perform the following SQL queries:
CREATE TABLE testtable (testcolumn TEXT);
SELECT grant_access_to_table('testtable');
Note that this is only necessary on databases created by users of the OGSA-DAI service. It is not needed for existing databases that have been connected to the service.
When destroying a data resource that was created by the OGSA-DAI service, it is necessary to drop first all the tables that were created in that database using the automatically created role resources. This can be done using a subscription to execute DROP TABLE SQL commands or DROP OWNED (for PostgreSQL >= 8.2).