VOSpace delegate notes

These notes refer to the as yet unreleased version 2009.0.01.alpha version of the VOSpace client.

The main client side intefaces and classes are

Top level VOSpace delegate

To create a new Node within VOSpace, use one of the create methods on SystemDelegate .

The create methods themselves are inherited from the common delegate interface AbstractDelegate .

    interface SystemDelegate
    extends AbstractDelegate
        {
    
        public Node create(NodeTypeEnum type, URI uri)
        throws ... ;

        }

The SystemDelegate is the top level delegate that provides access to the VOSpace system, spanning multiple VOSpace services.

  • It will automatically resolve VOSpace links that point to other VOSpace services.
  • It will automatically handle retries using alternative endpoints if a VOSpace service is registered with more than one endpoint.

Using default registry client

If you want to use the default AG registry delegate.

    import java.net.URI;
    import org.astrogrid.security.SecurityGuard;
    import org.astrogrid.vospace.v11.client.node.Node;
    import org.astrogrid.vospace.v11.client.node.NodeTypeEnum;
    import org.astrogrid.vospace.v11.client.system.SystemDelegate;
    import org.astrogrid.vospace.v11.client.system.SystemDelegateResolver;
    import org.astrogrid.vospace.v11.client.system.SystemDelegateResolverImpl;

    //
    // Generate user name ....
    String username = "albert" ;

    //
    // Load the user credentials ....
    SecurityGuard guard = ....

    //
    // Create the new URI.
    final URI baseuri = new URI(
        "vos://service/base/"
        );
    final URI useruri = base.resolve(
        username
        );

    //
    // Create a VOSpace delegate resolver (using the default AG Registry client).
    final SystemDelegateResolver resolver = new SystemDelegateResolverImpl()

    //
    // Create a VOSpace delegate (using the SecurityGuard credentials).
    final SystemDelegate delegate = resolver.resolve(
        guard
        );

    //
    // Create the VOSpace node.
    final Node node = delegate.create(
        NodeTypeEnum.TREE_NODE,
        useruri
        );

    log.debug("Node created");
    log.debug("  URI  [" + node.uri()  + "]");
    log.debug("  Type [" + node.type() + "]");
    log.debug("  Name [" + node.name() + "]");
    log.debug("  Path [" + node.path() + "]");

Using custom registry client

If you want to manage your own registry delegates, then you can pass it in to the resolver constructor.

    import org.astrogrid.registry.client.query.v1_0.RegistryService;

    //
    // Our registry delegate.
    RegistryService registry = ....
        
    //
    // Create a VOSpace delegate resolver (using a custom registry client).
    final SystemDelegateResolver resolver = new SystemDelegateResolverImpl(
        registry
        );

Server generated name

If you want the VOSpace server to allocate a unique name for the node, then use '.auto' in the Node URI.

    //
    // Create the new URI.
    final URI baseuri = new URI(
        "vos://service/base/"
        );
    final URI useruri = base.resolve(
        ".auto"
        );

JUnit examples

Further examples of how the deledate and resolver are used are available in the JUnit tests.

Maven dependencies

Direct dependencies

Additional dependencies

-- DaveMorris - 14 Apr 2009

Topic revision: r1 - 2009-04-14 - 14:42:20 - DaveMorris
 
AstroGrid Service Click here for the
AstroGrid Service Web
This is the AstroGrid
Development Wiki

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback