code: public void process() {
  		try {
  			Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources("META-INF/persistence.xml");
  			XMLInputFactory factory = XMLInputFactory.newInstance();
  			List<String> persistenceUnits = new ArrayList<String>();
  			
  			while (urls.hasMoreElements()) {
  				URL url = urls.nextElement();
  				XMLStreamReader reader = factory.createXMLStreamReader(url.openStream());
  				
  				while (reader.hasNext()) {
  					if (reader.next() == XMLStreamConstants.START_ELEMENT 
  							&& reader.getName().getLocalPart().equals("persistence-unit")) {
  						for (int i = 0; i < reader.getAttributeCount(); i++) {
  							if (reader.getAttributeLocalName(i).equals("name")) {
  								persistenceUnits.add(reader.getAttributeValue(i));
  								break;
  							}
  						}
  					}
  				}
  			}
  			
  			this.persistenceUnits = persistenceUnits;
  		} catch (Exception e) {
  			logger.error("Failed to parse persistence.xml", e);
  		}
  	}
docs: Parses persistence.xml files on the current ClassLoader's search path
  entries and detects persistence unit declarations from them.