Discovery by classpath analysis - easysoa/EasySOA GitHub Wiki
Discovery by classpath analysis
Introduction
Analyzing the classpath of an application can provide interesting information about the current state of your SOA. This tool (compatible with Java servers only) allows to extract data about which Jars have been used to deploy services on your application.
Documentation
Setup
Right now, a prototype has been made available as "easysoa-classpath-discovery-prototype". It has been tested on an Apache CXF server only, but has the potential to work on numerous Java application servers.
- Build the
easysoa-classpath-discovery-prototype
and add it to your application server as a library - [Server-dependent] Find a way to call
new EasySOAClasspathAnalysis().discover();
during your server startup (in the Apache CXF test, we added this line directly within the server initialization, but it could be easily decoupled better - choose the solution that fits best your runtime) - Launch the server, after making sure the EasySOA Registry is launched
Configuration
You can configure the discovery behavior by adding a discovery.properties
file to the root of the application's execution path. Example file:
discovery.nuxeoUrl=http://localhost:8080/nuxeo
discovery.nuxeoUsername=Administrator
discovery.nuxeoPassword=Administrator
discovery.appliImplUrl=http://localhost
discovery.appliImplTitle=My App
discovery.environment=Master
discovery.jarMatchers=*
discovery.logOnly=true
nuxeoUrl
: The URL of the EasySOA service registrynuxeoUsername
/nuxeoPassword
: The service registry credentialsenvironment
/appliImplUrl
/appliImplTitle
: Some (recommended) information about your applicationjarMatchers
: A (set of) regular expression(s), separated by a|
, that filters the watched JARs. Ex:easysoa*|nuxeo*
will only discover EasySOA and Nuxeo-related JARs.logOnly
: Retains the tool from actually sending discovery notifications to the registry (for testing/debugging purposes).
How does it work?
// Fetch the classpath JARs list
String[] classPath = System.getProperty("java.class.path").split(File.pathSeparator);
// Extract the JAR names
for (String classPathEntry : classPath) {
if (classPathEntry.endsWith(".jar")) {
...
}
}