config parametrica, per ora bindata

This commit is contained in:
Alfredo Oliviero 2024-05-29 13:28:41 +02:00
parent 812594ce70
commit 8056e75d52
13 changed files with 274 additions and 147 deletions

View File

@ -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";
}

View File

@ -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<String> userContexts = new ArrayList<String>();
// List<String> vreContexts = new ArrayList<String>();
// List<GCubeGroup> 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);
}
}

View File

@ -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<String> userContexts = new ArrayList<String>();
// List<String> vreContexts = new ArrayList<String>();
// List<GCubeGroup> 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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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")); %>
<script src="https://cdn.cloud.d4science.org/common/js/keycloak.js" type="text/javascript"></script>
<script src="https://cdn.cloud.d4science.org/common/js/bss-min-1.2.6.js"></script>
<link href="https://cdn.cloud.d4science.org/ccp/css/common.css" rel="stylesheet" />
<script src="${cdn_url}/common/js/keycloak.js" type="text/javascript"></script>
<script src="${cdn_url}/common/js/bss-min-1.2.6.js"></script>
<link href="${cdn_url}/ccp/css/common.css" rel="stylesheet" />
<div>
<d4s-boot-2 context="%2Fgcube%2Fdevsec%2FdevVRE"
gateway="next.dev.d4science.org"
redirect-url="https://next.dev.d4science.org/group/devvre/cloudcomputing"
url="https://accounts.dev.d4science.org/auth">
<script src="https://cdn.cloud.d4science.org/boot/d4s-boot.js"></script>
<d4s-boot-2 context="${encoded_context}"
gateway="${gateway}"
redirect-url="${redirect_url}"
url="${auth_url}"/>
<script src="${cdn_url}/boot/d4s-boot.js"></script>
</d4s-boot-2>
</div>
Boot Portlet
<ul>
<li> encoded_context = ${encoded_context}</li>
<li> gateway = ${gateway}</li>
<li> redirect_url = ${redirect_url}</li>
<li> auth_url = ${auth_url}</li>
<li> ccp_url = ${ccp_url}</li>
<li> cdn_url = ${cdn_url}</li>
</ul>

View File

@ -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")); %>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<script src="https://cdn.cloud.d4science.org/ccp/js/inputwidgetcontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/storage/d4s-storage.js"></script>
<script src="${cdn_url}/ccp/js/inputwidgetcontroller.js"></script>
<script src="${cdn_url}/storage/d4s-storage.js"></script>
<div>
<d4s-ccp-methodeditor serviceurl="https://ccp.cloud-dev.d4science.org">
<script src="https://cdn.cloud.d4science.org/ccp/js/methodeditorcontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/inputwidgeteditorcontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/outputwidgeteditorcontroller.js"></script>
<d4s-ccp-methodeditor serviceurl="${ccp_url}">
<script src="${cdn_url}/ccp/js/methodeditorcontroller.js"></script>
<script src="${cdn_url}/ccp/js/inputwidgeteditorcontroller.js"></script>
<script src="${cdn_url}/ccp/js/outputwidgeteditorcontroller.js"></script>
</d4s-ccp-methodeditor>
</div>
Method Editor Form Portlet

View File

@ -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")); %>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<div>
<d4s-ccp-executionform serviceurl="https://ccp.cloud-dev.d4science.org">
<script src="https://cdn.cloud.d4science.org/storage/d4s-storage.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/inputwidgetcontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/outputwidgetcontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/executionformcontroller.js"></script>
<d4s-ccp-executionform serviceurl="${ccp_url}">
<script src="${cdn_url}/storage/d4s-storage.js"></script>
<script src="${cdn_url}/ccp/js/inputwidgetcontroller.js"></script>
<script src="${cdn_url}/ccp/js/outputwidgetcontroller.js"></script>
<script src="${cdn_url}/ccp/js/executionformcontroller.js"></script>
</d4s-ccp-executionform>
</div>

View File

@ -1,11 +1,17 @@
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@include file="../../init.jsp" %>
<%@include file="../../init.jsp" %>
<div>
<d4s-ccp-methodlist allow-execute="true" archive="true"
serviceurl="https://ccp.cloud-dev.d4science.org">
<script src="https://cdn.cloud.d4science.org/ccp/js/methodlistcontroller.js"></script>
</d4s-ccp-methodlist>
</div>
<%
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
<div>
<d4s-ccp-methodlist allow-execute="true" archive="true"
serviceurl="${ccp_url}">
<script src="${cdn_url}/ccp/js/methodlistcontroller.js"></script>
</d4s-ccp-methodlist>
</div>
Method List Portlet

View File

@ -1,9 +1,16 @@
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@include file="../../init.jsp" %>
<%@include file="../../init.jsp" %>
<div><d4s-ccp-executionhistory archive="true" serviceurl="https://ccp.cloud-dev.d4science.org">
<script src="https://cdn.cloud.d4science.org/ccp/js/executionhistorycontroller.js"></script>
<script src="https://cdn.cloud.d4science.org/ccp/js/logterminalcontroller.js"></script>
</d4s-ccp-executionhistory></div>
<%
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
<div><d4s-ccp-executionhistory archive="true" serviceurl="${ccp_url}">
<script src="${cdn_url}/ccp/js/executionhistorycontroller.js"></script>
<script src="${cdn_url}/ccp/js/logterminalcontroller.js"></script>
</d4s-ccp-executionhistory></div>
Method List Portlet