Difference between revisions of "URI Resolver"

From Gcube Wiki
Jump to: navigation, search
(SMP Resolver)
Line 17: Line 17:
  
 
  http://dev.d4science.org/uri-resolver/smp?smp-uri=smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV+gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y  
 
  http://dev.d4science.org/uri-resolver/smp?smp-uri=smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV+gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y  
 +
 +
The artifact is available on Nexus with the following coordinates:
 +
 +
<source lang=xml">
 +
<dependency>
 +
  <groupId>org.gcube.data.transfer</groupId>
 +
  <artifactId>uri-resolver</artifactId>
 +
  <version>1.0.0-SNAPSHOT</version>
 +
  <type>war</type>
 +
</dependency>
 +
</source>
  
 
==== Runtime Resource ====
 
==== Runtime Resource ====

Revision as of 07:22, 25 April 2013

The URI Resolver is an HTTP URI resolver implemented as an HTTP servlet which gives access trough HTTP to different protocols URIs.

SMP Resolver

The first version of the component is able to give HTTP resolution to SMP protocol URIs [1].

Once deployed in a servlet container as Tomcat, the servlet can be used to resolve SMP URIs as follows:

URL url = new URL("http://<hostname>:<port>/uri-resolver/smp?smp-uri=smp://.....);


The HTTP URI can be also used to retrieve files using wget or trough a Web Browser.. just click on the link :

http://dev.d4science.org/uri-resolver/smp?smp-uri=smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV+gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y 

The artifact is available on Nexus with the following coordinates:

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic


<dependency>
  <groupId>org.gcube.data.transfer</groupId>
  <artifactId>uri-resolver</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <type>war</type>
</dependency>

Runtime Resource

The address and the configuration information of the servlet are registered on the gCube Information System as Runtime Resource. This in an example of the Runtime Resource to configure:

<Profile>
        
      <Category>Service</Category>
        
      <Name>HTTP-URI-Resolver</Name>
        
      <Description>HTTP URI Resolver</Description>
        
      <Platform>
            
         <Name>tomcat</Name>
            
         <Version>6</Version>
            
         <MinorVersion>0</MinorVersion>
            
         <RevisionVersion>0</RevisionVersion>
            
         <BuildVersion>0</BuildVersion>
        
      </Platform>
        
      <RunTime>
            
         <HostedOn>dev.d4science.org</HostedOn>
            
         <GHN UniqueID="" />
            
         <Status>READY</Status>
        
      </RunTime>
        
      <AccessPoint>
            
         <Description>SMP URI Resolver</Description>
            
         <Interface>
                
            <Endpoint EntryName="smp">http://dev.d4science.org/uri-resolver/smp</Endpoint>
            
         </Interface>
            
         <AccessData>
                
            <Username />
                
            <Password>6vW1u92cpdgHzYAgIurn9w==</Password>
            
         </AccessData>
            
         <Properties>
                
            <Property>
                    
               <Name>parameter</Name>
                    
               <Value encrypted="false">smp-uri</Value>
                
            </Property>
            
         </Properties>
        
      </AccessPoint>
    
   </Profile>


Query

The following code snippet can be used to retrieve from the gCube Information System the info to configure the resolver

 
        ScopeProvider.instance.set(<scope>);
 
	XQuery query = queryFor(ServiceEndpoint.class);
 
	query.addCondition("$resource/Profile/Name/text() eq 'HTTP-URI-Resolver'").setResult("$resource/Profile/AccessPoint");
 
	DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
 
	List<AccessPoint> endpoints = client.submit(query);
 
	if (endpoints.size() == 0)
		throw new Exception("No Resolver available");
 
	//Base Address
        System.out.println(endpoints.get(0).address());
        //Query URL parameter
	System.out.println(endpoints.get(0).propertyMap().get("parameter").value());