UriResolver scope provider updated
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@83665 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f3b17d0c73
commit
f41541cb23
|
@ -19,6 +19,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.workspace.server.shortener.UrlEncoderUtil;
|
import org.gcube.portlets.user.workspace.server.shortener.UrlEncoderUtil;
|
||||||
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||||
|
|
||||||
|
@ -55,7 +56,9 @@ public class UriResolverReaderParameter {
|
||||||
|
|
||||||
logger.trace("UriResolverReaderParameter is istancing with scope: "+scope);
|
logger.trace("UriResolverReaderParameter is istancing with scope: "+scope);
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scopeUtil.getScopeRoot());
|
||||||
|
|
||||||
XQuery query = queryFor(ServiceEndpoint.class);
|
XQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.log4j.Logger;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||||
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
import org.gcube.resources.discovery.client.queries.impl.XQuery;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
@ -58,12 +59,14 @@ public final class UrlShortener {
|
||||||
* @throws IllegalStateException *
|
* @throws IllegalStateException *
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public UrlShortener() throws Exception {
|
public UrlShortener(String scope) throws Exception {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
logger.trace("Tentative reading HTTP-URL-Shortener RR");
|
logger.trace("Tentative reading HTTP-URL-Shortener RR");
|
||||||
|
|
||||||
ScopeProvider.instance.set("/gcube");
|
ScopeUtilFilter scopeUtil = new ScopeUtilFilter(scope);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scopeUtil.getScopeRoot());
|
||||||
|
|
||||||
XQuery query = queryFor(ServiceEndpoint.class);
|
XQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
|
@ -197,7 +200,7 @@ public final class UrlShortener {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
UrlShortener urlSh = new UrlShortener();
|
UrlShortener urlSh = new UrlShortener("/d4science.research-infrastructures.eu");
|
||||||
System.out.println("UrlShortener: "+urlSh);
|
System.out.println("UrlShortener: "+urlSh);
|
||||||
|
|
||||||
shorten = urlSh.shorten("https://dev.d4science.org/group/data-e-infrastructure-gateway/workspace?itemid=056648-c7ce-4de3-a4c7-e1411816cc12&operation=gotofolder");
|
shorten = urlSh.shorten("https://dev.d4science.org/group/data-e-infrastructure-gateway/workspace?itemid=056648-c7ce-4de3-a4c7-e1411816cc12&operation=gotofolder");
|
||||||
|
|
|
@ -74,10 +74,10 @@ public class WsUtil {
|
||||||
|
|
||||||
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
||||||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||||
user=TEST_USER;
|
// user=TEST_USER;
|
||||||
|
|
||||||
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
||||||
// user = "francesco.mangiacrapa";
|
user = "francesco.mangiacrapa";
|
||||||
|
|
||||||
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
||||||
logger.warn("session id: "+sessionID);
|
logger.warn("session id: "+sessionID);
|
||||||
|
@ -285,7 +285,7 @@ public class WsUtil {
|
||||||
shortener = (UrlShortener) session.getAttribute(WsUtil.URL_SHORTENER_SERVICE);
|
shortener = (UrlShortener) session.getAttribute(WsUtil.URL_SHORTENER_SERVICE);
|
||||||
|
|
||||||
if(shortener==null){
|
if(shortener==null){
|
||||||
shortener = new UrlShortener();
|
shortener = new UrlShortener(session.getScope().toString());
|
||||||
session.setAttribute(URL_SHORTENER_SERVICE, shortener);
|
session.setAttribute(URL_SHORTENER_SERVICE, shortener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,10 @@ public class ScopeUtilFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getScopeRoot() {
|
||||||
|
return scopeRoot;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String scope = "/gcube";
|
String scope = "/gcube";
|
||||||
|
|
||||||
|
@ -136,6 +140,8 @@ public class ScopeUtilFilter {
|
||||||
|
|
||||||
ScopeUtilFilter filter = new ScopeUtilFilter(scope);
|
ScopeUtilFilter filter = new ScopeUtilFilter(scope);
|
||||||
|
|
||||||
|
System.out.println("scope root is: "+filter.getScopeRoot());
|
||||||
|
|
||||||
filter.convertListScopeToPortlet(listTest);
|
filter.convertListScopeToPortlet(listTest);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ public class UriResolverReaderRR {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public UriResolverReaderRR() throws Exception {
|
public UriResolverReaderRR(String scope) throws Exception {
|
||||||
|
|
||||||
ScopeProvider.instance.set("/gcube/devsec");
|
ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
XQuery query = queryFor(ServiceEndpoint.class);
|
XQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
|
@ -163,6 +163,8 @@ public class UriResolverReaderRR {
|
||||||
try{
|
try{
|
||||||
String scope = "/gcube/devsec";
|
String scope = "/gcube/devsec";
|
||||||
|
|
||||||
|
ScopeProvider.instance.set("/gcube/devsec");
|
||||||
|
|
||||||
Workspace workspace = HomeLibrary
|
Workspace workspace = HomeLibrary
|
||||||
.getHomeManagerFactory()
|
.getHomeManagerFactory()
|
||||||
.getHomeManager()
|
.getHomeManager()
|
||||||
|
@ -202,7 +204,7 @@ public class UriResolverReaderRR {
|
||||||
// String smpUri = "smp://Home/test.user/Workspace/bla8200ceb0-c525-40e6-bad1-a63f83811d3d?5ezvFfBOLqb3YESyI/kesN4T+ZD0mtmc/4sZ0vGMrl0lgx7k85j8o2Q1vF0ezJi/xIGDhncO9jOkV1T8u6Db7GZ/4ePgMws8Jxu8ierJajHBd20bUotElPG3BVG0ODMHf1ztm6rKJIAeb9R/0FEIDQ==";
|
// String smpUri = "smp://Home/test.user/Workspace/bla8200ceb0-c525-40e6-bad1-a63f83811d3d?5ezvFfBOLqb3YESyI/kesN4T+ZD0mtmc/4sZ0vGMrl0lgx7k85j8o2Q1vF0ezJi/xIGDhncO9jOkV1T8u6Db7GZ/4ePgMws8Jxu8ierJajHBd20bUotElPG3BVG0ODMHf1ztm6rKJIAeb9R/0FEIDQ==";
|
||||||
|
|
||||||
|
|
||||||
UrlShortener urlShortner = new UrlShortener();
|
UrlShortener urlShortner = new UrlShortener(scope);
|
||||||
|
|
||||||
String shortUrl = urlShortner.shorten(url);
|
String shortUrl = urlShortner.shorten(url);
|
||||||
System.out.println("url shortUrl: "+shortUrl);
|
System.out.println("url shortUrl: "+shortUrl);
|
||||||
|
|
Loading…
Reference in New Issue