001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.kew.rule.xmlrouting;
017    
018    import java.util.Iterator;
019    
020    import javax.xml.namespace.NamespaceContext;
021    
022    /**
023     * An XML NamespaceContext for KEW.
024     *
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     */
027    public class WorkflowNamespaceContext implements NamespaceContext {
028            public String getNamespaceURI(String prefix) {
029                    if (prefix == null) {
030                            throw new IllegalArgumentException("The prefix cannot be null.");
031                    }
032    
033                    if (prefix.equals("wf")) {
034                            return "http://nothingfornowwf.com";
035                    } else {
036                            return null;
037                    }
038            }
039    
040            public String getPrefix(String namespace) {
041                    if (namespace == null) {
042                            throw new IllegalArgumentException("The namespace uri cannot be null.");
043                    }
044                    if (namespace.equals("http://nothingfornowwf.com")) {
045                            return "wf";
046                    } else {
047                            return null;
048                    }
049            }
050    
051            public Iterator getPrefixes(String namespace) {
052                    return null;
053            }
054    }