If property file is xml.

@param propertyFileName
@param puMetadata
@return
322086
private ClientProperties onParseXML(String propertyFileName, PersistenceUnitMetadata puMetadata)
    {
        InputStream inStream = puMetadata.getClassLoader().getResourceAsStream(propertyFileName);
        if (inStream == null)
        {
            propertyFileName = KunderaCoreUtils.resolvePath(propertyFileName);
            try
            {
                inStream = new FileInputStream(new File(propertyFileName));
            }
            catch (FileNotFoundException e)
            {
                log.warn("File {} not found, Caused by ", propertyFileName);
                return null;
            }

        }

        if (inStream != null)
        {
            xStream = getXStreamObject();
            Object o = xStream.fromXML(inStream);
            return (ClientProperties) o;
        }

        return null;
    }
142983
private static Properties loadWithNormalMode(final String propertyFilePath)
            throws Exception {

        Properties props = new Properties();
        props.load(new InputStreamReader(new FileInputStream(propertyFilePath), "utf-8"));
        return props;
    }
1033496
public static JPropertyFile getOrCreatePropertyFile(JPackage thePackage,
			String name) {
		JPropertyFile propertyFile = null;
		for (Iterator<JResourceFile> iterator = thePackage.propertyFiles(); iterator
				.hasNext() && (null == propertyFile);) {
			final JResourceFile resourceFile = (JResourceFile) iterator.next();
			if (resourceFile instanceof JPropertyFile
					&& name.equals(resourceFile.name())) {
				propertyFile = (JPropertyFile) resourceFile;
			}
		}

		if (null == propertyFile) {
			propertyFile = new JPropertyFile(name);
			thePackage.addResourceFile(propertyFile);
		}
		return propertyFile;
	}
1097512
private static boolean isFile(Node node) throws RepositoryException
   {
      if (!node.isNodeType("nt:file"))
      {
         return false;
      }
      if (!node.getNode("jcr:content").isNodeType("nt:resource"))
      {
         return false;
      }
      return true;
   }
1215767
public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException {
    try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
      if (xmlStream == null) {
        throw new IOException("File not found in classpath: " + filename);
      }
      URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
      if (schemaUrl == null) {
        throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
      }
      validateInternal(new StreamSource(xmlStream), schemaUrl);
    } catch (Exception e) {
      throw new IOException("Cannot load or parse '" + filename + "'", e);
    }
  }
