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,BundleInfo> |
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) |
ServerInfo(String name,
String version,
Set<BundleInfo> bundles) |
Modifier and Type | Method and Description |
---|---|
void |
addBundle(BundleInfo bundle) |
void |
addBundle(Collection<BundleInfo> 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() |
BundleInfo |
getBundle(String id) |
Collection<BundleInfo> |
getBundles() |
String |
getName() |
protected static List<Class<?>> |
getSPI(Class<?> klass) |
String |
getVersion() |
protected static boolean |
isServiceOverriden(RegistrationInfo ri,
String serviceName) |
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,BundleInfo> bundles
public ServerInfo(String name, String version)
public ServerInfo(String name, String version, Set<BundleInfo> bundles)
public String getVersion()
public Collection<BundleInfo> getBundles()
public void addBundle(BundleInfo bundle)
public void addBundle(Collection<BundleInfo> someBundles)
public BundleInfo getBundle(String id)
public static ServerInfo build()
protected static BundleInfoImpl computeBundleInfo(org.osgi.framework.Bundle bundle)
public static ServerInfo build(String name, String version)
protected static boolean isServiceOverriden(RegistrationInfo ri, String serviceName)
public void toXML(Writer writer) throws IOException
IOException
public static ServerInfo fromXML(File file) throws IOException
IOException
public static ServerInfo fromXML(Reader reader)
Copyright © 2018 Nuxeo. All rights reserved.