public class ServerInfo extends Object
ServerInfo
object using the method build(String, String)
.
Example
ServerInfo info = ServerInfo.build();The server name and version will be fetched from the runtime properties:
Environment.DISTRIBUTION_NAME
and
Environment.DISTRIBUTION_VERSION
If you want to use another name and version just call
build(String, String)
instead to build your server information.
After building a ServerInfo
object you can start browsing the bundles deployed on the server by calling
getBundles()
or fetch a specific bundle given its symbolic name getBundle(String)
.
To write down the server information as XML use toXML(Writer)
and to read it back use
fromXML(Reader)
.
Example:
ServerInfo info = ServerInfo.build(); BundleInfo binfo =info.getBundle("org.nuxeo.runtime"); System.out.println("Bundle Id: "+binfo.getBundleId()); System.out.println("File Name: "+binfo.getFileName()); System.out.println("Manifest: "+ binfo.getManifest()); for (ComponentInfo cinfo : binfo.getComponents()) { System.out.println("Component: "+cinfo.getName()); System.out.println(cinfo.getDocumentation()); // find extension points provided by this component for (ExtensionPointInfo xpi : cinfo.getExtensionPoints()) { System.out.println("Extension point: "+xpi.getName()); System.out.println("Accepted contribution classes: "+Arrays.asList(xpi.getTypes())); // find contributed extensions to this extension point: } // find contribution provided by this component for (ExtensionInfo xi : cinfo.getExtensions()) { System.out.println("Extension: "+xi.getId()+" to "+xi.getExtensionPoint()); System.out.println(xi.getDocumentation()); ... } }
Modifier and Type | Field and Description |
---|---|
protected List<Class<?>> |
allSpi |
protected Map<String,BundleInfoImpl> |
bundles |
protected static DocumentBuilderFactory |
documentBuilderFactory |
static String |
META_INF_MANIFEST_MF |
protected String |
name |
static String |
POM_PROPERTIES |
static String |
POM_XML |
protected String |
version |
protected static XPathFactory |
xpathFactory |
Constructor and Description |
---|
ServerInfo(String name,
String version) |
Modifier and Type | Method and Description |
---|---|
void |
addBundle(BundleInfoImpl bundle) |
void |
addBundle(Collection<BundleInfoImpl> someBundles) |
static ServerInfo |
build() |
static ServerInfo |
build(String name,
String version) |
protected static BundleInfoImpl |
computeBundleInfo(org.osgi.framework.Bundle bundle) |
static ServerInfo |
fromXML(File file) |
static ServerInfo |
fromXML(Reader reader) |
List<Class<?>> |
getAllSpi() |
BundleInfoImpl |
getBundle(String id) |
Collection<BundleInfoImpl> |
getBundles() |
String |
getName() |
protected static List<Class<?>> |
getSPI(Class<?> klass) |
String |
getVersion() |
void |
toXML(Writer writer) |
public static final String META_INF_MANIFEST_MF
public static final String POM_XML
public static final String POM_PROPERTIES
protected static final DocumentBuilderFactory documentBuilderFactory
protected static final XPathFactory xpathFactory
protected final Map<String,BundleInfoImpl> bundles
public ServerInfo(String name, String version)
public String getVersion()
public Collection<BundleInfoImpl> getBundles()
public void addBundle(BundleInfoImpl bundle)
public void addBundle(Collection<BundleInfoImpl> someBundles)
public BundleInfoImpl getBundle(String id)
public static ServerInfo build()
protected static BundleInfoImpl computeBundleInfo(org.osgi.framework.Bundle bundle)
public static ServerInfo build(String name, String version)
public void toXML(Writer writer) throws IOException
IOException
public static ServerInfo fromXML(File file) throws IOException
IOException
public static ServerInfo fromXML(Reader reader)
Copyright © 2015 Nuxeo SA. All rights reserved.