refs:3772: SAI - Create a github project importer
https://support.d4science.org/issues/3772 Fixed directory explorer git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/github-connector@129135 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d0918a9f60
commit
a5cd17254d
47
pom.xml
47
pom.xml
|
@ -70,6 +70,11 @@
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>xerces</groupId>
|
||||||
|
<artifactId>xerces</artifactId>
|
||||||
|
<version>2.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Storage -->
|
<!-- Storage -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -100,6 +105,7 @@
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Authorization -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>common-authorization</artifactId>
|
<artifactId>common-authorization</artifactId>
|
||||||
|
@ -136,9 +142,13 @@
|
||||||
<groupId>javax.portlet</groupId>
|
<groupId>javax.portlet</groupId>
|
||||||
<artifactId>portlet-api</artifactId>
|
<artifactId>portlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- PORTAL -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>accesslogger</artifactId>
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -147,25 +157,17 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>common-scope-maps</artifactId>
|
<artifactId>aslcore</artifactId>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.dvos</groupId>
|
||||||
<artifactId>aslcore</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>xalan</artifactId>
|
|
||||||
<groupId>xalan</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Authorization -->
|
<!-- Authorization -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
@ -179,7 +181,7 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- GCube Widget -->
|
<!-- GCube Widgets -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
|
@ -193,16 +195,6 @@
|
||||||
<version>[0.0.0-SNAPSHOT,1.0.0-SNAPSHOT)</version>
|
<version>[0.0.0-SNAPSHOT,1.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
|
||||||
<artifactId>aslsocial</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Storage -->
|
<!-- Storage -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.contentmanagement</groupId>
|
<groupId>org.gcube.contentmanagement</groupId>
|
||||||
|
@ -267,7 +259,7 @@
|
||||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
<artifactId>gwt-log</artifactId>
|
<artifactId>gwt-log</artifactId>
|
||||||
<version>${gwtLogVersion}</version>
|
<version>${gwtLogVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
@ -384,6 +376,7 @@
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>gCubeExternal</id>
|
<id>gCubeExternal</id>
|
||||||
|
@ -400,7 +393,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>2.6.0-SNAPSHOT</version>
|
<version>LATEST</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.widgets.githubconnector.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.Callback;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.DialogBox;
|
||||||
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ProgressDialog extends DialogBox implements ClickHandler {
|
||||||
|
private Callback<Void, Void> callback;
|
||||||
|
protected HTML msg;
|
||||||
|
protected double msgMinWidth=200;
|
||||||
|
protected double msgMinHeight=30;
|
||||||
|
|
||||||
|
|
||||||
|
public ProgressDialog(String title, String text) {
|
||||||
|
init(title, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressDialog(String title, String text, Callback<Void, Void> callback) {
|
||||||
|
init(title, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(String title, String text) {
|
||||||
|
setText(title);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button closeButton = new Button("Close", this);
|
||||||
|
msg = new HTML(text, true);
|
||||||
|
msg.getElement().getStyle().setProperty("minWidth", msgMinWidth, Unit.PX);
|
||||||
|
msg.getElement().getStyle().setProperty("minHeight",msgMinHeight, Unit.PX);
|
||||||
|
|
||||||
|
DockPanel dock = new DockPanel();
|
||||||
|
dock.setSpacing(4);
|
||||||
|
|
||||||
|
|
||||||
|
dock.add(closeButton, DockPanel.SOUTH);
|
||||||
|
dock.add(msg, DockPanel.CENTER);
|
||||||
|
|
||||||
|
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_CENTER);
|
||||||
|
dock.setWidth("100%");
|
||||||
|
setWidget(dock);
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
if(callback!=null){
|
||||||
|
callback.onSuccess(null);
|
||||||
|
}
|
||||||
|
hide();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ public class GitHubConnectorServiceImpl extends RemoteServiceServlet implements
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
|
SessionUtil.getToken(aslSession);
|
||||||
logger.debug("hello()");
|
logger.debug("hello()");
|
||||||
UserInfo userInfo = new UserInfo(aslSession.getUsername(),
|
UserInfo userInfo = new UserInfo(aslSession.getUsername(),
|
||||||
aslSession.getGroupId(), aslSession.getGroupName(),
|
aslSession.getGroupId(), aslSession.getGroupName(),
|
||||||
|
@ -72,6 +73,7 @@ public class GitHubConnectorServiceImpl extends RemoteServiceServlet implements
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
|
SessionUtil.getToken(aslSession);
|
||||||
logger.debug("getRepository(): " + gitHubCredential);
|
logger.debug("getRepository(): " + gitHubCredential);
|
||||||
GitConnectorService gitConnectorService = new GitConnectorService(
|
GitConnectorService gitConnectorService = new GitConnectorService(
|
||||||
aslSession.getUsername(), gitHubCredential);
|
aslSession.getUsername(), gitHubCredential);
|
||||||
|
@ -92,6 +94,7 @@ public class GitHubConnectorServiceImpl extends RemoteServiceServlet implements
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
|
SessionUtil.getToken(aslSession);
|
||||||
logger.debug("cloneRepository(): " + gitHubCloneSession);
|
logger.debug("cloneRepository(): " + gitHubCloneSession);
|
||||||
GitConnectorService gitConnectorService = new GitConnectorService(
|
GitConnectorService gitConnectorService = new GitConnectorService(
|
||||||
aslSession.getUsername(),
|
aslSession.getUsername(),
|
||||||
|
|
|
@ -167,10 +167,10 @@ public class GitConnectorService {
|
||||||
+ destinationFolderId + ", folderName="
|
+ destinationFolderId + ", folderName="
|
||||||
+ contents.getName() + ", folderDescription="
|
+ contents.getName() + ", folderDescription="
|
||||||
+ contents.getName() + "]");
|
+ contents.getName() + "]");
|
||||||
StorageUtil.createFolderOnWorkspace(userName, destinationFolderId,
|
String internalFolderId=StorageUtil.createFolderOnWorkspace(userName, destinationFolderId,
|
||||||
contents.getName(), contents.getName());
|
contents.getName(), contents.getName());
|
||||||
|
|
||||||
createContent(destinationFolderId, repository, contents.getPath());
|
createContent(internalFolderId, repository, contents.getPath());
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">
|
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN"
|
||||||
|
"http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||||
<display>
|
<display>
|
||||||
<category name="gCube Applications">
|
<category name="gCube Applications">
|
||||||
<portlet id="GitHubConnector" />
|
<portlet id="GitHubConnector" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
|
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN"
|
||||||
|
"http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||||
<liferay-portlet-app>
|
<liferay-portlet-app>
|
||||||
<portlet>
|
<portlet>
|
||||||
<portlet-name>GitHubConnector</portlet-name>
|
<portlet-name>GitHubConnector</portlet-name>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
version="3.0">
|
version="3.0">
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>GitHubConnectorServlet</servlet-name>
|
<servlet-name>GitHubConnectorServlet</servlet-name>
|
||||||
|
|
Loading…
Reference in New Issue