001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2006-2012 Open Geospatial Consortium, Inc.
006 * All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007 *
008 * Permission to use, copy, and modify this software and its documentation, with
009 * or without modification, for any purpose and without fee or royalty is hereby
010 * granted, provided that you include the following on ALL copies of the software
011 * and documentation or portions thereof, including modifications, that you make:
012 *
013 * 1. The full text of this NOTICE in a location viewable to users of the
014 * redistributed or derivative work.
015 * 2. Notice of any changes or modifications to the OGC files, including the
016 * date changes were made.
017 *
018 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019 * NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020 * TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021 * THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023 *
024 * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025 * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026 *
027 * The name and trademarks of copyright holders may NOT be used in advertising or
028 * publicity pertaining to the software without specific, written prior permission.
029 * Title to copyright in this software and any associated documentation will at all
030 * times remain with copyright holders.
031 */
032 package org.opengis.feature.type;
033
034 import java.lang.reflect.InvocationTargetException;
035
036 import org.opengis.feature.Attribute;
037
038 /**
039 * An implementation of an operation that may be invoked on an Attribute.
040 *
041 * @author Jody Garnett, Refractions Research
042 */
043 public interface Operation extends PropertyDescriptor {
044
045 /**
046 * Operations are not part of the structure.
047 * @return 0 in order to not trip up
048 */
049 int getMaxOccurs();
050
051 /**
052 * Operations are not part of the structure.
053 * @return 0 in order to not trip up
054 */
055 int getMinOccurs();
056
057 /** Indicates the OpperationType of this attribute */
058 OperationType getType();
059
060 /**
061 * Indicates if invoke may be called.
062 * <p>
063 * In order allow for faithful description of a software system we will need
064 * construct models dynamically at runtime, possibly when no implementation
065 * of this Operation is available. As an example when working with features
066 * in a web application some operations may only be available
067 * when being executed on a remote web processing service.
068 * </p>
069 *
070 * @return true if invoke may be called.
071 */
072 boolean isImplemented();
073
074 /**
075 * Invoke this operation on an attribute using the provided parameters.
076 * <p>
077 * The state of the attribute may be used and / or updated during the
078 * execution of the operation.
079 * </p>
080 * <p>
081 * Please check to ensure that isImplemented returns <code>true</code>
082 * before calling invoke.
083 *
084 * @param target
085 * Attribute this operation is being applied to, the state of this
086 * attribute may be changed by this operation.
087 * @param params parameters used by the operation
088 * @return the result of the operation
089 * @throws InvoationTargetException
090 * if an error occurred while processing
091 */
092 Object invoke(Attribute target, Object params[])
093 throws InvocationTargetException;
094
095 }