├── .dependencycheck └── publishedSuppressions.xml ├── .gitignore ├── .wiki ├── agileway-codec.MD ├── agileway-feign.MD ├── agileway-redis.MD └── agileway-web.MD ├── LICENSE ├── README.md ├── RELEASE-NOTES-5.x.MD ├── agileway-aop ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── aop │ └── adapter │ └── aopalliance │ ├── ConstructorInvocationAdapter.java │ └── MethodInvocationAdapter.java ├── agileway-audit ├── agileway-audit-core │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── audit │ │ └── core │ │ ├── AbstractAuditEventExtractor.java │ │ ├── AuditEventBuilder.java │ │ ├── AuditEventExtractor.java │ │ ├── AuditRequest.java │ │ ├── AuditRequestFilter.java │ │ ├── AuditRequestFilterChain.java │ │ ├── AuditSettings.java │ │ ├── Auditor.java │ │ ├── AuditorFactory.java │ │ ├── SimpleAuditorFactory.java │ │ ├── annotation │ │ ├── Audit.java │ │ ├── Operation.java │ │ ├── Resource.java │ │ ├── ResourceId.java │ │ ├── ResourceMapping.java │ │ ├── ResourceName.java │ │ ├── ResourceProperty.java │ │ └── ResourceType.java │ │ ├── auditing │ │ └── aop │ │ │ └── AuditMethodInterceptor.java │ │ ├── exception │ │ └── IllegalResourceDefinition.java │ │ ├── filter │ │ └── MethodInvocationAuditAnnotationFilter.java │ │ ├── model │ │ ├── AuditEvent.java │ │ ├── Operation.java │ │ ├── OperationDefinition.java │ │ ├── OperationImportance.java │ │ ├── OperationResult.java │ │ ├── Principal.java │ │ ├── PrincipalType.java │ │ ├── Resource.java │ │ ├── ResourceDefinition.java │ │ └── Service.java │ │ ├── operation │ │ ├── OperationDefinitionParser.java │ │ ├── OperationDefinitionParserRegistry.java │ │ ├── OperationExtractor.java │ │ ├── OperationIdGenerator.java │ │ ├── OperationParametersExtractor.java │ │ ├── method │ │ │ ├── AbstractOperationMethodIdGenerator.java │ │ │ ├── OperationAnnotationParser.java │ │ │ ├── OperationMethodAnnotationDefinitionParser.java │ │ │ ├── OperationMethodInvocationExtractor.java │ │ │ ├── OperationParameterMethodInvocationExtractor.java │ │ │ └── ResourceDefinitionParser.java │ │ └── repository │ │ │ ├── DefaultOperationRepositoryParser.java │ │ │ ├── OperationDefinitionLoader.java │ │ │ ├── OperationDefinitionRepository.java │ │ │ ├── OperationRepositoryParser.java │ │ │ └── YamlOperationDefinitionLoader.java │ │ ├── principal │ │ └── PrincipalExtractor.java │ │ ├── resource │ │ ├── ResourceExtractor.java │ │ ├── ResourceMethodInvocationExtractor.java │ │ ├── ResourceSupplier.java │ │ ├── ResourceUtils.java │ │ ├── ResourcesSupplier.java │ │ ├── idresource │ │ │ ├── AbstractEntityLoader.java │ │ │ ├── AbstractIdResourceExtractor.java │ │ │ ├── EntityLoader.java │ │ │ ├── EntityLoaderDispatcher.java │ │ │ ├── EntityLoaderRegistry.java │ │ │ └── LoadingEntityIdResourceExtractor.java │ │ ├── parser │ │ │ ├── ResourceSupplierParser.java │ │ │ ├── clazz │ │ │ │ ├── AnnotatedEntityResourceSupplierParser.java │ │ │ │ ├── CustomNamedEntityResourceSupplierParser.java │ │ │ │ ├── DefaultEntityClassResourceSupplierParser.java │ │ │ │ ├── EntityClassResourceSupplierParser.java │ │ │ │ └── MemberNameEntityResourceSupplierParser.java │ │ │ └── parameter │ │ │ │ ├── CustomNamedMapParameterResourceSupplierParser.java │ │ │ │ ├── CustomResourcePropertyParameterResourceSupplierParser.java │ │ │ │ ├── ResourceAnnotatedCollectionParameterResourcesSupplierParser.java │ │ │ │ ├── ResourceAnnotatedEntityParameterResourceSupplierParser.java │ │ │ │ ├── ResourceAnnotatedMapParameterResourceSupplierParser.java │ │ │ │ └── ResourcePropertyAnnotatedResourceSupplierParser.java │ │ └── supplier │ │ │ ├── ContainerResourceSupplier.java │ │ │ ├── EntityResourceSupplier.java │ │ │ ├── EnumerationValueGetter.java │ │ │ ├── IterableResourceSupplier.java │ │ │ └── MapResourceSupplier.java │ │ ├── service │ │ └── ServiceExtractor.java │ │ └── session │ │ └── SessionIdExtractor.java ├── agileway-audit-entityloader │ ├── agileway-audit-entityloader-mybatis │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── audit │ │ │ └── entityloader │ │ │ └── mybatis │ │ │ ├── MybatisEntityLoader.java │ │ │ └── spring │ │ │ └── dynamicdatasource │ │ │ ├── AuditRequestDynamicDataSourceKeySelector.java │ │ │ └── DynamicSqlSessionFactoryProvider.java │ ├── agileway-audit-entityloader-resttemplate │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── audit │ │ │ └── entityloader │ │ │ └── resttemplate │ │ │ ├── DefaultHttpRequestProvider.java │ │ │ ├── DefaultParameterizedResponseClassProvider.java │ │ │ ├── DefaultResourceEntityExtractor.java │ │ │ ├── DefaultRestTemplateProvider.java │ │ │ ├── HttpRequestProvider.java │ │ │ ├── ParameterizedResponseClassProvider.java │ │ │ ├── ResourceEntityExtractor.java │ │ │ ├── RestTemplateEntityLoaders.java │ │ │ ├── RestTemplateProvider.java │ │ │ └── SpringRestTemplateEntityLoader.java │ └── pom.xml ├── agileway-audit-springboot1_2-web │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── audit │ │ │ ├── servlet │ │ │ ├── ServletAuditEventExtractor.java │ │ │ ├── ServletAuditEventPrincipalExtractor.java │ │ │ ├── ServletAuditEventServiceExtractor.java │ │ │ ├── ServletAuditEventSessionIdExtractor.java │ │ │ ├── ServletAuditRequest.java │ │ │ ├── ServletHttpParametersExtractor.java │ │ │ └── ServletUrlOperationIdGenerator.java │ │ │ └── spring │ │ │ ├── boot │ │ │ └── autoconfigure │ │ │ │ ├── AuditAutoConfiguration.java │ │ │ │ ├── AuditEntranceConfiguration.java │ │ │ │ ├── AuditProperties.java │ │ │ │ ├── OperationAutoConfiguration.java │ │ │ │ ├── OperationDefinitionProperties.java │ │ │ │ ├── ResourceExtractAutoConfiguration.java │ │ │ │ └── WebappInterceptorRegisterConfiguration.java │ │ │ ├── simple │ │ │ └── MethodAuditInterceptor.java │ │ │ └── webmvc │ │ │ ├── AuditHttpHandlerInterceptor.java │ │ │ ├── RequestMappingOperationDefinitionIdGenerator.java │ │ │ └── SpringMvcRequestMappings.java │ │ └── resources │ │ └── META-INF │ │ ├── spring.factories │ │ └── spring │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports ├── agileway-audit-springboot3-web │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── audit │ │ │ └── spring │ │ │ └── package-info.java │ │ └── resources │ │ └── META-INF │ │ ├── spring.factories │ │ └── spring │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports ├── agileway-audit-swagger │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── audit │ │ └── swagger │ │ └── operation │ │ └── SwaggerApiOperationAnnotationParser.java └── pom.xml ├── agileway-cmd ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── cmd │ │ ├── CommandLine.java │ │ ├── CommandLineDebugs.java │ │ ├── CommandLineExecutor.java │ │ ├── CommandLineStrings.java │ │ ├── CommandLines.java │ │ ├── DefaultCommandLineExecutor.java │ │ ├── DefaultExecuteResultHandler.java │ │ ├── ExecuteException.java │ │ ├── ExecuteResultHandler.java │ │ ├── ExecuteStreamHandler.java │ │ ├── ExecuteWatchdog.java │ │ ├── InputStreamPumper.java │ │ ├── InstructionSequence.java │ │ ├── InstructionSequenceDestroyer.java │ │ ├── LogOutputStream.java │ │ ├── ProcessAdapter.java │ │ ├── PumpStreamHandler.java │ │ ├── ShutdownHookProcessDestroyer.java │ │ ├── StreamPumper.java │ │ ├── TimeoutObserver.java │ │ ├── Watchdog.java │ │ ├── environment │ │ ├── DefaultProcessingEnvironment.java │ │ └── EnvironmentUtils.java │ │ ├── launcher │ │ ├── AbstractLocalCommandLauncher.java │ │ ├── CommandLauncher.java │ │ ├── CommandLauncherFactory.java │ │ ├── CommandLauncherProxy.java │ │ ├── Java1_5CommandLauncher.java │ │ ├── OS2CommandLauncher.java │ │ ├── VmsCommandLauncher.java │ │ └── WinNTCommandLauncher.java │ │ └── streamhandler │ │ ├── AbstractExecuteStreamHandler.java │ │ ├── OutputAsStringExecuteStreamHandler.java │ │ ├── OutputExtractExecuteStreamHandler.java │ │ └── OutputLinesExecuteStreamHandler.java │ └── test │ └── java │ └── com │ └── jn │ └── agileway │ └── test │ ├── commandline │ └── HardwaresTests.java │ └── util │ └── os │ ├── Infrastructures.java │ ├── hardware │ └── cpu │ │ ├── CPUs.java │ │ ├── GetCpuIdStreamHandler.java │ │ ├── LinuxGetCpuIdStreamHandler.java │ │ └── WindowsGetCpuIdStreamHandler.java │ └── virtualization │ ├── GetRuntimeContainerHandler.java │ ├── LinuxGetRuntimeContainerHandler.java │ ├── RuntimeContainer.java │ └── RuntimeContainers.java ├── agileway-codec ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── codec │ │ │ ├── AbstractCodec.java │ │ │ ├── AbstractCodecFactory.java │ │ │ ├── Codec.java │ │ │ ├── CodecFactory.java │ │ │ ├── CodecFactoryRegistry.java │ │ │ ├── CodecType.java │ │ │ ├── readme.md │ │ │ └── serialization │ │ │ ├── SchemaedStruct.java │ │ │ ├── activejser │ │ │ ├── ActivejCodecFactory.java │ │ │ ├── ActivejSerCodec.java │ │ │ └── ActivejSerializers.java │ │ │ ├── avro │ │ │ ├── AvroCodec.java │ │ │ ├── AvroCodecFactory.java │ │ │ └── Avros.java │ │ │ ├── bson │ │ │ ├── BsonCodec.java │ │ │ ├── BsonCodecFactory.java │ │ │ └── Bsons.java │ │ │ ├── cbor │ │ │ ├── CborJacksonCodec.java │ │ │ └── CborJacksonCodecFactory.java │ │ │ ├── fse │ │ │ ├── FseCodec.java │ │ │ ├── FseCodecFactory.java │ │ │ ├── FseCustomizer.java │ │ │ └── Fses.java │ │ │ ├── fst │ │ │ ├── FstCodec.java │ │ │ ├── FstCodecFactory.java │ │ │ ├── FstCustomizer.java │ │ │ └── Fsts.java │ │ │ ├── hessian │ │ │ ├── HessianCodec.java │ │ │ ├── HessianCodecFactory.java │ │ │ └── Hessians.java │ │ │ ├── jackson │ │ │ └── BasedJacksonCodec.java │ │ │ ├── jdk │ │ │ ├── JdkCodec.java │ │ │ └── JdkCodecFactory.java │ │ │ ├── json │ │ │ ├── EasyjsonCodec.java │ │ │ ├── EasyjsonCodecFactory.java │ │ │ ├── JacksonCodec.java │ │ │ └── JacksonCodecFactory.java │ │ │ ├── kryo │ │ │ ├── KryoCodec.java │ │ │ ├── KryoCodecFactory.java │ │ │ ├── KryoCustomizer.java │ │ │ ├── Kryos.java │ │ │ ├── customizer │ │ │ │ ├── CGLibProxyKryoCustomizer.java │ │ │ │ ├── DexxKryoCustomizer.java │ │ │ │ ├── GuavaKryoCustomizer.java │ │ │ │ ├── JdkClassesKryoCustomizer.java │ │ │ │ ├── JodaTimeKryoCustomizer.java │ │ │ │ └── LangxJavaKryoCustomizer.java │ │ │ └── serializer │ │ │ │ └── jdk │ │ │ │ ├── GregorianCalendarSerializer.java │ │ │ │ └── JdkProxySerializer.java │ │ │ ├── msgpack │ │ │ ├── MsgPackCodec.java │ │ │ └── MsgPackCodecFactory.java │ │ │ ├── protostuff │ │ │ ├── ProtostuffCodec.java │ │ │ ├── ProtostuffCodecFactory.java │ │ │ └── Protostuffs.java │ │ │ ├── xml │ │ │ └── javabeans │ │ │ │ ├── JavaBeansXmlCodec.java │ │ │ │ └── JavaBeansXmlCodecFactory.java │ │ │ └── xson │ │ │ ├── XsonCodec.java │ │ │ ├── XsonCodecFactory.java │ │ │ └── Xsons.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── com.jn.agileway.codec.CodecFactory │ │ ├── com.jn.agileway.codec.serialization.fst.FstCustomizer │ │ ├── com.jn.agileway.codec.serialization.kryo.KryoCustomizer │ │ └── org.bson.codecs.configuration.CodecProvider │ └── test │ └── java │ └── com │ └── jn │ └── agileway │ └── codec │ └── tests │ ├── CodecTests.java │ └── Pojo.java ├── agileway-dmmq ├── README.MD ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── dmmq │ └── core │ ├── BuiltinWaitStrategyFactory.java │ ├── Consumer.java │ ├── DefaultMessageTranslator.java │ ├── MessageHolder.java │ ├── MessageHolderFactory.java │ ├── MessageTopic.java │ ├── MessageTopicConfiguration.java │ ├── MessageTopicDispatcher.java │ ├── MessageTopicDispatcherAware.java │ ├── MessageTranslator.java │ ├── Producer.java │ ├── SimpleProducer.java │ ├── TopicAllocator.java │ ├── TopicAllocatorAware.java │ ├── TopicNameAware.java │ ├── allocator │ ├── AbstractMultipleCandidateTopicAllocator.java │ ├── DefaultTopicAllocator.java │ ├── FixedTopicAllocator.java │ ├── HashedTopicAllocator.java │ ├── RandomTopicAllocator.java │ └── RoundRobinTopicAllocator.java │ ├── consumer │ └── DebugConsumer.java │ ├── event │ ├── TopicEvent.java │ ├── TopicEventListener.java │ └── TopicEventType.java │ └── utils │ └── MQs.java ├── agileway-eipchannel ├── agileway-eipchannel-core │ ├── .wiki │ │ ├── images │ │ │ └── eip.png │ │ └── readme.md │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── eipchannel │ │ │ ├── core │ │ │ ├── channel │ │ │ │ ├── ChannelDirect.java │ │ │ │ ├── ChannelResolver.java │ │ │ │ ├── DefaultInboundChannel.java │ │ │ │ ├── DefaultOutboundChannel.java │ │ │ │ ├── DuplexChannel.java │ │ │ │ ├── InboundChannel.java │ │ │ │ ├── MessageChannel.java │ │ │ │ ├── OutboundChannel.java │ │ │ │ ├── PipedInboundChannel.java │ │ │ │ ├── PipedOutboundChannel.java │ │ │ │ └── pipe │ │ │ │ │ ├── ChannelMessageInterceptor.java │ │ │ │ │ ├── ChannelMessageInterceptorPipeline.java │ │ │ │ │ ├── InboundMessageInterceptor.java │ │ │ │ │ └── OutboundMessageInterceptor.java │ │ │ ├── endpoint │ │ │ │ ├── Endpoint.java │ │ │ │ ├── dispatcher │ │ │ │ │ ├── MessageDispatcher.java │ │ │ │ │ └── MessageHandler.java │ │ │ │ ├── exchange │ │ │ │ │ ├── RequestReplyExchanger.java │ │ │ │ │ └── readme.md │ │ │ │ ├── mapper │ │ │ │ │ ├── HeaderMapper.java │ │ │ │ │ ├── MessageMapper.java │ │ │ │ │ └── UnsupportedObjectException.java │ │ │ │ ├── pubsub │ │ │ │ │ ├── AbstractMessagePubSubEndpoint.java │ │ │ │ │ ├── AbstractPollingConsumer.java │ │ │ │ │ ├── DefaultMessageConsumer.java │ │ │ │ │ ├── DefaultMessageProducer.java │ │ │ │ │ ├── MessageConsumer.java │ │ │ │ │ ├── MessageProducer.java │ │ │ │ │ ├── PollerMetadata.java │ │ │ │ │ ├── PollingConsumer.java │ │ │ │ │ └── PubSubEndpoint.java │ │ │ │ └── sourcesink │ │ │ │ │ ├── sink │ │ │ │ │ ├── BlockingQueueOutboundChannelSinker.java │ │ │ │ │ ├── DispatcherOutboundChannelSinker.java │ │ │ │ │ ├── OutboundChannelRouterSinkerAdapter.java │ │ │ │ │ └── OutboundChannelSinker.java │ │ │ │ │ └── source │ │ │ │ │ ├── BlockingQueueInboundChannelMessageSource.java │ │ │ │ │ └── InboundChannelMessageSource.java │ │ │ ├── message │ │ │ │ ├── ErrorMessage.java │ │ │ │ ├── GenericMessage.java │ │ │ │ ├── Message.java │ │ │ │ ├── MessageBuilder.java │ │ │ │ ├── MessageHeaders.java │ │ │ │ └── MessagingException.java │ │ │ ├── router │ │ │ │ ├── AbstractMessageRouter.java │ │ │ │ ├── DirectOutboundRouter.java │ │ │ │ ├── MessageRouter.java │ │ │ │ └── filter │ │ │ │ │ └── MessageFilter.java │ │ │ └── transformer │ │ │ │ ├── AbstractMessageTransformer.java │ │ │ │ ├── MessageTransformationException.java │ │ │ │ ├── MessageTransformer.java │ │ │ │ ├── TransformerInboundMessageInterceptor.java │ │ │ │ └── TransformerOutboundMessageInterceptor.java │ │ │ └── eventchannel │ │ │ ├── EventProducer.java │ │ │ ├── PollingEventConsumer.java │ │ │ ├── mapper │ │ │ └── DomainEventMapper.java │ │ │ └── sink │ │ │ ├── EventOutboundLocalSinker.java │ │ │ └── EventOutboundRemoteSinker.java │ │ └── test │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── eipchannel │ │ └── tests │ │ ├── QueueChannelTests.java │ │ ├── UserEvent.java │ │ └── UserEventType.java └── pom.xml ├── agileway-feign ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── feign │ ├── AgilewayFeignDecodeException.java │ ├── ErrorHandler.java │ ├── Feigns.java │ ├── HttpConnectionContext.java │ ├── HttpConnectionProperties.java │ ├── RestServiceProvider.java │ ├── SimpleStubProvider.java │ ├── SimpleStubProviderCustomizer.java │ ├── StubProvider.java │ ├── loadbalancer │ ├── DynamicLBClientFactory.java │ └── LBClientConfig.java │ ├── param │ ├── ToJsonStringExpander.java │ └── ToQueryStringExpander.java │ └── supports │ ├── adaptable │ ├── AdaptableDecoder.java │ ├── AdaptableErrorDecoder.java │ └── ResponseBodyAdapter.java │ ├── mixedprovider │ ├── MixedStubProvider.java │ ├── NameAnnotationStubProviderLocator.java │ └── StubProviderLocator.java │ └── rpc │ ├── ClientWrapper.java │ ├── FeignRR.java │ ├── FeignRpcException.java │ ├── RpcInvocationHandlerFactory.java │ └── rest │ ├── EasyjsonDecoder.java │ ├── EasyjsonEncoder.java │ ├── EasyjsonErrorDecoder.java │ ├── RestStubProvider.java │ ├── RestStubProviderCustomizer.java │ ├── UnifiedResponseRestErrorHandler.java │ └── param │ └── ToJsonExpander.java ├── agileway-httpclient ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── httpclient │ ├── CookieSpecs.java │ ├── HttpAsyncClientCustomizer.java │ ├── HttpAsyncClientProvider.java │ ├── HttpClientCustomizer.java │ ├── HttpClientProperties.java │ └── HttpClientProvider.java ├── agileway-httpcontainer-common ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── http │ ├── rest │ ├── AbstractGlobalRestExceptionHandler.java │ ├── AbstractGlobalRestResponseHandler.java │ ├── DefaultRestActionExceptionHandlerOrderFinder.java │ ├── DefaultRestErrorMessageHandler.java │ ├── GlobalRestExceptionHandlerProperties.java │ ├── GlobalRestExceptionHandlerRegistry.java │ ├── GlobalRestHandlers.java │ ├── GlobalRestProperties.java │ ├── GlobalRestResponseBodyContext.java │ ├── GlobalRestResponseBodyHandler.java │ ├── GlobalRestResponseBodyHandlerConfiguration.java │ ├── GlobalRestResponseBodyHandlerConfigurationBuilder.java │ ├── GlobalRestResponseBodyHandlerProperties.java │ ├── GlobalRestResponseBodyMapper.java │ ├── I18nRestErrorMessageHandler.java │ ├── I18nRestErrorMessageHandlerProperties.java │ ├── NoopRestErrorMessageHandler.java │ ├── RestAction.java │ ├── RestActionException.java │ ├── RestActionExceptionHandler.java │ ├── RestActionExceptionHandlerDefinition.java │ ├── RestActionExceptionHandlerOrderFinder.java │ ├── RestActionExceptionHandlerRegistration.java │ ├── RestActionExceptions.java │ ├── RestErrorMessageHandler.java │ ├── exceptionhandler │ │ └── ThrowableHandler.java │ └── readme.md │ └── rr │ ├── HttpRRFactorySupplier.java │ ├── HttpRRs.java │ ├── HttpRequest.java │ ├── HttpRequestFactory.java │ ├── HttpResponse.java │ ├── HttpResponseFactory.java │ ├── RR.java │ ├── RRLocal.java │ └── requestmapping │ ├── JavaMethodRequestMappingAccessorParser.java │ ├── RequestMappingAccessor.java │ ├── RequestMappingAccessorParser.java │ └── RequestMappingAccessorRegistry.java ├── agileway-jaxrs ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── jaxrs │ ├── rest │ ├── JaxrsGlobalRestExceptionHandler.java │ ├── JaxrsGlobalRestResponseBodyHandler.java │ └── JaxrsGlobalRestResponseInterceptor.java │ └── rr │ ├── JaxrsHttpRequest.java │ ├── JaxrsHttpResponse.java │ └── requestmapping │ ├── JaxrsRequestMappingAccessor.java │ ├── JaxrsRequestMappingAccessorParser.java │ └── RequestMappings.java ├── agileway-jersey ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── jersey │ ├── GlobalRestCustomizer.java │ ├── ResourceConfigCustomizer.java │ ├── exception │ └── mapper │ │ └── JerseyGlobalRestExceptionMapper.java │ └── validator │ ├── JerseyGlobalRestResultValidator.java │ └── JerseyValidatorProxy.java ├── agileway-jwt ├── agileway-jwt-core │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── jwt │ │ │ ├── AbstractJWTService.java │ │ │ ├── AlgorithmType.java │ │ │ ├── ClaimSet.java │ │ │ ├── DefaultJWTParser.java │ │ │ ├── DefaultJWTService.java │ │ │ ├── HMacSigner.java │ │ │ ├── HMacVerifier.java │ │ │ ├── Header.java │ │ │ ├── JWSToken.java │ │ │ ├── JWSTokenBuilder.java │ │ │ ├── JWT.java │ │ │ ├── JWTBuilder.java │ │ │ ├── JWTException.java │ │ │ ├── JWTParser.java │ │ │ ├── JWTService.java │ │ │ ├── JWTs.java │ │ │ ├── PKISigner.java │ │ │ ├── PKIVerifier.java │ │ │ ├── Payload.java │ │ │ ├── PlainSigner.java │ │ │ ├── PlainVerifier.java │ │ │ ├── Signer.java │ │ │ ├── Signs.java │ │ │ ├── Verifier.java │ │ │ ├── ec │ │ │ ├── ECDSA.java │ │ │ ├── ECurve.java │ │ │ ├── ECurveParameterTable.java │ │ │ └── ECurves.java │ │ │ ├── jwe │ │ │ ├── JWEPlugin.java │ │ │ ├── JWEToken.java │ │ │ └── JWETokenBuilder.java │ │ │ └── readme.md │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.jwt.JWTService ├── agileway-jwt-plugin-nimbusds │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jn │ │ │ │ └── agileway │ │ │ │ └── jwt │ │ │ │ └── plugin │ │ │ │ └── nimbusds │ │ │ │ ├── JoseJWEPlugin.java │ │ │ │ ├── JoseJWETokenBuilder.java │ │ │ │ └── JoseJwtEncryptedToken.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.jn.agileway.jwt.jwe.JWEPlugin │ │ └── test │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── jwt │ │ └── tests │ │ ├── nacos_jwt │ │ ├── NacosJwtParser.java │ │ ├── NacosJwtPayload.java │ │ ├── NacosJwtTests.java │ │ ├── NacosSignatureAlgorithm.java │ │ ├── NacosUser.java │ │ └── User.java │ │ └── nimbusds │ │ └── JwtTests.java └── pom.xml ├── agileway-metrics ├── agileway-metrics-core │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── metrics │ │ │ └── core │ │ │ ├── EWMA.java │ │ │ ├── Meter.java │ │ │ ├── Meters.java │ │ │ ├── Metric.java │ │ │ ├── collector │ │ │ ├── ClassifiedMetricsCollector.java │ │ │ ├── CollectLevel.java │ │ │ ├── Collector.java │ │ │ ├── CompactMetricsCollector.java │ │ │ ├── MetricObject.java │ │ │ ├── MetricsCollector.java │ │ │ ├── MetricsCollectorFactory.java │ │ │ └── NormalMetricsCollector.java │ │ │ ├── config │ │ │ └── MetricsCollectPeriodConfig.java │ │ │ ├── meter │ │ │ ├── Compass.java │ │ │ ├── Counter.java │ │ │ ├── Counting.java │ │ │ ├── FastCompass.java │ │ │ ├── Gauge.java │ │ │ ├── Histogram.java │ │ │ ├── Metered.java │ │ │ ├── Sampling.java │ │ │ ├── Timed.java │ │ │ ├── Timer.java │ │ │ └── impl │ │ │ │ ├── AbstractMetricBuilder.java │ │ │ │ ├── Bucket.java │ │ │ │ ├── BucketCounter.java │ │ │ │ ├── BucketCounterImpl.java │ │ │ │ ├── BucketDeque.java │ │ │ │ ├── CachedGauge.java │ │ │ │ ├── ClusterHistogram.java │ │ │ │ ├── ClusterHistogramBuilder.java │ │ │ │ ├── ClusterHistogramImpl.java │ │ │ │ ├── CompassBuilder.java │ │ │ │ ├── CompassImpl.java │ │ │ │ ├── CounterBuilder.java │ │ │ │ ├── CounterImpl.java │ │ │ │ ├── DerivativeGauge.java │ │ │ │ ├── FastCompassBuilder.java │ │ │ │ ├── FastCompassImpl.java │ │ │ │ ├── HistogramBuilder.java │ │ │ │ ├── HistogramImpl.java │ │ │ │ ├── MeteredBuilder.java │ │ │ │ ├── MeteredImpl.java │ │ │ │ ├── PersistentGauge.java │ │ │ │ ├── RatioGauge.java │ │ │ │ ├── TimerBuilder.java │ │ │ │ └── TimerImpl.java │ │ │ ├── meterset │ │ │ ├── CachedMetricMeterSet.java │ │ │ ├── DefaultMetricFactory.java │ │ │ ├── DefaultMetricRegistry.java │ │ │ ├── DynamicMetricMeterSet.java │ │ │ ├── MetricMeterBuilder.java │ │ │ ├── MetricMeterFactory.java │ │ │ ├── MetricMeterFactoryBinder.java │ │ │ ├── MetricMeterRegistry.java │ │ │ ├── MetricMeterRegistryListener.java │ │ │ ├── MetricMeterSet.java │ │ │ └── SharedMetricMeterRegistries.java │ │ │ ├── noop │ │ │ ├── NoopBucketCounter.java │ │ │ ├── NoopClusterHistogram.java │ │ │ ├── NoopCompass.java │ │ │ ├── NoopCounter.java │ │ │ ├── NoopFastCompass.java │ │ │ ├── NoopHistogram.java │ │ │ ├── NoopMetered.java │ │ │ ├── NoopMetricMeterFactory.java │ │ │ ├── NoopMetricMeterRegistry.java │ │ │ ├── NoopMetricMeterRegistryListener.java │ │ │ └── NoopTimer.java │ │ │ ├── predicate │ │ │ ├── BucketMetricLevelPredicate.java │ │ │ ├── CompositeMetricPredicate.java │ │ │ ├── FixedPredicate.java │ │ │ ├── MetricMeterPredicate.java │ │ │ ├── MetricNameSetPredicate.java │ │ │ ├── TimeMetricLevelPredicate.java │ │ │ └── TrueMetricMeterPredicate.java │ │ │ ├── reporter │ │ │ ├── BaseMetricOutput.java │ │ │ ├── ConsoleMetricOutput.java │ │ │ ├── MetricOutput.java │ │ │ ├── Reporter.java │ │ │ ├── ScheduledReporter.java │ │ │ └── Slf4jMetricOutput.java │ │ │ ├── snapshot │ │ │ ├── AbstractSnapshot.java │ │ │ ├── BucketReservoir.java │ │ │ ├── BucketSnapshot.java │ │ │ ├── ExponentiallyDecayingReservoir.java │ │ │ ├── Reservoir.java │ │ │ ├── ReservoirType.java │ │ │ ├── ReservoirTypeBuilder.java │ │ │ ├── ReservoirTypeMetricBuilder.java │ │ │ ├── SlidingTimeWindowReservoir.java │ │ │ ├── SlidingWindowReservoir.java │ │ │ ├── Snapshot.java │ │ │ ├── UniformReservoir.java │ │ │ ├── UniformSnapshot.java │ │ │ └── WeightedSnapshot.java │ │ │ └── tag │ │ │ ├── Tag.java │ │ │ ├── TagList.java │ │ │ └── Tags.java │ │ └── resources │ │ └── readme.md ├── agileway-metrics-supports-csv │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── metrics │ │ └── supports │ │ └── csv │ │ ├── CsvFileProvider.java │ │ ├── CsvReporter.java │ │ └── FixedNameCsvFileProvider.java ├── agileway-metrics-supports-jdk │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── metrics │ │ └── supports │ │ └── jdk │ │ └── jmx │ │ ├── DefaultObjectNameFactory.java │ │ ├── JmxAttributeGauge.java │ │ ├── JmxReporter.java │ │ └── ObjectNameFactory.java ├── agileway-metrics-supports-prometheus │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── metrics │ │ └── supports │ │ └── prometheus │ │ ├── PrometheusMetricsCollectorAdapter.java │ │ └── simple │ │ ├── CustomMappingSampleBuilder.java │ │ ├── DefaultSampleBuilder.java │ │ ├── GraphiteNamePattern.java │ │ ├── MapperConfig.java │ │ └── SampleBuilder.java ├── pom.xml └── readme.md ├── agileway-redis-springdata2 ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── redis │ │ ├── collection │ │ ├── RedisList.java │ │ ├── RedisMap.java │ │ ├── RedisSet.java │ │ ├── RedisSortedSet.java │ │ └── RedisStack.java │ │ ├── core │ │ ├── RedisTemplate.java │ │ ├── RedisTemplates.java │ │ ├── conf │ │ │ └── RedisTemplateProperties.java │ │ ├── key │ │ │ ├── RedisKeyProperties.java │ │ │ └── RedisKeyWrapper.java │ │ ├── script │ │ │ ├── BuiltinLuaScriptLocationProvider.java │ │ │ ├── RedisLuaScript.java │ │ │ ├── RedisLuaScriptParser.java │ │ │ ├── RedisLuaScriptRepository.java │ │ │ ├── RedisLuaScriptResourceLoader.java │ │ │ └── lua │ │ │ │ ├── GetAndRemove.lua │ │ │ │ ├── GetAndUpdateExpireTime.lua │ │ │ │ ├── SetIfAbsentWithExpireTime.lua │ │ │ │ ├── SetValueAndExpire.lua │ │ │ │ ├── UnlockExclusiveLock.lua │ │ │ │ └── mGetAndRemove.lua │ │ └── serialization │ │ │ ├── DelegatableRedisSerializer.java │ │ │ └── RedisKeySerializer.java │ │ ├── counter │ │ ├── DistributedCounter.java │ │ ├── HashedDistributedCounter.java │ │ └── SimpleDistributedCounter.java │ │ ├── l2cache │ │ ├── RedisCache.java │ │ ├── RedisCacheContext.java │ │ └── RedisCacheFactory.java │ │ └── locks │ │ ├── ExclusiveLock.java │ │ ├── LockRandomValueBuilder.java │ │ └── RedisLocks.java │ └── test │ └── java │ └── com │ └── jn │ └── agileway │ └── redis │ └── test │ └── core │ └── lock │ ├── LockRandomValueTests.java │ └── RedisLuaScriptResourceLoaderTest.java ├── agileway-shiro-redis-springdata2 ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── shiro │ └── redis │ ├── cache │ ├── NoopStringKeyCodec.java │ ├── ShiroRedisCache.java │ ├── ShiroRedisCacheManager.java │ └── StringKeyCodec.java │ └── session │ ├── RedisSessionDAO.java │ ├── SessionIdGeneratorAdapter.java │ ├── SimpleShiroSession.java │ ├── SimpleShiroSessionFactory.java │ └── SpringIdGeneratorAdapter.java ├── agileway-spring ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jn │ │ └── agileway │ │ ├── spring │ │ ├── aop │ │ │ └── AspectJExpressionPointcutAdvisorBuilder.java │ │ ├── converter │ │ │ ├── CommonEnumByNameConverterFactory.java │ │ │ ├── JsonEnumDeserializer.java │ │ │ ├── JsonEnumSerializer.java │ │ │ └── NameToCommonEnumConverter.java │ │ ├── messagestorage │ │ │ └── SpringMessageStorage.java │ │ ├── propertysource │ │ │ ├── SpringPropertyResolverAccessor.java │ │ │ ├── SpringPropertySourceAdapter.java │ │ │ ├── SpringPropertySources.java │ │ │ └── SpringPropertySourcesAdapter.java │ │ └── utils │ │ │ ├── SpringContainerPluginRegistry.java │ │ │ ├── SpringContextHolder.java │ │ │ └── SpringVersions.java │ │ └── springboot │ │ ├── SpringBootVersions.java │ │ ├── appboot │ │ └── SpringAppAutoConfiguration.java │ │ ├── httpclient │ │ └── HttpClientAutoConfiguration.java │ │ ├── i18n │ │ ├── SpringBootBuiltinMessageSourceProperties.java │ │ └── error │ │ │ ├── EnableI18ErrorMessageHandler.java │ │ │ └── I18nErrorMessageHandlerConfiguration.java │ │ ├── jdbc │ │ └── JdbcDataSourceFactoryAutoConfiguration.java │ │ ├── json │ │ └── JsonConfiguration.java │ │ ├── redis │ │ ├── RedisGlobalTemplateAutoConfiguration.java │ │ ├── RedisLuaScriptRepositoryAutoConfiguration.java │ │ └── SimpleCache.java │ │ └── vfs │ │ └── ArtifactRepositoryConfiguration.java │ └── resources │ └── META-INF │ ├── spring.factories │ ├── spring.provides │ └── spring │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports ├── agileway-springboot1_2-web ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ ├── spring │ └── web │ │ ├── mvc │ │ └── requestmapping │ │ │ ├── DeleteMappingAnnotationAccessor.java │ │ │ ├── GetMappingAnnotationAccessor.java │ │ │ ├── PatchMappingAnnotationAccessor.java │ │ │ ├── PostMappingAnnotationAccessor.java │ │ │ ├── PutMappingAnnotationAccessor.java │ │ │ ├── RequestMappingAnnotationAccessor.java │ │ │ ├── RequestMappings.java │ │ │ └── SpringRequestMappingAccessorParser.java │ │ └── rest │ │ ├── EasyjsonHttpMessageConverter.java │ │ ├── GlobalSpringRestExceptionHandler.java │ │ ├── GlobalSpringRestResponseBodyAdvice.java │ │ ├── GlobalSpringRestResponseBodyHandler.java │ │ ├── ResponseEntitys.java │ │ └── RestActionExceptionHandlerRegisterListener.java │ └── springboot │ └── web │ ├── filter │ ├── AgilewayBasicFiltersConfiguration.java │ └── EnableAgilewayWebFilters.java │ └── rest │ ├── AgilewaySpringWebMvcConfigurer.java │ ├── EnableGlobalRestHandlers.java │ ├── GlobalRestHandlersConfiguration.java │ ├── SpringBootErrorControllers.java │ ├── SpringBuiltinExceptionHandlerAutoConfiguration.java │ ├── SpringOrderedRestExceptionHandlerOrderFinder.java │ └── exceptionhandler │ ├── Http400ExceptionHandler.java │ ├── Http401ExceptionHandler.java │ ├── Http404ExceptionHandler.java │ ├── Http503ExceptionHandler.java │ ├── HttpMediaTypeNotAcceptableExceptionHandler.java │ ├── HttpMediaTypeNotSupportedExceptionHandler.java │ ├── HttpMethodNotSupportedExceptionHandler.java │ ├── HttpRequestMethodNotSupportedExceptionHandler.java │ └── SpringServerExceptionHandler.java ├── agileway-springboot3-web ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── jn │ └── agileway │ └── springboot │ └── web │ └── package-info.java ├── agileway-ssh ├── agileway-sshclient-ganymedssh2 │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── ganymedssh2 │ │ │ ├── Ssh2Connection.java │ │ │ ├── Ssh2ConnectionConfig.java │ │ │ ├── Ssh2ConnectionFactory.java │ │ │ ├── Ssh2ForwardingClient.java │ │ │ ├── Ssh2SessionedChannel.java │ │ │ ├── readme.md │ │ │ ├── sftp │ │ │ ├── Ssh2SftpFile.java │ │ │ ├── Ssh2SftpSession.java │ │ │ └── Ssh2Sftps.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ └── verifier │ │ │ ├── FromSsh2HostKeyVerifierAdapter.java │ │ │ ├── KnownHosts.java │ │ │ ├── KnownHostsVerifier.java │ │ │ └── ToSsh2HostKeyVerifierAdapter.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.SshConnectionFactory ├── agileway-sshclient-j2ssh │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── j2ssh │ │ │ ├── J2sshConnection.java │ │ │ ├── J2sshConnectionConfig.java │ │ │ ├── J2sshConnectionFactory.java │ │ │ ├── J2sshForwardingClient.java │ │ │ ├── J2sshSessionedChannel.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ └── verifier │ │ │ ├── FromJ2ssHostKeyVerifier.java │ │ │ ├── KnownHostsVerifier.java │ │ │ └── ToJ2sshHostKeyVerifier.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.SshConnectionFactory ├── agileway-sshclient-jsch │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── jsch │ │ │ ├── JschChannelType.java │ │ │ ├── JschConnection.java │ │ │ ├── JschConnectionConfig.java │ │ │ ├── JschConnectionFactory.java │ │ │ ├── JschForwardingClient.java │ │ │ ├── JschLoggerToSlf4jLogger.java │ │ │ ├── JschSessionedChannel.java │ │ │ ├── authc │ │ │ └── PasswordUserInfo.java │ │ │ ├── sftp │ │ │ ├── JschSftpFile.java │ │ │ ├── JschSftpSession.java │ │ │ └── JschSftps.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ └── knownhosts │ │ │ └── JschKnownHostsKeyRepository.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.SshConnectionFactory ├── agileway-sshclient-sshj │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── sshj │ │ │ ├── SshjConnection.java │ │ │ ├── SshjConnectionConfig.java │ │ │ ├── SshjConnectionFactory.java │ │ │ ├── SshjForwardingClient.java │ │ │ ├── SshjSessionedChannel.java │ │ │ ├── sec │ │ │ └── SecurityUtils.java │ │ │ ├── sftp │ │ │ ├── SshjSftpFile.java │ │ │ ├── SshjSftpSession.java │ │ │ └── SshjSftps.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ ├── codec │ │ │ ├── Ecdsa256PublicKeyCodec.java │ │ │ ├── Ecdsa384PublicKeyCodec.java │ │ │ ├── Ecdsa512PublicKeyCodec.java │ │ │ ├── EcdsaXPublicKeyCodec.java │ │ │ ├── EcdsaXs.java │ │ │ ├── Ed25519PublicKey.java │ │ │ ├── Eddsa25519PublicKeyCodec.java │ │ │ └── Secg.java │ │ │ └── verifier │ │ │ ├── FromSshHostKeyVerifierAdapter.java │ │ │ └── ToSshjHostKeyVerifierAdapter.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── com.jn.agileway.ssh.client.SshConnectionFactory │ │ └── com.jn.agileway.ssh.client.transport.hostkey.codec.PublicKeyCodec ├── agileway-sshclient-synergy │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── synergy │ │ │ ├── SynergyConnection.java │ │ │ ├── SynergyConnectionConfig.java │ │ │ ├── SynergyConnectionFactory.java │ │ │ ├── SynergyForwardingClient.java │ │ │ ├── SynergySessionedChannel.java │ │ │ ├── sftp │ │ │ ├── SynergySftpFile.java │ │ │ ├── SynergySftpSession.java │ │ │ └── SynergySftps.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ └── verifier │ │ │ ├── FromSynergyHostKeyVerificationAdapter.java │ │ │ └── ToSynergyHostKeyVerifierAdapter.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.SshConnectionFactory ├── agileway-sshclient-tests │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── test │ │ │ ├── BaseSshTests.java │ │ │ ├── channel │ │ │ └── direct │ │ │ │ └── session │ │ │ │ ├── command │ │ │ │ ├── SshClients_CommandLineTests.java │ │ │ │ ├── SshCommandLineExecutorTest.java │ │ │ │ └── SshCommandTest.java │ │ │ │ └── shell │ │ │ │ └── SwingShellTest.java │ │ │ ├── knownhosts │ │ │ └── KnownHostsFilesTests.java │ │ │ └── sftp │ │ │ ├── FileModeTests.java │ │ │ ├── OpenModeTests.java │ │ │ └── SftpTests.java │ │ └── resources │ │ ├── known_hosts_test │ │ └── simplelogger.properties ├── agileway-sshclient-trileadssh2 │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ └── impl │ │ │ └── trileadssh2 │ │ │ ├── Ssh2Connection.java │ │ │ ├── Ssh2ConnectionConfig.java │ │ │ ├── Ssh2ConnectionFactory.java │ │ │ ├── Ssh2ForwardingClient.java │ │ │ ├── Ssh2SessionedChannel.java │ │ │ ├── sftp │ │ │ ├── Ssh2SftpFile.java │ │ │ ├── Ssh2SftpSession.java │ │ │ └── Ssh2Sftps.java │ │ │ └── transport │ │ │ └── hostkey │ │ │ └── verifier │ │ │ ├── FromSsh2HostKeyVerifierAdapter.java │ │ │ ├── KnownHostsVerifier.java │ │ │ └── ToSsh2HostKeyVerifierAdapter.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.SshConnectionFactory ├── agileway-sshclient │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── ssh │ │ │ └── client │ │ │ ├── AbstractSshConnection.java │ │ │ ├── AbstractSshConnectionConfig.java │ │ │ ├── AbstractSshConnectionFactory.java │ │ │ ├── SshClients.java │ │ │ ├── SshConnection.java │ │ │ ├── SshConnectionConfig.java │ │ │ ├── SshConnectionFactory.java │ │ │ ├── SshConnectionFactoryRegistry.java │ │ │ ├── SshConnectionStatus.java │ │ │ ├── SshException.java │ │ │ ├── channel │ │ │ ├── AbstarctSessionedChannel.java │ │ │ ├── Channel.java │ │ │ ├── ChannelState.java │ │ │ ├── ChannelType.java │ │ │ ├── DefaultShellExecutor.java │ │ │ ├── SessionedChannel.java │ │ │ ├── ShellExecutor.java │ │ │ └── forwarding │ │ │ │ ├── ForwardingChannelInfo.java │ │ │ │ └── ForwardingClient.java │ │ │ ├── sftp │ │ │ ├── AbstractSftpSession.java │ │ │ ├── OpenMode.java │ │ │ ├── ResponseStatusCode.java │ │ │ ├── SftpFile.java │ │ │ ├── SftpFileInputStream.java │ │ │ ├── SftpFileOutputStream.java │ │ │ ├── SftpResourceInfo.java │ │ │ ├── SftpSession.java │ │ │ ├── Sftps.java │ │ │ ├── attrs │ │ │ │ ├── FileAttrs.java │ │ │ │ ├── FileMode.java │ │ │ │ └── FileType.java │ │ │ └── exception │ │ │ │ ├── NoSuchFileSftpException.java │ │ │ │ └── SftpException.java │ │ │ ├── supports │ │ │ └── command │ │ │ │ ├── SshCommandResponse.java │ │ │ │ └── executor │ │ │ │ ├── SshCommandExecutionAdaptor.java │ │ │ │ ├── SshCommandLineExecutor.java │ │ │ │ └── SshCommandLineLauncher.java │ │ │ ├── transport │ │ │ └── hostkey │ │ │ │ ├── HostsKeyRepository.java │ │ │ │ ├── IllegalSshKeyException.java │ │ │ │ ├── StrictHostKeyChecking.java │ │ │ │ ├── UnsupportedHostsKeyTypeException.java │ │ │ │ ├── UnsupportedKeyException.java │ │ │ │ ├── codec │ │ │ │ ├── AbstractPublicKeyCodec.java │ │ │ │ ├── PublicKeyCodec.java │ │ │ │ ├── PublicKeyCodecRegistry.java │ │ │ │ ├── PublicKeyCodecs.java │ │ │ │ ├── SshDssPublicKeyCodec.java │ │ │ │ └── SshRsaPublicKeyCodec.java │ │ │ │ ├── keytype │ │ │ │ ├── DefaultPublicKeyHostKeyTypeExtractor.java │ │ │ │ ├── HostKeyTypeExtractor.java │ │ │ │ ├── KeyBufferHostKeyTypeExtractor.java │ │ │ │ ├── KeyBytesHostKeyTypeExtractor.java │ │ │ │ └── PublicKeyHostKeyTypeExtractor.java │ │ │ │ ├── knownhosts │ │ │ │ ├── AbstractHostsKeyEntry.java │ │ │ │ ├── CommentHostsKeyEntry.java │ │ │ │ ├── HashedHostsKeyEntry.java │ │ │ │ ├── HostsKeyEntry.java │ │ │ │ ├── KnownHostsFiles.java │ │ │ │ ├── Marker.java │ │ │ │ ├── OpenSSHKnownHosts.java │ │ │ │ └── SimpleHostsKeyEntry.java │ │ │ │ └── verifier │ │ │ │ ├── AnyHostKeyVerifier.java │ │ │ │ ├── HostKeyVerifier.java │ │ │ │ ├── KnownHostsVerifier.java │ │ │ │ └── PromiscuousHostKeyVerifier.java │ │ │ └── utils │ │ │ ├── Buffer.java │ │ │ ├── PTYMode.java │ │ │ ├── Signal.java │ │ │ └── SshConfigs.java │ │ └── resources │ │ ├── .wiki │ │ ├── img │ │ │ └── data_stream.png │ │ └── readme.md │ │ └── META-INF │ │ └── services │ │ └── com.jn.agileway.ssh.client.transport.hostkey.codec.PublicKeyCodec └── pom.xml ├── agileway-syslog ├── agileway-syslog-protocol │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── syslog │ │ │ └── protocol │ │ │ ├── CEFOverSyslogMessageParser.java │ │ │ ├── Facility.java │ │ │ ├── MessageParser.java │ │ │ ├── MessageType.java │ │ │ ├── Priority.java │ │ │ ├── RFC3164MessageParser.java │ │ │ ├── RFC3164SyslogTextGenerator.java │ │ │ ├── RFC5424MessageParser.java │ │ │ ├── RFC5424SyslogTextGenerator.java │ │ │ ├── Severity.java │ │ │ ├── StructuredDataFormatter.java │ │ │ ├── StructuredElement.java │ │ │ ├── SyslogMessage.java │ │ │ └── SyslogTextGenerator.java │ │ └── test │ │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── syslog │ │ └── protocol │ │ └── tests │ │ └── SyslogTest.java └── pom.xml ├── agileway-templates ├── agileway-templates-freemarker │ └── pom.xml └── pom.xml ├── agileway-vfs ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── jn │ │ └── agileway │ │ └── vfs │ │ ├── AgilewayVFSManagerBootstrap.java │ │ ├── FileSystemManagerAware.java │ │ ├── VfsException.java │ │ ├── artifact │ │ ├── AbstractArtifact.java │ │ ├── AbstractArtifactManager.java │ │ ├── Artifact.java │ │ ├── ArtifactDigitExtractor.java │ │ ├── ArtifactFactory.java │ │ ├── ArtifactManager.java │ │ ├── ArtifactManagerAware.java │ │ ├── ArtifactManagerProperties.java │ │ ├── IGAV.java │ │ ├── SimpleArtifactManager.java │ │ ├── SynchronizedArtifactManager.java │ │ └── repository │ │ │ ├── AbstractArtifactRepositoryLayout.java │ │ │ ├── ArtifactRepository.java │ │ │ ├── ArtifactRepositoryAware.java │ │ │ ├── ArtifactRepositoryFactory.java │ │ │ ├── ArtifactRepositoryLayout.java │ │ │ ├── ArtifactRepositoryProperties.java │ │ │ ├── DefaultArtifactRepository.java │ │ │ ├── DefaultArtifactRepositoryFactory.java │ │ │ └── LocalArtifactRepositoryLayout.java │ │ ├── filter │ │ ├── AllMatchFileFilter.java │ │ ├── AnyMatchFileFilter.java │ │ ├── ExistsFileFilter.java │ │ ├── FileObjectFilter.java │ │ ├── FileTypeFilter.java │ │ ├── FilenameEndsWithFileFilter.java │ │ ├── FilenameEqualsFileFilter.java │ │ ├── FilenamePredicateFilter.java │ │ ├── FilenamePrefixFileFilter.java │ │ ├── FilenameSuffixFileFilter.java │ │ ├── IsDirectoryFilter.java │ │ ├── IsFileFilter.java │ │ ├── NoneMatchFileFilter.java │ │ └── NotFileFilter.java │ │ ├── management │ │ ├── AbstractFileManager.java │ │ ├── FileDigestExtractor.java │ │ ├── FileDigit.java │ │ ├── FileManager.java │ │ ├── FileManagerAware.java │ │ └── repository │ │ │ ├── AbstractFileRepositoryLayout.java │ │ │ ├── DefaultFileRepository.java │ │ │ ├── FileRepository.java │ │ │ ├── FileRepositoryAware.java │ │ │ └── FileRepositoryLayout.java │ │ ├── provider │ │ └── sftp │ │ │ ├── SftpFileNameParser.java │ │ │ ├── SftpFileObject.java │ │ │ ├── SftpFileProvider.java │ │ │ ├── SftpFileSystem.java │ │ │ └── SftpFileSystemConfigBuilder.java │ │ └── utils │ │ ├── FileObjects.java │ │ └── VFSUtils.java │ └── test │ └── java │ └── com │ └── jn │ └── agileway │ └── tests │ └── vfs │ └── sftp │ └── AgilewaySftpProviderTests.java ├── agileway-web-jakarta ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jn │ │ └── agileway │ │ └── web │ │ └── package-info.java │ └── resources │ └── .gitkeep ├── agileway-web-javaee ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── jn │ │ └── agileway │ │ └── web │ │ ├── filter │ │ ├── HttpRequestHandlerFilter.java │ │ ├── OncePerRequestFilter.java │ │ ├── accesslog │ │ │ ├── AccessLogFilter.java │ │ │ ├── AccessLogLevel.java │ │ │ └── WebAccessLogProperties.java │ │ ├── globalresponse │ │ │ ├── GlobalFilterRestExceptionHandler.java │ │ │ ├── GlobalFilterRestResponseHandler.java │ │ │ └── GlobalRestResponseFilter.java │ │ ├── readme.md │ │ ├── rr │ │ │ └── RRFilter.java │ │ └── waf │ │ │ ├── SqlInjectionFilter.java │ │ │ ├── XssFilter.java │ │ │ ├── allowedmethods │ │ │ ├── AllowedMethodsFilter.java │ │ │ └── HttpMethodNotSupportedException.java │ │ │ ├── cors │ │ │ ├── CorsFilter.java │ │ │ ├── CorsProperties.java │ │ │ └── CorsResponses.java │ │ │ └── csrf │ │ │ └── CsrfFilter.java │ │ ├── prediate │ │ ├── HttpRequestPredicate.java │ │ ├── HttpRequestPredicateConfigItem.java │ │ ├── HttpRequestPredicateConfigItems.java │ │ ├── HttpRequestPredicateFactory.java │ │ ├── HttpRequestPredicateFactoryRegistry.java │ │ ├── HttpRequestPredicateGroup.java │ │ ├── HttpRequestPredicateGroupFactory.java │ │ ├── HttpRequestPredicates.java │ │ └── impl │ │ │ ├── CookieMatchPredicate.java │ │ │ ├── CookieMatchPredicateFactory.java │ │ │ ├── HeaderMatchPredicate.java │ │ │ ├── HeaderMatchPredicateFactory.java │ │ │ ├── HostMatchPredicate.java │ │ │ ├── HostMatchPredicateFactory.java │ │ │ ├── MethodPredicate.java │ │ │ ├── MethodPredicateFactory.java │ │ │ ├── PathMatchPredicate.java │ │ │ └── PathMatchPredicateFactory.java │ │ ├── request │ │ ├── handler │ │ │ ├── AbstractHttpRequestHandler.java │ │ │ ├── HttpRequestHandler.java │ │ │ └── HttpRequestHandlerChain.java │ │ ├── header │ │ │ ├── HttpResponseHeaderRule.java │ │ │ ├── HttpResponseHeaderSetter.java │ │ │ ├── HttpResponseHeaderSetterFactory.java │ │ │ ├── SetResponseHeaderHandler.java │ │ │ └── SetResponseHeaderProperties.java │ │ └── parse │ │ │ ├── HttpParser.java │ │ │ ├── SkipResult.java │ │ │ └── Vary.java │ │ ├── rest │ │ ├── AbstractGlobalServletRestExceptionHandler.java │ │ ├── AbstractGlobalServletRestResponseBodyHandler.java │ │ └── AbstractServletRestActionExceptionHandler.java │ │ ├── security │ │ ├── AbstractWAFHandler.java │ │ ├── AccessDeniedException.java │ │ ├── AccessDeniedHandler.java │ │ ├── AccessDeniedHandlerImpl.java │ │ ├── WAF.java │ │ ├── WAFHandler.java │ │ ├── WAFHttpServletRequestWrapper.java │ │ ├── WAFHttpServletResponseWrapper.java │ │ ├── WAFStrategy.java │ │ ├── WAFs.java │ │ ├── csrf │ │ │ ├── CookieCsrfTokenRepository.java │ │ │ ├── CsrfAuthenticationStrategy.java │ │ │ ├── CsrfException.java │ │ │ ├── CsrfToken.java │ │ │ ├── CsrfTokenRepository.java │ │ │ ├── DefaultCsrfToken.java │ │ │ ├── HttpSessionCsrfTokenRepository.java │ │ │ ├── InvalidCsrfTokenException.java │ │ │ ├── LazyCsrfTokenRepository.java │ │ │ └── MissingCsrfTokenException.java │ │ ├── sqlinjection │ │ │ ├── SqlFirewall.java │ │ │ ├── SqlInjectionProperties.java │ │ │ ├── SqlInjectionWafFactory.java │ │ │ ├── SqlSymbolsHandler.java │ │ │ └── SqlWAFHandler.java │ │ └── xss │ │ │ ├── AbstractRegexpXssHandler.java │ │ │ ├── AbstractXssHandler.java │ │ │ ├── HtmlEventHandlerXssHandler.java │ │ │ ├── HtmlTagXssHandler.java │ │ │ ├── JavaScriptXssHandler.java │ │ │ ├── XssFirewall.java │ │ │ ├── XssProperties.java │ │ │ └── XssWafFactory.java │ │ └── servlet │ │ ├── HttpDateGenerator.java │ │ ├── HttpDateParser.java │ │ ├── HttpRequestParameterController.java │ │ ├── HttpServletRequestStreamWrapper.java │ │ ├── RRHolder.java │ │ ├── ServletHttpRRFactorySupplier.java │ │ ├── ServletHttpRequest.java │ │ ├── ServletHttpRequestFactory.java │ │ ├── ServletHttpResponse.java │ │ ├── ServletHttpResponseFactory.java │ │ └── Servlets.java │ └── resources │ ├── META-INF │ └── services │ │ └── com.jn.agileway.web.prediate.HttpRequestPredicateFactory │ ├── agileway_error_en.properties │ └── agileway_error_zh.properties ├── agileway-zip ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── jn │ │ │ └── agileway │ │ │ └── zip │ │ │ ├── CompressFormat.java │ │ │ ├── CompressFormatFactory.java │ │ │ ├── CompressFormats.java │ │ │ ├── CompressUtils.java │ │ │ ├── UnsupportedArchiveFormatException.java │ │ │ ├── archive │ │ │ ├── ArchiveEntryCustomizer.java │ │ │ ├── ArchiveEntryFilter.java │ │ │ ├── ArchiveIterator.java │ │ │ ├── ArchiveOutputStreamCustomizer.java │ │ │ ├── ArchiveSuiteFactory.java │ │ │ ├── Archiver.java │ │ │ ├── AutowiredArchiveSuiteFactory.java │ │ │ ├── Expander.java │ │ │ ├── FileAttrsCopier.java │ │ │ ├── SimpleArchiveSuiteFactory.java │ │ │ ├── SingleArchiveSuiteFactory.java │ │ │ └── tar │ │ │ │ ├── TarArchiveOutputStreamCustomizer.java │ │ │ │ ├── TarArchiveSuiteFactory.java │ │ │ │ └── TarFileEntryFileAttrsCopier.java │ │ │ ├── ext │ │ │ └── quicklz │ │ │ │ └── QuickLz.java │ │ │ └── readme.md │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── com.jn.agileway.zip.archive.SingleArchiveSuiteFactory │ │ └── compressformats.yml │ └── test │ └── java │ └── com │ └── jn │ └── agileway │ └── zip │ └── tests │ ├── TarTests.java │ └── ZipTests.java ├── build ├── clean.bat └── prebuild.bat ├── pom.xml └── sonar-scan.bat /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | target/ 4 | *.iml 5 | .idea/ 6 | dependency-reduced-pom.xml 7 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/AuditRequestFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core; 2 | 3 | import com.jn.langx.Filter; 4 | 5 | /** 6 | * 对请求进行过滤,判断到底是否要进行审计 7 | * @param 8 | * @param 9 | */ 10 | public interface AuditRequestFilter extends Filter> { 11 | } 12 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/AuditorFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core; 2 | 3 | 4 | import com.jn.langx.Factory; 5 | 6 | public interface AuditorFactory extends Factory { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/Audit.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.*; 8 | 9 | /** 10 | * A mark annotation 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target({TYPE, METHOD, PACKAGE}) 14 | public @interface Audit { 15 | /** 16 | * @return whether enable audit for a method 17 | */ 18 | boolean enable() default true; 19 | } 20 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/Operation.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.METHOD; 8 | 9 | /** 10 | * The operation definition annotation 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target({METHOD}) 14 | public @interface Operation { 15 | String code() default ""; // class fullname +"."+methodName 16 | 17 | String name() default ""; // 18 | 19 | String description() default ""; // 20 | 21 | String type() default ""; // 22 | 23 | String module() default ""; 24 | 25 | Resource resourceDefinition() default @Resource(); 26 | } 27 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/Resource.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.ANNOTATION_TYPE; 8 | import static java.lang.annotation.ElementType.PARAMETER; 9 | 10 | /** 11 | * 用在方法参数上,用于 表示被标注的 字段、参数的值就是该资源实例的 Id 12 | *

13 | * 被标注的应该是一个字符串 类型,如果不是,会被自动转为字符串 14 | */ 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Target({PARAMETER, ANNOTATION_TYPE}) 17 | public @interface Resource { 18 | ResourceMapping value() default @ResourceMapping(id = "id", name = "name", type = ""); 19 | 20 | ResourceProperty[] properties() default {}; 21 | } 22 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/ResourceId.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.*; 8 | 9 | /** 10 | * 用在一个字段上、Getter、方法参数上,用于 表示被标注的 字段、参数的值就是该资源实例的 Id 11 | *

12 | * 被标注的应该是一个字符串 类型,如果不是,会被自动转为字符串 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target({PARAMETER, FIELD, METHOD}) 16 | public @interface ResourceId { 17 | } 18 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/ResourceName.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.*; 8 | 9 | /** 10 | * 用在一个字段上、Getter、方法参数上,用于 表示被标注的 字段、参数的值就是该资源实例的名称 11 | *

12 | * 被标注的应该是一个字符串 类型 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target({PARAMETER, FIELD, METHOD}) 16 | public @interface ResourceName { 17 | } 18 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/ResourceProperty.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | public @interface ResourceProperty { 4 | String name(); 5 | String value(); 6 | } 7 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/annotation/ResourceType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.annotation; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | import java.lang.annotation.Target; 6 | 7 | import static java.lang.annotation.ElementType.*; 8 | 9 | /** 10 | * 用在一个字段上、Getter、方法参数上,用于 表示被标注的 字段、参数的值就是该资源实例的名称 11 | * 被标注的应该是一个字符串 类型 12 | */ 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Target({PARAMETER, FIELD, METHOD}) 15 | public @interface ResourceType { 16 | } 17 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/exception/IllegalResourceDefinition.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.exception; 2 | 3 | public class IllegalResourceDefinition extends RuntimeException { 4 | public IllegalResourceDefinition() { 5 | super(); 6 | } 7 | 8 | public IllegalResourceDefinition(String message) { 9 | super(message); 10 | } 11 | 12 | public IllegalResourceDefinition(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public IllegalResourceDefinition(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/model/OperationImportance.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.model; 2 | 3 | import com.jn.langx.util.struct.pair.NameValuePair; 4 | 5 | import java.io.Serializable; 6 | 7 | public class OperationImportance extends NameValuePair implements Serializable { 8 | public static final long serialVersionUID = 1L; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/model/PrincipalType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.model; 2 | 3 | public enum PrincipalType { 4 | authenticated, 5 | anonymous, 6 | unknown; 7 | } 8 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/OperationDefinitionParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation; 2 | 3 | import com.jn.agileway.audit.core.model.OperationDefinition; 4 | import com.jn.langx.Nameable; 5 | import com.jn.langx.Parser; 6 | 7 | /** 8 | * OperationDefinition 解析器,解析出OperationDefinition 9 | * 10 | * @param 11 | */ 12 | public interface OperationDefinitionParser extends Parser, Nameable { 13 | String getName(); 14 | 15 | @Override 16 | void setName(String s); 17 | 18 | @Override 19 | OperationDefinition parse(E e); 20 | } 21 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/OperationIdGenerator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.langx.IdGenerator; 5 | 6 | /** 7 | * 生成 operation id 8 | * @param 9 | * @param 10 | * 11 | * @see com.jn.agileway.audit.core.operation.method.OperationMethodExtractor 12 | */ 13 | public interface OperationIdGenerator extends IdGenerator> { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/OperationParametersExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.langx.util.function.Supplier; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * 请求参数提取器 10 | * @param 11 | * @param 12 | */ 13 | public interface OperationParametersExtractor extends Supplier, Map> { 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/method/AbstractOperationMethodIdGenerator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation.method; 2 | 3 | import com.jn.agileway.audit.core.operation.OperationIdGenerator; 4 | import com.jn.langx.invocation.MethodInvocation; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | * 方法ID生成器 10 | * @param 11 | */ 12 | public abstract class AbstractOperationMethodIdGenerator implements OperationIdGenerator { 13 | @Override 14 | public final String get() { 15 | throw new UnsupportedOperationException(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/method/OperationMethodAnnotationDefinitionParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation.method; 2 | 3 | import com.jn.agileway.audit.core.operation.OperationDefinitionParser; 4 | 5 | import java.lang.annotation.Annotation; 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | * 基于方法上的注解的解析器 10 | * @param 11 | */ 12 | public interface OperationMethodAnnotationDefinitionParser extends OperationDefinitionParser { 13 | Class getAnnotation(); 14 | } 15 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/repository/OperationDefinitionLoader.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation.repository; 2 | 3 | import com.jn.agileway.audit.core.model.OperationDefinition; 4 | import com.jn.agileway.audit.core.model.OperationImportance; 5 | import com.jn.langx.annotation.NonNull; 6 | import com.jn.langx.annotation.Nullable; 7 | import com.jn.langx.configuration.ConfigurationLoader; 8 | import com.jn.langx.configuration.FullLoadConfigurationLoader; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public interface OperationDefinitionLoader extends ConfigurationLoader { 14 | @NonNull 15 | List reload(@Nullable Map importances); 16 | 17 | void setDefinitionFilePath(@NonNull String definitionFilePath); 18 | } 19 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/operation/repository/OperationRepositoryParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.operation.repository; 2 | 3 | import com.jn.agileway.audit.core.operation.OperationDefinitionParser; 4 | 5 | public interface OperationRepositoryParser extends OperationDefinitionParser { 6 | String getName(); 7 | 8 | String getRepositoryName(); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/principal/PrincipalExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.principal; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.agileway.audit.core.model.Principal; 5 | import com.jn.langx.util.function.Supplier; 6 | 7 | public interface PrincipalExtractor extends Supplier, Principal> { 8 | @Override 9 | Principal get(AuditRequest wrappedRequest); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/ResourceExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.agileway.audit.core.model.Resource; 5 | import com.jn.langx.util.function.Supplier; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 提取 Resource 11 | * @param 12 | * @param 13 | */ 14 | public interface ResourceExtractor extends Supplier, List> { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/ResourceSupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource; 2 | 3 | import com.jn.agileway.audit.core.model.Resource; 4 | import com.jn.langx.util.valuegetter.ValueGetter; 5 | 6 | /** 7 | * create a {@link com.jn.agileway.audit.core.model.Resource} object from a entity, collection or other struct 8 | * 9 | * @param the entity 10 | */ 11 | public interface ResourceSupplier extends ValueGetter { 12 | } 13 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/idresource/EntityLoader.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.idresource; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.agileway.audit.core.model.ResourceDefinition; 5 | import com.jn.langx.Named; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | public interface EntityLoader extends Named { 11 | List load(AuditRequest request, ResourceDefinition resourceDefinition, List ids); 12 | } 13 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/idresource/EntityLoaderRegistry.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.idresource; 2 | 3 | import com.jn.langx.registry.GenericRegistry; 4 | import com.jn.langx.util.Preconditions; 5 | 6 | public class EntityLoaderRegistry extends GenericRegistry { 7 | 8 | @Override 9 | public void register(EntityLoader entityLoader) { 10 | register(entityLoader.getName(), entityLoader); 11 | } 12 | 13 | @Override 14 | public void register(String name, EntityLoader entityLoader) { 15 | if(entityLoader instanceof EntityLoaderDispatcher){ 16 | return; 17 | } 18 | Preconditions.checkNotEmpty(name,"the entity loader name is null or empty"); 19 | super.register(name, entityLoader); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/parser/ResourceSupplierParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.parser; 2 | 3 | import com.jn.agileway.audit.core.resource.ResourceSupplier; 4 | import com.jn.langx.Parser; 5 | 6 | /** 7 | * 用于创建 ResourceSupplier 8 | */ 9 | public interface ResourceSupplierParser extends Parser { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/parser/clazz/EntityClassResourceSupplierParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.parser.clazz; 2 | 3 | import com.jn.agileway.audit.core.resource.parser.ResourceSupplierParser; 4 | import com.jn.agileway.audit.core.resource.supplier.EntityResourceSupplier; 5 | 6 | /** 7 | * 根据Entity Class 来解析出 ResourceSupplier 8 | */ 9 | public interface EntityClassResourceSupplierParser extends ResourceSupplierParser, EntityResourceSupplier> { 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/supplier/EntityResourceSupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.supplier; 2 | 3 | import com.jn.langx.util.valuegetter.MemberValueGetter; 4 | 5 | public class EntityResourceSupplier extends ContainerResourceSupplier { 6 | /** 7 | * 实体类 8 | */ 9 | private Class entityClass; 10 | 11 | public EntityResourceSupplier(Class entityClass) { 12 | this.entityClass = entityClass; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "EntityResourceSupplier{" + 18 | "entityClass=" + entityClass + 19 | '}'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/supplier/EnumerationValueGetter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.supplier; 2 | 3 | import com.jn.langx.util.collection.Pipeline; 4 | import com.jn.langx.util.valuegetter.ValueGetter; 5 | 6 | public class EnumerationValueGetter implements ValueGetter { 7 | private int index; 8 | 9 | public EnumerationValueGetter(int index) { 10 | this.index = index; 11 | } 12 | 13 | @Override 14 | public Object get(Object enumeration) { 15 | return Pipeline.of(enumeration).asList().get(index); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/supplier/IterableResourceSupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.supplier; 2 | 3 | 4 | public class IterableResourceSupplier extends ContainerResourceSupplier { 5 | } 6 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/resource/supplier/MapResourceSupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.resource.supplier; 2 | 3 | import com.jn.langx.util.valuegetter.MapValueGetter; 4 | 5 | import java.util.Map; 6 | 7 | public class MapResourceSupplier extends ContainerResourceSupplier { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/service/ServiceExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.service; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.agileway.audit.core.model.Service; 5 | import com.jn.langx.util.function.Supplier; 6 | 7 | public interface ServiceExtractor extends Supplier, Service> { 8 | @Override 9 | Service get(AuditRequest input); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-core/src/main/java/com/jn/agileway/audit/core/session/SessionIdExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.core.session; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.langx.util.function.Supplier; 5 | 6 | public interface SessionIdExtractor extends Supplier, String> { 7 | } 8 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-entityloader/agileway-audit-entityloader-resttemplate/src/main/java/com/jn/agileway/audit/entityloader/resttemplate/DefaultResourceEntityExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.entityloader.resttemplate; 2 | 3 | import com.jn.langx.http.rest.RestRespBody; 4 | import org.springframework.http.ResponseEntity; 5 | 6 | public class DefaultResourceEntityExtractor implements ResourceEntityExtractor { 7 | @Override 8 | public Object extract(ResponseEntity response) { 9 | if (response.hasBody()) { 10 | Object obj = response.getBody(); 11 | if (obj instanceof RestRespBody) { 12 | RestRespBody restRespBody = (RestRespBody) obj; 13 | return restRespBody.getData(); 14 | } 15 | return obj; 16 | } 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-entityloader/agileway-audit-entityloader-resttemplate/src/main/java/com/jn/agileway/audit/entityloader/resttemplate/DefaultRestTemplateProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.entityloader.resttemplate; 2 | 3 | import com.jn.agileway.audit.core.model.ResourceDefinition; 4 | import org.springframework.http.HttpMethod; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | public class DefaultRestTemplateProvider implements RestTemplateProvider { 8 | private RestTemplate restTemplate = new RestTemplate(); 9 | 10 | @Override 11 | public RestTemplate get(String url, HttpMethod httpMethod, ResourceDefinition resourceDefinition) { 12 | return restTemplate; 13 | } 14 | 15 | public void setRestTemplate(RestTemplate restTemplate) { 16 | this.restTemplate = restTemplate; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-entityloader/agileway-audit-entityloader-resttemplate/src/main/java/com/jn/agileway/audit/entityloader/resttemplate/ParameterizedResponseClassProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.entityloader.resttemplate; 2 | 3 | import com.jn.agileway.audit.core.model.ResourceDefinition; 4 | import org.springframework.core.ParameterizedTypeReference; 5 | import org.springframework.http.HttpMethod; 6 | 7 | public interface ParameterizedResponseClassProvider { 8 | ParameterizedTypeReference get(String url, HttpMethod httpMethod, ResourceDefinition resourceDefinition); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-entityloader/agileway-audit-entityloader-resttemplate/src/main/java/com/jn/agileway/audit/entityloader/resttemplate/ResourceEntityExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.entityloader.resttemplate; 2 | 3 | import org.springframework.http.ResponseEntity; 4 | 5 | public interface ResourceEntityExtractor { 6 | Object extract(ResponseEntity response); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-entityloader/agileway-audit-entityloader-resttemplate/src/main/java/com/jn/agileway/audit/entityloader/resttemplate/RestTemplateProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.entityloader.resttemplate; 2 | 3 | import com.jn.agileway.audit.core.model.ResourceDefinition; 4 | import org.springframework.http.HttpMethod; 5 | import org.springframework.web.client.RestTemplate; 6 | 7 | public interface RestTemplateProvider { 8 | RestTemplate get(String url, HttpMethod httpMethod, ResourceDefinition resourceDefinition); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot1_2-web/src/main/java/com/jn/agileway/audit/servlet/ServletAuditEventExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.servlet; 2 | 3 | import com.jn.agileway.audit.core.AbstractAuditEventExtractor; 4 | import com.jn.langx.invocation.MethodInvocation; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | public class ServletAuditEventExtractor extends AbstractAuditEventExtractor { 9 | public ServletAuditEventExtractor() { 10 | setPrincipalExtractor(new ServletAuditEventPrincipalExtractor()); 11 | setServiceExtractor(new ServletAuditEventServiceExtractor()); 12 | setSessionIdExtractor(new ServletAuditEventSessionIdExtractor()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot1_2-web/src/main/java/com/jn/agileway/audit/servlet/ServletAuditRequest.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.servlet; 2 | 3 | import com.jn.agileway.audit.core.AuditRequest; 4 | import com.jn.langx.invocation.MethodInvocation; 5 | import com.jn.langx.text.StringTemplates; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | public class ServletAuditRequest extends AuditRequest { 10 | 11 | public ServletAuditRequest(HttpServletRequest request, MethodInvocation method) { 12 | setRequest(request); 13 | setRequestContext(method); 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return StringTemplates.formatWithPlaceholder("servletPath:{}, url:{}", getRequest().getServletPath(), getRequest().getRequestURL().toString()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot1_2-web/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.jn.agileway.audit.spring.boot.autoconfigure.ResourceExtractAutoConfiguration,\ 3 | com.jn.agileway.audit.spring.boot.autoconfigure.OperationAutoConfiguration,\ 4 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditAutoConfiguration,\ 5 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditEntranceConfiguration,\ 6 | com.jn.agileway.audit.spring.boot.autoconfigure.WebappInterceptorRegisterConfiguration -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot1_2-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | com.jn.agileway.audit.spring.boot.autoconfigure.ResourceExtractAutoConfiguration 2 | com.jn.agileway.audit.spring.boot.autoconfigure.OperationAutoConfiguration 3 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditAutoConfiguration 4 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditEntranceConfiguration 5 | com.jn.agileway.audit.spring.boot.autoconfigure.WebappInterceptorRegisterConfiguration -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot3-web/src/main/java/com/jn/agileway/audit/spring/package-info.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.audit.spring; -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot3-web/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.jn.agileway.audit.spring.boot.autoconfigure.ResourceExtractAutoConfiguration,\ 3 | com.jn.agileway.audit.spring.boot.autoconfigure.OperationAutoConfiguration,\ 4 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditAutoConfiguration,\ 5 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditEntranceConfiguration,\ 6 | com.jn.agileway.audit.spring.boot.autoconfigure.WebappInterceptorRegisterConfiguration -------------------------------------------------------------------------------- /agileway-audit/agileway-audit-springboot3-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | com.jn.agileway.audit.spring.boot.autoconfigure.ResourceExtractAutoConfiguration 2 | com.jn.agileway.audit.spring.boot.autoconfigure.OperationAutoConfiguration 3 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditAutoConfiguration 4 | com.jn.agileway.audit.spring.boot.autoconfigure.AuditEntranceConfiguration 5 | com.jn.agileway.audit.spring.boot.autoconfigure.WebappInterceptorRegisterConfiguration -------------------------------------------------------------------------------- /agileway-cmd/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.bes2008.solution.agileway 8 | agileway 9 | 5.0.4 10 | 11 | 12 | agileway-cmd 13 | ${project.groupId}:${project.artifactId}:${project.version} 14 | -------------------------------------------------------------------------------- /agileway-cmd/src/main/java/com/jn/agileway/cmd/InstructionSequence.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.cmd; 2 | 3 | import java.io.InputStream; 4 | import java.io.OutputStream; 5 | 6 | public interface InstructionSequence { 7 | 8 | OutputStream getOutputStream(); 9 | 10 | InputStream getInputStream(); 11 | 12 | InputStream getErrorStream(); 13 | 14 | void destroy(); 15 | 16 | int waitFor() throws InterruptedException; 17 | 18 | int exitValue(); 19 | } 20 | -------------------------------------------------------------------------------- /agileway-cmd/src/main/java/com/jn/agileway/cmd/TimeoutObserver.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.cmd; 2 | 3 | /** 4 | * Interface for classes that want to be notified by Watchdog. 5 | * 6 | * @see com.jn.agileway.cmd.Watchdog 7 | */ 8 | public interface TimeoutObserver { 9 | 10 | /** 11 | * Called when the watchdog times out. 12 | * 13 | * @param w the watchdog that timed out. 14 | */ 15 | void onTimeout(Watchdog w); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-cmd/src/main/java/com/jn/agileway/cmd/streamhandler/OutputAsStringExecuteStreamHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.cmd.streamhandler; 2 | 3 | import com.jn.langx.util.io.IOs; 4 | 5 | import java.io.IOException; 6 | 7 | public class OutputAsStringExecuteStreamHandler extends OutputExtractExecuteStreamHandler{ 8 | @Override 9 | public void start() throws IOException { 10 | String content = IOs.readAsString(this.subProcessOutputStream); 11 | this.outputContent.set(content); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-cmd/src/main/java/com/jn/agileway/cmd/streamhandler/OutputExtractExecuteStreamHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.cmd.streamhandler; 2 | 3 | import com.jn.langx.util.struct.Holder; 4 | 5 | public abstract class OutputExtractExecuteStreamHandler extends AbstractExecuteStreamHandler { 6 | protected final Holder outputContent = new Holder(); 7 | 8 | public O getOutputContent() { 9 | return outputContent.get(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /agileway-cmd/src/main/java/com/jn/agileway/cmd/streamhandler/OutputLinesExecuteStreamHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.cmd.streamhandler; 2 | 3 | import com.jn.langx.util.io.IOs; 4 | 5 | import java.io.IOException; 6 | import java.util.List; 7 | 8 | public class OutputLinesExecuteStreamHandler extends OutputExtractExecuteStreamHandler> { 9 | 10 | @Override 11 | public void start() throws IOException { 12 | List output = IOs.readLines(this.subProcessOutputStream); 13 | this.outputContent.set(output); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-cmd/src/test/java/com/jn/agileway/test/commandline/HardwaresTests.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.test.commandline; 2 | 3 | import com.jn.agileway.test.util.os.hardware.cpu.CPUs; 4 | import org.junit.Test; 5 | 6 | public class HardwaresTests { 7 | 8 | @Test 9 | public void testGetCpuId() throws Throwable{ 10 | String id = CPUs.getCpuId(); 11 | System.out.println(id); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /agileway-cmd/src/test/java/com/jn/agileway/test/util/os/Infrastructures.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.test.util.os; 2 | 3 | import com.jn.agileway.test.util.os.hardware.cpu.CPUs; 4 | 5 | public class Infrastructures { 6 | private Infrastructures() { 7 | } 8 | 9 | public static String getCpuId() { 10 | return CPUs.getCpuId(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /agileway-cmd/src/test/java/com/jn/agileway/test/util/os/hardware/cpu/GetCpuIdStreamHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.test.util.os.hardware.cpu; 2 | 3 | import com.jn.agileway.cmd.streamhandler.OutputExtractExecuteStreamHandler; 4 | 5 | abstract class GetCpuIdStreamHandler extends OutputExtractExecuteStreamHandler { 6 | public abstract String getCpuId(); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-cmd/src/test/java/com/jn/agileway/test/util/os/virtualization/GetRuntimeContainerHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.test.util.os.virtualization; 2 | 3 | import com.jn.agileway.cmd.streamhandler.OutputExtractExecuteStreamHandler; 4 | 5 | abstract class GetRuntimeContainerHandler extends OutputExtractExecuteStreamHandler { 6 | /** 7 | * 获取当前运行在的容器,不限定docker容器 8 | * 9 | */ 10 | public abstract RuntimeContainer getContainer(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/AbstractCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec; 2 | 3 | public abstract class AbstractCodecFactory implements CodecFactory { 4 | @Override 5 | public final Codec get(Class expectedType) { 6 | AbstractCodec codec = newCodec(); 7 | if (expectedType != null) { 8 | codec.setTargetType(expectedType); 9 | } 10 | return codec; 11 | } 12 | 13 | abstract protected AbstractCodec newCodec(); 14 | 15 | @Override 16 | public String getName() { 17 | return applyTo().getName(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/CodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec; 2 | 3 | import com.jn.langx.Factory; 4 | import com.jn.langx.Named; 5 | 6 | public interface CodecFactory extends Factory, Named { 7 | @Override 8 | Codec get(Class expectedType); 9 | 10 | CodecType applyTo(); 11 | 12 | @Override 13 | String getName(); 14 | } 15 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/SchemaedStruct.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization; 2 | 3 | /** 4 | * name is the class 5 | */ 6 | public class SchemaedStruct { 7 | private String name; // class name 8 | private byte[] value; 9 | 10 | public String getName() { 11 | return name; 12 | } 13 | 14 | public void setName(String name) { 15 | this.name = name; 16 | } 17 | 18 | public byte[] getValue() { 19 | return value; 20 | } 21 | 22 | public void setValue(byte[] value) { 23 | this.value = value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/activejser/ActivejCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.activejser; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class ActivejCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new ActivejSerCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.ACTIVEJ; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/avro/AvroCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.avro; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class AvroCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new AvroCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.AVRO; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/bson/BsonCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.bson; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class BsonCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new BsonCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.BSON; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/cbor/CborJacksonCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.cbor; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class CborJacksonCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new CborJacksonCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.CBOR; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/fse/FseCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.fse; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class FseCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new FseCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.FSE; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/fse/FseCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.fse; 2 | 3 | import com.jfireframework.fse.Fse; 4 | 5 | public interface FseCustomizer { 6 | String getName(); 7 | 8 | void customize(Fse fse); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/fst/FstCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.fst; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class FstCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new FstCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.FST; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/fst/FstCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.fst; 2 | 3 | import org.nustaq.serialization.FSTConfiguration; 4 | 5 | public interface FstCustomizer { 6 | String getName(); 7 | 8 | void customize(FSTConfiguration fst); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/hessian/HessianCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.hessian; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class HessianCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new HessianCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.HESSIAN; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/jdk/JdkCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.jdk; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class JdkCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new JdkCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.JDK; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/json/EasyjsonCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.json; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class EasyjsonCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new EasyjsonCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.JSON; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/json/JacksonCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.json; 2 | 3 | import com.fasterxml.jackson.core.JsonFactory; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.jn.agileway.codec.serialization.jackson.BasedJacksonCodec; 6 | 7 | public class JacksonCodec extends BasedJacksonCodec { 8 | public JacksonCodec() { 9 | super(new ObjectMapper(new JsonFactory())); 10 | } 11 | 12 | public JacksonCodec(ClassLoader classLoader) { 13 | super(createObjectMapper(classLoader, new ObjectMapper(new JsonFactory()))); 14 | } 15 | 16 | public JacksonCodec(ClassLoader classLoader, JacksonCodec codec) { 17 | super(createObjectMapper(classLoader, codec.objectMapper.copy())); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/json/JacksonCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.json; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class JacksonCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new JacksonCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.JACKSON; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/kryo/KryoCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.kryo; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class KryoCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new KryoCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.KRYO; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/kryo/KryoCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.kryo; 2 | 3 | import com.esotericsoftware.kryo.Kryo; 4 | 5 | public interface KryoCustomizer { 6 | String getName(); 7 | void customize(Kryo kryo); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/kryo/customizer/LangxJavaKryoCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.kryo.customizer; 2 | 3 | import com.esotericsoftware.kryo.Kryo; 4 | import com.jn.agileway.codec.serialization.kryo.KryoCustomizer; 5 | 6 | public class LangxJavaKryoCustomizer implements KryoCustomizer { 7 | @Override 8 | public String getName() { 9 | return "langx_java"; 10 | } 11 | 12 | @Override 13 | public void customize(Kryo kryo) { 14 | 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/msgpack/MsgPackCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.msgpack; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.jn.agileway.codec.serialization.jackson.BasedJacksonCodec; 5 | import org.msgpack.jackson.dataformat.MessagePackFactory; 6 | 7 | public class MsgPackCodec extends BasedJacksonCodec { 8 | public MsgPackCodec() { 9 | super(new ObjectMapper(new MessagePackFactory())); 10 | } 11 | 12 | public MsgPackCodec(ClassLoader classLoader) { 13 | super(createObjectMapper(classLoader, new ObjectMapper(new MessagePackFactory()))); 14 | } 15 | 16 | public MsgPackCodec(ClassLoader classLoader, MsgPackCodec codec) { 17 | super(createObjectMapper(classLoader, codec.objectMapper.copy())); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/msgpack/MsgPackCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.msgpack; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class MsgPackCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new MsgPackCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.MSGPACK; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/protostuff/ProtostuffCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.protostuff; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class ProtostuffCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new ProtostuffCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.PROTOSTUFF; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/xml/javabeans/JavaBeansXmlCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.xml.javabeans; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class JavaBeansXmlCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new JavaBeansXmlCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.JAVABEANS_XML; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/xson/XsonCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.xson; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.langx.codec.CodecException; 5 | 6 | public class XsonCodec extends AbstractCodec { 7 | 8 | @Override 9 | protected byte[] doEncode(T t, boolean withSchema) throws CodecException { 10 | try { 11 | return Xsons.serialize(t); 12 | } catch (Throwable ex) { 13 | throw new CodecException(ex.getMessage(), ex); 14 | } 15 | } 16 | 17 | @Override 18 | protected T doDecode(byte[] bytes, boolean withSchema, Class targetType) throws CodecException { 19 | return Xsons.deserialize(bytes, targetType); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /agileway-codec/src/main/java/com/jn/agileway/codec/serialization/xson/XsonCodecFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.codec.serialization.xson; 2 | 3 | import com.jn.agileway.codec.AbstractCodec; 4 | import com.jn.agileway.codec.AbstractCodecFactory; 5 | import com.jn.agileway.codec.CodecType; 6 | 7 | public class XsonCodecFactory extends AbstractCodecFactory { 8 | @Override 9 | protected AbstractCodec newCodec() { 10 | return new XsonCodec(); 11 | } 12 | 13 | @Override 14 | public CodecType applyTo() { 15 | return CodecType.XSON; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-codec/src/main/resources/META-INF/services/com.jn.agileway.codec.serialization.fst.FstCustomizer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bes2008/agileway/0e8badd20d40f267796849addb313cbd80947bc1/agileway-codec/src/main/resources/META-INF/services/com.jn.agileway.codec.serialization.fst.FstCustomizer -------------------------------------------------------------------------------- /agileway-codec/src/main/resources/META-INF/services/com.jn.agileway.codec.serialization.kryo.KryoCustomizer: -------------------------------------------------------------------------------- 1 | com.jn.agileway.codec.serialization.kryo.customizer.LangxJavaKryoCustomizer 2 | com.jn.agileway.codec.serialization.kryo.customizer.JdkClassesKryoCustomizer 3 | com.jn.agileway.codec.serialization.kryo.customizer.GuavaKryoCustomizer 4 | com.jn.agileway.codec.serialization.kryo.customizer.JodaTimeKryoCustomizer 5 | com.jn.agileway.codec.serialization.kryo.customizer.CGLibProxyKryoCustomizer 6 | com.jn.agileway.codec.serialization.kryo.customizer.DexxKryoCustomizer 7 | -------------------------------------------------------------------------------- /agileway-codec/src/main/resources/META-INF/services/org.bson.codecs.configuration.CodecProvider: -------------------------------------------------------------------------------- 1 | org.bson.codecs.ValueCodecProvider 2 | org.bson.codecs.MapCodecProvider 3 | org.bson.codecs.BsonValueCodecProvider 4 | org.bson.codecs.jsr310.Jsr310CodecProvider 5 | org.bson.codecs.UuidCodecProvider 6 | org.bson.codecs.IterableCodecProvider 7 | org.bson.codecs.DocumentCodecProvider 8 | org.bson.codecs.BsonCodecProvider 9 | -------------------------------------------------------------------------------- /agileway-dmmq/README.MD: -------------------------------------------------------------------------------- 1 | # agileway-dmmq (Disruptor Memory Message Queue) 2 | 3 | ## 术语 4 | + Topic: 消息主题 5 | + Producer: 生产者,push消息到Topic 6 | + Consumer: 消费者,从topic中pull消息 7 | + MessageTopicDispatcher: 赋值对topic管理、调度, consumer订阅等等 8 | 9 | ## Producer, Topic, Consumer 关系 10 | 1. 消息流转:producer -> topic -> consumer 11 | 2. 一个producer可以push消息到多个topic, 一个topic可以接收多个producer发的消息 12 | 3. 一个consumer可以从多个topic拉取消息, 一个topic的消息可以被多个消费者重复的消费 13 | 4. 一个consumer可以依赖于从同一topic拉取消息的多个其他的consumer -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/BuiltinWaitStrategyFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.agileway.dmmq.core.utils.MQs; 4 | import com.jn.langx.Factory; 5 | import com.lmax.disruptor.WaitStrategy; 6 | 7 | public class BuiltinWaitStrategyFactory implements Factory { 8 | @Override 9 | public WaitStrategy get(String name) { 10 | return MQs.builtinWaitStrategyMap.get(name); 11 | } 12 | 13 | public boolean isBuiltin(String name) { 14 | return get(name) != null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/Consumer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.langx.util.struct.Holder; 4 | import com.lmax.disruptor.EventHandler; 5 | import com.lmax.disruptor.ExceptionHandler; 6 | import com.lmax.disruptor.TimeoutHandler; 7 | 8 | public interface Consumer extends EventHandler>, ExceptionHandler>, TimeoutHandler { 9 | String getName(); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/DefaultMessageTranslator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | 4 | public class DefaultMessageTranslator implements MessageTranslator { 5 | @Override 6 | public void translateTo(MessageHolder event, long sequence, String topic, M message) { 7 | event.setTopicName(topic); 8 | event.set(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/MessageHolder.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.langx.util.struct.Holder; 4 | 5 | public class MessageHolder extends Holder implements TopicNameAware { 6 | private String topicName; 7 | 8 | @Override 9 | public String getTopicName() { 10 | return topicName; 11 | } 12 | 13 | @Override 14 | public void setTopicName(String topicName) { 15 | this.topicName = topicName; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/MessageHolderFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.lmax.disruptor.EventFactory; 4 | 5 | public class MessageHolderFactory implements EventFactory> { 6 | @Override 7 | public MessageHolder newInstance() { 8 | return new MessageHolder(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/MessageTopicDispatcherAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | public interface MessageTopicDispatcherAware { 4 | MessageTopicDispatcher getMessageTopicDispatcher(); 5 | void setMessageTopicDispatcher(MessageTopicDispatcher dispatcher); 6 | } 7 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/MessageTranslator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.langx.annotation.NonNull; 4 | import com.lmax.disruptor.EventTranslatorTwoArg; 5 | 6 | /** 7 | * 多个topic不能共用同一个translator 8 | *

9 | * 一个topic 一个,每一次 publish时,要保证 translator 是独占使用的,因为 publish动作是阻塞。 10 | * 11 | * @param 12 | */ 13 | public interface MessageTranslator extends EventTranslatorTwoArg, String, M> { 14 | 15 | @Override 16 | void translateTo(MessageHolder event, long sequence, @NonNull String topic,@NonNull M message); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/Producer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.langx.annotation.NonNull; 4 | import com.jn.langx.annotation.Nullable; 5 | 6 | public interface Producer extends TopicAllocatorAware, MessageTopicDispatcherAware { 7 | void publish(@NonNull M message); 8 | 9 | void publish(@Nullable String topicName, @NonNull M message); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/TopicAllocator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | import com.jn.agileway.dmmq.core.event.TopicEventListener; 4 | import com.jn.langx.util.function.Function; 5 | 6 | public interface TopicAllocator extends Function, TopicEventListener { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/TopicAllocatorAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | public interface TopicAllocatorAware { 4 | 5 | void setTopicAllocator(TopicAllocator topicAllocator); 6 | 7 | TopicAllocator getTopicAllocator(); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/TopicNameAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core; 2 | 3 | public interface TopicNameAware { 4 | void setTopicName(String topic); 5 | String getTopicName(); 6 | } 7 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/allocator/DefaultTopicAllocator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.allocator; 2 | 3 | public class DefaultTopicAllocator extends FixedTopicAllocator { 4 | public static final String TOPIC_DEFAULT = "DEFAULT"; 5 | 6 | public DefaultTopicAllocator() { 7 | super(TOPIC_DEFAULT); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/allocator/HashedTopicAllocator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.allocator; 2 | 3 | import com.jn.langx.util.collection.Collects; 4 | import com.jn.langx.util.function.Function; 5 | 6 | import java.util.List; 7 | 8 | public class HashedTopicAllocator extends AbstractMultipleCandidateTopicAllocator { 9 | 10 | private Function hasher; 11 | 12 | public void setHasher(Function hasher) { 13 | this.hasher = hasher; 14 | } 15 | 16 | @Override 17 | public String apply(M message) { 18 | List topics = Collects.asList(validTopics); 19 | if (topics.isEmpty()) { 20 | return null; 21 | } 22 | return topics.get(hasher.apply(message) % topics.size()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/allocator/RandomTopicAllocator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.allocator; 2 | 3 | import com.jn.langx.util.collection.Collects; 4 | import com.jn.langx.util.random.ThreadLocalRandom; 5 | 6 | public class RandomTopicAllocator extends AbstractMultipleCandidateTopicAllocator { 7 | 8 | @Override 9 | public String apply(M input) { 10 | if (validTopics.isEmpty()) { 11 | return null; 12 | } 13 | int index = ThreadLocalRandom.current().nextInt(0, validTopics.size()); 14 | return Collects.asList(validTopics).get(index); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/event/TopicEvent.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.event; 2 | 3 | import com.jn.agileway.dmmq.core.MessageTopic; 4 | import com.jn.langx.event.DomainEvent; 5 | 6 | public class TopicEvent extends DomainEvent { 7 | public static final String DOMAIN = "TOPIC"; 8 | private TopicEventType type; 9 | 10 | public TopicEvent(MessageTopic source) { 11 | super(DOMAIN, source); 12 | } 13 | 14 | public TopicEvent(MessageTopic source, TopicEventType type) { 15 | super(DOMAIN, source); 16 | setType(type); 17 | } 18 | 19 | 20 | public TopicEventType getType() { 21 | return type; 22 | } 23 | 24 | public void setType(TopicEventType type) { 25 | this.type = type; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/event/TopicEventListener.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.event; 2 | 3 | import com.jn.langx.event.EventListener; 4 | 5 | public interface TopicEventListener extends EventListener { 6 | } 7 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/event/TopicEventType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.event; 2 | 3 | public enum TopicEventType { 4 | ADD, REMOVE; 5 | } 6 | -------------------------------------------------------------------------------- /agileway-dmmq/src/main/java/com/jn/agileway/dmmq/core/utils/MQs.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.dmmq.core.utils; 2 | 3 | import com.lmax.disruptor.*; 4 | 5 | import java.util.Collections; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class MQs { 10 | public static final Map builtinWaitStrategyMap; 11 | 12 | static { 13 | HashMap map = new HashMap(); 14 | map.put("blocking", new BlockingWaitStrategy()); 15 | map.put("sleeping", new SleepingWaitStrategy()); 16 | map.put("yielding", new YieldingWaitStrategy()); 17 | map.put("busySpin", new BusySpinWaitStrategy()); 18 | 19 | builtinWaitStrategyMap = Collections.unmodifiableMap(map); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/.wiki/images/eip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bes2008/agileway/0e8badd20d40f267796849addb313cbd80947bc1/agileway-eipchannel/agileway-eipchannel-core/.wiki/images/eip.png -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.bes2008.solution.agileway.eipchannel 7 | agileway-eipchannel 8 | 5.0.4 9 | 10 | 4.0.0 11 | 12 | agileway-eipchannel-core 13 | ${project.groupId}:${project.artifactId}:${project.version} 14 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/ChannelDirect.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel; 2 | 3 | public enum ChannelDirect { 4 | INBOUND, 5 | OUTBOUND, 6 | DUPLEX 7 | } 8 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/ChannelResolver.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel; 2 | 3 | public interface ChannelResolver { 4 | /** 5 | * Return the MessageChannel for the given name. 6 | */ 7 | C resolve(String channelName, ChannelDirect channelMode); 8 | } -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/DuplexChannel.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel; 2 | 3 | /** 4 | * 双工通道, 通常用于 Request, Replay模式 5 | */ 6 | public interface DuplexChannel extends InboundChannel, OutboundChannel { 7 | } 8 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/MessageChannel.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel; 2 | 3 | import com.jn.langx.Nameable; 4 | import com.jn.langx.lifecycle.Initializable; 5 | import com.jn.langx.lifecycle.Lifecycle; 6 | 7 | /** 8 | * Base channel interface defining common behavior for sending messages. 9 | * 用于代表内存级channel,或者分布式 channel 10 | *

11 | * 使用它可以用来接收消息,也可以用来发布消息。 12 | *

13 | * 用它来接收时,源头可以是一个,也可以是多个 14 | */ 15 | public interface MessageChannel extends Nameable, Lifecycle, Initializable { 16 | } 17 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/pipe/InboundMessageInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel.pipe; 2 | 3 | 4 | import com.jn.agileway.eipchannel.core.channel.OutboundChannel; 5 | import com.jn.agileway.eipchannel.core.message.Message; 6 | 7 | public abstract class InboundMessageInterceptor implements ChannelMessageInterceptor { 8 | @Override 9 | public final Message beforeOutbound(OutboundChannel channel, Message message) { 10 | throw new UnsupportedOperationException(); 11 | } 12 | 13 | @Override 14 | public final void afterOutbound(OutboundChannel channel, Message message, boolean sent) { 15 | throw new UnsupportedOperationException(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/channel/pipe/OutboundMessageInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.channel.pipe; 2 | 3 | import com.jn.agileway.eipchannel.core.channel.InboundChannel; 4 | import com.jn.agileway.eipchannel.core.message.Message; 5 | 6 | public abstract class OutboundMessageInterceptor implements ChannelMessageInterceptor { 7 | @Override 8 | public final boolean beforeInbound(InboundChannel channel) { 9 | throw new UnsupportedOperationException(); 10 | } 11 | 12 | @Override 13 | public final Message afterInbound(InboundChannel channel, Message message) { 14 | throw new UnsupportedOperationException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/Endpoint.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint; 2 | 3 | import com.jn.langx.Nameable; 4 | import com.jn.langx.lifecycle.Initializable; 5 | import com.jn.langx.lifecycle.Lifecycle; 6 | 7 | public interface Endpoint extends Lifecycle, Nameable, Initializable { 8 | } 9 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/dispatcher/MessageDispatcher.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.dispatcher; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.Endpoint; 4 | import com.jn.agileway.eipchannel.core.message.Message; 5 | 6 | /** 7 | * 通常在 consumer 上使用 8 | */ 9 | public interface MessageDispatcher extends Endpoint { 10 | 11 | /** 12 | * 在 consumer中使用时, 该过程代表了 订阅 13 | */ 14 | boolean addHandler(MessageHandler handler); 15 | 16 | boolean removeHandler(MessageHandler handler); 17 | 18 | boolean dispatch(Message message); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/dispatcher/MessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.dispatcher; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | 5 | /** 6 | * Base interface for any component that handles Messages. 7 | */ 8 | public interface MessageHandler { 9 | void handle(Message message); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/exchange/RequestReplyExchanger.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.exchange; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | import com.jn.agileway.eipchannel.core.endpoint.Endpoint; 5 | 6 | public interface RequestReplyExchanger extends Endpoint { 7 | Message exchange(Message request); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/exchange/readme.md: -------------------------------------------------------------------------------- 1 | exchange 通常用于: command系统: redis RPC系统: ejb -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/mapper/MessageMapper.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.mapper; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | import com.jn.langx.util.bean.ReversibleModeMapper; 5 | 6 | public interface MessageMapper extends ReversibleModeMapper> { 7 | @Override 8 | Message map(T t); 9 | 10 | @Override 11 | T reverseMap(Message message); 12 | } 13 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/mapper/UnsupportedObjectException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.mapper; 2 | 3 | public class UnsupportedObjectException extends RuntimeException { 4 | public UnsupportedObjectException() { 5 | super(); 6 | } 7 | 8 | public UnsupportedObjectException(String message) { 9 | super(message); 10 | } 11 | 12 | public UnsupportedObjectException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public UnsupportedObjectException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/pubsub/MessageConsumer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.pubsub; 2 | 3 | import com.jn.agileway.eipchannel.core.channel.InboundChannel; 4 | 5 | public interface MessageConsumer extends PubSubEndpoint { 6 | 7 | InboundChannel getInboundChannel(); 8 | 9 | void setInboundChannel(InboundChannel channel); 10 | 11 | /** 12 | * 阻塞式拉取 13 | * 14 | * @return return a object 15 | */ 16 | T poll(); 17 | 18 | /** 19 | * 指定时间内阻塞 20 | * 21 | * @return return a object 22 | */ 23 | T poll(long timeout); 24 | } 25 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/pubsub/MessageProducer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.pubsub; 2 | 3 | 4 | import com.jn.agileway.eipchannel.core.channel.OutboundChannel; 5 | 6 | public interface MessageProducer extends PubSubEndpoint { 7 | OutboundChannel getOutboundChannel(); 8 | 9 | void setOutboundChannel(OutboundChannel channel); 10 | 11 | boolean send(T obj); 12 | } 13 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/pubsub/PubSubEndpoint.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.pubsub; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.Endpoint; 4 | import com.jn.agileway.eipchannel.core.endpoint.mapper.MessageMapper; 5 | 6 | public interface PubSubEndpoint extends Endpoint { 7 | 8 | void setMessageMapper(MessageMapper messageMapper); 9 | 10 | MessageMapper getMessageMapper(); 11 | } 12 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/sourcesink/sink/OutboundChannelSinker.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.sourcesink.sink; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | import com.jn.langx.lifecycle.Lifecycle; 5 | 6 | public interface OutboundChannelSinker extends Lifecycle { 7 | boolean sink(Message message); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/endpoint/sourcesink/source/InboundChannelMessageSource.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.endpoint.sourcesink.source; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | import com.jn.langx.lifecycle.Lifecycle; 5 | 6 | public interface InboundChannelMessageSource extends Lifecycle { 7 | Message poll(long timeoutInMills); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/message/Message.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.message; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | public interface Message extends Serializable { 7 | T getPayload(); 8 | 9 | MessageHeaders getHeaders(); 10 | } -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/router/DirectOutboundRouter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.router; 2 | 3 | import com.jn.agileway.eipchannel.core.channel.OutboundChannel; 4 | import com.jn.agileway.eipchannel.core.message.Message; 5 | import com.jn.langx.util.collection.Collects; 6 | 7 | import java.util.List; 8 | 9 | public class DirectOutboundRouter extends AbstractMessageRouter { 10 | public DirectOutboundRouter(OutboundChannel defaultOutboundChannel) { 11 | setDefaultOutputChannel(defaultOutboundChannel); 12 | } 13 | 14 | public DirectOutboundRouter() { 15 | 16 | } 17 | 18 | @Override 19 | protected List getChannelIdentifiers(Message message) { 20 | return Collects.asList(getDefaultOutputChannel()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/router/MessageRouter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.router; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.dispatcher.MessageHandler; 4 | import com.jn.langx.lifecycle.Lifecycle; 5 | 6 | public interface MessageRouter extends MessageHandler, Lifecycle { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/router/filter/MessageFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.router.filter; 2 | 3 | import com.jn.agileway.eipchannel.core.router.MessageRouter; 4 | 5 | public interface MessageFilter extends MessageRouter { 6 | } 7 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/core/transformer/MessageTransformer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.core.transformer; 2 | 3 | import com.jn.agileway.eipchannel.core.message.Message; 4 | import com.jn.langx.Transformer; 5 | 6 | public interface MessageTransformer extends Transformer, Message> { 7 | Message transform(Message message); 8 | } -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/eventchannel/EventProducer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.eventchannel; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.pubsub.DefaultMessageProducer; 4 | import com.jn.agileway.eipchannel.eventchannel.mapper.DomainEventMapper; 5 | import com.jn.langx.event.DomainEvent; 6 | 7 | public class EventProducer extends DefaultMessageProducer { 8 | public void setDomainEventMapper(DomainEventMapper mapper) { 9 | this.setMessageMapper(mapper); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/eventchannel/mapper/DomainEventMapper.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.eventchannel.mapper; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.mapper.MessageMapper; 4 | import com.jn.agileway.eipchannel.core.message.Message; 5 | import com.jn.langx.event.DomainEvent; 6 | 7 | public interface DomainEventMapper extends MessageMapper { 8 | @Override 9 | Message map(DomainEvent domainEvent); 10 | 11 | @Override 12 | DomainEvent reverseMap(Message message); 13 | } 14 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/main/java/com/jn/agileway/eipchannel/eventchannel/sink/EventOutboundRemoteSinker.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.eventchannel.sink; 2 | 3 | import com.jn.agileway.eipchannel.core.endpoint.sourcesink.sink.DispatcherOutboundChannelSinker; 4 | import com.jn.agileway.eipchannel.core.router.MessageRouter; 5 | 6 | public class EventOutboundRemoteSinker extends DispatcherOutboundChannelSinker { 7 | public void addMessageRouter(MessageRouter router) { 8 | getDispatcher().addHandler(router); 9 | } 10 | 11 | public void remoteMessageRouter(MessageRouter router) { 12 | getDispatcher().removeHandler(router); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agileway-eipchannel/agileway-eipchannel-core/src/test/java/com/jn/agileway/eipchannel/tests/UserEvent.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.eipchannel.tests; 2 | 3 | import com.jn.langx.event.DomainEvent; 4 | import com.jn.langx.text.StringTemplates; 5 | 6 | public class UserEvent extends DomainEvent { 7 | private UserEventType userEventType; 8 | 9 | public UserEvent(String domain, String userId) { 10 | super(domain, userId); 11 | } 12 | 13 | public void setUserEventType(UserEventType userEventType) { 14 | this.userEventType = userEventType; 15 | } 16 | 17 | public UserEventType getUserEventType() { 18 | return userEventType; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return StringTemplates.formatWithPlaceholder("event-type: {}, event-source: {}", getUserEventType(), getSource()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/AgilewayFeignDecodeException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign; 2 | 3 | import feign.FeignException; 4 | 5 | public class AgilewayFeignDecodeException extends FeignException { 6 | public AgilewayFeignDecodeException(int status, String message) { 7 | super( status, message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/ErrorHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign; 2 | 3 | import com.jn.langx.util.function.Function2; 4 | import feign.InvocationHandlerFactory; 5 | import feign.codec.Decoder; 6 | 7 | /** 8 | * 处理错误 9 | * 10 | * @since 2.6.0 11 | * @param 12 | * 13 | * 14 | */ 15 | public interface ErrorHandler extends Function2 { 16 | 17 | Decoder getDecoder(); 18 | void setDecoder(Decoder decoder); 19 | 20 | @Override 21 | Object apply(E e, InvocationHandlerFactory.MethodHandler methodHandler); 22 | } 23 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/RestServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign; 2 | 3 | import com.jn.agileway.feign.supports.rpc.rest.RestStubProvider; 4 | 5 | 6 | /** 7 | * @see SimpleStubProvider 8 | * @since 1.0.0 9 | */ 10 | @Deprecated 11 | public class RestServiceProvider extends RestStubProvider { 12 | 13 | public Service getService(Class serviceInterface) { 14 | return this.getStub(serviceInterface); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/SimpleStubProviderCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign; 2 | 3 | import com.jn.langx.Customizer; 4 | 5 | /** 6 | * 提供自定义功能 7 | * 8 | * @since 2.6.0 9 | */ 10 | public interface SimpleStubProviderCustomizer extends Customizer { 11 | @Override 12 | void customize(SimpleStubProvider stubProvider); 13 | } 14 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/StubProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign; 2 | 3 | /** 4 | * 服务Stub提供者 5 | * @since 2.6.0 6 | */ 7 | public interface StubProvider { 8 | Stub getStub(Class stubInterface); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/loadbalancer/LBClientConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.loadbalancer; 2 | 3 | import com.netflix.client.config.CommonClientConfigKey; 4 | import com.netflix.client.config.DefaultClientConfigImpl; 5 | import com.netflix.client.config.IClientConfigKey; 6 | 7 | /** 8 | * 由框架控制,只创建一个实例,不需要我们代码调用 9 | * @since 1.0.0 10 | */ 11 | public class LBClientConfig extends DefaultClientConfigImpl { 12 | IClientConfigKey retryableStatusCodes = new CommonClientConfigKey("RetryableStatusCodes") { 13 | }; 14 | 15 | @Override 16 | public int getDefaultMaxAutoRetriesNextServer() { 17 | return 0; 18 | } 19 | 20 | @Override 21 | public void loadDefaultValues() { 22 | super.loadDefaultValues(); 23 | putDefaultStringProperty(retryableStatusCodes, ""); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/param/ToJsonStringExpander.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.param; 2 | 3 | import com.jn.agileway.feign.supports.rpc.rest.param.ToJsonExpander; 4 | 5 | /** 6 | * @see ToJsonExpander 7 | * @since 1.0.0 8 | */ 9 | @Deprecated 10 | public class ToJsonStringExpander extends ToJsonExpander { 11 | } 12 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/param/ToQueryStringExpander.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.param; 2 | 3 | import com.jn.easyjson.core.util.JSONs; 4 | import com.jn.langx.util.net.http.HttpQueryStrings; 5 | import feign.Param; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * @since 1.0.0 11 | */ 12 | public class ToQueryStringExpander implements Param.Expander { 13 | 14 | @Override 15 | public String expand(Object value) { 16 | if (value == null) { 17 | return ""; 18 | } 19 | String jsonString = JSONs.toJson(value); 20 | Map map = JSONs.parse(jsonString, Map.class); 21 | String queryString = HttpQueryStrings.toQueryString(map, true, null, null); 22 | return queryString; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/supports/adaptable/AdaptableErrorDecoder.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.supports.adaptable; 2 | 3 | import feign.Response; 4 | import feign.codec.ErrorDecoder; 5 | /** 6 | * @since 2.6.0 7 | */ 8 | public class AdaptableErrorDecoder implements ErrorDecoder { 9 | @Override 10 | public Exception decode(String methodKey, Response response) { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/supports/adaptable/ResponseBodyAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.supports.adaptable; 2 | 3 | import feign.Response; 4 | 5 | import java.lang.reflect.Type; 6 | 7 | /** 8 | * 当decoder#decode后,如果返回值与期望的不符时,可以使用该适配器进行适配 9 | * @since 2.6.0 10 | */ 11 | public interface ResponseBodyAdapter { 12 | Object adapt(Response response, Type expectedType, Object decodedObject); 13 | } 14 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/supports/mixedprovider/StubProviderLocator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.supports.mixedprovider; 2 | 3 | import com.jn.agileway.feign.SimpleStubProvider; 4 | import com.jn.langx.util.function.Function2; 5 | 6 | import java.util.List; 7 | /** 8 | * @since 2.6.0 9 | */ 10 | public interface StubProviderLocator extends Function2, Class, String> { 11 | @Override 12 | String apply(List providers, Class stubClass); 13 | } 14 | -------------------------------------------------------------------------------- /agileway-feign/src/main/java/com/jn/agileway/feign/supports/rpc/FeignRR.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.feign.supports.rpc; 2 | 3 | import feign.Request; 4 | import feign.Response; 5 | 6 | public class FeignRR { 7 | private Request request; 8 | private Response response; 9 | 10 | public Request getRequest() { 11 | return request; 12 | } 13 | 14 | public void setRequest(Request request) { 15 | this.request = request; 16 | } 17 | 18 | public Response getResponse() { 19 | return response; 20 | } 21 | 22 | public void setResponse(Response response) { 23 | this.response = response; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /agileway-httpclient/src/main/java/com/jn/agileway/httpclient/HttpAsyncClientCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.httpclient; 2 | 3 | import org.apache.http.client.config.RequestConfig; 4 | import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; 5 | 6 | public interface HttpAsyncClientCustomizer { 7 | void customizeHttpRequest(RequestConfig.Builder requestConfigBuilder); 8 | 9 | void customizeAsyncHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-httpclient/src/main/java/com/jn/agileway/httpclient/HttpClientCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.httpclient; 2 | 3 | import org.apache.http.client.config.RequestConfig; 4 | import org.apache.http.impl.client.HttpClientBuilder; 5 | 6 | public interface HttpClientCustomizer { 7 | void customizeHttpRequest(RequestConfig.Builder requestConfigBuilder); 8 | 9 | void customizeHttpClient(HttpClientBuilder httpClientBuilder); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/GlobalRestResponseBodyHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import com.jn.agileway.http.rr.HttpRequest; 4 | import com.jn.agileway.http.rr.HttpResponse; 5 | import com.jn.langx.http.rest.RestRespBody; 6 | 7 | import java.util.Map; 8 | 9 | public interface GlobalRestResponseBodyHandler { 10 | 11 | void setContext(GlobalRestResponseBodyContext context); 12 | GlobalRestResponseBodyContext getContext(); 13 | 14 | RestRespBody handle(HttpRequest request, HttpResponse response, ACTION action, ACTION_RESULT actionReturnValue); 15 | 16 | Map toMap(HttpRequest request, HttpResponse response, ACTION action, RestRespBody respBody); 17 | } 18 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/I18nRestErrorMessageHandlerProperties.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | public class I18nRestErrorMessageHandlerProperties { 4 | 5 | /** 6 | * 是否强制使用 I18n storage里提供的错误消息 7 | */ 8 | private boolean forceI18n = true; 9 | 10 | public boolean isForceI18n() { 11 | return forceI18n; 12 | } 13 | 14 | public void setForceI18n(boolean forceI18n) { 15 | this.forceI18n = forceI18n; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/NoopRestErrorMessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import com.jn.langx.http.rest.RestRespBody; 4 | 5 | import java.util.Locale; 6 | 7 | public class NoopRestErrorMessageHandler implements RestErrorMessageHandler { 8 | public static final NoopRestErrorMessageHandler INSTANCE = new NoopRestErrorMessageHandler(); 9 | 10 | @Override 11 | public void handler(Locale locale, RestRespBody restRespBody) { 12 | // NOOP 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/RestAction.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | public @interface RestAction { 11 | public boolean value() default true; 12 | 13 | /** 14 | * @see com.jn.langx.http.rest.RestRespBody 15 | */ 16 | public String[] ignoreFields() default {}; 17 | } 18 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/RestActionExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import com.jn.agileway.http.rr.HttpRequest; 4 | import com.jn.agileway.http.rr.HttpResponse; 5 | import com.jn.langx.http.rest.RestRespBody; 6 | 7 | public interface RestActionExceptionHandler { 8 | RestRespBody handle(HttpRequest request, HttpResponse response, Object handler, Exception ex); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/RestActionExceptionHandlerOrderFinder.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import com.jn.langx.util.function.Supplier; 4 | 5 | public interface RestActionExceptionHandlerOrderFinder extends Supplier { 6 | @Override 7 | Integer get(RestActionExceptionHandler handler); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/RestActionExceptions.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE}) 10 | public @interface RestActionExceptions { 11 | String name() default ""; 12 | RestActionException[] value() default {}; 13 | int order() default 0; 14 | } 15 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/RestErrorMessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rest; 2 | 3 | import com.jn.langx.http.rest.RestRespBody; 4 | 5 | import java.util.Locale; 6 | 7 | /** 8 | * 通常用于消息格式化、国际化等等 9 | */ 10 | public interface RestErrorMessageHandler { 11 | void handler(Locale locale, RestRespBody restRespBody); 12 | } 13 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rest/readme.md: -------------------------------------------------------------------------------- 1 | 该目录下的内容,可以取代 Spring @ControllerAdvise @ExceptionHandler 等内容 2 | 3 | 开发该功能的主要原因是 Spring的太简单,不能满足复杂的业务场景,不能高度定制化。 -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/HttpRRFactorySupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr; 2 | 3 | public interface HttpRRFactorySupplier { 4 | HttpRequestFactory getHttpRequestFactory(); 5 | 6 | HttpResponseFactory getHttpResponseFactory(); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/HttpRequestFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr; 2 | 3 | import com.jn.langx.Factory; 4 | 5 | public interface HttpRequestFactory extends Factory { 6 | @Override 7 | HttpRequest get(I request); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/HttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr; 2 | 3 | import java.util.Collection; 4 | 5 | public interface HttpResponse { 6 | D getContainerResponse(); 7 | void addHeader(String name, String value); 8 | String getHeader(String name); 9 | Collection getHeaderNames(); 10 | Collection getHeaders(String name); 11 | int getStatusCode(); 12 | } 13 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/HttpResponseFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr; 2 | 3 | import com.jn.langx.Factory; 4 | 5 | public interface HttpResponseFactory extends Factory { 6 | @Override 7 | public HttpResponse get(I response) ; 8 | } 9 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/RR.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr; 2 | 3 | 4 | public class RR { 5 | private HttpRequest request; 6 | private HttpResponse response; 7 | 8 | public RR(final HttpRequest request, final HttpResponse response) { 9 | this.request = request; 10 | this.response = response; 11 | } 12 | 13 | public HttpRequest getRequest() { 14 | return this.request; 15 | } 16 | 17 | public HttpResponse getResponse() { 18 | return this.response; 19 | } 20 | 21 | public void setRequest(HttpRequest request){ 22 | this.request = request; 23 | } 24 | public void setResponse(HttpResponse response){ 25 | this.response = response; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/requestmapping/JavaMethodRequestMappingAccessorParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr.requestmapping; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | public interface JavaMethodRequestMappingAccessorParser extends RequestMappingAccessorParser{ 6 | @Override 7 | RequestMappingAccessor parse(Method method); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/requestmapping/RequestMappingAccessor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr.requestmapping; 2 | 3 | import com.jn.langx.util.net.http.HttpMethod; 4 | 5 | import java.lang.annotation.Annotation; 6 | import java.util.List; 7 | 8 | public interface RequestMappingAccessor { 9 | E getMapping(); 10 | 11 | void setMapping(E mapping); 12 | 13 | String name(); 14 | 15 | List values(); 16 | 17 | List paths(); 18 | 19 | List methods(); 20 | 21 | List params(); 22 | 23 | List headers(); 24 | 25 | List consumes(); 26 | 27 | List produces(); 28 | } 29 | -------------------------------------------------------------------------------- /agileway-httpcontainer-common/src/main/java/com/jn/agileway/http/rr/requestmapping/RequestMappingAccessorParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.http.rr.requestmapping; 2 | 3 | import com.jn.langx.Parser; 4 | 5 | public interface RequestMappingAccessorParser extends Parser { 6 | @Override 7 | RequestMappingAccessor parse(RequestHandler requestHandler); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-jaxrs/src/main/java/com/jn/agileway/jaxrs/rest/JaxrsGlobalRestExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jaxrs.rest; 2 | 3 | import com.jn.agileway.http.rest.AbstractGlobalRestExceptionHandler; 4 | import com.jn.agileway.http.rr.HttpRequest; 5 | import com.jn.agileway.http.rr.HttpResponse; 6 | import com.jn.langx.util.net.http.HttpHeaders; 7 | import com.jn.langx.util.net.mime.MediaType; 8 | 9 | public class JaxrsGlobalRestExceptionHandler extends AbstractGlobalRestExceptionHandler { 10 | @Override 11 | protected boolean isSupportedRestAction(HttpRequest request, HttpResponse response, Object action, Exception ex) { 12 | String header = request.getHeader(HttpHeaders.ACCEPT); 13 | return header.contains(MediaType.APPLICATION_JSON_VALUE) || header.contains("*/*"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-jersey/src/main/java/com/jn/agileway/jersey/ResourceConfigCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jersey; 2 | 3 | import com.jn.langx.Customizer; 4 | import org.glassfish.jersey.server.ResourceConfig; 5 | 6 | public interface ResourceConfigCustomizer extends Customizer { 7 | @Override 8 | void customize(ResourceConfig rc); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/AlgorithmType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | public enum AlgorithmType { 4 | NONE, 5 | JWS, 6 | JWE, 7 | UNSUPPORTED 8 | } 9 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/JWT.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | 4 | public interface JWT { 5 | Header getHeader(); 6 | 7 | Payload getPayload(); 8 | 9 | String toUtf8UrlEncodedToken(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/JWTException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | public class JWTException extends RuntimeException { 4 | public JWTException() { 5 | super(); 6 | } 7 | 8 | public JWTException(String message) { 9 | super(message); 10 | } 11 | 12 | public JWTException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public JWTException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/JWTParser.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | import com.jn.langx.Parser; 4 | 5 | public interface JWTParser extends Parser { 6 | @Override 7 | JWT parse(String jwtstring); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/JWTService.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | import com.jn.agileway.jwt.jwe.JWEPlugin; 4 | 5 | import java.util.List; 6 | 7 | public interface JWTService { 8 | AlgorithmType getAlgorithmType(String algorithmName); 9 | 10 | List supportedJWSAlgorithms(); 11 | 12 | List supportedJWEAlgorithms(); 13 | 14 | JWEPlugin getJWEPlugin(); 15 | 16 | JWTParser newParser(); 17 | 18 | JWSTokenBuilder newJWSTokenBuilder(); 19 | } 20 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/Payload.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | import com.jn.easyjson.core.util.JSONs; 4 | import com.jn.langx.codec.base64.Base64; 5 | import com.jn.langx.util.io.Charsets; 6 | 7 | import java.util.Map; 8 | 9 | public class Payload extends ClaimSet { 10 | public Payload(Map payload) { 11 | super(payload); 12 | } 13 | 14 | public String toBase64UrlEncoded() { 15 | return Base64.encodeBase64URLSafeString(JSONs.toJson(getAllClaims()).getBytes(Charsets.UTF_8)); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/PlainSigner.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | import com.jn.langx.util.collection.Collects; 4 | 5 | import java.util.List; 6 | 7 | public final class PlainSigner implements Signer { 8 | 9 | @Override 10 | public void sign(JWSToken token) { 11 | // NOOP 12 | } 13 | 14 | private static final List supportedAlgorithms = Collects.immutableList(JWTs.JWT_ALGORITHM_PLAIN); 15 | 16 | @Override 17 | public List supportedAlgorithms() { 18 | return supportedAlgorithms; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/PlainVerifier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | public class PlainVerifier implements Verifier { 4 | @Override 5 | public boolean verify(JWSToken token) { 6 | return false; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/Signer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | import java.util.List; 4 | 5 | public interface Signer { 6 | void sign(JWSToken token); 7 | 8 | List supportedAlgorithms(); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/Verifier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt; 2 | 3 | public interface Verifier { 4 | boolean verify(JWSToken token); 5 | } 6 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/jwe/JWEPlugin.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt.jwe; 2 | 3 | 4 | import java.util.List; 5 | 6 | public interface JWEPlugin { 7 | List getSupportedJWEAlgorithms(); 8 | 9 | JWEToken parse(String jwe); 10 | 11 | JWETokenBuilder newJWEBuilder(); 12 | 13 | boolean verify(JWEToken jwe); 14 | } 15 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/jwe/JWEToken.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt.jwe; 2 | 3 | import com.jn.agileway.jwt.JWT; 4 | 5 | public interface JWEToken extends JWT { 6 | } 7 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/java/com/jn/agileway/jwt/readme.md: -------------------------------------------------------------------------------- 1 | ## 数据模型 2 | 3 | + JWT 代表token, 它有2个子类 4 | + JWSToken 5 | + JWEToken 6 | + JWTBuilder:用于构建 JWT 对象,它有2个子类: 7 | + JWSTokenBuilder ,用于构建 plain token, jws token 8 | + JWETokenBuilder 9 | + JWTParser: 用于解析 base64url 格式的 token,生成 JWT对象 10 | -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-core/src/main/resources/META-INF/services/com.jn.agileway.jwt.JWTService: -------------------------------------------------------------------------------- 1 | com.jn.agileway.jwt.DefaultJWTService -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-plugin-nimbusds/src/main/resources/META-INF/services/com.jn.agileway.jwt.jwe.JWEPlugin: -------------------------------------------------------------------------------- 1 | com.jn.agileway.jwt.plugin.nimbusds.JoseJWEPlugin -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-plugin-nimbusds/src/test/java/com/jn/agileway/jwt/tests/nacos_jwt/NacosJwtPayload.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt.tests.nacos_jwt; 2 | 3 | 4 | import com.jn.easyjson.core.util.JSONs; 5 | 6 | public class NacosJwtPayload { 7 | 8 | private String sub; 9 | 10 | private long exp = System.currentTimeMillis() / 1000L; 11 | 12 | public String getSub() { 13 | return sub; 14 | } 15 | 16 | public void setSub(String sub) { 17 | this.sub = sub; 18 | } 19 | 20 | public long getExp() { 21 | return exp; 22 | } 23 | 24 | public void setExp(long exp) { 25 | this.exp = exp; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return JSONs.toJson(this); 31 | } 32 | } -------------------------------------------------------------------------------- /agileway-jwt/agileway-jwt-plugin-nimbusds/src/test/java/com/jn/agileway/jwt/tests/nacos_jwt/User.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.jwt.tests.nacos_jwt; 2 | 3 | import java.io.Serializable; 4 | 5 | public class User implements Serializable { 6 | 7 | private static final long serialVersionUID = -1L; 8 | 9 | /** 10 | * Unique string representing user. 11 | */ 12 | private String userName; 13 | 14 | public String getUserName() { 15 | return userName; 16 | } 17 | 18 | public void setUserName(String userName) { 19 | this.userName = userName; 20 | } 21 | } -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.bes2008.solution.agileway.metrics 7 | agileway-metrics 8 | 5.0.4 9 | 10 | 4.0.0 11 | 12 | agileway-metrics-core 13 | ${project.groupId}:${project.artifactId}:${project.version} 14 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/Meter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core; 2 | 3 | /** 4 | * An interface to indicate that a class is a metric. 5 | * 6 | * @since 4.1.0 7 | */ 8 | public interface Meter { 9 | 10 | /** 11 | * Return the last update time in milliseconds 12 | * 13 | * @return the last updated time in milliseconds 14 | */ 15 | long lastUpdateTime(); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/collector/CollectLevel.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.collector; 2 | 3 | /** 4 | * @since 4.1.0 5 | */ 6 | public enum CollectLevel { 7 | 8 | COMPACT, 9 | NORMAL, 10 | COMPLETE, 11 | CLASSIFIER 12 | } 13 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meter/Counting.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meter; 2 | 3 | /** 4 | * An interface for metric types which have counts. 5 | * 6 | * @since 4.1.0 7 | */ 8 | interface Counting { 9 | /** 10 | * Returns the current count. 11 | * 12 | * @return the current count 13 | */ 14 | long getCount(); 15 | } 16 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meter/Metered.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meter; 2 | 3 | /** 4 | * A meter metric which measures mean throughput and one-, five-, and fifteen-minute 5 | * exponentially-weighted moving average throughput. 6 | * 一种用于度量一段时间内吞吐率的计量器。例如,一分钟内,五分钟内,十五分钟内的qps指标, 7 | * 这段时间内的吞吐率通过指数加权的方式计算移动平均得出。 8 | * 9 | * @since 4.1.0 10 | */ 11 | public interface Metered extends Timed { 12 | 13 | /** 14 | * Mark the occurrence of an event. 15 | * 标记一次事件 16 | */ 17 | void mark(); 18 | 19 | /** 20 | * Mark the occurrence of a given number of events. 21 | * 标记n次事件 22 | * 23 | * @param n the number of events 24 | */ 25 | void mark(long n); 26 | } 27 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meter/Sampling.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meter; 2 | 3 | import com.jn.agileway.metrics.core.snapshot.Snapshot; 4 | 5 | /** 6 | * An object which samples values. 7 | * @since 4.1.0 8 | */ 9 | interface Sampling { 10 | /** 11 | * Returns a snapshot of the values. 12 | * 13 | * @return a snapshot of the values 14 | */ 15 | Snapshot getSnapshot(); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meter/impl/Bucket.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meter.impl; 2 | 3 | 4 | import java.util.concurrent.atomic.LongAdder; 5 | 6 | /** 7 | * The abstraction of a bucket for collecting statistics 8 | * 9 | * @since 4.1.0 10 | */ 11 | class Bucket { 12 | 13 | /** 14 | * The timestamp of this bucket 15 | */ 16 | long timestamp = -1L; 17 | 18 | /** 19 | * The counter for the bucket, can be updated concurrently 20 | */ 21 | LongAdder count = new LongAdder(); 22 | } 23 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meter/impl/PersistentGauge.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meter.impl; 2 | 3 | import com.jn.agileway.metrics.core.meter.Gauge; 4 | 5 | /** 6 | * A subclass of {@link Gauge} which should be persistent. 7 | * A gauge that is never invalidated. 8 | * 9 | * 10 | * @since 4.1.0 11 | */ 12 | public abstract class PersistentGauge implements Gauge { 13 | 14 | /** 15 | * This gauge is always available, and be updated constantly. 16 | */ 17 | @Override 18 | public long lastUpdateTime() { 19 | return System.currentTimeMillis(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meterset/DynamicMetricMeterSet.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meterset; 2 | 3 | import com.jn.agileway.metrics.core.Meter; 4 | import com.jn.agileway.metrics.core.Metric; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * A dynamic metric set. 10 | * The metrics inside will change dynamically. 11 | * 12 | * @since 4.1.0 13 | */ 14 | public interface DynamicMetricMeterSet extends Meter { 15 | 16 | /** 17 | * A map of metric names to metrics. 18 | * The metrics inside will change dynamically. 19 | * So DO NOT register them at first time. 20 | * 21 | * @return the dynamically changing metrics 22 | */ 23 | Map getDynamicMetrics(); 24 | } 25 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meterset/MetricMeterFactoryBinder.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meterset; 2 | 3 | /** 4 | * @since 4.1.0 5 | */ 6 | public class MetricMeterFactoryBinder { 7 | 8 | private static final MetricMeterFactoryBinder instance = new MetricMeterFactoryBinder(); 9 | 10 | private MetricMeterFactory factory; 11 | 12 | private MetricMeterFactoryBinder() { 13 | factory = new DefaultMetricFactory(); 14 | } 15 | 16 | public static MetricMeterFactoryBinder getSingleton() { 17 | return instance; 18 | } 19 | 20 | public MetricMeterFactory getMetricFactory() { 21 | return factory; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/meterset/MetricMeterSet.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.meterset; 2 | 3 | import com.jn.agileway.metrics.core.Meter; 4 | import com.jn.agileway.metrics.core.Metric; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * A set of named metrics. 10 | * 11 | * @see MetricMeterRegistry#registerAll(MetricMeterSet) 12 | * 13 | * @since 4.1.0 14 | */ 15 | public interface MetricMeterSet { 16 | /** 17 | * A map of metric names to metrics. 18 | * 19 | * @return the metrics 20 | */ 21 | Map getMetricMeters(); 22 | } 23 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/noop/NoopClusterHistogram.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.noop; 2 | 3 | import com.jn.agileway.metrics.core.meter.impl.ClusterHistogram; 4 | import com.jn.langx.util.Emptys; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * @since 4.1.0 10 | */ 11 | public class NoopClusterHistogram extends ClusterHistogram { 12 | public static final NoopClusterHistogram NOOP_CLUSTER_HISTOGRAM = new NoopClusterHistogram(); 13 | @Override 14 | public void update(long value) { 15 | 16 | } 17 | 18 | @Override 19 | public Map> getBucketValues(long startTime) { 20 | return Emptys.EMPTY_TREE_MAP; 21 | } 22 | 23 | @Override 24 | public long lastUpdateTime() { 25 | return 0; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/noop/NoopCounter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.noop; 2 | 3 | import com.jn.agileway.metrics.core.meter.Counter; 4 | 5 | /** 6 | * @since 4.1.0 7 | */ 8 | public class NoopCounter implements Counter { 9 | public static final NoopCounter NOOP_COUNTER = new NoopCounter(); 10 | 11 | @Override 12 | public void inc() { 13 | } 14 | 15 | @Override 16 | public void inc(long n) { 17 | } 18 | 19 | @Override 20 | public void dec() { 21 | } 22 | 23 | @Override 24 | public void dec(long n) { 25 | } 26 | 27 | @Override 28 | public long getCount() { 29 | return 0; 30 | } 31 | 32 | @Override 33 | public long lastUpdateTime() { 34 | return 0; 35 | } 36 | }; -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/predicate/FixedPredicate.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.predicate; 2 | 3 | import com.jn.agileway.metrics.core.Meter; 4 | import com.jn.agileway.metrics.core.Metric; 5 | 6 | /** 7 | * @since 4.1.0 8 | */ 9 | public class FixedPredicate implements MetricMeterPredicate { 10 | private final boolean value; 11 | public FixedPredicate(boolean value){ 12 | this.value = value; 13 | } 14 | public static final FixedPredicate TRUE = new FixedPredicate(true); 15 | public static final FixedPredicate FALSE = new FixedPredicate(false); 16 | @Override 17 | public boolean test(Metric name, Meter metric) { 18 | return this.value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/predicate/MetricMeterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.predicate; 2 | 3 | 4 | import com.jn.agileway.metrics.core.Meter; 5 | import com.jn.agileway.metrics.core.Metric; 6 | import com.jn.langx.util.function.Predicate2; 7 | 8 | /** 9 | * A filter used to determine whether a metric should be reported, among other things or not . 10 | * 11 | * @since 4.1.0 12 | */ 13 | public interface MetricMeterPredicate extends Predicate2 { 14 | 15 | 16 | /** 17 | * Returns {@code true} if the metric matches the filter; {@code false} otherwise. 18 | * 19 | * @param name the metric name 20 | * @param metric the metric 21 | * @return {@code true} if the metric matches the filter 22 | */ 23 | boolean test(Metric name, Meter metric); 24 | } 25 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/predicate/TrueMetricMeterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.predicate; 2 | 3 | import com.jn.agileway.metrics.core.Meter; 4 | import com.jn.agileway.metrics.core.Metric; 5 | 6 | public class TrueMetricMeterPredicate implements MetricMeterPredicate { 7 | @Override 8 | public boolean test(Metric name, Meter metric) { 9 | return true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/reporter/MetricOutput.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.reporter; 2 | 3 | import com.jn.agileway.metrics.core.meterset.MetricMeterRegistry; 4 | 5 | public interface MetricOutput { 6 | void write(MetricMeterRegistry registry); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/reporter/Reporter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.reporter; 2 | 3 | import java.io.Closeable; 4 | 5 | /** 6 | * @since 4.1.0 7 | */ 8 | public interface Reporter extends Closeable { 9 | void report(); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/snapshot/Reservoir.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.snapshot; 2 | 3 | 4 | /** 5 | * A statistically representative reservoir of a data stream. 6 | * 7 | * @since 4.1.0 8 | */ 9 | public interface Reservoir { 10 | /** 11 | * Returns the number of values recorded. 12 | * 13 | * @return the number of values recorded 14 | */ 15 | int size(); 16 | 17 | /** 18 | * Adds a new recorded value to the reservoir. 19 | * 20 | * @param value a new recorded value 21 | */ 22 | void update(long value); 23 | 24 | /** 25 | * Returns a snapshot of the reservoir's values. 26 | * 27 | * @return a snapshot of the reservoir's values 28 | */ 29 | Snapshot getSnapshot(); 30 | } 31 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/snapshot/ReservoirType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.snapshot; 2 | 3 | /** 4 | * An enum of various reservoir type 5 | * 6 | * @since 4.1.0 7 | */ 8 | public enum ReservoirType { 9 | 10 | /** 11 | * The exponentially decaying reservoir 12 | */ 13 | EXPONENTIALLY_DECAYING, 14 | /** 15 | * The sliding time window reservoir 16 | */ 17 | SLIDING_TIME_WINDOW, 18 | /** 19 | * The sliding window reservoir 20 | */ 21 | SLIDING_WINDOW, 22 | /** 23 | * The uniform reservoir 24 | */ 25 | UNIFORM, 26 | /** 27 | * The bucket reservoir 28 | */ 29 | BUCKET 30 | 31 | } 32 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-core/src/main/java/com/jn/agileway/metrics/core/snapshot/ReservoirTypeBuilder.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.core.snapshot; 2 | 3 | import com.jn.agileway.metrics.core.Meter; 4 | import com.jn.agileway.metrics.core.meterset.MetricMeterBuilder; 5 | import com.jn.agileway.metrics.core.Metric; 6 | 7 | /** 8 | * @since 4.1.0 9 | */ 10 | public interface ReservoirTypeBuilder extends MetricMeterBuilder { 11 | 12 | /** 13 | * Create a instance with given reservoir type 14 | * 15 | * @param name the name of the metric 16 | * @param type the type of reservoir type specified in {@link ReservoirType} 17 | * @return a metric implementation 18 | */ 19 | T newMetric(Metric name, ReservoirType type); 20 | 21 | @Override 22 | MetricMeterBuilder newBuilder(); 23 | } 24 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-supports-csv/src/main/java/com/jn/agileway/metrics/supports/csv/CsvFileProvider.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.supports.csv; 2 | 3 | import com.jn.agileway.metrics.core.Metric; 4 | 5 | import java.io.File; 6 | 7 | /** 8 | * This interface allows a pluggable implementation of what file names 9 | * the {@link CsvReporter} will write to. 10 | * 11 | * @since 4.1.0 12 | */ 13 | public interface CsvFileProvider { 14 | File getFile(File directory, Metric metricName); 15 | } 16 | -------------------------------------------------------------------------------- /agileway-metrics/agileway-metrics-supports-jdk/src/main/java/com/jn/agileway/metrics/supports/jdk/jmx/ObjectNameFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.metrics.supports.jdk.jmx; 2 | 3 | import com.jn.agileway.metrics.core.Metric; 4 | 5 | import javax.management.ObjectName; 6 | 7 | /** 8 | * @since 4.1.0 9 | */ 10 | public interface ObjectNameFactory { 11 | 12 | ObjectName createName(String type, String domain, Metric name); 13 | } 14 | -------------------------------------------------------------------------------- /agileway-metrics/readme.md: -------------------------------------------------------------------------------- 1 | # dropwizard metrics 2 | 3 | ## 度量类型 4 | 5 | + Gauge:用于提供指标的瞬时值 6 | + Counter:计数器,本质是一个java.util.concurrent.atomic.LongAdder, 用于对指标的值进行加、减计数 7 | + Histogram:直方图数据,代表了一个指标(数据流类的指标)的分布情况(比例情况)。 最小值、最大值、平均值、中位数、p75、p90、p95、p98、p99、p999数据 8 | + Meter:统计系统中某一事件的响应速率,如TPS、QPS。该项指标值直接反应系统当前的处理能力 9 | + Timer:计时器,是Meter和Histogram的结合,可以统计接口请求速率和响应时长。 10 | 11 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/collection/RedisStack.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.collection; 2 | 3 | public class RedisStack { 4 | } 5 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/key/RedisKeyProperties.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.core.key; 2 | 3 | public class RedisKeyProperties { 4 | private String prefix = RedisKeyWrapper.PREFIX_DEFAULT; 5 | private String separation = RedisKeyWrapper.SEPARATOR_DEFAULT; 6 | 7 | public String getPrefix() { 8 | return prefix; 9 | } 10 | 11 | public void setPrefix(String prefix) { 12 | this.prefix = prefix; 13 | } 14 | 15 | public String getSeparation() { 16 | return separation; 17 | } 18 | 19 | public void setSeparation(String separation) { 20 | this.separation = separation; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/RedisLuaScript.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.core.script; 2 | 3 | import com.jn.langx.configuration.Configuration; 4 | import org.springframework.data.redis.core.script.DefaultRedisScript; 5 | 6 | public class RedisLuaScript extends DefaultRedisScript implements Configuration { 7 | private String id; 8 | 9 | @Override 10 | public String getId() { 11 | return id; 12 | } 13 | 14 | @Override 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/RedisLuaScriptRepository.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.core.script; 2 | 3 | import com.jn.langx.configuration.AbstractConfigurationRepository; 4 | import com.jn.langx.configuration.ConfigurationWriter; 5 | import com.jn.langx.configuration.resource.ResourceConfigurationLoader; 6 | 7 | public class RedisLuaScriptRepository extends AbstractConfigurationRepository, ConfigurationWriter> { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/GetAndRemove.lua: -------------------------------------------------------------------------------- 1 | -- @return 2 | local value = redis.call("get", KEYS[1]) 3 | if value then 4 | redis.call("DEL", KEYS[1]) 5 | return value 6 | end 7 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/GetAndUpdateExpireTime.lua: -------------------------------------------------------------------------------- 1 | -- getAndUpdateExpireTime(key, expireMills) 2 | -- eval "return $getAndUpdateExpireTime" 1 $key $expireMills 3 | local value = redis.call("get", KEYS[1]) 4 | if value then 5 | redis.call("PEXPIRE", KEYS[1], ARGV[1]) 6 | return value 7 | end -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/SetIfAbsentWithExpireTime.lua: -------------------------------------------------------------------------------- 1 | -- @usage: SetIfAbsentWithExpireTime([key1], [ttl, value]) 2 | -- @param ttl 3 | -- the ttl expire time (mills) 4 | -- @param value 5 | -- the value of the key1 6 | -- @return boolean 7 | -- @since redis 2.6.0 8 | 9 | local value = redis.call('get', KEYS[1]) 10 | if value == nil then 11 | redis.call('psetex', KEYS[1], ARGV[1], ARGV[2]) 12 | return true 13 | else 14 | return false 15 | end 16 | 17 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/SetValueAndExpire.lua: -------------------------------------------------------------------------------- 1 | -- @return Object 2 | local value = redis.call('get', KEYS[1]) 3 | if value == false then 4 | redis.call('set', KEYS[1], ARGV[1]) 5 | redis.call('expire', KEYS[1], ARGV[2]) 6 | return ARGV[1] 7 | else 8 | redis.call('expire', KEYS[1], ARGV[2]) 9 | return value 10 | end -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/UnlockExclusiveLock.lua: -------------------------------------------------------------------------------- 1 | -- @usage: UnlockExclusiveLock([key] [expectedValue, force]) 2 | -- @param expectedValue {any} 3 | -- the expectedValue value 4 | -- @param force {boolean} 5 | -- whether force unlock or not 6 | -- @return boolean 7 | 8 | local value = redis.call("get", KEYS[1]) 9 | if ARGV[2] then 10 | redis.call("del", KEYS[1]) 11 | return true 12 | else 13 | if value == ARGV[1] then 14 | redis.call("del", KEYS[1]) 15 | return true 16 | else 17 | return false 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/core/script/lua/mGetAndRemove.lua: -------------------------------------------------------------------------------- 1 | -- @return list 2 | local ks = unpack(KEYS[1]) 3 | local values = redis.call("MGET", ks) 4 | redis.call("DEL", ks) 5 | return values 6 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/counter/DistributedCounter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.counter; 2 | 3 | import com.jn.agileway.redis.core.RedisTemplate; 4 | import com.jn.langx.util.struct.counter.Counter; 5 | 6 | public interface DistributedCounter extends Counter { 7 | void clear(); 8 | 9 | RedisTemplate getRedisTemplate(); 10 | 11 | void setRedisTemplate(RedisTemplate redisTemplate); 12 | 13 | String getCounterKey(); 14 | 15 | void setCounterKey(String key); 16 | 17 | String getKey(); 18 | 19 | void setKey(String key); 20 | 21 | @Override 22 | void reset(); 23 | } 24 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/main/java/com/jn/agileway/redis/l2cache/RedisCacheFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.l2cache; 2 | 3 | 4 | import com.jn.langx.Factory; 5 | 6 | public class RedisCacheFactory implements Factory { 7 | @Override 8 | public RedisCache get(RedisCacheContext context) { 9 | RedisCache redisCache = new RedisCache(); 10 | redisCache.setLoader(context.getLoader()); 11 | redisCache.setRedisTemplate(context.getRedisTemplate()); 12 | redisCache.setRemoveListener(context.getRemoveListener()); 13 | redisCache.setKeyWrapper(context.getKeyWrapper()); 14 | return redisCache; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-redis-springdata2/src/test/java/com/jn/agileway/redis/test/core/lock/LockRandomValueTests.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.redis.test.core.lock; 2 | 3 | import com.jn.agileway.redis.locks.LockRandomValueBuilder; 4 | import org.junit.Test; 5 | 6 | public class LockRandomValueTests { 7 | @Test 8 | public void test() { 9 | LockRandomValueBuilder builder = new LockRandomValueBuilder(); 10 | int i = 100; 11 | while (i > 0) { 12 | i--; 13 | System.out.println(builder.build()); 14 | } 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /agileway-shiro-redis-springdata2/src/main/java/com/jn/agileway/shiro/redis/cache/NoopStringKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.shiro.redis.cache; 2 | 3 | public class NoopStringKeyCodec implements StringKeyCodec { 4 | @Override 5 | public String encode(String obj) { 6 | return obj; 7 | } 8 | 9 | @Override 10 | public String decode(String string) { 11 | return string; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-shiro-redis-springdata2/src/main/java/com/jn/agileway/shiro/redis/cache/StringKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.shiro.redis.cache; 2 | 3 | /** 4 | * Redis 里的Key 必然是 String的,如果期望使用的缓存Key不是字符串,则需要自定义编解码 5 | * @param 6 | */ 7 | public interface StringKeyCodec { 8 | String encode(T obj); 9 | T decode(String string); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-shiro-redis-springdata2/src/main/java/com/jn/agileway/shiro/redis/session/SimpleShiroSessionFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.shiro.redis.session; 2 | 3 | import org.apache.shiro.session.Session; 4 | import org.apache.shiro.session.mgt.SessionContext; 5 | import org.apache.shiro.session.mgt.SessionFactory; 6 | 7 | public class SimpleShiroSessionFactory implements SessionFactory { 8 | @Override 9 | public Session createSession(SessionContext ctx) { 10 | if (ctx != null) { 11 | String host = ctx.getHost(); 12 | if (host != null) { 13 | return new SimpleShiroSession(host); 14 | } 15 | } 16 | return new SimpleShiroSession(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /agileway-shiro-redis-springdata2/src/main/java/com/jn/agileway/shiro/redis/session/SpringIdGeneratorAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.shiro.redis.session; 2 | 3 | import com.jn.langx.IdGenerator; 4 | 5 | public class SpringIdGeneratorAdapter implements IdGenerator { 6 | private org.springframework.util.IdGenerator uuidGenerator; 7 | 8 | public SpringIdGeneratorAdapter(org.springframework.util.IdGenerator uuidGenerator) { 9 | this.uuidGenerator = uuidGenerator; 10 | } 11 | 12 | @Override 13 | public String get(E e) { 14 | return get(); 15 | } 16 | 17 | @Override 18 | public String get() { 19 | return uuidGenerator.generateId().toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/spring/converter/JsonEnumSerializer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.spring.converter; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import com.jn.langx.util.enums.Enums; 7 | 8 | import java.io.IOException; 9 | 10 | public class JsonEnumSerializer extends JsonSerializer { 11 | @Override 12 | public void serialize(E e, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { 13 | jsonGenerator.writeString(Enums.getName(e)); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/spring/propertysource/SpringPropertySources.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.spring.propertysource; 2 | 3 | import com.jn.langx.util.Emptys; 4 | import org.springframework.core.env.PropertySources; 5 | 6 | public class SpringPropertySources { 7 | public static Object getProperty(PropertySources ps, String key) { 8 | if (Emptys.isEmpty(key)) { 9 | return null; 10 | } 11 | return ps.get(key); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/spring/utils/SpringVersions.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.spring.utils; 2 | 3 | import com.jn.langx.util.Strings; 4 | import org.springframework.core.SpringVersion; 5 | 6 | public class SpringVersions { 7 | public static String getVersion() { 8 | return SpringVersion.getVersion(); 9 | } 10 | 11 | public static String getComparableVersion() { 12 | String version = getVersion(); 13 | if (Strings.endsWithIgnoreCase(version, ".RELEASE")) { 14 | version = version.substring(0, version.length() - ".RELEASE".length()).toString(); 15 | } 16 | return version; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/springboot/SpringBootVersions.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot; 2 | 3 | import com.jn.langx.util.Strings; 4 | 5 | public class SpringBootVersions { 6 | 7 | public static String getVersion() { 8 | try { 9 | return org.springframework.boot.SpringBootVersion.getVersion(); 10 | }catch (Throwable ex){ 11 | return null; 12 | } 13 | } 14 | 15 | public static int getMajor() { 16 | return getMajor(getVersion()); 17 | } 18 | 19 | public static int getMajor(String springBootVersion) { 20 | String[] segments = Strings.split(springBootVersion, "."); 21 | return Integer.parseInt(segments[0]); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/springboot/appboot/SpringAppAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.appboot; 2 | 3 | import com.jn.agileway.spring.utils.SpringContextHolder; 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class SpringAppAutoConfiguration { 10 | @Bean 11 | @ConditionalOnMissingBean 12 | public SpringContextHolder springContextHolder(){ 13 | return new SpringContextHolder(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/springboot/i18n/error/EnableI18ErrorMessageHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.i18n.error; 2 | 3 | import org.springframework.context.annotation.Import; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Import({I18nErrorMessageHandlerConfiguration.class}) 13 | public @interface EnableI18ErrorMessageHandler { 14 | } 15 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/springboot/jdbc/JdbcDataSourceFactoryAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.jdbc; 2 | 3 | public class JdbcDataSourceFactoryAutoConfiguration { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /agileway-spring/src/main/java/com/jn/agileway/springboot/json/JsonConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.json; 2 | 3 | import com.jn.easyjson.core.JSONFactory; 4 | import com.jn.easyjson.core.factory.JsonFactorys; 5 | import com.jn.easyjson.core.factory.JsonScope; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | @ConditionalOnMissingBean(JSONFactory.class) 12 | public class JsonConfiguration { 13 | @Bean 14 | @ConditionalOnMissingBean({JSONFactory.class}) 15 | public JSONFactory jsonFactory() { 16 | return JsonFactorys.getJSONFactory(JsonScope.SINGLETON); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /agileway-spring/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.jn.agileway.springboot.appboot.SpringAppAutoConfiguration,\ 3 | com.jn.agileway.springboot.json.JsonConfiguration,\ 4 | com.jn.agileway.springboot.redis.RedisLuaScriptRepositoryAutoConfiguration,\ 5 | com.jn.agileway.springboot.redis.RedisGlobalTemplateAutoConfiguration,\ 6 | com.jn.agileway.springboot.httpclient.HttpClientAutoConfiguration,\ 7 | com.jn.agileway.springboot.vfs.ArtifactRepositoryConfiguration -------------------------------------------------------------------------------- /agileway-spring/src/main/resources/META-INF/spring.provides: -------------------------------------------------------------------------------- 1 | spring-boot-starter-data-redis -------------------------------------------------------------------------------- /agileway-spring/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | com.jn.agileway.springboot.appboot.SpringAppAutoConfiguration 2 | com.jn.agileway.springboot.json.JsonConfiguration 3 | com.jn.agileway.springboot.redis.RedisLuaScriptRepositoryAutoConfiguration 4 | com.jn.agileway.springboot.redis.RedisGlobalTemplateAutoConfiguration 5 | com.jn.agileway.springboot.httpclient.HttpClientAutoConfiguration 6 | com.jn.agileway.springboot.vfs.ArtifactRepositoryConfiguration -------------------------------------------------------------------------------- /agileway-springboot1_2-web/src/main/java/com/jn/agileway/spring/web/rest/ResponseEntitys.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.spring.web.rest; 2 | 3 | import com.jn.langx.annotation.NonNull; 4 | import com.jn.langx.http.rest.RestRespBody; 5 | import com.jn.langx.util.Preconditions; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.ResponseEntity; 8 | 9 | public class ResponseEntitys { 10 | public static ResponseEntity fromRestRespBody(@NonNull RestRespBody restRespBody){ 11 | Preconditions.checkNotNull(restRespBody); 12 | return new ResponseEntity(restRespBody.getData(), HttpStatus.valueOf(restRespBody.getStatusCode())); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agileway-springboot1_2-web/src/main/java/com/jn/agileway/springboot/web/filter/EnableAgilewayWebFilters.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.web.filter; 2 | 3 | import org.springframework.context.annotation.Import; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * 用于启动全局的 Filters 12 | */ 13 | @Target(ElementType.TYPE) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Import({AgilewayBasicFiltersConfiguration.class}) 16 | public @interface EnableAgilewayWebFilters { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /agileway-springboot1_2-web/src/main/java/com/jn/agileway/springboot/web/rest/EnableGlobalRestHandlers.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.web.rest; 2 | 3 | import com.jn.agileway.springboot.i18n.error.EnableI18ErrorMessageHandler; 4 | import com.jn.agileway.springboot.web.filter.EnableAgilewayWebFilters; 5 | import org.springframework.context.annotation.Import; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * 用于启动全局的 Rest handler 处理器 14 | */ 15 | @Target(ElementType.TYPE) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Import({GlobalRestHandlersConfiguration.class}) 18 | @EnableAgilewayWebFilters 19 | @EnableI18ErrorMessageHandler 20 | public @interface EnableGlobalRestHandlers { 21 | } 22 | -------------------------------------------------------------------------------- /agileway-springboot1_2-web/src/main/java/com/jn/agileway/springboot/web/rest/SpringBuiltinExceptionHandlerAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.web.rest; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | /** 7 | * 由于 @ComponentScan 会冲突,所以在spring boot starter里,一般不会采用 @ComponentScan, 8 | * 以此来避免出现灵异问题(找不到期望的Bean) 9 | */ 10 | @Configuration 11 | @ComponentScan("com.jn.agileway.springboot.web.rest.exceptionhandler") 12 | public class SpringBuiltinExceptionHandlerAutoConfiguration { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /agileway-springboot3-web/src/main/java/com/jn/agileway/springboot/web/package-info.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.springboot.web; -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-ganymedssh2/src/main/java/com/jn/agileway/ssh/client/impl/ganymedssh2/Ssh2ConnectionConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.ganymedssh2; 2 | 3 | import com.jn.agileway.ssh.client.AbstractSshConnectionConfig; 4 | 5 | public class Ssh2ConnectionConfig extends AbstractSshConnectionConfig { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-ganymedssh2/src/main/java/com/jn/agileway/ssh/client/impl/ganymedssh2/readme.md: -------------------------------------------------------------------------------- 1 | Ganymed-ssh2 已不再维护,由 trilead-ssh2 来继续维护。如果要使用,请使用 trilead-ssh2 。 -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-ganymedssh2/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.ganymedssh2.Ssh2ConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-j2ssh/src/main/java/com/jn/agileway/ssh/client/impl/j2ssh/J2sshConnectionConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.j2ssh; 2 | 3 | import com.jn.agileway.ssh.client.AbstractSshConnectionConfig; 4 | 5 | public class J2sshConnectionConfig extends AbstractSshConnectionConfig { 6 | } 7 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-j2ssh/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.j2ssh.J2sshConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-jsch/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.jsch.JschConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/java/com/jn/agileway/ssh/client/impl/sshj/SshjConnectionConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.sshj; 2 | 3 | import com.jn.agileway.ssh.client.AbstractSshConnectionConfig; 4 | 5 | public class SshjConnectionConfig extends AbstractSshConnectionConfig { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/java/com/jn/agileway/ssh/client/impl/sshj/transport/hostkey/codec/Ecdsa256PublicKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec; 2 | 3 | 4 | public class Ecdsa256PublicKeyCodec extends EcdsaXPublicKeyCodec { 5 | public Ecdsa256PublicKeyCodec() { 6 | setName("ecdsa-sha2-nistp256"); 7 | } 8 | 9 | @Override 10 | protected int getFieldSize() { 11 | return 256; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/java/com/jn/agileway/ssh/client/impl/sshj/transport/hostkey/codec/Ecdsa384PublicKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec; 2 | 3 | 4 | public class Ecdsa384PublicKeyCodec extends EcdsaXPublicKeyCodec { 5 | public Ecdsa384PublicKeyCodec() { 6 | setName("ecdsa-sha2-nistp384"); 7 | } 8 | 9 | @Override 10 | protected int getFieldSize() { 11 | return 384; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/java/com/jn/agileway/ssh/client/impl/sshj/transport/hostkey/codec/Ecdsa512PublicKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec; 2 | 3 | public class Ecdsa512PublicKeyCodec extends EcdsaXPublicKeyCodec { 4 | public Ecdsa512PublicKeyCodec() { 5 | setName("ecdsa-sha2-nistp512"); 6 | } 7 | 8 | @Override 9 | protected int getFieldSize() { 10 | return 512; 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.sshj.SshjConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-sshj/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.transport.hostkey.codec.PublicKeyCodec: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec.Ecdsa256PublicKeyCodec 2 | com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec.Ecdsa384PublicKeyCodec 3 | com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec.Ecdsa512PublicKeyCodec 4 | com.jn.agileway.ssh.client.impl.sshj.transport.hostkey.codec.Eddsa25519PublicKeyCodec -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-synergy/src/main/java/com/jn/agileway/ssh/client/impl/synergy/SynergyConnectionConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.synergy; 2 | 3 | import com.jn.agileway.ssh.client.AbstractSshConnectionConfig; 4 | 5 | public class SynergyConnectionConfig extends AbstractSshConnectionConfig { 6 | } 7 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-synergy/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.synergy.SynergyConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-tests/src/test/java/com/jn/agileway/ssh/test/BaseSshTests.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.test; 2 | 3 | public class BaseSshTests { 4 | protected String user= "bes"; 5 | protected String password= "password"; 6 | protected String host = "192.168.137.130"; 7 | protected int sshPort = 22; 8 | } 9 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-tests/src/test/java/com/jn/agileway/ssh/test/sftp/FileModeTests.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.test.sftp; 2 | 3 | import com.jn.agileway.ssh.client.sftp.attrs.FileMode; 4 | import com.jn.agileway.ssh.client.sftp.attrs.FileType; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | public class FileModeTests { 9 | @Test 10 | public void test() { 11 | test0(FileType.REGULAR, 0644); 12 | test0(FileType.REGULAR, 0775); 13 | } 14 | 15 | void test0(FileType fileType, int permissions) { 16 | FileMode mode = FileMode.createFileMode(fileType, permissions); 17 | Assert.assertEquals(fileType, mode.getType()); 18 | Assert.assertEquals(permissions, mode.getPermissionsMask()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-tests/src/test/resources/known_hosts_test: -------------------------------------------------------------------------------- 1 | github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== 2 | github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg= 3 | github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl 4 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-tests/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | org.slf4j.simpleLogger.defaultLogLevel=debug 2 | org.slf4j.simpleLogger.log.net.schmizz=info -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-trileadssh2/src/main/java/com/jn/agileway/ssh/client/impl/trileadssh2/Ssh2ConnectionConfig.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.impl.trileadssh2; 2 | 3 | import com.jn.agileway.ssh.client.AbstractSshConnectionConfig; 4 | 5 | public class Ssh2ConnectionConfig extends AbstractSshConnectionConfig { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient-trileadssh2/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.SshConnectionFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.impl.trileadssh2.Ssh2ConnectionFactory -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/SshConnectionFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client; 2 | 3 | import com.jn.langx.Factory; 4 | import com.jn.langx.Named; 5 | 6 | public interface SshConnectionFactory extends Factory, Named { 7 | /** 8 | * 获取一个认证通过的,可以直接使用的Connection 9 | * 10 | * @param sshConfig 11 | */ 12 | @Override 13 | SshConnection get(CONF sshConfig); 14 | 15 | CONF newConfig(); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/SshException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client; 2 | 3 | public class SshException extends RuntimeException { 4 | public SshException() { 5 | super(); 6 | } 7 | 8 | public SshException(String message) { 9 | super(message); 10 | } 11 | 12 | public SshException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public SshException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/channel/Channel.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.channel; 2 | 3 | import com.jn.agileway.ssh.client.SshException; 4 | 5 | import java.io.Closeable; 6 | import java.io.InputStream; 7 | import java.io.OutputStream; 8 | 9 | public interface Channel extends Closeable { 10 | ChannelType getType(); 11 | 12 | /** 13 | * 远程机器输出的内容,会作为这里的标准输入 14 | * 15 | * @return 16 | */ 17 | InputStream getInputStream() throws SshException; 18 | 19 | /** 20 | * 获取一个输出到远程机器的流 21 | * 22 | * @return 23 | */ 24 | OutputStream getOutputStream() throws SshException; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/channel/ChannelState.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.channel; 2 | 3 | public class ChannelState { 4 | } 5 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/channel/ChannelType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.channel; 2 | 3 | public enum ChannelType { 4 | EXEC, 5 | SHELL, 6 | SUBSYSTEM, 7 | X11; 8 | } 9 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/channel/ShellExecutor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.channel; 2 | 3 | import com.jn.langx.util.struct.Holder; 4 | 5 | public interface ShellExecutor { 6 | SessionedChannel getChannel(); 7 | /** 8 | * @param statementBlock 要执行的shell 语句块 9 | * @param moreFlagLine 还有更多输出时的标志行 10 | * @param responseTime 从stdout, stderr读取结果时,最大尝试读取不到数据时间 11 | * @param maxAttempts 从stdout, stderr读取结果时,最大尝试次数 12 | * @param stdout 执行成功时的 13 | * @param stderr 执行失败时的错误内容 14 | * @return 执行是否执行成功 15 | */ 16 | boolean execute(String statementBlock, String moreFlagLine, String more, long responseTime, int maxAttempts, Holder stdout, Holder stderr); 17 | } 18 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/supports/command/executor/SshCommandLineExecutor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.supports.command.executor; 2 | 3 | import com.jn.agileway.ssh.client.SshConnection; 4 | import com.jn.agileway.cmd.DefaultCommandLineExecutor; 5 | import com.jn.langx.util.Objs; 6 | 7 | import java.io.File; 8 | 9 | public class SshCommandLineExecutor extends DefaultCommandLineExecutor { 10 | 11 | public SshCommandLineExecutor(SshConnection connection) { 12 | this(null, connection); 13 | } 14 | 15 | public SshCommandLineExecutor(File workingDirectory, SshConnection connection) { 16 | setWorkingDirectory(Objs.useValueIfNull(workingDirectory, new File("~"))); 17 | setLauncher(new SshCommandLineLauncher(connection)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/IllegalSshKeyException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey; 2 | 3 | import com.jn.agileway.ssh.client.SshException; 4 | 5 | public class IllegalSshKeyException extends SshException { 6 | public IllegalSshKeyException() { 7 | } 8 | 9 | public IllegalSshKeyException(String message) { 10 | super(message); 11 | } 12 | 13 | public IllegalSshKeyException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | 17 | public IllegalSshKeyException(Throwable cause) { 18 | super(cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/UnsupportedHostsKeyTypeException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey; 2 | 3 | import com.jn.agileway.ssh.client.SshException; 4 | 5 | public class UnsupportedHostsKeyTypeException extends SshException { 6 | public UnsupportedHostsKeyTypeException() { 7 | super(); 8 | } 9 | 10 | public UnsupportedHostsKeyTypeException(String message) { 11 | super(message); 12 | } 13 | 14 | public UnsupportedHostsKeyTypeException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public UnsupportedHostsKeyTypeException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/UnsupportedKeyException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey; 2 | 3 | import com.jn.agileway.ssh.client.SshException; 4 | 5 | public class UnsupportedKeyException extends SshException { 6 | public UnsupportedKeyException() { 7 | super(); 8 | } 9 | 10 | public UnsupportedKeyException(String message) { 11 | super(message); 12 | } 13 | 14 | public UnsupportedKeyException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public UnsupportedKeyException(Throwable cause) { 19 | super(cause); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/codec/AbstractPublicKeyCodec.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.codec; 2 | 3 | import com.jn.langx.AbstractNameable; 4 | 5 | import java.security.PublicKey; 6 | 7 | public abstract class AbstractPublicKeyCodec extends AbstractNameable implements PublicKeyCodec { 8 | @Override 9 | public final String get(PublicKey publicKey) { 10 | if (publicKey == null) { 11 | return null; 12 | } 13 | String algorithm =publicKey.getAlgorithm(); 14 | if (isPublicKeyMatched(publicKey, algorithm)) { 15 | return getName(); 16 | } 17 | 18 | return null; 19 | } 20 | 21 | protected abstract boolean isPublicKeyMatched(PublicKey publicKey, String algorithm); 22 | } 23 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/keytype/HostKeyTypeExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.keytype; 2 | 3 | import com.jn.langx.util.function.Supplier; 4 | 5 | public interface HostKeyTypeExtractor extends Supplier { 6 | public static final String[] SUPPORTED_KEY_TYPES = { 7 | "ssh-dss", 8 | "ssh-rsa", 9 | "ecdsa-sha2-nistp256", 10 | "ecdsa-sha2-nistp384", 11 | "ecdsa-sha2-nistp521", 12 | "ssh-ed25519", 13 | "ssh-ed25519" 14 | }; 15 | 16 | @Override 17 | String get(T publicKey); 18 | } 19 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/keytype/KeyBufferHostKeyTypeExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.keytype; 2 | 3 | import com.jn.agileway.ssh.client.utils.Buffer; 4 | 5 | public class KeyBufferHostKeyTypeExtractor implements HostKeyTypeExtractor { 6 | public static final KeyBufferHostKeyTypeExtractor INSTANCE = new KeyBufferHostKeyTypeExtractor(); 7 | 8 | private KeyBufferHostKeyTypeExtractor() { 9 | } 10 | 11 | @Override 12 | public String get(Buffer buffer) { 13 | final String keyType = buffer.readString(); 14 | return keyType; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/keytype/KeyBytesHostKeyTypeExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.keytype; 2 | 3 | import com.jn.agileway.ssh.client.utils.Buffer; 4 | 5 | public class KeyBytesHostKeyTypeExtractor implements HostKeyTypeExtractor { 6 | public static final KeyBytesHostKeyTypeExtractor INSTANCE = new KeyBytesHostKeyTypeExtractor(); 7 | 8 | private KeyBytesHostKeyTypeExtractor() { 9 | } 10 | 11 | @Override 12 | public String get(byte[] publicKey) { 13 | return KeyBufferHostKeyTypeExtractor.INSTANCE.get(new Buffer.PlainBuffer(publicKey)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/keytype/PublicKeyHostKeyTypeExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.keytype; 2 | 3 | import java.security.PublicKey; 4 | 5 | public interface PublicKeyHostKeyTypeExtractor extends HostKeyTypeExtractor { 6 | @Override 7 | String get(PublicKey publicKey); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/java/com/jn/agileway/ssh/client/transport/hostkey/knownhosts/CommentHostsKeyEntry.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.ssh.client.transport.hostkey.knownhosts; 2 | 3 | public class CommentHostsKeyEntry extends AbstractHostsKeyEntry { 4 | private final String comment; 5 | 6 | public CommentHostsKeyEntry(String comment) { 7 | this.comment = comment; 8 | } 9 | 10 | @Override 11 | public String getLine() { 12 | return comment; 13 | } 14 | 15 | @Override 16 | protected boolean containsHost(String host) { 17 | return false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/resources/.wiki/img/data_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bes2008/agileway/0e8badd20d40f267796849addb313cbd80947bc1/agileway-ssh/agileway-sshclient/src/main/resources/.wiki/img/data_stream.png -------------------------------------------------------------------------------- /agileway-ssh/agileway-sshclient/src/main/resources/META-INF/services/com.jn.agileway.ssh.client.transport.hostkey.codec.PublicKeyCodec: -------------------------------------------------------------------------------- 1 | com.jn.agileway.ssh.client.transport.hostkey.codec.SshRsaPublicKeyCodec 2 | com.jn.agileway.ssh.client.transport.hostkey.codec.SshDssPublicKeyCodec -------------------------------------------------------------------------------- /agileway-syslog/agileway-syslog-protocol/src/main/java/com/jn/agileway/syslog/protocol/MessageType.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.syslog.protocol; 2 | 3 | public enum MessageType { 4 | /** 5 | * Message type for a message that could not be parsed. 6 | */ 7 | UNKNOWN, 8 | /** 9 | * Message type for a CEF message. 10 | */ 11 | CEF, 12 | /** 13 | * Message type for a rfc 3164 message. 14 | */ 15 | RFC3164, 16 | /** 17 | * Message type for a rfc 5424 message. 18 | */ 19 | RFC5424 20 | } 21 | -------------------------------------------------------------------------------- /agileway-syslog/agileway-syslog-protocol/src/main/java/com/jn/agileway/syslog/protocol/Priority.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.syslog.protocol; 2 | 3 | 4 | import com.jn.langx.util.enums.Enums; 5 | 6 | public class Priority { 7 | private Priority() { 8 | } 9 | 10 | public static int getFacility(int priority) { 11 | return priority >> 3; 12 | } 13 | 14 | public static Severity getSeverity(int priority, int facility) { 15 | return Enums.ofCode(Severity.class,priority - (facility << 3)); 16 | } 17 | 18 | public static int createPriority(int severity, int facility) { 19 | return (facility * 8) + severity; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-syslog/agileway-syslog-protocol/src/main/java/com/jn/agileway/syslog/protocol/StructuredDataFormatter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.syslog.protocol; 2 | 3 | import com.jn.langx.Formatter; 4 | 5 | import java.util.List; 6 | 7 | public interface StructuredDataFormatter extends Formatter,String> { 8 | @Override 9 | String format(List input, Object... args) ; 10 | } 11 | -------------------------------------------------------------------------------- /agileway-syslog/agileway-syslog-protocol/src/main/java/com/jn/agileway/syslog/protocol/SyslogTextGenerator.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.syslog.protocol; 2 | 3 | 4 | import com.jn.langx.util.function.Supplier; 5 | 6 | public interface SyslogTextGenerator extends Supplier { 7 | @Override 8 | String get(SyslogMessage syslogMessage); 9 | 10 | void setDatePattern(String pattern); 11 | } 12 | -------------------------------------------------------------------------------- /agileway-syslog/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.bes2008.solution.agileway 7 | agileway 8 | 5.0.4 9 | 10 | 4.0.0 11 | io.github.bes2008.solution.agileway.syslog 12 | agileway-syslog 13 | ${project.groupId}:${project.artifactId}:${project.version} 14 | pom 15 | 16 | agileway-syslog-protocol 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /agileway-templates/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | agileway 7 | io.github.bes2008.solution.agileway 8 | 5.0.4 9 | 10 | 4.0.0 11 | 12 | agileway-templates 13 | pom 14 | 15 | ${project.groupId}:${project.artifactId}:${project.version} 16 | 17 | 18 | agileway-templates-freemarker 19 | 20 | 21 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/AgilewayVFSManagerBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs; 2 | 3 | import com.jn.agileway.vfs.provider.sftp.SftpFileProvider; 4 | import com.jn.agileway.vfs.utils.VFSUtils; 5 | import org.apache.commons.vfs2.FileSystemManager; 6 | import org.apache.commons.vfs2.VFS; 7 | import org.apache.commons.vfs2.impl.DefaultFileSystemManager; 8 | 9 | public class AgilewayVFSManagerBootstrap { 10 | public static void startup() throws Throwable { 11 | FileSystemManager defaultFSManager = VFS.getManager(); 12 | VFSUtils.addFileProvider((DefaultFileSystemManager) defaultFSManager, new SftpFileProvider(), "sftp"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/FileSystemManagerAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs; 2 | 3 | import org.apache.commons.vfs2.FileSystemManager; 4 | 5 | public interface FileSystemManagerAware { 6 | FileSystemManager getFileSystemManager(); 7 | 8 | void setFileSystemManager(FileSystemManager manager); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/VfsException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs; 2 | 3 | public class VfsException extends RuntimeException { 4 | public VfsException() { 5 | super(); 6 | } 7 | 8 | public VfsException(String message) { 9 | super(message); 10 | } 11 | 12 | public VfsException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public VfsException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/Artifact.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | public interface Artifact extends IGAV { 4 | String getClassifier(); 5 | 6 | void setClassifier(String classifier); 7 | 8 | /** 9 | * 文件扩展名 10 | */ 11 | String getExtension(); 12 | 13 | void setExtension(String extension); 14 | 15 | boolean isSupportSynchronized(); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/ArtifactDigitExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | 4 | import com.jn.agileway.vfs.management.FileDigestExtractor; 5 | 6 | public interface ArtifactDigitExtractor extends FileDigestExtractor { 7 | @Override 8 | String apply(String relativePath, String algorithm); 9 | 10 | String apply(Artifact artifact, String algorithm); 11 | } 12 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/ArtifactFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | 4 | import com.jn.langx.Factory; 5 | 6 | public interface ArtifactFactory extends Factory { 7 | @Override 8 | A get(GAV gav); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/ArtifactManagerAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | public interface ArtifactManagerAware { 4 | void setArtifactManager(ArtifactManager artifactManager); 5 | 6 | ArtifactManager getArtifactManager(); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/ArtifactManagerProperties.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | import com.jn.agileway.vfs.artifact.repository.ArtifactRepositoryProperties; 4 | 5 | import java.util.List; 6 | 7 | public class ArtifactManagerProperties { 8 | private boolean enabled = false; 9 | private List repositories; 10 | 11 | public List getRepositories() { 12 | return repositories; 13 | } 14 | 15 | public void setRepositories(List repositories) { 16 | this.repositories = repositories; 17 | } 18 | 19 | public boolean isEnabled() { 20 | return enabled; 21 | } 22 | 23 | public void setEnabled(boolean enabled) { 24 | this.enabled = enabled; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/IGAV.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | public interface IGAV { 4 | String getGroupId(); 5 | 6 | void setGroupId(String groupId); 7 | 8 | String getArtifactId(); 9 | 10 | void setArtifactId(String artifactId); 11 | 12 | String getVersion(); 13 | 14 | void setVersion(String version); 15 | } 16 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/SimpleArtifactManager.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact; 2 | 3 | import com.jn.agileway.vfs.management.FileDigit; 4 | import org.apache.commons.vfs2.FileObject; 5 | import org.apache.commons.vfs2.FileSystemException; 6 | 7 | import java.util.List; 8 | 9 | public class SimpleArtifactManager extends AbstractArtifactManager { 10 | 11 | @Override 12 | public FileObject getArtifactFile(Artifact artifact) throws FileSystemException { 13 | String localPath = getRepository().getPath(artifact); 14 | return getFileSystemManager().resolveFile(localPath); 15 | } 16 | 17 | @Override 18 | public List getDigits(Artifact artifact) { 19 | return getDigits(this.getRepository(), artifact); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/repository/ArtifactRepository.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact.repository; 2 | 3 | import com.jn.agileway.vfs.artifact.Artifact; 4 | import com.jn.agileway.vfs.management.repository.FileRepository; 5 | 6 | /** 7 | * 代表仓库元数据信息,并可以根据它来计算指定的 artifact的path 8 | *

9 | * ${url}/${basedir}/${artifact} 10 | */ 11 | public interface ArtifactRepository extends FileRepository { 12 | 13 | void setLayout(ArtifactRepositoryLayout layout); 14 | 15 | ArtifactRepositoryLayout getLayout(); 16 | 17 | 18 | String getPath(Artifact artifact); 19 | 20 | String getDigitPath(Artifact artifact, String digit); 21 | } 22 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/repository/ArtifactRepositoryAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact.repository; 2 | 3 | public interface ArtifactRepositoryAware { 4 | ArtifactRepository getRepository(); 5 | 6 | void setRepository(ArtifactRepository repository); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/repository/ArtifactRepositoryFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact.repository; 2 | 3 | import com.jn.langx.registry.Registry; 4 | 5 | public interface ArtifactRepositoryFactory { 6 | void setArtifactRepositoryLayoutRegistry(Registry registry); 7 | 8 | Registry getLayoutRegistry(); 9 | 10 | ArtifactRepository get(ArtifactRepositoryProperties props); 11 | } 12 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/artifact/repository/ArtifactRepositoryLayout.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.artifact.repository; 2 | 3 | import com.jn.agileway.vfs.artifact.Artifact; 4 | import com.jn.agileway.vfs.management.repository.FileRepositoryLayout; 5 | 6 | public interface ArtifactRepositoryLayout extends FileRepositoryLayout { 7 | 8 | @Override 9 | String getFilePath(ArtifactRepository repository, String relativePath); 10 | 11 | @Override 12 | String getFileDigestPath(ArtifactRepository repository, String relativePath, String digest); 13 | 14 | String getPath(ArtifactRepository repository, Artifact artifact); 15 | 16 | String getDigitPath(ArtifactRepository repository, Artifact artifact, String digit); 17 | 18 | String toRelativePath(ArtifactRepository repository, Artifact artifact); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/ExistsFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.agileway.vfs.utils.FileObjects; 4 | import org.apache.commons.vfs2.FileObject; 5 | 6 | public class ExistsFileFilter implements FileObjectFilter { 7 | private boolean exists; 8 | 9 | public ExistsFileFilter() { 10 | this(true); 11 | } 12 | 13 | public ExistsFileFilter(boolean exists) { 14 | this.exists = exists; 15 | } 16 | 17 | @Override 18 | public boolean test(FileObject fileObject) { 19 | return FileObjects.isExists(fileObject) ? exists : !exists; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/FileObjectFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.langx.util.function.Predicate; 4 | import org.apache.commons.vfs2.FileObject; 5 | 6 | public interface FileObjectFilter extends Predicate { 7 | @Override 8 | public boolean test(FileObject fileObject); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/FileTypeFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.agileway.vfs.utils.FileObjects; 4 | import org.apache.commons.vfs2.FileObject; 5 | import org.apache.commons.vfs2.FileType; 6 | 7 | public class FileTypeFilter implements FileObjectFilter{ 8 | private FileType expected; 9 | 10 | public FileTypeFilter(FileType fileType){ 11 | this.expected = fileType; 12 | } 13 | 14 | @Override 15 | public boolean test(FileObject fileObject) { 16 | if(FileObjects.isExists(fileObject)) { 17 | try { 18 | return fileObject.getType() == expected; 19 | }catch (Throwable ex){ 20 | // ignore it 21 | } 22 | } 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/FilenameEndsWithFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.langx.util.collection.Collects; 4 | import com.jn.langx.util.function.predicate.StringEndsWithPredicate; 5 | 6 | import java.util.List; 7 | 8 | public class FilenameEndsWithFileFilter extends FilenamePredicateFilter { 9 | public FilenameEndsWithFileFilter(boolean ignoreCase, String suffix) { 10 | this(ignoreCase, Collects.asList(suffix)); 11 | } 12 | 13 | public FilenameEndsWithFileFilter(boolean ignoreCase, String... suffixes) { 14 | this(ignoreCase, Collects.asList(suffixes)); 15 | } 16 | 17 | public FilenameEndsWithFileFilter(boolean ignoreCase, List suffixes) { 18 | super(new StringEndsWithPredicate(ignoreCase, suffixes)); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/FilenamePredicateFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.langx.util.function.Predicate; 4 | import org.apache.commons.vfs2.FileName; 5 | import org.apache.commons.vfs2.FileObject; 6 | 7 | public class FilenamePredicateFilter implements FileObjectFilter { 8 | private Predicate predicate; 9 | 10 | public FilenamePredicateFilter(Predicate predicate) { 11 | this.predicate = predicate; 12 | } 13 | 14 | @Override 15 | public final boolean test(FileObject fileObject) { 16 | FileName fileName = fileObject.getName(); 17 | String name = fileName.getBaseName(); 18 | return doTest(name); 19 | } 20 | 21 | protected boolean doTest(String filename) { 22 | return predicate.test(filename); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/FilenamePrefixFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import com.jn.langx.util.collection.Collects; 4 | import com.jn.langx.util.function.predicate.StringStartsWithPredicate; 5 | 6 | import java.util.List; 7 | 8 | public class FilenamePrefixFileFilter extends FilenamePredicateFilter { 9 | public FilenamePrefixFileFilter(boolean ignoreCase, String prefix) { 10 | this(ignoreCase, Collects.asList(prefix)); 11 | } 12 | 13 | public FilenamePrefixFileFilter(boolean ignoreCase, String... prefixes) { 14 | this(ignoreCase, Collects.asList(prefixes)); 15 | } 16 | 17 | public FilenamePrefixFileFilter(boolean ignoreCase, List prefixes) { 18 | super(new StringStartsWithPredicate(ignoreCase, prefixes)); 19 | } 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/IsDirectoryFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import org.apache.commons.vfs2.FileType; 4 | 5 | public class IsDirectoryFilter extends FileTypeFilter { 6 | public IsDirectoryFilter() { 7 | super(FileType.FOLDER); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/IsFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import org.apache.commons.vfs2.FileType; 4 | 5 | public class IsFileFilter extends FileTypeFilter{ 6 | public IsFileFilter() { 7 | super(FileType.FILE); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/filter/NotFileFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.filter; 2 | 3 | import org.apache.commons.vfs2.FileObject; 4 | 5 | public class NotFileFilter implements FileObjectFilter { 6 | private FileObjectFilter filter; 7 | 8 | public NotFileFilter(FileObjectFilter filter) { 9 | this.filter = filter; 10 | } 11 | 12 | @Override 13 | public boolean test(FileObject fileObject) { 14 | return !filter.test(fileObject); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/FileDigestExtractor.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management; 2 | 3 | import com.jn.langx.util.function.Function2; 4 | 5 | public interface FileDigestExtractor extends Function2, FileManagerAware { 6 | @Override 7 | String apply(String relativePath, String algorithm); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/FileDigit.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management; 2 | 3 | public class FileDigit { 4 | private String algorithm; 5 | private String digit; 6 | 7 | public FileDigit() { 8 | } 9 | 10 | public FileDigit(String algorithm, String digit) { 11 | setAlgorithm(algorithm); 12 | setDigit(digit); 13 | } 14 | 15 | public String getAlgorithm() { 16 | return algorithm; 17 | } 18 | 19 | public void setAlgorithm(String algorithm) { 20 | this.algorithm = algorithm; 21 | } 22 | 23 | public String getDigit() { 24 | return digit; 25 | } 26 | 27 | public void setDigit(String digit) { 28 | this.digit = digit; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/FileManager.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management; 2 | 3 | import com.jn.agileway.vfs.FileSystemManagerAware; 4 | import com.jn.agileway.vfs.management.repository.FileRepository; 5 | import com.jn.agileway.vfs.management.repository.FileRepositoryAware; 6 | import org.apache.commons.vfs2.FileObject; 7 | 8 | import java.util.List; 9 | 10 | public interface FileManager extends FileSystemManagerAware, FileRepositoryAware { 11 | FileObject getFile(String relativePath); 12 | 13 | /** 14 | * @param relativePath 15 | * @return 16 | */ 17 | List getDigits(String relativePath); 18 | } 19 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/FileManagerAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management; 2 | 3 | public interface FileManagerAware { 4 | M getManager(); 5 | 6 | void setManager(M manager); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/repository/FileRepositoryAware.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management.repository; 2 | 3 | public interface FileRepositoryAware { 4 | void setRepository(R repository); 5 | 6 | R getRepository(); 7 | } 8 | -------------------------------------------------------------------------------- /agileway-vfs/src/main/java/com/jn/agileway/vfs/management/repository/FileRepositoryLayout.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.vfs.management.repository; 2 | 3 | import com.jn.langx.Nameable; 4 | 5 | public interface FileRepositoryLayout extends Nameable { 6 | String getFilePath(R repository, String relativePath); 7 | 8 | String getFileDigestPath(R repository, String relativePath, String digest); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-web-jakarta/src/main/java/com/jn/agileway/web/package-info.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web; -------------------------------------------------------------------------------- /agileway-web-jakarta/src/main/resources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bes2008/agileway/0e8badd20d40f267796849addb313cbd80947bc1/agileway-web-jakarta/src/main/resources/.gitkeep -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/filter/accesslog/AccessLogLevel.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.filter.accesslog; 2 | 3 | public enum AccessLogLevel { 4 | NONE, // 不记录 5 | BASIC, // url, protocol , method 6 | HEADERS, // 在BASIC的基础上包含 请求headers 7 | BODY, // 在 HEADER的基础上,加上 请求体 8 | } 9 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/filter/globalresponse/GlobalFilterRestExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.filter.globalresponse; 2 | 3 | import com.jn.agileway.http.rr.HttpRequest; 4 | import com.jn.agileway.http.rr.HttpResponse; 5 | import com.jn.agileway.web.rest.AbstractGlobalServletRestExceptionHandler; 6 | 7 | 8 | /** 9 | * 在 javax.servlet.Filter 里处理全局异常 10 | */ 11 | public class GlobalFilterRestExceptionHandler extends AbstractGlobalServletRestExceptionHandler { 12 | @Override 13 | protected boolean isSupportedRestAction(HttpRequest request, HttpResponse response, Object action, Exception ex) { 14 | return action == GlobalRestResponseFilter.doFilterMethod; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/filter/readme.md: -------------------------------------------------------------------------------- 1 | ## Filters 说明 2 | 3 | 1. RRFilter 提供对HttpServletRequest, HttpServletResponse 的结对封装,可以在其他地方直接使用 4 | 2. AccessLogFilter 提供访问日志 5 | 3. GlobalResponseFilter 对相应内容做统一处理,封装成RestRespBody 6 | 7 | 建议配置顺序: 8 | RRFilter (-1030) > AccessLogFilter (-1020) > GlobalResponseFilter (-1000) > AllowedMethodsFilter (-990) > CORS (-980) > XssFilter (-970) > SQLInjection (-960) > SetHeaders (-950)> > your custom filter 9 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/prediate/HttpRequestPredicate.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.prediate; 2 | 3 | import com.jn.agileway.http.rr.RR; 4 | import com.jn.langx.util.function.Predicate; 5 | 6 | /** 7 | * 用于进行某种匹配。在HttpRequest匹配过程中,很常见的一种情况是,在多个值中任选一个进行匹配。 8 | *

9 | * 所以对于 HttpRequestPredicate实现中,通常对于存在多值的情况,进行 or 匹配,不存在多值的情况,进行 equals 匹配 10 | * 11 | * @see HttpRequestPredicateGroup 用于对多个Predicate进行 and 操作 12 | */ 13 | public interface HttpRequestPredicate extends Predicate { 14 | @Override 15 | boolean test(RR holder); 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/prediate/HttpRequestPredicateConfigItem.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.prediate; 2 | 3 | import com.jn.langx.text.StringTemplates; 4 | 5 | public class HttpRequestPredicateConfigItem { 6 | private String key; 7 | private String configuration; 8 | 9 | public String getKey() { 10 | return key; 11 | } 12 | 13 | public void setKey(String key) { 14 | this.key = key; 15 | } 16 | 17 | public String getConfiguration() { 18 | return configuration; 19 | } 20 | 21 | public void setConfiguration(String configuration) { 22 | this.configuration = configuration; 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return StringTemplates.formatWithPlaceholder("{}={}", key,configuration); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/prediate/HttpRequestPredicateFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.prediate; 2 | 3 | import com.jn.langx.Factory; 4 | import com.jn.langx.Named; 5 | 6 | public abstract class HttpRequestPredicateFactory

implements Factory, Named { 7 | private String name; 8 | 9 | @Override 10 | public abstract P get(String configuration); 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | public void setName(String name) { 17 | this.name = name; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/prediate/HttpRequestPredicates.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.prediate; 2 | 3 | public class HttpRequestPredicates { 4 | public final static String PREDICATE_CONFIGURATION_ITEM_SEPARATOR = "="; 5 | 6 | public final static String PREDICATE_KEY_PATH = "paths"; 7 | public final static String PREDICATE_KEY_METHOD = "methods"; 8 | public final static String PREDICATE_KEY_HEADER = "header"; 9 | public final static String PREDICATE_KEY_HOSTS = "hosts"; 10 | public final static String PREDICATE_KEY_COOKIE = "cookie"; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/prediate/impl/HostMatchPredicate.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.prediate.impl; 2 | 3 | import com.jn.agileway.web.prediate.HttpRequestPredicate; 4 | import com.jn.agileway.http.rr.RR; 5 | import com.jn.langx.util.pattern.PatternMatcher; 6 | 7 | public class HostMatchPredicate implements HttpRequestPredicate { 8 | private PatternMatcher matcher; 9 | 10 | public PatternMatcher getMatcher() { 11 | return matcher; 12 | } 13 | 14 | public void setMatcher(PatternMatcher matcher) { 15 | this.matcher = matcher; 16 | } 17 | 18 | @Override 19 | public boolean test(RR holder) { 20 | return matcher == null || matcher.matches(holder.getRequest().getRemoteHost()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/request/handler/HttpRequestHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.request.handler; 2 | 3 | import com.jn.agileway.http.rr.RR; 4 | import com.jn.langx.annotation.NonNull; 5 | 6 | public interface HttpRequestHandler { 7 | void handle(@NonNull RR rr); 8 | } 9 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/request/header/HttpResponseHeaderRule.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.request.header; 2 | 3 | import com.jn.agileway.web.prediate.HttpRequestPredicateConfigItems; 4 | 5 | /** 6 | * 提供 满足 predicates 条件的情况下,为 response 设置 header 7 | */ 8 | public class HttpResponseHeaderRule extends HttpRequestPredicateConfigItems { 9 | private String header; 10 | private String value; 11 | 12 | public String getHeader() { 13 | return header; 14 | } 15 | 16 | public void setHeader(String header) { 17 | this.header = header; 18 | } 19 | 20 | public String getValue() { 21 | return value; 22 | } 23 | 24 | public void setValue(String value) { 25 | this.value = value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/request/header/HttpResponseHeaderSetterFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.request.header; 2 | 3 | import com.jn.agileway.web.prediate.HttpRequestPredicateGroup; 4 | import com.jn.agileway.web.prediate.HttpRequestPredicateGroupFactory; 5 | import com.jn.langx.Factory; 6 | 7 | public class HttpResponseHeaderSetterFactory implements Factory { 8 | @Override 9 | public HttpResponseHeaderSetter get(HttpResponseHeaderRule rule) { 10 | HttpResponseHeaderSetter setter = new HttpResponseHeaderSetter(); 11 | HttpRequestPredicateGroup predicates = new HttpRequestPredicateGroupFactory().get(rule); 12 | setter.setRule(rule); 13 | setter.setPredicates(predicates); 14 | return setter; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/request/header/SetResponseHeaderProperties.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.request.header; 2 | 3 | import java.util.List; 4 | 5 | public class SetResponseHeaderProperties { 6 | private List rules; 7 | 8 | public List getRules() { 9 | return rules; 10 | } 11 | 12 | public void setRules(List rules) { 13 | this.rules = rules; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/request/parse/SkipResult.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.request.parse; 2 | 3 | public enum SkipResult { 4 | FOUND, 5 | NOT_FOUND, 6 | EOF 7 | } 8 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/AbstractWAFHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security; 2 | 3 | import com.jn.langx.lifecycle.AbstractInitializable; 4 | import com.jn.langx.util.logging.Loggers; 5 | import org.slf4j.Logger; 6 | 7 | public abstract class AbstractWAFHandler extends AbstractInitializable implements WAFHandler { 8 | private final Logger logger = Loggers.getLogger(this.getClass()); 9 | 10 | @Override 11 | public String apply(String value) { 12 | if (isAttack(value)) { 13 | logger.warn("maybe {} attack: {}", getAttackName(), value); 14 | return ""; 15 | } 16 | return value; 17 | } 18 | 19 | protected abstract boolean isAttack(String value); 20 | } 21 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/AccessDeniedException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security; 2 | 3 | public class AccessDeniedException extends SecurityException { 4 | public AccessDeniedException(String msg) { 5 | super(msg); 6 | } 7 | 8 | public AccessDeniedException(String msg, Throwable cause) { 9 | super(msg, cause); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/WAFHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security; 2 | 3 | import com.jn.langx.lifecycle.Initializable; 4 | import com.jn.langx.util.function.Function; 5 | 6 | public interface WAFHandler extends Function, Initializable { 7 | @Override 8 | String apply(String value); 9 | 10 | String getAttackName(); 11 | 12 | /** 13 | * 是否处理请求头 14 | * 15 | * @return 16 | */ 17 | boolean requestHeaderAware(); 18 | } 19 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/sqlinjection/SqlInjectionProperties.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security.sqlinjection; 2 | 3 | import com.jn.agileway.web.prediate.HttpRequestPredicateConfigItems; 4 | 5 | public class SqlInjectionProperties extends HttpRequestPredicateConfigItems { 6 | private boolean enabled = false; 7 | 8 | public boolean isEnabled() { 9 | return enabled; 10 | } 11 | 12 | public void setEnabled(boolean enabled) { 13 | this.enabled = enabled; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/sqlinjection/SqlWAFHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security.sqlinjection; 2 | 3 | import com.jn.agileway.web.security.AbstractWAFHandler; 4 | 5 | /** 6 | * 替换掉特殊字符 7 | */ 8 | public abstract class SqlWAFHandler extends AbstractWAFHandler { 9 | 10 | @Override 11 | public abstract String apply(String value); 12 | 13 | @Override 14 | public String getAttackName() { 15 | return "SQL-Inject"; 16 | } 17 | 18 | @Override 19 | protected boolean isAttack(String value) { 20 | return false; 21 | } 22 | 23 | @Override 24 | public boolean requestHeaderAware() { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/xss/AbstractXssHandler.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security.xss; 2 | 3 | import com.jn.agileway.web.security.AbstractWAFHandler; 4 | 5 | public abstract class AbstractXssHandler extends AbstractWAFHandler { 6 | 7 | @Override 8 | public boolean requestHeaderAware() { 9 | return true; 10 | } 11 | 12 | @Override 13 | public final String getAttackName() { 14 | return "XSS"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/security/xss/XssFirewall.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.security.xss; 2 | 3 | import com.jn.agileway.web.security.WAF; 4 | 5 | public class XssFirewall extends WAF { 6 | private XssProperties config; 7 | 8 | public String getContentSecurityPolicy() { 9 | return config.getContentSecurityPolicy(); 10 | } 11 | 12 | @Override 13 | public boolean isEnabled() { 14 | return config.isEnabled(); 15 | } 16 | 17 | @Override 18 | public void setEnabled(boolean enabled) { 19 | config.setEnabled(enabled); 20 | } 21 | 22 | public XssProperties getConfig() { 23 | return config; 24 | } 25 | 26 | public void setConfig(XssProperties config) { 27 | this.config = config; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/servlet/ServletHttpRRFactorySupplier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.servlet; 2 | 3 | import com.jn.agileway.http.rr.HttpRRFactorySupplier; 4 | import com.jn.agileway.http.rr.HttpRequestFactory; 5 | import com.jn.agileway.http.rr.HttpResponseFactory; 6 | 7 | 8 | public class ServletHttpRRFactorySupplier implements HttpRRFactorySupplier { 9 | @Override 10 | public HttpRequestFactory getHttpRequestFactory() { 11 | return new ServletHttpRequestFactory(); 12 | } 13 | 14 | @Override 15 | public HttpResponseFactory getHttpResponseFactory() { 16 | return new ServletHttpResponseFactory(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/servlet/ServletHttpRequestFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.servlet; 2 | 3 | import com.jn.agileway.http.rr.HttpRequest; 4 | import com.jn.agileway.http.rr.HttpRequestFactory; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | 8 | public class ServletHttpRequestFactory implements HttpRequestFactory { 9 | 10 | public static final ServletHttpRequestFactory INSTANCE = new ServletHttpRequestFactory(); 11 | 12 | @Override 13 | public HttpRequest get(HttpServletRequest request) { 14 | return new ServletHttpRequest(request); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/java/com/jn/agileway/web/servlet/ServletHttpResponseFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.web.servlet; 2 | 3 | import com.jn.agileway.http.rr.HttpResponse; 4 | import com.jn.agileway.http.rr.HttpResponseFactory; 5 | 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | public class ServletHttpResponseFactory implements HttpResponseFactory { 9 | 10 | public static final ServletHttpResponseFactory INSTANCE = new ServletHttpResponseFactory(); 11 | @Override 12 | public HttpResponse get(HttpServletResponse response) { 13 | return new ServletHttpResponse(response); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/resources/META-INF/services/com.jn.agileway.web.prediate.HttpRequestPredicateFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.web.prediate.impl.CookieMatchPredicateFactory 2 | com.jn.agileway.web.prediate.impl.HeaderMatchPredicateFactory 3 | com.jn.agileway.web.prediate.impl.HostMatchPredicateFactory 4 | com.jn.agileway.web.prediate.impl.MethodPredicateFactory 5 | com.jn.agileway.web.prediate.impl.PathMatchPredicateFactory -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/resources/agileway_error_en.properties: -------------------------------------------------------------------------------- 1 | HTTP-400=bad request ! {0} 2 | HTTP-401=Unauthorized ! {0} 3 | HTTP-403=Forbidden ! {0} 4 | HTTP-404=the resource is not found 5 | HTTP-405=the http method is not allowed 6 | HTTP-406=the media type is not acceptable 7 | HTTP-411=length required 8 | HTTP-414=URI too long 9 | HTTP-415=the media type is not supported 10 | HTTP-500=error occur in server: {0} 11 | HTTP-502=Bad Gateway 12 | HTTP-503=Service Unavailable 13 | HTTP-504=Gateway Timeout -------------------------------------------------------------------------------- /agileway-web-javaee/src/main/resources/agileway_error_zh.properties: -------------------------------------------------------------------------------- 1 | HTTP-400=\u8BF7\u6C42\u9519\u8BEF 2 | HTTP-404=\u627E\u4E0D\u5230\u8BF7\u6C42\u7684\u8D44\u6E90 3 | HTTP-405=HTTP method\u4E0D\u652F\u6301 4 | HTTP-406=MediaType\u4E0D\u63A5\u53D7 5 | HTTP-415=MediaType\u4E0D\u652F\u6301 6 | HTTP-500=\u670D\u52A1\u7AEF\u51FA\u9519: {0} 7 | HTTP-503=\u5F02\u6B65\u8BF7\u6C42\u8D85\u65F6 -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/CompressFormatFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip; 2 | 3 | import com.jn.langx.util.function.Supplier0; 4 | 5 | import java.util.List; 6 | 7 | public interface CompressFormatFactory extends Supplier0> { 8 | @Override 9 | List get(); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/UnsupportedArchiveFormatException.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip; 2 | 3 | public class UnsupportedArchiveFormatException extends RuntimeException { 4 | public UnsupportedArchiveFormatException() { 5 | super(); 6 | } 7 | 8 | public UnsupportedArchiveFormatException(String message) { 9 | super(message); 10 | } 11 | 12 | public UnsupportedArchiveFormatException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public UnsupportedArchiveFormatException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/ArchiveEntryCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | import com.jn.langx.Customizer; 4 | import org.apache.commons.compress.archivers.ArchiveEntry; 5 | 6 | public interface ArchiveEntryCustomizer extends Customizer { 7 | @Override 8 | void customize(ArchiveEntry entry); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/ArchiveEntryFilter.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | import com.jn.langx.Filter; 4 | import org.apache.commons.compress.archivers.ArchiveEntry; 5 | 6 | public interface ArchiveEntryFilter extends Filter { 7 | @Override 8 | boolean accept(ArchiveEntry archiveEntry); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/ArchiveOutputStreamCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | import com.jn.langx.Customizer; 4 | import org.apache.commons.compress.archivers.ArchiveOutputStream; 5 | 6 | public interface ArchiveOutputStreamCustomizer extends Customizer { 7 | @Override 8 | void customize(ArchiveOutputStream archiveOutputStream); 9 | } 10 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/ArchiveSuiteFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | 7 | public interface ArchiveSuiteFactory { 8 | Archiver get(String format, OutputStream outputStream); 9 | Expander get(String format, InputStream inputStream); 10 | } 11 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/FileAttrsCopier.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | import com.jn.langx.util.function.Consumer2; 4 | import org.apache.commons.compress.archivers.ArchiveEntry; 5 | 6 | import java.io.File; 7 | 8 | public interface FileAttrsCopier extends Consumer2 { 9 | @Override 10 | void accept(ArchiveEntry archiveEntry, File file); 11 | } 12 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/SingleArchiveSuiteFactory.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive; 2 | 3 | public interface SingleArchiveSuiteFactory extends ArchiveSuiteFactory{ 4 | String getArchiveFormat(); 5 | } 6 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/archive/tar/TarArchiveOutputStreamCustomizer.java: -------------------------------------------------------------------------------- 1 | package com.jn.agileway.zip.archive.tar; 2 | 3 | import com.jn.agileway.zip.archive.ArchiveOutputStreamCustomizer; 4 | import org.apache.commons.compress.archivers.ArchiveOutputStream; 5 | import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; 6 | 7 | public class TarArchiveOutputStreamCustomizer implements ArchiveOutputStreamCustomizer { 8 | @Override 9 | public void customize(ArchiveOutputStream archiveOutputStream) { 10 | TarArchiveOutputStream tarOut = (TarArchiveOutputStream)archiveOutputStream; 11 | tarOut.setAddPaxHeadersForNonAsciiNames(true); 12 | tarOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); 13 | tarOut.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /agileway-zip/src/main/java/com/jn/agileway/zip/readme.md: -------------------------------------------------------------------------------- 1 | # commons-compress 2 | 3 | ## commons-compress 使用限制 4 | https://commons.apache.org/proper/commons-compress/limitations.html 5 | 6 | 7 | 8 | ## archive 9 | 10 | ### 1. zip 11 | 12 | zip 规范: 13 | 14 | http://www.pkware.com/documents/casestudies/APPNOTE.TXT 15 | https://libzip.org/specifications/ 16 | 17 | 18 | #### 关于加密、解密 19 | ```text 20 | zip 规范中可知,是可以进行 加密、解密的,但 commons-compress 是不支持的。 如果要处理一个加密的zip文件,可以使用 zip4j 21 | ``` 22 | 23 | 24 | ### 2. tar 25 | 26 | 27 | ## compress 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /agileway-zip/src/main/resources/META-INF/services/com.jn.agileway.zip.archive.SingleArchiveSuiteFactory: -------------------------------------------------------------------------------- 1 | com.jn.agileway.zip.archive.tar.TarArchiveSuiteFactory 2 | com.jn.agileway.zip.archive.SimpleArchiveSuiteFactory -------------------------------------------------------------------------------- /build/clean.bat: -------------------------------------------------------------------------------- 1 | echo current directory: %~dp0.. 2 | 3 | set PROJECT_DIR=%~dp0.. 4 | 5 | echo remove directory: %PROJECT_DIR%/agileway-redis-springdata2/src 6 | rmdir /S/Q "%PROJECT_DIR%/agileway-redis-springdata2/target" 7 | rmdir /S/Q "%PROJECT_DIR%/agileway-redis-springdata2/src" 8 | 9 | 10 | echo remove directory: %PROJECT_DIR%/agileway-shiro-redis-springdata2/src 11 | rmdir /S/Q "%PROJECT_DIR%/agileway-shiro-redis-springdata2/target" 12 | rmdir /S/Q "%PROJECT_DIR%/agileway-shiro-redis-springdata2/src" 13 | 14 | echo 0 -------------------------------------------------------------------------------- /sonar-scan.bat: -------------------------------------------------------------------------------- 1 | REM 使用之前,先将 pom 文件中的 构建目标版本设置为 1.7 2 | 3 | set JAVA_HOME=%JAVA_17_HOME% 4 | set Path=%JAVA_HOME%/bin;%Path% 5 | REM mvn clean package -DskipTests 6 | mvn clean package -DskipTests -PstaticAnalyze -Dsonar.login=squ_7cfd830d0fce088249875af9c8f83222f86e8eb6 -Dsonar.projectKey=agileway -Dsonar.projectName=agileway -Dsonar.host.url=http://192.168.137.133:9000 --------------------------------------------------------------------------------