diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfig.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfig.java new file mode 100644 index 0000000..0a3edd8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfig.java @@ -0,0 +1,14 @@ +package org.gcube.portlets.user.cloudcomputing; + +public class CloudComputingConfig { + public String encoded_context = "%2Fgcube%2Fdevsec%2FdevVRE"; + public String gateway = "next.dev.d4science.org"; + + public String redirect_url = "https://next.dev.d4science.org/group/devvre/cloudcomputing"; + + public String auth_url = "https://accounts.dev.d4science.org/auth"; + public String ccp_url = "https://ccp.cloud-dev.d4science.org"; + // public String cdn_url = "https://cdn.cloud.d4science.org"; //"https://cdn.cloud-dev.d4science.org"; + public String cdn_url = "https://cdn.cloud-dev.d4science.org"; + +} diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfigPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfigPortlet.java new file mode 100644 index 0000000..dce4390 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/CloudComputingConfigPortlet.java @@ -0,0 +1,112 @@ +package org.gcube.portlets.user.cloudcomputing; + +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.common.portal.PortalContext; + +import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.util.PortalUtil; +import com.liferay.util.bridges.mvc.MVCPortlet; + +public class CloudComputingConfigPortlet extends MVCPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingConfigPortlet.class); + + public CloudComputingConfig getConfig() { + return new CloudComputingConfig(); + } + + private String getCurrentContext(RenderRequest request) { + long groupId = -1; + try { + groupId = PortalUtil.getScopeGroupId(request); + return getCurrentContext(groupId); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private String getCurrentContext(long groupId) { + try { + PortalContext pContext = PortalContext.getConfiguration(); + return pContext.getCurrentScope("" + groupId); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + @Override + public void render(RenderRequest renderRequest, RenderResponse renderResponse) + throws PortletException, IOException { + // GroupManager gm = new LiferayGroupManager(); + try { + + // String encoded_context = + // "%2Fd4science.research-infrastructures.eu%2FSoBigData%2FSoBigDataLab"; + // String gateway = "sobigdata.d4science.org"; + // String redirect_url = "https://sobigdata.d4science.org/group/sobigdatalab"; + // String url = "https://accounts.d4science.org/auth"; + + CloudComputingConfig config = getConfig(); + + renderRequest.setAttribute("encoded_context", config.encoded_context); + renderRequest.setAttribute("gateway", config.gateway); + renderRequest.setAttribute("redirect_url", config.redirect_url); + renderRequest.setAttribute("auth_url", config.auth_url); + renderRequest.setAttribute("ccp_url", config.ccp_url); + renderRequest.setAttribute("cdn_url", config.cdn_url); + + // User theUser = PortalUtil.getUser(renderRequest); + // String currentContext = getCurrentContext(renderRequest); + // ScopeBean bean = new ScopeBean(currentContext); + // String context; + // String excapedContext; + // String gateway; + // String redirect-url; + // String + + // List userContexts = new ArrayList(); + // List vreContexts = new ArrayList(); + // List userGroups = gm.listGroupsByUser(theUser.getUserId()); + // if (bean.is(Type.VRE)) { + // userContexts.add(currentContext); + // vreContexts.add(currentContext); + // } else { + // for (GCubeGroup g : userGroups) { + // // skipping these sites + // if (!(g.getFriendlyURL().equals("/guest") || + // g.getFriendlyURL().equals("/global"))) { + // if + // (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) + // { + // String context = gm.getInfrastructureScope(g.getGroupId()); + // userContexts.add(context); + // if (context.split("/").length == 4) { + // vreContexts.add(context); + // } + // } + // if (g.getParentGroupId() > 0) { + // String context = gm.getInfrastructureScope(g.getGroupId()); + // userContexts.add(context); + // if (context.split("/").length == 4) { + // vreContexts.add(context); + // } + // } + // } + // } + // } + // renderRequest.setAttribute("userGroups", userGroups); + // renderRequest.setAttribute("userContexts", userContexts); + // renderRequest.setAttribute("vreContexts", vreContexts); + } catch (Exception e) { + e.printStackTrace(); + } + super.render(renderRequest, renderResponse); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingBootPlatformPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingBootPlatformPortlet.java index 3a7aa07..3ac4441 100644 --- a/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingBootPlatformPortlet.java +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingBootPlatformPortlet.java @@ -1,119 +1,22 @@ package org.gcube.portlets.user.cloudcomputing.boot; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; -import org.gcube.common.portal.PortalContext; +import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet; import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.portal.model.User; -import com.liferay.portal.util.PortalUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -import org.gcube.common.scope.impl.ScopeBean; -import org.gcube.common.scope.impl.ScopeBean.Type; -import org.gcube.vomanagement.usermanagement.GroupManager; -import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager; -import org.gcube.vomanagement.usermanagement.model.GCubeGroup; +public class CloudComputingBootPlatformPortlet extends CloudComputingConfigPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil + .getLog(CloudComputingBootPlatformPortlet.class); -public class CloudComputingBootPlatformPortlet extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingBootPlatformPortlet.class); - - @Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException { - // GroupManager gm = new LiferayGroupManager(); - try { - - // String encoded_context = "%2Fd4science.research-infrastructures.eu%2FSoBigData%2FSoBigDataLab"; - // String gateway = "sobigdata.d4science.org"; - // String redirect_url = "https://sobigdata.d4science.org/group/sobigdatalab"; - // String url = "https://accounts.d4science.org/auth"; - - - String encoded_context = "%2Fgcube%2Fdevsec%2FdevVRE"; - String gateway = "next.dev.d4science.org"; - String redirect_url = "https://next.dev.d4science.org/group/devvre/cloudcomputing"; - String url = "https://accounts.dev.d4science.org/auth"; - - - renderRequest.setAttribute("encoded_context", encoded_context); - renderRequest.setAttribute("gateway", gateway); - renderRequest.setAttribute("redirect_url", redirect_url); - renderRequest.setAttribute("url", url); - - // User theUser = PortalUtil.getUser(renderRequest); - // String currentContext = getCurrentContext(renderRequest); - // ScopeBean bean = new ScopeBean(currentContext); - // String context; - // String excapedContext; - // String gateway; - // String redirect-url; - // String - - // List userContexts = new ArrayList(); - // List vreContexts = new ArrayList(); - // List userGroups = gm.listGroupsByUser(theUser.getUserId()); - // if (bean.is(Type.VRE)) { - // userContexts.add(currentContext); - // vreContexts.add(currentContext); - // } else { - // for (GCubeGroup g : userGroups) { - // // skipping these sites - // if (!(g.getFriendlyURL().equals("/guest") || - // g.getFriendlyURL().equals("/global"))) { - // if - // (g.getGroupName().equals(PortalContext.getConfiguration().getInfrastructureName())) - // { - // String context = gm.getInfrastructureScope(g.getGroupId()); - // userContexts.add(context); - // if (context.split("/").length == 4) { - // vreContexts.add(context); - // } - // } - // if (g.getParentGroupId() > 0) { - // String context = gm.getInfrastructureScope(g.getGroupId()); - // userContexts.add(context); - // if (context.split("/").length == 4) { - // vreContexts.add(context); - // } - // } - // } - // } - // } - // renderRequest.setAttribute("userGroups", userGroups); - // renderRequest.setAttribute("userContexts", userContexts); - // renderRequest.setAttribute("vreContexts", vreContexts); - } catch (Exception e) { - e.printStackTrace(); - } super.render(renderRequest, renderResponse); } - private String getCurrentContext(RenderRequest request) { - long groupId = -1; - try { - groupId = PortalUtil.getScopeGroupId(request); - return getCurrentContext(groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - private String getCurrentContext(long groupId) { - try { - PortalContext pContext = PortalContext.getConfiguration(); - return pContext.getCurrentScope("" + groupId); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - } diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingConfigPorlter b/src/main/java/org/gcube/portlets/user/cloudcomputing/boot/CloudComputingConfigPorlter new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/edit/CloudComputingMethodEditorPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/edit/CloudComputingMethodEditorPortlet.java index 9588a32..95ab122 100644 --- a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/edit/CloudComputingMethodEditorPortlet.java +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/edit/CloudComputingMethodEditorPortlet.java @@ -1,10 +1,23 @@ package org.gcube.portlets.user.cloudcomputing.methods.edit; +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet; + import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -public class CloudComputingMethodEditorPortlet extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingMethodEditorPortlet.class); +public class CloudComputingMethodEditorPortlet extends CloudComputingConfigPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil + .getLog(CloudComputingMethodEditorPortlet.class); + + public void render(RenderRequest renderRequest, RenderResponse renderResponse) + throws PortletException, IOException { + super.render(renderRequest, renderResponse); + } } diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/exec/CloudComputingMethodExecutorPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/exec/CloudComputingMethodExecutorPortlet.java index 7e25400..c8c6f7d 100644 --- a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/exec/CloudComputingMethodExecutorPortlet.java +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/exec/CloudComputingMethodExecutorPortlet.java @@ -1,10 +1,23 @@ package org.gcube.portlets.user.cloudcomputing.methods.exec; +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet; + import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -public class CloudComputingMethodExecutorPortlet extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingMethodExecutorPortlet.class); +public class CloudComputingMethodExecutorPortlet extends CloudComputingConfigPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil + .getLog(CloudComputingMethodExecutorPortlet.class); + + public void render(RenderRequest renderRequest, RenderResponse renderResponse) + throws PortletException, IOException { + super.render(renderRequest, renderResponse); + } } diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/list/CloudComputingMethodListPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/list/CloudComputingMethodListPortlet.java index f81feaa..f109d77 100644 --- a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/list/CloudComputingMethodListPortlet.java +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/list/CloudComputingMethodListPortlet.java @@ -1,10 +1,24 @@ + package org.gcube.portlets.user.cloudcomputing.methods.list; +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet; + import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -public class CloudComputingMethodListPortlet extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingMethodListPortlet.class); +public class CloudComputingMethodListPortlet extends CloudComputingConfigPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil + .getLog(CloudComputingMethodListPortlet.class); + + public void render(RenderRequest renderRequest, RenderResponse renderResponse) + throws PortletException, IOException { + super.render(renderRequest, renderResponse); + } } diff --git a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/monitor/CloudComputingMethodMonitorPortlet.java b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/monitor/CloudComputingMethodMonitorPortlet.java index d4c6963..41c2d69 100644 --- a/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/monitor/CloudComputingMethodMonitorPortlet.java +++ b/src/main/java/org/gcube/portlets/user/cloudcomputing/methods/monitor/CloudComputingMethodMonitorPortlet.java @@ -1,10 +1,23 @@ package org.gcube.portlets.user.cloudcomputing.methods.monitor; +import java.io.IOException; + +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; + +import org.gcube.portlets.user.cloudcomputing.CloudComputingConfigPortlet; + import com.liferay.portal.kernel.log.LogFactoryUtil; -import com.liferay.util.bridges.mvc.MVCPortlet; -public class CloudComputingMethodMonitorPortlet extends MVCPortlet { - private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil.getLog(CloudComputingMethodMonitorPortlet.class); +public class CloudComputingMethodMonitorPortlet extends CloudComputingConfigPortlet { + private static com.liferay.portal.kernel.log.Log _log = LogFactoryUtil + .getLog(CloudComputingMethodMonitorPortlet.class); + + public void render(RenderRequest renderRequest, RenderResponse renderResponse) + throws PortletException, IOException { + super.render(renderRequest, renderResponse); + } } diff --git a/src/main/webapp/html/boot/boot.jsp b/src/main/webapp/html/boot/boot.jsp index 3f661c5..2577f93 100644 --- a/src/main/webapp/html/boot/boot.jsp +++ b/src/main/webapp/html/boot/boot.jsp @@ -1,17 +1,34 @@ <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> <%@include file="../init.jsp" %> +<% +pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context")); +pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url")); +pageContext.setAttribute("auth_url", request.getAttribute("auth_url")); +pageContext.setAttribute("ccp_url", +request.getAttribute("ccp_url")); +pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url")); %> - - - + + +
- - + +
-Boot Portlet \ No newline at end of file + +Boot Portlet + +
    +
  • encoded_context = ${encoded_context}
  • +
  • gateway = ${gateway}
  • +
  • redirect_url = ${redirect_url}
  • +
  • auth_url = ${auth_url}
  • +
  • ccp_url = ${ccp_url}
  • +
  • cdn_url = ${cdn_url}
  • +
diff --git a/src/main/webapp/html/methods/edit/methodeditor.jsp b/src/main/webapp/html/methods/edit/methodeditor.jsp index a790ad3..c33b4ca 100644 --- a/src/main/webapp/html/methods/edit/methodeditor.jsp +++ b/src/main/webapp/html/methods/edit/methodeditor.jsp @@ -1,15 +1,23 @@ <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> <%@include file="../../init.jsp"%> +<% +pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context")); +pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url")); +pageContext.setAttribute("auth_url", request.getAttribute("auth_url")); +pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url")); +pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url")); %> + - - + +
- - - - + + + +
+ Method Editor Form Portlet \ No newline at end of file diff --git a/src/main/webapp/html/methods/exec/methodexecutor.jsp b/src/main/webapp/html/methods/exec/methodexecutor.jsp index 3daa15e..108ec0c 100644 --- a/src/main/webapp/html/methods/exec/methodexecutor.jsp +++ b/src/main/webapp/html/methods/exec/methodexecutor.jsp @@ -1,13 +1,20 @@ <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> <%@include file="../../init.jsp"%> +<% +pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context")); +pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url")); +pageContext.setAttribute("auth_url", request.getAttribute("auth_url")); +pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url")); +pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url")); %> +
- - - - - + + + + +
diff --git a/src/main/webapp/html/methods/list/methodslist.jsp b/src/main/webapp/html/methods/list/methodslist.jsp index c6aee14..afc1c0c 100644 --- a/src/main/webapp/html/methods/list/methodslist.jsp +++ b/src/main/webapp/html/methods/list/methodslist.jsp @@ -1,11 +1,17 @@ <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - <%@include file="../../init.jsp" %> +<%@include file="../../init.jsp" %> -
- - - -
+<% +pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context")); +pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url")); +pageContext.setAttribute("auth_url", request.getAttribute("auth_url")); +pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url")); +pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url")); %> - Method List Portlet \ No newline at end of file +
+ + + +
+Method List Portlet \ No newline at end of file diff --git a/src/main/webapp/html/methods/monitor/methodmonitor.jsp b/src/main/webapp/html/methods/monitor/methodmonitor.jsp index a717a41..1c31f3f 100644 --- a/src/main/webapp/html/methods/monitor/methodmonitor.jsp +++ b/src/main/webapp/html/methods/monitor/methodmonitor.jsp @@ -1,9 +1,16 @@ <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> - <%@include file="../../init.jsp" %> +<%@include file="../../init.jsp" %> -
- - -
+<% +pageContext.setAttribute("encoded_context", request.getAttribute("encoded_context")); +pageContext.setAttribute("redirect_url", request.getAttribute("redirect_url")); +pageContext.setAttribute("auth_url", request.getAttribute("auth_url")); +pageContext.setAttribute("ccp_url", request.getAttribute("ccp_url")); +pageContext.setAttribute("cdn_url", request.getAttribute("cdn_url")); %> - Method List Portlet \ No newline at end of file +
+ + +
+ +Method List Portlet \ No newline at end of file