diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMProject.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMProject.java new file mode 100644 index 0000000000..726f1a6274 --- /dev/null +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMProject.java @@ -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; + +} diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResource.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResource.java new file mode 100644 index 0000000000..d2bec90e23 --- /dev/null +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResource.java @@ -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 changes; + private Map 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 getChanges() { + return changes; + } + + public void setChanges(List changes) { + this.changes = changes; + } + + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } +} diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResourceChange.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResourceChange.java new file mode 100644 index 0000000000..d4e6b98c09 --- /dev/null +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMResourceChange.java @@ -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; + } +} diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMService.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMService.java new file mode 100644 index 0000000000..0cb289928d --- /dev/null +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/service/rm/RMService.java @@ -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; + +}