return null; ConfigurationParser parser = new ConfigurationParser(m); PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader);
protected boolean startElement(String name, Attributes attrs) throws SAXException { if (currentDepth() == 1) startPersistenceUnit(attrs); else if (currentDepth() == 3 && "property".equals(name)) _info.setProperty(attrs.getValue("name"), attrs.getValue("value")); return true; }
/** * Parse resources at the given location. Searches for a * PersistenceUnitInfo with the requested name, or an OpenJPA unit if * no name given (preferring an unnamed OpenJPA unit to a named one). */ private PersistenceUnitInfoImpl parseResources(ConfigurationParser parser, List<URL> urls, String name, ClassLoader loader) throws IOException { List<PersistenceUnitInfoImpl> pinfos = new ArrayList<PersistenceUnitInfoImpl>(); for (URL url : urls) { parser.parse(url); pinfos.addAll((List<PersistenceUnitInfoImpl>) parser.getResults()); } return findUnit(pinfos, name, loader); }
return null; ConfigurationParser parser = new ConfigurationParser(m); PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader); if (pinfo == null) {
return null; ConfigurationParser parser = new ConfigurationParser(m); PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader); if (pinfo == null) {
return null; ConfigurationParser parser = new ConfigurationParser(m); PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader); if (pinfo == null) {
return null; ConfigurationParser parser = new ConfigurationParser(m); PersistenceUnitInfoImpl pinfo = parseResources(parser, urls, name, loader); if (pinfo == null) {
protected void endElement(String name) throws SAXException { if (currentDepth() == 1) { endPersistenceUnit(); _info.fromUserProperties(_map); addResult(_info); if (currentDepth() != 2) return; _info.addManagedClassName(currentText()); break; case 'e': // exclude-unlisted-classes setExcludeUnlistedClasses(currentText()); break; case 'j': if ("jta-data-source".equals(name)) _info.setJtaDataSourceName(currentText()); else { // jar-file try { _info.addJarFileName(currentText()); } catch (IllegalArgumentException iae) { throw getException(iae.getMessage()); _info.addMappingFileName(currentText()); break; case 'n': // non-jta-data-source _info.setNonJtaDataSourceName(currentText()); break; case 'p':
protected void endElement(String name) throws SAXException { if (currentDepth() == 1) { endPersistenceUnit(); _info.fromUserProperties(_map); addResult(_info); if (currentDepth() != 2) return; _info.addManagedClassName(currentText()); break; case 'e': // exclude-unlisted-classes setExcludeUnlistedClasses(currentText()); break; case 'j': if ("jta-data-source".equals(name)) _info.setJtaDataSourceName(currentText()); else { // jar-file try { _info.addJarFileName(currentText()); } catch (IllegalArgumentException iae) { throw getException(iae.getMessage()); _info.addMappingFileName(currentText()); break; case 'n': // non-jta-data-source _info.setNonJtaDataSourceName(currentText()); break; case 'p':
protected void endElement(String name) throws SAXException { if (currentDepth() == 1) { endPersistenceUnit(); _info.fromUserProperties(_map); addResult(_info); if (currentDepth() != 2) return; _info.addManagedClassName(currentText()); break; case 'e': // exclude-unlisted-classes setExcludeUnlistedClasses(currentText()); break; case 'j': if ("jta-data-source".equals(name)) _info.setJtaDataSourceName(currentText()); else { // jar-file try { _info.addJarFileName(currentText()); } catch (IllegalArgumentException iae) { throw getException(iae.getMessage()); _info.addMappingFileName(currentText()); break; case 'n': // non-jta-data-source _info.setNonJtaDataSourceName(currentText()); break; case 'p':
protected void endElement(String name) throws SAXException { if (currentDepth() == 1) { endPersistenceUnit(); _info.fromUserProperties(_map); addResult(_info); if (currentDepth() != 2) return; _info.addManagedClassName(currentText()); break; case 'e': // exclude-unlisted-classes setExcludeUnlistedClasses(currentText()); break; case 'j': if ("jta-data-source".equals(name)) _info.setJtaDataSourceName(currentText()); else { // jar-file try { _info.addJarFileName(currentText()); } catch (IllegalArgumentException iae) { throw getException(iae.getMessage()); _info.addMappingFileName(currentText()); break; case 'n': // non-jta-data-source _info.setNonJtaDataSourceName(currentText()); break; case 'p':
protected void endElement(String name) throws SAXException { if (currentDepth() == 1) { _info.fromUserProperties(_map); addResult(_info); if (currentDepth() != 2) return; _info.addManagedClassName(currentText()); case 'e': // exclude-unlisted-classes _info.setExcludeUnlistedClasses("true".equalsIgnoreCase (currentText())); break; case 'j': if ("jta-data-source".equals(name)) _info.setJtaDataSourceName(currentText()); else // jar-file _info.addJarFileName(currentText()); } catch (IllegalArgumentException iae) { throw getException(iae.getMessage()); _info.addMappingFileName(currentText()); break; case 'n': // non-jta-data-source _info.setNonJtaDataSourceName(currentText()); break; case 'p': if ("provider".equals(name))
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { List results = new ArrayList(); ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); List<URL> urls = getResourceURLs(resource, loader); if (urls != null) { for (URL url : urls) { parser.parse(url); results.addAll(getUnitNames(parser)); } } return results; } catch (IOException e) { // not all configuration files are XML; return null if unparsable return null; } }
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { List results = new ArrayList(); ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); List<URL> urls = getResourceURLs(resource, loader); if (urls != null) { for (URL url : urls) { parser.parse(url); results.addAll(getUnitNames(parser)); } } return results; } catch (IOException e) { // not all configuration files are XML; return null if unparsable return null; } }
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { List results = new ArrayList(); ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); List<URL> urls = getResourceURLs(resource, loader); if (urls != null) { for (URL url : urls) { parser.parse(url); results.addAll(getUnitNames(parser)); } } return results; } catch (IOException e) { // not all configuration files are XML; return null if unparsable return null; } }
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { List results = new ArrayList(); ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); List<URL> urls = getResourceURLs(resource, loader); if (urls != null) { for (URL url : urls) { parser.parse(url); results.addAll(getUnitNames(parser)); } } return results; } catch (IOException e) { // not all configuration files are XML; return null if unparsable return null; } }
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { ClassLoader loader = (ClassLoader) AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); List<URL> urls = getResourceURLs(resource, loader); if (urls != null) { for (URL url : urls) { parser.parse(url); } } return getUnitNames(parser); } catch (IOException e) { // not all configuration files are XML; return null if unparsable return null; } }
/** * Parse resources at the given location. Searches for a * PersistenceUnitInfo with the requested name, or an OpenJPA unit if * no name given (preferring an unnamed OpenJPA unit to a named one). */ private PersistenceUnitInfoImpl parseResources(ConfigurationParser parser, List<URL> urls, String name, ClassLoader loader) throws IOException { List<PersistenceUnitInfoImpl> pinfos = new ArrayList<PersistenceUnitInfoImpl>(); for (URL url : urls) { parser.parse(url); pinfos.addAll((List<PersistenceUnitInfoImpl>) parser.getResults()); } return findUnit(pinfos, name, loader); }
private List<String> getUnitNames(ConfigurationParser parser) { List<PersistenceUnitInfoImpl> units = parser.getResults(); List<String> names = new ArrayList<String>(); for (PersistenceUnitInfoImpl unit : units){ String provider = unit.getPersistenceProviderClassName(); // Only add the PU name if the provider it is ours or not specified. if (provider == null || provider.equals(_providerImplName)) { names.add(unit.getPersistenceUnitName()); } else { // Should trace something, but logging isn't configured yet. // Swallow. } } return names; }
private List<String> getUnitNames(ConfigurationParser parser) { List<PersistenceUnitInfoImpl> units = parser.getResults(); List<String> names = new ArrayList<String>(); for (PersistenceUnitInfoImpl unit : units){ String provider = unit.getPersistenceProviderClassName(); // Only add the PU name if the provider it is ours or not specified. if (provider == null || provider.equals(_providerImplName)) { names.add(unit.getPersistenceUnitName()); } else { // Should trace something, but logging isn't configured yet. // Swallow. } } return names; }