public void initMetadata() throws SecurityRuntimeException {
		try {
			logger.info("init simple metadata config form: " + metadataFileLocation + "...");
			InputStream config = WebSecurity.getServletContext().getResourceAsStream(metadataFileLocation);
			SAXReader reader = new SAXReader(true);
			logger.debug("验证 websecurity-metadatas Schema ...");
			EntityResolver resolver = new EntityResolver() {
				public InputSource resolveEntity(String publicId, String systemId) {
					InputStream in = getClass().getClassLoader().getResourceAsStream(METADATAS_XSD);
					return new InputSource(in);
				}
			};
			reader.setEntityResolver(resolver);
			reader.setFeature("http://apache.org/xml/features/validation/schema", true);
			Document doc = reader.read(config);
			logger.debug("验证 websecurity-metadatas Schema 成功");
			
			List<?> resources = doc.selectNodes("//metadatas/resource");
			Map<String, Metadata> metadatas = new HashMap<String, Metadata>();
			for (Object o : resources) {
				if (o instanceof Element) {
					Element ele = (Element) o;
					String urlpattern = ele.valueOf("@urlpattern").trim();
					String access = ele.valueOf("@access").trim();
					String relation = ele.valueOf("@relation").trim();
					if(urlpattern.length() > 0 && access.length() > 0) {
						String[] arr = access.split(",");
						Collection<GrantedPrivilege> privileges = new HashSet<GrantedPrivilege>();
						for(String p : arr) {
							p = p.trim();
							if(p.length() > 0) {
								privileges.add(new GrantedPrivilegeImpl(p));
							}
						}
						Metadata metadata = new Metadata(urlpattern, privileges, relation);
						metadatas.put(urlpattern, metadata);
						if(logger.isDebugEnabled()) {
							logger.debug("resource [ " + metadata.getObject() + ", [ " + metadata.getPrivileges() + " ], " + metadata.getRelation() + "]");
						}
					}
				}
			}
			
			// write lock
			lock.writeLock().lock();
			try {
				this.metadatas = metadatas;
			} finally {
				lock.writeLock().unlock();
			}
			logger.info("init simple metadata config form: " + metadataFileLocation + " success!");
		} catch (Exception e) {
			logger.error("init simple metadata config form: " + metadataFileLocation + " error!");
			throw new SecurityRuntimeException("init simple metadata config form: " + metadataFileLocation + " error!", e);
		}
	}