code: @Override
  	public void add(Resource resource) {
  		checkNotNull(resource,"Resource cannot be null");
  		lock.writeLock().lock();
  		try {
  			checkState(find(resource.id())==null,"A resource with identifier '%s' already exists",resource.id());
  			resource.accept(
  				new ResourceVisitor() {
  					@Override
  					public void visitResource(Resource resource) {
  						InMemoryResourceRepository.this.resources.put(resource.id(),resource);
  					}
  					@Override
  					public void visitContainer(Container resource) {
  						InMemoryResourceRepository.this.containers.put(resource.id(),resource);
  					}
  				}
  			);
  		} finally {
  			lock.writeLock().unlock();
  		}
  	}
docs: {@inheritDoc}