Developer DevOps System Administrator Jahia 8.2

Import Package Checker

Question

I want to identify if any of my module / class might be using Spring 5 or any specific package/class.

Solution

A new tool interface, the OSGI Import-Package checker (JAHIA_URL//modules/tools/importPackageChecker.jsp), is now available: osgi_import_package_checker.png

It allows: 

  • searching for any Import-Package clause on the running bundles, based on a regular expression.
  • showing only Import-Package with no versions restrictions
  • providing a version to be checked, returning only Import-Package valid for the specified version.

The bundle id in the picture (102) is actually a link to the OSGI bundle page that provides the details of the bundle.


A new GraphQL API is also available, here is a query example:

query {
  admin {
    tools {
        findMatchingImportPackages(RegExp:"org\\.springframework\\..*", version: null, versionMissing: true) {
        totalCount
        bundles{
          bundleDisplayName
          matchingImportPackages
        }
      }
    }
  }
} 
 

and a result example:

{
  "data": {
    "admin": {
      "tools": {
        "findMatchingImportPackages": {
          "totalCount": 88,
          "bundles": [
            {
              "bundleDisplayName": "Forms No CSS Theme (forms-nocss-theme)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution"
              ]
            },
            {
              "bundleDisplayName": "topPages (toppages)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional",
                "org.springframework.webflow.core.collection;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Bulk create users (bulk-create-users)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional",
                "org.springframework.binding.validation;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Jahia Cloud - Threads and heap dumps provider (jahia-cloud-threads-heap-dumps-provider)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional",
                "org.springframework.webflow.core.collection;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Jahia Roles Manager (rolesmanager)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Distributed Sessions (distributed-sessions)",
              "matchingImportPackages": [
                "org.springframework.data.gemfire;resolution:=optional",
                "org.springframework.data.redis.listener;resolution:=optional",
                "org.springframework.data.redis.core;resolution:=optional",
                "org.springframework.security.core.session;resolution:=optional",
                "org.springframework.messaging;resolution:=optional",
                "org.springframework.messaging.simp;resolution:=optional",
                "org.springframework.data.mongodb.core;resolution:=optional",
                "org.springframework.data.mongodb.core.query;resolution:=optional",
                "org.springframework.web.socket;resolution:=optional",
                "org.springframework.security.core.context;resolution:=optional",
                "org.springframework.security.web.authentication.logout;resolution:=optional",
                "org.springframework.data.gemfire.client;resolution:=optional",
                "org.springframework.web.socket.config.annotation;resolution:=optional",
                "org.springframework.security.core.userdetails;resolution:=optional",
                "org.springframework.web.socket.messaging;resolution:=optional",
                "org.springframework.data.redis.serializer;resolution:=optional",
                "org.springframework.web.socket.handler;resolution:=optional",
                "org.springframework.security.web.authentication;resolution:=optional",
                "org.springframework.security.core;resolution:=optional",
                "org.springframework.data.domain;resolution:=optional",
                "org.springframework.messaging.simp.config;resolution:=optional",
                "org.springframework.data.mongodb.core.index;resolution:=optional",
                "org.springframework.web.socket.server;resolution:=optional",
                "org.springframework.data.redis.connection;resolution:=optional",
                "org.springframework.messaging.support;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Site Settings - Publication (site-settings-publication)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Forms Snippets extension (forms-snippets-extension)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution"
              ]
            },
            {
              "bundleDisplayName": "Jahia External Provider VFS (external-provider-vfs)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Jahia Tags (tags)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "ff-self-assessment (ff-self-assessment)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Academy Augmented Search UI (academy-augmented-search-ui)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Augmented Search UI (augmented-search-ui)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Full Read Only Notifier (full-read-only-notifier)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.webflow.context;resolution:=optional",
                "org.springframework.webflow.core.collection;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Brute force login protection (brute-force-login-protection)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.webflow.context;resolution:=optional",
                "org.springframework.webflow.core.collection;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Forms Core (forms-core)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution"
              ]
            },
            {
              "bundleDisplayName": "Jahia External Provider Users and Groups (external-provider-users-groups)",
              "matchingImportPackages": [
                "org.springframework.binding.message",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Jahia Database Connector (database-connector)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution"
              ]
            },
            {
              "bundleDisplayName": "Jahia External Provider UI (external-provider-ui)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.webflow.context",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Jahia User Dashboards (userDashboard)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Default Jahia Templates (default)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message"
              ]
            },
            {
              "bundleDisplayName": "Module Manager (module-manager)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.binding.validation",
                "org.springframework.webflow.context",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Jahia Site Settings (siteSettings)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.binding.validation"
              ]
            },
            {
              "bundleDisplayName": "Jahia Server Settings (serverSettings)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.binding.validation",
                "org.springframework.webflow.context",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Jahia Server Settings EE (serverSettings-ee)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.webflow.core.collection"
              ]
            },
            {
              "bundleDisplayName": "Support Token Authentication Valve (support-token-authentication-valve)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution;resolution:=optional",
                "org.springframework.binding.message;resolution:=optional"
              ]
            },
            {
              "bundleDisplayName": "Jahia Remote Publishing (remotepublish)",
              "matchingImportPackages": [
                "org.springframework.webflow.execution",
                "org.springframework.binding.message",
                "org.springframework.binding.validation",
                "org.springframework.webflow.context",
                "org.springframework.webflow.core.collection"
              ]
            }
          ]
        }
      }
    }
  }
}

Another GraphQL API, to search for a specific export package, is available:

query {
  admin {
    tools {
        findMatchingExportPackages (duplicates: false, RegExp: ".+cloud.+"){
        packages{
          packageName
          matchingExportPackages
        }
      }
    }
  }
}
 

Giving a result like this one:

{
  "data": {
    "admin": {
      "tools": {
        "findMatchingExportPackages": {
          "packages": [
            {
              "packageName": "org.jahia.community.external.cloud.factory",
              "matchingExportPackages": [
                "org.jahia.community.external.cloud.factory;uses:=\"javax.jcr,org.jahia.modules.external.admin.mount,org.jahia.services.content,org.springframework.binding.message,org.springframework.webflow.execution\";version=1.0.0 EXPOSED BY Jahia Cloud - Threads and heap dumps provider (jahia-cloud-threads-heap-dumps-provider)"
              ]
            }
          ]
        }
      }
    }
  }
}