Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7d1c68f

Browse files
authoredNov 22, 2024··
Merge branch 'apache:griffin-2.0.0-dev' into griffin-2.0.0-dev
2 parents ed3f762 + 47af255 commit 7d1c68f

35 files changed

+1779
-23
lines changed
 

‎griffin-bom/pom.xml

+149-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ under the License.
2626
<groupId>org.apache.griffin</groupId>
2727
<artifactId>griffin</artifactId>
2828
<version>2.0.0-SNAPSHOT</version>
29-
<relativePath/>
3029
</parent>
3130

3231
<groupId>org.apache.griffin</groupId>
@@ -37,12 +36,160 @@ under the License.
3736
<url>https://griffin.apache.org</url>
3837

3938
<properties>
40-
39+
<spring-boot.version>2.7.3</spring-boot.version>
40+
<mybatis-plus.version>3.5.2</mybatis-plus.version>
41+
<commons-codec.version>1.11</commons-codec.version>
42+
<commons-logging.version>1.1.1</commons-logging.version>
43+
<commons-lang3.version>3.12.0</commons-lang3.version>
44+
<commons-httpclient>3.0.1</commons-httpclient>
45+
<commons-beanutils.version>1.9.4</commons-beanutils.version>
46+
<commons-configuration.version>1.10</commons-configuration.version>
47+
<commons-email.version>1.5</commons-email.version>
48+
<commons-collections4.version>4.3</commons-collections4.version>
49+
<httpclient.version>4.5.13</httpclient.version>
50+
<httpcore.version>4.4.15</httpcore.version>
51+
<jackson.version>2.13.4</jackson.version>
52+
<slf4j.version>1.7.36</slf4j.version>
53+
<logback.version>1.2.11</logback.version>
54+
<h2.version>2.2.220</h2.version>
55+
<mysql-connector.version>8.0.28</mysql-connector.version>
56+
<commons-io.version>2.11.0</commons-io.version>
57+
<presto-jdbc.version>0.238.1</presto-jdbc.version>
58+
<joda-time.version>2.10.13</joda-time.version>
59+
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
60+
<snakeyaml.version>1.33</snakeyaml.version>
4161
</properties>
4262

4363

4464
<dependencyManagement>
4565
<dependencies>
66+
<!-- spring -->
67+
<dependency>
68+
<groupId>org.springframework.boot</groupId>
69+
<artifactId>spring-boot-starter-parent</artifactId>
70+
<version>${spring-boot.version}</version>
71+
<type>pom</type>
72+
<scope>import</scope>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.springframework</groupId>
76+
<artifactId>spring-test</artifactId>
77+
<scope>test</scope>
78+
</dependency>
79+
80+
<!-- mybatis -->
81+
<dependency>
82+
<groupId>com.baomidou</groupId>
83+
<artifactId>mybatis-plus-boot-starter</artifactId>
84+
<version>${mybatis-plus.version}</version>
85+
</dependency>
86+
<dependency>
87+
<groupId>com.baomidou</groupId>
88+
<artifactId>mybatis-plus</artifactId>
89+
<version>${mybatis-plus.version}</version>
90+
</dependency>
91+
<dependency>
92+
<groupId>com.baomidou</groupId>
93+
<artifactId>mybatis-plus-annotation</artifactId>
94+
<version>${mybatis-plus.version}</version>
95+
</dependency>
96+
97+
<!-- jackson -->
98+
<dependency>
99+
<groupId>com.fasterxml.jackson.core</groupId>
100+
<artifactId>jackson-annotations</artifactId>
101+
<version>${jackson.version}</version>
102+
</dependency>
103+
<dependency>
104+
<groupId>com.fasterxml.jackson.core</groupId>
105+
<artifactId>jackson-databind</artifactId>
106+
<version>${jackson.version}</version>
107+
</dependency>
108+
<dependency>
109+
<groupId>com.fasterxml.jackson.core</groupId>
110+
<artifactId>jackson-core</artifactId>
111+
<version>${jackson.version}</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>com.fasterxml.jackson.datatype</groupId>
115+
<artifactId>jackson-datatype-jsr310</artifactId>
116+
<version>${jackson.version}</version>
117+
</dependency>
118+
119+
<!-- db connectors -->
120+
<dependency>
121+
<groupId>mysql</groupId>
122+
<artifactId>mysql-connector-java</artifactId>
123+
<version>${mysql-connector.version}</version>
124+
</dependency>
125+
126+
<dependency>
127+
<groupId>com.h2database</groupId>
128+
<artifactId>h2</artifactId>
129+
<version>${h2.version}</version>
130+
</dependency>
131+
132+
<!-- sl4j -->
133+
<dependency>
134+
<groupId>org.slf4j</groupId>
135+
<artifactId>slf4j-api</artifactId>
136+
<version>${slf4j.version}</version>
137+
</dependency>
138+
<dependency>
139+
<groupId>org.slf4j</groupId>
140+
<artifactId>slf4j-log4j12</artifactId>
141+
<version>${slf4j.version}</version>
142+
</dependency>
143+
<!-- logback -->
144+
<dependency>
145+
<groupId>ch.qos.logback</groupId>
146+
<artifactId>logback-classic</artifactId>
147+
<version>${logback.version}</version>
148+
</dependency>
149+
<dependency>
150+
<groupId>ch.qos.logback</groupId>
151+
<artifactId>logback-core</artifactId>
152+
<version>${logback.version}</version>
153+
</dependency>
154+
155+
<dependency>
156+
<groupId>com.google.guava</groupId>
157+
<artifactId>guava</artifactId>
158+
<version>${guava.version}</version>
159+
</dependency>
160+
161+
<dependency>
162+
<groupId>org.apache.commons</groupId>
163+
<artifactId>commons-collections4</artifactId>
164+
<version>${commons-collections4.version}</version>
165+
</dependency>
166+
167+
<dependency>
168+
<groupId>commons-io</groupId>
169+
<artifactId>commons-io</artifactId>
170+
<version>${commons-io.version}</version>
171+
</dependency>
172+
173+
<dependency>
174+
<groupId>joda-time</groupId>
175+
<artifactId>joda-time</artifactId>
176+
<version>${joda-time.version}</version>
177+
</dependency>
178+
179+
<dependency>
180+
<groupId>org.springframework.cloud</groupId>
181+
<artifactId>spring-cloud-dependencies</artifactId>
182+
<version>${spring-cloud-dependencies.version}</version>
183+
<type>pom</type>
184+
<scope>import</scope>
185+
</dependency>
186+
187+
<dependency>
188+
<groupId>org.yaml</groupId>
189+
<artifactId>snakeyaml</artifactId>
190+
<version>${snakeyaml.version}</version>
191+
</dependency>
192+
46193
</dependencies>
47194
</dependencyManagement>
48195

‎griffin-metric/pom.xml

+93
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,98 @@ under the License.
3232
<name>${project.artifactId}</name>
3333
<packaging>jar</packaging>
3434

35+
<dependencyManagement>
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.apache.griffin</groupId>
39+
<artifactId>griffin-bom</artifactId>
40+
<version>${project.version}</version>
41+
<type>pom</type>
42+
<scope>import</scope>
43+
</dependency>
44+
</dependencies>
45+
</dependencyManagement>
3546

