Skip to content

Commit 215570a

Browse files
committed
2 parents 9db0194 + bd77039 commit 215570a

23 files changed

+1275
-1297
lines changed

Changelog.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Changelog for nextcloud api
2-
## Version 13.1.0
3-
- 2024-05-07
4-
- Release 13.1.0
5-
- Merged enhancements and cleanups (Thanks to mathiasbosman)
2+
## Version 13.0.2
3+
- 2024-03-16
4+
- Typo fixes
5+
- Javadoc url's
6+
- Modifiers should be declared in the correct order
7+
- Try-with resources
8+
- Use constants where possible
9+
- Removed redundant Exception throwing
10+
- Simplified assertions in tests
611

712
## Version 13.0.1
813
- 2023-09-29

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.aarboard.nextcloud</groupId>
55
<artifactId>nextcloud-api</artifactId>
6-
<version>13.1.0-SNAPSHOT</version>
6+
<version>13.1.0</version>
77
<packaging>jar</packaging>
88
<properties>
99
<!-- compile time dependencies -->

src/main/java/org/aarboard/nextcloud/api/NextcloudConnector.java

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
public class NextcloudConnector {
4343

44-
private final ServerConfig _serverConfig;
44+
private final ServerConfig serverConfig;
4545
private final ProvisionConnector pc;
4646
private final FilesharingConnector fc;
4747
private final ConfigConnector cc;
@@ -73,7 +73,7 @@ public NextcloudConnector(String serverName, boolean useHTTPS, int port, String
7373

7474
/**
7575
* @param serviceUrl url of the nextcloud instance, e.g.
76-
* https://nextcloud.instance.com:8443/cloud
76+
* <a href="https://nextcloud.instance.com:8443/cloud">...</a>
7777
* @param loginName User for login
7878
* @param password Password for login
7979
*/
@@ -83,32 +83,32 @@ public NextcloudConnector(String serviceUrl, String loginName, String password)
8383

8484
/**
8585
* @param serviceUrl url of the nextcloud instance, e.g.
86-
* https://nextcloud.instance.com:8443/cloud
86+
* <a href="https://nextcloud.instance.com:8443/cloud">...</a>
8787
* @param bearerToken Bearer token for login
8888
*/
8989
public NextcloudConnector(String serviceUrl, String bearerToken) {
9090
this(serviceUrl, new AuthenticationConfig(bearerToken));
9191
}
9292

9393
/**
94-
* @param serviceUrl url of the nextcloud instance, e.g.
95-
* https://nextcloud.instance.com:8443/cloud
94+
* @param originalServiceUrl url of the nextcloud instance, e.g.
95+
* <a href="https://nextcloud.instance.com:8443/cloud">...</a>
9696
* @param authenticationConfig Authentication config
9797
*/
98-
public NextcloudConnector(String serviceUrl, AuthenticationConfig authenticationConfig) {
98+
public NextcloudConnector(String originalServiceUrl, AuthenticationConfig authenticationConfig) {
9999
try {
100-
URL _serviceUrl = new URL(serviceUrl);
101-
boolean useHTTPS = serviceUrl.startsWith("https");
102-
_serverConfig = new ServerConfig(_serviceUrl.getHost(), useHTTPS, _serviceUrl.getPort(),
100+
URL serviceUrl = new URL(originalServiceUrl);
101+
boolean useHTTPS = originalServiceUrl.startsWith("https");
102+
this.serverConfig = new ServerConfig(serviceUrl.getHost(), useHTTPS, serviceUrl.getPort(),
103103
authenticationConfig);
104-
if (!_serviceUrl.getPath().isEmpty()) {
105-
_serverConfig.setSubPathPrefix(_serviceUrl.getPath());
104+
if (!serviceUrl.getPath().isEmpty()) {
105+
this.serverConfig.setSubPathPrefix(serviceUrl.getPath());
106106
}
107-
pc = new ProvisionConnector(_serverConfig);
108-
fc = new FilesharingConnector(_serverConfig);
109-
cc = new ConfigConnector(_serverConfig);
110-
fd = new Folders(_serverConfig);
111-
fl = new Files(_serverConfig);
107+
pc = new ProvisionConnector(this.serverConfig);
108+
fc = new FilesharingConnector(this.serverConfig);
109+
cc = new ConfigConnector(this.serverConfig);
110+
fd = new Folders(this.serverConfig);
111+
fl = new Files(this.serverConfig);
112112

113113
} catch (MalformedURLException e) {
114114
throw new IllegalArgumentException(e);
@@ -124,12 +124,12 @@ public NextcloudConnector(String serviceUrl, AuthenticationConfig authentication
124124
*/
125125
public NextcloudConnector(String serverName, boolean useHTTPS, int port,
126126
AuthenticationConfig authenticationConfig) {
127-
_serverConfig = new ServerConfig(serverName, useHTTPS, port, authenticationConfig);
128-
pc = new ProvisionConnector(_serverConfig);
129-
fc = new FilesharingConnector(_serverConfig);
130-
cc = new ConfigConnector(_serverConfig);
131-
fd = new Folders(_serverConfig);
132-
fl = new Files(_serverConfig);
127+
this.serverConfig = new ServerConfig(serverName, useHTTPS, port, authenticationConfig);
128+
pc = new ProvisionConnector(this.serverConfig);
129+
fc = new FilesharingConnector(this.serverConfig);
130+
cc = new ConfigConnector(this.serverConfig);
131+
fd = new Folders(this.serverConfig);
132+
fl = new Files(this.serverConfig);
133133
}
134134

135135
/**
@@ -171,8 +171,8 @@ public void setWebDavPathResolverAsType(final WebDavPathResolverBuilder.TYPE typ
171171
WebDavPathResolver resolver = WebDavPathResolverBuilder.get(type)
172172
.ofVersion(NextcloudVersion.get(getServerVersion()))
173173
.withUserName(getCurrentUser().getId())
174-
// .withUserName(_serverConfig.getUserName())
175-
.withBasePathPrefix(_serverConfig.getSubPathPrefix()).build();
174+
// .withUserName(this.serverConfig.getUserName())
175+
.withBasePathPrefix(this.serverConfig.getSubPathPrefix()).build();
176176

177177
this.fd.setWebDavPathResolver(resolver);
178178
this.fl.setWebDavPathResolver(resolver);
@@ -192,10 +192,10 @@ public void shutdown() throws IOException {
192192
* Trust all HTTPS certificates presented by the server. This is e.g. used
193193
* to work against a Nextcloud instance with a self-signed certificate.
194194
*
195-
* @param trustAllCertificates Do we accep self signed certificates or not
195+
* @param trustAllCertificates Do we accept self-signed certificates or not
196196
*/
197197
public void trustAllCertificates(boolean trustAllCertificates) {
198-
_serverConfig.setTrustAllCertificates(trustAllCertificates);
198+
this.serverConfig.setTrustAllCertificates(trustAllCertificates);
199199
}
200200

201201
/**
@@ -206,7 +206,7 @@ public void trustAllCertificates(boolean trustAllCertificates) {
206206
* installed in root
207207
*/
208208
public void setSubpathPrefix(String subpathPrefix) {
209-
_serverConfig.setSubPathPrefix(subpathPrefix);
209+
this.serverConfig.setSubPathPrefix(subpathPrefix);
210210
}
211211

212212
/**
@@ -662,7 +662,7 @@ public CompletableFuture<UserDetailsAnswer> getUserAsync(String userId) {
662662
}
663663

664664
/**
665-
* Gets user details of currently logged in user
665+
* Gets user details of currently logged-in user
666666
*
667667
* @return all user details
668668
*/
@@ -968,7 +968,7 @@ public void uploadFile(File srcFile, String remotePath) {
968968
* @deprecated Since some nextcloud installations use fpm or fastcgi to
969969
* connect to php, here the uploads might get zero empty on the server Use a
970970
* (temp) file to upload the data, so the content length is known in advance
971-
* https://github.com/a-schild/nextcloud-java-api/issues/20
971+
* <a href="https://github.com/a-schild/nextcloud-java-api/issues/20">...</a>
972972
*/
973973
public void uploadFile(InputStream inputStream, String remotePath) {
974974
fl.uploadFile(inputStream, remotePath);
@@ -987,7 +987,7 @@ public void uploadFile(InputStream inputStream, String remotePath) {
987987
* @deprecated Since some nextcloud installations use fpm or fastcgi to
988988
* connect to php, here the uploads might get zero empty on the server Use a
989989
* (temp) file to upload the data, so the content length is known in advance
990-
* https://github.com/a-schild/nextcloud-java-api/issues/20
990+
* <a href="https://github.com/a-schild/nextcloud-java-api/issues/20">...</a>
991991
*/
992992
public void uploadFile(InputStream inputStream, String remotePath, boolean continueHeader) {
993993
fl.uploadFile(inputStream, remotePath, continueHeader);
@@ -1136,7 +1136,7 @@ public CompletableFuture<XMLAnswer> editShareAsync(int shareId, Map<ShareData, S
11361136
* nextcloud server
11371137
* @param downloadpath Local path where the file has to be downloaded in the
11381138
* local machine
1139-
* @return boolean true if sucessfull
1139+
* @return boolean true if successful
11401140
* @throws java.io.IOException In case of IO errors
11411141
*/
11421142
public boolean downloadFile(String remotepath, String downloadpath) throws IOException {
@@ -1219,7 +1219,7 @@ public String getAppConfigAppKeyValue(String appConfigAppKeyPath) {
12191219
* @param appConfigAppKey a key name as returned by
12201220
* {@link #getAppConfigAppKeys(String)}
12211221
* @param value the value to set
1222-
* @return true if sucessfully set
1222+
* @return true if successfully set
12231223
*/
12241224
public boolean setAppConfigAppKeyValue(String appConfigApp, String appConfigAppKey, Object value) {
12251225
return cc.setAppConfigAppKeyValue(appConfigApp, appConfigAppKey, value);
@@ -1230,7 +1230,7 @@ public boolean setAppConfigAppKeyValue(String appConfigApp, String appConfigAppK
12301230
* @param appConfigAppKeyPath the full appConfigAppKeyPath combining
12311231
* appConfigApp and appConfigAppKey with "/"
12321232
* @param value the value to set
1233-
* @return Operation sucessfull
1233+
* @return Operation successful
12341234
*/
12351235
public boolean setAppConfigAppKeyValue(String appConfigAppKeyPath, Object value) {
12361236
return cc.setAppConfigAppKeyValue(appConfigAppKeyPath, value);
@@ -1243,7 +1243,7 @@ public boolean setAppConfigAppKeyValue(String appConfigAppKeyPath, Object value)
12431243
* {@link #getAppConfigApps()}
12441244
* @param appConfigAppkey a key name as returned by
12451245
* {@link #getAppConfigAppKeys(String)}
1246-
* @return Operation sucessfull
1246+
* @return Operation successful
12471247
*/
12481248
public boolean deleteAppConfigAppKeyEntry(String appConfigApp, String appConfigAppkey) {
12491249
return cc.deleteAppConfigAppKeyEntry(appConfigApp, appConfigAppkey);

0 commit comments

Comments
 (0)