if (object == null)
throw new com.sun.star.lang.IllegalArgumentException(
"The given object must not be null."
);
XServiceInfo xServiceInfo =
(XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, object);
if (xServiceInfo == null)
throw new com.sun.star.lang.IllegalArgumentException(
"The given object does not implement the XServiceInfo interface."
);
XSingleServiceFactory xSingleServiceFactory =
(XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, object);
if (xSingleServiceFactory == null)
throw new com.sun.star.lang.IllegalArgumentException(
"The given object does not implement the XSingleServiceFactory interface."
);
if ( factoriesByImplNames.remove( xServiceInfo.getImplementationName() ) == null )
throw new com.sun.star.container.NoSuchElementException(
xServiceInfo.getImplementationName() +
" is not registered as an implementation."
);
String[] serviceNames = xServiceInfo.getSupportedServiceNames();
for ( int i=0; i<serviceNames.length; i++ ) {
if ( factoriesByServiceNames.containsKey( serviceNames[i] ) ) {
java.util.Vector vec = (java.util.Vector) factoriesByServiceNames.get(serviceNames[i]);
if ( !vec.removeElement(object) )
System.err.println("The implementation " + xServiceInfo.getImplementationName() +
" is not registered for the service " + serviceNames[i] + " - ignoring!");
if ( vec.isEmpty() ) // remove the vector if no implementations aviable for the service
factoriesByServiceNames.remove( serviceNames[i] );
}