001    /*
002     * Copyright 2005-2008 The Kuali Foundation
003     * 
004     * 
005     * Licensed under the Educational Community License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     * 
009     * http://www.opensource.org/licenses/ecl2.php
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.kuali.rice.kew.engine.node.var;
018    
019    import java.util.Arrays;
020    import java.util.Collection;
021    import java.util.Collections;
022    
023    import org.kuali.rice.kew.engine.RouteContext;
024    import org.kuali.rice.kew.engine.node.var.schemes.LiteralScheme;
025    import org.kuali.rice.kew.engine.node.var.schemes.ResourceScheme;
026    import org.kuali.rice.kew.engine.node.var.schemes.URLScheme;
027    import org.kuali.rice.kew.engine.node.var.schemes.VariableScheme;
028    import org.kuali.rice.kew.engine.node.var.schemes.XPathScheme;
029    
030    
031    /**
032     * Interface representing an implementation that can resolve Property objects to
033     * values.
034     * 
035     * @author Kuali Rice Team (rice.collab@kuali.org)
036     */
037    public interface PropertyScheme {
038        public static final PropertyScheme VARIABLE_SCHEME = new VariableScheme();
039        public static final PropertyScheme LITERAL_SCHEME = new LiteralScheme();
040        public static final PropertyScheme RESOURCE_SCHEME = new ResourceScheme();
041        public static final PropertyScheme URL_SCHEME = new URLScheme();
042        public static final PropertyScheme XPATH_SCHEME = new XPathScheme();
043    
044        /**
045         * Collection/enumeration of PropertyScheme types
046         */
047        /* interfaces can't have static initializers */
048        public static final Collection SCHEMES = Collections.unmodifiableCollection(
049                                                                 Arrays.
050                                                                     asList(new PropertyScheme[] {
051                                                                        VARIABLE_SCHEME,
052                                                                        LITERAL_SCHEME,
053                                                                        RESOURCE_SCHEME,
054                                                                        URL_SCHEME,
055                                                                        XPATH_SCHEME}));
056    
057        /**
058         * Scheme name
059         * @return scheme name
060         */
061        public String getName();
062        /**
063         * Short scheme name
064         * @return short scheme name
065         */
066        public String getShortName();
067        /**
068         * Loads/resolves a Property
069         * @param property the property to resolve
070         * @param context the current RouteContext
071         * @return the loaded/resolved value
072         */
073        public Object load(Property property, RouteContext context);
074    }