Package org.ogre4j

Examples of org.ogre4j.ResourceManager$ResourceMap


*/
public class ResourceMapFactory {
    private static final Log log = LogFactory.getLog(ResourceMapFactory.class);
   
    public static ResourceMap createResourceMap(OMElement elem) {
        ResourceMap resourceMap = null;
        Iterator it = elem.getChildrenWithName(
            new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "resource"));
        while (it.hasNext()) {
            // Lazily create the ResourceMap, so that when no <resource>
            // elements are found, the method returns null.
            if (resourceMap == null) {
                resourceMap = new ResourceMap();
            }
            OMElement resourceElem = (OMElement)it.next();
            OMAttribute location = resourceElem.getAttribute
                (new QName(XMLConfigConstants.NULL_NAMESPACE, "location"));
            if (location == null) {
                handleException("The 'location' attribute is required for a resource definition");
            }
            OMAttribute key = resourceElem.getAttribute(
                new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
            if (key == null) {
                handleException("The 'key' attribute is required for a resource definition");
            }
            resourceMap.addResource(location.getAttributeValue(), key.getAttributeValue());
        }
        return resourceMap;
    }
View Full Code Here

TOP

Related Classes of org.ogre4j.ResourceManager$ResourceMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.