Skip to content

Commit d2ae10e

Browse files
Updated frontend.
Updated to have option in configuration to use Google Drive API Implemented provider to use files from Google Drive using it's API (simple sample)
1 parent 5956196 commit d2ae10e

31 files changed

Lines changed: 1196 additions & 509 deletions

Demos/Dropwizard/client/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,24 @@
3737
"@angular/platform-browser": "^8.2.14",
3838
"@angular/platform-browser-dynamic": "^8.2.14",
3939
"@angular/router": "^8.2.14",
40-
"@groupdocs.examples.angular/comparison": "^0.5.5",
40+
"@groupdocs.examples.angular/comparison": "^0.8.80",
4141
"@nrwl/angular": "^8.8.2",
4242
"core-js": "^2.6.10",
4343
"rxjs": "~6.4.0",
4444
"zone.js": "^0.9.1"
4545
},
4646
"devDependencies": {
47-
"@angular-devkit/build-angular": "^0.800.1",
48-
"@angular/cli": "8.1.1",
47+
"@angular-devkit/build-angular": "^0.800.0",
48+
"@angular/cli": "8.0.0",
4949
"@angular/compiler-cli": "^8.2.14",
5050
"@angular/language-service": "^8.2.14",
51-
"@nrwl/cypress": "8.4.3",
52-
"@nrwl/jest": "8.4.3",
53-
"@nrwl/workspace": "8.4.3",
51+
"@nrwl/cypress": "8.2.0",
52+
"@nrwl/jest": "8.2.0",
53+
"@nrwl/workspace": "8.2.0",
5454
"@types/jest": "24.0.9",
5555
"@types/node": "~8.9.4",
5656
"codelyzer": "~5.0.1",
57-
"cypress": "3.4.0",
57+
"cypress": "~3.3.1",
5858
"dotenv": "6.2.0",
5959
"jest": "24.1.0",
6060
"jest-preset-angular": "7.0.0",

Demos/Dropwizard/configuration.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ server:
1414
# Application (global) configurations
1515
################################################
1616
application:
17-
# License path
18-
# Absolute or relative path to GroupDocs license file
19-
licensePath: ${LIC_PATH:-C:/GroupDocs.Total.Java.lic}
17+
# Absolute or relative path to GroupDocs license
18+
# Can be as a path to license file, to directory, in which license file is placed (*.lic) or url to download license file
19+
# Default value is `Licenses`
20+
licensePath: ${LIC_PATH:-}
2021
# Host name or ip for server instance
2122
hostAddress: ${HOST_ADDRESS:-}
2223

@@ -25,9 +26,9 @@ application:
2526
################################################
2627
common:
2728
# File rewriting on document uploading
28-
# Set false to keep both files
29+
# Set false to cancel uploading in case of existence of file with the same name
2930
# Set true to replace files with same name
30-
rewrite: true
31+
rewrite: ${REWRITE:-true}
3132
# Page navigation
3233
# Set false to disable document navigation (go to next, previous, last and first page)
3334
pageSelector: true
@@ -52,13 +53,52 @@ common:
5253
# GroupDocs.Comparison configurations
5354
################################################
5455
comparison:
55-
# Files directory path
56-
# Absolute or relative path to files directory
57-
filesDirectory: ${FILES_DIR:-DocumentSamples}
58-
# FResult files directory path
59-
# Absolute path to result files directory
60-
resultDirectory: ${RESULT_DIR:-DocumentSamples}
56+
# Files provider, where to get files to show them in browse dialog
57+
# Available values are `google` - using Google Drive API, `local` - using local directories
58+
filesProviderType: ${FILES_PROVIDER_TYPE:-local}
6159
# Result pages preload
6260
# How many pages from a result document should be loaded, remaining pages will be loaded on page scrolling
6361
# Set 0 to load all pages at once
64-
preloadResultPageCount: 2
62+
preloadResultPageCount: 0
63+
# Page width that will be used to resize preview images before displaying them
64+
# Default value is 768
65+
previewPageWidth: ${PREVIEW_PAGE_WIDTH:-}
66+
# Ratio to calculate height of preview images using width
67+
# Default value is 1.3
68+
previewPageRatio: ${PREVIEW_PAGE_RATIO:-}
69+
# Absolute or relative path to directory to save cache files
70+
# Default value is system temp directory. The path is always local
71+
cacheDirectory: ${CACHE_DIR:-}
72+
# Absolute or relative path to directory to save temporary files
73+
# Default value is system temp directory. The path is always local
74+
tempDirectory: ${TEMP_DIR:-}
75+
################################################
76+
# Local files provider Configuration
77+
################################################
78+
local:
79+
# Files directory path
80+
# Absolute or relative path to files directory, default value is `DocumentSamples`.
81+
filesDirectory: ${FILES_DIR:-DocumentSamples}
82+
# Result files directory path
83+
# Absolute or relative path to result files directory, default value is `DocumentSamples/Temp`.
84+
resultDirectory: ${RESULT_DIR:-}
85+
################################################
86+
# Google API files provider Configuration
87+
################################################
88+
google:
89+
# When false or empty, file with name `credentials.json` from resources will be used
90+
useCredentialsPath: ${USE_CREDENTIALS_PATH:-false}
91+
# When useCredentialsPath is true, this path will be used as a path to google credentials file (usually `credentials.json`)
92+
credentialsPath: ${CREDENTIALS_PATH:-}
93+
# Path to directory to save stored credentials. When empty, credentials will not be saved
94+
tokensDirectoryPath: ${TOKENS_DIRECTORY_PATH:-}
95+
# Client application name
96+
applicationName: ${APPLICATION_NAME:-GroupDocs.Comparison for Java Dropwizard sample}
97+
# Files access type, available options are `offline` and `online`.
98+
# Default value is `offline`
99+
accessType: offline
100+
# Port that will be used for Google Drive API authorization callback.
101+
# Default value is `8888`
102+
localServerReceiverPort: ${LOCAL_SERVER_RECEIVER_PORT:-8888}
103+
# user ID or null if not using a persisted credential store
104+
authorizationUserId: user

Demos/Dropwizard/pom.xml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,24 @@
9090
<artifactId>activation</artifactId>
9191
<version>1.1.1</version>
9292
</dependency>
93+
94+
<!-- Google API -->
95+
<dependency>
96+
<groupId>com.google.api-client</groupId>
97+
<artifactId>google-api-client</artifactId>
98+
<version>1.33.0</version>
99+
</dependency>
100+
<dependency>
101+
<groupId>com.google.apis</groupId>
102+
<artifactId>google-api-services-drive</artifactId>
103+
<version>v3-rev20211107-1.32.1</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>com.google.oauth-client</groupId>
107+
<artifactId>google-oauth-client-jetty</artifactId>
108+
<version>1.32.1</version>
109+
</dependency>
110+
93111
<dependency>
94112
<groupId>org.assertj</groupId>
95113
<artifactId>assertj-core</artifactId>
@@ -241,7 +259,7 @@
241259
<repository>
242260
<id>com.springsource.repository.bundles.external</id>
243261
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
244-
<url>http://repository.springsource.com/maven/bundles/external</url>
262+
<url>https://repository.springsource.com/maven/bundles/external</url>
245263
</repository>
246264
<repository>
247265
<id>maven.groupdocs.com</id>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.groupdocs.ui.common;
2+
3+
public interface Defaults {
4+
interface Application {
5+
String DEFAULT_LICENSE_PATH = "Licenses";
6+
String DEFAULT_LICENSE_EXTENSION = ".lic";
7+
}
8+
9+
interface Comparison {
10+
enum FilesProviderType {
11+
LOCAL, GOOGLE
12+
}
13+
14+
int DEFAULT_PRELOAD_RESULT_PAGE_COUNT = 2;
15+
int DEFAULT_PREVIEW_PAGE_WIDTH = 768;
16+
float DEFAULT_PREVIEW_PAGE_RATIO = 1.3F;
17+
FilesProviderType DEFAULT_FILES_PROVIDER_TYPE = FilesProviderType.LOCAL;
18+
}
19+
20+
interface Local {
21+
22+
String DEFAULT_FILES_DIRECTORY = "DocumentSamples";
23+
String DEFAULT_RESULT_DIRECTORY = "DocumentSamples/Temp";
24+
String DEFAULT_CACHE_DIRECTORY = System.getProperty("java.io.tmpdir");
25+
String DEFAULT_TEMP_DIRECTORY = System.getProperty("java.io.tmpdir");
26+
}
27+
28+
interface Google {
29+
30+
enum AccessType {
31+
OFFLINE, ONLINE
32+
}
33+
34+
int DEFAULT_LOCAL_SERVER_RECEIVER_PORT = 8888;
35+
AccessType DEFAULT_ACCESS_TYPE = AccessType.OFFLINE;
36+
String DEFAULT_CREDENTIALS_PATH = "credentials.json";
37+
}
38+
}

Demos/Dropwizard/src/main/java/com/groupdocs/ui/common/MainService.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import io.dropwizard.setup.Environment;
1717
import io.dropwizard.views.ViewBundle;
1818
import org.apache.commons.lang3.StringUtils;
19-
import org.eclipse.jetty.server.Handler;
2019
import org.eclipse.jetty.server.session.SessionHandler;
2120
import org.eclipse.jetty.servlets.CrossOriginFilter;
2221
import org.slf4j.Logger;
@@ -25,8 +24,6 @@
2524
import javax.imageio.ImageIO;
2625
import javax.servlet.DispatcherType;
2726
import javax.servlet.FilterRegistration;
28-
import javax.servlet.http.HttpSessionEvent;
29-
import javax.servlet.http.HttpSessionListener;
3027
import java.io.File;
3128
import java.util.EnumSet;
3229
import java.util.HashSet;

Demos/Dropwizard/src/main/java/com/groupdocs/ui/common/config/ApplicationConfiguration.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.groupdocs.ui.common.config;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.groupdocs.ui.common.Defaults;
45
import io.dropwizard.Configuration;
56
import org.apache.commons.lang3.StringUtils;
67

78
import javax.validation.Valid;
89

9-
import static com.groupdocs.ui.common.config.DefaultDirectories.defaultLicenseDirectory;
10-
import static com.groupdocs.ui.common.config.DefaultDirectories.relativePathToAbsolute;
11-
1210
/**
1311
* ApplicationConfiguration
1412
*
@@ -24,11 +22,7 @@ public class ApplicationConfiguration extends Configuration {
2422
private String hostAddress;
2523

2624
public String getLicensePath() {
27-
return licensePath;
28-
}
29-
30-
public void setLicensePath(String licensePath) {
31-
this.licensePath = StringUtils.isEmpty(licensePath) ? defaultLicenseDirectory() : relativePathToAbsolute(licensePath);
25+
return licensePath == null || StringUtils.isBlank(licensePath) ? Defaults.Application.DEFAULT_LICENSE_PATH : licensePath;
3226
}
3327

3428
public String getHostAddress() {

Demos/Dropwizard/src/main/java/com/groupdocs/ui/common/config/DefaultDirectories.java

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)