47+
<dependencies>
48+
<!--springboot-->
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-starter-web</artifactId>
52+
<!-- <exclusions>-->
53+
<!-- <exclusion>-->
54+
<!-- <groupId>org.springframework.boot</groupId>-->
55+
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
56+
<!-- </exclusion>-->
57+
<!-- <exclusion>-->
58+
<!-- <groupId>org.apache.logging.log4j</groupId>-->
59+
<!-- <artifactId>log4j-to-slf4j</artifactId>-->
60+
<!-- </exclusion>-->
61+
<!-- </exclusions>-->
62+
</dependency>
63+
<!-- <dependency>-->
64+
<!-- <groupId>org.springframework.boot</groupId>-->
65+
<!-- <artifactId>spring-boot-starter-jetty</artifactId>-->
66+
<!-- <exclusions>-->
67+
<!-- <exclusion>-->
68+
<!-- <groupId>org.eclipse.jetty.websocket</groupId>-->
69+
<!-- <artifactId>javax-websocket-server-impl</artifactId>-->
70+
<!-- </exclusion>-->
71+
<!-- <exclusion>-->
72+
<!-- <groupId>org.eclipse.jetty.websocket</groupId>-->
73+
<!-- <artifactId>websocket-server</artifactId>-->
74+
<!-- </exclusion>-->
75+
<!-- </exclusions>-->
76+
<!-- </dependency>-->
77+
78+
<dependency>
79+
<groupId>org.apache.commons</groupId>
80+
<artifactId>commons-collections4</artifactId>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>com.baomidou</groupId>
85+
<artifactId>mybatis-plus</artifactId>
86+
</dependency>
87+
<dependency>
88+
<groupId>com.baomidou</groupId>
89+
<artifactId>mybatis-plus-boot-starter</artifactId>
90+
<exclusions>
91+
<exclusion>
92+
<groupId>org.apache.logging.log4j</groupId>
93+
<artifactId>log4j-to-slf4j</artifactId>
94+
</exclusion>
95+
</exclusions>
96+
</dependency>
97+
98+
<dependency>
99+
<groupId>org.springframework.boot</groupId>
100+
<artifactId>spring-boot-starter-test</artifactId>
101+
<scope>test</scope>
102+
</dependency>
103+
104+
<dependency>
105+
<groupId>com.zaxxer</groupId>
106+
<artifactId>HikariCP</artifactId>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>com.h2database</groupId>
111+
<artifactId>h2</artifactId>
112+
<!-- <scope>test</scope>-->
113+
</dependency>
114+
115+
<dependency>
116+
<groupId>mysql</groupId>
117+
<artifactId>mysql-connector-java</artifactId>
118+
</dependency>
119+
</dependencies>
120+
121+
<build>
122+
<plugins>
123+
<plugin>
124+
<groupId>org.springframework.boot</groupId>
125+
<artifactId>spring-boot-maven-plugin</artifactId>
126+
</plugin>
127+
</plugins>
128+
</build>
36129
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric;
19+
20+
import lombok.extern.slf4j.Slf4j;
21+
import org.springframework.boot.SpringApplication;
22+
import org.springframework.boot.autoconfigure.SpringBootApplication;
23+
24+
@Slf4j
25+
@SpringBootApplication
26+
public class DAOApplication {
27+
public static void main(String[] args) {
28+
SpringApplication.run(DAOApplication.class, args);
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao;
19+
20+
import org.apache.commons.collections4.CollectionUtils;
21+
22+
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
23+
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
24+
import lombok.NonNull;
25+
26+
import java.io.Serializable;
27+
import java.util.Collection;
28+
import java.util.Collections;
29+
import java.util.List;
30+
import java.util.Optional;
31+
32+
public abstract class BaseDao<E, M extends BaseMapper<E>> implements IDao<E> {
33+
34+
protected M mybatisMapper;
35+
36+
public BaseDao(@NonNull M mybatisMapper) {
37+
this.mybatisMapper = mybatisMapper;
38+
}
39+
40+
@Override
41+
public E queryById(@NonNull Serializable id) {
42+
return mybatisMapper.selectById(id);
43+
}
44+
45+
@Override
46+
public Optional<E> queryOptionalById(@NonNull Serializable id) {
47+
return Optional.ofNullable(queryById(id));
48+
}
49+
50+
@Override
51+
public List<E> queryByIds(Collection<? extends Serializable> ids) {
52+
if (CollectionUtils.isEmpty(ids)) {
53+
return Collections.emptyList();
54+
}
55+
return mybatisMapper.selectBatchIds(ids);
56+
}
57+
58+
@Override
59+
public List<E> queryAll() {
60+
return mybatisMapper.selectList(null);
61+
}
62+
63+
@Override
64+
public List<E> queryByCondition(E queryCondition) {
65+
if (queryCondition == null) {
66+
throw new IllegalArgumentException("queryCondition can not be null.");
67+
}
68+
return mybatisMapper.selectList(new QueryWrapper<>(queryCondition));
69+
}
70+
71+
@Override
72+
public int insert(@NonNull E entity) {
73+
return mybatisMapper.insert(entity);
74+
}
75+
76+
@Override
77+
public void insertBatch(Collection<E> entities) {
78+
if (CollectionUtils.isEmpty(entities)) {
79+
return;
80+
}
81+
for (E e : entities) {
82+
insert(e);
83+
}
84+
}
85+
86+
@Override
87+
public boolean updateById(@NonNull E entity) {
88+
return mybatisMapper.updateById(entity) > 0;
89+
}
90+
91+
@Override
92+
public boolean deleteById(@NonNull Serializable id) {
93+
return mybatisMapper.deleteById(id) > 0;
94+
}
95+
96+
@Override
97+
public boolean deleteByIds(Collection<? extends Serializable> ids) {
98+
if (CollectionUtils.isEmpty(ids)) {
99+
return true;
100+
}
101+
return mybatisMapper.deleteBatchIds(ids) > 0;
102+
}
103+
104+
@Override
105+
public boolean deleteByCondition(E queryCondition) {
106+
if (queryCondition == null) {
107+
throw new IllegalArgumentException("queryCondition can not be null.");
108+
}
109+
return mybatisMapper.delete(new QueryWrapper<>(queryCondition)) > 0;
110+
}
111+
112+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
*/
20+
21+
package org.apache.griffin.metric.dao;
22+
23+
import org.mybatis.spring.annotation.MapperScan;
24+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
25+
import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
26+
import org.springframework.context.annotation.ComponentScan;
27+
import org.springframework.context.annotation.Configuration;
28+
29+
@Configuration
30+
@ComponentScan("org.apache.griffin.metric")
31+
@EnableAutoConfiguration
32+
@MapperScan(basePackages = "org.apache.griffin.metric.dao.mapper", sqlSessionFactoryRef = "sqlSessionFactory")
33+
public class DaoConfiguration {
34+
35+
public final DataSourceScriptDatabaseInitializer dataSourceScriptDatabaseInitializer;
36+
37+
public DaoConfiguration(DataSourceScriptDatabaseInitializer dsScriptDatabaseInitializer) {
38+
this.dataSourceScriptDatabaseInitializer = dsScriptDatabaseInitializer;
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao;
19+
20+
import lombok.NonNull;
21+
22+
import java.io.Serializable;
23+
import java.util.Collection;
24+
import java.util.List;
25+
import java.util.Optional;
26+
27+
public interface IDao<E> {
28+
29+
/**
30+
* Query by the primary key.
31+
* @param id Unique identity of E
32+
* @return E if exist
33+
*/
34+
E queryById(@NonNull Serializable id);
35+
36+
/**
37+
* Query by the primary key.
38+
* @param id Unique identity of E
39+
* @return {@code Optional}
40+
*/
41+
Optional<E> queryOptionalById(@NonNull Serializable id);
42+
43+
List<E> queryByIds(Collection<? extends Serializable> ids);
44+
45+
List<E> queryAll();
46+
47+
List<E> queryByCondition(E queryCondition);
48+
49+
int insert(@NonNull E model);
50+
51+
void insertBatch(Collection<E> entities);
52+
53+
boolean updateById(@NonNull E entity);
54+
55+
boolean deleteById(@NonNull Serializable id);
56+
57+
boolean deleteByIds(Collection<? extends Serializable> ids);
58+
59+
boolean deleteByCondition(E queryCondition);
60+
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao;
19+
20+
import lombok.extern.slf4j.Slf4j;
21+
import org.apache.griffin.metric.dao.mapper.MetricDMapper;
22+
import org.apache.griffin.metric.entity.MetricD;
23+
import org.apache.griffin.metric.exception.GriffinErr;
24+
import org.apache.griffin.metric.exception.GriffinException;
25+
import org.springframework.stereotype.Repository;
26+
27+
@Repository
28+
@Slf4j
29+
public class MetricDDao extends BaseDao<MetricD, MetricDMapper> {
30+
31+
public static final String NOT_BE_NULL = "The metricD argument is illegal." +
32+
"Either metricD entity or metric name attribute must not be null.";
33+
34+
public MetricDDao(MetricDMapper metricDMapper) {
35+
super(metricDMapper);
36+
}
37+
38+
public int addMetricD(MetricD metricD) {
39+
validateEntity(metricD);
40+
int count = 0;
41+
try {
42+
count = mybatisMapper.insert(metricD);
43+
} catch (Exception e) {
44+
throw new GriffinException(e);
45+
}
46+
log.info("add metricD: {}, count: {}", metricD, count);
47+
return count;
48+
}
49+
50+
private void validateEntity(MetricD metricD) {
51+
if (null == metricD || null == metricD.getMetricName()) {
52+
log.error(NOT_BE_NULL);
53+
throw new GriffinException(NOT_BE_NULL, GriffinErr.validationError);
54+
}
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.apache.griffin.metric.dao;
2+
3+
import lombok.NonNull;
4+
import lombok.extern.slf4j.Slf4j;
5+
import org.apache.griffin.metric.dao.mapper.MetricTagDMapper;
6+
import org.apache.griffin.metric.entity.MetricTagD;
7+
import org.springframework.stereotype.Repository;
8+
9+
@Repository
10+
@Slf4j
11+
public class MetricTagDDao extends BaseDao<MetricTagD, MetricTagDMapper>{
12+
13+
public MetricTagDDao(@NonNull MetricTagDMapper mybatisMapper) {
14+
super(mybatisMapper);
15+
}
16+
17+
public int addMetricTagD(MetricTagD metricTagD) {
18+
if (metricTagD == null) {
19+
log.warn("metricTagD is invalid");
20+
return 0;
21+
}
22+
23+
int count = mybatisMapper.insert(metricTagD);
24+
log.info("add metricTagD: {}, count: {}", metricTagD, count);
25+
return count;
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.apache.griffin.metric.dao;
2+
3+
import lombok.NonNull;
4+
import lombok.extern.slf4j.Slf4j;
5+
import org.apache.griffin.metric.dao.mapper.MetricVMapper;
6+
import org.apache.griffin.metric.entity.MetricV;
7+
import org.springframework.stereotype.Repository;
8+
9+
@Repository
10+
@Slf4j
11+
public class MetricVDao extends BaseDao<MetricV, MetricVMapper>{
12+
public MetricVDao(@NonNull MetricVMapper mybatisMapper) {
13+
super(mybatisMapper);
14+
}
15+
16+
public int addMetricV(MetricV metricV) {
17+
if (metricV == null) {
18+
log.warn("metricV is invalid");
19+
return 0;
20+
}
21+
int count = mybatisMapper.insert(metricV);
22+
log.info("add metricV: {}, count: {}", metricV, count);
23+
return count;
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.apache.griffin.metric.dao;
2+
3+
import lombok.NonNull;
4+
import lombok.extern.slf4j.Slf4j;
5+
import org.apache.griffin.metric.dao.mapper.TagsMapper;
6+
import org.apache.griffin.metric.entity.TagAttachment;
7+
import org.springframework.stereotype.Repository;
8+
9+
import java.util.Objects;
10+
11+
@Repository
12+
@Slf4j
13+
public class TagAttachmentDao extends BaseDao<TagAttachment, TagsMapper> {
14+
15+
public TagAttachmentDao(@NonNull TagsMapper mybatisMapper) {
16+
super(mybatisMapper);
17+
}
18+
19+
public int addMetricTags(TagAttachment tagAttachment) {
20+
if (Objects.isNull(tagAttachment)) {
21+
log.warn("tags is invalid");
22+
return 0;
23+
}
24+
25+
if (Objects.isNull(tagAttachment.getMetricId())) {
26+
log.warn("metric id is invalid");
27+
return 0;
28+
}
29+
30+
TagAttachment existence = mybatisMapper.selectById(tagAttachment.getMetricId());
31+
if (Objects.nonNull(existence)) {
32+
log.warn("tagAttachment has existed");
33+
return 0;
34+
}
35+
36+
int count = mybatisMapper.insert(tagAttachment);
37+
log.info("add tags: {}, count: {}", tagAttachment, count);
38+
return count;
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao.mapper;
19+
20+
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
21+
import org.apache.griffin.metric.entity.MetricD;
22+
import org.apache.ibatis.annotations.Mapper;
23+
import org.apache.ibatis.annotations.Param;
24+
25+
@Mapper
26+
public interface MetricDMapper extends BaseMapper<MetricD> {
27+
MetricD queryByName(@Param("metricName") String metricName);
28+
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.apache.griffin.metric.dao.mapper;
2+
3+
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4+
import org.apache.griffin.metric.entity.MetricTagD;
5+
import org.apache.ibatis.annotations.Mapper;
6+
7+
@Mapper
8+
public interface MetricTagDMapper extends BaseMapper<MetricTagD> {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.apache.griffin.metric.dao.mapper;
2+
3+
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4+
import org.apache.griffin.metric.entity.MetricV;
5+
import org.apache.ibatis.annotations.Mapper;
6+
7+
@Mapper
8+
public interface MetricVMapper extends BaseMapper<MetricV> {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.apache.griffin.metric.dao.mapper;
2+
3+
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4+
import org.apache.griffin.metric.entity.TagAttachment;
5+
import org.apache.ibatis.annotations.Mapper;
6+
7+
@Mapper
8+
public interface TagsMapper extends BaseMapper<TagAttachment> {
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
package org.apache.griffin.metric.entity;
21+
22+
import com.baomidou.mybatisplus.annotation.TableField;
23+
import com.fasterxml.jackson.annotation.JsonInclude;
24+
import com.fasterxml.jackson.annotation.JsonProperty;
25+
import lombok.Data;
26+
27+
import java.util.Date;
28+
29+
/**
30+
* A base class in metric function in griffin, which contains timestamp properties of entity creation/update.
31+
*/
32+
@Data
33+
@JsonInclude(JsonInclude.Include.NON_NULL)
34+
public abstract class BaseEntity implements java.io.Serializable {
35+
36+
private static final long serialVersionUID = 2110740953277261851L;
37+
38+
/**
39+
* creation time
40+
*/
41+
@JsonProperty(value = "creation_time")
42+
@TableField(value = "ctime")
43+
protected Date ctime;
44+
45+
/**
46+
* update time
47+
*/
48+
@JsonProperty(value = "update_time")
49+
@TableField(value = "mtime")
50+
protected Date mtime;
51+
52+
public void prePersist() {
53+
Date date = new Date();
54+
if (ctime == null) {
55+
ctime = date;
56+
}
57+
if (mtime == null) {
58+
mtime = date;
59+
}
60+
}
61+
62+
public void preUpdate() {
63+
mtime = new Date();
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
package org.apache.griffin.metric.entity;
21+
22+
import com.baomidou.mybatisplus.annotation.IdType;
23+
import com.baomidou.mybatisplus.annotation.TableField;
24+
import com.baomidou.mybatisplus.annotation.TableId;
25+
import com.baomidou.mybatisplus.annotation.TableName;
26+
import com.fasterxml.jackson.annotation.JsonInclude;
27+
import lombok.AllArgsConstructor;
28+
import lombok.Builder;
29+
import lombok.Data;
30+
import lombok.EqualsAndHashCode;
31+
import lombok.NoArgsConstructor;
32+
33+
/**
34+
* A metric definition entity represents fundamental metadata.
35+
*/
36+
@Builder
37+
@Data
38+
@NoArgsConstructor
39+
@AllArgsConstructor
40+
@EqualsAndHashCode(callSuper = false)
41+
@JsonInclude(JsonInclude.Include.NON_NULL)
42+
@TableName("t_metric_d")
43+
public class MetricD extends BaseEntity {
44+
45+
/**
46+
* An unique identity for a metric.
47+
*/
48+
@TableId(value="mid", type = IdType.AUTO)
49+
private Long metricId;
50+
51+
/**
52+
* The name of a metric entity.
53+
*/
54+
@TableField(value = "name")
55+
private String metricName;
56+
57+
/**
58+
* The owner of a metric entity.
59+
*/
60+
@TableField(value = "owner")
61+
private String owner;
62+
63+
/**
64+
* The details of a metric entity.
65+
*/
66+
@TableField(value = "description")
67+
private String description;
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
package org.apache.griffin.metric.entity;
21+
22+
import com.baomidou.mybatisplus.annotation.IdType;
23+
import com.baomidou.mybatisplus.annotation.TableField;
24+
import com.baomidou.mybatisplus.annotation.TableId;
25+
import com.baomidou.mybatisplus.annotation.TableName;
26+
import lombok.AllArgsConstructor;
27+
import lombok.Builder;
28+
import lombok.Data;
29+
import lombok.EqualsAndHashCode;
30+
import lombok.NoArgsConstructor;
31+
32+
/**
33+
* A metric tag entity represents fundamental information.
34+
*/
35+
@Builder
36+
@Data
37+
@NoArgsConstructor
38+
@AllArgsConstructor
39+
@EqualsAndHashCode(callSuper = false)
40+
@TableName("t_tag_d")
41+
public class MetricTagD extends BaseEntity {
42+
43+
/**
44+
* An unique identity for a metric tag.
45+
*/
46+
@TableId(value="tid", type = IdType.AUTO)
47+
private Long id;
48+
49+
/**
50+
* Key name
51+
*/
52+
@TableField(value = "name")
53+
private String tagKey;
54+
55+
/**
56+
* The value corresponding to a key
57+
*/
58+
@TableField(value = "val")
59+
private String tagValue;
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
package org.apache.griffin.metric.entity;
21+
22+
import com.baomidou.mybatisplus.annotation.IdType;
23+
import com.baomidou.mybatisplus.annotation.TableField;
24+
import com.baomidou.mybatisplus.annotation.TableId;
25+
import lombok.AllArgsConstructor;
26+
import lombok.Builder;
27+
import lombok.Data;
28+
import lombok.EqualsAndHashCode;
29+
import lombok.NoArgsConstructor;
30+
import lombok.ToString;
31+
32+
import com.baomidou.mybatisplus.annotation.TableName;
33+
34+
/**
35+
* A metric value entity represents fundamental information.
36+
*/
37+
@Data
38+
@ToString
39+
@Builder
40+
@NoArgsConstructor
41+
@AllArgsConstructor
42+
@EqualsAndHashCode(callSuper = false)
43+
@TableName("t_metric_v")
44+
public class MetricV extends BaseEntity {
45+
46+
/**
47+
* An unique identity for a metric.
48+
*/
49+
@TableId(value="mid", type = IdType.AUTO)
50+
private Long metricId;
51+
52+
/**
53+
* A double number to store metric value.
54+
*/
55+
@TableField(value = "val")
56+
private double value;
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.entity;
19+
20+
import com.baomidou.mybatisplus.annotation.IdType;
21+
import com.baomidou.mybatisplus.annotation.TableField;
22+
import com.baomidou.mybatisplus.annotation.TableId;
23+
import com.baomidou.mybatisplus.annotation.TableName;
24+
import lombok.AllArgsConstructor;
25+
import lombok.Builder;
26+
import lombok.Data;
27+
import lombok.EqualsAndHashCode;
28+
import lombok.NoArgsConstructor;
29+
30+
/**
31+
* A common tag entity represents the relationships among metric entities and metric tag entities.
32+
*/
33+
@Data
34+
@Builder
35+
@NoArgsConstructor
36+
@AllArgsConstructor
37+
@EqualsAndHashCode(callSuper = false)
38+
@TableName("t_metric_tag")
39+
public class TagAttachment extends BaseEntity {
40+
41+
/**
42+
* Metric entity's identity.
43+
*/
44+
@TableId(value="mid", type = IdType.INPUT)
45+
private Long metricId;
46+
47+
/**
48+
* Metric tag's identity.
49+
*/
50+
@TableField(value="tid")
51+
private Long tagId;
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.apache.griffin.metric.exception;
2+
3+
import lombok.Getter;
4+
5+
public enum GriffinErr {
6+
commonError(101, "Hit an error without details."),
7+
validationError(102, "Data validation fails due to [%s]"),
8+
// db operation errors
9+
dbInsertionError(301, "Fail to insert a record."),
10+
dbUpdateError(302, "Fail to update a record."),
11+
dbDeletionError(303, "Fail to delete a record."),
12+
;
13+
14+
@Getter
15+
private int code;
16+
17+
@Getter
18+
private String message;
19+
20+
GriffinErr(int code, String message) {
21+
this.code = code;
22+
this.message = message;
23+
}
24+
25+
public GriffinErrorEntity buildErrorEntity() {
26+
return new GriffinErrorEntity(this);
27+
}
28+
29+
public GriffinErrorEntity buildErrorEntity(String message) {
30+
return new GriffinErrorEntity(this, message);
31+
}
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.apache.griffin.metric.exception;
2+
3+
import lombok.Data;
4+
import org.apache.griffin.metric.entity.BaseEntity;
5+
6+
@Data
7+
public class GriffinErrorEntity extends BaseEntity {
8+
9+
private Integer code;
10+
11+
private String message;
12+
13+
public GriffinErrorEntity(GriffinErr err) {
14+
this.code = err.getCode();
15+
this.message = err.getMessage();
16+
}
17+
18+
public GriffinErrorEntity(GriffinErr err, String details) {
19+
this.code = err.getCode();
20+
this.message = String.format(err.getMessage(), details);
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.apache.griffin.metric.exception;
2+
3+
import lombok.Getter;
4+
5+
public class GriffinException extends RuntimeException {
6+
@Getter
7+
private final GriffinErr error;
8+
9+
public GriffinException(String message) {
10+
super(message);
11+
this.error = GriffinErr.commonError;
12+
}
13+
14+
public GriffinException(Throwable cause) {
15+
super(cause);
16+
this.error = GriffinErr.commonError;
17+
}
18+
19+
public GriffinException(String message, Throwable cause) {
20+
super(message, cause);
21+
this.error = GriffinErr.commonError;
22+
}
23+
24+
public GriffinException(String message, GriffinErr error) {
25+
super(message);
26+
this.error = error;
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package org.apache.griffin.metric.service;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.griffin.metric.dao.MetricDDao;
5+
import org.apache.griffin.metric.entity.BaseEntity;
6+
import org.apache.griffin.metric.entity.MetricD;
7+
import org.apache.griffin.metric.exception.GriffinErr;
8+
import org.apache.griffin.metric.exception.GriffinException;
9+
import org.springframework.http.HttpStatus;
10+
import org.springframework.http.MediaType;
11+
import org.springframework.http.ResponseEntity;
12+
import org.springframework.lang.NonNull;
13+
import org.springframework.web.bind.annotation.DeleteMapping;
14+
import org.springframework.web.bind.annotation.GetMapping;
15+
import org.springframework.web.bind.annotation.PathVariable;
16+
import org.springframework.web.bind.annotation.PostMapping;
17+
import org.springframework.web.bind.annotation.PutMapping;
18+
import org.springframework.web.bind.annotation.RequestBody;
19+
import org.springframework.web.bind.annotation.ResponseStatus;
20+
import org.springframework.web.bind.annotation.RestController;
21+
22+
import java.util.List;
23+
24+
@RestController
25+
@Slf4j
26+
public class MetricDService {
27+
28+
public static final String METRICD_URI = "/metricD";
29+
30+
private final MetricDDao metricDDao;
31+
32+
public MetricDService(MetricDDao metricDDao) {
33+
this.metricDDao = metricDDao;
34+
}
35+
36+
@GetMapping(value = "/ping", produces = MediaType.APPLICATION_JSON_VALUE)
37+
public String ping() {
38+
return "hello";
39+
}
40+
41+
@GetMapping(value = "/allMetricD", produces = MediaType.APPLICATION_JSON_VALUE)
42+
@ResponseStatus(HttpStatus.OK)
43+
public List<MetricD> allMetricDs() {
44+
return metricDDao.queryAll();
45+
}
46+
47+
@PutMapping(value = METRICD_URI, consumes = MediaType.APPLICATION_JSON_VALUE,
48+
produces = MediaType.APPLICATION_JSON_VALUE)
49+
@ResponseStatus(HttpStatus.CREATED)
50+
public ResponseEntity<BaseEntity> createMetricD(@RequestBody MetricD metricD) {
51+
try {
52+
int id = metricDDao.addMetricD(metricD);
53+
if (id != 1) {
54+
return new ResponseEntity<>(GriffinErr.dbInsertionError.buildErrorEntity(),
55+
HttpStatus.INTERNAL_SERVER_ERROR);
56+
}
57+
return new ResponseEntity<>(metricD, HttpStatus.CREATED);
58+
} catch (GriffinException e) {
59+
return new ResponseEntity<>(e.getError().buildErrorEntity(e.getMessage()),
60+
HttpStatus.INTERNAL_SERVER_ERROR);
61+
}
62+
}
63+
64+
@PostMapping(value = METRICD_URI, consumes = MediaType.APPLICATION_JSON_VALUE,
65+
produces = MediaType.APPLICATION_JSON_VALUE)
66+
@ResponseStatus(HttpStatus.ACCEPTED)
67+
public ResponseEntity<BaseEntity> updateMetricD(MetricD metricD) {
68+
boolean ret = metricDDao.updateById(metricD);
69+
return ret ? new ResponseEntity<>(metricD, HttpStatus.ACCEPTED) : new ResponseEntity<>(
70+
GriffinErr.dbUpdateError.buildErrorEntity(),
71+
HttpStatus.INTERNAL_SERVER_ERROR);
72+
}
73+
74+
@DeleteMapping(value = METRICD_URI + "/{id}")
75+
@ResponseStatus(HttpStatus.OK)
76+
public ResponseEntity<BaseEntity> deleteMetricD(@PathVariable @NonNull String id) {
77+
boolean ret = metricDDao.deleteById(id);
78+
return ret ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(
79+
GriffinErr.dbDeletionError.buildErrorEntity(),
80+
HttpStatus.INTERNAL_SERVER_ERROR);
81+
}
82+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package org.apache.griffin.metric.service;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.griffin.metric.dao.MetricTagDDao;
5+
import org.apache.griffin.metric.dao.TagAttachmentDao;
6+
import org.apache.griffin.metric.entity.BaseEntity;
7+
import org.apache.griffin.metric.entity.MetricTagD;
8+
import org.apache.griffin.metric.entity.TagAttachment;
9+
import org.apache.griffin.metric.exception.GriffinErr;
10+
import org.apache.griffin.metric.exception.GriffinException;
11+
import org.springframework.http.HttpStatus;
12+
import org.springframework.http.MediaType;
13+
import org.springframework.http.ResponseEntity;
14+
import org.springframework.lang.NonNull;
15+
import org.springframework.web.bind.annotation.DeleteMapping;
16+
import org.springframework.web.bind.annotation.PathVariable;
17+
import org.springframework.web.bind.annotation.PostMapping;
18+
import org.springframework.web.bind.annotation.PutMapping;
19+
import org.springframework.web.bind.annotation.RequestBody;
20+
import org.springframework.web.bind.annotation.ResponseStatus;
21+
import org.springframework.web.bind.annotation.RestController;
22+
23+
@RestController
24+
@Slf4j
25+
public class MetricTagService {
26+
27+
public static final String METRIC_TAG_D = "/metricTagD";
28+
29+
public static final String TAGS = "/tags";
30+
31+
private final MetricTagDDao metricTagDDao;
32+
33+
private final TagAttachmentDao tagAttachmentDao;
34+
35+
public MetricTagService(MetricTagDDao metricTagDDao, TagAttachmentDao tagAttachmentDao) {
36+
this.metricTagDDao = metricTagDDao;
37+
this.tagAttachmentDao = tagAttachmentDao;
38+
}
39+
40+
@PutMapping(value = METRIC_TAG_D,consumes = MediaType.APPLICATION_JSON_VALUE,
41+
produces = MediaType.APPLICATION_JSON_VALUE)
42+
@ResponseStatus(HttpStatus.CREATED)
43+
public ResponseEntity<BaseEntity> createMetricTagD(@RequestBody MetricTagD metricTagD) {
44+
try {
45+
int id = metricTagDDao.addMetricTagD(metricTagD);
46+
if (id != 1) {
47+
return new ResponseEntity<>(GriffinErr.dbInsertionError.buildErrorEntity(),
48+
HttpStatus.INTERNAL_SERVER_ERROR);
49+
}
50+
return new ResponseEntity<>(metricTagD, HttpStatus.CREATED);
51+
} catch (GriffinException e) {
52+
return new ResponseEntity<>(e.getError().buildErrorEntity(e.getMessage()),
53+
HttpStatus.INTERNAL_SERVER_ERROR);
54+
}
55+
}
56+
57+
@PostMapping(value = METRIC_TAG_D, consumes = MediaType.APPLICATION_JSON_VALUE,
58+
produces = MediaType.APPLICATION_JSON_VALUE)
59+
@ResponseStatus(HttpStatus.ACCEPTED)
60+
public ResponseEntity<BaseEntity> updateMetricTagD(@RequestBody MetricTagD metricTagD) {
61+
boolean ret = metricTagDDao.updateById(metricTagD);
62+
return ret ? new ResponseEntity<>(metricTagD, HttpStatus.ACCEPTED) : new ResponseEntity<>(
63+
GriffinErr.dbUpdateError.buildErrorEntity(),
64+
HttpStatus.INTERNAL_SERVER_ERROR);
65+
}
66+
67+
@DeleteMapping(value = METRIC_TAG_D + "/{id}")
68+
@ResponseStatus(HttpStatus.OK)
69+
public ResponseEntity<BaseEntity> deleteMetricTagD(@PathVariable @NonNull String id) {
70+
boolean ret = metricTagDDao.deleteById(id);
71+
return ret ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(
72+
GriffinErr.dbDeletionError.buildErrorEntity(),
73+
HttpStatus.INTERNAL_SERVER_ERROR);
74+
}
75+
76+
@PutMapping(value = TAGS,consumes = MediaType.APPLICATION_JSON_VALUE,
77+
produces = MediaType.APPLICATION_JSON_VALUE)
78+
@ResponseStatus(HttpStatus.CREATED)
79+
public ResponseEntity<BaseEntity> attachTags(@RequestBody TagAttachment tagAttachment) {
80+
try {
81+
int id = tagAttachmentDao.addMetricTags(tagAttachment);
82+
if (id != 1) {
83+
return new ResponseEntity<>(GriffinErr.dbInsertionError.buildErrorEntity(),
84+
HttpStatus.INTERNAL_SERVER_ERROR);
85+
}
86+
return new ResponseEntity<>(tagAttachment, HttpStatus.CREATED);
87+
} catch (GriffinException e) {
88+
return new ResponseEntity<>(e.getError().buildErrorEntity(e.getMessage()),
89+
HttpStatus.INTERNAL_SERVER_ERROR);
90+
}
91+
}
92+
93+
@PostMapping(value = TAGS, consumes = MediaType.APPLICATION_JSON_VALUE,
94+
produces = MediaType.APPLICATION_JSON_VALUE)
95+
@ResponseStatus(HttpStatus.ACCEPTED)
96+
public ResponseEntity<BaseEntity> updateMetricD(@RequestBody TagAttachment tagAttachment) {
97+
boolean ret = tagAttachmentDao.updateById(tagAttachment);
98+
return ret ? new ResponseEntity<>(tagAttachment, HttpStatus.ACCEPTED) : new ResponseEntity<>(
99+
GriffinErr.dbUpdateError.buildErrorEntity(),
100+
HttpStatus.INTERNAL_SERVER_ERROR);
101+
}
102+
103+
@DeleteMapping(value = TAGS + "/{id}")
104+
@ResponseStatus(HttpStatus.OK)
105+
public ResponseEntity<BaseEntity> deleteMetricD(@PathVariable @NonNull String id) {
106+
boolean ret = tagAttachmentDao.deleteById(id);
107+
return ret ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(
108+
GriffinErr.dbDeletionError.buildErrorEntity(),
109+
HttpStatus.INTERNAL_SERVER_ERROR);
110+
}
111+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package org.apache.griffin.metric.service;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.apache.griffin.metric.dao.MetricVDao;
5+
import org.apache.griffin.metric.entity.BaseEntity;
6+
import org.apache.griffin.metric.entity.MetricV;
7+
import org.apache.griffin.metric.exception.GriffinErr;
8+
import org.apache.griffin.metric.exception.GriffinException;
9+
import org.springframework.http.HttpStatus;
10+
import org.springframework.http.MediaType;
11+
import org.springframework.http.ResponseEntity;
12+
import org.springframework.lang.NonNull;
13+
import org.springframework.web.bind.annotation.DeleteMapping;
14+
import org.springframework.web.bind.annotation.PathVariable;
15+
import org.springframework.web.bind.annotation.PostMapping;
16+
import org.springframework.web.bind.annotation.PutMapping;
17+
import org.springframework.web.bind.annotation.RequestBody;
18+
import org.springframework.web.bind.annotation.ResponseStatus;
19+
import org.springframework.web.bind.annotation.RestController;
20+
21+
@RestController
22+
@Slf4j
23+
public class MetricVService {
24+
public static final String METRIC_V_URI = "/metricV";
25+
26+
private final MetricVDao metricVDao;
27+
28+
public MetricVService(MetricVDao metricVDao) {
29+
this.metricVDao = metricVDao;
30+
}
31+
32+
@PutMapping(value = METRIC_V_URI,consumes = MediaType.APPLICATION_JSON_VALUE,
33+
produces = MediaType.APPLICATION_JSON_VALUE)
34+
@ResponseStatus(HttpStatus.CREATED)
35+
public ResponseEntity<BaseEntity> createMetricV(@RequestBody MetricV metricV) {
36+
try {
37+
int id = metricVDao.addMetricV(metricV);
38+
if (id != 1) {
39+
return new ResponseEntity<>(GriffinErr.dbInsertionError.buildErrorEntity(),
40+
HttpStatus.INTERNAL_SERVER_ERROR);
41+
}
42+
return new ResponseEntity<>(metricV, HttpStatus.CREATED);
43+
} catch (GriffinException e) {
44+
return new ResponseEntity<>(e.getError().buildErrorEntity(e.getMessage()),
45+
HttpStatus.INTERNAL_SERVER_ERROR);
46+
}
47+
}
48+
49+
@PostMapping(value = METRIC_V_URI, consumes = MediaType.APPLICATION_JSON_VALUE,
50+
produces = MediaType.APPLICATION_JSON_VALUE)
51+
@ResponseStatus(HttpStatus.ACCEPTED)
52+
public ResponseEntity<BaseEntity> updateMetricV(@RequestBody MetricV metricV) {
53+
boolean ret = metricVDao.updateById(metricV);
54+
return ret ? new ResponseEntity<>(metricV, HttpStatus.ACCEPTED) : new ResponseEntity<>(
55+
GriffinErr.dbUpdateError.buildErrorEntity(),
56+
HttpStatus.INTERNAL_SERVER_ERROR);
57+
}
58+
59+
@DeleteMapping(value = METRIC_V_URI + "/{id}")
60+
@ResponseStatus(HttpStatus.OK)
61+
public ResponseEntity<BaseEntity> deleteMetricV(@PathVariable @NonNull String id) {
62+
boolean ret = metricVDao.deleteById(id);
63+
return ret ? new ResponseEntity<>(HttpStatus.OK) : new ResponseEntity<>(
64+
GriffinErr.dbDeletionError.buildErrorEntity(),
65+
HttpStatus.INTERNAL_SERVER_ERROR);
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
server:
18+
port: 8888
19+
20+
spring:
21+
application:
22+
name: persist-service
23+
# sql:
24+
# init:
25+
# schema-locations: classpath:sql/create_mysql.sql
26+
# datasource:
27+
# driver-class-name: com.mysql.cj.jdbc.Driver
28+
# url: jdbc:mysql://127.0.0.1:3306/griffin
29+
# username: root
30+
# password: ""
31+
# hikari:
32+
# maximum-pool-size: 5
33+
sql:
34+
init:
35+
schema-locations: classpath:sql/create_h2.sql
36+
continue-on-error: false
37+
mode: embedded
38+
datasource:
39+
driver-class-name: org.h2.Driver
40+
url: jdbc:h2:mem:griffin
41+
username: sa
42+
password: ""
43+
hikari:
44+
maximum-pool-size: 5
45+
46+
h2:
47+
console:
48+
path: /h2-console
49+
enabled: on
50+
settings:
51+
web-allow-others: true
52+
trace: true
53+
54+
mybatis-plus:
55+
mapper-locations: classpath:mapper/*Mapper.xml
56+
type-aliases-package: org.apache.griffin.metric.dao.entity
57+
configuration:
58+
cache-enabled: false
59+
call-setters-on-nulls: true
60+
map-underscore-to-camel-case: true
61+
jdbc-type-for-null: NULL
62+
global-config:
63+
db-config:
64+
id-type: auto
65+
banner: false
66+
67+
68+
#logging:
69+
# level:
70+
# root: DEBUG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
20+
<mapper namespace="org.apache.griffin.metric.dao.mapper.MetricDMapper">
21+
<select id="queryByName" parameterType="String" resultType="org.apache.griffin.metric.entity.MetricD">
22+
SELECT * FROM t_metric_d WHERE name = #{metricName}
23+
</select>
24+
25+
</mapper>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
DROP TABLE IF EXISTS t_metric_d;
2+
CREATE TABLE t_metric_d (
3+
mid BIGINT PRIMARY KEY AUTO_INCREMENT,
4+
name VARCHAR(255) NOT NULL,
5+
owner VARCHAR(255) NOT NULL,
6+
description TEXT,
7+
ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
8+
mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
9+
);
10+
11+
DROP TABLE IF EXISTS t_tag_d;
12+
CREATE TABLE t_tag_d (
13+
tid BIGINT PRIMARY KEY AUTO_INCREMENT,
14+
name VARCHAR(255) NOT NULL,
15+
val DOUBLE NOT NULL,
16+
ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
17+
mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
18+
);
19+
20+
DROP TABLE IF EXISTS t_metric_tag;
21+
CREATE TABLE t_metric_tag (
22+
mid BIGINT references t_metric_d(mid),
23+
tid BIGINT references t_tag_d(tid),
24+
ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
25+
mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
26+
PRIMARY KEY(tid,mid)
27+
);
28+
29+
DROP TABLE IF EXISTS t_metric_v;
30+
CREATE TABLE t_metric_v (
31+
mid BIGINT PRIMARY KEY references t_metric_d(mid),
32+
val DOUBLE NOT NULL,
33+
ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
34+
mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
35+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-- Create database if it doesn't exist
2+
CREATE DATABASE IF NOT EXISTS griffin;
3+
4+
-- Use the created database
5+
USE griffin;
6+
7+
-- Create table for MetricD
8+
DROP TABLE IF EXISTS `t_metric_d`;
9+
CREATE TABLE IF NOT EXISTS t_metric_d (
10+
mid BIGINT AUTO_INCREMENT PRIMARY KEY, -- Metric ID
11+
name VARCHAR(255) NOT NULL, -- Metric name
12+
owner VARCHAR(255) NOT NULL, -- Metric owner
13+
description TEXT, -- Metric description
14+
ctime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Creation time
15+
mtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -- Modification time
16+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE = utf8_bin;
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao;
19+
20+
import org.springframework.boot.autoconfigure.SpringBootApplication;
21+
import org.springframework.boot.test.context.SpringBootTest;
22+
import org.springframework.test.annotation.Rollback;
23+
import org.springframework.transaction.annotation.Transactional;
24+
25+
@SpringBootTest(classes = DaoConfiguration.class)
26+
@SpringBootApplication(scanBasePackageClasses = DaoConfiguration.class)
27+
@Transactional
28+
@Rollback
29+
public class BaseDaoTest {
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.griffin.metric.dao;
19+
20+
import org.apache.griffin.metric.entity.MetricD;
21+
import org.junit.jupiter.api.Assertions;
22+
import org.junit.jupiter.api.Test;
23+
import org.springframework.beans.factory.annotation.Autowired;
24+
25+
import java.util.List;
26+
27+
public class MetricDDaoTest extends BaseDaoTest{
28+
@Autowired
29+
private MetricDDao metricDDao;
30+
31+
@Test
32+
void testAddMetric(){
33+
MetricD metricD= new MetricD();
34+
metricD.setOwner("sys");
35+
metricD.setMetricName("count");
36+
metricD.setDescription("table count for one partition");
37+
metricD.setMetricId(1L);
38+
39+
metricDDao.addMetricD(metricD);
40+
41+
List<MetricD> metircDs = metricDDao.queryAll();
42+
Assertions.assertNotEquals(0, metircDs.size());
43+
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
package org.apache.griffin.metric.entity;
20+
21+
import org.junit.jupiter.api.BeforeEach;
22+
import org.junit.jupiter.api.Test;
23+
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
27+
import static org.junit.jupiter.api.Assertions.*;
28+
29+
public class MetricTest {
30+
31+
private MetricD metricD;
32+
private MetricV metricV1;
33+
private MetricV metricV2;
34+
private TagAttachment tagAttachment;
35+
36+
@BeforeEach
37+
public void setUp() {
38+
// Initialize MetricD
39+
metricD = MetricD.builder()
40+
.metricId(1L)
41+
.metricName("Metric A")
42+
.owner("Owner A")
43+
.description("Description A")
44+
.build();
45+
46+
// Initialize MetricV
47+
metricV1 = MetricV.builder()
48+
.metricId(1L)
49+
.value(100.5)
50+
.tags(TagAttachment.builder()
51+
.metricId(1L)
52+
.metricTags(createSampleTags())
53+
.build())
54+
.build();
55+
56+
metricV2 = MetricV.builder()
57+
.metricId(1L)
58+
.value(200.75)
59+
.tags(TagAttachment.builder()
60+
.metricId(1L)
61+
.metricTags(createSampleTags())
62+
.build())
63+
.build();
64+
65+
// Initialize Tags
66+
tagAttachment = TagAttachment.builder()
67+
.metricId(1L)
68+
.metricTags(createSampleTags())
69+
.build();
70+
}
71+
72+
@Test
73+
public void testCreateMetricD() {
74+
assertNotNull(metricD);
75+
assertEquals(1L, metricD.getMetricId());
76+
assertEquals("Metric A", metricD.getMetricName());
77+
assertEquals("Owner A", metricD.getOwner());
78+
assertEquals("Description A", metricD.getDescription());
79+
}
80+
81+
@Test
82+
public void testIngestMetricV() {
83+
List<MetricV> metricVs = new ArrayList<>();
84+
metricVs.add(metricV1);
85+
metricVs.add(metricV2);
86+
87+
assertEquals(2, metricVs.size());
88+
assertTrue(metricVs.contains(metricV1));
89+
assertTrue(metricVs.contains(metricV2));
90+
}
91+
92+
@Test
93+
public void testFetchMetricDWithTags() {
94+
// Mock fetch logic here. This would typically involve querying a database or service.
95+
MetricD fetchedMetricD = metricD; // Simulate fetching
96+
TagAttachment fetchedTagAttachment = tagAttachment; // Simulate fetching tags
97+
98+
assertNotNull(fetchedMetricD);
99+
assertEquals(1L, fetchedMetricD.getMetricId());
100+
101+
assertNotNull(fetchedTagAttachment);
102+
assertEquals(1L, fetchedTagAttachment.getMetricId());
103+
assertEquals(2, fetchedTagAttachment.getMetricTags().size());
104+
}
105+
106+
private List<MetricTagD> createSampleTags() {
107+
List<MetricTagD> tags = new ArrayList<>();
108+
tags.add(new MetricTagD(1L, "key1", "value1"));
109+
tags.add(new MetricTagD(2L, "key2", "value2"));
110+
return tags;
111+
}
112+
}
113+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
spring:
19+
sql:
20+
init:
21+
schema-locations: classpath:sql/create_mysql.sql
22+
datasource:
23+
driver-class-name: com.mysql.cj.jdbc.Driver
24+
url: jdbc:mysql://127.0.0.1:3306/griffin
25+
username: root
26+
password: ""
27+
hikari:
28+
maximum-pool-size: 5
29+
30+
31+
mybatis-plus:
32+
mapper-locations: classpath:mapper/*Mapper.xml
33+
type-aliases-package: org.apache.griffin.metric.dao.entity
34+
configuration:
35+
cache-enabled: false
36+
call-setters-on-nulls: true
37+
map-underscore-to-camel-case: true
38+
jdbc-type-for-null: NULL
39+
global-config:
40+
db-config:
41+
id-type: auto
42+
banner: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<configuration scan="true" scanPeriod="120 seconds">
20+
<logger name="*" level="DEBUG"/>
21+
<logger name="org.springframework.jdbc" level="DEBUG"/>
22+
</configuration>

‎pom.xml

+46-21
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ under the License.
9999

100100

101101
<modules>
102+
<module>griffin-bom</module>
102103
<module>griffin-connectors</module>
103104
<module>griffin-metric</module>
104105
<module>griffin-dqc</module>
@@ -151,24 +152,6 @@ under the License.
151152
<artifactId>junit-vintage-engine</artifactId>
152153
<scope>test</scope>
153154
</dependency>
154-
<dependency>
155-
<groupId>org.mockito</groupId>
156-
<artifactId>mockito-core</artifactId>
157-
<version>${mockito.version}</version>
158-
<scope>test</scope>
159-
</dependency>
160-
<dependency>
161-
<groupId>org.mockito</groupId>
162-
<artifactId>mockito-inline</artifactId>
163-
<version>${mockito.version}</version>
164-
<scope>test</scope>
165-
</dependency>
166-
<dependency>
167-
<groupId>org.mockito</groupId>
168-
<artifactId>mockito-junit-jupiter</artifactId>
169-
<version>${mockito.version}</version>
170-
<scope>test</scope>
171-
</dependency>
172155
<dependency>
173156
<groupId>org.springframework.boot</groupId>
174157
<artifactId>spring-boot-configuration-processor</artifactId>
@@ -189,12 +172,54 @@ under the License.
189172
<plugin>
190173
<groupId>org.apache.maven.plugins</groupId>
191174
<artifactId>maven-compiler-plugin</artifactId>
192-
<version>3.11.0</version>
175+
<version>${maven-compiler-plugin.version}</version>
193176
<configuration>
194-
<source>${maven.compiler.source}</source>
195-
<target>${maven.compiler.target}</target>
177+
<source>${java.version}</source>
178+
<target>${java.version}</target>
179+
<testSource>${java.version}</testSource>
180+
<testTarget>${java.version}</testTarget>
196181
</configuration>
197182
</plugin>
183+
<plugin>
184+
<groupId>org.apache.maven.plugins</groupId>
185+
<artifactId>maven-release-plugin</artifactId>
186+
<version>${maven-release-plugin.version}</version>
187+
<configuration>
188+
<tagNameFormat>@{project.version}</tagNameFormat>
189+
</configuration>
190+
</plugin>
191+
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-assembly-plugin</artifactId>
195+
<version>${maven-assembly-plugin.version}</version>
196+
</plugin>
197+
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-javadoc-plugin</artifactId>
201+
<version>${maven-javadoc-plugin.version}</version>
202+
<configuration>
203+
<quiet>true</quiet>
204+
<source>8</source>
205+
<failOnError>false</failOnError>
206+
</configuration>
207+
</plugin>
208+
<plugin>
209+
<groupId>org.apache.maven.plugins</groupId>
210+
<artifactId>maven-dependency-plugin</artifactId>
211+
<version>${maven-dependency-plugin.version}</version>
212+
</plugin>
213+
<plugin>
214+
<groupId>org.apache.maven.plugins</groupId>
215+
<artifactId>maven-shade-plugin</artifactId>
216+
<version>${maven-shade-plugin.version}</version>
217+
</plugin>
218+
<plugin>
219+
<groupId>org.apache.maven.plugins</groupId>
220+
<artifactId>maven-jar-plugin</artifactId>
221+
<version>${maven-jar-plugin.version}</version>
222+
</plugin>
198223
<!-- Surefire runs all Java tests -->
199224
<plugin>
200225
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)
Please sign in to comment.