📦 Project no longer maintained
See model-graph-tools for updates.
This repository contains
- a command line tool which reads the management model from a WildFly instance and stores it as a graph in a Neo4j database
- docker images with graph databases for the last three WildFly versions
- setup to use the graph databases on OpenShift
This graph is used to store the management model:
There are six main nodes in the database:
-
Resource
The resource node holds the fully qualified address and the name of the resource. In most cases the name of a resource is the resource type. For singleton resources the name consists of the type and the name:
Address Name /subsystem=datasources/data-source=* data-source /subsystem=mail/mail-session=default/server=imap server=imap There's a
singletonflag you can use to explicitly query for (non-)singleton resources. Child resources have aCHILD_OFrelationship with their parent. If a resource declares a capability, there's aDECLARES_CAPABILITYrelationship. Finally the resource has aHAS_ATTRIBUTErelationship with its attributes and aPROVIDESrelationship with its operations. -
Attribute
The attribute node holds most of the attribute's metadata such as type, required, nillable or storage. Attributes can have relationships to other attributes of the same resource. This is modeled using the
ALTERNATIVEandREQUIRESrelationship. Finally attributes which reference a capability have aREFERENCES_CAPABILITYrelation. -
Operation
The operation node holds information about an operation. Global operations are stored only once (except the add operation). Use the flag
globalto distinguish between global and resource dependent operations. Operations have an optionalreturnandvalue-typeproperty. If the operation accepts request properties, there's anACCEPTSrelationship with its parameters. -
Parameter
The parameter node holds information about the request properties. The properties and relationships of the parameter node are similar to the attribute node.
-
Constraint
The constraint node holds information about attribute constraints. Each constraint has a name and a type.
-
Capability
The capability node holds just the name of the capability.
In addition the database contains a Version node with information about the WildFly and management model version. See the Neo4j browser for the complete list of nodes, relations and properties.
Here are a few examples how to query the database:
Show the alternatives and requires relations of the connection-definitions resource:
MATCH g=(r:Resource)-->(:Attribute)-[:ALTERNATIVE|:REQUIRES]->(:Attribute)
WHERE r.name = "connection-definitions"
RETURN gShow all resources where's a requires relation between attributes:
MATCH g=(r:Resource)-->(:Attribute)-[:REQUIRES]->(:Attribute)
RETURN gShow all data-source resource trees:
MATCH g=(r:Resource)-[:CHILD_OF*..10]->()
WHERE r.name = "data-source"
RETURN gThe top twenty resources with lots of attributes:
MATCH (r:Resource)-[has:HAS_ATTRIBUTE]->()
RETURN r.address, COUNT(has) as attributes
ORDER BY attributes DESC
LIMIT 20List all attributes which have a capability reference to org.wildfly.network.socket-binding:
MATCH (r:Resource)-->(a:Attribute)-[:REFERENCES_CAPABILITY]->(c:Capability)
WHERE c.name = "org.wildfly.network.socket-binding"
RETURN r.address, a.nameList all attributes which match the regexp .*socket-binding.*, but do not have a capability reference
MATCH (r:Resource)-->(a:Attribute)
WHERE a.name =~ ".*socket-binding.*" AND
NOT (a)-[:REFERENCES_CAPABILITY]-()
RETURN r.address, a.nameList all attributes which are both required and nillable together with their alternatives:
MATCH (r:Resource)-->(a:Attribute)-[:ALTERNATIVE]-(alt)
WHERE a.required = true AND
a.nillable = true AND
a.storage = "configuration"
RETURN r.address, a.name, alt.nameList all attributes which are both required and nillable, but which don't have alternatives:
MATCH (r:Resource)-->(a:Attribute)
WHERE NOT (a)-[:ALTERNATIVE]-() AND
a.required = true AND
a.nillable = true AND
a.storage = "configuration"
RETURN r.address, a.nameList all attributes which are required and have a default value:
MATCH (r:Resource)-->(a:Attribute)
WHERE a.required = true AND
exists(a.default)
RETURN r.address, a.name, a.defaultList all complex attributes (i.e. attributes with a value type other than STRING):
MATCH (r:Resource)-->(a:Attribute)
WHERE exists(a.`value-type`) AND a.`value-type` = "OBJECT"
RETURN r.address, a.nameList all deprecated attributes:
MATCH (r:Resource)-->(a:Attribute)
WHERE exists(a.deprecated)
RETURN r.address, a.name, a.since
ORDER BY a.since DESCList all resources with more than five non-global operations:
MATCH (r:Resource)-[p:PROVIDES]->(o:Operation)
WHERE NOT o.global
WITH r, count(p) as operations
WHERE operations > 5
RETURN r.address, operations
ORDER BY operations DESCList all add operations with more than two required parameters:
MATCH (r:Resource)-[:PROVIDES]->(o:Operation)-[a:ACCEPTS]->(p:Parameter)
WHERE o.name = "add" AND p.required
WITH r, o, count(a) as parameters
WHERE parameters > 2
RETURN r.address, o.name, parameters
ORDER BY parameters DESCList all deprecated operation parameters:
MATCH (r:Resource)-->(o:Operation)-->(p:Parameter)
WHERE exists(p.deprecated)
RETURN r.address, o.name, p.name, p.since
ORDER BY p.since DESCShow the release and management model version:
MATCH (v:Version)
RETURN v.`release-codename` + " " + v.`release-version` as Release,
v.`management-major-version` + "." + v.`management-minor-version` + "." + v.`management-micro-version` as `Management Model Version`See https://neo4j.com/docs/cypher-refcard/current/ for a quick reference of the Cypher query language.
