001/**
002 * Copyright 2005-2015 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 */
016package org.kuali.rice.kew.engine.node.var;
017
018import java.util.Arrays;
019import java.util.Collection;
020import java.util.Collections;
021
022import org.kuali.rice.kew.engine.RouteContext;
023import org.kuali.rice.kew.engine.node.var.schemes.LiteralScheme;
024import org.kuali.rice.kew.engine.node.var.schemes.ResourceScheme;
025import org.kuali.rice.kew.engine.node.var.schemes.URLScheme;
026import org.kuali.rice.kew.engine.node.var.schemes.VariableScheme;
027import org.kuali.rice.kew.engine.node.var.schemes.XPathScheme;
028
029
030/**
031 * Interface representing an implementation that can resolve Property objects to
032 * values.
033 * 
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public interface PropertyScheme {
037    public static final PropertyScheme VARIABLE_SCHEME = new VariableScheme();
038    public static final PropertyScheme LITERAL_SCHEME = new LiteralScheme();
039    public static final PropertyScheme RESOURCE_SCHEME = new ResourceScheme();
040    public static final PropertyScheme URL_SCHEME = new URLScheme();
041    public static final PropertyScheme XPATH_SCHEME = new XPathScheme();
042
043    /**
044     * Collection/enumeration of PropertyScheme types
045     */
046    /* interfaces can't have static initializers */
047    public static final Collection SCHEMES = Collections.unmodifiableCollection(
048                                                             Arrays.
049                                                                 asList(new PropertyScheme[] {
050                                                                    VARIABLE_SCHEME,
051                                                                    LITERAL_SCHEME,
052                                                                    RESOURCE_SCHEME,
053                                                                    URL_SCHEME,
054                                                                    XPATH_SCHEME}));
055
056    /**
057     * Scheme name
058     * @return scheme name
059     */
060    public String getName();
061    /**
062     * Short scheme name
063     * @return short scheme name
064     */
065    public String getShortName();
066    /**
067     * Loads/resolves a Property
068     * @param property the property to resolve
069     * @param context the current RouteContext
070     * @return the loaded/resolved value
071     */
072    public Object load(Property property, RouteContext context);
073}