Skip to content

Commit

Permalink
refactor: update the package path of the startup class
Browse files Browse the repository at this point in the history
  • Loading branch information
wtt40122 committed Sep 25, 2024
1 parent ca454b5 commit 1ab33f8
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
*/
@Slf4j
@SpringBootApplication
@DubboComponentScan(basePackages = "com.xiaomi.mone.app")
@MapperScan("com.xiaomi.mone.app.dao")
@DubboComponentScan(basePackages = "org.apache.ozhera.app")
@MapperScan("org.apache.ozhera.app.dao")
@EnableScheduling
public class AppBootstrap {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@Slf4j
public class OperateAppBaseInfoAspect {

private final String appGetResultDataPoint = "execution(* com.xiaomi.mone.app.service.impl.HeraAppBaseInfoServiceImpl.appBaseInfoOperate(..))";
private final String appGetResultDataPoint = "execution(* org.apache.ozhera.app.service.impl.HeraAppBaseInfoServiceImpl.appBaseInfoOperate(..))";

@Value("${rocket.mq.hera.app.topic}")
private String topic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @date 2022/10/29 13:27
*/
@Slf4j
@RestControllerAdvice(basePackages = "com.xiaomi.mone.app.controller")
@RestControllerAdvice(basePackages = "org.apache.ozhera.app.controller")
public class AppExceptionControllerAdvice {

@ExceptionHandler(value = MethodArgumentNotValidException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring.datasource.default.maxPoolSize=20
spring.datasource.default.minialPoolSize=10

mybatis-plus.mapper-locations=classpath:mapper/*.xml
mybatis-plus.type-aliases-package=com.xiaomi.mone.app.model
mybatis-plus.type-aliases-package=org.apache.ozhera.app.model
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.global-config.db-config.id-type=auto
#mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @author dingtao
*/
@EnableAutoConfiguration(exclude= {DataSourceAutoConfiguration.class})
@ComponentScan(basePackages = {"com.xiaomi.mone.hera.demo.client"})
@DubboComponentScan(basePackages = "com.xiaomi.mone.hera.demo.client")
@ComponentScan(basePackages = {"org.apache.ozhera.demo.client"})
@DubboComponentScan(basePackages = "org.apache.ozhera.demo.client")
@Slf4j
public class HeraDemoClientBootstrap {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class DubboHealthServiceImpl implements DubboHealthService {

@Reference(group = "${dubbo.group}",version = "1.0",timeout = 3000,retries = 0,check = false)
private com.xiaomi.mone.hera.demo.server.service.DubboHealthService dubboHealthService;
private org.apache.ozhera.demo.server.service.DubboHealthService dubboHealthService;

@Override
public int remoteHealth(int size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*/
@Slf4j
@SpringBootApplication
@ComponentScan(basePackages = {"com.xiaomi.mone.hera.demo.server"})
@DubboComponentScan(basePackages = {"com.xiaomi.mone.hera.demo.server"})
@DubboComponentScan(basePackages = {"org.apache.ozhera.demo.server"})
public class HeraDemoServerBootstrap {
public static void main(String... args) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.context.annotation.ComponentScan;

@EnableAutoConfiguration
@ComponentScan(basePackages = {"run.mone.hera.intelligence"})
@ComponentScan(basePackages = {"org.apache.ozhera.intelligence"})
@Slf4j
public class IntelligenceBootStrap {
public static void main(String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import com.xiaomi.data.push.rpc.RpcCmd;
import com.xiaomi.data.push.rpc.RpcServer;
import com.xiaomi.data.push.rpc.common.Pair;
import com.xiaomi.youpin.docean.Ioc;
import lombok.extern.slf4j.Slf4j;
import org.apache.ozhera.log.common.Config;
import org.apache.ozhera.log.common.Constant;
import org.apache.ozhera.log.server.porcessor.AgentCollectProgressProcessor;
import org.apache.ozhera.log.server.porcessor.AgentConfigProcessor;
import org.apache.ozhera.log.server.porcessor.PingProcessor;
import com.xiaomi.youpin.docean.Ioc;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

Expand Down Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) throws IOException {
rpcServer.start();

Ioc.ins().putBean(rpcServer);
Ioc.ins().init("com.xiaomi.mone", "com.xiaomi.youpin");
Ioc.ins().init("com.xiaomi.mone", "com.xiaomi.youpin", "org.apache.ozhera.log.server");
log.info("log server start finish");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void main(String[] args) throws IOException {
client.waitStarted();
log.info("create rpc client finish");
Aop.ins().init(Maps.newLinkedHashMap());
Ioc.ins().putBean(client).init("com.xiaomi.mone.log.agent", "com.xiaomi.youpin.docean");
Ioc.ins().putBean(client).init("org.apache.ozhera.log.agent", "com.xiaomi.youpin.docean");
//Because the client life cycle is advanced, the processor needs to be re-registered here
client.registerProcessor();
System.in.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
*/
package org.apache.ozhera.log.agent.channel;

import cn.hutool.core.io.FileUtil;
import com.xiaomi.mone.file.ReadResult;
import com.xiaomi.mone.file.common.FileInfoCache;
import lombok.extern.slf4j.Slf4j;
import org.apache.ozhera.log.agent.channel.memory.ChannelMemory;
import org.apache.ozhera.log.agent.common.ChannelUtil;
import org.apache.ozhera.log.agent.input.Input;
import org.apache.ozhera.log.api.enums.LogTypeEnum;
import org.apache.ozhera.log.api.model.meta.LogPattern;
import org.apache.ozhera.log.api.model.msg.LineMessage;
import org.apache.ozhera.log.utils.NetUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -152,7 +153,7 @@ private Map<String, ChannelMemory.FileProgress> buildFileProgressMap(List<String
protected static void wildcardGraceShutdown(List<String> directory, String matchExpress) {
// Add a shutdown hook to gracefully shutdown FileInfoCache
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
log.info("wildcardGraceShutdown Shutdown,directory:{},express:{}", GSON.toJson(directory), matchExpress);
log.info("wildcardGraceShutdown Shutdown,directory:{},express:{},cacheSize:{}", GSON.toJson(directory), matchExpress, FileInfoCache.ins().caches().size());
FileInfoCache.ins().shutdown();
}));
}
Expand Down Expand Up @@ -192,7 +193,9 @@ protected void updateChannelMemory(ChannelMemory channelMemory, String fileName,
if (null != readResult.get().getFileMaxPointer()) {
fileProgress.setFileMaxPointer(readResult.get().getFileMaxPointer());
}
fileProgress.setUnixFileNode(ChannelUtil.buildUnixFileNode(fileName));
if (FileUtil.exist(fileName)) {
fileProgress.setUnixFileNode(ChannelUtil.buildUnixFileNode(fileName));
}
fileProgress.setPodType(channelDefine.getPodType());
fileProgress.setCtTime(ct);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.apache.ozhera.log.manager.bootstrap;

import org.apache.ozhera.log.common.Config;
import org.apache.ozhera.log.manager.controller.interceptor.HttpRequestInterceptor;
import com.xiaomi.youpin.docean.Aop;
import com.xiaomi.youpin.docean.Ioc;
import com.xiaomi.youpin.docean.anno.RequestMapping;
Expand All @@ -25,6 +23,8 @@
import com.xiaomi.youpin.docean.config.HttpServerConfig;
import com.xiaomi.youpin.docean.mvc.DoceanHttpServer;
import lombok.extern.slf4j.Slf4j;
import org.apache.ozhera.log.common.Config;
import org.apache.ozhera.log.manager.controller.interceptor.HttpRequestInterceptor;

import java.util.LinkedHashMap;

Expand All @@ -45,7 +45,7 @@ public static void main(String[] args) throws InterruptedException {
Aop.ins().init(m);

Ioc.ins().putBean(Cons.AUTO_FIND_IMPL, "true")
.init("com.xiaomi.mone", "com.xiaomi.youpin");
.init("com.xiaomi.mone", "com.xiaomi.youpin", "org.apache.ozhera.log.manager");
Config ins = Config.ins();

int port = Integer.parseInt(ins.get("serverPort", ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) {
private static void initializeApplication() {
OkHttpClient okHttpClient = getOkHttpClient();
Ioc.ins().putBean(okHttpClient)
.init("com.xiaomi.mone.log.stream", "com.xiaomi.youpin.docean");
.init("org.apache.ozhera.log.stream", "com.xiaomi.youpin.docean");
}

private static void startHealthCheckTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

@Slf4j
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.xiaomi.mone.monitor"})
@DubboComponentScan(basePackages = "com.xiaomi.mone.monitor")
@ServletComponentScan("com.xiaomi.mone.monitor.filter")
@ComponentScan(basePackages = {"org.apache.ozhera.monitor"})
@DubboComponentScan(basePackages = "org.apache.ozhera.monitor")
@ServletComponentScan("org.apache.ozhera.monitor.filter")
public class MiMonitorBootstrap {

public static void main(String[] args) throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class HeraBootstrap {

public static void main(String[] args) throws InterruptedException {
Ioc.ins().init("run.mone.docean.plugin","com.xiaomi.youpin.docean.plugin","run.mone.hera.operator");
Ioc.ins().init("run.mone.docean.plugin","com.xiaomi.youpin.docean.plugin","org.apache.ozhera.operator");
//Mvc.ins();
Mvc.ins().getMvcConfig().setResponseOriginalValue(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* @author dingtao
*/
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.xiaomi.youpin.prometheus.agent", "com.xiaomi.youpin"})
@DubboComponentScan(basePackages = "com.xiaomi.youpin.prometheus.agent")
@ComponentScan(basePackages = {"org.apache.ozhera.prometheus.agent", "com.xiaomi.youpin"})
@DubboComponentScan(basePackages = "org.apache.ozhera.prometheus.agent")
@Slf4j
public class PrometheusAgentBootstrap {
private static final Logger logger = LoggerFactory.getLogger(PrometheusAgentBootstrap.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author dingtao
*/
@EnableAutoConfiguration
@ComponentScan(basePackages = {"run.mone.hera.webhook"})
@ComponentScan(basePackages = {"org.apache.ozhera.webhook"})
@Slf4j
public class Bootstrap {

Expand Down
14 changes: 8 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1058,14 +1058,16 @@
</build>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central</id>
<name>maven-release-virtual</name>
<url>https://pkgs.d.xiaomi.net/artifactory/maven-release-virtual</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshots</name>
<url>https://pkgs.d.xiaomi.net/artifactory/snapshots</url>
</snapshotRepository>
</distributionManagement>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
* @author dingtao
*/
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.xiaomi.hera.trace.etl", "com.xiaomi.data.push.redis", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "com.xiaomi.hera.trace.etl.es.dubbo")
@MapperScan("com.xiaomi.hera.trace.etl.mapper")
@ComponentScan(basePackages = {"org.apache.ozhera.trace.etl.es", "com.xiaomi.data.push.redis", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "org.apache.ozhera.trace.etl.es.dubbo")
@MapperScan("org.apache.ozhera.trace.etl.mapper")
@Slf4j
public class TraceEtlEsBootstrap {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
* @author dingtao
*/
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.xiaomi.hera.trace.etl", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "com.xiaomi.hera.trace.etl")
@MapperScan("com.xiaomi.hera.trace.etl.mapper")
@ComponentScan(basePackages = {"org.apache.ozhera.trace.etl", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "org.apache.ozhera.trace.etl")
@MapperScan("org.apache.ozhera.trace.etl.mapper")
public class TraceEtlManagerBootstrap {

public static void main(String... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @author dingtao
*/
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@ComponentScan(basePackages = {"com.xiaomi.hera.trace.etl.nginx"})
@ComponentScan(basePackages = {"org.apache.ozhera.trace.etl.nginx"})
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
@Slf4j
public class TraceEtlNginxBootstrap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
* @author dingtao
*/
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.xiaomi.hera.trace.etl", "com.xiaomi.data.push.redis", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "com.xiaomi.hera.trace.etl.dubbo")
@MapperScan("com.xiaomi.hera.trace.etl.mapper")
@ComponentScan(basePackages = {"org.apache.ozhera.trace.etl", "com.xiaomi.data.push.redis", "run.mone.trace.etl"})
@DubboComponentScan(basePackages = "org.apache.ozhera.trace.etl.dubbo")
@MapperScan("org.apache.ozhera.trace.etl.mapper")
@Slf4j
public class TraceEtlBootstrap {

Expand Down

0 comments on commit 1ab33f8

Please sign in to comment.