Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bnd plugin validating that the OSGi metadata complies with certain namespacing rules

NotificationsYou must be signed in to change notification settings

Netcentric/bundle-namespace-validators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusLicenseMaven CentralSonarCloud Quality Gate StatusSonarCloud Coverage

Overview

ABnd plugin that validates OSGi bundle metadata compliance with configurable namespacing rules. This plugin helps ensure consistent naming conventions and organizational standards across OSGi bundles in enterprise projects. It validates the following aspects of an OSGi bundle

Features

Export Package

Validates that all exported packages match a specified regular expression pattern.

Bundle Symbolic Name

Ensures Bundle-SymbolicName headers conform to naming conventions, with support for parameter handling (e.g.,singleton:=true).

DS Component Provided Services

Validates that Declarative Services components only provide services whose fully qualified class names match specified patterns.

Implicitly Allowed Services

In addition to explicitly configured patterns, the following services are always allowed by default because they are known to support multi-tenancy or are unlikely to cause namespace clashes:

  • javax.servlet.Servlet
  • jakarta.servlet.Servlet
  • javax.servlet.Filter
  • jakarta.servlet.Filter
  • org.apache.sling.api.adapter.AdapterFactory
  • org.apache.sling.rewriter.TransformerFactory
  • com.adobe.granite.workflow.exec.WorkflowProcess
  • com.day.cq.workflow.exec.WorkflowProcess
  • org.apache.sling.auth.core.spi.AuthenticationHandler

HTTP/Servlet Whiteboard

For DS components implementingjavax.servlet.Servlet orjakarta.servlet.Servlet, validates

  • osgi.http.whiteboard.servlet.pattern - Servlet pattern

For DS components implementingjavax.servlet.Filter orjakarta.servlet.Filter, validates

  • osgi.http.whiteboard.filter.pattern - Servlet filter pattern

Sling Servlet/Filter

For DS components implementingjavax.servlet.Servlet orjakarta.servlet.Servlet, validates:

  • sling.servlet.paths - Servlet path patterns
  • sling.servlet.resourceTypes - Resource type patterns
  • sling.servlet.resourceSuperType - Resource super type patterns

For DS components implementingjavax.servlet.Filter orjakarta.servlet.Filter, validates:

  • sling.filter.pattern - Servlet filter patterns
  • sling.filter.resourceTypes - Resource type patterns

Sling Authentication Handler

For DS components implementingorg.apache.sling.auth.core.spi.AuthenticationHandler validates propertypath.

Configuration

The configuration differs slightly depending on which Maven plugin is being used.In generalBnd's -plugin instruction is being used.

Configuration Parameters

ParameterTypeDescription
allowedExportPackagePatternsPattern[]Regular expression(s) for validating exported package names
allowedBundleSymbolicNamePatternsPattern[]Regular expression(s) for validating Bundle-SymbolicName header
allowedServiceClassPatternsPattern[]Regular expression(s) for validating provided service FQCNs of DS components
allowedHttpWhiteboardServletPatternsPattern[]Regular expression(s) for validating HTTP Whiteboard servlet patterns (osgi.http.whiteboard.servlet.pattern)
allowedHttpWhiteboardFilterPatternsPattern[]Regular expression(s) for validating HTTP Whiteboard filter patterns (osgi.http.whiteboard.filter.pattern)
allowedSlingServletPathsPatternsPattern[]Regular expression(s) for validating Sling servlet paths (sling.servlet.paths)
allowedSlingServletResourceTypesPatternsPattern[]Regular expression(s) for validating Sling servlet resource types (sling.servlet.resourceTypes)
allowedSlingServletResourceSuperTypePatternsPattern[]Regular expression(s) for validating Sling servlet resource super types (sling.servlet.resourceSuperType)
allowedSlingFilterPatternsPattern[]Regular expression(s) for validating Sling filter patterns (sling.filter.pattern)
allowedSlingFilterResourceTypesPatternsPattern[]Regular expression(s) for validating Sling filter resource types (sling.filter.resourceTypes)
allowedSlingAuthenticationHandlerPathPatternsPattern[]Regular expression(s) for validating Sling Authentication Handler's path property (path)

Each parameter may take multipleregular expression patterns separated by comma. That makes the comma itself unusable within the regular expression pattern itself, however this shouldn't be necessary there.All parameters are optional. If not set the according property/name/header is not validated.

Usage

In general you add this artifact as plugin dependency to the Maven plugin. Then you can configure with the options outlined above.

Example with bnd-maven-plugin Configuration Example (in POM)

<plugin>    <groupId>biz.aQute.bnd</groupId>    <artifactId>bnd-maven-plugin</artifactId>    <version>7.1.0</version>    <extensions>true</extensions>    <configuration>        <bnd><![CDATA[            Bundle-Name: My OSGi Bundle            Bundle-SymbolicName: com.mycompany.bundles.mybundle            Export-Package: \                com.mycompany.api.*,\                com.mycompany.services.*            -plugin.namespace: biz.netcentric.osgi.bnd.NamespaceValidatorsPlugin; \                allowedExportPackagePattern="com\\.mycompany\\.myproject\\..**"; \                allowedBundleSymbolicNamePatterns="com\\.mycompany\\.bundles\\..*"; \                allowedServiceClassPatterns="com\\.mycompany\\.myproject\\..*"; \                allowedSlingServletPathsPattern="/bin/myproject/.*"; \                allowedSlingServletResourceTypesPatterns="/apps/myproject/.*"; \                allowedSlingServletResourceSuperTypePattern="/apps/myproject/.*";]]></bnd>    </configuration>    <dependencies>        <dependency>            <groupId>biz.netcentric.osgi.bnd</groupId>            <artifactId>bundle-namespace-validators</artifactId>            <version>1.0.0</version>        </dependency>    </dependencies></plugin>

Requirements

  • Java 8 or higher (builds with Java 21, targets Java 8)
  • Maven 3.9.0 or higher
  • Bnd 6.0.0 or higher (i.e.bnd-maven-plugin 6.0.0+ ormaven-bundle-plugin 5.1.4+)

License

This project is licensed under the Eclipse Public License 2.0 - see theLICENSE for details.

Related Projects

About

Bnd plugin validating that the OSGi metadata complies with certain namespacing rules

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp