mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-1922 Initial RM service API
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2022 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver.service.rm;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Resource manager API
|
||||
*/
|
||||
public class RMProject {
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private boolean shared;
|
||||
|
||||
private Date createTime;
|
||||
private String creator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2022 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver.service.rm;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Resource manager API
|
||||
*/
|
||||
public class RMResource {
|
||||
private String name;
|
||||
private boolean folder;
|
||||
private String contentType;
|
||||
private Charset contentCharset;
|
||||
private long length;
|
||||
|
||||
private List<RMResourceChange> changes;
|
||||
private Map<String, Object> properties;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isFolder() {
|
||||
return folder;
|
||||
}
|
||||
|
||||
public void setFolder(boolean folder) {
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public Charset getContentCharset() {
|
||||
return contentCharset;
|
||||
}
|
||||
|
||||
public void setContentCharset(Charset contentCharset) {
|
||||
this.contentCharset = contentCharset;
|
||||
}
|
||||
|
||||
public long getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(long length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public List<RMResourceChange> getChanges() {
|
||||
return changes;
|
||||
}
|
||||
|
||||
public void setChanges(List<RMResourceChange> changes) {
|
||||
this.changes = changes;
|
||||
}
|
||||
|
||||
public Map<String, Object> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(Map<String, Object> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2022 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver.service.rm;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Resource change
|
||||
*/
|
||||
public class RMResourceChange {
|
||||
private String changeId;
|
||||
private Date changeTime;
|
||||
private Date changeUser;
|
||||
|
||||
public String getChangeId() {
|
||||
return changeId;
|
||||
}
|
||||
|
||||
public void setChangeId(String changeId) {
|
||||
this.changeId = changeId;
|
||||
}
|
||||
|
||||
public Date getChangeTime() {
|
||||
return changeTime;
|
||||
}
|
||||
|
||||
public void setChangeTime(Date changeTime) {
|
||||
this.changeTime = changeTime;
|
||||
}
|
||||
|
||||
public Date getChangeUser() {
|
||||
return changeUser;
|
||||
}
|
||||
|
||||
public void setChangeUser(Date changeUser) {
|
||||
this.changeUser = changeUser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2022 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package io.cloudbeaver.service.rm;
|
||||
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
|
||||
/**
|
||||
* Resource manager API.
|
||||
*/
|
||||
public interface RMService {
|
||||
|
||||
@NotNull
|
||||
RMProject[] listAccessibleProjects();
|
||||
|
||||
@NotNull
|
||||
RMProject[] listSharedProjects();
|
||||
|
||||
@NotNull
|
||||
RMProject getPrivateProject();
|
||||
|
||||
@NotNull
|
||||
void createProject(@NotNull RMProject project);
|
||||
|
||||
@NotNull
|
||||
void deleteProject(@NotNull String projectId);
|
||||
|
||||
@NotNull
|
||||
RMResource[] listResources(
|
||||
@NotNull String projectId,
|
||||
@Nullable String folder,
|
||||
@Nullable String nameMask,
|
||||
boolean readProperties,
|
||||
boolean readHistory) throws DBException;
|
||||
|
||||
String createResource(
|
||||
@NotNull String projectId,
|
||||
@NotNull String folder,
|
||||
@NotNull RMResource resource) throws DBException;
|
||||
|
||||
String updateResource(
|
||||
@NotNull String projectId,
|
||||
@NotNull String folder,
|
||||
@NotNull RMResource resource) throws DBException;
|
||||
|
||||
String moveResource(
|
||||
@NotNull String projectId,
|
||||
@NotNull String oldResourcePath,
|
||||
@NotNull String newResourcePath) throws DBException;
|
||||
|
||||
void deleteResource(
|
||||
@NotNull String projectId,
|
||||
@NotNull String resourcePath,
|
||||
boolean recursive) throws DBException;
|
||||
|
||||
@NotNull
|
||||
byte[] getResourceContents(
|
||||
@NotNull String projectId,
|
||||
@NotNull String resourcePath) throws DBException;
|
||||
|
||||
@NotNull
|
||||
String setResourceContents(
|
||||
@NotNull String projectId,
|
||||
@NotNull String resourcePath,
|
||||
@NotNull String contentType,
|
||||
@NotNull byte[] data) throws DBException;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user