610168
private String getColumnName(EntityMetadata metadata, String property) {
        MetamodelImpl metaModel =
            (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit());
        String jpaColumnName = null;

        if (property.equals(((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName())) {
            jpaColumnName = CassandraUtilities.getIdColumnName(kunderaMetadata, metadata,
                ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).getExternalProperties(),
                ((CassandraClientBase) persistenceDelegeator.getClient(metadata)).isCql3Enabled(metadata));
        } else {
            jpaColumnName = ((AbstractAttribute) metaModel.getEntityAttribute(metadata.getEntityClazz(), property))
                .getJPAColumnName();
        }
        return jpaColumnName;
    }
219418
private void writeMetaTagProperty(Node node, Hashtable properties) {

        NamedNodeMap attrs = node.getAttributes();
        String metaName = "";
        String metaContent = "";
        // look through all attribs to find the name and content attributes
        for (int i = attrs.getLength() - 1; i >= 0; i--) {
            String name = attrs.item(i).getNodeName();
            String value = attrs.item(i).getNodeValue();
            if (name.equals(ATTRIB_NAME)) {
                metaName = value;
            } else if (name.equals(ATTRIB_CONTENT)) {
                metaContent = value;
            }
        }
        // check if we have valid entries for this <META> node, store them
        // in the properties
        if ((metaName.length() > 0) && (metaContent.length() > 0)) {
            properties.put(metaName, CmsStringUtil.substitute(metaContent, "{subst}", "&#"));
        }
    }
271171
public void putPropertyMetadata(PropertyMetadata propertyMetadata) {
    String mappedName = propertyMetadata.getMappedName();
    PropertyMetadata old = propertyMetadataMap.put(mappedName, propertyMetadata);
    if (old != null) {
      String format = "Class %s has two fields, %s and %s, both mapped to the same property "
          + "name, %s";
      String message = String.format(format, clazz.getName(), old.getName(),
          propertyMetadata.getName(), mappedName);
      throw new EntityManagerException(message);
    }
  }
457316
public void read(String pu)
    {

        String propertyFileName = null;
        if (puMetadata.getProperties() != null
                && puMetadata.getProperties().containsKey(PersistenceProperties.KUNDERA_CLIENT_PROPERTY))
        {
            propertyFileName = (String) puMetadata.getProperties().get(PersistenceProperties.KUNDERA_CLIENT_PROPERTY);
        }
        if (externalProperties != null && externalProperties.containsKey(PersistenceProperties.KUNDERA_CLIENT_PROPERTY))
        {
            propertyFileName = (String) externalProperties.get(PersistenceProperties.KUNDERA_CLIENT_PROPERTY);
        }
        
        if (propertyFileName == null)
        {
            propertyFileName = puMetadata != null ? puMetadata
                    .getProperty(PersistenceProperties.KUNDERA_CLIENT_PROPERTY) : null;
        }
        if (propertyFileName != null && PropertyType.value(propertyFileName) != null
                && PropertyType.value(propertyFileName).equals(PropertyType.xml))
        {
            onXml(onParseXML(propertyFileName, puMetadata));
        }
    }
199882
private String checkProperty(String propName) throws AttributeNotSupportedException {
        final String METHODNAME = "checkProperty";
        boolean inRepos = false;
        boolean inLA = false;
        if (propName.equals(xsiType)) {
/*
 * if (trcLogger.isLoggable(Level.FINER)) {
 * trcLogger.exiting(CLASSNAME, METHODNAME, " " + propName
 * + " is defined in Repository " + repos);
 * }
 */ return repos;
        }
        inRepos = false;
        for (int i = 0; i < entityTypes.size() && !inRepos; i++) {
            inRepos = _metaDataMapper.isPropertyInRepository(propName,
                                                             entityTypes.get(i));
        }
        if (!inRepos) {
            for (int i = 0; i < entityTypes.size(); i++) {
                inLA = _metaDataMapper.isPropertyInLookAside(propName,
                                                             entityTypes.get(i));
            }
        } else {
/*
 * if (trcLogger.isLoggable(Level.FINER)) {
 * trcLogger.exiting(CLASSNAME, METHODNAME, "Property " + propName
 * + " is defined in Repository " + repos);
 * }
 */ return repos;
        }
        if (!inRepos && !inLA) {
            throw new AttributeNotSupportedException(WIMMessageKey.ATTRIBUTE_NOT_SUPPORTED, WIMMessageKey.ATTRIBUTE_NOT_SUPPORTED);
        }
/*
 * if (trcLogger.isLoggable(Level.FINER)) {
 * trcLogger.exiting(CLASSNAME, METHODNAME, "Property " + propName
 * + " is defined in Repository " + la);
 * }
 */ return la;
    }
687951
private File getFile(String xmlFilename) {

        File file = new File(m_basePath + xmlFilename);
        if (!file.exists() || !file.canRead()) {
            file = new File(xmlFilename);
        }
        return file;
    }
937411
public static boolean hasProperty(ClassNode classNode, String propertyName) {
        if(classNode == null || propertyName == null || "".equals(propertyName.trim()))
            return false;

        List properties = classNode.getProperties();
        for (Iterator i = properties.iterator(); i.hasNext();) {
            PropertyNode pn = (PropertyNode) i.next();
            if(pn.getName().equals(propertyName))
                return true;
        }
        return false;
    }
1105621
private boolean checkRootfile( ZipInputStream zipStream,
                                   ZipEntry entry ) throws Exception {
        List<EpubMetadataProperty> properties = new ArrayList<>();
        Map<String, EpubMetadataProperty> propertiesWithId = new HashMap<>();

        ByteArrayOutputStream content = getZipEntryContent(zipStream, entry);

        // get metadata elements
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.parse(new ByteArrayInputStream(content.toByteArray()));

        XPathFactory xPathfactory = XPathFactory.newInstance();
        XPath xpath = xPathfactory.newXPath();
        xpath.setNamespaceContext(new SimpleNamespaceContext().setNamespace(DUBLIN_CORE_PREFIX, DUBLIN_CORE_URI));
        XPathExpression expr = xpath.compile("//" + DUBLIN_CORE_PREFIX + ":*");
        NodeList metadata = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);

        for (int i = 0; i < metadata.getLength(); i++) {
            EpubMetadataProperty property = new EpubMetadataProperty();

            Node node = metadata.item(i);
            property.setName(node.getLocalName());
            property.setValue(node.getTextContent());

            Node nodeId = node.getAttributes().getNamedItem("id");
            if (nodeId != null) {
                String id = nodeId.getTextContent();
                if (!propertiesWithId.containsKey(id)) {
                    propertiesWithId.put(id, property);
                }
            } else {
                properties.add(property);
            }
        }

        // read <meta> elements which can refine the properties
        NodeList metadataRefines = doc.getElementsByTagName("meta");
        for (int i = 0; i < metadataRefines.getLength(); i++) {
            Node node = metadataRefines.item(i);
            Node refines = node.getAttributes().getNamedItem("refines");
            if (refines != null) {
                String refinesId = refines.getTextContent().substring(1);
                if (propertiesWithId.containsKey(refinesId)) {
                    EpubMetadataProperty property = propertiesWithId.get(refinesId);

                    Node schemeAttribute = node.getAttributes().getNamedItem("scheme");
                    if (schemeAttribute != null) {
                        property.setScheme(schemeAttribute.getTextContent());
                    }

                    String propertyName = node.getAttributes().getNamedItem("property").getTextContent();
                    if (propertyName.equals("title-type")) {
                        property.setTitleType(node.getTextContent());
                    } else if (propertyName.equals("identifier-type")) {
                        property.setIdentifierType(node.getTextContent());
                    } else if (propertyName.equals("metadata-authority")) {
                        property.setMetadataAuthority(node.getTextContent());
                    } else if (propertyName.equals("role")) {
                        property.setRole(node.getTextContent());
                    } else if (propertyName.equals("display-seq")) {
                        property.setDisplaySeq(Long.parseLong(node.getTextContent()));
                    } else if (propertyName.equals("group-position")) {
                        property.setGroupPosition(Long.parseLong(node.getTextContent()));
                    } else if (propertyName.equals("file-as")) {
                        property.setFileAs(node.getTextContent());
                    } else if (propertyName.equals("alternate-script")) {
                        Node languageAttribute = node.getAttributes().getNamedItem("xml:lang");
                        if (languageAttribute != null) {
                            property.setAlternateScript(new AlternateScript(node.getTextContent(), languageAttribute.getTextContent()));
                        }
                    }
                }
            }
        }

        properties.addAll(propertiesWithId.values());
        for (EpubMetadataProperty prop : properties) {
            String propertyName = prop.getName();
            if (propertyName.equals("identifier")) {
                getIdentifier().add(prop);
            } else if (propertyName.equals("title")) {
                getTitle().add(prop);
            } else if (propertyName.equals("language")) {
                getLanguage().add(prop);
            } else if (propertyName.equals("contributor")) {
                getContributor().add(prop);
            } else if (propertyName.equals("creator")) {
                getCreator().add(prop);
            } else if (propertyName.equals("description")) {
                getDescription().add(prop);
            } else if (propertyName.equals("publisher")) {
                getPublisher().add(prop);
            } else if (propertyName.equals("rights")) {
                getRights().add(prop);
            } else if (propertyName.equals("date")) {
                getDate().add(prop);
            }
        }

        return true;
    }
