Resource.java [src/csip/annotations] Revision: default  Date:
/*
 * $Id$
 *
 * This file is part of the Cloud Services Integration Platform (CSIP),
 * a Model-as-a-Service framework, API and application suite.
 *
 * 2012-2022, Olaf David and others, OMSLab, Colorado State University.
 *
 * OMSLab licenses this file to you under the MIT license.
 * See the LICENSE file in the project root for more information.
 */

package csip.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Resource definition.
 *
 * @author od
 */
@Repeatable(Resources.class)
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface Resource {

  /**
   * The path to the file within the war file or file system.
   *
   * @return the relative path to the file in the war or on the absolute path in
   *        the file system.
   */
  String file() default "";


  /**
   * The type of the resource.
   *
   * @return the specific type of the resource.
   */
  ResourceType type() default ResourceType.FILE;


  /**
   * The id of that resource. Set it only if you want to access the resource.
   *
   * @return the id of that resource
   * @see csip.api.server.ServiceResources#getExe(java.lang.String)
   * @see csip.api.server.ServiceResources#getFile(java.lang.String)
   */
  String id() default "";


  /**
   * Should the file executed via wine.
   *
   * @return true if executed via wine, false otherwise.
   */
  boolean wine() default false;


  /**
   * Default arguments, separated by space.
   *
   * @return the executable arguments
   */
  String args() default "";


  /**
   * environment or config variables to be used. ("env1=abc", "env2=def"}
   *
   * @return the environment variables.
   */
  String[] env() default {};


  /**
   * Allows for resource 'inheritance'.
   *
   * @return the class to use/inherit the resources from
   */
  Class<?> from() default Object.class;
}