public synchronized <I, T extends I> I register(Class<I> type, T defaults) throws InvalidTypeException, TypeFilterException, DoubleIDException, InvalidMethodException, InvocationException, ControllerPersistenceException {
	ManagedPropertiesController controller = null;
	if (!type.isInterface()) {
	    throw new InvalidTypeException("Could  not register the type " + type.getName() + " as a Managed Property. The type must be an interface");
	}
	  
	if(persistenceProvider != null){
	    controller = persistenceProvider.getController(type);
	}
	
	
	  
	  if(controller == null){
	        ArrayList<Class<? extends TypeFilter>> filters = new ArrayList<>();
		if(filterProvider != null){
		    filters.addAll(filterProvider.getFilters());
		}
	        controller = getInvocationHandler(type, defaults, filters);
	        ManagedPropertiesProvider provider = handlerFactory.getProvider(type, controller, defaults);
		validateInputTypesWithProvider(provider, controller.getAttributes(), filters);
	    try {
		provider.start();
	    } catch (Exception ex) {
		throw new InvocationException("Could not start provider: "+provider, ex);
	    }
	    
		controller.setProvider(provider);
		if(persistenceProvider != null){
		    persistenceProvider.persistController(type, controller);
		}
		logger.info("Registered "+controller);
	  }
	  
	return castToProxy(type, controller);
    }
public synchronized < I , T extends I > I register ( Class < I > type , T defaults ) throws InvalidTypeException , TypeFilterException , DoubleIDException , InvalidMethodException , InvocationException , ControllerPersistenceException { ManagedPropertiesController controller = null ; if ( ! type . isInterface ( ) ) { throw new InvalidTypeException ( "Could  not register the type " + type . getName ( ) + " as a Managed Property. The type must be an interface" ) ; } if ( persistenceProvider != null ) { controller = persistenceProvider . getController ( type ) ; } if ( controller == null ) { ArrayList < Class < ? extends TypeFilter > > filters = new ArrayList < > ( ) ; if ( filterProvider != null ) { filters . addAll ( filterProvider . getFilters ( ) ) ; } controller = getInvocationHandler ( type , defaults , filters ) ; ManagedPropertiesProvider provider = handlerFactory . getProvider ( type , controller , defaults ) ; validateInputTypesWithProvider ( provider , controller . getAttributes ( ) , filters ) ; try { provider . start ( ) ; } catch ( Exception ex ) { throw new InvocationException ( "Could not start provider: " + provider , ex ) ; } controller . setProvider ( provider ) ; if ( persistenceProvider != null ) { persistenceProvider . persistController ( type , controller ) ; } logger . info ( "Registered " + controller ) ; } return castToProxy ( type , controller ) ; }
Registers a configuration backed by the Configuration Admin. When this method is called, a {@link Proxy} object is created based on the {@code type}
provided to the method. The configuration is automatically registered as a {@link org.osgi.service.cm.ManagedService} and {@link org.osgi.service.metatype.MetaTypeProvider}.
The configuration can also be created with a Defaults object. In order to create a Defaults object, implement the Interface provided by {@code type}
and supplying an instance of that class to {@code defaults}. {@code defaults} may be null.

* Example:
SomeInterface properties = ManagedPropertiesFactory.register(SomeInterface.class, new SomeInterfaceImpl(), context);

@param <I> The return type ofs the configuration.
@param <T> The return type of the default.
@param type The type of configuration to create. The type of interface must be be annotated by
{@link dk.netdesign.common.osgi.config.annotation.Property}, and each parameter must be annotated by
{@link dk.netdesign.common.osgi.config.annotation.PropertyDefinition}
@param defaults The defaults object to create. When a configuration item is not found in the Configuration Admin, the defaults method is called.
@return A proxy representing a Configuration Admin configuration.
@throws InvalidTypeException If a method/configuration item mapping uses an invalid type.
@throws TypeFilterException If a method/configuration item mapping uses an invalid TypeMapper.
@throws DoubleIDException If a method/configuration item mapping uses an ID that is already defined.
@throws InvalidMethodException If a method/configuration violates any restriction not defined in the other exceptions.