@SuppressWarnings("unchecked")
	private void checkPartition(String partitionName, String dn,
			HashMap attributes) throws Exception {
		LoggerFactory.getLogger(this.getClass()).debug("Adding partition:"+partitionName+dn+attributes.toString());

		Partition apachePartition = addPartition(partitionName, dn);
		// Index some attributes on the partition
		addIndex(apachePartition, "objectClass", "ou", "uid");

		// Inject the apache root entry if it does not already exist
		try {
			directoryService.getAdminSession().lookup(
					apachePartition.getSuffixDn());
		} catch (LdapNameNotFoundException lnnfe) {
			LdapDN dnApache = new LdapDN(dn);
			ServerEntry entryApache = directoryService.newEntry(dnApache);
			Iterator<String> iter = attributes.keySet().iterator();
			while (iter.hasNext()) {
				String attributeName = (String) iter.next();
				Object value = attributes.get(attributeName);
				if (value instanceof String) {
					entryApache.add(attributeName, (String) value);
				} else {
					ArrayList<String> val = (ArrayList<String>) value;
					for (String v : val) {
						entryApache.add(attributeName, v);
					}
				}
			}
			directoryService.getAdminSession().add(entryApache);
		}
	}