Files
qbit-backups/src/main/java/com/kingsrook/qbits/backups/BackupsQBitConfig.java
T
james.maesandClaude Opus 5.5 7d33355b05 chore: bootstrap qbit-backups with the QRun qbit repository standard
Maven scaffold (qbit-build-parent 2.0.0, com.kingsrook.qbits, <revision>
versioning, qqq 4.1.0-RC.4 BOM, JaCoCo gate), QBit config and producer,
CircleCI qqq-orb pipeline, and the standard repository files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:41:29 -05:00

93 lines
3.0 KiB
Java

/*
* Copyright 2026 Kingsrook, LLC
*
* 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 com.kingsrook.qbits.backups;
import java.util.List;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
import com.kingsrook.qqq.backend.core.model.metadata.qbits.QBitConfig;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
/*******************************************************************************
** Host-facing configuration for the Backups QBit.
**
** Tables are named backups_<name> (lowercase snake_case, backend name equal
** to the table name); permissions are backups.<action>.
*******************************************************************************/
public class BackupsQBitConfig implements QBitConfig
{
public static final String TABLE_NAME_PREFIX = "backups_";
public static final String PERMISSION_BASE_NAME = "backups";
private String backendName;
/*******************************************************************************
** The backend must be named.
*******************************************************************************/
@Override
public void validate(QInstance qInstance, List<String> errors)
{
assertCondition(StringUtils.hasContent(backendName), "backendName is required for the Backups QBit", errors);
}
/*******************************************************************************
** Tables without their own backend use the configured backend.
*******************************************************************************/
@Override
public String getDefaultBackendNameForTables()
{
return (backendName);
}
/*******************************************************************************
** Getter for backendName
*******************************************************************************/
public String getBackendName()
{
return (this.backendName);
}
/*******************************************************************************
** Setter for backendName
*******************************************************************************/
public void setBackendName(String backendName)
{
this.backendName = backendName;
}
/*******************************************************************************
** Fluent setter for backendName
*******************************************************************************/
public BackupsQBitConfig withBackendName(String backendName)
{
this.backendName = backendName;
return (this);
}
}