object. */
XMultiComponentFactory xmulticomponentfactory =
xcomponentcontext.getServiceManager();
// Querying for the interface XSet on XMultiComponentFactory
XSet xsetMultiServiceFactory = ( XSet ) UnoRuntime.queryInterface(
XSet.class, xmulticomponentfactory );
// Getting the XSingleServiceFactory for the minimal component
XSingleServiceFactory xsingleservicefactoryMinimalComponent =
MinimalComponent.__getServiceFactory(
"MinimalComponent$MinimalComponentImplementation",
( XMultiServiceFactory ) UnoRuntime.queryInterface(
XMultiServiceFactory.class, xmulticomponentfactory ),
null );
// Inserting the XSingleServiceFactory into the container
xsetMultiServiceFactory.insert( xsingleservicefactoryMinimalComponent );
// Creating an instance of the minimal component
Object objectMinimalComponent =
xmulticomponentfactory.createInstanceWithContext(
"org.OpenOffice.MinimalComponent", xcomponentcontext );
XServiceInfo xserviceinfoMinimalComponent = ( XServiceInfo )
UnoRuntime.queryInterface( XServiceInfo.class,
objectMinimalComponent );
System.out.println( "\nXServiceInfo is used to get the implementation name:\n -> " +
xserviceinfoMinimalComponent.getImplementationName() +
"\nOk");
// Removing the XSingleServiceFactory of the minimal Component from the container
xsetMultiServiceFactory.remove( xsingleservicefactoryMinimalComponent );
xcomponentcontext = null;
System.exit(0);
}