Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.kuali.rice.ken.util;
Resource resolver for SchemaFactory. For now used during validation of NotificationRequest content element. Looks up XSD in NotificationContentType record.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
public class ContentTypeLSResourceResolver extends ContentTypeResourceResolver implements LSResourceResolver {
    
Constructs a ContentTypeLSResourceResolver.java.

Parameters:
notificationContentTypeService
    public ContentTypeLSResourceResolver(NotificationContentTypeService notificationContentTypeService) {
	super(notificationContentTypeService);
    }

    
    public LSInput resolveResource(String typeString namespaceURIString publicIdString systemIdString baseURI) {
        if (!type.equals(.)) {
            return null;
        }
        if (!systemId.startsWith()) {
            .warn("Cannot resolve non-ContentType resources");
            return null;
        }
        NotificationContentTypeBo notificationContentType = resolveContentType(systemId);
        if (notificationContentType == null) {
	    .error("Unable to resolve system id '" + systemId + "' locally...delegating to default resolution strategy.");
	    return null;
	}
        Reader reader = new StringReader(notificationContentType.getXsd());
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            DOMImplementation domImpl = builder.getDOMImplementation();
            DOMImplementationLS dils = (DOMImplementationLSdomImpl;
            LSInput input = dils.createLSInput();
            input.setCharacterStream(reader);
            return input;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
New to GrepCode? Check out our FAQ X