001: /*
002: * Source.java February 2006
003: *
004: * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013: * GNU Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General
016: * Public License along with this library; if not, write to the
017: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
018: * Boston, MA 02111-1307 USA
019: */
020:
021: package simple.page.translate;
022:
023: import java.io.File;
024:
025: /**
026: * The <code>Source</code> object is used to describe a translated JSP
027: * page. It contains information such as the language th JSP has been
028: * written in, for example Java or Groovy, as well as a description of
029: * the object and package that will result from compilation. Of core
030: * importance is the <code>Reference</code> object provided. This
031: * allows the JSP engine to determine when a JSP needs recompilation.
032: *
033: * @author Niall Gallagher
034: *
035: * @see simple.page.translate.Reference
036: */
037: public interface Source {
038:
039: /**
040: * The language property is used to specify the type of source that
041: * is to be generated and the compiler required to process that
042: * source. The language property is specified within the JSP page
043: * using the "page" directives "language" attribute.
044: *
045: * @return this returns the language, for example Groovy or Java
046: */
047: public String getLanguage();
048:
049: /**
050: * The provides the name of the resulting object. This is used by
051: * the code generator to determine the correct class name and
052: * constructor to use, and may be used by the source compiler.
053: *
054: * @return this returns the name of the source object generated
055: */
056: public String getName();
057:
058: /**
059: * Provides the fully qualified package name for the resulting
060: * object. This is required by the compiler, so that once the
061: * generated source has been compiled it can later be loaded as a
062: * class by the compiler class loader and instantiated.
063: *
064: * @return this returns the fully qualified class name targeted
065: */
066: public String getTarget();
067:
068: /**
069: * This is used by the source code generator to determine the
070: * package the target object is using. This ensures that a correct
071: * name space is given to each source, which avoids collisions.
072: *
073: * @return this returns the package name for the source object
074: */
075: public String getPackage();
076:
077: /**
078: * This acquires the directory the source object is generated into.
079: * This allows the generator to create the appropriate directory,
080: * before generating the resulting Java or Groovy object into that
081: * directory before compilation can proceed.
082: *
083: * @return the directory to generate the source object into
084: */
085: public File getDirectory();
086:
087: /**
088: * Provides the OS file system reference for the source file. This
089: * can be used to acquire a file system location using the provided
090: * project <code>Workspace</code>. This is used by the source
091: * generator to determine where the resulting source is written to.
092: *
093: * @return this returns the file system path for the source
094: */
095: public File getSource();
096:
097: /**
098: * This provides a key component for the JSP engine, which is used
099: * to determine when a JSP page or its includes have expired. This
100: * allows background compilation, and ensures that pages can be
101: * edited and deployed without restarting the server.
102: *
103: * @return this returns a monitor to the referenced JSP sources
104: */
105: public Reference getReference();
106: }
|