119123
public static ConceptId getInstance(String propId, String propertyName, Metadata metadata) {
        return getInstance(propId, propertyName, null, metadata);
    }
1256803
public static boolean hasMetadata(@NonNull final Context context, @NonNull final String metadataKey) {
        if (TextUtils.isEmpty(metadataKey)) {
            throw new IllegalArgumentException("Meta data key can't be null or empty.");
        }

        try {
            final PackageInfo info = context.getPackageManager()
                    .getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            final Bundle metaData = info.applicationInfo.metaData;
            if (metaData != null && metaData.get(metadataKey) != null) {
                return true;
            }
        } catch (PackageManager.NameNotFoundException e) {
            //ignore
        }
        return false;
    }
877440
private Map<String, Object> loadPropertyFiles() {
        final Map<String, Object> definedProps = new HashMap<>();
        for (int propertyFileIndex = 0; propertyFileIndex < propertyFiles.size(); propertyFileIndex++) {
            final String filename = propertyFiles.elementAt(propertyFileIndex);
            final Properties props = new Properties();
            FileInputStream fis = null;
            try {
                fis = new FileInputStream(filename);
                props.load(fis);
            } catch (final IOException e) {
                System.out.println("Could not load property file " + filename + ": " + e.getMessage());
            } finally {
                FileUtils.close(fis);
            }

            // ensure that -D properties take precedence
            final Enumeration propertyNames = props.propertyNames();
            while (propertyNames.hasMoreElements()) {
                final String name = propertyNames.nextElement().toString();
                if (!definedProps.containsKey(name)) {
                    final Argument arg = getPluginArguments().get("--" + name);
                    final String value = props.getProperty(name);
                    if (arg != null) {
                        definedProps.put(name, arg.getValue(value));
                    } else {
                        definedProps.put(name, value);
                    }
                }
            }
        }
        return definedProps;
    }
952078
private boolean matchMetadata(MetaData metadata)
    {
        boolean match;

        if (this.metadataValue != null) {
            Object value = metadata.getMetaData(this.metadataKey);
            match = value != null && value.equals(this.metadataValue);
        } else {
            match = metadata.contains(this.metadataKey);
        }

        return match;
    }