This is an automated email from the ASF dual-hosted git repository. lizhimins pushed a commit to branch rocketmq-studio in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
commit d14fbc91835a23e3e7321747c82d7cf1a56fec2b Author: zhaohaihzb <[email protected]> AuthorDate: Tue Jul 28 19:27:55 2026 +0800 feat: add core cluster and topic model DTOs (#525) --- .../apache/rocketmq/studio/model/ACLPolicy.java | 197 +++++++++++ .../org/apache/rocketmq/studio/model/ACLUser.java | 141 ++++++++ .../rocketmq/studio/model/AccessControlList.java | 133 ++++++++ .../rocketmq/studio/model/Acl2PolicyContext.java | 320 ++++++++++++++++++ .../rocketmq/studio/model/ClientInstance.java | 373 +++++++++++++++++++++ .../rocketmq/studio/model/ClusterCapability.java | 150 +++++++++ .../rocketmq/studio/model/ClusterTopology.java | 256 ++++++++++++++ .../rocketmq/studio/model/ConsumerGroupInfo.java | 210 ++++++++++++ .../studio/model/ConsumerMonitorConfig.java | 46 +++ .../rocketmq/studio/model/LiteTopicQuota.java | 130 +++++++ .../rocketmq/studio/model/LiteTopicSession.java | 223 ++++++++++++ .../rocketmq/studio/model/LiteTopicSummary.java | 163 +++++++++ .../apache/rocketmq/studio/model/LoginInfo.java | 39 +++ .../apache/rocketmq/studio/model/LoginResult.java | 54 +++ .../studio/model/MetricsDataSourceConfig.java | 182 ++++++++++ .../rocketmq/studio/model/MetricsHealthResult.java | 87 +++++ .../org/apache/rocketmq/studio/model/Policy.java | 42 +++ .../rocketmq/studio/model/PolicyRequest.java | 60 ++++ .../rocketmq/studio/model/SubscriptionInfo.java | 130 +++++++ .../apache/rocketmq/studio/model/TopicInfo.java | 226 +++++++++++++ .../apache/rocketmq/studio/model/TopicType.java | 69 ++++ .../org/apache/rocketmq/studio/model/User.java | 83 +++++ .../org/apache/rocketmq/studio/model/UserInfo.java | 67 ++++ .../model/request/ArchitectureSwitchRequest.java | 72 ++++ .../studio/model/request/MessageQuery.java | 82 +++++ .../model/request/MetricsDataSourceRequest.java | 211 ++++++++++++ .../studio/model/request/ResetOffsetRequest.java | 58 ++++ .../model/request/SendTopicMessageRequest.java | 66 ++++ .../studio/model/request/TopicTypeList.java | 45 +++ .../studio/model/request/TopicTypeMeta.java | 38 +++ .../studio/model/request/UserCreateRequest.java | 49 +++ .../studio/model/request/UserInfoParam.java | 58 ++++ .../studio/model/request/UserUpdateRequest.java | 49 +++ 33 files changed, 4109 insertions(+) diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ACLPolicy.java b/server/src/main/java/org/apache/rocketmq/studio/model/ACLPolicy.java new file mode 100644 index 00000000..808d5dd9 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ACLPolicy.java @@ -0,0 +1,197 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.Set; + +public class ACLPolicy { + + private String policyId; + + private String policyName; + + private String description; + + private Set<String> users; + + private Set<String> resources; + + private Set<String> actions; + + private String policyType; + + private Set<String> ipWhiteList; + + private Date effectiveTime; + + private Date expirationTime; + + private Date createTime; + + private Date updateTime; + + private String status; + + private Boolean defaultPolicy; + + public boolean isEffective() { + Date now = new Date(); + if (effectiveTime != null && now.before(effectiveTime)) { + return false; + } + if (expirationTime != null && now.after(expirationTime)) { + return false; + } + if (!"ACTIVE".equals(status)) { + return false; + } + return true; + } + + public boolean hasPermission(String user, String resource, String action) { + if (!isEffective()) { + return false; + } + + if (users != null && !users.isEmpty() && !users.contains(user)) { + return false; + } + + if (resources != null && !resources.isEmpty() && !resources.contains(resource)) { + return false; + } + + if (actions != null && !actions.contains(action)) { + return false; + } + + return "ALLOW".equals(policyType); + } + public String getPolicyId() { + return policyId; + } + + public void setPolicyId(String policyId) { + this.policyId = policyId; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Set<String> getUsers() { + return users; + } + + public void setUsers(Set<String> users) { + this.users = users; + } + + public Set<String> getResources() { + return resources; + } + + public void setResources(Set<String> resources) { + this.resources = resources; + } + + public Set<String> getActions() { + return actions; + } + + public void setActions(Set<String> actions) { + this.actions = actions; + } + + public String getPolicyType() { + return policyType; + } + + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + + public Set<String> getIpWhiteList() { + return ipWhiteList; + } + + public void setIpWhiteList(Set<String> ipWhiteList) { + this.ipWhiteList = ipWhiteList; + } + + public Date getEffectiveTime() { + return effectiveTime; + } + + public void setEffectiveTime(Date effectiveTime) { + this.effectiveTime = effectiveTime; + } + + public Date getExpirationTime() { + return expirationTime; + } + + public void setExpirationTime(Date expirationTime) { + this.expirationTime = expirationTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Boolean getDefaultPolicy() { + return defaultPolicy; + } + + public void setDefaultPolicy(Boolean defaultPolicy) { + this.defaultPolicy = defaultPolicy; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ACLUser.java b/server/src/main/java/org/apache/rocketmq/studio/model/ACLUser.java new file mode 100644 index 00000000..e7d850c5 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ACLUser.java @@ -0,0 +1,141 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 according to 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.Set; + +public class ACLUser { + + private String userName; + + /** + * AccessKey + */ + private String accessKey; + + private String userType; + + private String status; + + private Date createTime; + + private Date updateTime; + + private Date lastLoginTime; + + private Set<String> policyIds; + + private Set<String> ipWhiteList; + + private String description; + + public boolean isActive() { + return "ACTIVE".equals(status); + } + + public boolean isAdmin() { + return "ADMIN".equals(userType); + } + + public boolean isIpAllowed(String ip) { + if (ipWhiteList == null || ipWhiteList.isEmpty()) { + return true; + } + return ipWhiteList.contains(ip); + } + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Date getLastLoginTime() { + return lastLoginTime; + } + + public void setLastLoginTime(Date lastLoginTime) { + this.lastLoginTime = lastLoginTime; + } + + public Set<String> getPolicyIds() { + return policyIds; + } + + public void setPolicyIds(Set<String> policyIds) { + this.policyIds = policyIds; + } + + public Set<String> getIpWhiteList() { + return ipWhiteList; + } + + public void setIpWhiteList(Set<String> ipWhiteList) { + this.ipWhiteList = ipWhiteList; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/AccessControlList.java b/server/src/main/java/org/apache/rocketmq/studio/model/AccessControlList.java new file mode 100644 index 00000000..9e85e9cf --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/AccessControlList.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.List; + +/** + * Access Control List model for ACL management. + * Represents the ACL configuration for a broker. + */ +public class AccessControlList { + + private String brokerAddr; + private String clusterName; + private List<AccessControlEntry> entries; + private long version; + + public String getBrokerAddr() { + return brokerAddr; + } + + public void setBrokerAddr(String brokerAddr) { + this.brokerAddr = brokerAddr; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public List<AccessControlEntry> getEntries() { + return entries; + } + + public void setEntries(List<AccessControlEntry> entries) { + this.entries = entries; + } + + public long getVersion() { + return version; + } + + public void setVersion(long version) { + this.version = version; + } + + /** + * Individual access control entry within an ACL. + */ + public static class AccessControlEntry { + + private String accessKey; + private String secretKey; + private String admin; + private String defaultTopicPerm; + private String defaultGroupPerm; + private List<String> topicPerms; + private List<String> groupPerms; + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getAdmin() { + return admin; + } + + public void setAdmin(String admin) { + this.admin = admin; + } + + public String getDefaultTopicPerm() { + return defaultTopicPerm; + } + + public void setDefaultTopicPerm(String defaultTopicPerm) { + this.defaultTopicPerm = defaultTopicPerm; + } + + public String getDefaultGroupPerm() { + return defaultGroupPerm; + } + + public void setDefaultGroupPerm(String defaultGroupPerm) { + this.defaultGroupPerm = defaultGroupPerm; + } + + public List<String> getTopicPerms() { + return topicPerms; + } + + public void setTopicPerms(List<String> topicPerms) { + this.topicPerms = topicPerms; + } + + public List<String> getGroupPerms() { + return groupPerms; + } + + public void setGroupPerms(List<String> groupPerms) { + this.groupPerms = groupPerms; + } + } +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/Acl2PolicyContext.java b/server/src/main/java/org/apache/rocketmq/studio/model/Acl2PolicyContext.java new file mode 100644 index 00000000..268b61af --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/Acl2PolicyContext.java @@ -0,0 +1,320 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +import java.util.Date; +import java.util.List; + +/** + * ACL 2.0 Policy Context - DTO for passing enhanced ACL 2.0 policy data between Controller and Service layers. + * + * This model extends ACL 1.0 compatible fields with ACL 2.0 RBAC-specific extensions including: + * - Policy name as unique identifier + * - Binding type (USER / GROUP / SERVICE_ACCOUNT) + * - Fine-grained authorization rules with resource patterns and effects + * + * @see ACLPolicy + */ +public class Acl2PolicyContext { + + // ========== Base Fields (Compatible with ACL 1.0) ========== + + /** Access key (user identifier) */ + private String accessKey; + + /** Secret key for authentication */ + private String secretKey; + + /** Whether this is an admin user */ + private boolean isAdmin; + + /** IP whitelist patterns */ + private List<String> whiteSet; + + // ========== ACL 2.0 RBAC Extended Fields ========== + + /** Policy name (unique identifier for ACL 2.0 policies) */ + private String policyName; + + /** Binding type: USER / GROUP / SERVICE_ACCOUNT */ + private String boundType; + + /** Bound entity ID (e.g., username, group name) */ + private String boundEntityId; + + /** List of authorization rules */ + private List<AuthorizationRule> rules; + + /** Whether this policy is enabled */ + private boolean enabled; + + /** Policy description */ + private String description; + + /** Cluster scope for this policy */ + private String clusterName; + + /** Broker scope for this policy */ + private String brokerName; + + /** Metadata for tracking creation/update */ + private Date createTime; + + /** Last update time */ + private Date updateTime; + + /** + * Authorization Rule - defines what actions are allowed/denied on which resources. + * Supports wildcards in resource patterns following path pattern syntax. + */ + public static class AuthorizationRule { + + /** Resource path pattern supporting wildcards (* matches any single level, ** matches all levels) */ + private String resourcePattern; + + /** Allowed operations: READ / WRITE / ADMIN / DELETE / UPDATE / CREATE / SUBSCRIBE / CONSUME */ + private List<String> actions; + + /** Effect: Allow or Deny (default is Allow when not specified) */ + private String effect; + + /** Priority: lower values are matched first. Default is 100. */ + private int priority; + + /** Optional rule description */ + private String description; + + /** Create a default Allow rule for backward compatibility */ + public static AuthorizationRule defaultAllowRule(String resourcePattern) { + AuthorizationRule rule = new AuthorizationRule(); + rule.setResourcePattern(resourcePattern); + rule.setActions(List.of("READ", "WRITE")); + rule.setEffect("Allow"); + rule.setPriority(100); + return rule; + } + + /** Create a deny-all rule */ + public static AuthorizationRule denyAllRule() { + AuthorizationRule rule = new AuthorizationRule(); + rule.setResourcePattern("**"); + rule.setActions(List.of("*")); + rule.setEffect("Deny"); + rule.setPriority(0); + return rule; + } + + public String getResourcePattern() { + return resourcePattern; + } + + public void setResourcePattern(String resourcePattern) { + this.resourcePattern = resourcePattern; + } + + public List<String> getActions() { + return actions; + } + + public void setActions(List<String> actions) { + this.actions = actions; + } + + public String getEffect() { + return effect; + } + + public void setEffect(String effect) { + this.effect = effect; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + } + + /** + * Validate this policy context for consistency. + * + * @throws IllegalArgumentException if required fields are missing + */ + public void validate() { + if (accessKey == null || accessKey.trim().isEmpty()) { + throw new IllegalArgumentException("accessKey cannot be empty"); + } + if (policyName == null || policyName.trim().isEmpty()) { + throw new IllegalArgumentException("policyName cannot be empty"); + } + if (rules != null && rules.isEmpty()) { + throw new IllegalArgumentException("rules list must not be empty"); + } + if (rules != null) { + for (int i = 0; i < rules.size(); i++) { + AuthorizationRule rule = rules.get(i); + if (rule.getResourcePattern() == null || rule.getResourcePattern().trim().isEmpty()) { + throw new IllegalArgumentException( + String.format("rules[%d].resourcePattern cannot be empty", i)); + } + if (rule.getActions() == null || rule.getActions().isEmpty()) { + throw new IllegalArgumentException( + String.format("rules[%d].actions cannot be empty", i)); + } + String effect = rule.getEffect(); + if (effect != null && !"Allow".equalsIgnoreCase(effect) && !"Deny".equalsIgnoreCase(effect)) { + throw new IllegalArgumentException( + String.format("rules[%d].effect must be 'Allow' or 'Deny', got: %s", i, effect)); + } + if (effect == null) { + rule.setEffect("Allow"); + } + } + } + if (boundType != null && !isValidBoundType(boundType)) { + throw new IllegalArgumentException( + String.format("boundType must be USER, GROUP, or SERVICE_ACCOUNT, got: %s", boundType)); + } + } + + private boolean isValidBoundType(String type) { + return "USER".equals(type) || "GROUP".equals(type) || "SERVICE_ACCOUNT".equals(type); + } + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public boolean isIsAdmin() { + return isAdmin; + } + + public void setIsAdmin(boolean isAdmin) { + this.isAdmin = isAdmin; + } + + public List<String> getWhiteSet() { + return whiteSet; + } + + public void setWhiteSet(List<String> whiteSet) { + this.whiteSet = whiteSet; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public String getBoundType() { + return boundType; + } + + public void setBoundType(String boundType) { + this.boundType = boundType; + } + + public String getBoundEntityId() { + return boundEntityId; + } + + public void setBoundEntityId(String boundEntityId) { + this.boundEntityId = boundEntityId; + } + + public List<AuthorizationRule> getRules() { + return rules; + } + + public void setRules(List<AuthorizationRule> rules) { + this.rules = rules; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getBrokerName() { + return brokerName; + } + + public void setBrokerName(String brokerName) { + this.brokerName = brokerName; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ClientInstance.java b/server/src/main/java/org/apache/rocketmq/studio/model/ClientInstance.java new file mode 100644 index 00000000..e608ee81 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ClientInstance.java @@ -0,0 +1,373 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.List; + +public class ClientInstance { + + private String clientId; + + private String clientAddress; + + private ClientType clientType; + + /** + * Topics associated with this client (published topics for producers, subscribed topics for consumers) + */ + private List<String> topics; + + private String clientSubType; + + private String language; + + private String sdkVersion; + + private ProtocolType protocolType; + + private String endpoint; + + private Date lastHeartbeatTime; + + private boolean active; + + private Date connectTime; + + private String instanceName; + + private String consumerGroup; + + private String producerGroup; + + private List<SubscriptionInfo> subscriptions; + + private List<String> publishTopics; + + private ConsumerProgress consumerProgress; + + private String clientVersion; + + private Boolean vipChannelEnabled; + + private String telemetrySessionId; + + private Boolean longConnectionActive; + + private String settingsVersion; + + private String authFailureReason; + + private Boolean popEnabled; + + private Integer pendingAckCount; + + /** + * Subscription count for consumer clients + */ + private Integer subscriptionCount; + + /** + * Client status (ONLINE, OFFLINE, etc.) + */ + private String status; + + public String getDisplayName() { + if (instanceName != null && !instanceName.trim().isEmpty()) { + return instanceName; + } + return clientId; + } + + public long getClientDelay() { + if (lastHeartbeatTime == null) { + return -1; + } + return (System.currentTimeMillis() - lastHeartbeatTime.getTime()) / 1000; + } + + public boolean isGrpcClient() { + return ProtocolType.GRPC.equals(protocolType); + } + + public boolean isRemotingClient() { + return ProtocolType.REMOTING.equals(protocolType); + } + + public boolean isConsumer() { + return ClientType.CONSUMER.equals(clientType); + } + + public boolean isProducer() { + return ClientType.PRODUCER.equals(clientType); + } + + /** + * Get version string (alias for sdkVersion for backward compatibility) + */ + public String getVersion() { + return sdkVersion; + } + + /** + * Set version string (alias for sdkVersion for backward compatibility) + */ + public void setVersion(String version) { + this.sdkVersion = version; + } + + public enum ClientType { + PRODUCER, CONSUMER, PUSH_CONSUMER, PULL_CONSUMER, SIMPLE_CONSUMER + } + + public enum ProtocolType { + REMOTING, GRPC + } + + public static class ConsumerProgress { + private Long totalConsumed; + private Long totalBacklog; + private Double consumptionRate; + private Date lastConsumeTime; + private String consumptionMode; // PULL / PUSH / POP + private Boolean orderlyConsume; + } + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientAddress() { + return clientAddress; + } + + public void setClientAddress(String clientAddress) { + this.clientAddress = clientAddress; + } + + public ClientType getClientType() { + return clientType; + } + + public void setClientType(ClientType clientType) { + this.clientType = clientType; + } + + public List<String> getTopics() { + return topics; + } + + public void setTopics(List<String> topics) { + this.topics = topics; + } + + public String getClientSubType() { + return clientSubType; + } + + public void setClientSubType(String clientSubType) { + this.clientSubType = clientSubType; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getSdkVersion() { + return sdkVersion; + } + + public void setSdkVersion(String sdkVersion) { + this.sdkVersion = sdkVersion; + } + + public ProtocolType getProtocolType() { + return protocolType; + } + + public void setProtocolType(ProtocolType protocolType) { + this.protocolType = protocolType; + } + + public String getEndpoint() { + return endpoint; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + public Date getLastHeartbeatTime() { + return lastHeartbeatTime; + } + + public void setLastHeartbeatTime(Date lastHeartbeatTime) { + this.lastHeartbeatTime = lastHeartbeatTime; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public Date getConnectTime() { + return connectTime; + } + + public void setConnectTime(Date connectTime) { + this.connectTime = connectTime; + } + + public String getInstanceName() { + return instanceName; + } + + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + public String getConsumerGroup() { + return consumerGroup; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + + public String getProducerGroup() { + return producerGroup; + } + + public void setProducerGroup(String producerGroup) { + this.producerGroup = producerGroup; + } + + public List<SubscriptionInfo> getSubscriptions() { + return subscriptions; + } + + public void setSubscriptions(List<SubscriptionInfo> subscriptions) { + this.subscriptions = subscriptions; + } + + public List<String> getPublishTopics() { + return publishTopics; + } + + public void setPublishTopics(List<String> publishTopics) { + this.publishTopics = publishTopics; + } + + public ConsumerProgress getConsumerProgress() { + return consumerProgress; + } + + public void setConsumerProgress(ConsumerProgress consumerProgress) { + this.consumerProgress = consumerProgress; + } + + public String getClientVersion() { + return clientVersion; + } + + public void setClientVersion(String clientVersion) { + this.clientVersion = clientVersion; + } + + public Boolean getVipChannelEnabled() { + return vipChannelEnabled; + } + + public void setVipChannelEnabled(Boolean vipChannelEnabled) { + this.vipChannelEnabled = vipChannelEnabled; + } + + public String getTelemetrySessionId() { + return telemetrySessionId; + } + + public void setTelemetrySessionId(String telemetrySessionId) { + this.telemetrySessionId = telemetrySessionId; + } + + public Boolean getLongConnectionActive() { + return longConnectionActive; + } + + public void setLongConnectionActive(Boolean longConnectionActive) { + this.longConnectionActive = longConnectionActive; + } + + public String getSettingsVersion() { + return settingsVersion; + } + + public void setSettingsVersion(String settingsVersion) { + this.settingsVersion = settingsVersion; + } + + public String getAuthFailureReason() { + return authFailureReason; + } + + public void setAuthFailureReason(String authFailureReason) { + this.authFailureReason = authFailureReason; + } + + public Boolean getPopEnabled() { + return popEnabled; + } + + public void setPopEnabled(Boolean popEnabled) { + this.popEnabled = popEnabled; + } + + public Integer getPendingAckCount() { + return pendingAckCount; + } + + public void setPendingAckCount(Integer pendingAckCount) { + this.pendingAckCount = pendingAckCount; + } + + public Integer getSubscriptionCount() { + return subscriptionCount; + } + + public void setSubscriptionCount(Integer subscriptionCount) { + this.subscriptionCount = subscriptionCount; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ClusterCapability.java b/server/src/main/java/org/apache/rocketmq/studio/model/ClusterCapability.java new file mode 100644 index 00000000..750dd85c --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ClusterCapability.java @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.HashSet; +import java.util.Set; + +public class ClusterCapability { + + private boolean liteTopicSupported; + + private boolean popConsumeSupported; + + private boolean aclV2Supported; + + private boolean grpcClientSupported; + + private boolean delayMessageSupported; + + private boolean transactionMessageSupported; + + private boolean fifoMessageSupported; + + private String architectureVersion; + + private String rocketmqVersion; + + private Set<String> extendedCapabilities; + + public Set<TopicType> getSupportedTopicTypes() { + Set<TopicType> supported = new HashSet<>(); + supported.add(TopicType.NORMAL); + + if (fifoMessageSupported) { + supported.add(TopicType.FIFO); + } + if (delayMessageSupported) { + supported.add(TopicType.DELAY); + } + if (transactionMessageSupported) { + supported.add(TopicType.TRANSACTION); + } + if (liteTopicSupported) { + supported.add(TopicType.LITE); + } + + return supported; + } + + public boolean hasCapability(String capability) { + if (extendedCapabilities != null) { + return extendedCapabilities.contains(capability); + } + return false; + } + public boolean isLiteTopicSupported() { + return liteTopicSupported; + } + + public void setLiteTopicSupported(boolean liteTopicSupported) { + this.liteTopicSupported = liteTopicSupported; + } + + public boolean isPopConsumeSupported() { + return popConsumeSupported; + } + + public void setPopConsumeSupported(boolean popConsumeSupported) { + this.popConsumeSupported = popConsumeSupported; + } + + public boolean isAclV2Supported() { + return aclV2Supported; + } + + public void setAclV2Supported(boolean aclV2Supported) { + this.aclV2Supported = aclV2Supported; + } + + public boolean isGrpcClientSupported() { + return grpcClientSupported; + } + + public void setGrpcClientSupported(boolean grpcClientSupported) { + this.grpcClientSupported = grpcClientSupported; + } + + public boolean isDelayMessageSupported() { + return delayMessageSupported; + } + + public void setDelayMessageSupported(boolean delayMessageSupported) { + this.delayMessageSupported = delayMessageSupported; + } + + public boolean isTransactionMessageSupported() { + return transactionMessageSupported; + } + + public void setTransactionMessageSupported(boolean transactionMessageSupported) { + this.transactionMessageSupported = transactionMessageSupported; + } + + public boolean isFifoMessageSupported() { + return fifoMessageSupported; + } + + public void setFifoMessageSupported(boolean fifoMessageSupported) { + this.fifoMessageSupported = fifoMessageSupported; + } + + public String getArchitectureVersion() { + return architectureVersion; + } + + public void setArchitectureVersion(String architectureVersion) { + this.architectureVersion = architectureVersion; + } + + public String getRocketmqVersion() { + return rocketmqVersion; + } + + public void setRocketmqVersion(String rocketmqVersion) { + this.rocketmqVersion = rocketmqVersion; + } + + public Set<String> getExtendedCapabilities() { + return extendedCapabilities; + } + + public void setExtendedCapabilities(Set<String> extendedCapabilities) { + this.extendedCapabilities = extendedCapabilities; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ClusterTopology.java b/server/src/main/java/org/apache/rocketmq/studio/model/ClusterTopology.java new file mode 100644 index 00000000..d6474409 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ClusterTopology.java @@ -0,0 +1,256 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Unified cluster topology model + * Hide differences between different cluster architectures + */ +public class ClusterTopology { + + /** + * Cluster name + */ + private String clusterName; + + /** + * NameServer address list + */ + private List<String> namesrvAddresses; + + /** + * NameServer node list + */ + private List<NodeInfo> namesrvNodes; + + /** + * Broker node list + */ + private List<NodeInfo> brokerNodes; + + /** + * Proxy node list (5.0 architecture) + */ + private List<NodeInfo> proxyNodes; + + /** + * Node mapping table (for quick lookup) + */ + private Map<String, NodeInfo> nodeMap; + + public ClusterTopology() { + this.namesrvAddresses = new ArrayList<>(); + this.namesrvNodes = new ArrayList<>(); + this.brokerNodes = new ArrayList<>(); + this.proxyNodes = new ArrayList<>(); + this.nodeMap = new HashMap<>(); + } + + /** + * Add node + */ + public void addNode(String nodeName, Long nodeId, String nodeAddress, String nodeType) { + NodeInfo node = new NodeInfo(); + node.setNodeName(nodeName); + node.setNodeId(nodeId); + node.setNodeAddress(nodeAddress); + node.setNodeType(nodeType); + node.setClusterName(clusterName); + + String key = nodeType + "-" + nodeName + "-" + nodeId; + nodeMap.put(key, node); + + switch (nodeType) { + case "NAMESRV": + namesrvNodes.add(node); + break; + case "BROKER": + brokerNodes.add(node); + break; + case "PROXY": + proxyNodes.add(node); + break; + } + } + + /** + * Get total node count + */ + public int getTotalNodeCount() { + return namesrvNodes.size() + brokerNodes.size() + proxyNodes.size(); + } + + /** + * Get master broker count + */ + public int getMasterBrokerCount() { + return (int) brokerNodes.stream() + .filter(node -> node.getNodeId() != null && node.getNodeId() == 0) + .count(); + } + + /** + * Get slave broker count + */ + public int getSlaveBrokerCount() { + return (int) brokerNodes.stream() + .filter(node -> node.getNodeId() != null && node.getNodeId() > 0) + .count(); + } + + + public static class NodeInfo { + private String nodeName; + private Long nodeId; + private String nodeAddress; + private String nodeType; + private String clusterName; + private String status; + private Long version; + private Map<String, Object> metadata; + + public NodeInfo() { + this.metadata = new HashMap<>(); + this.status = "UNKNOWN"; + } + + public boolean isMaster() { + return nodeId != null && nodeId == 0; + } + + public boolean isOnline() { + return "ONLINE".equals(status); + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public Long getNodeId() { + return nodeId; + } + + public void setNodeId(Long nodeId) { + this.nodeId = nodeId; + } + + public String getNodeAddress() { + return nodeAddress; + } + + public void setNodeAddress(String nodeAddress) { + this.nodeAddress = nodeAddress; + } + + public String getNodeType() { + return nodeType; + } + + public void setNodeType(String nodeType) { + this.nodeType = nodeType; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + public Map<String, Object> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, Object> metadata) { + this.metadata = metadata; + } + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public List<String> getNamesrvAddresses() { + return namesrvAddresses; + } + + public void setNamesrvAddresses(List<String> namesrvAddresses) { + this.namesrvAddresses = namesrvAddresses; + } + + public List<NodeInfo> getNamesrvNodes() { + return namesrvNodes; + } + + public void setNamesrvNodes(List<NodeInfo> namesrvNodes) { + this.namesrvNodes = namesrvNodes; + } + + public List<NodeInfo> getBrokerNodes() { + return brokerNodes; + } + + public void setBrokerNodes(List<NodeInfo> brokerNodes) { + this.brokerNodes = brokerNodes; + } + + public List<NodeInfo> getProxyNodes() { + return proxyNodes; + } + + public void setProxyNodes(List<NodeInfo> proxyNodes) { + this.proxyNodes = proxyNodes; + } + + public Map<String, NodeInfo> getNodeMap() { + return nodeMap; + } + + public void setNodeMap(Map<String, NodeInfo> nodeMap) { + this.nodeMap = nodeMap; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerGroupInfo.java b/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerGroupInfo.java new file mode 100644 index 00000000..db0b7500 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerGroupInfo.java @@ -0,0 +1,210 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.Map; +import java.util.Set; + +public class ConsumerGroupInfo { + + private String consumerGroupName; + + private String consumeMode; + + private Boolean consumeMessageOrderly; + + private Boolean consumeBroadcastEnable; + + private Boolean consumeFromMinEnable; + + private Integer retryQueueNums; + + private Integer retryMaxTimes; + + private Integer consumeTimeoutMinute; + + private String clusterName; + + private Date createTime; + + private Date updateTime; + + private String status; + + private Set<String> subscribedTopics; + + private Integer onlineClientCount; + + private String liteBindTopic; + + private Map<String, String> attributes; + + private Integer groupSysFlag; + + public String getDisplayName() { + return consumerGroupName; + } + + public boolean isPopConsumer() { + return "POP".equalsIgnoreCase(consumeMode); + } + + public boolean isOrderlyConsume() { + return Boolean.TRUE.equals(consumeMessageOrderly); + } + + public boolean isBroadcastConsume() { + return Boolean.TRUE.equals(consumeBroadcastEnable); + } + public String getConsumerGroupName() { + return consumerGroupName; + } + + public void setConsumerGroupName(String consumerGroupName) { + this.consumerGroupName = consumerGroupName; + } + + public String getConsumeMode() { + return consumeMode; + } + + public void setConsumeMode(String consumeMode) { + this.consumeMode = consumeMode; + } + + public Boolean getConsumeMessageOrderly() { + return consumeMessageOrderly; + } + + public void setConsumeMessageOrderly(Boolean consumeMessageOrderly) { + this.consumeMessageOrderly = consumeMessageOrderly; + } + + public Boolean getConsumeBroadcastEnable() { + return consumeBroadcastEnable; + } + + public void setConsumeBroadcastEnable(Boolean consumeBroadcastEnable) { + this.consumeBroadcastEnable = consumeBroadcastEnable; + } + + public Boolean getConsumeFromMinEnable() { + return consumeFromMinEnable; + } + + public void setConsumeFromMinEnable(Boolean consumeFromMinEnable) { + this.consumeFromMinEnable = consumeFromMinEnable; + } + + public Integer getRetryQueueNums() { + return retryQueueNums; + } + + public void setRetryQueueNums(Integer retryQueueNums) { + this.retryQueueNums = retryQueueNums; + } + + public Integer getRetryMaxTimes() { + return retryMaxTimes; + } + + public void setRetryMaxTimes(Integer retryMaxTimes) { + this.retryMaxTimes = retryMaxTimes; + } + + public Integer getConsumeTimeoutMinute() { + return consumeTimeoutMinute; + } + + public void setConsumeTimeoutMinute(Integer consumeTimeoutMinute) { + this.consumeTimeoutMinute = consumeTimeoutMinute; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Set<String> getSubscribedTopics() { + return subscribedTopics; + } + + public void setSubscribedTopics(Set<String> subscribedTopics) { + this.subscribedTopics = subscribedTopics; + } + + public Integer getOnlineClientCount() { + return onlineClientCount; + } + + public void setOnlineClientCount(Integer onlineClientCount) { + this.onlineClientCount = onlineClientCount; + } + + public String getLiteBindTopic() { + return liteBindTopic; + } + + public void setLiteBindTopic(String liteBindTopic) { + this.liteBindTopic = liteBindTopic; + } + + public Map<String, String> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, String> attributes) { + this.attributes = attributes; + } + + public Integer getGroupSysFlag() { + return groupSysFlag; + } + + public void setGroupSysFlag(Integer groupSysFlag) { + this.groupSysFlag = groupSysFlag; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerMonitorConfig.java b/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerMonitorConfig.java new file mode 100644 index 00000000..9bb74c3a --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/ConsumerMonitorConfig.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +public class ConsumerMonitorConfig { + private int minCount; + private int maxDiffTotal; + + public ConsumerMonitorConfig() { + } + + public ConsumerMonitorConfig(int minCount, int maxDiffTotal) { + this.minCount = minCount; + this.maxDiffTotal = maxDiffTotal; + } + + public int getMinCount() { + return minCount; + } + + public void setMinCount(int minCount) { + this.minCount = minCount; + } + + public int getMaxDiffTotal() { + return maxDiffTotal; + } + + public void setMaxDiffTotal(int maxDiffTotal) { + this.maxDiffTotal = maxDiffTotal; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicQuota.java b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicQuota.java new file mode 100644 index 00000000..daa39b8c --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicQuota.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +public class LiteTopicQuota { + + private Integer maxTopicCount; + + private Integer currentTopicCount; + + private Integer maxSessionCount; + + private Integer currentSessionCount; + + private Long defaultTTL; + + private Long maxTTL; + + private Double currentCreationRate; + + private Double maxCreationRate; + + public double getUsageRate() { + if (maxTopicCount == null || maxTopicCount == 0) { + return 0.0; + } + return (double) currentTopicCount / maxTopicCount; + } + + public double getSessionUsageRate() { + if (maxSessionCount == null || maxSessionCount == 0) { + return 0.0; + } + return (double) currentSessionCount / maxSessionCount; + } + + public boolean isNearQuotaLimit(double threshold) { + return getUsageRate() >= threshold; + } + + public boolean isQuotaExceeded() { + return currentTopicCount >= maxTopicCount; + } + + public Integer getRemainingQuota() { + if (maxTopicCount == null) { + return 0; + } + return Math.max(0, maxTopicCount - currentTopicCount); + } + public Integer getMaxTopicCount() { + return maxTopicCount; + } + + public void setMaxTopicCount(Integer maxTopicCount) { + this.maxTopicCount = maxTopicCount; + } + + public Integer getCurrentTopicCount() { + return currentTopicCount; + } + + public void setCurrentTopicCount(Integer currentTopicCount) { + this.currentTopicCount = currentTopicCount; + } + + public Integer getMaxSessionCount() { + return maxSessionCount; + } + + public void setMaxSessionCount(Integer maxSessionCount) { + this.maxSessionCount = maxSessionCount; + } + + public Integer getCurrentSessionCount() { + return currentSessionCount; + } + + public void setCurrentSessionCount(Integer currentSessionCount) { + this.currentSessionCount = currentSessionCount; + } + + public Long getDefaultTTL() { + return defaultTTL; + } + + public void setDefaultTTL(Long defaultTTL) { + this.defaultTTL = defaultTTL; + } + + public Long getMaxTTL() { + return maxTTL; + } + + public void setMaxTTL(Long maxTTL) { + this.maxTTL = maxTTL; + } + + public Double getCurrentCreationRate() { + return currentCreationRate; + } + + public void setCurrentCreationRate(Double currentCreationRate) { + this.currentCreationRate = currentCreationRate; + } + + public Double getMaxCreationRate() { + return maxCreationRate; + } + + public void setMaxCreationRate(Double maxCreationRate) { + this.maxCreationRate = maxCreationRate; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSession.java b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSession.java new file mode 100644 index 00000000..f7ea3587 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSession.java @@ -0,0 +1,223 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.Set; + +public class LiteTopicSession { + + /** + * Session ID + */ + private String sessionId; + + private String clientId; + + private String clientAddress; + + private Set<String> liteTopics; + + private String parentTopic; + + /** + * Consumer Group + */ + private String consumerGroup; + + private Date createTime; + + private Date lastActiveTime; + + private Long ttl; + + private Long ttlRemaining; + + private String status; + + private Long totalMessages; + + private Long consumedMessages; + + private Long pendingMessages; + + private Double consumptionRate; + + private PopConsumeProgress popProgress; + + private Integer liteTopicCreationCount; + + public boolean hasActiveConsumption() { + return "ACTIVE".equals(status) && consumptionRate != null && consumptionRate > 0; + } + + public boolean isExpired() { + return "EXPIRED".equals(status) || ttlRemaining != null && ttlRemaining <= 0; + } + + public double getConsumptionProgress() { + if (totalMessages == null || totalMessages == 0) { + return 0.0; + } + return (double) consumedMessages / totalMessages * 100.0; + } + + public static class PopConsumeProgress { + private Integer ackTimeoutSeconds; + private Integer maxReconsumeTimes; + private Integer totalPopInFlightCount; + private Integer lastPopTime; + private Integer popCheckpoint; + private Integer totalPopCount; + } + public String getSessionId() { + return sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getClientAddress() { + return clientAddress; + } + + public void setClientAddress(String clientAddress) { + this.clientAddress = clientAddress; + } + + public Set<String> getLiteTopics() { + return liteTopics; + } + + public void setLiteTopics(Set<String> liteTopics) { + this.liteTopics = liteTopics; + } + + public String getParentTopic() { + return parentTopic; + } + + public void setParentTopic(String parentTopic) { + this.parentTopic = parentTopic; + } + + public String getConsumerGroup() { + return consumerGroup; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getLastActiveTime() { + return lastActiveTime; + } + + public void setLastActiveTime(Date lastActiveTime) { + this.lastActiveTime = lastActiveTime; + } + + public Long getTtl() { + return ttl; + } + + public void setTtl(Long ttl) { + this.ttl = ttl; + } + + public Long getTtlRemaining() { + return ttlRemaining; + } + + public void setTtlRemaining(Long ttlRemaining) { + this.ttlRemaining = ttlRemaining; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Long getTotalMessages() { + return totalMessages; + } + + public void setTotalMessages(Long totalMessages) { + this.totalMessages = totalMessages; + } + + public Long getConsumedMessages() { + return consumedMessages; + } + + public void setConsumedMessages(Long consumedMessages) { + this.consumedMessages = consumedMessages; + } + + public Long getPendingMessages() { + return pendingMessages; + } + + public void setPendingMessages(Long pendingMessages) { + this.pendingMessages = pendingMessages; + } + + public Double getConsumptionRate() { + return consumptionRate; + } + + public void setConsumptionRate(Double consumptionRate) { + this.consumptionRate = consumptionRate; + } + + public PopConsumeProgress getPopProgress() { + return popProgress; + } + + public void setPopProgress(PopConsumeProgress popProgress) { + this.popProgress = popProgress; + } + + public Integer getLiteTopicCreationCount() { + return liteTopicCreationCount; + } + + public void setLiteTopicCreationCount(Integer liteTopicCreationCount) { + this.liteTopicCreationCount = liteTopicCreationCount; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSummary.java b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSummary.java new file mode 100644 index 00000000..49447ac5 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/LiteTopicSummary.java @@ -0,0 +1,163 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.List; + +public class LiteTopicSummary { + + private String topicPattern; + + private Integer topicCount; + + private List<String> sessionIds; + + private Date earliestCreateTime; + + private Date lastActiveTime; + + private Long averageTTL; + + private Long minTTL; + + private Long maxTTL; + + private Integer consumerCount; + + private Long totalBacklog; + + private boolean active; + + private java.util.Map<String, Object> attributes; + + public String getTTLStatus() { + if (lastActiveTime == null) { + return "UNKNOWN"; + } + + long now = System.currentTimeMillis(); + long elapsed = now - lastActiveTime.getTime(); + + if (averageTTL != null && elapsed > averageTTL * 0.8) { + return "EXPIRING_SOON"; + } else if (averageTTL != null && elapsed > averageTTL) { + return "EXPIRED"; + } else { + return "ACTIVE"; + } + } + + public double getConsumerDensity() { + if (topicCount == null || topicCount == 0) { + return 0.0; + } + return (double) consumerCount / topicCount; + } + + public boolean isEmptyAggregation() { + return consumerCount == 0 && (totalBacklog == null || totalBacklog == 0); + } + public String getTopicPattern() { + return topicPattern; + } + + public void setTopicPattern(String topicPattern) { + this.topicPattern = topicPattern; + } + + public Integer getTopicCount() { + return topicCount; + } + + public void setTopicCount(Integer topicCount) { + this.topicCount = topicCount; + } + + public List<String> getSessionIds() { + return sessionIds; + } + + public void setSessionIds(List<String> sessionIds) { + this.sessionIds = sessionIds; + } + + public Date getEarliestCreateTime() { + return earliestCreateTime; + } + + public void setEarliestCreateTime(Date earliestCreateTime) { + this.earliestCreateTime = earliestCreateTime; + } + + public Date getLastActiveTime() { + return lastActiveTime; + } + + public void setLastActiveTime(Date lastActiveTime) { + this.lastActiveTime = lastActiveTime; + } + + public Long getAverageTTL() { + return averageTTL; + } + + public void setAverageTTL(Long averageTTL) { + this.averageTTL = averageTTL; + } + + public Long getMinTTL() { + return minTTL; + } + + public void setMinTTL(Long minTTL) { + this.minTTL = minTTL; + } + + public Long getMaxTTL() { + return maxTTL; + } + + public void setMaxTTL(Long maxTTL) { + this.maxTTL = maxTTL; + } + + public Integer getConsumerCount() { + return consumerCount; + } + + public void setConsumerCount(Integer consumerCount) { + this.consumerCount = consumerCount; + } + + public Long getTotalBacklog() { + return totalBacklog; + } + + public void setTotalBacklog(Long totalBacklog) { + this.totalBacklog = totalBacklog; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/LoginInfo.java b/server/src/main/java/org/apache/rocketmq/studio/model/LoginInfo.java new file mode 100644 index 00000000..189c6928 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/LoginInfo.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +public class LoginInfo { + private boolean loginRequired; + private boolean logined; + + public boolean isLoginRequired() { + return loginRequired; + } + + public void setLoginRequired(boolean loginRequired) { + this.loginRequired = loginRequired; + } + + public boolean isLogined() { + return logined; + } + + public void setLogined(boolean logined) { + this.logined = logined; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/LoginResult.java b/server/src/main/java/org/apache/rocketmq/studio/model/LoginResult.java new file mode 100644 index 00000000..72eccf1f --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/LoginResult.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +public class LoginResult { + + private String loginUserName; + + /** + * 0: normal 1: admin + */ + private int loginUserRole; + + private String contextPath; + public String getLoginUserName() { + return loginUserName; + } + + public void setLoginUserName(String loginUserName) { + this.loginUserName = loginUserName; + } + + public int getLoginUserRole() { + return loginUserRole; + } + + public void setLoginUserRole(int loginUserRole) { + this.loginUserRole = loginUserRole; + } + + public String getContextPath() { + return contextPath; + } + + public void setContextPath(String contextPath) { + this.contextPath = contextPath; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/MetricsDataSourceConfig.java b/server/src/main/java/org/apache/rocketmq/studio/model/MetricsDataSourceConfig.java new file mode 100644 index 00000000..f15400ae --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/MetricsDataSourceConfig.java @@ -0,0 +1,182 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +import java.io.Serializable; +import java.util.Map; + +/** + * Configuration model for Prometheus-compatible metrics data sources. + * Supports multiple data sources (N:N mapping with clusters). + * Auth types: none, basic, bearer, sigv4. + * <p> + * This class carries raw configuration values. Sensitive fields such as + * password / bearerToken should be encrypted at rest in production. + * </p> + */ +public class MetricsDataSourceConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * User-defined name identifying this data source. + */ + private String name; + + /** + * Base URL of the Prometheus-compatible backend + * (e.g., http://prometheus:9090). + */ + private String url; + + /** + * Authentication type: "none", "basic", "bearer", "sigv4". + */ + private String authType; + + /** + * Username for basic authentication. + */ + private String username; + + /** + * Password for basic authentication (encrypted in storage). + */ + private String password; + + /** + * Bearer token for bearer authentication. + */ + private String bearerToken; + + /** + * Prometheus-compatible backend provider type. + * Supported: PROMETHEUS, VICTORIAMETRICS, THANOS, MIMIR, CORTEX, ARMS, CUSTOM + */ + private String providerType = "PROMETHEUS"; + + /** + * Whether TLS / HTTPS is enabled. + */ + private boolean tlsEnabled; + + /** + * Default labels used for PromQL construction (e.g., cluster -> broker name). + */ + private Map<String, String> defaultLabels; + + /** + * Scrape interval in seconds configured on the Prometheus side. + */ + private int scrapeInterval; + + /** + * Whether this data source is currently activated. + */ + private boolean enabled; + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getAuthType() { + return authType; + } + + public void setAuthType(String authType) { + this.authType = authType; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getBearerToken() { + return bearerToken; + } + + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + public String getProviderType() { + return providerType; + } + + public void setProviderType(String providerType) { + this.providerType = providerType; + } + + public boolean isTlsEnabled() { + return tlsEnabled; + } + + public void setTlsEnabled(boolean tlsEnabled) { + this.tlsEnabled = tlsEnabled; + } + + public Map<String, String> getDefaultLabels() { + return defaultLabels; + } + + public void setDefaultLabels(Map<String, String> defaultLabels) { + this.defaultLabels = defaultLabels; + } + + public int getScrapeInterval() { + return scrapeInterval; + } + + public void setScrapeInterval(int scrapeInterval) { + this.scrapeInterval = scrapeInterval; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/MetricsHealthResult.java b/server/src/main/java/org/apache/rocketmq/studio/model/MetricsHealthResult.java new file mode 100644 index 00000000..118ff31e --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/MetricsHealthResult.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +import java.io.Serializable; +import java.util.List; + +/** + * Result object returned by data-source health checks. + * Contains connection status, discovered metric families, and latency. + */ +public class MetricsHealthResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** Whether the backend was reachable and responded successfully. */ + private boolean connected; + + /** Human-readable status message (e.g., error description). */ + private String statusMessage; + + /** Metric-family names that are expected but NOT found in the data source. */ + private List<String> missingMetricFamilies; + + /** Metric-family names actually discovered via /api/v1/labels or /api/v1/targets. */ + private List<String> availableMetricFamilies; + + /** Round-trip query latency in milliseconds during the health probe. */ + private long queryLatencyMs; + + + public boolean isConnected() { + return connected; + } + + public void setConnected(boolean connected) { + this.connected = connected; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public List<String> getMissingMetricFamilies() { + return missingMetricFamilies; + } + + public void setMissingMetricFamilies(List<String> missingMetricFamilies) { + this.missingMetricFamilies = missingMetricFamilies; + } + + public List<String> getAvailableMetricFamilies() { + return availableMetricFamilies; + } + + public void setAvailableMetricFamilies(List<String> availableMetricFamilies) { + this.availableMetricFamilies = availableMetricFamilies; + } + + public long getQueryLatencyMs() { + return queryLatencyMs; + } + + public void setQueryLatencyMs(long queryLatencyMs) { + this.queryLatencyMs = queryLatencyMs; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/Policy.java b/server/src/main/java/org/apache/rocketmq/studio/model/Policy.java new file mode 100644 index 00000000..2483425e --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/Policy.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +import java.util.List; + +public class Policy { + private String policyType; + private List<Entry> entries; + public String getPolicyType() { + return policyType; + } + + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + + public List<Entry> getEntries() { + return entries; + } + + public void setEntries(List<Entry> entries) { + this.entries = entries; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/PolicyRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/PolicyRequest.java new file mode 100644 index 00000000..b143812e --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/PolicyRequest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + + +import java.util.List; + +public class PolicyRequest { + private String clusterName; + private String brokerName; + private String subject; + private List<Policy> policies; + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getBrokerName() { + return brokerName; + } + + public void setBrokerName(String brokerName) { + this.brokerName = brokerName; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public List<Policy> getPolicies() { + return policies; + } + + public void setPolicies(List<Policy> policies) { + this.policies = policies; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/SubscriptionInfo.java b/server/src/main/java/org/apache/rocketmq/studio/model/SubscriptionInfo.java new file mode 100644 index 00000000..ccc3bd59 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/SubscriptionInfo.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Map; + +public class SubscriptionInfo { + + private String topic; + + private String consumerGroup; + + private String subExpression; + + private String subscriptionType; + + private Long version; + + private Boolean broadcast; + + private String consumeFromWhere; + + private Long consumeProgress; + + private Long backlogCount; + + private Map<String, Object> attributes; + + public boolean isTagSubscription() { + return "TAG".equals(subscriptionType); + } + + public boolean isSQL92Subscription() { + return "SQL92".equals(subscriptionType); + } + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public String getConsumerGroup() { + return consumerGroup; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + + public String getSubExpression() { + return subExpression; + } + + public void setSubExpression(String subExpression) { + this.subExpression = subExpression; + } + + public String getSubscriptionType() { + return subscriptionType; + } + + public void setSubscriptionType(String subscriptionType) { + this.subscriptionType = subscriptionType; + } + + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + public Boolean getBroadcast() { + return broadcast; + } + + public void setBroadcast(Boolean broadcast) { + this.broadcast = broadcast; + } + + public String getConsumeFromWhere() { + return consumeFromWhere; + } + + public void setConsumeFromWhere(String consumeFromWhere) { + this.consumeFromWhere = consumeFromWhere; + } + + public Long getConsumeProgress() { + return consumeProgress; + } + + public void setConsumeProgress(Long consumeProgress) { + this.consumeProgress = consumeProgress; + } + + public Long getBacklogCount() { + return backlogCount; + } + + public void setBacklogCount(Long backlogCount) { + this.backlogCount = backlogCount; + } + + public Map<String, Object> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, Object> attributes) { + this.attributes = attributes; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/TopicInfo.java b/server/src/main/java/org/apache/rocketmq/studio/model/TopicInfo.java new file mode 100644 index 00000000..bf5082cb --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/TopicInfo.java @@ -0,0 +1,226 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import java.util.Date; +import java.util.Map; + +public class TopicInfo { + + private String topicName; + + private TopicType topicType; + + private Integer readQueueNums; + + private Integer writeQueueNums; + + private Integer perm; + + private Boolean orderTopic; + + private Date createTime; + + private Date updateTime; + + private String topicStatus; + + private String clusterName; + + private Map<String, String> attributes; + + private Long fifoTimeoutSeconds; + + private Long liteTopicTTL; + + /** + * LiteTopic - Session ID + */ + private String sessionId; + + private String autoCreatePattern; + + private String delayLevel; + + private String transactionServerAddr; + + private Long transactionTimeoutSeconds; + + public String getDisplayName() { + return topicName; + } + + public boolean isLiteTopic() { + return TopicType.LITE.equals(topicType); + } + + public boolean isOrderTopic() { + return Boolean.TRUE.equals(orderTopic) || TopicType.FIFO.equals(topicType); + } + + public boolean isDelayTopic() { + return TopicType.DELAY.equals(topicType); + } + + public boolean isTransactionTopic() { + return TopicType.TRANSACTION.equals(topicType); + } + public String getTopicName() { + return topicName; + } + + public void setTopicName(String topicName) { + this.topicName = topicName; + } + + public TopicType getTopicType() { + return topicType; + } + + public void setTopicType(TopicType topicType) { + this.topicType = topicType; + } + + public Integer getReadQueueNums() { + return readQueueNums; + } + + public void setReadQueueNums(Integer readQueueNums) { + this.readQueueNums = readQueueNums; + } + + public Integer getWriteQueueNums() { + return writeQueueNums; + } + + public void setWriteQueueNums(Integer writeQueueNums) { + this.writeQueueNums = writeQueueNums; + } + + public Integer getPerm() { + return perm; + } + + public void setPerm(Integer perm) { + this.perm = perm; + } + + public Boolean getOrderTopic() { + return orderTopic; + } + + public void setOrderTopic(Boolean orderTopic) { + this.orderTopic = orderTopic; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getTopicStatus() { + return topicStatus; + } + + public void setTopicStatus(String topicStatus) { + this.topicStatus = topicStatus; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public Map<String, String> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, String> attributes) { + this.attributes = attributes; + } + + public Long getFifoTimeoutSeconds() { + return fifoTimeoutSeconds; + } + + public void setFifoTimeoutSeconds(Long fifoTimeoutSeconds) { + this.fifoTimeoutSeconds = fifoTimeoutSeconds; + } + + public Long getLiteTopicTTL() { + return liteTopicTTL; + } + + public void setLiteTopicTTL(Long liteTopicTTL) { + this.liteTopicTTL = liteTopicTTL; + } + + public String getSessionId() { + return sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public String getAutoCreatePattern() { + return autoCreatePattern; + } + + public void setAutoCreatePattern(String autoCreatePattern) { + this.autoCreatePattern = autoCreatePattern; + } + + public String getDelayLevel() { + return delayLevel; + } + + public void setDelayLevel(String delayLevel) { + this.delayLevel = delayLevel; + } + + public String getTransactionServerAddr() { + return transactionServerAddr; + } + + public void setTransactionServerAddr(String transactionServerAddr) { + this.transactionServerAddr = transactionServerAddr; + } + + public Long getTransactionTimeoutSeconds() { + return transactionTimeoutSeconds; + } + + public void setTransactionTimeoutSeconds(Long transactionTimeoutSeconds) { + this.transactionTimeoutSeconds = transactionTimeoutSeconds; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/TopicType.java b/server/src/main/java/org/apache/rocketmq/studio/model/TopicType.java new file mode 100644 index 00000000..9e12fb24 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/TopicType.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +public enum TopicType { + + NORMAL("NORMAL", "Normal message", false), + + FIFO("FIFO", "FIFO ordered message", true), + + DELAY("DELAY", "Delay message", true), + + TRANSACTION("TRANSACTION", "Transaction message", true), + + LITE("LITE", "LiteTopic", true); + + private final String value; + private final String description; + private final boolean requiresSpecialConfig; + + TopicType(String value, String description, boolean requiresSpecialConfig) { + this.value = value; + this.description = description; + this.requiresSpecialConfig = requiresSpecialConfig; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public boolean isRequiresSpecialConfig() { + return requiresSpecialConfig; + } + + public boolean isV5Specific() { + return this == LITE; + } + + public boolean isNotSupportedInV4() { + return this == LITE; + } + + public static TopicType fromValue(String value) { + for (TopicType type : values()) { + if (type.getValue().equals(value)) { + return type; + } + } + throw new IllegalArgumentException("Unknown topic type: " + value); + } +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/User.java b/server/src/main/java/org/apache/rocketmq/studio/model/User.java new file mode 100644 index 00000000..020aed11 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/User.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +import org.hibernate.validator.constraints.Range; + +public class User { + public static final int SUPER = 0; + public static final int NORMAL = 1; + + private long id; + private String name; + private String password; + @Range(min = 0, max = 1) + private int type = 0; + + + public User(String name, String password, int type) { + this.name = name; + this.password = password; + this.type = type; + } + + public User cloneOne() { + return new User(this.name, this.password, this.type); + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", name='" + name + '\'' + + ", password='" + password + '\'' + + ", type=" + type + + '}'; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/UserInfo.java b/server/src/main/java/org/apache/rocketmq/studio/model/UserInfo.java new file mode 100644 index 00000000..b5f21236 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/UserInfo.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model; + +public class UserInfo { + public static final String USER_INFO = "userInfo"; + private User user; + private long loginTime; + private String ip; + private String sessionId; + + public long getLoginTime() { + return loginTime; + } + + public void setLoginTime(long loginTime) { + this.loginTime = loginTime; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public String getSessionId() { + return sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + @Override + public String toString() { + return "UserInfo{" + + "user=" + user + + ", loginTime=" + loginTime + + ", ip='" + ip + '\'' + + ", sessionId='" + sessionId + '\'' + + '}'; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/ArchitectureSwitchRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/ArchitectureSwitchRequest.java new file mode 100644 index 00000000..574eb099 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/ArchitectureSwitchRequest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + +/** + * Request body for architecture switch operation. + * + * <p>Used by {@code POST /api/architecture/switch} to dynamically switch + * the dashboard between different cluster architecture types.</p> + * + * <p>For V5 architectures (V5_PROXY_LOCAL, V5_PROXY_CLUSTER), the + * {@code proxyAddresses} and {@code nameSrvAddress} fields are required. + * For V4 architecture, only {@code accessType} is needed.</p> + */ +public class ArchitectureSwitchRequest { + + /** + * Target access type name (e.g., "V4_NAMESRV", "V5_PROXY_LOCAL", "V5_PROXY_CLUSTER"). + * Must match a value in {@link org.apache.rocketmq.studio.architecture.ClusterAccessType}. + */ + private String accessType; + + /** + * Proxy node addresses for V5 architecture. + * Required when accessType is V5_PROXY_LOCAL or V5_PROXY_CLUSTER. + */ + private String[] proxyAddresses; + + /** + * NameServer address for Remoting fallback. + * Required when accessType is V5_PROXY_LOCAL or V5_PROXY_CLUSTER. + */ + private String nameSrvAddress; + + public String getAccessType() { + return accessType; + } + + public void setAccessType(String accessType) { + this.accessType = accessType; + } + + public String[] getProxyAddresses() { + return proxyAddresses; + } + + public void setProxyAddresses(String[] proxyAddresses) { + this.proxyAddresses = proxyAddresses; + } + + public String getNameSrvAddress() { + return nameSrvAddress; + } + + public void setNameSrvAddress(String nameSrvAddress) { + this.nameSrvAddress = nameSrvAddress; + } +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/MessageQuery.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/MessageQuery.java new file mode 100644 index 00000000..141ce421 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/MessageQuery.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + +public class MessageQuery { + /** + * current page num + */ + private int pageNum; + + private int pageSize; + + private String topic; + + private String taskId; + + private long begin; + + private long end; + + public int getPageNum() { + return pageNum; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public long getBegin() { + return begin; + } + + public void setBegin(long begin) { + this.begin = begin; + } + + public long getEnd() { + return end; + } + + public void setEnd(long end) { + this.end = end; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/MetricsDataSourceRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/MetricsDataSourceRequest.java new file mode 100644 index 00000000..72846b2b --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/MetricsDataSourceRequest.java @@ -0,0 +1,211 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + + +/** + * Metrics data source configuration request DTO. + * + * <p>Used for creating and updating Prometheus-compatible data source + * configurations for the PromQL proxy query feature.</p> + * + * <h3>Supported Data Source Types</h3> + * <ul> + * <li><b>PROMETHEUS:</b> Standard Prometheus HTTP API server</li> + * <li><b>VICTORIAMETRICS:</b> VictoriaMetrics (Prometheus-compatible)</li> + * <li><b>THANOS:</b> Thanos Query (Prometheus-compatible)</li> + * <li><b>CORTEX:</b> Cortex (Prometheus-compatible)</li> + * </ul> + */ +public class MetricsDataSourceRequest { + + /** + * Data source display name (required for create). + */ + private String name; + + /** + * Data source type (PROMETHEUS, VICTORIAMETRICS, THANOS, CORTEX). + * Defaults to PROMETHEUS if not specified. + */ + private String type; + + /** + * Prometheus-compatible backend provider type. + * Supported: PROMETHEUS, VICTORIAMETRICS, THANOS, MIMIR, CORTEX, ARMS, CUSTOM + */ + private String providerType = "PROMETHEUS"; + + /** + * Data source URL (required for create). + * Example: "http://prometheus:9090" + */ + private String url; + + /** + * Authentication username (optional). + */ + private String username; + + /** + * Authentication password (optional). + */ + private String password; + + /** + * Bearer token for authentication (optional). + * If set, takes precedence over username/password. + */ + private String bearerToken; + + /** + * Whether this data source is the default for PromQL queries. + * Only one data source can be the default at a time. + */ + private boolean isDefault; + + /** + * Whether this data source is read-only. + * Read-only data sources only support query operations. + */ + private boolean readOnly; + + /** + * Custom HTTP headers to include in requests to this data source. + * Format: "Header-Name: Header-Value" per line. + */ + private String customHeaders; + + /** + * Connection timeout in milliseconds (default: 5000). + */ + private Integer connectionTimeoutMs; + + /** + * Read timeout in milliseconds (default: 30000). + */ + private Integer readTimeoutMs; + + /** + * Additional description or notes about this data source. + */ + private String description; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getProviderType() { + return providerType; + } + + public void setProviderType(String providerType) { + this.providerType = providerType; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getBearerToken() { + return bearerToken; + } + + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + public boolean isIsDefault() { + return isDefault; + } + + public void setIsDefault(boolean isDefault) { + this.isDefault = isDefault; + } + + public boolean isReadOnly() { + return readOnly; + } + + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + + public String getCustomHeaders() { + return customHeaders; + } + + public void setCustomHeaders(String customHeaders) { + this.customHeaders = customHeaders; + } + + public Integer getConnectionTimeoutMs() { + return connectionTimeoutMs; + } + + public void setConnectionTimeoutMs(Integer connectionTimeoutMs) { + this.connectionTimeoutMs = connectionTimeoutMs; + } + + public Integer getReadTimeoutMs() { + return readTimeoutMs; + } + + public void setReadTimeoutMs(Integer readTimeoutMs) { + this.readTimeoutMs = readTimeoutMs; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} \ No newline at end of file diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/ResetOffsetRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/ResetOffsetRequest.java new file mode 100644 index 00000000..f741dd3f --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/ResetOffsetRequest.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + +import java.util.List; + +public class ResetOffsetRequest { + private List<String> consumerGroupList; + private String topic; + private long resetTime; + private boolean force; + + public List<String> getConsumerGroupList() { + return consumerGroupList; + } + + public void setConsumerGroupList(List<String> consumerGroupList) { + this.consumerGroupList = consumerGroupList; + } + + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public long getResetTime() { + return resetTime; + } + + public void setResetTime(long resetTime) { + this.resetTime = resetTime; + } + + public boolean isForce() { + return force; + } + + public void setForce(boolean force) { + this.force = force; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/SendTopicMessageRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/SendTopicMessageRequest.java new file mode 100644 index 00000000..624b739e --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/SendTopicMessageRequest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + + +public class SendTopicMessageRequest { + private String topic; + private String key; + private String tag; + private String messageBody; + private boolean traceEnabled; + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getMessageBody() { + return messageBody; + } + + public void setMessageBody(String messageBody) { + this.messageBody = messageBody; + } + + public boolean isTraceEnabled() { + return traceEnabled; + } + + public void setTraceEnabled(boolean traceEnabled) { + this.traceEnabled = traceEnabled; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeList.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeList.java new file mode 100644 index 00000000..ec059079 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeList.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + +import java.util.List; + +public class TopicTypeList { + private List<String> topicNameList; + private List<String> messageTypeList; + + public List<String> getTopicNameList() { + return topicNameList; + } + + public void setTopicNameList(List<String> topicNameList) { + this.topicNameList = topicNameList; + } + + public List<String> getMessageTypeList() { + return messageTypeList; + } + + public void setMessageTypeList(List<String> messageTypeList) { + this.messageTypeList = messageTypeList; + } + + public TopicTypeList(List<String> topicNameList, List<String> messageTypeList) { + this.topicNameList = topicNameList; + this.messageTypeList = messageTypeList; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeMeta.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeMeta.java new file mode 100644 index 00000000..22148962 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/TopicTypeMeta.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + +public class TopicTypeMeta { + private String topicName; + private String messageType; + + public String getTopicName() { + return topicName; + } + + public void setTopicName(String topicName) { + this.topicName = topicName; + } + + public String getMessageType() { + return messageType; + } + + public void setMessageType(String messageType) { + this.messageType = messageType; + } +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/UserCreateRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserCreateRequest.java new file mode 100644 index 00000000..20a76d53 --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserCreateRequest.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + + +public class UserCreateRequest { + private String clusterName; + private String brokerName; + private UserInfoParam userInfo; + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getBrokerName() { + return brokerName; + } + + public void setBrokerName(String brokerName) { + this.brokerName = brokerName; + } + + public UserInfoParam getUserInfo() { + return userInfo; + } + + public void setUserInfo(UserInfoParam userInfo) { + this.userInfo = userInfo; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/UserInfoParam.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserInfoParam.java new file mode 100644 index 00000000..f733edbd --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserInfoParam.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + + +public class UserInfoParam { + private String username; + private String password; + private String userStatus; + private String userType; + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUserStatus() { + return userStatus; + } + + public void setUserStatus(String userStatus) { + this.userStatus = userStatus; + } + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + +} diff --git a/server/src/main/java/org/apache/rocketmq/studio/model/request/UserUpdateRequest.java b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserUpdateRequest.java new file mode 100644 index 00000000..65e8596d --- /dev/null +++ b/server/src/main/java/org/apache/rocketmq/studio/model/request/UserUpdateRequest.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.rocketmq.studio.model.request; + + +public class UserUpdateRequest { + private String clusterName; + private String brokerName; + private UserInfoParam userInfo; + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } + + public String getBrokerName() { + return brokerName; + } + + public void setBrokerName(String brokerName) { + this.brokerName = brokerName; + } + + public UserInfoParam getUserInfo() { + return userInfo; + } + + public void setUserInfo(UserInfoParam userInfo) { + this.userInfo = userInfo; + } + +}
