Client Management Interface
Creating a MembershipGroup
Membership Groups can be used to control access to resources. First we create a proxy to the Membership Service.
EndpointReferenceType membershipServiceEPR = (RemoteMembershipService)
ConversationID.getEPR("http://.../gria-client-mgt/services/MembershipService");
RemoteMembershipService membershipService =
(RemoteMembershipService) repository.getOrCreateObject(RemoteMembershipService.class,membershipServiceEPR);
A MembershipGroup is created using the createGroup method.
MembershipGroupConversation group = membershipService.createGroup("Group1");
Users can be added to a group using the addPolicy rule in the PolicyManagement Interface.
// Need to have the users and issuers certficate group.addPolicyRule(new PolicyRule(new MatchPattern(userCertificate,issuerCertifcate),"member"));
Users can then be given access to a resource if they are members of the group, by adding a rule to the resource.
String[] possibleRoles = resource.getValidRoles(); // Choose a role for members of the group to have on this resource String role = ....; resource.addPolicyRule(new PolicyRule(group.getMembershipPattern(), role));
Creating a Registry
A Registry can be created and other resource added to it. First we create a proxy to the Registry Service
EndpointReferenceType registryServiceEPR =
ConversationID.getEPR("http://.../gria-service-provider-mgt/services/RegistryService");
RemoteRegistryService registryService =
(RemoteRegistryService) repository.getOrCreateObject(RemoteRegistryService.class,registryServiceEPR);
A Registry can bew created using the createRegisty method
RegistryConversation registry = registryService.createRegistry("Registry1");
Resources can be added to the registry with the registerResource
method. Use getEndpointRef() to get the endpoint of a resource and pass
this as the first parameter to registerResource.
registry.registerResource(resource.getEndpointRef());
Note: if you register an SLA then the registry will try to get usage information from the SLA service. You need to add a rule to the SLA resource allowing the registry to do this:
SLAConversation sla ...
MatchRule rule = registry.getMatchRuleForResource();
rule.setProcessRole("monitor");
sla.addPolicyRule(new PolicyRule(rule));
registry.registerResource(sla.getEndpointRef());
Opening a Private Account
First we create a proxy to the Private Account Service
EndpointReferenceType privateAccountServiceEPR =
ConversationID.getEPR("http://.../gria-client-mgt/services/PrivateAccountService");
RemotePrivateAccountService privateAccountService =
(RemotePrivateAccountService) repository.getOrCreateObject(RemotePrivateAccountService.class,privateAccountServiceEPR);
Then we can open a Private Account using the openAccount method
PrivateAccountConversation privateAccount
= privateAccountService.openAccount("Name","1234","email@mycompany.com",
new AddressType(),null,"PrivateAccount1");
