├── .gitattributes ├── .github └── workflows │ ├── pull-request.yml │ ├── push-branch.yml │ └── push-main.yml ├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── build.gradle.kts ├── communicator ├── build.gradle.kts └── src │ ├── jmh │ └── java │ │ └── io │ │ └── art │ │ └── communicator │ │ └── benchmark │ │ └── CommunicatorBenchmark.java │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── communicator │ │ ├── Communicator.java │ │ ├── action │ │ └── CommunicatorAction.java │ │ ├── configuration │ │ ├── CommunicatorActionConfiguration.java │ │ ├── CommunicatorActionsConfiguration.java │ │ └── CommunicatorConfiguration.java │ │ ├── configurator │ │ ├── CommunicatorActionConfigurator.java │ │ ├── CommunicatorConfigurator.java │ │ └── CommunicatorConfiguratorImplementation.java │ │ ├── constants │ │ └── CommunicatorConstants.java │ │ ├── decorator │ │ ├── CommunicatorDeactivationDecorator.java │ │ └── CommunicatorLoggingDecorator.java │ │ ├── exception │ │ └── CommunicatorException.java │ │ ├── factory │ │ ├── CommunicatorActionFactory.java │ │ └── CommunicatorProxyFactory.java │ │ ├── model │ │ ├── Communication.java │ │ ├── CommunicatorActionFactory.java │ │ ├── CommunicatorActionProvider.java │ │ ├── CommunicatorKey.java │ │ ├── CommunicatorProxy.java │ │ └── ConnectorIdentifier.java │ │ ├── refresher │ │ └── CommunicatorRefresher.java │ │ └── registry │ │ └── CommunicatorRegistry.java │ └── test │ └── java │ └── io │ └── art │ └── communicator │ └── test │ ├── CommunicatorTest.java │ ├── meta │ └── MetaCommunicatorTest.java │ ├── proxy │ ├── BenchmarkCommunication.java │ ├── TestCommunication.java │ └── TestCommunicator.java │ └── registry │ └── CommunicatorTestExecutionsRegistry.java ├── configurator ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── configurator │ │ ├── Configuring.java │ │ ├── configuration │ │ └── ConfiguratorModuleConfiguration.java │ │ ├── constants │ │ └── ConfiguratorModuleConstants.java │ │ ├── custom │ │ ├── CustomConfigurationParser.java │ │ └── CustomConfigurator.java │ │ ├── exception │ │ ├── ConfigurationLoadingException.java │ │ ├── ConfigurationNotFoundException.java │ │ └── UnknownConfigurationFileExtensionException.java │ │ ├── model │ │ ├── ConfigurationFile.java │ │ └── CustomConfiguration.java │ │ ├── module │ │ ├── ConfiguratorActivator.java │ │ ├── ConfiguratorInitializer.java │ │ ├── ConfiguratorModule.java │ │ └── CustomConfigurationsConfigurator.java │ │ └── source │ │ ├── DelegateConfigurationSource.java │ │ ├── EnvironmentConfigurationSource.java │ │ ├── FileConfigurationSource.java │ │ ├── PropertiesConfigurationSource.java │ │ └── YamlConfigurationSource.java │ └── test │ ├── java │ └── io │ │ └── art │ │ └── configurator │ │ └── test │ │ ├── ConfigurationFormatsTest.java │ │ └── CustomConfigurationParserTest.java │ └── resources │ ├── module.yml │ └── test.yml ├── core ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── core │ │ ├── annotation │ │ ├── Generation.java │ │ └── Public.java │ │ ├── builder │ │ └── MapBuilder.java │ │ ├── callable │ │ └── ExceptionCallable.java │ │ ├── caster │ │ └── Caster.java │ │ ├── changes │ │ ├── ChangesConsumer.java │ │ ├── ChangesConsumerRegistry.java │ │ ├── ChangesListener.java │ │ ├── ChangesListenerRegistry.java │ │ ├── ChangesProducer.java │ │ └── ChangesProducerRegistry.java │ │ ├── checker │ │ ├── EmptinessChecker.java │ │ ├── EqualityChecker.java │ │ ├── ModuleChecker.java │ │ ├── NullityChecker.java │ │ └── TerminalChecker.java │ │ ├── collection │ │ ├── ImmutableArray.java │ │ ├── ImmutableArrayImplementation.java │ │ ├── ImmutableCollection.java │ │ ├── ImmutableLazyArrayImplementation.java │ │ ├── ImmutableLazyMapImplementation.java │ │ ├── ImmutableMap.java │ │ ├── ImmutableMapImplementation.java │ │ ├── ImmutableSet.java │ │ └── ImmutableSetImplementation.java │ │ ├── collector │ │ ├── ArrayCollector.java │ │ ├── MapCollector.java │ │ ├── QueueCollector.java │ │ └── SetCollector.java │ │ ├── combiner │ │ └── SectionCombiner.java │ │ ├── configuration │ │ └── ContextConfiguration.java │ │ ├── constants │ │ ├── AlgorithmConstants.java │ │ ├── ArrayConstants.java │ │ ├── BufferConstants.java │ │ ├── BuilderValidatorErrors.java │ │ ├── CharacterConstants.java │ │ ├── CharsetConstants.java │ │ ├── CommonConfigurationKeys.java │ │ ├── CompilerSuppressingWarnings.java │ │ ├── ContextConstants.java │ │ ├── DateTimeConstants.java │ │ ├── DurationConstants.java │ │ ├── EmptyFunctions.java │ │ ├── Errors.java │ │ ├── ExceptionInterceptionStrategy.java │ │ ├── HashConstants.java │ │ ├── IdeaContracts.java │ │ ├── InterceptionAction.java │ │ ├── KnownClassNameSuffixes.java │ │ ├── KnownProcessorArchitecture.java │ │ ├── LoggingMessages.java │ │ ├── MethodDecoratorScope.java │ │ ├── MimeTypeConstants.java │ │ ├── ModuleIdentifiers.java │ │ ├── NetworkConstants.java │ │ ├── ProtocolConstants.java │ │ ├── QueueConstants.java │ │ ├── ReactiveConstants.java │ │ ├── ReflectionConstants.java │ │ ├── RegExps.java │ │ ├── SeedConstants.java │ │ ├── SizesConstants.java │ │ ├── StreamConstants.java │ │ ├── StringConstants.java │ │ ├── SystemConstants.java │ │ ├── SystemNamePatterns.java │ │ ├── SystemProperties.java │ │ ├── ThreadConstants.java │ │ ├── ValidationConstants.java │ │ └── WaiterConstants.java │ │ ├── context │ │ ├── Context.java │ │ └── ContextService.java │ │ ├── converter │ │ └── WslPathConverter.java │ │ ├── determiner │ │ ├── ProcessorDeterminer.java │ │ └── SystemDeterminer.java │ │ ├── exception │ │ ├── ConfigurationPathException.java │ │ ├── ImpossibleSituationException.java │ │ ├── InternalRuntimeException.java │ │ ├── InvalidMimeTypeException.java │ │ ├── NotImplementedException.java │ │ ├── ParseException.java │ │ └── ValidationException.java │ │ ├── extensions │ │ ├── ArrayExtensions.java │ │ ├── CollectionExtensions.java │ │ ├── DateTimeExtensions.java │ │ ├── ExecutorExtensions.java │ │ ├── FileExtensions.java │ │ ├── FunctionExtensions.java │ │ ├── HashExtensions.java │ │ ├── InputStreamExtensions.java │ │ ├── JarExtensions.java │ │ ├── NettyBufferExtensions.java │ │ ├── NioBufferExtensions.java │ │ ├── OptionalExtensions.java │ │ ├── RandomExtensions.java │ │ ├── ReactiveExtensions.java │ │ ├── StreamsExtensions.java │ │ ├── StringExtensions.java │ │ ├── SystemExtensions.java │ │ └── ThreadExtensions.java │ │ ├── factory │ │ ├── ArrayFactory.java │ │ ├── ExceptionFactory.java │ │ ├── FunctionInvokerFactory.java │ │ ├── ListFactory.java │ │ ├── MapFactory.java │ │ ├── PairFactory.java │ │ ├── QueueFactory.java │ │ ├── SetFactory.java │ │ ├── StackFactory.java │ │ └── TreeFactory.java │ │ ├── file │ │ └── FileProxy.java │ │ ├── format │ │ └── DurationFormatter.java │ │ ├── handler │ │ ├── CauseHandler.java │ │ └── ExceptionHandler.java │ │ ├── initializer │ │ └── Initializer.java │ │ ├── invoker │ │ ├── FunctionInvoker.java │ │ └── Invoker.java │ │ ├── local │ │ └── ThreadLocalValue.java │ │ ├── managed │ │ └── Managed.java │ │ ├── matcher │ │ └── PathMatcher.java │ │ ├── mime │ │ ├── MimeType.java │ │ └── MimeTypes.java │ │ ├── model │ │ ├── CommunicatorActionIdentifier.java │ │ ├── Pair.java │ │ ├── ProcessorArchitecture.java │ │ ├── ServiceMethodIdentifier.java │ │ ├── Tuple.java │ │ ├── Tuple1.java │ │ ├── Tuple2.java │ │ ├── Tuple3.java │ │ ├── Tuple4.java │ │ └── Tuple5.java │ │ ├── module │ │ ├── ManagedModule.java │ │ ├── Module.java │ │ ├── ModuleActivator.java │ │ ├── ModuleConfiguration.java │ │ ├── ModuleConfigurationProvider.java │ │ ├── ModuleConfigurator.java │ │ ├── ModuleFactory.java │ │ ├── ModuleInitializationOperator.java │ │ ├── ModuleInitializationProvider.java │ │ ├── ModuleInitializer.java │ │ ├── ModuleRefresher.java │ │ ├── ModuleState.java │ │ ├── ModuleStateProvider.java │ │ ├── StatefulModule.java │ │ ├── StatefulModuleProxy.java │ │ ├── StatelessModule.java │ │ └── StatelessModuleProxy.java │ │ ├── network │ │ ├── balancer │ │ │ ├── Balancer.java │ │ │ └── RoundRobinBalancer.java │ │ ├── provider │ │ │ └── IpAddressProvider.java │ │ └── selector │ │ │ └── PortSelector.java │ │ ├── normalizer │ │ └── ClassIdentifierNormalizer.java │ │ ├── operator │ │ └── Operators.java │ │ ├── parser │ │ ├── DurationParser.java │ │ ├── EnumParser.java │ │ └── PrimitiveParser.java │ │ ├── property │ │ ├── DisposableProperty.java │ │ ├── LazyProperty.java │ │ └── Property.java │ │ ├── reactive │ │ ├── BlockingFirstSubscriber.java │ │ ├── BlockingLastSubscriber.java │ │ ├── BlockingMonoSubscriber.java │ │ ├── BlockingSingleSubscriber.java │ │ ├── CompensationOnErrorSubscriber.java │ │ └── CompensationOnNextSubscriber.java │ │ ├── replacer │ │ └── Replacer.java │ │ ├── runnable │ │ └── ExceptionRunnable.java │ │ ├── singleton │ │ ├── SingletonAction.java │ │ └── SingletonsRegistry.java │ │ ├── source │ │ ├── ConfigurationSource.java │ │ ├── ConfigurationSourceParameters.java │ │ └── NestedConfiguration.java │ │ ├── strategy │ │ └── ServiceMethodStrategy.java │ │ ├── stream │ │ ├── NioByteBufferInputStream.java │ │ └── NioByteBufferOutputStream.java │ │ ├── validation │ │ ├── BetweenDoubleValidationExpression.java │ │ ├── BetweenIntValidationExpression.java │ │ ├── BetweenLongValidationExpression.java │ │ ├── ContainsValidationExpression.java │ │ ├── EqualsValidationExpression.java │ │ ├── NotEmptyCollectionValidationExpression.java │ │ ├── NotEmptyMapValidationExpression.java │ │ ├── NotEmptyStringValidationExpression.java │ │ ├── NotEqualsValidationExpression.java │ │ ├── NotNullValidationExpression.java │ │ ├── Validatable.java │ │ ├── ValidationExpression.java │ │ ├── Validator.java │ │ └── Validators.java │ │ ├── waiter │ │ └── Waiter.java │ │ └── wrapper │ │ ├── ExceptionWrapper.java │ │ └── FunctionWrapper.java │ └── test │ └── java │ └── io │ └── art │ └── core │ └── test │ ├── CompensationTest.java │ ├── ContextTest.java │ ├── PropertyTest.java │ └── WaiterTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── http ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── http │ │ ├── Http.java │ │ ├── communicator │ │ ├── HttpBlockingRequest.java │ │ ├── HttpBlockingResponse.java │ │ ├── HttpBuiltinCommunicator.java │ │ ├── HttpCommunication.java │ │ ├── HttpCommunicationDecorator.java │ │ ├── HttpCommunicationFactory.java │ │ ├── HttpCommunicator.java │ │ ├── HttpDefaultCommunicator.java │ │ ├── HttpReactiveRequest.java │ │ └── HttpReactiveResponse.java │ │ ├── configuration │ │ ├── HttpConnectorConfiguration.java │ │ ├── HttpModuleConfiguration.java │ │ ├── HttpPathRouteConfiguration.java │ │ ├── HttpRouteConfiguration.java │ │ ├── HttpServerConfiguration.java │ │ ├── HttpSslConfiguration.java │ │ └── HttpWsRouteConfiguration.java │ │ ├── constants │ │ └── HttpModuleConstants.java │ │ ├── exception │ │ └── HttpException.java │ │ ├── manager │ │ └── HttpManager.java │ │ ├── message │ │ └── HttpMessageBuilder.java │ │ ├── meta │ │ └── MetaHttp.java │ │ ├── module │ │ ├── HttpActivator.java │ │ ├── HttpCommunicatorConfigurator.java │ │ ├── HttpInitializer.java │ │ ├── HttpModule.java │ │ └── HttpServerConfigurator.java │ │ ├── path │ │ ├── HttpCommunicationUri.java │ │ └── HttpServingUri.java │ │ ├── refresher │ │ └── HttpModuleRefresher.java │ │ ├── router │ │ ├── HttpRouter.java │ │ ├── HttpRouting.java │ │ ├── WsRouting.java │ │ └── package-info.java │ │ ├── server │ │ └── HttpServer.java │ │ └── state │ │ ├── HttpLocalState.java │ │ ├── HttpModuleState.java │ │ └── WsLocalState.java │ └── test │ └── java │ └── io │ └── art │ └── http │ └── test │ ├── HttpDefaultTest.java │ ├── HttpTest.java │ ├── WsTest.java │ ├── communicator │ ├── TestHttp.java │ └── TestWs.java │ ├── meta │ └── MetaHttpTest.java │ ├── registry │ └── HttpTestExecutionsRegistry.java │ └── service │ ├── TestHttpService.java │ └── TestWsService.java ├── json ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── json │ │ ├── Json.java │ │ ├── configuration │ │ └── JsonModuleConfiguration.java │ │ ├── constants │ │ └── JsonModuleConstants.java │ │ ├── descriptor │ │ ├── JsonReader.java │ │ └── JsonWriter.java │ │ ├── exception │ │ └── JsonException.java │ │ └── module │ │ ├── JsonActivator.java │ │ └── JsonModule.java │ └── test │ └── java │ └── io │ └── art │ └── json │ └── test │ └── JsonTest.java ├── launcher ├── build.gradle.kts └── src │ └── main │ └── java │ └── io │ └── art │ └── launcher │ ├── Activator.java │ ├── Launcher.java │ └── LauncherConstants.java ├── logging ├── build.gradle.kts └── src │ └── main │ └── java │ ├── io │ └── art │ │ └── logging │ │ ├── Logging.java │ │ ├── colorizer │ │ ├── AnsiColorizer.java │ │ └── LogColorizer.java │ │ ├── configuration │ │ ├── ConsoleWriterConfiguration.java │ │ ├── FileWriterConfiguration.java │ │ ├── LoggerConfiguration.java │ │ ├── LoggerConstructionConfiguration.java │ │ ├── LoggerWriterConfiguration.java │ │ ├── LoggingModuleConfiguration.java │ │ ├── TcpWriterConfiguration.java │ │ └── UdpWriterConfiguration.java │ │ ├── constants │ │ ├── LoggingLevel.java │ │ ├── LoggingModuleConstants.java │ │ └── LoggingWriterType.java │ │ ├── exception │ │ └── LoggingException.java │ │ ├── factory │ │ ├── LoggerFactory.java │ │ └── LoggerWriterFactory.java │ │ ├── logger │ │ ├── Logger.java │ │ └── LoggerImplementation.java │ │ ├── manager │ │ └── LoggingManager.java │ │ ├── messaging │ │ ├── LoggerConsumer.java │ │ ├── LoggerProducer.java │ │ └── LoggingQueue.java │ │ ├── model │ │ └── LoggingMessage.java │ │ ├── module │ │ ├── LoggingActivator.java │ │ ├── LoggingInitializer.java │ │ └── LoggingModule.java │ │ ├── reactor │ │ ├── ReactorLogger.java │ │ └── package-info.java │ │ ├── state │ │ ├── LoggerProcessor.java │ │ └── LoggingModuleState.java │ │ ├── stream │ │ ├── LoggerOutputStream.java │ │ └── LoggerPrintStream.java │ │ └── writer │ │ ├── CompositeWriter.java │ │ ├── ConsoleWriter.java │ │ ├── FileWriter.java │ │ ├── LoggerWriter.java │ │ ├── TcpWriter.java │ │ └── UdpWriter.java │ └── org │ └── slf4j │ └── impl │ ├── Slf4jLogger.java │ └── StaticLoggerBinder.java ├── message-pack ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── message │ │ └── pack │ │ ├── MessagePack.java │ │ ├── configuration │ │ └── MessagePackModuleConfiguration.java │ │ ├── constants │ │ └── MessagePackConstants.java │ │ ├── descriptor │ │ ├── MessagePackReader.java │ │ └── MessagePackWriter.java │ │ ├── exception │ │ └── MessagePackException.java │ │ └── module │ │ ├── MessagePackActivator.java │ │ └── MessagePackModule.java │ └── test │ └── java │ └── io │ └── art │ └── message │ └── pack │ └── test │ └── MessagePackTest.java ├── meta ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── meta │ │ ├── Meta.java │ │ ├── configuration │ │ └── MetaModuleConfiguration.java │ │ ├── constants │ │ └── MetaConstants.java │ │ ├── descriptor │ │ ├── Reader.java │ │ └── Writer.java │ │ ├── exception │ │ ├── MetaException.java │ │ └── TransformationException.java │ │ ├── extensions │ │ └── MetaClassExtensions.java │ │ ├── invoker │ │ └── MetaMethodInvoker.java │ │ ├── model │ │ ├── EmptyMetaLibrary.java │ │ ├── InstanceMetaMethod.java │ │ ├── MetaClass.java │ │ ├── MetaConstructor.java │ │ ├── MetaField.java │ │ ├── MetaLibrary.java │ │ ├── MetaLocalState.java │ │ ├── MetaMethod.java │ │ ├── MetaPackage.java │ │ ├── MetaParameter.java │ │ ├── MetaProperty.java │ │ ├── MetaProxy.java │ │ ├── MetaType.java │ │ ├── MetaTypeKindComputer.java │ │ ├── RuntimeMetaType.java │ │ ├── StaticMetaMethod.java │ │ ├── TransformersComputer.java │ │ ├── TypeReference.java │ │ └── TypedObject.java │ │ ├── module │ │ ├── MetaActivator.java │ │ ├── MetaInitializer.java │ │ └── MetaModule.java │ │ ├── registry │ │ ├── BuiltinMetaTypes.java │ │ ├── CustomMetaTransformerRegistrator.java │ │ ├── CustomMetaTransformerRegistry.java │ │ ├── CustomMetaTypeRegistrator.java │ │ └── CustomMetaTypeRegistry.java │ │ ├── schema │ │ ├── MetaCreatorTemplate.java │ │ └── MetaProviderTemplate.java │ │ ├── searcher │ │ └── ClassSearcher.java │ │ ├── state │ │ └── MetaComputationState.java │ │ ├── transformer │ │ ├── ArrayTransformer.java │ │ ├── BooleanArrayTransformer.java │ │ ├── BooleanTransformer.java │ │ ├── ByteArrayTransformer.java │ │ ├── ByteTransformer.java │ │ ├── CharacterArrayTransformer.java │ │ ├── CharacterTransformer.java │ │ ├── CollectionTransformer.java │ │ ├── CustomTransformers.java │ │ ├── DateTransformer.java │ │ ├── DefaultTransformer.java │ │ ├── DequeueTransformer.java │ │ ├── DoubleArrayTransformer.java │ │ ├── DoubleTransformer.java │ │ ├── DurationTransformer.java │ │ ├── EnumTransformer.java │ │ ├── FloatArrayTransformer.java │ │ ├── FloatTransformer.java │ │ ├── FluxTransformer.java │ │ ├── ImmutableArrayTransformer.java │ │ ├── ImmutableCollectionTransformer.java │ │ ├── ImmutableMapTransformer.java │ │ ├── ImmutableSetTransformer.java │ │ ├── InputStreamTransformer.java │ │ ├── IntegerArrayTransformer.java │ │ ├── IntegerTransformer.java │ │ ├── LazyTransformer.java │ │ ├── ListTransformer.java │ │ ├── LocalDateTimeTransformer.java │ │ ├── LongArrayTransformer.java │ │ ├── LongTransformer.java │ │ ├── MapTransformer.java │ │ ├── MetaTransformer.java │ │ ├── MonoTransformer.java │ │ ├── NettyBufferTransformer.java │ │ ├── NioBufferTransformer.java │ │ ├── OptionalTransformer.java │ │ ├── OutputStreamTransformer.java │ │ ├── QueueTransformer.java │ │ ├── SetTransformer.java │ │ ├── ShortArrayTransformer.java │ │ ├── ShortTransformer.java │ │ ├── StreamTransformer.java │ │ ├── StringTransformer.java │ │ ├── SupplierTransformer.java │ │ └── ZonedDateTimeTransformer.java │ │ └── validator │ │ ├── MetaTypeValidator.java │ │ └── ValidationResult.java │ └── testFixtures │ └── java │ └── io │ └── art │ └── meta │ └── test │ ├── TestingMetaConfiguration.java │ ├── TestingMetaConfigurationGenerator.java │ ├── TestingMetaModel.java │ ├── TestingMetaModelGenerator.java │ ├── TestingShortMetaModel.java │ └── meta │ └── MetaMetaTest.java ├── rsocket ├── build.gradle.kts └── src │ ├── jmh │ └── java │ │ └── io │ │ └── art │ │ └── rsocket │ │ └── benchmark │ │ └── RsocketBenchmark.java │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── rsocket │ │ ├── Rsocket.java │ │ ├── communicator │ │ ├── RsocketBlockingRequest.java │ │ ├── RsocketBlockingResponse.java │ │ ├── RsocketBuiltinCommunicator.java │ │ ├── RsocketCommunication.java │ │ ├── RsocketCommunicationFactory.java │ │ ├── RsocketDefaultCommunicator.java │ │ ├── RsocketDefaultTcpCommunicator.java │ │ ├── RsocketDefaultWsCommunicator.java │ │ ├── RsocketFluxRequest.java │ │ ├── RsocketMonoRequest.java │ │ └── RsocketReactiveResponse.java │ │ ├── configuration │ │ ├── RsocketModuleConfiguration.java │ │ ├── common │ │ │ ├── RsocketKeepAliveConfiguration.java │ │ │ ├── RsocketResumeConfiguration.java │ │ │ └── RsocketSslConfiguration.java │ │ ├── communicator │ │ │ ├── common │ │ │ │ └── RsocketCommonConnectorConfiguration.java │ │ │ ├── tcp │ │ │ │ ├── RsocketTcpClientConfiguration.java │ │ │ │ └── RsocketTcpConnectorConfiguration.java │ │ │ └── ws │ │ │ │ ├── RsocketWsClientConfiguration.java │ │ │ │ └── RsocketWsConnectorConfiguration.java │ │ └── server │ │ │ ├── RsocketCommonServerConfiguration.java │ │ │ ├── RsocketTcpServerConfiguration.java │ │ │ └── RsocketWsServerConfiguration.java │ │ ├── constants │ │ └── RsocketModuleConstants.java │ │ ├── exception │ │ └── RsocketException.java │ │ ├── interceptor │ │ ├── RsocketConnectorLoggingInterceptor.java │ │ ├── RsocketLoggingProxy.java │ │ ├── RsocketServerLoggingInterceptor.java │ │ └── package-info.java │ │ ├── manager │ │ └── RsocketManager.java │ │ ├── message │ │ ├── RsocketMessageBuilder.java │ │ └── RsocketServiceMethodsMessageBuilder.java │ │ ├── meta │ │ └── MetaRsocket.java │ │ ├── model │ │ └── RsocketSetupPayload.java │ │ ├── module │ │ ├── RsocketActivator.java │ │ ├── RsocketCommunicatorConfigurator.java │ │ ├── RsocketInitializer.java │ │ ├── RsocketModule.java │ │ ├── RsocketServerConfigurator.java │ │ ├── RsocketTcpConnectorConfigurator.java │ │ └── RsocketWsConnectorConfigurator.java │ │ ├── reader │ │ └── RsocketPayloadReader.java │ │ ├── refresher │ │ └── RsocketModuleRefresher.java │ │ ├── server │ │ ├── RsocketServer.java │ │ └── package-info.java │ │ ├── socket │ │ ├── ServingRsocket.java │ │ └── package-info.java │ │ └── state │ │ └── RsocketModuleState.java │ └── test │ └── java │ └── io │ └── art │ └── rsocket │ └── test │ ├── RsocketDefaultTest.java │ ├── RsocketTest.java │ ├── communicator │ └── TestRsocket.java │ ├── meta │ └── MetaRsocketTest.java │ ├── registry │ └── RsocketTestExecutionsRegistry.java │ └── service │ ├── BenchmarkRsocketService.java │ └── TestRsocketService.java ├── scheduler ├── build.gradle.kts └── src │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── scheduler │ │ ├── Scheduling.java │ │ ├── constants │ │ └── SchedulerModuleConstants.java │ │ ├── exception │ │ └── SchedulerException.java │ │ ├── executor │ │ ├── deferred │ │ │ ├── DefaultExceptionHandler.java │ │ │ ├── DeferredEvent.java │ │ │ ├── DeferredEventObserver.java │ │ │ ├── DeferredExecutor.java │ │ │ ├── DeferredExecutorImplementation.java │ │ │ └── ExceptionHandler.java │ │ └── periodic │ │ │ ├── PeriodicExecutor.java │ │ │ └── RepeatableRunnable.java │ │ ├── factory │ │ └── TaskFactory.java │ │ ├── model │ │ ├── PeriodicRunnableTask.java │ │ └── RunnableTask.java │ │ ├── module │ │ ├── SchedulerActivator.java │ │ ├── SchedulerModule.java │ │ └── SchedulerModuleConfiguration.java │ │ └── queue │ │ ├── DelayWaitingQueue.java │ │ └── PriorityWaitingQueue.java │ └── test │ └── java │ └── io │ └── art │ └── scheduler │ └── test │ ├── SchedulerTest.java │ ├── comparator │ └── DateTimeApproximateComparator.java │ ├── counter │ └── OrderCounter.java │ └── model │ ├── OrderedScheduledTask.java │ └── ScheduledTask.java ├── server ├── build.gradle.kts └── src │ ├── jmh │ └── java │ │ └── io │ │ └── art │ │ └── server │ │ └── benchmark │ │ └── ServerBenchmark.java │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── server │ │ ├── Server.java │ │ ├── configuration │ │ ├── ServerConfiguration.java │ │ ├── ServiceMethodConfiguration.java │ │ └── ServiceMethodsConfiguration.java │ │ ├── configurator │ │ ├── ServerConfigurator.java │ │ ├── ServerConfiguratorImplementation.java │ │ └── ServiceMethodConfigurator.java │ │ ├── constants │ │ └── ServerConstants.java │ │ ├── decorator │ │ ├── ServiceDeactivationDecorator.java │ │ ├── ServiceLoggingDecorator.java │ │ └── ServiceValidationDecorator.java │ │ ├── factory │ │ └── ServiceMethodFactory.java │ │ ├── method │ │ └── ServiceMethod.java │ │ └── refresher │ │ └── ServerRefresher.java │ └── test │ └── java │ └── io │ └── art │ └── server │ └── test │ ├── ServerTest.java │ ├── meta │ └── MetaServerTest.java │ ├── registry │ └── ServiceTestExecutionsRegistry.java │ └── service │ ├── BenchmarkService.java │ └── TestService.java ├── settings.gradle.kts ├── storage ├── build.gradle.kts └── src │ └── main │ └── java │ └── io │ └── art │ └── storage │ ├── Storage.java │ ├── constants │ └── StorageConstants.java │ ├── filter │ ├── implementation │ │ ├── FilterByFieldImplementation.java │ │ ├── FilterByFunctionImplementation.java │ │ ├── FilterByNumberImplementation.java │ │ ├── FilterBySpaceImplementation.java │ │ ├── FilterBySpaceUseFieldsImplementation.java │ │ ├── FilterBySpaceUseNumberFieldsImplementation.java │ │ ├── FilterBySpaceUseNumbersImplementation.java │ │ ├── FilterBySpaceUseStringFieldsImplementation.java │ │ ├── FilterBySpaceUseStringsImplementation.java │ │ ├── FilterBySpaceUseValuesImplementation.java │ │ ├── FilterByStringImplementation.java │ │ ├── FilterImplementation.java │ │ ├── FilterRule.java │ │ └── NestedFilter.java │ └── model │ │ ├── Filter.java │ │ ├── FilterByField.java │ │ ├── FilterByNumber.java │ │ ├── FilterBySpace.java │ │ ├── FilterBySpaceUseFields.java │ │ ├── FilterBySpaceUseNumberFields.java │ │ ├── FilterBySpaceUseNumbers.java │ │ ├── FilterBySpaceUseStringFields.java │ │ ├── FilterBySpaceUseStrings.java │ │ ├── FilterBySpaceUseValues.java │ │ └── FilterByString.java │ ├── index │ ├── Index.java │ ├── Index1.java │ ├── Index2.java │ ├── Index3.java │ ├── Index4.java │ ├── Index5.java │ ├── IndexFiveFields.java │ ├── IndexFourFields.java │ ├── IndexOneField.java │ ├── IndexThreeFields.java │ ├── IndexTwoFields.java │ └── Indexes.java │ ├── mapper │ ├── Mapper.java │ ├── MapperByField.java │ ├── MapperByFunction.java │ └── MapperBySpace.java │ ├── model │ └── ProcessingOperator.java │ ├── service │ ├── BlockingIndex1Service.java │ ├── BlockingIndex2Service.java │ ├── BlockingIndex3Service.java │ ├── BlockingIndex4Service.java │ ├── BlockingIndex5Service.java │ ├── BlockingIndexService.java │ ├── BlockingShardService.java │ ├── BlockingSpaceService.java │ ├── ReactiveIndex1Service.java │ ├── ReactiveIndex2Service.java │ ├── ReactiveIndex3Service.java │ ├── ReactiveIndex4Service.java │ ├── ReactiveIndex5Service.java │ ├── ReactiveIndexService.java │ ├── ReactiveShardService.java │ └── ReactiveSpaceService.java │ ├── sharder │ ├── ShardRequest.java │ ├── ShardRequestFactory.java │ ├── Sharder.java │ ├── Sharder1.java │ ├── Sharder2.java │ ├── Sharder3.java │ ├── Sharder4.java │ ├── Sharder5.java │ └── Sharders.java │ ├── sorter │ ├── implementation │ │ └── SorterImplementation.java │ └── model │ │ └── Sorter.java │ ├── stream │ ├── BlockingSpaceStream.java │ └── ReactiveSpaceStream.java │ └── updater │ ├── Updater.java │ └── UpdaterImplementation.java ├── tarantool ├── build.gradle.kts └── src │ ├── jmh │ └── java │ │ └── io │ │ └── art │ │ └── tarantool │ │ └── benchmark │ │ └── TarantoolBenchmark.java │ ├── main │ └── java │ │ └── io │ │ └── art │ │ └── tarantool │ │ ├── Tarantool.java │ │ ├── authenticator │ │ ├── TarantoolAuthenticationRequester.java │ │ └── TarantoolAuthenticationResponder.java │ │ ├── client │ │ ├── TarantoolClient.java │ │ └── TarantoolConnection.java │ │ ├── communicator │ │ ├── TarantoolCommunication.java │ │ ├── TarantoolCommunicationDecorator.java │ │ └── TarantoolStorage.java │ │ ├── configuration │ │ ├── TarantoolClientConfiguration.java │ │ ├── TarantoolModuleConfiguration.java │ │ └── TarantoolStorageConfiguration.java │ │ ├── connector │ │ └── TarantoolStorageConnector.java │ │ ├── constants │ │ └── TarantoolModuleConstants.java │ │ ├── decoder │ │ └── TarantoolResponseDecoder.java │ │ ├── descriptor │ │ ├── TarantoolModelReader.java │ │ ├── TarantoolModelWriter.java │ │ ├── TarantoolRequestWriter.java │ │ └── TarantoolResponseReader.java │ │ ├── exception │ │ └── TarantoolException.java │ │ ├── factory │ │ ├── TarantoolCommunicationFactory.java │ │ ├── TarantoolNameFactory.java │ │ └── TarantoolRequestContentFactory.java │ │ ├── manager │ │ └── TarantoolManager.java │ │ ├── model │ │ ├── TarantoolFormatConfiguration.java │ │ ├── TarantoolHeader.java │ │ ├── TarantoolIndexConfiguration.java │ │ ├── TarantoolIndexPartConfiguration.java │ │ ├── TarantoolReceiver.java │ │ ├── TarantoolResponse.java │ │ ├── TarantoolSpaceConfiguration.java │ │ └── TarantoolSubscription.java │ │ ├── module │ │ ├── TarantoolActivator.java │ │ ├── TarantoolInitializer.java │ │ ├── TarantoolModule.java │ │ ├── TarantoolSpaceConfigurator.java │ │ ├── TarantoolStorageConfigurator.java │ │ ├── TarantoolStorageConnectorConfigurator.java │ │ ├── TarantoolStoragesConfigurator.java │ │ ├── TarantoolSubscriptionConfigurator.java │ │ └── TarantoolSubscriptionsConfigurator.java │ │ ├── refresher │ │ └── TarantoolModuleRefresher.java │ │ ├── registry │ │ ├── TarantoolReceiverRegistry.java │ │ ├── TarantoolStorageRegistry.java │ │ └── TarantoolSubscriptionRegistry.java │ │ ├── serializer │ │ ├── TarantoolStreamSerializer.java │ │ └── TarantoolUpdateSerializer.java │ │ ├── service │ │ ├── index │ │ │ ├── TarantoolBlockingRouterIndexService.java │ │ │ ├── TarantoolBlockingStorageIndexService.java │ │ │ ├── TarantoolReactiveRouterIndexService.java │ │ │ └── TarantoolReactiveStorageIndexService.java │ │ ├── schema │ │ │ ├── TarantoolRouterSchemaService.java │ │ │ ├── TarantoolSchemaService.java │ │ │ └── TarantoolStorageSchemaService.java │ │ ├── space │ │ │ ├── TarantoolBlockingRouterService.java │ │ │ ├── TarantoolBlockingStorageService.java │ │ │ ├── TarantoolReactiveRouterService.java │ │ │ └── TarantoolReactiveStorageService.java │ │ └── subscription │ │ │ └── TarantoolSubscriptionService.java │ │ ├── state │ │ └── TarantoolModuleState.java │ │ └── stream │ │ ├── TarantoolBlockingRouterSpaceStream.java │ │ ├── TarantoolBlockingStorageSpaceStream.java │ │ ├── TarantoolReactiveRouterIndexStream.java │ │ ├── TarantoolReactiveRouterSpaceStream.java │ │ ├── TarantoolReactiveStorageIndexStream.java │ │ └── TarantoolReactiveStorageSpaceStream.java │ └── test │ ├── java │ └── io │ │ └── art │ │ └── tarantool │ │ └── test │ │ ├── TarantoolRouterTest.java │ │ ├── TarantoolStorageTest.java │ │ ├── TarantoolStreamTest.java │ │ ├── constants │ │ └── TestTarantoolConstants.java │ │ ├── lock │ │ └── TestTarantoolLocker.java │ │ ├── manager │ │ └── TestTarantoolInstanceManager.java │ │ ├── meta │ │ └── MetaTarantoolTest.java │ │ └── model │ │ ├── OtherSpace.java │ │ ├── TestService.java │ │ └── TestStorage.java │ └── resources │ ├── art-tarantool.lua │ ├── test-router.lua │ ├── test-shard-1-master.lua │ ├── test-shard-1-replica.lua │ ├── test-shard-2-master.lua │ ├── test-shard-2-replica.lua │ ├── test-shard-initializer.lua │ ├── test-sharding.lua │ └── test-storage.lua ├── tests ├── build.gradle.kts └── src │ └── main │ └── java │ └── io │ └── art │ └── tests │ ├── Tests.java │ ├── configuration │ ├── TestSuitConfiguration.java │ └── TestsModuleConfiguration.java │ ├── constants │ └── TestsModuleConstants.java │ ├── invoker │ └── TestSuitInvoker.java │ └── module │ ├── TestsActivator.java │ ├── TestsInitializer.java │ └── TestsModule.java ├── transport ├── build.gradle.kts └── src │ └── main │ └── java │ └── io │ └── art │ └── transport │ ├── allocator │ └── WriteBufferAllocator.java │ ├── configuration │ ├── TransportModuleConfiguration.java │ ├── TransportPoolConfiguration.java │ └── TransportRetryConfiguration.java │ ├── constants │ └── TransportModuleConstants.java │ ├── exception │ └── UnsupportedMimeTypeException.java │ ├── extensions │ └── TransportExtensions.java │ ├── mime │ └── MimeTypeDataFormatMapper.java │ ├── module │ ├── TransportActivator.java │ └── TransportModule.java │ ├── payload │ ├── TransportPayload.java │ ├── TransportPayloadReader.java │ └── TransportPayloadWriter.java │ ├── pool │ └── TransportPool.java │ └── reactor │ └── EmptyReactorLogger.java └── yaml ├── build.gradle.kts └── src ├── main └── java │ └── io │ └── art │ └── yaml │ ├── Yaml.java │ ├── configuration │ └── YamlModuleConfiguration.java │ ├── constants │ └── YamlModuleConstants.java │ ├── descriptor │ ├── YamlReader.java │ └── YamlWriter.java │ ├── exception │ └── YamlException.java │ └── module │ ├── YamlActivator.java │ └── YamlModule.java └── test └── java └── io └── art └── yaml └── test └── YamlTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | # Handle line endings automatically for files detected as text 2 | * text=auto 3 | 4 | # These files are text and should be normalized 5 | *.java text diff=java -------------------------------------------------------------------------------- /.github/workflows/pull-request.yml: -------------------------------------------------------------------------------- 1 | name: ART Java Pull Request 2 | on: [pull_request] 3 | jobs: 4 | gradle-build: 5 | strategy: 6 | matrix: 7 | os: [ubuntu-latest] 8 | jdk: [21] 9 | runs-on: ${{ matrix.os }} 10 | steps: 11 | - uses: actions/checkout@v2 12 | - uses: tarantool/setup-tarantool@v4 13 | with: 14 | tarantool-version: "2.11" 15 | 16 | - name: Setup temporary directory on Unix based 17 | run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV 18 | - uses: actions/setup-java@v1 19 | with: 20 | java-version: ${{ matrix.jdk }} 21 | - name: Grant execute permission for gradlew 22 | run: chmod +x gradlew 23 | - name: Build with Gradle 24 | run: ./gradlew clean build --max-workers 8 --configure-on-demand --parallel 25 | -------------------------------------------------------------------------------- /.github/workflows/push-branch.yml: -------------------------------------------------------------------------------- 1 | name: ART Java Branch 2 | on: 3 | push: 4 | branches-ignore: 5 | - main 6 | jobs: 7 | gradle-build: 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest] 11 | jdk: [21] 12 | runs-on: ${{ matrix.os }} 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: tarantool/setup-tarantool@v4 16 | with: 17 | tarantool-version: "2.11" 18 | - name: Setup temporary directory on Unix based 19 | run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV 20 | - uses: actions/setup-java@v1 21 | with: 22 | java-version: ${{ matrix.jdk }} 23 | - name: Grant execute permission for gradlew 24 | run: chmod +x gradlew 25 | - name: Build with Gradle 26 | run: ./gradlew clean build --max-workers 8 --parallel 27 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ART 2 | 3 | Copyright 2020 ART 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /communicator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | plugins { 20 | id("art-internal-jvm") 21 | id("me.champeau.jmh") 22 | } 23 | 24 | dependencies { 25 | api(project(":core")) 26 | api(project(":meta")) 27 | api(project(":transport")) 28 | 29 | implementation(project(":logging")) 30 | } 31 | 32 | generator { 33 | source("CommunicatorTest") { 34 | modulePackage("io.art.communicator.test") 35 | jvm() 36 | sourcesPattern { 37 | include("src/test/**") 38 | } 39 | includeClasses("*Communicator") 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/Communicator.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Communicator { 7 | } 8 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/configurator/CommunicatorConfigurator.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.configurator; 2 | 3 | import io.art.communicator.*; 4 | import io.art.core.annotation.*; 5 | import io.art.meta.model.*; 6 | import java.util.function.*; 7 | 8 | @Public 9 | public interface CommunicatorConfigurator { 10 | CommunicatorConfigurator communicator(Class communicatorClass, UnaryOperator decorator); 11 | 12 | > CommunicatorConfigurator 13 | communicator(Supplier communicatorClass, UnaryOperator decorator); 14 | 15 | > CommunicatorConfigurator 16 | action(Supplier communicatorClass, Supplier> actionMethod, UnaryOperator decorator); 17 | } 18 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/exception/CommunicatorException.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.exception; 2 | 3 | public class CommunicatorException extends RuntimeException { 4 | public CommunicatorException(Throwable cause) { 5 | super(cause); 6 | } 7 | 8 | public CommunicatorException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/model/Communication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.communicator.model; 20 | 21 | import io.art.communicator.action.*; 22 | import io.art.transport.payload.*; 23 | import reactor.core.publisher.*; 24 | 25 | public interface Communication { 26 | default void initialize(CommunicatorAction action) { 27 | 28 | } 29 | 30 | default void dispose() { 31 | 32 | } 33 | 34 | Flux communicate(Flux input); 35 | } 36 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/model/CommunicatorActionFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.model; 2 | 3 | import io.art.core.model.*; 4 | import java.util.function.*; 5 | 6 | @FunctionalInterface 7 | public interface CommunicatorActionFactory extends BiFunction { 8 | } 9 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/model/CommunicatorActionProvider.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.model; 2 | 3 | import io.art.communicator.action.*; 4 | import io.art.meta.model.*; 5 | import java.util.function.*; 6 | 7 | @FunctionalInterface 8 | public interface CommunicatorActionProvider extends Function, ?>, CommunicatorAction> { 9 | } 10 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/model/CommunicatorProxy.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.model; 2 | 3 | import io.art.communicator.*; 4 | import io.art.communicator.action.*; 5 | import io.art.core.collection.*; 6 | import io.art.core.model.*; 7 | import lombok.*; 8 | 9 | @Getter 10 | @RequiredArgsConstructor 11 | public class CommunicatorProxy { 12 | private final T communicator; 13 | private final ImmutableMap actions; 14 | } 15 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/model/ConnectorIdentifier.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.model; 2 | 3 | import io.art.core.annotation.*; 4 | import static io.art.core.constants.StringConstants.*; 5 | 6 | @Public 7 | @FunctionalInterface 8 | public interface ConnectorIdentifier { 9 | String name(); 10 | 11 | default String id() { 12 | return name().toLowerCase().replaceAll(UNDERSCORE, DASH); 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /communicator/src/main/java/io/art/communicator/refresher/CommunicatorRefresher.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.refresher; 2 | 3 | import io.art.core.changes.*; 4 | import lombok.*; 5 | import lombok.experimental.*; 6 | import static io.art.core.changes.ChangesListener.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | public class CommunicatorRefresher { 11 | private final ChangesListener deactivationListener = changesListener(); 12 | private final ChangesListener loggingListener = changesListener(); 13 | private final Consumer consumer = new Consumer(); 14 | 15 | public void produce() { 16 | loggingListener.produce(); 17 | deactivationListener.produce(); 18 | } 19 | 20 | @Getter 21 | @Accessors(fluent = true) 22 | public class Consumer { 23 | private final ChangesConsumer loggingConsumer = loggingListener.consumer(); 24 | private final ChangesConsumer deactivationConsumer = deactivationListener.consumer(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /communicator/src/test/java/io/art/communicator/test/proxy/BenchmarkCommunication.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.test.proxy; 2 | 3 | import io.art.communicator.model.*; 4 | import reactor.core.publisher.*; 5 | 6 | public class BenchmarkCommunication implements Communication { 7 | @Override 8 | public Flux communicate(Flux input) { 9 | return Flux.empty(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /communicator/src/test/java/io/art/communicator/test/proxy/TestCommunication.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.test.proxy; 2 | 3 | import io.art.communicator.action.*; 4 | import io.art.communicator.model.*; 5 | import reactor.core.publisher.*; 6 | import static io.art.communicator.test.registry.CommunicatorTestExecutionsRegistry.*; 7 | import static io.art.core.checker.NullityChecker.*; 8 | import static io.art.core.extensions.ReactiveExtensions.*; 9 | 10 | public class TestCommunication implements Communication { 11 | private CommunicatorAction action; 12 | 13 | @Override 14 | public void initialize(CommunicatorAction action) { 15 | this.action = action; 16 | } 17 | 18 | @Override 19 | public Flux communicate(Flux input) { 20 | register(action.getId().getActionId(), orElse(blockFirst(input), new Object())); 21 | return Flux.just("test"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /communicator/src/test/java/io/art/communicator/test/proxy/TestCommunicator.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.test.proxy; 2 | 3 | import io.art.communicator.*; 4 | import reactor.core.publisher.*; 5 | 6 | public interface TestCommunicator extends Communicator { 7 | void m1(); 8 | 9 | String m2(); 10 | 11 | Mono m3(); 12 | 13 | Flux m4(); 14 | 15 | void m5(String input); 16 | 17 | String m6(String input); 18 | 19 | Mono m7(String input); 20 | 21 | Flux m8(String input); 22 | 23 | void m9(Mono input); 24 | 25 | String m10(Mono input); 26 | 27 | Mono m11(Mono input); 28 | 29 | Flux m12(Mono input); 30 | 31 | 32 | void m13(Flux input); 33 | 34 | String m14(Flux input); 35 | 36 | Mono m15(Flux input); 37 | 38 | Flux m16(Flux input); 39 | } 40 | -------------------------------------------------------------------------------- /communicator/src/test/java/io/art/communicator/test/registry/CommunicatorTestExecutionsRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.communicator.test.registry; 2 | 3 | import static io.art.core.factory.MapFactory.*; 4 | import java.util.*; 5 | 6 | public class CommunicatorTestExecutionsRegistry { 7 | private final static Map executions = map(); 8 | 9 | public static void register(String method, Object input) { 10 | executions.put(method, input); 11 | } 12 | 13 | public static Map executions() { 14 | return executions; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /configurator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | dependencies { 20 | api(project(":core")) 21 | api(project(":meta")) 22 | 23 | val jacksonVersion: String by project 24 | api("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", jacksonVersion) 25 | api("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) 26 | api("com.fasterxml.jackson.core", "jackson-databind", jacksonVersion) 27 | 28 | testImplementation(testFixtures(project(":meta"))) 29 | } 30 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/custom/CustomConfigurator.java: -------------------------------------------------------------------------------- 1 | package io.art.configurator.custom; 2 | 3 | import io.art.core.source.*; 4 | 5 | public interface CustomConfigurator { 6 | T configure(ConfigurationSource source); 7 | } 8 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/exception/ConfigurationLoadingException.java: -------------------------------------------------------------------------------- 1 | package io.art.configurator.exception; 2 | 3 | public class ConfigurationLoadingException extends RuntimeException { 4 | public ConfigurationLoadingException(Throwable cause) { 5 | super(cause); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/exception/ConfigurationNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.art.configurator.exception; 2 | 3 | import static io.art.configurator.constants.ConfiguratorModuleConstants.Errors.*; 4 | import static java.text.MessageFormat.*; 5 | 6 | public class ConfigurationNotFoundException extends RuntimeException { 7 | public ConfigurationNotFoundException(String section) { 8 | super(format(CONFIGURATION_WAS_NOT_FOUND, section)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/exception/UnknownConfigurationFileExtensionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.configurator.exception; 20 | 21 | import static io.art.configurator.constants.ConfiguratorModuleConstants.Errors.*; 22 | import static java.text.MessageFormat.*; 23 | 24 | public class UnknownConfigurationFileExtensionException extends RuntimeException { 25 | public UnknownConfigurationFileExtensionException(String extension) { 26 | super(format(UNKNOWN_CONFIGURATION_SOURCE_FILE_EXTENSION, extension)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/model/ConfigurationFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.configurator.model; 20 | 21 | import lombok.*; 22 | 23 | @Getter 24 | @AllArgsConstructor 25 | public class ConfigurationFile { 26 | private final String path; 27 | private final String type; 28 | } 29 | -------------------------------------------------------------------------------- /configurator/src/main/java/io/art/configurator/model/CustomConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.configurator.model; 2 | 3 | import lombok.*; 4 | 5 | @Getter 6 | @EqualsAndHashCode 7 | @RequiredArgsConstructor 8 | public class CustomConfiguration { 9 | private final String section; 10 | private final Class type; 11 | } 12 | -------------------------------------------------------------------------------- /configurator/src/test/resources/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | key: value 3 | array: 4 | - value-0 5 | - value-1 6 | - test: value-2 7 | nested: 8 | inner: 9 | value: value 10 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/annotation/Generation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.annotation; 20 | 21 | import static java.lang.annotation.ElementType.METHOD; 22 | import static java.lang.annotation.ElementType.TYPE; 23 | import static java.lang.annotation.RetentionPolicy.SOURCE; 24 | import java.lang.annotation.*; 25 | 26 | @Target({TYPE, METHOD}) 27 | @Retention(SOURCE) 28 | public @interface Generation { 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/annotation/Public.java: -------------------------------------------------------------------------------- 1 | package io.art.core.annotation; 2 | 3 | import static java.lang.annotation.ElementType.*; 4 | import static java.lang.annotation.RetentionPolicy.*; 5 | import java.lang.annotation.*; 6 | 7 | @Target({TYPE}) 8 | @Retention(SOURCE) 9 | public @interface Public { 10 | } 11 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/callable/ExceptionCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ART 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a recursiveCopy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.art.core.callable; 18 | 19 | @FunctionalInterface 20 | public interface ExceptionCallable { 21 | T call() throws Throwable; 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/caster/Caster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.caster; 20 | 21 | import lombok.experimental.*; 22 | import static io.art.core.constants.CompilerSuppressingWarnings.*; 23 | 24 | @UtilityClass 25 | public class Caster { 26 | @SuppressWarnings(UNCHECKED) 27 | public static T cast(Object object) { 28 | return (T) object; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/changes/ChangesConsumer.java: -------------------------------------------------------------------------------- 1 | package io.art.core.changes; 2 | 3 | import io.art.core.property.*; 4 | import lombok.*; 5 | 6 | @RequiredArgsConstructor 7 | public class ChangesConsumer { 8 | private final ChangesListener listener; 9 | 10 | public ChangesConsumer consume(Runnable action) { 11 | listener.consume(action); 12 | return this; 13 | } 14 | 15 | public ChangesConsumer consume(Runnable onChange, Runnable onDispose){ 16 | listener.consume(onChange, onDispose); 17 | return this; 18 | } 19 | 20 | public Property consume(Property value) { 21 | listener.consume(value); 22 | return value; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/changes/ChangesConsumerRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.core.changes; 2 | 3 | import lombok.*; 4 | 5 | @RequiredArgsConstructor 6 | public class ChangesConsumerRegistry { 7 | private final ChangesListenerRegistry listeners; 8 | 9 | public ChangesConsumer consumerFor(String id) { 10 | return listeners.listenerFor(id).consumer(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/changes/ChangesProducer.java: -------------------------------------------------------------------------------- 1 | package io.art.core.changes; 2 | 3 | import lombok.*; 4 | 5 | @RequiredArgsConstructor 6 | public class ChangesProducer { 7 | private final ChangesListener listener; 8 | 9 | public ChangesProducer produce() { 10 | listener.produce(); 11 | return this; 12 | } 13 | 14 | public ChangesProducer dispose() { 15 | listener.dispose(); 16 | return this; 17 | } 18 | 19 | public T emit(T value) { 20 | return listener.emit(value); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/changes/ChangesProducerRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.core.changes; 2 | 3 | import lombok.*; 4 | 5 | @RequiredArgsConstructor 6 | public class ChangesProducerRegistry { 7 | private final ChangesListenerRegistry listeners; 8 | 9 | public ChangesProducer producerFor(String id) { 10 | return listeners.listenerFor(id).producer(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/checker/TerminalChecker.java: -------------------------------------------------------------------------------- 1 | package io.art.core.checker; 2 | 3 | import io.art.core.collection.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.checker.NullityChecker.*; 6 | import static io.art.core.constants.SystemConstants.*; 7 | import static io.art.core.context.Context.*; 8 | import static io.art.core.determiner.SystemDeterminer.*; 9 | 10 | @UtilityClass 11 | public class TerminalChecker { 12 | public static boolean terminalSupportColors() { 13 | ImmutableMap environment = context().configuration().getEnvironment(); 14 | if (let(environment.get(TERM_VARIABLE), value -> value.contains(XTERM_PATTERN), false)) { 15 | return true; 16 | } 17 | return isWindows() && WINDOWS_TERMINAL_ENVIRONMENT 18 | .stream() 19 | .anyMatch(environment::containsKey); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/collector/QueueCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.collector; 20 | 21 | import io.art.core.factory.*; 22 | import static java.util.stream.Collectors.*; 23 | import java.util.*; 24 | import java.util.stream.*; 25 | 26 | public class QueueCollector { 27 | public static Collector> queueCollector() { 28 | return toCollection(QueueFactory::queue); 29 | } 30 | 31 | public static Collector> dequeCollector() { 32 | return toCollection(QueueFactory::deque); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/collector/SetCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.collector; 20 | 21 | import io.art.core.factory.*; 22 | import lombok.experimental.*; 23 | import static java.util.stream.Collectors.*; 24 | import java.util.*; 25 | import java.util.stream.*; 26 | 27 | @UtilityClass 28 | public class SetCollector { 29 | public static Collector> setCollector() { 30 | return toCollection(SetFactory::set); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/combiner/SectionCombiner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.combiner; 20 | 21 | import lombok.experimental.*; 22 | import static io.art.core.checker.EmptinessChecker.isEmpty; 23 | import static io.art.core.constants.StringConstants.DOT; 24 | 25 | @UtilityClass 26 | public class SectionCombiner { 27 | public static String combine(String current, String nested) { 28 | return isEmpty(current) ? nested : current + DOT + nested; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/AlgorithmConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import io.art.core.exception.*; 22 | import java.security.*; 23 | 24 | public interface AlgorithmConstants { 25 | String MD5 = "MD5"; 26 | 27 | static MessageDigest sha1() { 28 | try { 29 | return MessageDigest.getInstance("SHA-1"); 30 | } catch (Throwable throwable) { 31 | throw new InternalRuntimeException(throwable); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/BufferConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import io.netty.buffer.*; 22 | import java.nio.*; 23 | 24 | public interface BufferConstants { 25 | int DEFAULT_BUFFER_SIZE = 16536; 26 | float BUFFER_REALLOCATION_FACTOR = 1.1f; 27 | 28 | static ByteBuf emptyNettyBuffer() { 29 | return ByteBufAllocator.DEFAULT.buffer(); 30 | } 31 | 32 | static ByteBuffer emptyNioBuffer() { 33 | return ByteBuffer.allocate(0); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/BuilderValidatorErrors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface BuilderValidatorErrors { 22 | String FIELD_MUST_NOT_BE_EMPTY = "''{0}'' must not be empty"; 23 | String FIELD_MUST_NOT_BE_NULL = "''{0}'' must not be null"; 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/CharsetConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import java.nio.charset.*; 22 | 23 | public interface CharsetConstants { 24 | Charset UTF_32LE = Charset.forName("UTF-32LE"); 25 | Charset UTF_32BE = Charset.forName("UTF-32BE"); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/CommonConfigurationKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface CommonConfigurationKeys { 22 | String VERBOSE_KEY = "verbose"; 23 | String COMPRESS_KEY = "compress"; 24 | String HOST_KEY = "host"; 25 | String PORT_KEY = "port"; 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/CompilerSuppressingWarnings.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Generation 6 | public interface CompilerSuppressingWarnings { 7 | String ALL = "all"; 8 | String WARNINGS = "warnings"; 9 | String OPTIONAL_USED_AS_FIELD = "OptionalUsedAsFieldOrParameterType"; 10 | String UNCHECKED = "unchecked"; 11 | String NULLABLE_PROBLEMS = "NullableProblems"; 12 | String UNSTABLE_API_USAGE = "UnstableApiUsage"; 13 | String CONSTANT_CONDITIONS = "ConstantConditions"; 14 | String UNUSED = "unused"; 15 | String DEPRECATION = "deprecation"; 16 | String RESULT_IGNORED = "ResultOfMethodCallIgnored"; 17 | String FINAL_FIELD = "FieldMayBeFinal"; 18 | String SUN_API = "sunapi"; 19 | String CALLING_SUBSCRIBE_IN_NON_BLOCKING_SCOPE = "CallingSubscribeInNonBlockingScope"; 20 | String VARARGS = "varargs"; 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ContextConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface ContextConstants { 22 | String DEFAULT_MAIN_MODULE_ID = "main-module"; 23 | String DEFAULT_MODULE_JAR = "module.jar"; 24 | String TERMINATOR_THREAD = "terminator"; 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/EmptyFunctions.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | import java.util.concurrent.*; 4 | import java.util.function.*; 5 | 6 | public interface EmptyFunctions { 7 | static Runnable emptyRunnable() { 8 | return () -> { 9 | }; 10 | } 11 | 12 | static Callable emptyCallable() { 13 | return () -> null; 14 | } 15 | 16 | static Consumer emptyConsumer() { 17 | return (T ignore) -> { 18 | }; 19 | } 20 | 21 | static BiConsumer emptyBiConsumer() { 22 | return (T first, U second) -> { 23 | }; 24 | } 25 | 26 | static BiFunction emptyBiFunction() { 27 | return (T first, U second) -> null; 28 | } 29 | 30 | static Supplier emptySupplier() { 31 | return () -> null; 32 | } 33 | 34 | static Function emptyFunction() { 35 | return (K ignore) -> null; 36 | } 37 | 38 | FutureTask EMPTY_FUTURE_TASK = new FutureTask<>(emptyCallable()); 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ExceptionInterceptionStrategy.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * ART 4 | * 5 | * Copyright 2019-2022 ART 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package io.art.core.constants; 21 | 22 | public enum ExceptionInterceptionStrategy { 23 | NEXT, 24 | THROW_EXCEPTION, 25 | RETURN_FALLBACK 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/HashConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import static io.art.core.constants.SeedConstants.*; 22 | 23 | public interface HashConstants { 24 | int DEFAULT_XX32_HASH_SEED = (int) DEFAULT_SEED; 25 | long DEFAULT_XX64_HASH_SEED = DEFAULT_SEED; 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/IdeaContracts.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | public interface IdeaContracts { 4 | String NULL_CONTRACT = "null -> fail"; 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/InterceptionAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public enum InterceptionAction { 22 | NEXT, 23 | PROCESS, 24 | TERMINATE 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/KnownClassNameSuffixes.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | public interface KnownClassNameSuffixes { 4 | String SERVICE_CLASS_SUFFIX = "service"; 5 | String COMMUNICATOR_CLASS_SUFFIX = "communicator"; 6 | String STORAGE_CLASS_SUFFIX = "storage"; 7 | String SPACE_CLASS_SUFFIX = "space"; 8 | } 9 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/LoggingMessages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface LoggingMessages { 22 | String WELCOME_MESSAGE = "Welcome to ART!"; 23 | String LAUNCHED_MESSAGE = "Modules have been launched!"; 24 | String SHUTDOWN_MESSAGE = "Bye, bye!"; 25 | String MODULE_RELOADING_START_MESSAGE = "Module: ''{0}'' are being reloaded"; 26 | String MODULE_RELOADING_END_MESSAGE = "Module: ''{0}'' have been reloaded"; 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/MethodDecoratorScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public enum MethodDecoratorScope { 22 | INPUT, 23 | OUTPUT 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ModuleIdentifiers.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | import io.art.core.collection.*; 4 | 5 | public interface ModuleIdentifiers { 6 | String LOGGING_MODULE_ID = "LoggingModule"; 7 | String TRANSPORT_MODULE_ID = "TransportModule"; 8 | String JSON_MODULE_ID = "JsonModule"; 9 | String YAML_MODULE_ID = "YamlModule"; 10 | String MESSAGE_PACK_MODULE_ID = "MessagePack"; 11 | String CONFIGURATOR_MODULE_ID = "ConfiguratorModule"; 12 | String META_MODULE_ID = "MetaModule"; 13 | String TESTS_MODULE_ID = "TestsModule"; 14 | 15 | ImmutableSet PRELOADED_MODULES = ImmutableSet.immutableSetBuilder() 16 | .add(CONFIGURATOR_MODULE_ID) 17 | .add(LOGGING_MODULE_ID) 18 | .add(TRANSPORT_MODULE_ID) 19 | .build(); 20 | 21 | ImmutableSet POST_LOADED_MODULES = ImmutableSet.immutableSetBuilder() 22 | .add(META_MODULE_ID) 23 | .build(); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ProtocolConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface ProtocolConstants { 22 | String HTTP_SCHEME = "http"; 23 | String HTTPS_SCHEME = "https"; 24 | String WS_SCHEME = "ws"; 25 | String WSS_SCHEME = "wss"; 26 | String TCP_SCHEME = "tcp"; 27 | String TCPS_SCHEME = "tcps"; 28 | int DEFAULT_HTTP_PORT = 80; 29 | int DEFAULT_HTTPS_PORT = 443; 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/QueueConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface QueueConstants { 22 | int DEFAULT_MPSC_BLOCKING_QUEUE_CAPACITY = 16535; 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ReactiveConstants.java: -------------------------------------------------------------------------------- 1 | package io.art.core.constants; 2 | 3 | import reactor.core.publisher.*; 4 | 5 | public interface ReactiveConstants { 6 | Object NULL_OBJECT = new Object(); 7 | Flux NULL_FLUX = Flux.just(NULL_OBJECT); 8 | Mono NULL_MONO = Mono.just(NULL_OBJECT); 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ReflectionConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import static java.util.regex.Pattern.compile; 22 | import java.util.regex.*; 23 | 24 | public interface ReflectionConstants { 25 | String WRITE_REPLACE = "writeReplace"; 26 | Pattern SIGNATURE_REGEX = compile("\\(L(.+);\\).+"); 27 | String CLASS_PREFIX = "L"; 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/SeedConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import static java.lang.System.currentTimeMillis; 22 | 23 | public interface SeedConstants { 24 | long DEFAULT_SEED = currentTimeMillis(); 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/SizesConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface SizesConstants { 22 | int SHORT_SIZE = 2; 23 | int INT_SIZE = 4; 24 | int LONG_SIZE = 8; 25 | int SHORT_MAX_CHARACTER_SIZE = 6; 26 | int INT_MAX_CHARACTER_SIZE = 11; 27 | int LONG_MAX_CHARACTER_SIZE = 20; 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/StreamConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface StreamConstants { 22 | int EOF = -1; 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/SystemNamePatterns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface SystemNamePatterns { 22 | String WIN = "win"; 23 | String MAC = "mac"; 24 | String NIX = "nix"; 25 | String NUX = "nux"; 26 | String AIX = "aix"; 27 | String SUNOS = "sunos"; 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/SystemProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | public interface SystemProperties { 22 | String OS_NAME_PROPERTY = "os.name"; 23 | String OS_ARCH_PROPERTY = "os.arch"; 24 | String USER_DIR_PROPERTY = "user.dir"; 25 | String JAVA_HOME_PROPERTY = "java.home"; 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/ThreadConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import static java.lang.Math.*; 22 | import static java.lang.Runtime.*; 23 | import static java.time.Duration.*; 24 | import java.time.*; 25 | 26 | public interface ThreadConstants { 27 | int DEFAULT_THREAD_POOL_SIZE = max(getRuntime().availableProcessors() - 1, 2); 28 | Duration DEFAULT_EXECUTOR_TERMINATION_TIMEOUT = ofMinutes(1); 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/constants/WaiterConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.constants; 20 | 21 | import static java.time.Duration.*; 22 | import java.time.*; 23 | 24 | public interface WaiterConstants { 25 | Duration DEFAULT_WAIT_TIMEOUT = ofSeconds(30); 26 | Duration DEFAULT_WAIT_CHECK_PERIOD = ofMillis(100); 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/determiner/ProcessorDeterminer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.determiner; 20 | 21 | import io.art.core.model.*; 22 | import static io.art.core.constants.SystemProperties.*; 23 | import static java.lang.System.*; 24 | import static java.util.Collections.*; 25 | 26 | public class ProcessorDeterminer { 27 | private static final String ARCHITECTURE = getProperty(OS_ARCH_PROPERTY).toLowerCase(); 28 | 29 | public static ProcessorArchitecture currentArchitecture() { 30 | return new ProcessorArchitecture(ARCHITECTURE, emptySet()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/ConfigurationPathException.java: -------------------------------------------------------------------------------- 1 | package io.art.core.exception; 2 | 3 | public class ConfigurationPathException extends RuntimeException { 4 | public ConfigurationPathException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/ImpossibleSituationException.java: -------------------------------------------------------------------------------- 1 | package io.art.core.exception; 2 | 3 | import static io.art.core.constants.Errors.IMPOSSIBLE_MESSAGE; 4 | 5 | public class ImpossibleSituationException extends IllegalStateException { 6 | public ImpossibleSituationException() { 7 | super(IMPOSSIBLE_MESSAGE); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/InternalRuntimeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.exception; 20 | 21 | public class InternalRuntimeException extends RuntimeException { 22 | public InternalRuntimeException(String message) { 23 | super(message); 24 | } 25 | 26 | public InternalRuntimeException(Throwable throwable) { 27 | super(throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/InvalidMimeTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.exception; 20 | 21 | import static io.art.core.constants.MimeTypeConstants.*; 22 | import static java.text.MessageFormat.*; 23 | 24 | public class InvalidMimeTypeException extends RuntimeException { 25 | public InvalidMimeTypeException(String value, String message) { 26 | super(format(INVALID_MIME_TYPE_MESSAGE, message, value)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.exception; 20 | 21 | import static io.art.core.constants.Errors.*; 22 | import static java.text.MessageFormat.*; 23 | 24 | public class NotImplementedException extends RuntimeException { 25 | public NotImplementedException(String method) { 26 | super(format(METHOD_NOT_IMPLEMENTED, method)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/exception/ParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.exception; 20 | 21 | public class ParseException extends RuntimeException { 22 | public ParseException(String message) { 23 | super(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/extensions/FunctionExtensions.java: -------------------------------------------------------------------------------- 1 | package io.art.core.extensions; 2 | 3 | import io.art.core.checker.*; 4 | import lombok.experimental.*; 5 | import java.util.function.*; 6 | 7 | @UtilityClass 8 | public class FunctionExtensions { 9 | public static T apply(T target, Consumer action) { 10 | action.accept(target); 11 | return target; 12 | } 13 | 14 | public static T applyIf(T target, Predicate predicate, Consumer action) { 15 | if (predicate.test(target)) { 16 | action.accept(target); 17 | } 18 | return target; 19 | } 20 | 21 | public static UnaryOperator then(UnaryOperator current, UnaryOperator next) { 22 | return value -> next.apply(current.apply(value)); 23 | } 24 | 25 | public static Runnable before(Runnable before, Runnable current) { 26 | return () -> { 27 | NullityChecker.apply(before, Runnable::run); 28 | NullityChecker.apply(current, Runnable::run); 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/extensions/RandomExtensions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.extensions; 20 | 21 | import lombok.experimental.*; 22 | import java.security.*; 23 | 24 | @UtilityClass 25 | public class RandomExtensions { 26 | private final static SecureRandom RANDOM = new SecureRandom(); 27 | 28 | public static int randomInt() { 29 | return RANDOM.nextInt(); 30 | } 31 | 32 | public static int randomPositiveInt() { 33 | return Math.abs(RANDOM.nextInt()); 34 | } 35 | 36 | public static long randomLong() { 37 | return RANDOM.nextLong(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/extensions/SystemExtensions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.extensions; 20 | 21 | import lombok.experimental.*; 22 | 23 | @UtilityClass 24 | public class SystemExtensions { 25 | public static void printMessage(Object value) { 26 | System.out.println(value); 27 | } 28 | 29 | public static void printError(Object value) { 30 | System.err.println(value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/factory/ExceptionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.factory; 20 | 21 | @FunctionalInterface 22 | public interface ExceptionFactory { 23 | T create(Throwable throwable); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/factory/FunctionInvokerFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.core.factory; 2 | 3 | import io.art.core.invoker.*; 4 | import lombok.experimental.*; 5 | import java.util.function.*; 6 | 7 | @UtilityClass 8 | public class FunctionInvokerFactory { 9 | public static FunctionInvoker voidInvoker(Runnable voidFunction) { 10 | return noArgumentsInvoker((() -> { 11 | voidFunction.run(); 12 | return null; 13 | })); 14 | } 15 | 16 | public static FunctionInvoker noArgumentsInvoker(Supplier noArgumentsFunction) { 17 | return FunctionInvoker.builder().noArguments(noArgumentsFunction).build(); 18 | } 19 | 20 | public static FunctionInvoker oneArgumentInvoker(Function oneArgumentFunction) { 21 | return FunctionInvoker.builder().oneArgument(oneArgumentFunction).build(); 22 | } 23 | 24 | public static FunctionInvoker invoker(Function argumentsFunction) { 25 | return FunctionInvoker.builder().manyArguments(argumentsFunction).build(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/factory/PairFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.core.factory; 2 | 3 | import io.art.core.model.*; 4 | import lombok.experimental.*; 5 | 6 | @UtilityClass 7 | public class PairFactory { 8 | public static Pair pairOf(K k, V v) { 9 | return new Pair<>(k, v); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/file/FileProxy.java: -------------------------------------------------------------------------------- 1 | package io.art.core.file; 2 | 3 | import lombok.*; 4 | import static io.art.core.extensions.FileExtensions.*; 5 | import java.io.*; 6 | import java.util.function.*; 7 | 8 | @Getter 9 | @AllArgsConstructor 10 | public class FileProxy { 11 | private final String path; 12 | private final Supplier inputStream; 13 | 14 | public FileProxy(File file) { 15 | path = file.getAbsolutePath(); 16 | inputStream = () -> fileInputStream(file); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/format/DurationFormatter.java: -------------------------------------------------------------------------------- 1 | package io.art.core.format; 2 | 3 | import lombok.experimental.*; 4 | import static io.art.core.constants.DurationConstants.*; 5 | import static io.art.core.constants.StringConstants.*; 6 | import static java.util.Objects.*; 7 | import static java.util.concurrent.TimeUnit.*; 8 | import java.time.*; 9 | 10 | @UtilityClass 11 | public class DurationFormatter { 12 | public static String format(Duration duration) { 13 | if (isNull(duration)) return EMPTY_STRING; 14 | long nano = duration.toNanos(); 15 | return (double) nano / (double) MILLISECONDS.toNanos(1) + MILLIS_LETTERS; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/invoker/FunctionInvoker.java: -------------------------------------------------------------------------------- 1 | package io.art.core.invoker; 2 | 3 | import lombok.*; 4 | import java.util.function.*; 5 | 6 | @Builder 7 | public class FunctionInvoker implements Invoker { 8 | private final Supplier noArguments; 9 | private final Function oneArgument; 10 | private final Function manyArguments; 11 | 12 | @Override 13 | public Object invoke() { 14 | return noArguments.get(); 15 | } 16 | 17 | @Override 18 | public Object invoke(Object argument) { 19 | return oneArgument.apply(argument); 20 | } 21 | 22 | @Override 23 | public Object invoke(Object[] arguments) { 24 | return manyArguments.apply(arguments); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/invoker/Invoker.java: -------------------------------------------------------------------------------- 1 | package io.art.core.invoker; 2 | 3 | public interface Invoker { 4 | Object invoke(); 5 | 6 | Object invoke(Object argument); 7 | 8 | Object invoke(Object[] arguments); 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/managed/Managed.java: -------------------------------------------------------------------------------- 1 | package io.art.core.managed; 2 | 3 | public interface Managed { 4 | void initialize(); 5 | 6 | void dispose(); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.model; 20 | 21 | import lombok.*; 22 | 23 | @Getter 24 | @ToString 25 | @EqualsAndHashCode 26 | @AllArgsConstructor 27 | public class Pair { 28 | private final First first; 29 | private final Second second; 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Tuple1.java: -------------------------------------------------------------------------------- 1 | package io.art.core.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.factory.ArrayFactory.*; 6 | import java.util.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | @AllArgsConstructor 11 | public class Tuple1 implements Tuple { 12 | private final T1 value1; 13 | 14 | @Override 15 | public List values() { 16 | return fixedArrayOf(value1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Tuple2.java: -------------------------------------------------------------------------------- 1 | package io.art.core.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.factory.ArrayFactory.*; 6 | import java.util.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | @AllArgsConstructor 11 | public class Tuple2 implements Tuple { 12 | private final T1 value1; 13 | private final T2 value2; 14 | 15 | @Override 16 | public List values() { 17 | return fixedArrayOf(value1, value2); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Tuple3.java: -------------------------------------------------------------------------------- 1 | package io.art.core.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.factory.ArrayFactory.*; 6 | import java.util.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | @AllArgsConstructor 11 | public class Tuple3 implements Tuple { 12 | private final T1 value1; 13 | private final T2 value2; 14 | private final T3 value3; 15 | 16 | @Override 17 | public List values() { 18 | return fixedArrayOf(value1, value2, value3); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Tuple4.java: -------------------------------------------------------------------------------- 1 | package io.art.core.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.factory.ArrayFactory.*; 6 | import java.util.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | @AllArgsConstructor 11 | public class Tuple4 implements Tuple { 12 | private final T1 value1; 13 | private final T2 value2; 14 | private final T3 value3; 15 | private final T4 value4; 16 | 17 | @Override 18 | public List values() { 19 | return fixedArrayOf(value1, value2, value3, value4); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/model/Tuple5.java: -------------------------------------------------------------------------------- 1 | package io.art.core.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.factory.ArrayFactory.*; 6 | import java.util.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | @AllArgsConstructor 11 | public class Tuple5 implements Tuple { 12 | private final T1 value1; 13 | private final T2 value2; 14 | private final T3 value3; 15 | private final T4 value4; 16 | private final T5 value5; 17 | 18 | @Override 19 | public List values() { 20 | return fixedArrayOf(value1, value2, value3, value4, value5); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface ModuleConfiguration { 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleConfigurationProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | @FunctionalInterface 22 | public interface ModuleConfigurationProvider { 23 | Configuration getConfiguration(); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.core.module; 2 | 3 | import java.util.function.*; 4 | 5 | public interface ModuleFactory> extends Supplier { 6 | } 7 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleInitializationOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | import java.util.function.*; 22 | 23 | @FunctionalInterface 24 | public interface ModuleInitializationOperator> extends UnaryOperator { 25 | static > ModuleInitializationOperator identity() { 26 | return value -> value; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleInitializationProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | import java.util.function.*; 22 | 23 | @FunctionalInterface 24 | public interface ModuleInitializationProvider> extends Supplier { 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | @FunctionalInterface 22 | public interface ModuleInitializer, ModuleType extends Module> { 23 | Configuration initialize(ModuleType module); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleRefresher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface ModuleRefresher { 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface ModuleState { 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/ModuleStateProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface ModuleStateProvider { 22 | State getState(); 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/StatefulModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface StatefulModule, State extends ModuleState> 22 | extends ModuleStateProvider, StatelessModule { 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/module/StatelessModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.module; 20 | 21 | public interface StatelessModule> 22 | extends ModuleConfigurationProvider, Module { 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/network/balancer/Balancer.java: -------------------------------------------------------------------------------- 1 | package io.art.core.network.balancer; 2 | 3 | import java.util.*; 4 | 5 | public interface Balancer { 6 | T select(); 7 | 8 | Collection endpoints(); 9 | 10 | void endpoints(Collection endpoints); 11 | 12 | void addEndpoint(T endpoint); 13 | 14 | enum BalancerMethod { 15 | ROUND_ROBIN 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/operator/Operators.java: -------------------------------------------------------------------------------- 1 | package io.art.core.operator; 2 | 3 | import lombok.experimental.*; 4 | import static io.art.core.caster.Caster.*; 5 | import static java.util.Objects.*; 6 | import java.util.function.*; 7 | 8 | @UtilityClass 9 | public class Operators { 10 | public void applyIf(T value, Predicate predicate, Consumer action) { 11 | if (nonNull(value) && predicate.test(value)) { 12 | action.accept(value); 13 | } 14 | } 15 | 16 | public UnaryOperator andThen(UnaryOperator current, UnaryOperator after) { 17 | return cast(current.andThen(cast(after))); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/reactive/BlockingFirstSubscriber.java: -------------------------------------------------------------------------------- 1 | package io.art.core.reactive; 2 | 3 | import static java.util.Objects.*; 4 | 5 | public class BlockingFirstSubscriber extends BlockingSingleSubscriber { 6 | @Override 7 | public void onNext(T element) { 8 | if (isNull(value)) { 9 | value = element; 10 | dispose(); 11 | countDown(); 12 | } 13 | } 14 | 15 | @Override 16 | public void onError(Throwable throwable) { 17 | if (isNull(value)) { 18 | error = throwable; 19 | } 20 | countDown(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/reactive/BlockingLastSubscriber.java: -------------------------------------------------------------------------------- 1 | package io.art.core.reactive; 2 | 3 | public class BlockingLastSubscriber extends BlockingSingleSubscriber { 4 | @Override 5 | public void onNext(T element) { 6 | value = element; 7 | } 8 | 9 | @Override 10 | public void onError(Throwable throwable) { 11 | value = null; 12 | error = throwable; 13 | countDown(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/reactive/BlockingMonoSubscriber.java: -------------------------------------------------------------------------------- 1 | package io.art.core.reactive; 2 | 3 | import static java.util.Objects.*; 4 | 5 | public class BlockingMonoSubscriber extends BlockingSingleSubscriber { 6 | @Override 7 | public void onNext(T element) { 8 | if (isNull(value)) { 9 | value = element; 10 | countDown(); 11 | } 12 | } 13 | 14 | @Override 15 | public void onError(Throwable throwable) { 16 | if (isNull(value)) { 17 | error = throwable; 18 | } 19 | countDown(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/replacer/Replacer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.replacer; 20 | 21 | import lombok.experimental.*; 22 | import static io.art.core.checker.EmptinessChecker.*; 23 | 24 | @UtilityClass 25 | public class Replacer { 26 | public static T replaceWith(T current, T from, T to) { 27 | if (isEmpty(current)) { 28 | if (isEmpty(from)) return to; 29 | return current; 30 | } 31 | if (current.equals(from)) return to; 32 | return current; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/runnable/ExceptionRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 ART 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a recursiveCopy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.art.core.runnable; 18 | 19 | @FunctionalInterface 20 | public interface ExceptionRunnable { 21 | void run() throws Throwable; 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/singleton/SingletonsRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.core.singleton; 2 | 3 | import static io.art.core.caster.Caster.*; 4 | import static io.art.core.extensions.CollectionExtensions.*; 5 | import static io.art.core.factory.MapFactory.*; 6 | import java.util.*; 7 | import java.util.function.*; 8 | 9 | public class SingletonsRegistry { 10 | private static final Map, ?> SINGLETONS_BY_CLASS = concurrentMap(); 11 | 12 | public static T singleton(Class objectClass, Supplier factory) { 13 | return cast(computeIfAbsent(SINGLETONS_BY_CLASS, objectClass, cast(factory))); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/source/ConfigurationSourceParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.source; 20 | 21 | import lombok.*; 22 | import static io.art.core.source.ConfigurationSource.*; 23 | import java.io.*; 24 | import java.util.function.*; 25 | 26 | @Value 27 | @Builder(toBuilder = true) 28 | public class ConfigurationSourceParameters { 29 | String section; 30 | String path; 31 | ModuleConfigurationSourceType type; 32 | Supplier inputStream; 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/validation/Validatable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.validation; 20 | 21 | public interface Validatable { 22 | default void validate(Validator validator) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/io/art/core/wrapper/FunctionWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.core.wrapper; 20 | 21 | import io.art.core.callable.*; 22 | import io.art.core.runnable.*; 23 | import lombok.experimental.*; 24 | import java.util.concurrent.*; 25 | 26 | @UtilityClass 27 | public class FunctionWrapper { 28 | public ExceptionRunnable wrap(ExceptionCallable callable) { 29 | return callable::call; 30 | } 31 | 32 | public Callable wrap(Runnable runnable) { 33 | return () -> { 34 | runnable.run(); 35 | return null; 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/test/java/io/art/core/test/PropertyTest.java: -------------------------------------------------------------------------------- 1 | package io.art.core.test; 2 | 3 | import io.art.core.property.*; 4 | import org.junit.jupiter.api.*; 5 | import static io.art.core.property.DisposableProperty.*; 6 | import static org.junit.jupiter.api.Assertions.*; 7 | import java.util.concurrent.atomic.*; 8 | 9 | public class PropertyTest { 10 | @Test 11 | public void testDisposable() { 12 | String test = "test"; 13 | AtomicInteger counter = new AtomicInteger(); 14 | DisposableProperty property = disposable(() -> test) 15 | .initialized(value -> assertEquals(test, value)).initialized(ignore -> counter.incrementAndGet()) 16 | .disposed(value -> assertEquals(test, value)).disposed(ignore -> counter.incrementAndGet()) 17 | .initialize(); 18 | property.dispose(); 19 | property.initialize().dispose(); 20 | assertEquals(4, counter.get()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/art-community/art-java/faa015a9eb432b37df334a68d0f0b4908284d03d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /http/src/main/java/io/art/http/communicator/HttpBuiltinCommunicator.java: -------------------------------------------------------------------------------- 1 | package io.art.http.communicator; 2 | 3 | import io.art.communicator.*; 4 | import reactor.core.publisher.*; 5 | import static io.art.core.caster.Caster.*; 6 | import static io.art.http.communicator.HttpCommunication.*; 7 | import java.util.function.*; 8 | 9 | public interface HttpBuiltinCommunicator extends Communicator { 10 | Flux execute(Flux input); 11 | 12 | default HttpBuiltinCommunicator decorate(UnaryOperator decorator) { 13 | decorateHttpCommunication(decorator); 14 | return cast(this); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /http/src/main/java/io/art/http/configuration/HttpPathRouteConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.http.configuration; 2 | 3 | import lombok.*; 4 | import java.nio.file.*; 5 | 6 | @Getter 7 | @Builder(toBuilder = true) 8 | public class HttpPathRouteConfiguration { 9 | private final Path path; 10 | } 11 | -------------------------------------------------------------------------------- /http/src/main/java/io/art/http/configuration/HttpWsRouteConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.http.configuration; 2 | 3 | import lombok.*; 4 | 5 | @Getter 6 | @Builder(toBuilder = true) 7 | public class HttpWsRouteConfiguration { 8 | private final int aggregateFrames; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /http/src/main/java/io/art/http/exception/HttpException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.http.exception; 20 | 21 | public class HttpException extends RuntimeException { 22 | public HttpException(String message) { 23 | super(message); 24 | } 25 | 26 | public HttpException(Throwable cause) { 27 | super(cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /http/src/main/java/io/art/http/router/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | @NonNullApi 20 | package io.art.http.router; 21 | 22 | import reactor.util.annotation.*; 23 | -------------------------------------------------------------------------------- /http/src/test/java/io/art/http/test/communicator/TestHttp.java: -------------------------------------------------------------------------------- 1 | package io.art.http.test.communicator; 2 | 3 | import io.art.http.communicator.*; 4 | import reactor.core.publisher.*; 5 | 6 | public interface TestHttp extends HttpCommunicator { 7 | void post1(); 8 | 9 | String post2(); 10 | 11 | Mono post3(); 12 | 13 | Flux post4(); 14 | 15 | void post5(String input); 16 | 17 | String post6(String input); 18 | 19 | Mono post7(String input); 20 | 21 | Flux post8(String input); 22 | 23 | void post9(Mono input); 24 | 25 | String post10(Mono input); 26 | 27 | Mono post11(Mono input); 28 | 29 | Flux post12(Mono input); 30 | 31 | void post13(Flux input); 32 | 33 | String post14(Flux input); 34 | 35 | Mono post15(Flux input); 36 | 37 | Flux post16(Flux input); 38 | 39 | void post17(Flux empty); 40 | 41 | String post18(Flux empty); 42 | 43 | Mono post19(Flux empty); 44 | 45 | Flux post20(Flux empty); 46 | 47 | String getFile(); 48 | } 49 | -------------------------------------------------------------------------------- /http/src/test/java/io/art/http/test/communicator/TestWs.java: -------------------------------------------------------------------------------- 1 | package io.art.http.test.communicator; 2 | 3 | import io.art.communicator.*; 4 | import reactor.core.publisher.*; 5 | 6 | public interface TestWs extends Communicator { 7 | void ws1(); 8 | 9 | String ws2(); 10 | 11 | Mono ws3(); 12 | 13 | Flux ws4(); 14 | 15 | void ws5(String input); 16 | 17 | String ws6(String input); 18 | 19 | Mono ws7(String input); 20 | 21 | Flux ws8(String input); 22 | 23 | void ws9(Mono input); 24 | 25 | String ws10(Mono input); 26 | 27 | Mono ws11(Mono input); 28 | 29 | Flux ws12(Mono input); 30 | 31 | void ws13(Flux input); 32 | 33 | String ws14(Flux input); 34 | 35 | Mono ws15(Flux input); 36 | 37 | Flux ws16(Flux input); 38 | 39 | void ws17(Flux input); 40 | 41 | Flux wsEcho(Flux input); 42 | } 43 | -------------------------------------------------------------------------------- /http/src/test/java/io/art/http/test/registry/HttpTestExecutionsRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.http.test.registry; 2 | 3 | import io.art.http.test.service.*; 4 | import io.art.meta.*; 5 | import static io.art.core.factory.MapFactory.*; 6 | import static io.art.core.waiter.Waiter.*; 7 | import static org.junit.jupiter.api.Assertions.*; 8 | import java.util.*; 9 | 10 | public class HttpTestExecutionsRegistry { 11 | private final static Map executions = concurrentMap(); 12 | 13 | public static void register(String method, Object input) { 14 | executions.put(method, input); 15 | } 16 | 17 | public static void clear() { 18 | executions.clear(); 19 | } 20 | 21 | public static Map executions(int size) { 22 | assertTrue(waitCondition(() -> executions.size() == size)); 23 | return executions; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /json/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | dependencies { 20 | val jacksonVersion: String by project 21 | 22 | api(project(":core")) 23 | api(project(":meta")) 24 | 25 | api("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) 26 | api("com.fasterxml.jackson.core", "jackson-databind", jacksonVersion) 27 | 28 | testImplementation(testFixtures(project(":meta"))) 29 | } 30 | -------------------------------------------------------------------------------- /json/src/main/java/io/art/json/Json.java: -------------------------------------------------------------------------------- 1 | package io.art.json; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.json.descriptor.*; 5 | import lombok.*; 6 | import lombok.experimental.*; 7 | import static io.art.json.module.JsonModule.*; 8 | import static lombok.AccessLevel.*; 9 | 10 | @Public 11 | @UtilityClass 12 | public class Json { 13 | private final static Provider provider = new Provider(); 14 | 15 | public static Provider json() { 16 | return provider; 17 | } 18 | 19 | @NoArgsConstructor(access = PRIVATE) 20 | public static class Provider { 21 | public JsonReader reader() { 22 | return jsonModule().configuration().getReader(); 23 | } 24 | 25 | public JsonWriter writer() { 26 | return jsonModule().configuration().getWriter(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /json/src/main/java/io/art/json/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.json.exception; 20 | 21 | public class JsonException extends RuntimeException { 22 | public JsonException(String message) { 23 | super(message); 24 | } 25 | 26 | public JsonException(Throwable throwable) { 27 | super(throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /json/src/main/java/io/art/json/module/JsonActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.json.module; 20 | 21 | import io.art.core.annotation.*; 22 | import io.art.core.module.*; 23 | import lombok.experimental.*; 24 | import static io.art.core.module.ModuleActivator.*; 25 | 26 | @Public 27 | @UtilityClass 28 | public class JsonActivator { 29 | public ModuleActivator json() { 30 | return module(JsonModule.class, JsonModule::new); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /launcher/src/main/java/io/art/launcher/LauncherConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.launcher; 20 | 21 | public interface LauncherConstants { 22 | String DEFAULT_CONFIGURATION = "Configurator has not activated. Using default configurations"; 23 | String LAUNCHER_LOGGER = "launcher"; 24 | } 25 | -------------------------------------------------------------------------------- /logging/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | dependencies { 20 | val sl4jVersion: String by project 21 | 22 | api(project(":core")) 23 | 24 | api("org.slf4j", "slf4j-api", sl4jVersion) 25 | } 26 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/configuration/LoggerConstructionConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.configuration; 20 | 21 | import io.art.core.collection.*; 22 | import io.art.logging.configuration.*; 23 | import io.art.logging.messaging.*; 24 | import io.art.logging.writer.*; 25 | import lombok.*; 26 | 27 | @Getter 28 | @Builder 29 | public class LoggerConstructionConfiguration { 30 | private final String name; 31 | private final LoggerConfiguration loggerConfiguration; 32 | private final LoggerProducer producer; 33 | private final ImmutableArray writers; 34 | } 35 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/constants/LoggingWriterType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.constants; 20 | 21 | import static java.util.Arrays.*; 22 | 23 | public enum LoggingWriterType { 24 | CONSOLE, 25 | TCP, 26 | UDP, 27 | FILE; 28 | 29 | public static LoggingWriterType parse(String type, LoggingWriterType defaultType) { 30 | return stream(LoggingWriterType.values()) 31 | .filter(known -> known.name().equalsIgnoreCase(type)) 32 | .findFirst() 33 | .orElse(defaultType); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/exception/LoggingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.exception; 20 | 21 | public class LoggingException extends RuntimeException { 22 | public LoggingException(String message) { 23 | super(message); 24 | } 25 | 26 | public LoggingException(Throwable throwable) { 27 | super(throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/messaging/LoggerConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.messaging; 20 | 21 | import io.art.core.collection.*; 22 | import io.art.logging.model.*; 23 | import io.art.logging.writer.*; 24 | import lombok.*; 25 | 26 | @AllArgsConstructor 27 | public class LoggerConsumer { 28 | private final ImmutableArray writers; 29 | 30 | public void consume(LoggingMessage message) { 31 | writers.forEach(writer -> writer.write(message)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/messaging/LoggerProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.messaging; 20 | 21 | import io.art.logging.model.*; 22 | import io.art.logging.writer.*; 23 | import lombok.*; 24 | 25 | @AllArgsConstructor 26 | public class LoggerProducer { 27 | private final LoggingQueue queue; 28 | private final LoggerWriter fallbackWriter; 29 | 30 | public void produce(LoggingMessage message) { 31 | if (!queue.offer(message)) { 32 | fallbackWriter.write(message); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/model/LoggingMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.model; 20 | 21 | import io.art.logging.constants.*; 22 | import lombok.*; 23 | import java.time.*; 24 | 25 | @Value 26 | @Builder(toBuilder = true) 27 | public class LoggingMessage { 28 | String logger; 29 | LocalDateTime dateTime; 30 | Thread thread; 31 | LoggingLevel level; 32 | String message; 33 | } 34 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/reactor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | @NonNullApi 20 | package io.art.logging.reactor; 21 | 22 | import reactor.util.annotation.*; 23 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/stream/LoggerPrintStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.stream; 20 | 21 | import io.art.logging.logger.*; 22 | import java.io.*; 23 | import java.util.function.*; 24 | 25 | public class LoggerPrintStream extends PrintStream { 26 | public LoggerPrintStream(Logger logger, BiConsumer writer) { 27 | super(new LoggerOutputStream(logger, writer), true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/writer/CompositeWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.writer; 20 | 21 | import io.art.core.collection.*; 22 | import io.art.logging.model.*; 23 | import lombok.*; 24 | import java.util.*; 25 | 26 | @RequiredArgsConstructor 27 | public class CompositeWriter implements LoggerWriter { 28 | private final ImmutableArray writers; 29 | 30 | @Override 31 | public void write(LoggingMessage message) { 32 | writers.forEach(writer -> writer.write(message)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /logging/src/main/java/io/art/logging/writer/LoggerWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.logging.writer; 20 | 21 | import io.art.logging.model.*; 22 | 23 | public interface LoggerWriter { 24 | void write(LoggingMessage message); 25 | } 26 | -------------------------------------------------------------------------------- /message-pack/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | plugins { 20 | id("art-internal-jvm") 21 | } 22 | 23 | dependencies { 24 | val messagePackVersion: String by project 25 | 26 | api(project(":core")) 27 | api(project(":meta")) 28 | 29 | api("org.msgpack", "msgpack-core", messagePackVersion) 30 | 31 | testImplementation(testFixtures(project(":meta"))) 32 | } 33 | -------------------------------------------------------------------------------- /message-pack/src/main/java/io/art/message/pack/MessagePack.java: -------------------------------------------------------------------------------- 1 | package io.art.message.pack; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.message.pack.descriptor.*; 5 | import lombok.*; 6 | import lombok.experimental.*; 7 | import static io.art.message.pack.module.MessagePackModule.*; 8 | import static lombok.AccessLevel.*; 9 | 10 | @Public 11 | @UtilityClass 12 | public class MessagePack { 13 | private final static Provider provider = new Provider(); 14 | 15 | public static Provider messagePack() { 16 | return provider; 17 | } 18 | 19 | @NoArgsConstructor(access = PRIVATE) 20 | public static class Provider { 21 | public MessagePackReader reader() { 22 | return messagePackModule().configuration().getReader(); 23 | } 24 | 25 | public MessagePackWriter writer() { 26 | return messagePackModule().configuration().getWriter(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /message-pack/src/main/java/io/art/message/pack/constants/MessagePackConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.message.pack.constants; 20 | 21 | public interface MessagePackConstants { 22 | interface Errors { 23 | String VALUE_TYPE_NOT_SUPPORTED = "MessagePack emit type ''{0}'' not supported"; 24 | String MESSAGE_PACK_ARRAY_EXCEPTION = "MessagePack {0} is array, but type {1} is not compatible with it"; 25 | String MESSAGE_PACK_MAP_EXCEPTION = "MessagePack {0} is map, but type {1} is not compatible with it"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /message-pack/src/main/java/io/art/message/pack/exception/MessagePackException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.message.pack.exception; 20 | 21 | public class MessagePackException extends RuntimeException { 22 | public MessagePackException(Throwable throwable) { 23 | super(throwable); 24 | } 25 | 26 | public MessagePackException(String message) { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /message-pack/src/main/java/io/art/message/pack/module/MessagePackActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.message.pack.module; 20 | 21 | import io.art.core.annotation.*; 22 | import io.art.core.module.*; 23 | import lombok.experimental.*; 24 | import static io.art.core.module.ModuleActivator.*; 25 | 26 | @Public 27 | @UtilityClass 28 | public class MessagePackActivator { 29 | public ModuleActivator messagePack() { 30 | return module(MessagePackModule.class, MessagePackModule::new); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /meta/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | plugins { 20 | `java-test-fixtures` 21 | id("art-internal-jvm") 22 | } 23 | 24 | dependencies { 25 | api(project(":core")) 26 | 27 | testFixturesImplementation(project(":core")) 28 | } 29 | 30 | generator { 31 | source("MetaTest") { 32 | modulePackage("io.art.meta.test") 33 | jvm() 34 | sourcesPattern { 35 | include("src/testFixtures/**") 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/exception/MetaException.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.exception; 2 | 3 | public class MetaException extends RuntimeException { 4 | public MetaException(String message, Throwable cause) { 5 | super(message, cause); 6 | } 7 | 8 | public MetaException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/exception/TransformationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.meta.exception; 20 | 21 | public class TransformationException extends RuntimeException { 22 | public TransformationException(String message) { 23 | super(message); 24 | } 25 | 26 | public TransformationException(Throwable cause) { 27 | super(cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/extensions/MetaClassExtensions.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.extensions; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.experimental.*; 5 | import static io.art.core.constants.StringConstants.*; 6 | import static java.util.stream.Collectors.*; 7 | import java.util.function.*; 8 | 9 | @UtilityClass 10 | public class MetaClassExtensions { 11 | public static String joinMethods(MetaClass owner, Predicate, ?>> predicate) { 12 | return owner.methods().stream() 13 | .filter(predicate) 14 | .map(MetaMethod::toString) 15 | .collect(joining(NEW_LINE + NEW_LINE)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/model/EmptyMetaLibrary.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.model; 2 | 3 | public class EmptyMetaLibrary extends MetaLibrary { 4 | public EmptyMetaLibrary(MetaLibrary[] dependencies) { 5 | super(dependencies); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/model/MetaLocalState.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.model; 2 | 3 | import static io.art.core.factory.MapFactory.*; 4 | import static java.util.Objects.*; 5 | import java.util.*; 6 | 7 | public class MetaLocalState { 8 | private final Map, ?>, T> state = concurrentMap(); 9 | 10 | public void remove(MetaMethod, ?> method) { 11 | state.remove(method); 12 | } 13 | 14 | public T get(MetaMethod, ?> method) { 15 | return state.get(method); 16 | } 17 | 18 | public void set(MetaMethod, ?> method, T value) { 19 | state.put(method, value); 20 | } 21 | 22 | public boolean contains(MetaMethod, ?> method) { 23 | return nonNull(get(method)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/model/MetaProperty.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.model; 2 | 3 | import lombok.*; 4 | import lombok.experimental.*; 5 | 6 | @Getter 7 | @ToString 8 | @Builder(toBuilder = true) 9 | @Accessors(fluent = true) 10 | @EqualsAndHashCode(onlyExplicitlyIncluded = true) 11 | public class MetaProperty { 12 | @EqualsAndHashCode.Include 13 | private final String name; 14 | private final MetaType type; 15 | private final InstanceMetaMethod, Object, ?> getter; 16 | private final int index; 17 | } 18 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/model/TypeReference.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.model; 2 | 3 | import lombok.*; 4 | import javax.annotation.*; 5 | import java.lang.reflect.*; 6 | 7 | @Getter 8 | public abstract class TypeReference implements Comparable> { 9 | protected final Type type; 10 | 11 | protected TypeReference() { 12 | Type superClass = getClass().getGenericSuperclass(); 13 | type = ((ParameterizedType) superClass).getActualTypeArguments()[0]; 14 | } 15 | 16 | @Override 17 | public int compareTo(@Nullable TypeReference other) { 18 | return 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/model/TypedObject.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.model; 2 | 3 | import io.art.core.annotation.*; 4 | import lombok.*; 5 | 6 | @Getter 7 | @Public 8 | @AllArgsConstructor 9 | public class TypedObject { 10 | private final MetaType type; 11 | private final Object object; 12 | 13 | public static TypedObject typed(MetaType type, Object object) { 14 | return new TypedObject(type, object); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/module/MetaActivator.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.module; 2 | 3 | import io.art.core.module.*; 4 | import io.art.core.property.*; 5 | import io.art.meta.model.*; 6 | import lombok.experimental.*; 7 | import static io.art.core.constants.ModuleIdentifiers.*; 8 | import static io.art.core.module.ModuleActivator.*; 9 | import static io.art.core.property.LazyProperty.*; 10 | import static java.util.function.UnaryOperator.*; 11 | import java.util.function.*; 12 | 13 | @UtilityClass 14 | public class MetaActivator { 15 | public ModuleActivator meta() { 16 | LazyProperty library = lazy(() -> new EmptyMetaLibrary(new MetaLibrary[0])); 17 | return module(META_MODULE_ID, () -> new MetaModule(library), () -> new MetaInitializer(library)); 18 | } 19 | 20 | public ModuleActivator meta(Supplier factory) { 21 | return meta(factory, identity()); 22 | } 23 | 24 | public ModuleActivator meta(Supplier factory, UnaryOperator initializer) { 25 | LazyProperty library = lazy(factory); 26 | return module(META_MODULE_ID, () -> new MetaModule(library), () -> initializer.apply(new MetaInitializer(library))); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/registry/CustomMetaTransformerRegistrator.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.registry; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.meta.transformer.*; 5 | import static io.art.core.factory.MapFactory.*; 6 | import java.util.*; 7 | 8 | public class CustomMetaTransformerRegistrator { 9 | private final Map, CustomTransformers> registry = map(); 10 | 11 | public CustomMetaTransformerRegistrator register(Class type, CustomTransformers transformers) { 12 | registry.put(type, transformers); 13 | return this; 14 | } 15 | 16 | public ImmutableMap, CustomTransformers> registry() { 17 | return immutableMapOf(registry); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/registry/CustomMetaTransformerRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.registry; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.meta.transformer.*; 5 | import lombok.*; 6 | import static io.art.core.factory.MapFactory.*; 7 | import static io.art.meta.searcher.ClassSearcher.*; 8 | import static java.util.Objects.*; 9 | import java.util.*; 10 | 11 | @RequiredArgsConstructor 12 | public class CustomMetaTransformerRegistry { 13 | private final ImmutableMap, CustomTransformers> registry; 14 | private final Map, CustomTransformers> cache = concurrentMap(); 15 | 16 | public CustomTransformers get(Class type) { 17 | CustomTransformers cached = cache.get(type); 18 | if (nonNull(cached)) return cached; 19 | cached = searchByClass(registry.toMutable(), type); 20 | if (isNull(cached)) return cached; 21 | cache.put(type, cached); 22 | return cached; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/registry/CustomMetaTypeRegistrator.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.registry; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.meta.model.*; 5 | import static io.art.core.factory.MapFactory.*; 6 | import java.util.*; 7 | 8 | public class CustomMetaTypeRegistrator { 9 | private final Map, MetaType> registry = map(); 10 | 11 | public CustomMetaTypeRegistrator register(MetaType metaType) { 12 | registry.put(metaType.type(), metaType); 13 | return this; 14 | } 15 | 16 | public ImmutableMap, MetaType> getRegistry() { 17 | return immutableMapOf(registry); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/registry/CustomMetaTypeRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.registry; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.meta.model.*; 5 | import lombok.*; 6 | import static io.art.core.factory.MapFactory.*; 7 | import static io.art.meta.searcher.ClassSearcher.*; 8 | import static java.util.Objects.*; 9 | import java.util.*; 10 | 11 | @RequiredArgsConstructor 12 | public class CustomMetaTypeRegistry { 13 | private final ImmutableMap, MetaType> registry; 14 | private final Map, MetaType> cache = concurrentMap(); 15 | 16 | public MetaType get(Class type) { 17 | MetaType cached = cache.get(type); 18 | if (nonNull(cached)) return cached; 19 | cached = searchByClass(registry.toMutable(), type); 20 | if (isNull(cached)) return cached; 21 | cache.put(type, cached); 22 | return cached; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/transformer/CustomTransformers.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.transformer; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import java.util.function.*; 6 | 7 | @Getter 8 | @AllArgsConstructor 9 | public class CustomTransformers { 10 | private final Function, MetaTransformer> input; 11 | private final Function, MetaTransformer> output; 12 | } 13 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/transformer/DefaultTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.meta.transformer; 20 | 21 | import lombok.*; 22 | import static lombok.AccessLevel.*; 23 | 24 | @NoArgsConstructor(access = PRIVATE) 25 | public class DefaultTransformer implements MetaTransformer { 26 | public static DefaultTransformer DEFAULT_TRANSFORMER = new DefaultTransformer(); 27 | } 28 | -------------------------------------------------------------------------------- /meta/src/main/java/io/art/meta/validator/ValidationResult.java: -------------------------------------------------------------------------------- 1 | 2 | package io.art.meta.validator; 3 | 4 | import lombok.*; 5 | 6 | @Getter 7 | @AllArgsConstructor 8 | public class ValidationResult { 9 | private final boolean valid; 10 | private final String message; 11 | } 12 | -------------------------------------------------------------------------------- /meta/src/testFixtures/java/io/art/meta/test/TestingShortMetaModel.java: -------------------------------------------------------------------------------- 1 | package io.art.meta.test; 2 | 3 | 4 | import lombok.*; 5 | 6 | @Builder 7 | @Getter 8 | @ToString 9 | @AllArgsConstructor 10 | public class TestingShortMetaModel { 11 | int id; 12 | String name; 13 | Inner inner; 14 | 15 | @Builder 16 | @Getter 17 | @ToString 18 | @AllArgsConstructor 19 | public static class Inner { 20 | int id; 21 | String name; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/communicator/RsocketBuiltinCommunicator.java: -------------------------------------------------------------------------------- 1 | package io.art.rsocket.communicator; 2 | 3 | import io.art.communicator.*; 4 | import reactor.core.publisher.*; 5 | 6 | public interface RsocketBuiltinCommunicator extends Communicator { 7 | void fireAndForget(Mono input); 8 | 9 | Mono requestResponse(Mono input); 10 | 11 | Flux requestStream(Mono input); 12 | 13 | Flux requestChannel(Flux input); 14 | } 15 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/communicator/RsocketDefaultCommunicator.java: -------------------------------------------------------------------------------- 1 | package io.art.rsocket.communicator; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface RsocketDefaultCommunicator { 7 | default RsocketDefaultWsCommunicator ws() { 8 | return new RsocketDefaultWsCommunicator(); 9 | } 10 | 11 | default RsocketDefaultTcpCommunicator tcp() { 12 | return new RsocketDefaultTcpCommunicator(); 13 | } 14 | 15 | void dispose(); 16 | } 17 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/exception/RsocketException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.rsocket.exception; 20 | 21 | public class RsocketException extends RuntimeException { 22 | public RsocketException(String message) { 23 | super(message); 24 | } 25 | 26 | public RsocketException(Throwable cause) { 27 | super(cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/interceptor/package-info.java: -------------------------------------------------------------------------------- 1 | @NonNullApi 2 | package io.art.rsocket.interceptor; 3 | 4 | import reactor.util.annotation.*; 5 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/server/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | @NonNullApi 20 | package io.art.rsocket.server; 21 | 22 | import reactor.util.annotation.*; 23 | -------------------------------------------------------------------------------- /rsocket/src/main/java/io/art/rsocket/socket/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | @NonNullApi 20 | package io.art.rsocket.socket; 21 | 22 | import reactor.util.annotation.*; 23 | -------------------------------------------------------------------------------- /rsocket/src/test/java/io/art/rsocket/test/communicator/TestRsocket.java: -------------------------------------------------------------------------------- 1 | package io.art.rsocket.test.communicator; 2 | 3 | import io.art.communicator.*; 4 | import reactor.core.publisher.*; 5 | 6 | public interface TestRsocket extends Communicator { 7 | void m1(); 8 | 9 | String m2(); 10 | 11 | Mono m3(); 12 | 13 | Flux m4(); 14 | 15 | void m5(String input); 16 | 17 | String m6(String input); 18 | 19 | Mono m7(String input); 20 | 21 | Flux m8(String input); 22 | 23 | void m9(Mono input); 24 | 25 | String m10(Mono input); 26 | 27 | Mono m11(Mono input); 28 | 29 | Flux m12(Mono input); 30 | 31 | void m13(Flux input); 32 | 33 | String m14(Flux input); 34 | 35 | Mono m15(Flux input); 36 | 37 | Flux m16(Flux input); 38 | } 39 | -------------------------------------------------------------------------------- /rsocket/src/test/java/io/art/rsocket/test/registry/RsocketTestExecutionsRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.rsocket.test.registry; 2 | 3 | import static io.art.core.factory.MapFactory.*; 4 | import static io.art.core.waiter.Waiter.*; 5 | import static org.junit.jupiter.api.Assertions.*; 6 | import java.util.*; 7 | 8 | public class RsocketTestExecutionsRegistry { 9 | private final static Map executions = concurrentMap(); 10 | 11 | public static void register(String method, Object input) { 12 | executions.put(method, input); 13 | } 14 | 15 | public static void clear() { 16 | executions.clear(); 17 | } 18 | 19 | public static Map executions(int size) { 20 | assertTrue(waitCondition(() -> executions.size() == size)); 21 | return executions; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scheduler/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | dependencies { 20 | api(project(":core")) 21 | implementation(project(":logging")) 22 | } 23 | -------------------------------------------------------------------------------- /scheduler/src/main/java/io/art/scheduler/exception/SchedulerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.scheduler.exception; 20 | 21 | public class SchedulerException extends RuntimeException { 22 | public SchedulerException(String message) { 23 | super(message); 24 | } 25 | 26 | public SchedulerException(Throwable throwable) { 27 | super(throwable.getMessage(), throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /scheduler/src/main/java/io/art/scheduler/executor/deferred/ExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.scheduler.executor.deferred; 20 | 21 | import static io.art.scheduler.constants.SchedulerModuleConstants.Errors.*; 22 | 23 | @FunctionalInterface 24 | public interface ExceptionHandler { 25 | void onException(Thread thread, ExceptionEvent event, Throwable throwable); 26 | } 27 | -------------------------------------------------------------------------------- /scheduler/src/main/java/io/art/scheduler/model/PeriodicRunnableTask.java: -------------------------------------------------------------------------------- 1 | package io.art.scheduler.model; 2 | 3 | import io.art.scheduler.constants.SchedulerModuleConstants.*; 4 | import lombok.*; 5 | import java.time.*; 6 | 7 | @Getter 8 | @Builder(toBuilder = true) 9 | public class PeriodicRunnableTask { 10 | private final PeriodicTaskMode mode; 11 | private final RunnableTask delegate; 12 | private final LocalDateTime startTime; 13 | private final Duration period; 14 | private final int order; 15 | private final Runnable decrement; 16 | } 17 | -------------------------------------------------------------------------------- /scheduler/src/main/java/io/art/scheduler/model/RunnableTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.scheduler.model; 20 | 21 | import lombok.*; 22 | import java.util.function.*; 23 | 24 | @Getter 25 | @AllArgsConstructor 26 | public class RunnableTask { 27 | private final String id; 28 | private final Consumer action; 29 | } 30 | -------------------------------------------------------------------------------- /scheduler/src/main/java/io/art/scheduler/module/SchedulerActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.scheduler.module; 20 | 21 | import io.art.core.annotation.*; 22 | import io.art.core.module.*; 23 | import lombok.experimental.*; 24 | import static io.art.core.module.ModuleActivator.*; 25 | 26 | @Public 27 | @UtilityClass 28 | public class SchedulerActivator { 29 | public static ModuleActivator scheduler() { 30 | return module(SchedulerModule.class, SchedulerModule::new); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /scheduler/src/test/java/io/art/scheduler/test/comparator/DateTimeApproximateComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.scheduler.test.comparator; 20 | 21 | import lombok.experimental.*; 22 | import java.time.*; 23 | 24 | @UtilityClass 25 | public class DateTimeApproximateComparator { 26 | public static boolean isAfterOrEqual(LocalDateTime first, LocalDateTime second, Duration distance) { 27 | if (first.isEqual(second)) return true; 28 | if (first.minus(distance).isAfter(second)) return true; 29 | return first.plus(distance).isAfter(second); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /server/src/main/java/io/art/server/Server.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.server; 20 | 21 | import io.art.core.managed.*; 22 | 23 | public interface Server extends Managed { 24 | boolean available(); 25 | } 26 | -------------------------------------------------------------------------------- /server/src/main/java/io/art/server/refresher/ServerRefresher.java: -------------------------------------------------------------------------------- 1 | package io.art.server.refresher; 2 | 3 | import io.art.core.changes.*; 4 | import lombok.*; 5 | import lombok.experimental.*; 6 | import static io.art.core.changes.ChangesListener.*; 7 | 8 | @Getter 9 | @Accessors(fluent = true) 10 | public class ServerRefresher { 11 | private final ChangesListener deactivationListener = changesListener(); 12 | private final ChangesListener loggingListener = changesListener(); 13 | private final ChangesListener validationListener = changesListener(); 14 | private final Consumer consumer = new Consumer(); 15 | 16 | public void produce() { 17 | loggingListener.produce(); 18 | deactivationListener.produce(); 19 | validationListener.produce(); 20 | } 21 | 22 | 23 | @Getter 24 | @Accessors(fluent = true) 25 | public class Consumer { 26 | private final ChangesConsumer deactivationConsumer = deactivationListener.consumer(); 27 | private final ChangesConsumer loggingConsumer = loggingListener.consumer(); 28 | private final ChangesConsumer validationConsumer = validationListener.consumer(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /server/src/test/java/io/art/server/test/registry/ServiceTestExecutionsRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.server.test.registry; 2 | 3 | import static io.art.core.factory.MapFactory.*; 4 | import java.util.*; 5 | 6 | public class ServiceTestExecutionsRegistry { 7 | private final static Map executions = map(); 8 | 9 | public static void register(String method, Object input) { 10 | executions.put(method, input); 11 | } 12 | 13 | public static Map executions() { 14 | return executions; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /storage/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | dependencies { 21 | api(project(":communicator")) 22 | } 23 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/Storage.java: -------------------------------------------------------------------------------- 1 | package io.art.storage; 2 | 3 | import io.art.communicator.*; 4 | import io.art.core.annotation.*; 5 | 6 | @Public 7 | public interface Storage extends Communicator { 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/implementation/FilterByFunctionImplementation.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.implementation; 2 | 3 | import io.art.meta.model.*; 4 | import io.art.storage.*; 5 | import lombok.*; 6 | import lombok.experimental.Delegate; 7 | 8 | @AllArgsConstructor 9 | public class FilterByFunctionImplementation { 10 | @Delegate 11 | private final FilterRule rule; 12 | @Getter 13 | private final MetaMethod, Boolean> function; 14 | } 15 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/implementation/FilterBySpaceUseStringsImplementation.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.implementation; 2 | 3 | import io.art.storage.filter.model.*; 4 | import lombok.*; 5 | import static io.art.storage.constants.StorageConstants.FilterOperator.*; 6 | 7 | @Getter 8 | public class FilterBySpaceUseStringsImplementation extends FilterBySpaceUseValuesImplementation implements FilterBySpaceUseStrings { 9 | FilterBySpaceUseStringsImplementation(FilterRule rule) { 10 | super(rule); 11 | } 12 | 13 | @Override 14 | public FilterRule startsWith(String pattern) { 15 | this.operator = STARTS_WITH; 16 | values.add(pattern); 17 | return rule; 18 | } 19 | 20 | @Override 21 | public FilterRule endsWith(String pattern) { 22 | this.operator = ENDS_WITH; 23 | values.add(pattern); 24 | return rule; 25 | } 26 | 27 | @Override 28 | public FilterRule contains(String pattern) { 29 | this.operator = CONTAINS; 30 | values.add(pattern); 31 | return rule; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/implementation/FilterByStringImplementation.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.implementation; 2 | 3 | import io.art.meta.model.*; 4 | import io.art.storage.filter.model.*; 5 | import lombok.*; 6 | import static io.art.storage.constants.StorageConstants.FilterOperator.*; 7 | 8 | @Getter 9 | public class FilterByStringImplementation extends FilterByFieldImplementation implements FilterByString { 10 | public FilterByStringImplementation(FilterRule rule, MetaField, String> field) { 11 | super(rule, field); 12 | } 13 | 14 | @Override 15 | public FilterRule startsWith(String pattern) { 16 | operator = STARTS_WITH; 17 | values.add(pattern); 18 | return rule; 19 | } 20 | 21 | @Override 22 | public FilterRule endsWith(String pattern) { 23 | operator = ENDS_WITH; 24 | values.add(pattern); 25 | return rule; 26 | } 27 | 28 | @Override 29 | public FilterRule contains(String pattern) { 30 | operator = CONTAINS; 31 | values.add(pattern); 32 | return rule; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/implementation/FilterRule.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.implementation; 2 | 3 | import io.art.storage.filter.model.*; 4 | import lombok.*; 5 | import java.util.function.*; 6 | 7 | @RequiredArgsConstructor 8 | public class FilterRule { 9 | private final FilterImplementation owner; 10 | 11 | public Filter and() { 12 | return owner.and(); 13 | } 14 | 15 | public Filter or() { 16 | return owner.or(); 17 | } 18 | 19 | public Filter or(Consumer> nested) { 20 | owner.or(nested); 21 | return owner; 22 | } 23 | 24 | public Filter and(Consumer> nested) { 25 | owner.and(nested); 26 | return owner; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/implementation/NestedFilter.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.implementation; 2 | 3 | import io.art.storage.filter.implementation.FilterImplementation.*; 4 | import lombok.*; 5 | import java.util.*; 6 | 7 | @Getter 8 | @RequiredArgsConstructor 9 | public class NestedFilter { 10 | private final List parts; 11 | } 12 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterByField.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | import static io.art.core.constants.CompilerSuppressingWarnings.*; 6 | import java.util.*; 7 | 8 | @Public 9 | @SuppressWarnings({UNCHECKED, VARARGS}) 10 | public interface FilterByField { 11 | FilterRule equal(FieldType value); 12 | 13 | FilterRule notEqual(FieldType value); 14 | 15 | FilterRule in(List values); 16 | 17 | FilterRule notIn(List values); 18 | 19 | FilterRule in(FieldType... values); 20 | 21 | FilterRule notIn(FieldType... values); 22 | } 23 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterByNumber.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | 6 | @Public 7 | public interface FilterByNumber extends FilterByField { 8 | FilterRule moreThan(Number value); 9 | 10 | FilterRule moreThanEquals(Number value); 11 | 12 | FilterRule lessThan(Number value); 13 | 14 | FilterRule lessThanEqual(Number value); 15 | 16 | FilterRule between(Number startValue, Number endValue); 17 | 18 | FilterRule notBetween(Number startValue, Number endValue); 19 | } 20 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpace.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.meta.model.*; 5 | 6 | @Public 7 | public interface FilterBySpace { 8 | FilterBySpaceUseFields currentField(MetaField, FieldType> currentField); 9 | 10 | FilterBySpaceUseStringFields currentString(MetaField, String> currentField); 11 | 12 | FilterBySpaceUseNumberFields currentNumber(MetaField, ? extends Number> currentField); 13 | 14 | FilterBySpaceUseNumbers otherNumber(MetaField, ? extends Number> otherField); 15 | 16 | FilterBySpaceUseStrings otherString(MetaField, String> otherField); 17 | 18 | FilterBySpaceUseValues otherField(MetaField, FieldType> otherField); 19 | } 20 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.meta.model.*; 5 | import io.art.storage.filter.implementation.*; 6 | import static io.art.core.constants.CompilerSuppressingWarnings.*; 7 | import java.util.*; 8 | 9 | @Public 10 | @SuppressWarnings({UNCHECKED, VARARGS}) 11 | public interface FilterBySpaceUseFields { 12 | FilterRule equal(MetaField, FieldType> otherField); 13 | 14 | FilterRule notEqual(MetaField, FieldType> otherField); 15 | 16 | FilterRule in(List, FieldType>> otherFields); 17 | 18 | FilterRule notIn(List, FieldType>> otherFields); 19 | 20 | FilterRule in(MetaField, FieldType>... otherFields); 21 | 22 | FilterRule notIn(MetaField, FieldType>... otherFields); 23 | } 24 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseNumberFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.meta.model.*; 5 | import io.art.storage.filter.implementation.*; 6 | 7 | @Public 8 | public interface FilterBySpaceUseNumberFields extends FilterBySpaceUseFields { 9 | FilterRule moreThan(MetaField, ? extends Number> otherField); 10 | 11 | FilterRule lessThan(MetaField, ? extends Number> otherField); 12 | 13 | FilterRule moreThanEquals(MetaField, ? extends Number> otherField); 14 | 15 | FilterRule lessThanEquals(MetaField, ? extends Number> otherField); 16 | 17 | FilterRule between(MetaField, ? extends Number> otherStartField, MetaField, ? extends Number> otherEndField); 18 | 19 | FilterRule notBetween(MetaField, ? extends Number> otherStartField, MetaField, ? extends Number> otherEndField); 20 | } 21 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseNumbers.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | 6 | @Public 7 | public interface FilterBySpaceUseNumbers extends FilterBySpaceUseValues { 8 | FilterRule moreThan(Number value); 9 | 10 | FilterRule lessThan(Number value); 11 | 12 | FilterRule moreThanEquals(Number value); 13 | 14 | FilterRule lessThanEquals(Number value); 15 | 16 | FilterRule between(Number start, Number end); 17 | 18 | FilterRule notBetween(Number start, Number end); 19 | } 20 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseStringFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.meta.model.*; 5 | import io.art.storage.filter.implementation.*; 6 | 7 | @Public 8 | public interface FilterBySpaceUseStringFields extends FilterBySpaceUseFields { 9 | FilterRule startsWith(MetaField, String> otherField); 10 | 11 | FilterRule endsWith(MetaField, String> otherField); 12 | 13 | FilterRule contains(MetaField, String> otherField); 14 | } 15 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseStrings.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | 6 | @Public 7 | public interface FilterBySpaceUseStrings extends FilterBySpaceUseValues { 8 | FilterRule startsWith(String pattern); 9 | 10 | FilterRule endsWith(String pattern); 11 | 12 | FilterRule contains(String pattern); 13 | } 14 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterBySpaceUseValues.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | import static io.art.core.constants.CompilerSuppressingWarnings.*; 6 | import java.util.*; 7 | 8 | @Public 9 | @SuppressWarnings({UNCHECKED, VARARGS}) 10 | public interface FilterBySpaceUseValues { 11 | FilterRule equal(FieldType value); 12 | 13 | FilterRule notEqual(FieldType value); 14 | 15 | FilterRule in(List values); 16 | 17 | FilterRule notIn(List values); 18 | 19 | FilterRule in(FieldType... values); 20 | 21 | FilterRule notIn(FieldType... values); 22 | } 23 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/filter/model/FilterByString.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.filter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.filter.implementation.*; 5 | 6 | @Public 7 | public interface FilterByString extends FilterByField { 8 | FilterRule startsWith(String pattern); 9 | 10 | FilterRule endsWith(String pattern); 11 | 12 | FilterRule contains(String pattern); 13 | } 14 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.meta.model.*; 5 | import static java.util.stream.Collectors.*; 6 | import java.util.*; 7 | 8 | @Public 9 | public interface Index { 10 | List> fields(); 11 | 12 | default MetaClass owner() { 13 | return first().owner(); 14 | } 15 | 16 | default MetaField field(int id) { 17 | return fields().get(id); 18 | } 19 | 20 | default MetaField first() { 21 | return field(0); 22 | } 23 | 24 | default String name() { 25 | return fields().stream().map(MetaField::name).collect(joining()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index1.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Index1 extends Index { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index2.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Index2 extends Index { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index3.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Index3 extends Index { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index4.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Index4 extends Index { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/Index5.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Index5 extends Index { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/IndexFiveFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import static io.art.core.factory.ListFactory.*; 6 | import java.util.*; 7 | 8 | @RequiredArgsConstructor 9 | public class IndexFiveFields implements Index5 { 10 | private final MetaField, F1> field1; 11 | private final MetaField, F2> field2; 12 | private final MetaField, F3> field3; 13 | private final MetaField, F4> field4; 14 | private final MetaField, F5> field5; 15 | 16 | @Override 17 | public List> fields() { 18 | return linkedListOf(field1, field2, field3, field4, field5); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/IndexFourFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import static io.art.core.factory.ListFactory.*; 6 | import java.util.*; 7 | 8 | @RequiredArgsConstructor 9 | public class IndexFourFields implements Index4 { 10 | private final MetaField, F1> field1; 11 | private final MetaField, F2> field2; 12 | private final MetaField, F3> field3; 13 | private final MetaField, F4> field4; 14 | 15 | @Override 16 | public List> fields() { 17 | return linkedListOf(field1, field2, field3, field4); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/IndexOneField.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import static io.art.core.factory.ListFactory.*; 6 | import java.util.*; 7 | 8 | @RequiredArgsConstructor 9 | public class IndexOneField implements Index1 { 10 | private final MetaField, F1> field1; 11 | 12 | @Override 13 | public List> fields() { 14 | return linkedListOf(field1); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/IndexThreeFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import static io.art.core.factory.ListFactory.*; 6 | import java.util.*; 7 | 8 | @RequiredArgsConstructor 9 | public class IndexThreeFields implements Index3 { 10 | private final MetaField, F1> field1; 11 | private final MetaField, F2> field2; 12 | private final MetaField, F3> field3; 13 | 14 | @Override 15 | public List> fields() { 16 | return linkedListOf(field1, field2, field3); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/index/IndexTwoFields.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.index; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | import static io.art.core.factory.ListFactory.*; 6 | import java.util.*; 7 | 8 | @RequiredArgsConstructor 9 | public class IndexTwoFields implements Index2 { 10 | private final MetaField, F1> field1; 11 | private final MetaField, F2> field2; 12 | 13 | @Override 14 | public List> fields() { 15 | return linkedListOf(field1, field2); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/mapper/MapperByField.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.mapper; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.*; 5 | 6 | @Getter 7 | @RequiredArgsConstructor 8 | public class MapperByField { 9 | private final MetaField, ?> field; 10 | } 11 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/mapper/MapperByFunction.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.mapper; 2 | 3 | import io.art.meta.model.*; 4 | import io.art.storage.*; 5 | import lombok.*; 6 | 7 | @Getter 8 | @RequiredArgsConstructor 9 | public class MapperByFunction { 10 | private final MetaMethod, Type> function; 11 | } 12 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/mapper/MapperBySpace.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.mapper; 2 | 3 | import io.art.core.model.*; 4 | import io.art.meta.model.*; 5 | import io.art.storage.index.*; 6 | import lombok.*; 7 | import static lombok.AccessLevel.*; 8 | 9 | @Getter 10 | @RequiredArgsConstructor(access = PACKAGE) 11 | public class MapperBySpace { 12 | private final MetaClass mappingSpace; 13 | private MetaField, ?> mappingKeyField; 14 | 15 | private Index mappingIndex; 16 | private Tuple mappingIndexTuple; 17 | 18 | MapperBySpace bySpace(MetaField, ?> mappingField) { 19 | mappingKeyField = mappingField; 20 | return this; 21 | } 22 | 23 | final MapperBySpace byIndex(Index index, Tuple tuple) { 24 | mappingIndex = index; 25 | mappingIndexTuple = tuple; 26 | return this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/model/ProcessingOperator.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.model; 2 | 3 | import lombok.*; 4 | import static io.art.storage.constants.StorageConstants.*; 5 | 6 | @Getter 7 | @AllArgsConstructor 8 | public class ProcessingOperator { 9 | private final ProcessingOperation operation; 10 | private final Object value; 11 | } 12 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/ShardRequest.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.core.model.*; 5 | import io.art.storage.constants.StorageConstants.*; 6 | import lombok.*; 7 | 8 | @Public 9 | @Getter 10 | @AllArgsConstructor 11 | public class ShardRequest { 12 | private final ShardingAlgorithm algorithm; 13 | private final Tuple data; 14 | } 15 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/ShardRequestFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.core.model.*; 5 | import io.art.storage.constants.StorageConstants.*; 6 | import lombok.experimental.*; 7 | import static io.art.storage.constants.StorageConstants.ShardingAlgorithm.*; 8 | 9 | @Public 10 | @UtilityClass 11 | public class ShardRequestFactory { 12 | public static ShardRequest shard(ShardingAlgorithm algorithm, Tuple data) { 13 | return new ShardRequest(algorithm, data); 14 | } 15 | 16 | public static ShardRequest crc32(Tuple data) { 17 | return new ShardRequest(CRC_32, data); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | import io.art.core.model.*; 4 | 5 | @FunctionalInterface 6 | public interface Sharder { 7 | ShardRequest shard(Tuple input); 8 | } 9 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder1.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | @FunctionalInterface 4 | public interface Sharder1 { 5 | ShardRequest shard(P1 p1); 6 | } 7 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder2.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | @FunctionalInterface 4 | public interface Sharder2 { 5 | ShardRequest shard(P1 p1, P2 p2); 6 | } 7 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder3.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | @FunctionalInterface 4 | public interface Sharder3 { 5 | ShardRequest shard(P1 p1, P2 p2, P3 p3); 6 | } 7 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder4.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | @FunctionalInterface 4 | public interface Sharder4 { 5 | ShardRequest shard(P1 p1, P2 p2, P3 p3, P4 p4); 6 | } 7 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sharder/Sharder5.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sharder; 2 | 3 | @FunctionalInterface 4 | public interface Sharder5 { 5 | ShardRequest shard(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); 6 | } 7 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sorter/implementation/SorterImplementation.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sorter.implementation; 2 | 3 | import io.art.meta.model.*; 4 | import io.art.storage.constants.StorageConstants.*; 5 | import io.art.storage.sorter.model.*; 6 | import lombok.*; 7 | import static io.art.storage.constants.StorageConstants.SortOrder.*; 8 | 9 | @Getter 10 | @RequiredArgsConstructor 11 | public class SorterImplementation implements Sorter { 12 | private final MetaField, FieldType> field; 13 | private SortOrder order = ASCENDANT; 14 | 15 | @Override 16 | public SorterImplementation ascendant() { 17 | order = ASCENDANT; 18 | return this; 19 | } 20 | 21 | @Override 22 | public SorterImplementation descendant() { 23 | order = DESCENDANT; 24 | return this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /storage/src/main/java/io/art/storage/sorter/model/Sorter.java: -------------------------------------------------------------------------------- 1 | package io.art.storage.sorter.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.sorter.implementation.*; 5 | 6 | @Public 7 | public interface Sorter { 8 | SorterImplementation ascendant(); 9 | 10 | SorterImplementation descendant(); 11 | } 12 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/authenticator/TarantoolAuthenticationResponder.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.authenticator; 2 | 3 | import io.art.tarantool.model.*; 4 | import io.netty.channel.*; 5 | import lombok.*; 6 | import org.msgpack.value.Value; 7 | import static io.art.core.checker.NullityChecker.*; 8 | import java.util.function.*; 9 | 10 | @RequiredArgsConstructor 11 | public class TarantoolAuthenticationResponder extends SimpleChannelInboundHandler { 12 | private final BiConsumer listener; 13 | 14 | @Override 15 | protected void channelRead0(ChannelHandlerContext context, TarantoolResponse tarantoolResponse) { 16 | listener.accept(!tarantoolResponse.isError(), let(tarantoolResponse.getBody(), Value::toJson)); 17 | context.pipeline().remove(this); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/communicator/TarantoolCommunicationDecorator.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.communicator; 2 | 3 | import io.art.core.annotation.*; 4 | import lombok.*; 5 | import static lombok.AccessLevel.*; 6 | 7 | @Public 8 | @Getter(value = PACKAGE) 9 | public class TarantoolCommunicationDecorator { 10 | private boolean immutable; 11 | private boolean channel; 12 | 13 | public TarantoolCommunicationDecorator immutable() { 14 | immutable = true; 15 | return this; 16 | } 17 | 18 | public TarantoolCommunicationDecorator mutable() { 19 | immutable = false; 20 | return this; 21 | } 22 | 23 | public TarantoolCommunicationDecorator channel() { 24 | channel = true; 25 | return this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/communicator/TarantoolStorage.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.communicator; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.storage.*; 5 | import static io.art.core.caster.Caster.*; 6 | import static io.art.tarantool.communicator.TarantoolCommunication.*; 7 | import java.util.function.*; 8 | 9 | @Public 10 | public interface TarantoolStorage> extends Storage { 11 | default C decorate(UnaryOperator decorator) { 12 | decorateTarantoolCommunication(decorator); 13 | return cast(this); 14 | } 15 | 16 | default C immutable() { 17 | return decorate(TarantoolCommunicationDecorator::immutable); 18 | } 19 | 20 | default C mutable() { 21 | return decorate(TarantoolCommunicationDecorator::mutable); 22 | } 23 | 24 | default C channel() { 25 | return decorate(TarantoolCommunicationDecorator::channel); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/exception/TarantoolException.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.exception; 2 | 3 | public class TarantoolException extends RuntimeException { 4 | public TarantoolException(String message) { 5 | super(message); 6 | } 7 | 8 | public TarantoolException(Throwable cause) { 9 | super(cause); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/factory/TarantoolCommunicationFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.factory; 2 | 3 | import io.art.tarantool.communicator.*; 4 | import io.art.tarantool.configuration.*; 5 | import lombok.experimental.*; 6 | import static io.art.tarantool.module.TarantoolModule.*; 7 | 8 | @UtilityClass 9 | public class TarantoolCommunicationFactory { 10 | public static TarantoolCommunication createTarantoolCommunication(TarantoolStorageConfiguration storageConfiguration) { 11 | String storage = storageConfiguration.getStorage(); 12 | TarantoolModuleConfiguration moduleConfiguration = tarantoolModule().configuration(); 13 | return new TarantoolCommunication(moduleConfiguration.storageRegistry(storage), moduleConfiguration); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/factory/TarantoolNameFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.factory; 2 | 3 | import io.art.meta.model.*; 4 | import lombok.experimental.*; 5 | import org.msgpack.value.*; 6 | import static io.art.core.normalizer.ClassIdentifierNormalizer.*; 7 | import static org.msgpack.value.ValueFactory.*; 8 | 9 | @UtilityClass 10 | public class TarantoolNameFactory { 11 | public static ImmutableStringValue spaceName(MetaClass type) { 12 | return newString(idByDash(type.definition().type())); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/factory/TarantoolRequestContentFactory.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.factory; 2 | 3 | import lombok.experimental.*; 4 | import org.msgpack.value.*; 5 | import static io.art.core.factory.MapFactory.*; 6 | import static io.art.tarantool.constants.TarantoolModuleConstants.AuthenticationMechanism.*; 7 | import static io.art.tarantool.constants.TarantoolModuleConstants.ProtocolConstants.*; 8 | import static org.msgpack.value.ValueFactory.*; 9 | import java.util.*; 10 | 11 | @UtilityClass 12 | public class TarantoolRequestContentFactory { 13 | public static Value authenticationRequest(String username, byte[] password) { 14 | Map request = map(2); 15 | request.put(IPROTO_USER_NAME, newString(username)); 16 | request.put(IPROTO_AUTH_DATA, newArray(CHAP_SHA1, newBinary(password))); 17 | return newMap(request); 18 | } 19 | 20 | public static Value callRequest(ImmutableStringValue function, ArrayValue arguments) { 21 | Map body = map(2); 22 | body.put(IPROTO_FUNCTION_NAME, function); 23 | body.put(IPROTO_TUPLE, arguments); 24 | return newMap(body); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/model/TarantoolFormatConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.tarantool.constants.TarantoolModuleConstants.*; 5 | import lombok.*; 6 | import lombok.experimental.*; 7 | import java.util.*; 8 | 9 | @Public 10 | @Builder 11 | @Getter 12 | @Accessors(fluent = true) 13 | public class TarantoolFormatConfiguration { 14 | @Singular("format") 15 | private final Map format; 16 | } 17 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/model/TarantoolHeader.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.model; 2 | 3 | import lombok.*; 4 | import org.msgpack.value.*; 5 | 6 | @Getter 7 | @AllArgsConstructor 8 | public class TarantoolHeader { 9 | private final IntegerValue syncId; 10 | private final IntegerValue code; 11 | } 12 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/model/TarantoolReceiver.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.model; 2 | 3 | import lombok.*; 4 | import org.msgpack.value.Value; 5 | import org.msgpack.value.*; 6 | import reactor.core.publisher.*; 7 | import java.util.function.*; 8 | 9 | @Getter 10 | @AllArgsConstructor 11 | public class TarantoolReceiver { 12 | private final IntegerValue id; 13 | private final Sinks.One sink; 14 | private final Consumer onChunk; 15 | } 16 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/model/TarantoolResponse.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.model; 2 | 3 | import lombok.*; 4 | import org.msgpack.value.Value; 5 | import org.msgpack.value.*; 6 | import static io.art.tarantool.constants.TarantoolModuleConstants.ProtocolConstants.*; 7 | 8 | @Getter 9 | @ToString 10 | public class TarantoolResponse { 11 | private final TarantoolHeader header; 12 | private final boolean error; 13 | private final boolean chunk; 14 | private Value body; 15 | 16 | public TarantoolResponse(TarantoolHeader header, Value body) { 17 | IntegerValue code = header.getCode(); 18 | this.header = header; 19 | this.error = !code.equals(IPROTO_CHUNK) && !code.equals(IPROTO_OK); 20 | this.chunk = code.equals(IPROTO_CHUNK); 21 | this.body = body; 22 | } 23 | 24 | public TarantoolResponse(TarantoolHeader header) { 25 | IntegerValue code = header.getCode(); 26 | this.header = header; 27 | this.error = !code.equals(IPROTO_CHUNK) && !code.equals(IPROTO_OK); 28 | this.chunk = code.equals(IPROTO_CHUNK); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/model/TarantoolSpaceConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.model; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.tarantool.constants.TarantoolModuleConstants.*; 5 | import lombok.*; 6 | import lombok.experimental.*; 7 | import static io.art.core.normalizer.ClassIdentifierNormalizer.idByDash; 8 | 9 | @Public 10 | @Builder 11 | @Getter 12 | @Accessors(fluent = true) 13 | public class TarantoolSpaceConfiguration { 14 | private final String name; 15 | private final Boolean ifNotExists; 16 | private final TarantoolFormatConfiguration format; 17 | private final Engine engine; 18 | private final Integer fieldCount; 19 | private final Integer id; 20 | private final Boolean local; 21 | private final Boolean sync; 22 | private final Boolean temporary; 23 | private final String user; 24 | 25 | public static TarantoolSpaceConfigurationBuilder spaceFor(Class type) { 26 | return TarantoolSpaceConfiguration.builder().name(idByDash(type)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/registry/TarantoolSubscriptionRegistry.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.registry; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.core.model.*; 5 | import io.art.core.property.*; 6 | import io.art.tarantool.model.*; 7 | import lombok.*; 8 | import static io.art.core.checker.NullityChecker.*; 9 | import java.util.function.*; 10 | 11 | @RequiredArgsConstructor 12 | public class TarantoolSubscriptionRegistry { 13 | private final LazyProperty> subscriptions; 14 | 15 | public TarantoolSubscription get(ServiceMethodIdentifier method) { 16 | return subscriptions.get().get(method); 17 | } 18 | 19 | public void forEach(Consumer consumer) { 20 | subscriptions.get().values().forEach(consumer); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tarantool/src/main/java/io/art/tarantool/state/TarantoolModuleState.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.state; 2 | 3 | 4 | import io.art.core.collection.*; 5 | import io.art.core.model.*; 6 | import io.art.core.module.*; 7 | import io.art.core.property.*; 8 | import io.art.server.method.*; 9 | import io.art.tarantool.model.*; 10 | import reactor.core.publisher.*; 11 | import static io.art.core.checker.NullityChecker.*; 12 | import static io.art.core.factory.MapFactory.*; 13 | import static io.art.tarantool.module.TarantoolModule.*; 14 | import java.util.*; 15 | 16 | public class TarantoolModuleState implements ModuleState { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /tarantool/src/test/java/io/art/tarantool/test/lock/TestTarantoolLocker.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.test.lock; 2 | 3 | import java.util.concurrent.locks.*; 4 | 5 | public class TestTarantoolLocker { 6 | private final static ReentrantLock afterLock = new ReentrantLock(); 7 | 8 | public static void lock() { 9 | afterLock.lock(); 10 | } 11 | 12 | public static void unlock() { 13 | afterLock.unlock(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tarantool/src/test/java/io/art/tarantool/test/model/OtherSpace.java: -------------------------------------------------------------------------------- 1 | package io.art.tarantool.test.model; 2 | 3 | import lombok.*; 4 | 5 | @Value 6 | @Builder(toBuilder = true) 7 | @AllArgsConstructor 8 | public class OtherSpace { 9 | int key; 10 | String value; 11 | int number; 12 | } 13 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-shard-1-master.lua: -------------------------------------------------------------------------------- 1 | local current = os.getenv("PWD") or io.popen("cd"):read() 2 | local temp = os.getenv("TMPDIR") or "/tmp" 3 | local cfg = { 4 | background = true, 5 | work_dir = temp .. "/tarantool/test-shard-1-master", 6 | pid_file = current .. "/test-shard-1-master.pid", 7 | bucket_count = 2, 8 | log = "file:" .. current .. "/test-shard-1-master.log", 9 | election_mode = "candidate", 10 | replication_connect_quorum = 0, 11 | memtx_use_mvcc_engine = true, 12 | replication_synchro_quorum = 2, 13 | sharding = require("test-sharding") 14 | } 15 | 16 | local initializer = require("test-shard-initializer") 17 | require("art-tarantool") 18 | vshard = require('vshard') 19 | vshard.storage.cfg(cfg, '8a274925-a26d-47fc-9e1b-af88ce939412') 20 | require("art.storage").initialize() 21 | initializer() 22 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-shard-1-replica.lua: -------------------------------------------------------------------------------- 1 | local current = os.getenv("PWD") or io.popen("cd"):read() 2 | local temp = os.getenv("TMPDIR") or "/tmp" 3 | local cfg = { 4 | background = true, 5 | work_dir = temp .. "/tarantool/test-shard-1-replica", 6 | pid_file = current .. "/test-shard-1-replica.pid", 7 | bucket_count = 2, 8 | log = "file:" .. current .. "/test-shard-1-replica.log", 9 | election_mode = "candidate", 10 | replication_connect_quorum = 0, 11 | memtx_use_mvcc_engine = true, 12 | replication_synchro_quorum = 2, 13 | sharding = require("test-sharding") 14 | } 15 | 16 | local initializer = require("test-shard-initializer") 17 | require("art-tarantool") 18 | vshard = require('vshard') 19 | vshard.storage.cfg(cfg, 'ce1f21d6-a7e3-11ec-b909-0242ac120002') 20 | require("art.storage").initialize() 21 | initializer() 22 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-shard-2-master.lua: -------------------------------------------------------------------------------- 1 | local current = os.getenv("PWD") or io.popen("cd"):read() 2 | local temp = os.getenv("TMPDIR") or "/tmp" 3 | local cfg = { 4 | background = true, 5 | work_dir = temp .. "/tarantool/test-shard-2-master", 6 | pid_file = current .. "/test-shard-2-master.pid", 7 | bucket_count = 2, 8 | log = "file:" .. current .. "/test-shard-2-master.log", 9 | election_mode = "candidate", 10 | replication_connect_quorum = 0, 11 | memtx_use_mvcc_engine = true, 12 | replication_synchro_quorum = 2, 13 | sharding = require("test-sharding") 14 | } 15 | 16 | local initializer = require("test-shard-initializer") 17 | require("art-tarantool") 18 | vshard = require('vshard') 19 | vshard.storage.cfg(cfg, '1e02ae8a-afc0-4e91-ba34-843a356b8ed7') 20 | require("art.storage").initialize() 21 | initializer() 22 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-shard-2-replica.lua: -------------------------------------------------------------------------------- 1 | local current = os.getenv("PWD") or io.popen("cd"):read() 2 | local temp = os.getenv("TMPDIR") or "/tmp" 3 | local cfg = { 4 | background = true, 5 | work_dir = temp .. "/tarantool/test-shard-2-replica", 6 | pid_file = current .. "/test-shard-2-replica.pid", 7 | bucket_count = 2, 8 | log = "file:" .. current .. "/test-shard-2-replica.log", 9 | election_mode = "candidate", 10 | replication_connect_quorum = 0, 11 | memtx_use_mvcc_engine = true, 12 | replication_synchro_quorum = 2, 13 | sharding = require("test-sharding") 14 | } 15 | 16 | local initializer = require("test-shard-initializer") 17 | require("art-tarantool") 18 | vshard = require('vshard') 19 | vshard.storage.cfg(cfg, 'bd13c3f6-a7e3-11ec-b909-0242ac120002') 20 | require("art.storage").initialize() 21 | initializer() 22 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-shard-initializer.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | box.once("main", function() 3 | testChannel = function() 4 | box.session.push("test") 5 | box.session.push("test") 6 | end 7 | 8 | testMapper = function(data) 9 | return data[16] .. " - mapped" 10 | end 11 | 12 | testFilter = function(data) 13 | return data[9] > 3 14 | end 15 | 16 | if not box.cfg.read_only then 17 | box.schema.user.create('username', { password = 'password', if_not_exists = true }) 18 | box.schema.user.grant('username', 'read,write,execute,create,alter,drop', 'universe', nil, { if_not_exists = true }) 19 | box.schema.func.create("testChannel", { if_not_exists = true }) 20 | box.schema.func.create("testMapper", { if_not_exists = true }) 21 | box.schema.func.create("testFilter", { if_not_exists = true }) 22 | end 23 | end) 24 | end 25 | -------------------------------------------------------------------------------- /tarantool/src/test/resources/test-sharding.lua: -------------------------------------------------------------------------------- 1 | return { 2 | ['cbf06940-0790-498b-948d-042b62cf3d29'] = { 3 | replicas = { 4 | ['8a274925-a26d-47fc-9e1b-af88ce939412'] = { 5 | uri = 'username:password@127.0.0.1:3303', 6 | name = 'test-shard-1-master', 7 | master = true 8 | }, 9 | ['ce1f21d6-a7e3-11ec-b909-0242ac120002'] = { 10 | uri = 'username:password@127.0.0.1:3304', 11 | name = 'test-shard-1-replica', 12 | master = false 13 | }, 14 | }, 15 | }, 16 | ['ac522f65-aa94-4134-9f64-51ee384f1a54'] = { 17 | replicas = { 18 | ['1e02ae8a-afc0-4e91-ba34-843a356b8ed7'] = { 19 | uri = 'username:password@127.0.0.1:3305', 20 | master = true, 21 | name = 'test-shard-2-master' 22 | }, 23 | ['bd13c3f6-a7e3-11ec-b909-0242ac120002'] = { 24 | uri = 'username:password@127.0.0.1:3306', 25 | name = 'test-shard-2-replica', 26 | master = false 27 | }, 28 | }, 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /tests/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | dependencies { 20 | api(project(":core")) 21 | api(project(":meta")) 22 | implementation(project(":logging")) 23 | } 24 | -------------------------------------------------------------------------------- /tests/src/main/java/io/art/tests/Tests.java: -------------------------------------------------------------------------------- 1 | package io.art.tests; 2 | 3 | import io.art.core.annotation.*; 4 | 5 | @Public 6 | public interface Tests { 7 | default void setup() { 8 | 9 | } 10 | 11 | default void beforeTest() { 12 | 13 | } 14 | 15 | default void afterTest() { 16 | 17 | } 18 | 19 | default void cleanup() { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/src/main/java/io/art/tests/configuration/TestSuitConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.art.tests.configuration; 2 | 3 | import io.art.core.collection.*; 4 | import io.art.meta.invoker.*; 5 | import io.art.meta.model.*; 6 | import io.art.tests.*; 7 | import lombok.*; 8 | 9 | @Getter 10 | @Builder 11 | public class TestSuitConfiguration { 12 | private final MetaClass definition; 13 | private final MetaMethodInvoker setupInvoker; 14 | private final MetaMethodInvoker beforeTestInvoker; 15 | private final MetaMethodInvoker cleanupInvoker; 16 | private final MetaMethodInvoker afterTestInvoker; 17 | private final ImmutableMap tests; 18 | 19 | @Getter 20 | @Builder 21 | public static class TestConfiguration { 22 | private final MetaMethodInvoker testInvoker; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/src/main/java/io/art/tests/constants/TestsModuleConstants.java: -------------------------------------------------------------------------------- 1 | package io.art.tests.constants; 2 | 3 | public interface TestsModuleConstants { 4 | interface Methods { 5 | String SETUP_METHOD_NAME = "setup"; 6 | String CLEANUP_METHOD_NAME = "cleanup"; 7 | String BEFORE_TEST_METHOD_NAME = "beforeTest"; 8 | String AFTER_TEST_METHOD_NAME = "afterTest"; 9 | String TEST_METHOD_PREFIX = "test"; 10 | } 11 | 12 | interface Messages { 13 | String TEST_INVOCATION_MESSAGE = "Test ''{0}''"; 14 | String TEST_COMPLETED_MESSAGE = "Test ''{0}'' completed"; 15 | String TEST_FAILED_MESSAGE = "Test ''{0}'' failed:\n{1}"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/src/main/java/io/art/tests/module/TestsActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.tests.module; 20 | 21 | import io.art.core.annotation.*; 22 | import io.art.core.module.*; 23 | import lombok.experimental.*; 24 | import static io.art.core.module.ModuleActivator.*; 25 | import java.util.function.*; 26 | 27 | @Public 28 | @UtilityClass 29 | public class TestsActivator { 30 | public ModuleActivator tests(UnaryOperator initializer) { 31 | return module(TestsModule.class, TestsModule::new, () -> initializer.apply(new TestsInitializer())); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /transport/src/main/java/io/art/transport/exception/UnsupportedMimeTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.transport.exception; 20 | 21 | import io.art.core.mime.*; 22 | 23 | public class UnsupportedMimeTypeException extends RuntimeException { 24 | public UnsupportedMimeTypeException(MimeType type) { 25 | super(type.toString()); 26 | } 27 | 28 | public UnsupportedMimeTypeException(String message) { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /transport/src/main/java/io/art/transport/extensions/TransportExtensions.java: -------------------------------------------------------------------------------- 1 | package io.art.transport.extensions; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.json.*; 5 | import io.art.yaml.*; 6 | import lombok.experimental.*; 7 | import static io.art.core.checker.ModuleChecker.*; 8 | import static io.art.meta.Meta.*; 9 | import static io.art.meta.model.TypedObject.*; 10 | 11 | @Public 12 | @UtilityClass 13 | public class TransportExtensions { 14 | public static String toPrettyString(Object data) { 15 | return withMeta() && findDeclaration(data.getClass()).isPresent() 16 | ? withYaml() ? Yaml.yaml().writer().writeToString(typed(declaration(data.getClass()).definition(), data)) 17 | : withJson() ? Json.json().writer().writeToString(typed(declaration(data.getClass()).definition(), data)) 18 | : data.toString() : data.toString(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /transport/src/main/java/io/art/transport/module/TransportActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.transport.module; 20 | 21 | import io.art.core.annotation.*; 22 | import io.art.core.module.*; 23 | import lombok.experimental.*; 24 | import static io.art.core.module.ModuleActivator.*; 25 | 26 | @Public 27 | @UtilityClass 28 | public class TransportActivator { 29 | public static ModuleActivator transport() { 30 | return module(TransportModule.class, TransportModule::new); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /yaml/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | 20 | dependencies { 21 | 22 | api(project(":core")) 23 | api(project(":meta")) 24 | 25 | val jacksonVersion: String by project 26 | api("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", jacksonVersion) 27 | api("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) 28 | api("com.fasterxml.jackson.core", "jackson-databind", jacksonVersion) 29 | 30 | testImplementation(testFixtures(project(":meta"))) 31 | } 32 | -------------------------------------------------------------------------------- /yaml/src/main/java/io/art/yaml/Yaml.java: -------------------------------------------------------------------------------- 1 | package io.art.yaml; 2 | 3 | import io.art.core.annotation.*; 4 | import io.art.yaml.descriptor.*; 5 | import lombok.*; 6 | import lombok.experimental.*; 7 | import static io.art.yaml.module.YamlModule.*; 8 | import static lombok.AccessLevel.*; 9 | 10 | @Public 11 | @UtilityClass 12 | public class Yaml { 13 | private final static Provider provider = new Provider(); 14 | 15 | public static Provider yaml() { 16 | return provider; 17 | } 18 | 19 | @NoArgsConstructor(access = PRIVATE) 20 | public static class Provider { 21 | public YamlReader reader() { 22 | return yamlModule().configuration().getReader(); 23 | } 24 | 25 | public YamlWriter writer() { 26 | return yamlModule().configuration().getWriter(); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /yaml/src/main/java/io/art/yaml/exception/YamlException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.yaml.exception; 20 | 21 | public class YamlException extends RuntimeException { 22 | public YamlException(String message) { 23 | super(message); 24 | } 25 | 26 | public YamlException(Throwable throwable) { 27 | super(throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /yaml/src/main/java/io/art/yaml/module/YamlActivator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ART 3 | * 4 | * Copyright 2019-2022 ART 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.art.yaml.module; 20 | 21 | import io.art.core.module.*; 22 | import lombok.experimental.*; 23 | import static io.art.core.module.ModuleActivator.*; 24 | 25 | @UtilityClass 26 | public class YamlActivator { 27 | public ModuleActivator yaml() { 28 | return module(YamlModule.class, YamlModule::new); 29 | } 30 | } 31 | --------------------------------------------------------------------------------