diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..0f4a4c2 --- /dev/null +++ b/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..22f8c1e --- /dev/null +++ b/.project @@ -0,0 +1,38 @@ + + + share-latex-wrapper + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + com.liferay.ide.core.liferayNature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..f179e11 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..8fb0e26 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..69c31cd --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.jst.jsp.core.prefs b/.settings/org.eclipse.jst.jsp.core.prefs new file mode 100644 index 0000000..3a5c98d --- /dev/null +++ b/.settings/org.eclipse.jst.jsp.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +validateFragments=false +validation.use-project-settings=true diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..e6f7678 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles=Liferay-v6.2-CE-(Tomcat-7)-(2) +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..f771b20 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..594f2d0 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/.tern-project b/.tern-project new file mode 100644 index 0000000..d7fbf24 --- /dev/null +++ b/.tern-project @@ -0,0 +1,23 @@ +{ + "plugins": { + "guess-types": { + + }, + "outline": { + + }, + "liferay": { + + }, + "yui3": { + + }, + "aui2.0.x": { + + } + }, + "libs": [ + "ecma5", + "browser" + ] +} \ No newline at end of file diff --git a/distro/LICENSE b/distro/LICENSE new file mode 100644 index 0000000..2d9616a --- /dev/null +++ b/distro/LICENSE @@ -0,0 +1 @@ +${gcube.license} \ No newline at end of file diff --git a/distro/README b/distro/README new file mode 100644 index 0000000..b13a32d --- /dev/null +++ b/distro/README @@ -0,0 +1,62 @@ +The gCube System - ${name} +-------------------------------------------------- + +${description} + + +${gcube.description} + +${gcube.funding} + + +Version +-------------------------------------------------- + +${version} (${buildDate}) + +Please see the file named "changelog.xml" in this directory for the release notes. + + +Authors +-------------------------------------------------- + +* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + +Maintainers +----------- + +* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + +Download information +-------------------------------------------------- + +Source code is available from SVN: + ${scm.url} + +Binaries can be downloaded from the gCube website: + ${gcube.website} + + +Installation +-------------------------------------------------- + +Installation documentation is available on-line in the gCube Wiki: + ${gcube.wikiRoot} + +Documentation +-------------------------------------------------- + +Documentation is available on-line in the gCube Wiki: + ${gcube.wikiRoot} + +Support +-------------------------------------------------- + +Bugs and support requests can be reported in the gCube issue tracking tool: + ${gcube.issueTracking} + + +Licensing +-------------------------------------------------- + +This software is licensed under the terms you may find in the file named "LICENSE" in this directory. \ No newline at end of file diff --git a/distro/changelog.xml b/distro/changelog.xml new file mode 100644 index 0000000..5e026b4 --- /dev/null +++ b/distro/changelog.xml @@ -0,0 +1,6 @@ + + + First Release + + diff --git a/distro/descriptor.xml b/distro/descriptor.xml new file mode 100644 index 0000000..b3f5628 --- /dev/null +++ b/distro/descriptor.xml @@ -0,0 +1,31 @@ + + servicearchive + + tar.gz + + / + + + ${distroDirectory} + / + true + + README + LICENSE + changelog.xml + profile.xml + + 755 + true + + + + + target/${build.finalName}.${project.packaging} + /${artifactId} + + + \ No newline at end of file diff --git a/distro/profile.xml b/distro/profile.xml new file mode 100644 index 0000000..51c3b6b --- /dev/null +++ b/distro/profile.xml @@ -0,0 +1,25 @@ + + + + Service + + ${description} + PortletUser + ${artifactId} + ${version} + + + ${artifactId} + ${version} + + ${groupId} + ${artifactId} + ${version} + + + target/${build.finalName}.war + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2376a12 --- /dev/null +++ b/pom.xml @@ -0,0 +1,140 @@ + + +4.0.0 + org.gcube.portlets.user + sharelatex-wrapper-portlet + war + ShareLatexWrapper Portlet + 1.0.0-SNAPSHOT + + + + com.liferay.maven.plugins + liferay-maven-plugin + ${liferay.maven.plugin.version} + + + generate-sources + + build-css + + + + + ${liferay.auto.deploy.dir} + ${liferay.app.server.deploy.dir} + ${liferay.app.server.lib.global.dir} + ${liferay.app.server.portal.dir} + ${liferay.version} + portlet + + + + maven-compiler-plugin + 2.5 + + UTF-8 + 1.6 + 1.6 + + + + maven-resources-plugin + 2.5 + + UTF-8 + + + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + + + + + org.gcube.resources.discovery + ic-client + provided + + + org.gcube.dvos + usermanagement-core + provided + + + org.gcube.common + authorization-client + provided + + + org.gcube.common + common-authorization + provided + + + com.liferay.portal + portal-service + ${liferay.version} + provided + + + com.liferay.portal + util-bridges + ${liferay.version} + provided + + + com.liferay.portal + util-taglib + ${liferay.version} + provided + + + com.liferay.portal + util-java + ${liferay.version} + provided + + + javax.portlet + portlet-api + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.servlet.jsp + jsp-api + 2.0 + provided + + + + + Liferay-v6.2-CE-(Tomcat-7)-(2) + + 6.2.5 + 6.2.5 + /Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext + /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/ShareLatexPortlet.java b/src/main/java/org/gcube/portlets/user/ShareLatexPortlet.java new file mode 100644 index 0000000..240beb5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/ShareLatexPortlet.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user; + +import com.liferay.util.bridges.mvc.MVCPortlet; + +/** + * Portlet implementation class ShareLatexPortlet + */ +public class ShareLatexPortlet extends MVCPortlet { + + +} diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml new file mode 100644 index 0000000..9e92657 --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-display.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties new file mode 100644 index 0000000..c33c6aa --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -0,0 +1,9 @@ +name=ShareLatexWrapper +module-group-id=liferay +module-incremental-version=2 +tags= +short-description= +change-log= +page-url=http://www.gcube-system.org +author=M. Assante +licenses=EUPL diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml new file mode 100644 index 0000000..0972b6c --- /dev/null +++ b/src/main/webapp/WEB-INF/liferay-portlet.xml @@ -0,0 +1,30 @@ + + + + + + share-latex + /icon.png + /css/main.css + + /js/main.js + + share-latex-portlet + + + administrator + Administrator + + + guest + Guest + + + power-user + Power User + + + user + User + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml new file mode 100644 index 0000000..69d1cac --- /dev/null +++ b/src/main/webapp/WEB-INF/portlet.xml @@ -0,0 +1,28 @@ + + + + + share-latex + Share Latex Wrapper + + org.gcube.portlets.user.ShareLatexPortlet + + + view-template + /html/sharelatex/view.jsp + + 0 + + text/html + view + + + Share Latex + Share Latex + + + + administrator + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..7d8c082 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/html/sharelatex/view.jsp b/src/main/webapp/html/sharelatex/view.jsp new file mode 100644 index 0000000..0c8f0f3 --- /dev/null +++ b/src/main/webapp/html/sharelatex/view.jsp @@ -0,0 +1,70 @@ +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%> +<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%> +<%@ page import="org.gcube.resources.discovery.icclient.ICFactory.*"%> +<%@ page import="org.gcube.common.resources.gcore.*"%> +<%@ page import="org.gcube.common.scope.api.ScopeProvider"%> +<%@ page import="org.gcube.resources.discovery.client.api.*"%> +<%@ page import="org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager"%> +<%@ page import="org.gcube.common.authorization.library.provider.UserInfo"%> + + + +<%@ page + import="static org.gcube.resources.discovery.icclient.ICFactory.clientFor"%> +<%@ page + import="static org.gcube.resources.discovery.icclient.ICFactory.queryFor"%> + <%@ page + import="static org.gcube.common.authorization.client.Constants.authorizationService"%> + + + + +<% + String SERVICE_NAME = "ShareLatex"; + String SERVICE_CLASS = "DataAccess"; + String ENTRY_NAME = "org.gcube.data.access.sharelatex.connector.Connector"; + long groupId = com.liferay.portal.util.PortalUtil.getScopeGroupId(request); + String username = com.liferay.portal.util.PortalUtil.getUser(request).getScreenName(); + String scope = new LiferayGroupManager().getInfrastructureScope(groupId);; + //set the context for this resource + ScopeProvider.instance.set(scope); + + + + //construct the xquery + org.gcube.resources.discovery.client.queries.api.SimpleQuery query = queryFor(GCoreEndpoint.class); + query.addCondition("$resource/Profile/ServiceName/text() eq '" + SERVICE_NAME + "'"); + query.addCondition("$resource/Profile/ServiceClass/text() eq '" + SERVICE_CLASS + "'"); + + org.gcube.resources.discovery.client.api.DiscoveryClient client = clientFor( + GCoreEndpoint.class); + java.util.List conf = client.submit(query); + if (conf == null || conf.isEmpty()) { + out.print("No gCore resource named " + SERVICE_NAME + " is present in the scope " + scope + ""); + } else { + java.util.List userRoles = new java.util.ArrayList(); + String DEFAULT_ROLE = "OrganizationMember"; + userRoles.add(DEFAULT_ROLE); + String token = authorizationService().generateUserToken(new UserInfo(username, userRoles), scope); + + GCoreEndpoint re2s = conf.get(0); + java.util.Iterator it = re2s.profile().endpoints().iterator(); + String uriService = ""; + while (it.hasNext()) { + org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint ep = it.next(); + if (ep.name().compareTo(ENTRY_NAME)==0) { + uriService = ep.uri().toString(); + System.out.println(" ** Found uriService for "+ENTRY_NAME+"="+uriService); + break; + } + } + String url = uriService+"/connect?gcube-token="+token; + %> + +

If no new window appears, please click here to open the ShareLaTeX Editor

+ <% + } + + +%> + diff --git a/src/main/webapp/icon.png b/src/main/webapp/icon.png new file mode 100644 index 0000000..807b862 Binary files /dev/null and b/src/main/webapp/icon.png differ diff --git a/src/main/webapp/js/main.js b/src/main/webapp/js/main.js new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/view.jsp b/src/main/webapp/view.jsp new file mode 100644 index 0000000..9652497 --- /dev/null +++ b/src/main/webapp/view.jsp @@ -0,0 +1,21 @@ +<%-- +/** + * Copyright (c) 2000-present Liferay, Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. + */ +--%> + +<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %> + + + +This is the ShareLatexWrapper. \ No newline at end of file