diff options
author | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-12 03:30:27 +0000 |
---|---|---|
committer | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-12 03:30:27 +0000 |
commit | bcfd180be7842a3a9b9844ba89b4d2e7b2a13bdf (patch) | |
tree | 95494f406bf45e1b60683f400d508b8f9cd23751 /java/src | |
parent | 85c09b7bf921d730f8e0203693425dd0c03e92da (diff) | |
download | ATCD-bcfd180be7842a3a9b9844ba89b4d2e7b2a13bdf.tar.gz |
Checks in the new additions to the ServiceConfigurator, makes a few
small adjustments to the sockets, and removes a deprecation problem
with a String in BlobReader. Acceptor's socket acceptor was changed
to protected rather than private.
The new files are broken down as follows:
Files that are involved in loading a C++ service config file to
load Java ACE network services:
Svc_Conf.y
parser.java
sym.java
Yylex.lex
ClassNameGenerator.java
Files that have to do with the overall restructuring of the Service
Configurator such that suspend/resume/remove and the service repository
are added:
AddServiceObjectNode.java
ClassReader.java Extracts the full class name from a .class file
SuspendNode.java
ResumeNode.java
RemoveNode.java
ServiceRecord.java Repository wrapper, makes calls via reflection
ServiceObjectRecord.java Wrapper for ServiceObjects specifically
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Acceptor.java | 2 | ||||
-rw-r--r-- | java/src/AddServiceObjectNode.java | 59 | ||||
-rw-r--r-- | java/src/BlobReader.java | 2 | ||||
-rw-r--r-- | java/src/ClassNameGenerator.java | 182 | ||||
-rw-r--r-- | java/src/ClassReader.java | 147 | ||||
-rw-r--r-- | java/src/Makefile | 19 | ||||
-rw-r--r-- | java/src/ParseNode.java | 74 | ||||
-rw-r--r-- | java/src/RemoveNode.java | 38 | ||||
-rw-r--r-- | java/src/ResumeNode.java | 37 | ||||
-rw-r--r-- | java/src/SOCKStream.java | 26 | ||||
-rw-r--r-- | java/src/ServiceConfig.java | 384 | ||||
-rw-r--r-- | java/src/ServiceLoader.java | 242 | ||||
-rw-r--r-- | java/src/ServiceObject.java | 18 | ||||
-rw-r--r-- | java/src/ServiceObjectRecord.java | 36 | ||||
-rw-r--r-- | java/src/ServiceRecord.java | 257 | ||||
-rw-r--r-- | java/src/ServiceRepository.java | 354 | ||||
-rw-r--r-- | java/src/SuspendNode.java | 37 | ||||
-rw-r--r-- | java/src/SvcHandler.java | 2 | ||||
-rw-r--r-- | java/src/Svc_Conf.y | 210 | ||||
-rw-r--r-- | java/src/Yylex.java | 1316 | ||||
-rw-r--r-- | java/src/Yylex.lex | 79 | ||||
-rw-r--r-- | java/src/parser.java | 623 | ||||
-rw-r--r-- | java/src/sym.java | 36 |
23 files changed, 3870 insertions, 310 deletions
diff --git a/java/src/Acceptor.java b/java/src/Acceptor.java index 4a47d743e98..1db6e01f7b5 100644 --- a/java/src/Acceptor.java +++ b/java/src/Acceptor.java @@ -209,5 +209,5 @@ public class Acceptor extends ServiceObject private Class handlerFactory_; // Our connection acceptance factory - private SOCKAcceptor sockAcceptor_; + protected SOCKAcceptor sockAcceptor_; } diff --git a/java/src/AddServiceObjectNode.java b/java/src/AddServiceObjectNode.java new file mode 100644 index 00000000000..86d1d2e66fd --- /dev/null +++ b/java/src/AddServiceObjectNode.java @@ -0,0 +1,59 @@ +package JACE.ServiceConfigurator; + +import java.io.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; +import java_cup.runtime.*; + +class AddServiceObjectNode extends ParseNode +{ + + public AddServiceObjectNode (int act_num) + { + super(act_num); + + this.locator_ = new String(); + this.params_ = new String(); + } + + /* String with possible locator information -- used when trying to load + old C++ format files */ + public String locator () + { + return this.locator_; + } + + public String params () + { + return this.params_; + } + + public void params (String params) + { + this.params_ = params; + } + + public boolean suspended () + { + return this.suspended_; + } + + public void init(String name, String locator, boolean suspended) + { + super.name_ = name; + this.locator_ = locator; + this.suspended_ = suspended; + } + + public void apply () + { + System.err.println("AddServiceObjectNode apply"); + + if (JACE.ServiceConfigurator.ServiceConfig.initialize(this) == -1) + ACE.ERROR("Error adding " + this.name_); + } + + String params_; + String locator_; + boolean suspended_; +}; diff --git a/java/src/BlobReader.java b/java/src/BlobReader.java index 6f37baef028..7209f3c721f 100644 --- a/java/src/BlobReader.java +++ b/java/src/BlobReader.java @@ -77,7 +77,7 @@ public class BlobReader } // Cache number of bytes read this.bytesRead_ = this.length_; - return new MessageBlock (new String (dataBuf, 0)); + return new MessageBlock (new String (dataBuf, 0, this.length_)); } public int close (long flags) diff --git a/java/src/ClassNameGenerator.java b/java/src/ClassNameGenerator.java new file mode 100644 index 00000000000..8c08b33c09c --- /dev/null +++ b/java/src/ClassNameGenerator.java @@ -0,0 +1,182 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ClassNameGenerator.java + * + * Given a locator string which may specify a class name, this generates as many possible locations for that + * class file as possible. This is needed when trying to infer a class name from a C++ DLL line in the + * svc.conf file. Implements the Enumeration interface. A variety of questionable tactics are + * used. + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import java.lang.*; +import java.util.*; +import JACE.OS.*; + +public class ClassNameGenerator implements Enumeration +{ + /** + * Constructor + * @param locator Locator string -- approximate class name + */ + public ClassNameGenerator (String locator) + { + this.locator_ = locator; + this.current_ = 0; + this.suggestions_ = new Vector(); + + this.makeSuggestions(); + } + + /** + * More unseen possibilities? + */ + public boolean hasMoreElements() + { + return this.current_ < this.suggestions_.size(); + } + + /** + * Get the next string + */ + public Object nextElement() + { + return this.suggestions_.elementAt(this.current_++); + } + + /** + * Take away things underscores, adjust capitalization. This + * makes a name more like a Java class name + */ + String makeJavaName(String oldName) + { + StringTokenizer tok = new StringTokenizer(oldName, "_"); + String result = new String(); + + while (tok.hasMoreTokens()) { + String token = tok.nextToken(); + + if (token.length() > 0) { + + result += (Character.toUpperCase(token.charAt(0)) + token.substring(1)); + } + } + + return result; + } + + + /** + * Generate the suggestions + */ + void makeSuggestions() + { + String slash = new String(System.getProperty("file.separator")); + + // Discard things like .shobj + if ((this.locator_.charAt(0) == '.') && (this.locator_.charAt(1) != '.')) { + int firstslash = this.locator_.indexOf(slash); + if (firstslash > 0) + this.locator_ = this.locator_.substring(firstslash + 1); + } + + // Find the last directory separator and the colon (inbetween + // these two is the last directory name, and by our convention + // this should be the class name) + int lastSlash = this.locator_.lastIndexOf(slash); + int colon = this.locator_.lastIndexOf(":"); + + ACE.DEBUG("Working with " + this.locator_ + " " + + lastSlash + " " + colon); + + // Best bet first: + // Locator string is a path, and the last directory name is the class + // name + String lastDir = new String(this.locator_.substring(lastSlash + 1, + colon)); + + // Save any other path info for later tries + String path = null; + if (lastSlash >= 0) + path = this.locator_.substring(0, lastSlash + 1); + + int tryNum = 0; + + if (lastDir.length() > 0) { + + // Add this try + this.suggestions_.addElement(lastDir); + + if (path != null) + this.suggestions_.addElement(path + lastDir); + + // Second try: + // Same as the first, but changed to the Java convention for class names: + // Begins with a capital letter, capital letters for new words rather + // than underscores. + + String try2 = this.makeJavaName(lastDir); + + this.suggestions_.addElement(try2); + if (path != null) + this.suggestions_.addElement(path + try2); + } + + // Third try: + // After the colon, the name of the method that created instances of the + // class in C++ may contain the class name. Maybe in the format of + // make_classname, etc. + + String lastWord = new String(this.locator_.substring(colon + 1)); + + if (lastWord.length() > 0) { + + // Try the word after the colon, too + this.suggestions_.addElement(lastWord); + if (path != null) + this.suggestions_.addElement(path + lastWord); + + String try2 = this.makeJavaName(lastWord); + + this.suggestions_.addElement(try2); + if (path != null) + this.suggestions_.addElement(path + try2); + + int make = lastWord.indexOf("make"); + if (make >= 0) { + + make += 4; + String makeTry = new String(lastWord.substring(make)); + + if (makeTry.length() > 0) { + + this.suggestions_.addElement(makeTry); + if (path != null) + this.suggestions_.addElement(path + makeTry); + + String try3 = this.makeJavaName(makeTry); + + this.suggestions_.addElement(try3); + if (path != null) + this.suggestions_.addElement(path + try3); + } + } + } + + } + + String locator_; + Vector suggestions_; + + int current_; +}; + + diff --git a/java/src/ClassReader.java b/java/src/ClassReader.java new file mode 100644 index 00000000000..deddf32eac2 --- /dev/null +++ b/java/src/ClassReader.java @@ -0,0 +1,147 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ClassReader.java + * + *@author Everett Anderson + * + *@see JACE.ServiceConfigurator + *@see JACE.ServiceConfigurator.ServiceLoader + * + *************************************************/ +package JACE.ServiceConfigurator; + +import JACE.OS.*; +import java.io.*; +import java.lang.*; +import java.util.*; + +/** + * <hr> + * <p><b>TITLE</b><br> + * Given a classfile name, this determines the qualified class name + * of what's inside (pacakage and class name together). It is necessary + * when users want to dynamically load classes, but don't provide the + * full name in svc.conf. + */ + +public class ClassReader +{ + // Types found in classfiles + public static final byte CONSTANT_Class = 7; + public static final byte CONSTANT_Fieldref = 9; + public static final byte CONSTANT_Methodref = 10; + public static final byte CONSTANT_InterfaceMethodref = 11; + public static final byte CONSTANT_String = 8; + public static final byte CONSTANT_Integer = 3; + public static final byte CONSTANT_Float = 4; + public static final byte CONSTANT_Long = 5; + public static final byte CONSTANT_Double = 6; + public static final byte CONSTANT_NameAndType = 12; + public static final byte CONSTANT_Utf8 = 1; + + /** Returns a string that is the qualified class name of the + * given file. It returns null if there are any problems. + * + *@param fileName File to examine + * + *@return String that's the qualified class name of the + * given file (null on error) + */ + public static String getClassName(String fileName) + { + try { + + // Open the .class file + FileInputStream fis = new FileInputStream(fileName); + + DataInputStream dis = new DataInputStream(fis); + + // Skip magic number and version numbers + dis.skipBytes(8); + + // Find out how many entries are in the constant pool table + int count = dis.readUnsignedShort(); + + // Hash table to hold the text entries (possibilities for + // the class name) + Hashtable ht = new Hashtable(); + + // Vector that holds the index of the class name for each + // class record (the vector is indexed by placement in the + // table) + Vector vt = new Vector(count); + Integer noValue = new Integer(-1); + int type; + + // Scan through all the entries + for (int i = 1; i < count; i++) { + + // Read what type of entry this is + type = dis.readUnsignedByte(); + + switch (type) { + + case CONSTANT_Class: + // Save the index of the class name + vt.addElement(new Integer(dis.readUnsignedShort())); + break; + case CONSTANT_Fieldref: + case CONSTANT_Methodref: + case CONSTANT_InterfaceMethodref: + case CONSTANT_Integer: + case CONSTANT_Float: + case CONSTANT_NameAndType: + // Skip the data + vt.addElement(noValue); + dis.skipBytes(4); + break; + case CONSTANT_String: + // Skip the data + vt.addElement(noValue); + dis.skipBytes(2); + break; + case CONSTANT_Long: + case CONSTANT_Double: + // Skip the data + vt.addElement(noValue); + dis.skipBytes(8); + // These take up two spots in the table + i++; + break; + case CONSTANT_Utf8: + vt.addElement(noValue); + // Save the text in the hash table + ht.put(new Integer(i), new String(dis.readUTF())); + break; + default: + System.err.println("Unknown type: " + type); + break; + + } + + } + + // Skip the access flags + dis.skipBytes(2); + + // Get index in table of this class + int classIdx = dis.readUnsignedShort(); + + // Get index in the table of the name of this class + Integer idx = (Integer)vt.elementAt(classIdx - 1); + + // Put the result in period separated notation + String result = new String(((String)ht.get(idx)).replace('/', '.')); + + return result; + + } catch (IOException e) { + ACE.ERROR("" + e); + return null; + } + } +} diff --git a/java/src/Makefile b/java/src/Makefile index b9a8ae5efcd..272f4bb4b3b 100644 --- a/java/src/Makefile +++ b/java/src/Makefile @@ -7,7 +7,7 @@ JACE_WRAPPER = .. CLASSDIR = $(JACE_WRAPPER)/classes DOCDIR = $(JACE_WRAPPER)/doc -JC = javac_g +JC = javac JCOPTS = -g -d $(CLASSDIR) JD = javadoc JDOPTS = -d $(DOCDIR) @@ -122,8 +122,21 @@ socksap: os $(addsuffix .java,$(pkg_socksap)) $(COMPILE.java) pkg_svcconfig = \ - ServiceObject \ - ServiceConfig \ + ServiceLoader \ + ClassNameGenerator \ + ClassReader \ + parser \ + sym \ + ParseNode \ + SuspendNode \ + ResumeNode \ + RemoveNode \ + ServiceRecord \ + ServiceObjectRecord \ + Yylex \ + AddServiceObjectNode \ + ServiceObject \ + ServiceConfig \ ServiceRepository svcconfig: os reactor misc $(addsuffix .java,$(pkg_svcconfig)) diff --git a/java/src/ParseNode.java b/java/src/ParseNode.java new file mode 100644 index 00000000000..b6d2d4957ed --- /dev/null +++ b/java/src/ParseNode.java @@ -0,0 +1,74 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ParseNode.java + * + * Base class for the data types used in the parse tree for adjusting + * services. Things like SuspendNode extend this. They help connect + * CUP/JLex with the service configurator system. + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; +import java_cup.runtime.*; + +public class ParseNode extends java_cup.runtime.symbol +{ + /** + * Constructor + * + */ + public ParseNode (int number) + { + super(number); + + this.name_ = new String("Uninitialized"); + } + + /** + * Initialize the service (subclasses + * may do more than set the name) + */ + public void init (String name) + { + this.name_ = name; + } + + /** + * Subclasses override to do real work, usually + * initiating a service or modifying one + */ + public void apply () + { + // Empty + } + + /** + * Retrive the service name + */ + public String name() + { + return this.name_; + } + + /** + * Set the name of the service + */ + public void name(String newName) + { + this.name_ = newName; + } + + String name_; +}; + + + diff --git a/java/src/RemoveNode.java b/java/src/RemoveNode.java new file mode 100644 index 00000000000..d93a0911054 --- /dev/null +++ b/java/src/RemoveNode.java @@ -0,0 +1,38 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * RemoveNode.java + * + * Used when a service is specified to be removed based on a line + * in a service configurator file. Note: Make sure to call the + * prepareToReload method in ServiceConfig before reloading the + * service that is being removed. + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; +import java_cup.runtime.*; + +class RemoveNode extends ParseNode +{ + public RemoveNode (int act_num) + { + super(act_num); + } + + public void apply () + { + ACE.DEBUG("RemoveNode apply"); + + if (JACE.ServiceConfigurator.ServiceConfig.remove(this.name_) == -1) + ACE.ERROR("Error removing " + this.name_); + } +}; diff --git a/java/src/ResumeNode.java b/java/src/ResumeNode.java new file mode 100644 index 00000000000..00d42a2994a --- /dev/null +++ b/java/src/ResumeNode.java @@ -0,0 +1,37 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ResumeNode.java + * + * Used when a service is specified to be resumed based on a line + * in a service configurator file. The actual implementation of the + * service being resumed does the work. + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; +import java_cup.runtime.*; + +class ResumeNode extends ParseNode +{ + public ResumeNode (int act_num) + { + super(act_num); + } + + public void apply () + { + ACE.DEBUG("ResumeNode apply: " + this.name_); + + if (JACE.ServiceConfigurator.ServiceConfig.resume(this.name_) == -1) + ACE.ERROR("Error resuming " + this.name_); + } +}; diff --git a/java/src/SOCKStream.java b/java/src/SOCKStream.java index 58498597e88..638482d8e40 100644 --- a/java/src/SOCKStream.java +++ b/java/src/SOCKStream.java @@ -50,8 +50,14 @@ public class SOCKStream this.socket_ = s; // Note that if s is not a valid socket or is null, the // following calls will throw exceptions - this.iStream_ = new DataInputStream (s.getInputStream ()); - this.oStream_ = new PrintStream (s.getOutputStream ()); + + // Create buffered, platform independent byte streams. This hasn't been switched + // to the newer character streams since the change would break cross talk with + // non-Java sockets. + + this.iStream_ = new DataInputStream(new BufferedInputStream(s.getInputStream())); + + this.oStream_ = new PrintStream(new DataOutputStream(new BufferedOutputStream(s.getOutputStream()))); } /* Get the underlying Socket. @@ -84,8 +90,10 @@ public class SOCKStream { // Get the data out String buf = s.toString (); - this.oStream_.print(buf); + + this.oStream_.println(buf); this.oStream_.flush (); + return buf.length (); } @@ -96,8 +104,9 @@ public class SOCKStream */ public int send (String s) throws IOException { - this.oStream_.print (s); - this.oStream_.flush (); + this.oStream_.println(s); + this.oStream_.flush(); + return s.length (); } @@ -125,6 +134,7 @@ public class SOCKStream { String temp = this.iStream_.readLine (); s.append (temp); + if (temp == null) // Possible if user sends just a line feed, but return -1; // not checking would cause a null ptr exception else @@ -152,7 +162,7 @@ public class SOCKStream */ public void inputStream (InputStream iStream) { - this.iStream_ = new DataInputStream (iStream); + this.iStream_ = new DataInputStream(new BufferedInputStream(iStream)); } /** @@ -169,8 +179,8 @@ public class SOCKStream *@param iStream the output stream */ public void outputStream (OutputStream oStream) - { - this.oStream_ = new PrintStream (oStream); + { + this.oStream_ = new PrintStream(new DataOutputStream(new BufferedOutputStream(oStream))); } /** diff --git a/java/src/ServiceConfig.java b/java/src/ServiceConfig.java index 74e8523d8c1..69fc8cf566e 100644 --- a/java/src/ServiceConfig.java +++ b/java/src/ServiceConfig.java @@ -6,13 +6,23 @@ * = FILENAME * ServiceConfig.java * - *@author Prashant Jain + * Services can be suspended, resumed, removed, and reloaded. Reloading requires that + * the user calls a prepareForReload method after removing a service. You can't access + * the ServiceObjects that are loaded directly -- anything loaded with a class loader + * must be wrapped and have its methods called via reflection. This is because a + * loaded class doesn't exist in the same space as one loaded with the system loader. + * + * + * + *@author Prashant Jain, Everett Anderson * *************************************************/ package JACE.ServiceConfigurator; import java.io.*; +import java.util.*; import java.net.*; +import java.lang.*; import JACE.OS.*; import JACE.Misc.*; @@ -20,24 +30,133 @@ import JACE.Misc.*; * <hr> * <p><b>TITLE</b><br> * Provide the base class that supplies common server daemon - * operations. + * operations. Also provides a global point for interacting with + * the service repository. */ public class ServiceConfig { - public static int open (String [] args) throws - FileNotFoundException, IOException, ClassNotFoundException, - IllegalAccessException, InstantiationException - { + /** Begins the process of loading a service configurator file: + * parses the command line and calls either loadOldConfigFile or + * processDirectives depending on whether or not the user wants + * to try to load a C++ svc.conf file. + */ + public static int open (String [] args) throws FileNotFoundException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException + { + // Parse the command line ServiceConfig.parseArgs (args); + + // Create a repository and class loader if (ServiceConfig.svcRep_ == null) ServiceConfig.svcRep_ = new ServiceRepository (); - return ServiceConfig.processDirectives (); + if (ServiceConfig.loader_ == null) + ServiceConfig.loader_ = new ServiceLoader(); + + if (ServiceConfig.oldConfigFormat_) + return ServiceConfig.loadOldConfigFile(); + else + return ServiceConfig.processDirectives (); + + } + + /** Parses the command line + * Valid command line options: + * -b Run as a daemon (not implemented yet) + * -d Debug mode + * -n No defaults + * -o Attempt to load a C++ ACE service config file + * -f <filename> Load services in the given file [see below for info] + * + */ + protected static void parseArgs (String [] args) + { + GetOpt getopt = new GetOpt (args, "bdnf:o:"); + for (int c; (c = getopt.next ()) != -1; ) + switch (c) + { + case 'b': + // Note: not supported yet! + ServiceConfig.beADaemon_ = true; + break; + case 'd': + ServiceConfig.debug_ = true; + break; + case 'n': + ServiceConfig.noDefaults_ = true; + break; + case 'o': + ServiceConfig.oldConfigFormat_ = true; + break; + case 'f': + ServiceConfig.serviceConfigFile_ = getopt.optarg (); + break; + default: + ACE.ERROR ((char ) c + " is not a ServiceConfig option"); + break; + } + } + + /** Called by ParseNode subclass + * Asks the Service Repository to spend a service + */ + public static int suspend (String name) + { + return svcRep_.suspend(name); + } + + /** Called by ParseNode subclass + * Asks the Service Repository to resume a service + */ + public static int resume (String name) + { + return svcRep_.resume(name); + } + + /** Called by ParseNode subclass + * Asks the Service Repository to remove a serivce + */ + public static int remove (String name) + { + return svcRep_.remove(name); + } + + /** Should be called before the user wants to reload + * a service. This calls garbage collection to + * (hopefully) obliterate the names of any unused + * service classes, and creates a new instance + * of the ClassLoader so there won't be problems + * reloading. + */ + public static void prepareForReload() + { + ServiceConfig.loader_ = new ServiceLoader(); + + System.gc(); + } - protected static int processDirectives () throws - FileNotFoundException, IOException, ClassNotFoundException, - IllegalAccessException, InstantiationException + /** + * Parse a service configurator file, creating classes as necessary + * + * This is getting too complicated -- since CUP and JLex are available, it would be nice to + * develop a grammar for this. Unfortunately, there may be file problems when trying to get + * CUP and JLex to produce more than one parser per program. + * + * Current formats: + * + * load <Service Name> <Full Class Name> Service_Object "<argument list>" + * + * resume <Service Name> + * suspend <Service Name> + * remove <Service Name> + * + */ + protected static int processDirectives () throws FileNotFoundException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException { + if (ServiceConfig.serviceConfigFile_ == null) + ServiceConfig.serviceConfigFile_ = "svc.conf"; + + ACE.DEBUG("Processing directives in file " + ServiceConfig.serviceConfigFile_); + File configFile = new File (ServiceConfig.serviceConfigFile_); // Check if file exists and is a normal file @@ -66,16 +185,64 @@ public class ServiceConfig in.wordChars ('[', '`'); // ASCII range 91 to 96 in.wordChars ('{', '~'); // ASCII range 123 to 126 + String commandName = null; + String serviceName = null; String className = null; String classType = null; String args = null; // Create a state machine - int state = ServiceConfig.CLASS_NAME; + int state = ServiceConfig.COMMAND_NAME; + + // The apply() method on ParseNode starts the process of actually executing the + // desired action (suspend, load, etc) + ParseNode result = null; while (in.nextToken () != StreamTokenizer.TT_EOF) { switch (state) { + case ServiceConfig.COMMAND_NAME: + if (in.ttype == StreamTokenizer.TT_WORD) { + commandName = in.sval; + + // This is a hack, but it should work until CUP is easier + // to deal with when multiple parsers are needed + if (commandName.equals("load")) + result = new AddServiceObjectNode(0); + else + if (commandName.equals("remove")) + result = new RemoveNode(0); + else + if (commandName.equals("suspend")) + result = new SuspendNode(0); + else + if (commandName.equals("resume")) + result = new ResumeNode(0); + else + throw new IOException ("COMMAND NAME missing or invalid: " + commandName); + + ACE.DEBUG("Command node type: " + ((Object)result).getClass().getName()); + + + } else + throw new IOException ("Illegal COMMAND NAME argument in file " + ServiceConfig.serviceConfigFile_); + state = ServiceConfig.SERVICE_NAME; + break; + case ServiceConfig.SERVICE_NAME: + if (in.ttype == StreamTokenizer.TT_WORD) + serviceName = in.sval; + else + throw new IOException ("Illegal SERVICE NAME argument in file " + ServiceConfig.serviceConfigFile_); + + + if (!commandName.equals("load")) { + result.init(serviceName); + result.apply(); + in.whitespaceChars (' ', ' '); + state = ServiceConfig.SERVICE_NAME; + } else + state = ServiceConfig.CLASS_NAME; + break; case ServiceConfig.CLASS_NAME: if (in.ttype == StreamTokenizer.TT_WORD) className = in.sval; @@ -94,47 +261,28 @@ public class ServiceConfig in.wordChars (' ', ' '); break; case ServiceConfig.ARGS: + ACE.DEBUG("Processing arguments"); + + args = new String(""); + if (in.ttype == StreamTokenizer.TT_WORD) { args = in.sval; - // Load the class - Class c = null; - - // First check if we need to load the class from the - // file system or from across the network. - if (className.lastIndexOf ("://") != -1) - { - // We need to get the bytes over the network since - // the name specified in the configuration file - // contains a protocol specification - c = ServiceConfig.svcRep_.load (new URL (className)); - } - else - { - c = ServiceConfig.svcRep_.load (className); - } - - // Note that c should be defined else an exception - // would have been thrown by now - - // Figure out the type of the class, create an - // instance and then invoke the initialization method - if (classType.equals ("ServiceObject")) - { - ServiceObject svcObj = (ServiceObject) c.newInstance (); - - // Create an array of String from args String - String [] argArray = OS.createStringArray (args, " "); - - // Call init on the Service Object passing in arguments - svcObj.init (argArray); - } - else - throw new IOException ("Illegal CLASS TYPE argument in file " + ServiceConfig.serviceConfigFile_); + + // If just two double quotes, there are no args + if (args.length() == 2) { + args = new String(""); + } else + args = args.substring(1, args.length() - 1); } - else - throw new IOException ("Illegal ARGS argument in file " + ServiceConfig.serviceConfigFile_); - state = ServiceConfig.CLASS_NAME; + + // Quick hack until more parsing necessary -- set the needed data + ((AddServiceObjectNode)result).init(serviceName, className, false); + ((AddServiceObjectNode)result).params(args); + + result.apply(); + + state = ServiceConfig.SERVICE_NAME; // Set space back to whitespace-character to extract the // next token in.whitespaceChars (' ', ' '); @@ -146,40 +294,128 @@ public class ServiceConfig return 0; } - protected static void parseArgs (String [] args) + /** Parses the svc.conf file, treating it as a C++ ACE svc.conf file. + * This will involve attempts to infer the class name from + * the service initializer path, and isn't very accurate. + */ + public static int loadOldConfigFile () { - GetOpt getopt = new GetOpt (args, "bdnf:"); - for (int c; (c = getopt.next ()) != -1; ) - switch (c) - { - case 'b': - // Note: not supported yet! - ServiceConfig.beADaemon_ = true; - break; - case 'd': - ServiceConfig.debug_ = true; - break; - case 'n': - ServiceConfig.noDefaults_ = true; - break; - case 'f': - ServiceConfig.serviceConfigFile_ = getopt.optarg (); - break; - default: - ACE.ERROR ((char ) c + " is not a ServiceConfig option"); - break; - } + parser ps = new parser(); + + try { + + ps.parse(); + + } catch (Exception e) { + ACE.ERROR("Error: " + e); + return -1; + } + + return 0; + } + + + /** + * This is called when apply() is called on AddServiceObjectNodes. Similar + * methods could be developed for later data types (AddStreamNode, etc). This + * tries to load the ServiceObject and its classes. When trying to find info + * from the C++ files, this generates possible file paths. + */ + public static int initialize (AddServiceObjectNode son) + { + Class c = null; + + if (ServiceConfig.oldConfigFormat_) { + + // Generate a lot of possible file locations and names + ClassNameGenerator cng = new ClassNameGenerator(son.locator()); + String attempt = null; + boolean ready = false; + + + // Try to load the class based on the names we can infer from + // the C++ svc.conf line + while ((cng.hasMoreElements()) && (!ready)) { + try { + + attempt = (String)cng.nextElement(); + + c = loader_.loadClass(attempt, true); + + ready = true; + + } catch (ClassNotFoundException e) { } + + } + + // Couldn't find the class + if (!ready) { + ACE.ERROR("Can't find class with locator: " + son.locator()); + return -1; + } + + } else { + + try { + + c = loader_.loadClass(son.locator(), true); + + } catch (ClassNotFoundException e) { + ACE.ERROR("Can't find class with locator: " + son.locator()); + return 01; + } + + } + + try { + + Object service = c.newInstance(); + // Can't cast this to a ServiceObject, even though it will look just + // like one -- Java puts things loaded with a non-standard class loader + // in their own name space. The ServiceObjectRecord is a wrapper that + // gets around this by using reflection. + ServiceObjectRecord svcObjRec = new ServiceObjectRecord(service, son.name()); + + // Split the argument array up into smaller pieces + String [] argArray = OS.createStringArray (son.params(), " "); + + // Initialize the service -- start it running + svcObjRec.init(argArray); + + // Put it in the service repository + svcRep_.insert((ServiceRecord)svcObjRec); + + } catch (IllegalAccessException e) { + ACE.ERROR("Error " + e); + return -1; + } catch (InstantiationException e) { + ACE.ERROR("Error " + e); + return -1; + } + + return 0; } // Set by command line options + private static boolean oldConfigFormat_ = false; private static boolean beADaemon_ = false; private static boolean debug_ = false; private static boolean noDefaults_ = false; - private static String serviceConfigFile_ = "svc.conf"; + + public static String serviceConfigFile_ = "svc.conf"; + private static ServiceRepository svcRep_ = null; + private static ServiceLoader loader_ = null; // States for the state-machine used in parsing the config file - private final static int CLASS_NAME = 0; - private final static int CLASS_TYPE = 1; - private final static int ARGS = 2; + private final static int SERVICE_NAME = 0; + private final static int CLASS_NAME = 1; + private final static int CLASS_TYPE = 2; + private final static int ARGS = 3; + private final static int COMMAND_NAME = 4; + + } + + + diff --git a/java/src/ServiceLoader.java b/java/src/ServiceLoader.java new file mode 100644 index 00000000000..c9b201c72a8 --- /dev/null +++ b/java/src/ServiceLoader.java @@ -0,0 +1,242 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ServiceLoader.java + * + * Implementation of a ClassLoader + * + *@author Prashant Jain, Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import java.util.*; +import java.net.*; +import java.lang.*; +import JACE.OS.*; +import JACE.Misc.*; + +public class ServiceLoader extends ClassLoader +{ + /** + * Constructor + */ + public ServiceLoader () + { + super (); + this.getClassPath (); + } + + /** + * Searches the class path for a given file + * + *@param filename File name to look for + *@return Returns the absolute path to the file + * (useful for package name) + */ + public String findFileInClasspath (String filename) + { + // Checks for the given name across the classpath + StringTokenizer tokens = new StringTokenizer (this.classPath_, + this.pathSeparator_); + + while (tokens.hasMoreTokens()) + { + String fn = tokens.nextToken() + this.fileSeparator_ + filename; + + File f = new File (fn); + + if (f.exists() && f.isFile() && f.canRead()) + return new String(f.getAbsolutePath()); + } + + return null; + } + + /** + * Load a class from across the network + */ + public Class loadClass (URL url, boolean resolve) throws ClassNotFoundException + { + Class newClass = null; + // Try to load it the class by reading in the bytes. + // Note that we are not catching ClassNotFoundException here + // since our caller will catch it. + try + { + URLConnection urlConnection = url.openConnection (); + + // Get the input stream associated with the URL connection and + // pipe it to a newly created DataInputStream + DataInputStream i = new DataInputStream (urlConnection.getInputStream ()); + + // Allocate a buffer big enough to hold the contents of the + // data we are about to read + byte [] buf = new byte [urlConnection.getContentLength ()]; + + // Now read all the data into the buffer + i.readFully (buf); + + newClass = defineClass (buf, 0, buf.length); + // ACE.DEBUG ("Loaded class: "+ name); + + // Check if we need to load other classes referred to by this class. + if (resolve) + resolveClass (newClass); + } + catch (IOException e) + { + throw new ClassNotFoundException (e.toString ()); + } + return newClass; + } + + + /** + * Load a class file: + * + * @param fn A file name WITHOUT the .class extension + * @param resolve Standard resolve flag -- user should set to true + * + * @return A Class file capable of creating quasi-useful instances + * of the loaded class. They can't exist in the normal + * Java space, though, so it's impossible to cast them + * to something useful. Use a wrapper and reflection + * as in ServiceRecords. + */ + public Class loadClass (String fn, boolean resolve) throws ClassNotFoundException + { + Class newClass; + + // Load built-in java classes with the system loader + if (fn.startsWith("java")) { + newClass = findSystemClass(fn); + if (newClass == null) + throw (new ClassNotFoundException()); + else + return newClass; + } + + // If given a dot separated qualified name, put it in OS path format. + // This assumes the file separator is one char + String str = new String(fn); + if (str.indexOf('.') >= 0) + str = str.replace('.', this.fileSeparator_.charAt(0)); + str = str + ".class"; + + // Search the class path for the given file name + String fullname = this.findFileInClasspath(str); + if (fullname == null) { + + // If we can't find the class file, see if the + // system can + if ((newClass = findSystemClass(fn)) != null) { + return newClass; + } else + throw (new ClassNotFoundException()); + } + + try + { + // Try to load it the class by reading in the bytes. + // Note that we are not catching ClassNotFoundException here + // since our caller will catch it. + try + { + byte[] buf = bytesForClass (fullname); + + // ***** Note ***** + // This looks inside the class file and digs up the true + // fully qualified class name. You need this to + // load the class! + String className = ClassReader.getClassName(fullname); + + if (className != null) { + ACE.DEBUG("Defining class with name: " + className); + newClass = defineClass (className, buf, 0, buf.length); + } else { + // Try it anyway + newClass = defineClass (null, buf, 0, buf.length); + + ACE.ERROR("Unknown class name"); + } + + // Check if we need to load other classes referred to by this class. + if (resolve) + resolveClass (newClass); + + } catch (ClassNotFoundException e) { + + ACE.DEBUG ("Using default loader for class: " + fn); + + if ((newClass = findSystemClass (fn)) != null) + return newClass; + else + throw (e); // Rethrow the exception + } + } + catch (IOException e) + { + throw new ClassNotFoundException (e.toString ()); + } + + return newClass; + } + + /** + * Get system properties for later use + */ + private void getClassPath () + { + // Cache system properties that are needed when trying to find a + // class file + this.classPath_ = System.getProperty ("java.class.path", "."); + this.pathSeparator_ = System.getProperty ("path.separator", ":"); + this.fileSeparator_ = System.getProperty ("file.separator", "/"); + } + + /** + * Read file into a byte array + */ + private byte[] bytesForClass (String name) throws IOException, ClassNotFoundException + { + // Set up the stream + FileInputStream in = new FileInputStream (name); + + // Get byte count + int length = in.available (); + + if (length == 0) + throw new ClassNotFoundException (name); + + // Create an array of bytes to read the file in + byte[] buf = new byte[length]; + + // Read the file + in.read (buf); + + // Return byte array + return buf; + } + + private String classPath_; + // Class path that is loaded at construction + + private String pathSeparator_; + // Platform-dependent path separator (e.g., : or ;) + + private String fileSeparator_; + // Platform-dependent file separator (e.g., / or \) + + private String context_ = null; +} + + + + + + diff --git a/java/src/ServiceObject.java b/java/src/ServiceObject.java index 56761f81267..1c420c08f3b 100644 --- a/java/src/ServiceObject.java +++ b/java/src/ServiceObject.java @@ -59,4 +59,22 @@ public class ServiceObject implements EventHandler { return -1; } + + /** + * Request that this service suspend activity. Overwrite this + * method to do anything useful. + */ + public int suspend () + { + return -1; + } + + /** + * Request that this service resume activity. Overwrite this + * method to do anything useful. + */ + public int resume () + { + return -1; + } } diff --git a/java/src/ServiceObjectRecord.java b/java/src/ServiceObjectRecord.java new file mode 100644 index 00000000000..b92a72173cb --- /dev/null +++ b/java/src/ServiceObjectRecord.java @@ -0,0 +1,36 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ServiceObjectRecord.java + * + * Provided to show future symmetry. ServiceRecord currently + * provides all the desired behavior necessary for a record + * of a ServiceObject, but later there could be ModuleRecords, + * etc. + * + *@see JACE.ServiceConfigurator.ServiceRecord; + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.lang.*; +import JACE.ServiceConfigurator.*; + +public class ServiceObjectRecord extends ServiceRecord +{ + public ServiceObjectRecord (Object so, String name) + { + super (so, name); + } + +}; + + + + + diff --git a/java/src/ServiceRecord.java b/java/src/ServiceRecord.java new file mode 100644 index 00000000000..6c598aa732f --- /dev/null +++ b/java/src/ServiceRecord.java @@ -0,0 +1,257 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * ServiceRecord.java + * + * This class structure is used in the ServiceRepository. Each service + * object, module, or stream in the repository should be wrapped by a + * type of ServiceRecord. The contained object does the real work. + * + * Modules and Streams will require records with more functionality. + * + * The caller should never be allowed to access the Object within the + * record -- casting will result in a ClassCastException because of + * the problem with loading classes with a ClassLoader. To get + * around this, all the method calls are made on the Object via + * reflection. + * + *@see JACE.ServiceConfigurator.ServiceObject + *@see JACE.ServiceConfigurator.ServiceRepository + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import java.lang.*; +import java.lang.reflect.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; + +public class ServiceRecord +{ + /** + * Constructor + * + *@param service A java Object, the service + *@param name Name of this service + */ + ServiceRecord (Object service, String name) + { + this.service_ = service; + this.name_ = name; + this.suspended_ = false; + } + + /** + * Forward the call to suspend + * @return -1 error + */ + public int suspend() + { + this.setSuspend(true); + + Object result = this.invokeSimpleReflected("suspend"); + + if (result == null) + return -1; + else + return ((Integer)result).intValue(); + } + + + /** + * Forward the call to resume + * @return -1 error + */ + public int resume() + { + this.setSuspend(false); + + Object result = this.invokeSimpleReflected("resume"); + + if (result == null) + return -1; + else + return ((Integer)result).intValue(); + } + + + /** + * Initialize the service, provide the given command line args to it. + * + */ + public int init(String [] args) + { + Class types[] = new Class[1]; + if (args == null) + args = new String[0]; + + types[0] = args.getClass(); + + // Find the method we want to call + Method m; + try { + m = this.object().getClass().getMethod("init", types); + } catch (NoSuchMethodException e) { + ACE.ERROR("" + e); + return -1; + } catch (SecurityException e) { + ACE.ERROR("" + e); + return -1; + } + + Class ptypes[] = m.getParameterTypes(); + //for (int x = 0; x < ptypes.length; x++) + // System.err.println(ptypes[x].getName()); + Object params[] = new Object[1]; + + params[0] = args; + + int result = -1; + try { + result = ((Integer)m.invoke(this.object(), params)).intValue(); + } catch (IllegalAccessException e) { + ACE.ERROR("" + e); + return -1; + } catch (IllegalArgumentException e) { + ACE.ERROR("" + e); + return -1; + } catch (InvocationTargetException e) { + ACE.ERROR("init(): " + e.getTargetException()); + return -1; + } + + return result; + } + + /** + * Prepare to close it + */ + public int fini() + { + Object result = this.invokeSimpleReflected("fini"); + + if (result == null) + return -1; + else + return ((Integer)result).intValue(); + } + + /** + * Obtain information about this service + */ + public String info() + { + Object result = this.invokeSimpleReflected("info"); + + System.err.println("info fin"); + + if (result == null) + return null; + else + return new String((String)result); + } + + /** Invokes the method with the given name on the ServiceObject. + * The invoked method must take no parameters for this to work. + * Could be adjusted to throw a generic exception. + */ + private Object invokeSimpleReflected(String name) + { + Method m; + + // find the desired method + try { + m = this.object().getClass().getMethod(name, null); + } catch (NoSuchMethodException e) { + ACE.ERROR("" + e); + return null; + } catch (SecurityException e) { + ACE.ERROR("" + e); + return null; + } + + // Invoke it + Object result = null; + + try { + result = m.invoke(this.object(), null); + } catch (IllegalAccessException e) { + ACE.ERROR("" + e); + } catch (IllegalArgumentException e) { + ACE.ERROR("" + e); + } catch (InvocationTargetException e) { + ACE.ERROR(name + "(): " + e.getTargetException()); + } + + return result; + } + + /** + * Accessor for the name + */ + public String name() + { + return new String(this.name_); + } + + /** Set the name of the service + */ + public void name(String name) + { + this.name_ = name; + } + + /** Is this service suspended? + */ + public boolean suspended() + { + return this.suspended_; + } + + /** Set the suspended flag + */ + void setSuspend (boolean suspended) + { + this.suspended_ = suspended; + } + + /** Accessor for the contained Object. This should + * never be available to the end user since they + * might try casting the result. + */ + Object object() + { + return this.service_; + } + + /** + * Set the contained object + */ + void object(Object service) + { + this.service_ = service; + } + + Object service_; + String name_; + boolean suspended_; +}; + + +/* +class ModuleRecord extends ServiceRecord +{ +}; + +class StreamRecord extends ServiceRecord +{ +}; +*/ + + diff --git a/java/src/ServiceRepository.java b/java/src/ServiceRepository.java index de5e4384b7d..79e5ed168fb 100644 --- a/java/src/ServiceRepository.java +++ b/java/src/ServiceRepository.java @@ -6,277 +6,187 @@ * = FILENAME * ServiceRepository.java * - *@author Prashant Jain + * The service repository stores the network services, allowing them to be removed, suspended, + * resumed, etc. To reload a service, the caller must remove it from the repository and then + * call prepareForReload(). + * + *@see JACE.ServiceConfigurator.ServiceRecord; + *@see JACE.ServiceConfigurator.ServiceConfig; + * + *@author Everett Anderson * *************************************************/ package JACE.ServiceConfigurator; import java.io.*; import java.util.*; -import java.net.*; -import JACE.OS.*; - -/** - * <hr> - * <h2>SYNOPSIS</h2> - *<blockquote> - * Provides a repository for loaded Java classes - *</blockquote> - * - * <h2>DESCRIPTION</h2> - *<blockquote> - * This class provides a means to load Java classes explicitly at - * runtime. Note that since the class makes use of the Java - * ClassLoader, this class can not be used in a Java applet. - *</blockquote> - */ +import JACE.ServiceConfigurator.*; + public class ServiceRepository { /** - * Create a Service Repository. + * Constructor */ public ServiceRepository () { - this.loader_ = new ServiceLoader (null); + this.serviceVector_ = new Vector(); } /** - * Create a Service Repository passing in the context. Note that - * this can cause problems for the default system loader since it will - * try to load all the system classes using the context specified. - *@param context Context to use when loading classes. + * Constructor + * + *@param initialSize Initial vector size for the repository */ - public ServiceRepository (String context) + public ServiceRepository (int initialSize) { - this.loader_ = new ServiceLoader (context); + this.serviceVector_ = new Vector (initialSize); } /** - * Set the context - *@param context Context to use when loading classes. + * Shut down all the services, closing them in reverse order of insertion + * + * Maybe should be called by finalize? */ - public void context (String c) - { - this.loader_.context (c); + public int close() + { + for (int i = this.size() - 1; i >= 0; i--) { + ServiceRecord rec = (ServiceRecord)this.serviceVector_.elementAt(i); + + rec.fini(); + + this.serviceVector_.removeElementAt(i); + } + + return 0; } /** - * Load a Java Class. This method first checks if the class is - * already in the repository. If it is not, it checks if the class - * is a system class and can be found on the local system. If both - * these fail, the method tries to load the bytes for the class and - * then create the Class from these bytes. - *@param name name of the class to find in the repository - *@return Class corresponding to name + * Insert a ServiceRecord into the repository. + * (If already in, calls fini() and replaces) + * + *@param srvRec ServiceRecord to add */ - public Class load (String name) throws ClassNotFoundException + public void insert (ServiceRecord srvRec) { - return this.loader_.loadClass (name, true); + ServiceRecord alreadyIn = find(srvRec.name()); + + // Replace the service + if (alreadyIn != null) { + alreadyIn.fini(); + this.serviceVector_.removeElement(alreadyIn); + } + + this.serviceVector_.addElement(srvRec); } /** - * Load a Java Class across the network. The method tries to load - * the bytes for the class and then create the Class from these - * bytes. - *@param url URL of the class to load - *@return Class corresponding to the url + * Finds the ServiceRecord associated with a given + * service name. Note -- the user should not try to + * get a ServiceObject out of the ServiceRecord. + * Same as saying ignoreSuspended is false on the + * next method. + * + *@param name Name of the service to find */ - public Class load (URL url) throws ClassNotFoundException + public ServiceRecord find (String name) { - return this.loader_.loadClass (url, true); + return this.find(name, false); } - private ServiceLoader loader_; -} - -class ServiceLoader extends ClassLoader -{ - public ServiceLoader (String context) + /** Return the service record for the given service. The caller + * should NOT try to access a ServiceObject (or Module or Stream) + * by taking it out of the ServiceRecord -- just make the calls + * through the record! + * + *@param name Name of the service to find + *@param ignoreSuspended Allow finding suspended services? + */ + public ServiceRecord find (String name, boolean ignoreSuspended) { - super (); - if (context == null) - this.getClassPath (); - else - this.context_ = context; - } + ServiceRecord rec; - public void context (String c) - { - this.context_ = c; + for (int i = 0; i < this.size(); i++) { + rec = (ServiceRecord)this.serviceVector_.elementAt(i); + + if ((rec.name().equals(name)) && ((!ignoreSuspended) || (!rec.suspended()))) + return rec; + } + + return null; } - // Load a compiled class file into runtime - public Class loadClass (String name, boolean resolve) throws ClassNotFoundException + /** Take the given service out of the repository. This also sets the + * reference in the repository to null to ensure there are no + * hidden references to the old ServiceObject. To reload, the user must + * still run prepareToReload on ServiceConfig if they don't want any + * problems. + */ + public int remove (String name) { - Class newClass; - if (this.context_ == null) - { - try - { - // Try to load it the class by reading in the bytes. - // Note that we are not catching ClassNotFoundException here - // since our caller will catch it. - try - { - byte[] buf = bytesForClass (name); - newClass = defineClass (buf, 0, buf.length); - // ACE.DEBUG ("Loaded class: "+ name); - - // Check if we need to load other classes referred to by this class. - if (resolve) - resolveClass (newClass); - } - catch (ClassNotFoundException e) - { - // ACE.DEBUG ("Using default loader for class: "+ name); - // Try default system loader - if ((newClass = findSystemClass (name)) != null) - return newClass; - else - throw (e); // Rethrow the exception - } - } - catch (IOException e) - { - throw new ClassNotFoundException (e.toString ()); - } - } - else - { - System.out.println ("Fetching over the net"); - System.out.println ("Context: " + this.context_); - // Try to load it the class by reading in the bytes. - // Note that we are not catching ClassNotFoundException here - // since our caller will catch it. - try - { - URL url = new URL (this.context_ + name); - URLConnection urlConnection = url.openConnection (); - - // Get the input stream associated with the URL connection and - // pipe it to a newly created DataInputStream - DataInputStream i = new DataInputStream (urlConnection.getInputStream ()); - - // Allocate a buffer big enough to hold the contents of the - // data we are about to read - byte [] buf = new byte [urlConnection.getContentLength ()]; - - // Now read all the data into the buffer - i.readFully (buf); - - newClass = defineClass (buf, 0, buf.length); - // ACE.DEBUG ("Loaded class: "+ name); - - // Check if we need to load other classes referred to by this class. - if (resolve) - resolveClass (newClass); - } - catch (IOException e) - { - throw new ClassNotFoundException (e.toString ()); - } - } - return newClass; + ACE.DEBUG("Removing service: " + name); + + ServiceRecord rec = this.find(name, false); + + if (rec == null) + return -1; + + int index = this.serviceVector_.indexOf(rec); + + // Shut down the service + rec.fini(); + + // Make sure there are no hidden references left + this.serviceVector_.setElementAt(null, index); + + this.serviceVector_.removeElementAt(index); + + return 0; } - // Load a compiled class file across the network - public Class loadClass (URL url, boolean resolve) throws ClassNotFoundException + /** + * Resume a suspended service + *@param name Name of the service to resume + */ + public int resume (String name) { - Class newClass = null; - // Try to load it the class by reading in the bytes. - // Note that we are not catching ClassNotFoundException here - // since our caller will catch it. - try - { - URLConnection urlConnection = url.openConnection (); - - // Get the input stream associated with the URL connection and - // pipe it to a newly created DataInputStream - DataInputStream i = new DataInputStream (urlConnection.getInputStream ()); - - // Allocate a buffer big enough to hold the contents of the - // data we are about to read - byte [] buf = new byte [urlConnection.getContentLength ()]; - - // Now read all the data into the buffer - i.readFully (buf); - - newClass = defineClass (buf, 0, buf.length); - // ACE.DEBUG ("Loaded class: "+ name); - - // Check if we need to load other classes referred to by this class. - if (resolve) - resolveClass (newClass); - } - catch (IOException e) - { - throw new ClassNotFoundException (e.toString ()); - } - return newClass; + ServiceRecord rec = this.find(name, false); + + if (rec == null) + return -1; + + return rec.resume(); } - private void getClassPath () + /** + * Suspend a service + *@param name Name of the service to suspend + */ + public int suspend (String name) { - // Cache system properties that are needed when trying to find a - // class file - this.classPath_ = System.getProperty ("java.class.path", "."); - this.pathSeparator_ = System.getProperty ("path.separator", ":"); - this.fileSeparator_ = System.getProperty ("file.separator", "/"); + ServiceRecord rec = this.find(name, false); + + if (rec == null) + return -1; + + return rec.suspend(); } - // Read a file into a byte array - private byte[] bytesForClass (String name) throws IOException, ClassNotFoundException + /** + * Returns the number of items in the repository + */ + public int size () { - // Break up the CLASSPATH to check for existence of file in each - // sub-path. Note that we use the path_separator to extract every - // sub-path and use that to check if the class file exists. - StringTokenizer tokens = new StringTokenizer (this.classPath_, - this.pathSeparator_); - while (tokens.hasMoreTokens ()) - { - // Create a File object which can then be used to see if the - // class file actually exists - File classFile = new File (tokens.nextToken () + - this.fileSeparator_ + - name + - ".class"); - - // Check if file exists, is a normal file and is readable - if (true) /*classFile.exists () && - classFile.isFile () && - classFile.canRead ()) */ - { - // Set up the stream - FileInputStream in = new FileInputStream (classFile); - - // Get byte count - int length = in.available (); - - if (length == 0) - throw new ClassNotFoundException (name); - - // Create an array of bytes to read the file in - byte[] buf = new byte[length]; - - // Read the file - in.read (buf); - - // Return byte array - return buf; - } - } - // File was not found so throw an exception. - throw new ClassNotFoundException ("Class file " + name + " not found"); + return this.serviceVector_.size(); } - private String classPath_; - // Class path that is loaded at construction + // Vector representation + Vector serviceVector_; +}; + + - private String pathSeparator_; - // Platform-dependent path separator (e.g., : or ;) + - private String fileSeparator_; - // Platform-dependent file separator (e.g., / or \) + - private String context_ = null; -} + diff --git a/java/src/SuspendNode.java b/java/src/SuspendNode.java new file mode 100644 index 00000000000..a34ae457e80 --- /dev/null +++ b/java/src/SuspendNode.java @@ -0,0 +1,37 @@ +/************************************************* + * + * = PACKAGE + * JACE.ServiceConfigurator + * + * = FILENAME + * SuspendNode.java + * + * Used when a service is specified to be suspended based on a line + * in a service configurator file. The actual implementation of the + * service being suspended does the work. + * + *@author Everett Anderson + * + *************************************************/ +package JACE.ServiceConfigurator; + +import java.io.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; +import java_cup.runtime.*; + +class SuspendNode extends ParseNode +{ + public SuspendNode (int act_num) + { + super(act_num); + } + + public void apply () + { + ACE.DEBUG("Suspend Node apply: " + this.name_); + + if (JACE.ServiceConfigurator.ServiceConfig.suspend(this.name_) == -1) + ACE.ERROR("Error suspending " + this.name_); + } +}; diff --git a/java/src/SvcHandler.java b/java/src/SvcHandler.java index 0ba7f671e0d..cb9af5a3334 100644 --- a/java/src/SvcHandler.java +++ b/java/src/SvcHandler.java @@ -81,5 +81,5 @@ public abstract class SvcHandler extends Task return -1; } - private SOCKStream stream_; + protected SOCKStream stream_; } diff --git a/java/src/Svc_Conf.y b/java/src/Svc_Conf.y new file mode 100644 index 00000000000..1079779eb31 --- /dev/null +++ b/java/src/Svc_Conf.y @@ -0,0 +1,210 @@ +package JACE.ServiceConfigurator; + +import java.io.*; +import java.lang.*; +import java_cup.runtime.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; + +parser code {: + // Lexical Analyzer + private Yylex lexer_; + + public void setLexer(Yylex lexer) + { + this.lexer_ = lexer; + } +:}; + +init with {: + try { + + FileInputStream fs = new FileInputStream(new String(ServiceConfig.serviceConfigFile_)); + + this.setLexer(new Yylex(fs)); + + } catch (FileNotFoundException fnf) { + + ACE.ERROR("File not found: " + fnf); + + } catch (SecurityException se) { + + ACE.ERROR("Security: " + se); + } +:}; + +scan with {: return this.lexer_.yylex(); :}; + +terminal token ACE_DYNAMIC, ACE_STATIC, ACE_SUSPEND, ACE_RESUME, ACE_REMOVE, ACE_STREAM; +terminal token ACE_MODULE_T, ACE_STREAM_T, ACE_SVC_OBJ_T, ACE_ACTIVE, ACE_INACTIVE; +terminal str_token ACE_PATHNAME, ACE_IDENT, ACE_STRING; +terminal token ACE_LPAREN, ACE_RPAREN, ACE_LBRACE, ACE_RBRACE, ACE_STAR, ACE_COLON; +terminal token ACE_USTREAM; + +non terminal AddServiceObjectNode dynamic, svc_location; /* AddServiceObjectNode */ +non terminal SuspendNode suspend; /* SuspendNode */ +non terminal ResumeNode resume; /* ResumeNode */ +non terminal RemoveNode remove; /* RemoveNode */ +non terminal ParseNode module_list, stream, svc_config_entry; +non terminal ParseNode svc_config_entries, static; +non terminal java_cup.runtime.str_token stream_modules, module; +non terminal java_cup.runtime.int_token status; +non terminal java_cup.runtime.str_token svc_initializer; +non terminal java_cup.runtime.str_token pathname, parameters_opt; +non terminal java_cup.runtime.str_token stream_ops, type; + +start with svc_config_entries; + +svc_config_entries ::= svc_config_entry:e1 svc_config_entries + {: + if (e1 != null) + e1.apply(); + :} + | + svc_config_entry:e1 + {: + if (e1 != null) + e1.apply(); + :} + ; + +svc_config_entry ::= dynamic + {: + /* Empty -- result auto set to dynamic */ + /* CUP$result = (ParseNode)CUP$stack.elementAt(CUP$top-0); */ + :} + | + static + {: + /* More graceful error system needed here */ + ACE.ERROR("Not implemented: static service loading"); :} + | + suspend + {: + /* Empty -- result auto set to suspend */ + /* CUP$result = (ParseNode)CUP$stack.elementAt(CUP$top-0); */ + :} + | + resume + {: /* Empty -- result auto set to resume */ + :} + | + remove + {: + + :} + | + stream + {: ACE.ERROR("Not implemented: stream loading"); :} + ; + +dynamic ::= ACE_DYNAMIC svc_location:e1 parameters_opt:e2 +{: + RESULT.init(e1.name(), e1.locator(), e1.suspended()); + + RESULT.params(e2.str_val); +:} + ; + +static ::= ACE_STATIC ACE_IDENT parameters_opt + ; + +suspend ::= ACE_SUSPEND ACE_IDENT:e1 +{: + RESULT.init(e1.str_val); +:} + ; + +resume ::= ACE_RESUME ACE_IDENT:e1 +{: + RESULT.init(e1.str_val); +:} + ; + +remove ::= ACE_REMOVE ACE_IDENT:e1 +{: + RESULT.init(e1.str_val); +:} + ; + +stream ::= ACE_USTREAM stream_ops stream_modules + | + ACE_USTREAM ACE_IDENT stream_modules + ; + +stream_ops ::= dynamic + | + static + ; + +stream_modules ::= ACE_LBRACE + | + module_list ACE_RBRACE + ; + +module_list ::= module_list module + {: ACE.ERROR("Not implemented: module manipulation"); :} + | + {: ACE.ERROR("Not implemented: module manipulation"); :} + ; + +module ::= dynamic + | + static + | + suspend + | + resume + | + remove + ; + +svc_location ::= ACE_IDENT:e1 type:e2 svc_initializer:e3 status:e4 +{: + boolean suspended = false; + if (e4.int_val == 1) + suspended = true; + + RESULT.init(e1.str_val, e3.str_val, suspended); +:} +; + +status ::= ACE_ACTIVE + {: RESULT.int_val = 0; :} + | + ACE_INACTIVE + {: RESULT.int_val = 1; :} + | + {: // Default case + RESULT.int_val = 0; :} + ; + +svc_initializer ::= pathname:e1 ACE_COLON ACE_IDENT:e2 + {: RESULT.str_val = new String(e1.str_val + ":" + e2.str_val); :} + | + pathname:e1 ACE_COLON ACE_IDENT:e2 ACE_LPAREN ACE_RPAREN + {: RESULT.str_val = new String(e1.str_val + ":" + e2.str_val); :} + ; + +type ::= ACE_MODULE_T ACE_STAR + | + ACE_SVC_OBJ_T ACE_STAR + {: RESULT.str_val = new String("Service Object"); :} + | + ACE_STREAM_T ACE_STAR + ; + +parameters_opt ::= ACE_STRING:e + {: RESULT.str_val = new String(e.str_val); :} + | + ; + +pathname ::= ACE_PATHNAME:e + {: RESULT.str_val = new String(e.str_val); :} + | + ACE_IDENT:e + {: RESULT.str_val = new String(e.str_val); :} + ; + + + diff --git a/java/src/Yylex.java b/java/src/Yylex.java new file mode 100644 index 00000000000..a23a48efe88 --- /dev/null +++ b/java/src/Yylex.java @@ -0,0 +1,1316 @@ +package JACE.ServiceConfigurator; +import java.lang.*; +import java.io.*; +import JACE.OS.*; +import java_cup.runtime.*; +// This was written for JLex version 1.2 + + +class Yylex { + private final int YY_BUFFER_SIZE = 512; + private final int YY_F = -1; + private final int YY_NO_STATE = -1; + private final int YY_NOT_ACCEPT = 0; + private final int YY_START = 1; + private final int YY_END = 2; + private final int YY_NO_ANCHOR = 4; + private final byte YYEOF = -1; + + // Used to assemble the parameter string for a service + private String params; + private java.io.DataInputStream yy_instream; + private int yy_buffer_index; + private int yy_buffer_read; + private int yy_buffer_start; + private int yy_buffer_end; + private byte yy_buffer[]; + private int yyline; + private int yy_lexical_state; + Yylex (java.io.InputStream instream) { + if (null == instream) { + throw (new Error("Error: Bad input stream initializer.")); + } + yy_instream = new java.io.DataInputStream(instream); + yy_buffer = new byte[YY_BUFFER_SIZE]; + yy_buffer_read = 0; + yy_buffer_index = 0; + yy_buffer_start = 0; + yy_buffer_end = 0; + yyline = 0; + yy_lexical_state = YYINITIAL; + } + private boolean yy_eof_done = false; + private final int COMMENT = 1; + private final int YYINITIAL = 0; + private final int PARAMS = 2; + private final int yy_state_dtrans[] = { + 0, + 23, + 30 + }; + private void yybegin (int state) { + yy_lexical_state = state; + } + private byte yy_advance () + throws java.io.IOException { + int next_read; + int i; + int j; + + if (yy_buffer_index < yy_buffer_read) { + return yy_buffer[yy_buffer_index++]; + } + + if (0 != yy_buffer_start) { + i = yy_buffer_start; + j = 0; + while (i < yy_buffer_read) { + yy_buffer[j] = yy_buffer[i]; + ++i; + ++j; + } + yy_buffer_end = yy_buffer_end - yy_buffer_start; + yy_buffer_start = 0; + yy_buffer_read = j; + yy_buffer_index = j; + next_read = yy_instream.read(yy_buffer, + yy_buffer_read, + yy_buffer.length - yy_buffer_read); + if (-1 == next_read) { + return YYEOF; + } + yy_buffer_read = yy_buffer_read + next_read; + } + + while (yy_buffer_index >= yy_buffer_read) { + if (yy_buffer_index >= yy_buffer.length) { + yy_buffer = yy_double(yy_buffer); + } + next_read = yy_instream.read(yy_buffer, + yy_buffer_read, + yy_buffer.length - yy_buffer_read); + if (-1 == next_read) { + return YYEOF; + } + yy_buffer_read = yy_buffer_read + next_read; + } + return yy_buffer[yy_buffer_index++]; + } + private void yy_move_start () { + if ((byte) '\n' == yy_buffer[yy_buffer_start]) { + ++yyline; + } + ++yy_buffer_start; + } + private void yy_pushback () { + --yy_buffer_end; + } + private void yy_mark_start () { + int i; + for (i = yy_buffer_start; i < yy_buffer_index; ++i) { + if ((byte) '\n' == yy_buffer[i]) { + ++yyline; + } + } + yy_buffer_start = yy_buffer_index; + } + private void yy_mark_end () { + yy_buffer_end = yy_buffer_index; + } + private void yy_to_mark () { + yy_buffer_index = yy_buffer_end; + } + private java.lang.String yytext () { + return (new java.lang.String(yy_buffer,0, + yy_buffer_start, + yy_buffer_end - yy_buffer_start)); + } + private int yylength () { + return yy_buffer_end - yy_buffer_start; + } + private byte[] yy_double (byte buf[]) { + int i; + byte newbuf[]; + newbuf = new byte[2*buf.length]; + for (i = 0; i < buf.length; ++i) { + newbuf[i] = buf[i]; + } + return newbuf; + } + private final int YY_E_INTERNAL = 0; + private final int YY_E_MATCH = 1; + private java.lang.String yy_error_string[] = { + "Error: Internal error.\n", + "Error: Unmatched input.\n" + }; + private void yy_error (int code,boolean fatal) { + java.lang.System.out.print(yy_error_string[code]); + java.lang.System.out.flush(); + if (fatal) { + throw new Error("Fatal Error.\n"); + } + } + private int yy_acpt[] = { + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NOT_ACCEPT, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NOT_ACCEPT, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR, + YY_NO_ANCHOR + }; + private int yy_cmap[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 3, 4, 0, 0, 0, 0, + 5, 6, 7, 0, 0, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 10, 0, 0, 0, 0, 0, + 0, 11, 12, 12, 12, 13, 12, 12, + 12, 12, 12, 12, 12, 14, 12, 15, + 12, 12, 16, 17, 18, 12, 12, 12, + 12, 12, 12, 0, 8, 0, 0, 19, + 0, 20, 21, 22, 23, 24, 12, 12, + 12, 25, 26, 12, 27, 28, 29, 30, + 31, 12, 32, 33, 34, 35, 36, 12, + 12, 37, 12, 38, 0, 39, 0, 0 + + }; + private int yy_rmap[] = { + 0, 1, 1, 1, 1, 1, 1, 2, + 1, 3, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 4, + 1, 1, 1, 1, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67 + }; + private int yy_nxt[][] = { + { 1, 28, 28, 2, 3, 4, 5, 6, + 7, 7, 8, 9, 9, 9, 72, 9, + 9, 73, 9, 9, 74, 9, 9, 81, + 9, 84, 9, 9, 9, 9, 9, 9, + 75, 76, 9, 9, 9, 9, 10, 11 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 7, -1, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { 24, 24, 25, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24 + + }, + { -1, 28, 28, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 12, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { 26, 26, 27, 27, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 13, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 14, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 15, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 16, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 17, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 18, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 19, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 20, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 21, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 22, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 29, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 31, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 32, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 33, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 34, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 35, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 36, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 37, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 38, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 39, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 40, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 41, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 42, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 43, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 44, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 45, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 46, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 47, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 48, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 49, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 50, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 51, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 52, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 53, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 54, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 55, 9, 9, 9, + 9, 56, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 57, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 58, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 59, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 60, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 61, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 62, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 63, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 64, 9, 9, 9, 9, 9, + 90, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 65, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 66, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 67, 78, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 68, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 69, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 70, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 71, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 77, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 79, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 80, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 82, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 83, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 85, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 86, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 87, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 88, 9, -1, -1 + + }, + { -1, -1, -1, -1, -1, -1, -1, -1, + 7, 9, -1, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, + 89, 9, 9, 9, 9, 9, -1, -1 + + } + }; + public java_cup.runtime.token yylex () + throws java.io.IOException { + byte yy_lookahead; + int yy_anchor = YY_NO_ANCHOR; + int yy_state = yy_state_dtrans[yy_lexical_state]; + int yy_next_state = YY_NO_STATE; + int yy_last_accept_state = YY_NO_STATE; + boolean yy_initial = true; + int yy_this_accept; + + yy_mark_start(); + yy_this_accept = yy_acpt[yy_state]; + if (YY_NOT_ACCEPT != yy_this_accept) { + yy_last_accept_state = yy_state; + yy_mark_end(); + } + while (true) { + yy_lookahead = yy_advance(); + yy_next_state = YY_F; + if (YYEOF != yy_lookahead) { + yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]]; + } + if (YY_F != yy_next_state) { + yy_state = yy_next_state; + yy_initial = false; + yy_this_accept = yy_acpt[yy_state]; + if (YY_NOT_ACCEPT != yy_this_accept) { + yy_last_accept_state = yy_state; + yy_mark_end(); + } + } + else { + if (YYEOF == yy_lookahead && true == yy_initial) { + + return new java_cup.runtime.token (sym.EOF); + } + else if (YY_NO_STATE == yy_last_accept_state) { + throw (new Error("Lexical Error: Unmatched Input.")); + } + else { + yy_to_mark(); + yy_anchor = yy_acpt[yy_last_accept_state]; + if (0 != (YY_END & yy_anchor)) { + yy_pushback(); + } + if (0 != (YY_START & yy_anchor)) { + yy_move_start(); + } + switch (yy_last_accept_state) { + case 0: + { /* Skip all white space */ } + case -2: + break; + case 1: + { + ACE.ERROR ("Unknown text, line " + (yyline + 1) + ": \"" + yytext() + "\""); + return new java_cup.runtime.str_token (sym.error); +} + case -3: + break; + case 2: + { + yybegin(PARAMS); + params = new String(); +} + case -4: + break; + case 3: + { yybegin(COMMENT); } + case -5: + break; + case 4: + { return new java_cup.runtime.token (sym.ACE_LPAREN); } + case -6: + break; + case 5: + { return new java_cup.runtime.token (sym.ACE_RPAREN); } + case -7: + break; + case 6: + { return new java_cup.runtime.token (sym.ACE_STAR); } + case -8: + break; + case 7: + { + return new java_cup.runtime.str_token (sym.ACE_PATHNAME, yytext()); +} + case -9: + break; + case 8: + { return new java_cup.runtime.token (sym.ACE_COLON); } + case -10: + break; + case 9: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -11: + break; + case 10: + { return new java_cup.runtime.token (sym.ACE_LBRACE); } + case -12: + break; + case 11: + { return new java_cup.runtime.token (sym.ACE_RBRACE); } + case -13: + break; + case 12: + { return new java_cup.runtime.token (sym.ACE_MODULE_T); } + case -14: + break; + case 13: + { return new java_cup.runtime.token (sym.ACE_STREAM_T); } + case -15: + break; + case 14: + { return new java_cup.runtime.token (sym.ACE_ACTIVE); } + case -16: + break; + case 15: + { return new java_cup.runtime.token (sym.ACE_REMOVE); } + case -17: + break; + case 16: + { return new java_cup.runtime.token (sym.ACE_RESUME); } + case -18: + break; + case 17: + { return new java_cup.runtime.token (sym.ACE_STATIC); } + case -19: + break; + case 18: + { return new java_cup.runtime.token (sym.ACE_USTREAM); } + case -20: + break; + case 19: + {return new java_cup.runtime.token (sym.ACE_DYNAMIC); } + case -21: + break; + case 20: + { return new java_cup.runtime.token (sym.ACE_SUSPEND); } + case -22: + break; + case 21: + { return new java_cup.runtime.token (sym.ACE_INACTIVE); } + case -23: + break; + case 22: + { return new java_cup.runtime.token (sym.ACE_SVC_OBJ_T); } + case -24: + break; + case 24: + { /* Skip everything on a comment line */ } + case -25: + break; + case 25: + { yybegin(YYINITIAL); } + case -26: + break; + case 26: + { + params = params + yytext(); +} + case -27: + break; + case 27: + { + yybegin(YYINITIAL); + return new java_cup.runtime.str_token (sym.ACE_STRING, params); +} + case -28: + break; + case 28: + { /* Skip all white space */ } + case -29: + break; + case 29: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -30: + break; + case 31: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -31: + break; + case 32: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -32: + break; + case 33: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -33: + break; + case 34: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -34: + break; + case 35: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -35: + break; + case 36: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -36: + break; + case 37: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -37: + break; + case 38: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -38: + break; + case 39: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -39: + break; + case 40: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -40: + break; + case 41: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -41: + break; + case 42: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -42: + break; + case 43: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -43: + break; + case 44: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -44: + break; + case 45: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -45: + break; + case 46: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -46: + break; + case 47: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -47: + break; + case 48: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -48: + break; + case 49: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -49: + break; + case 50: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -50: + break; + case 51: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -51: + break; + case 52: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -52: + break; + case 53: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -53: + break; + case 54: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -54: + break; + case 55: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -55: + break; + case 56: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -56: + break; + case 57: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -57: + break; + case 58: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -58: + break; + case 59: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -59: + break; + case 60: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -60: + break; + case 61: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -61: + break; + case 62: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -62: + break; + case 63: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -63: + break; + case 64: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -64: + break; + case 65: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -65: + break; + case 66: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -66: + break; + case 67: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -67: + break; + case 68: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -68: + break; + case 69: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -69: + break; + case 70: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -70: + break; + case 71: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -71: + break; + case 72: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -72: + break; + case 73: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -73: + break; + case 74: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -74: + break; + case 75: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -75: + break; + case 76: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -76: + break; + case 77: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -77: + break; + case 78: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -78: + break; + case 79: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -79: + break; + case 80: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -80: + break; + case 81: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -81: + break; + case 82: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -82: + break; + case 83: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -83: + break; + case 84: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -84: + break; + case 85: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -85: + break; + case 86: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -86: + break; + case 87: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -87: + break; + case 88: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -88: + break; + case 89: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -89: + break; + case 90: + { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} + case -90: + break; + default: + yy_error(YY_E_INTERNAL,false); + case -1: + } + yy_initial = true; + yy_state = yy_state_dtrans[yy_lexical_state]; + yy_next_state = YY_NO_STATE; + yy_last_accept_state = YY_NO_STATE; + yy_mark_start(); + yy_this_accept = yy_acpt[yy_state]; + if (YY_NOT_ACCEPT != yy_this_accept) { + yy_last_accept_state = yy_state; + } + } + } + } + } +} diff --git a/java/src/Yylex.lex b/java/src/Yylex.lex new file mode 100644 index 00000000000..e40a69f73f7 --- /dev/null +++ b/java/src/Yylex.lex @@ -0,0 +1,79 @@ +package JACE.ServiceConfigurator; + +import java.lang.*; +import java.io.*; +import JACE.OS.*; +import java_cup.runtime.*; + +// This was written for JLex version 1.2 + +%% + +// Return a java_cup.runtime.token instead of a Yytoken from yylex() +%type java_cup.runtime.token +%{ + // Used to assemble the parameter string for a service + private String params; +%} + +%eofval{ + return new java_cup.runtime.token (sym.EOF); +%eofval} + +%line + +%state COMMENT +%state PARAMS + +ALPHA=[A-Za-z_] +DIGIT=[0-9] +WHITE_SPACE=[\ \t\b\012] +PATHNAME=[\.\\\/A-Za-z_\-0-9] +NEWLINE=\n +OTHER=. + +%% + +<YYINITIAL> dynamic {return new java_cup.runtime.token (sym.ACE_DYNAMIC); } +<YYINITIAL> static { return new java_cup.runtime.token (sym.ACE_STATIC); } +<YYINITIAL> suspend { return new java_cup.runtime.token (sym.ACE_SUSPEND); } +<YYINITIAL> resume { return new java_cup.runtime.token (sym.ACE_RESUME); } +<YYINITIAL> remove { return new java_cup.runtime.token (sym.ACE_REMOVE); } +<YYINITIAL> stream { return new java_cup.runtime.token (sym.ACE_USTREAM); } +<YYINITIAL> Module { return new java_cup.runtime.token (sym.ACE_MODULE_T); } +<YYINITIAL> Service_Object { return new java_cup.runtime.token (sym.ACE_SVC_OBJ_T); } +<YYINITIAL> STREAM { return new java_cup.runtime.token (sym.ACE_STREAM_T); } +<YYINITIAL> active { return new java_cup.runtime.token (sym.ACE_ACTIVE); } +<YYINITIAL> inactive { return new java_cup.runtime.token (sym.ACE_INACTIVE); } +<YYINITIAL> ":" { return new java_cup.runtime.token (sym.ACE_COLON); } +<YYINITIAL> \" { + yybegin(PARAMS); + params = new String(); +} +<YYINITIAL> "#" { yybegin(COMMENT); } +<YYINITIAL> "*" { return new java_cup.runtime.token (sym.ACE_STAR); } +<YYINITIAL> "(" { return new java_cup.runtime.token (sym.ACE_LPAREN); } +<YYINITIAL> ")" { return new java_cup.runtime.token (sym.ACE_RPAREN); } +<YYINITIAL> "{" { return new java_cup.runtime.token (sym.ACE_LBRACE); } +<YYINITIAL> "}" { return new java_cup.runtime.token (sym.ACE_RBRACE); } +<YYINITIAL> {WHITE_SPACE}* { /* Skip all white space */ } +<YYINITIAL> {ALPHA}({ALPHA}|{DIGIT}|_)* { + return new java_cup.runtime.str_token (sym.ACE_IDENT, yytext()); +} +<YYINITIAL> {PATHNAME}* { + return new java_cup.runtime.str_token (sym.ACE_PATHNAME, yytext()); +} +<YYINITIAL> {NEWLINE} { /* Empty */ } +<YYINITIAL> {OTHER} { + ACE.ERROR ("Unknown text, line " + (yyline + 1) + ": \"" + yytext() + "\""); + return new java_cup.runtime.str_token (sym.error); +} +<PARAMS> [\"\n] { + yybegin(YYINITIAL); + return new java_cup.runtime.str_token (sym.ACE_STRING, params); +} +<PARAMS> . { + params = params + yytext(); +} +<COMMENT> {NEWLINE} { yybegin(YYINITIAL); } +<COMMENT> {OTHER} { /* Skip everything on a comment line */ } diff --git a/java/src/parser.java b/java/src/parser.java new file mode 100644 index 00000000000..214b2abef6b --- /dev/null +++ b/java/src/parser.java @@ -0,0 +1,623 @@ + +//---------------------------------------------------- +// The following code was generated by CUP v0.9e +// Sun Nov 09 13:56:12 CST 1997 +//---------------------------------------------------- + +package JACE.ServiceConfigurator; + +import java.io.*; +import java.lang.*; +import java_cup.runtime.*; +import JACE.ServiceConfigurator.*; +import JACE.OS.*; + +public class parser extends java_cup.runtime.lr_parser { + + /** constructor */ + public parser() {super();} + + /** production table */ + protected static final short _production_table[][] = { + {0, 2}, {9, 2}, {9, 1}, {8, 1}, {8, 1}, + {8, 1}, {8, 1}, {8, 1}, {8, 1}, {1, 3}, + {10, 3}, {3, 2}, {4, 2}, {5, 2}, {7, 3}, + {7, 3}, {17, 1}, {17, 1}, {11, 1}, {11, 2}, + {6, 2}, {6, 0}, {12, 1}, {12, 1}, {12, 1}, + {12, 1}, {12, 1}, {2, 4}, {13, 1}, {13, 1}, + {13, 0}, {14, 3}, {14, 5}, {18, 2}, {18, 2}, + {18, 2}, {16, 1}, {16, 0}, {15, 1}, {15, 1} + }; + + /** access to production table */ + public short[][] production_table() {return _production_table;} + + /** parse action table */ + protected static final short[][] _action_table = { + /*0*/{2,6,3,10,4,15,5,11,6,3,22,2,-1,0}, + /*1*/{2,6,3,10,14,47,-1,0}, + /*2*/{14,44,-1,0}, + /*3*/{0,-5,2,-5,3,-5,4,-5,5,-5,6,-5,22,-5,-1,0}, + /*4*/{0,-7,2,-7,3,-7,4,-7,5,-7,6,-7,22,-7,-1,0}, + /*5*/{14,24,-1,0}, + /*6*/{0,-3,2,6,3,10,4,15,5,11,6,3,22,2,-1,0}, + /*7*/{0,-9,2,-9,3,-9,4,-9,5,-9,6,-9,22,-9,-1,0}, + /*8*/{0,-6,2,-6,3,-6,4,-6,5,-6,6,-6,22,-6,-1,0}, + /*9*/{14,19,-1,0}, + /*10*/{14,18,-1,0}, + /*11*/{0,-8,2,-8,3,-8,4,-8,5,-8,6,-8,22,-8,-1,0}, + /*12*/{0,17,-1,0}, + /*13*/{0,-4,2,-4,3,-4,4,-4,5,-4,6,-4,22,-4,-1,0}, + /*14*/{14,16,-1,0}, + /*15*/{0,-12,2,-12,3,-12,4,-12,5,-12,6,-12,19,-12,22,-12,-1,0}, + /*16*/{0,-1,-1,0}, + /*17*/{0,-13,2,-13,3,-13,4,-13,5,-13,6,-13,19,-13,22,-13,-1,0}, + /*18*/{0,-38,2,-38,3,-38,4,-38,5,-38,6,-38,15,20,18,-38,19,-38,22,-38,-1,0}, + /*19*/{0,-37,2,-37,3,-37,4,-37,5,-37,6,-37,18,-37,19,-37,22,-37,-1,0}, + /*20*/{0,-11,2,-11,3,-11,4,-11,5,-11,6,-11,18,-11,19,-11,22,-11,-1,0}, + /*21*/{0,-2,-1,0}, + /*22*/{0,-38,2,-38,3,-38,4,-38,5,-38,6,-38,15,20,18,-38,19,-38,22,-38,-1,0}, + /*23*/{8,26,9,28,10,27,-1,0}, + /*24*/{13,32,14,35,-1,0}, + /*25*/{20,31,-1,0}, + /*26*/{20,30,-1,0}, + /*27*/{20,29,-1,0}, + /*28*/{13,-36,14,-36,-1,0}, + /*29*/{13,-35,14,-35,-1,0}, + /*30*/{13,-34,14,-34,-1,0}, + /*31*/{21,-39,-1,0}, + /*32*/{0,-31,2,-31,3,-31,4,-31,5,-31,6,-31,11,42,12,41,15,-31,18,-31,19,-31,22,-31,-1,0}, + /*33*/{21,36,-1,0}, + /*34*/{21,-40,-1,0}, + /*35*/{14,37,-1,0}, + /*36*/{0,-32,2,-32,3,-32,4,-32,5,-32,6,-32,11,-32,12,-32,15,-32,16,38,18,-32,19,-32,22,-32,-1,0}, + /*37*/{17,39,-1,0}, + /*38*/{0,-33,2,-33,3,-33,4,-33,5,-33,6,-33,11,-33,12,-33,15,-33,18,-33,19,-33,22,-33,-1,0}, + /*39*/{0,-28,2,-28,3,-28,4,-28,5,-28,6,-28,15,-28,18,-28,19,-28,22,-28,-1,0}, + /*40*/{0,-30,2,-30,3,-30,4,-30,5,-30,6,-30,15,-30,18,-30,19,-30,22,-30,-1,0}, + /*41*/{0,-29,2,-29,3,-29,4,-29,5,-29,6,-29,15,-29,18,-29,19,-29,22,-29,-1,0}, + /*42*/{0,-10,2,-10,3,-10,4,-10,5,-10,6,-10,18,-10,19,-10,22,-10,-1,0}, + /*43*/{0,-14,2,-14,3,-14,4,-14,5,-14,6,-14,19,-14,22,-14,-1,0}, + /*44*/{2,-18,3,-18,4,-18,5,-18,6,-18,18,-18,19,-18,-1,0}, + /*45*/{2,-22,3,-22,4,-22,5,-22,6,-22,18,50,19,-22,-1,0}, + /*46*/{2,-22,3,-22,4,-22,5,-22,6,-22,18,50,19,-22,-1,0}, + /*47*/{2,-17,3,-17,4,-17,5,-17,6,-17,18,-17,19,-17,-1,0}, + /*48*/{2,6,3,10,4,15,5,11,6,3,19,54,-1,0}, + /*49*/{0,-19,2,-19,3,-19,4,-19,5,-19,6,-19,22,-19,-1,0}, + /*50*/{0,-16,2,-16,3,-16,4,-16,5,-16,6,-16,22,-16,-1,0}, + /*51*/{2,-21,3,-21,4,-21,5,-21,6,-21,19,-21,-1,0}, + /*52*/{2,-24,3,-24,4,-24,5,-24,6,-24,19,-24,-1,0}, + /*53*/{0,-20,2,-20,3,-20,4,-20,5,-20,6,-20,22,-20,-1,0}, + /*54*/{2,-26,3,-26,4,-26,5,-26,6,-26,19,-26,-1,0}, + /*55*/{2,-25,3,-25,4,-25,5,-25,6,-25,19,-25,-1,0}, + /*56*/{2,-27,3,-27,4,-27,5,-27,6,-27,19,-27,-1,0}, + /*57*/{2,-23,3,-23,4,-23,5,-23,6,-23,19,-23,-1,0}, + /*58*/{0,-15,2,-15,3,-15,4,-15,5,-15,6,-15,22,-15,-1,0}, + }; + + /** access to parse action table */ + public short[][] action_table() {return _action_table;} + + /** reduce_goto table */ + protected static final short[][] _reduce_table = { + /*0*/{1,13,3,8,4,4,5,11,7,7,8,6,9,12,10,3,-1,-1}, + /*1*/{1,47,10,44,17,45,-1,-1}, + /*2*/{-1,-1}, + /*3*/{-1,-1}, + /*4*/{-1,-1}, + /*5*/{2,22,-1,-1}, + /*6*/{1,13,3,8,4,4,5,11,7,7,8,6,9,21,10,3,-1,-1}, + /*7*/{-1,-1}, + /*8*/{-1,-1}, + /*9*/{-1,-1}, + /*10*/{-1,-1}, + /*11*/{-1,-1}, + /*12*/{-1,-1}, + /*13*/{-1,-1}, + /*14*/{-1,-1}, + /*15*/{-1,-1}, + /*16*/{-1,-1}, + /*17*/{-1,-1}, + /*18*/{16,20,-1,-1}, + /*19*/{-1,-1}, + /*20*/{-1,-1}, + /*21*/{-1,-1}, + /*22*/{16,42,-1,-1}, + /*23*/{18,24,-1,-1}, + /*24*/{14,32,15,33,-1,-1}, + /*25*/{-1,-1}, + /*26*/{-1,-1}, + /*27*/{-1,-1}, + /*28*/{-1,-1}, + /*29*/{-1,-1}, + /*30*/{-1,-1}, + /*31*/{-1,-1}, + /*32*/{13,39,-1,-1}, + /*33*/{-1,-1}, + /*34*/{-1,-1}, + /*35*/{-1,-1}, + /*36*/{-1,-1}, + /*37*/{-1,-1}, + /*38*/{-1,-1}, + /*39*/{-1,-1}, + /*40*/{-1,-1}, + /*41*/{-1,-1}, + /*42*/{-1,-1}, + /*43*/{-1,-1}, + /*44*/{-1,-1}, + /*45*/{6,48,11,58,-1,-1}, + /*46*/{6,48,11,50,-1,-1}, + /*47*/{-1,-1}, + /*48*/{1,57,3,55,4,54,5,56,10,52,12,51,-1,-1}, + /*49*/{-1,-1}, + /*50*/{-1,-1}, + /*51*/{-1,-1}, + /*52*/{-1,-1}, + /*53*/{-1,-1}, + /*54*/{-1,-1}, + /*55*/{-1,-1}, + /*56*/{-1,-1}, + /*57*/{-1,-1}, + /*58*/{-1,-1}, + }; + + /** access to reduce_goto table */ + public short[][] reduce_table() {return _reduce_table;} + + /** instance of action encapsulation class */ + protected CUP$actions action_obj; + + /** action encapsulation object initializer */ + protected void init_actions() + { + action_obj = new CUP$actions(); + } + + /** invoke a user supplied parse action */ + public java_cup.runtime.symbol do_action( + int act_num, + java_cup.runtime.lr_parser parser, + java.util.Stack stack, + int top) + throws java.lang.Exception + { + /* call code in generated class */ + return action_obj.CUP$do_action(act_num, parser, stack, top); + } + + /** start state */ + public int start_state() {return 0;} + /** start production */ + public int start_production() {return 0;} + + /** EOF symbol index */ + public int EOF_sym() {return 0;} + + /** error symbol index */ + public int error_sym() {return 1;} + + + /** user initialization */ + public void user_init() throws java.lang.Exception + { + + try { + + FileInputStream fs = new FileInputStream(new String(ServiceConfig.serviceConfigFile_)); + + this.setLexer(new Yylex(fs)); + + } catch (FileNotFoundException fnf) { + + ACE.ERROR("File not found: " + fnf); + + } catch (SecurityException se) { + + ACE.ERROR("Security: " + se); + } + + } + + /** scan to get the next token */ + public java_cup.runtime.token scan() + throws java.lang.Exception + { + return this.lexer_.yylex(); + } + + + // Lexical Analyzer + private Yylex lexer_; + + public void setLexer(Yylex lexer) + { + this.lexer_ = lexer; + } + +}; + +/** Cup generated class to encapsulate user supplied action code.*/ +class CUP$actions { + + /** Constructor */ + CUP$actions() { } + + /** Method with the actual generated action code. */ + public final java_cup.runtime.symbol CUP$do_action( + int CUP$act_num, + java_cup.runtime.lr_parser CUP$parser, + java.util.Stack CUP$stack, + int CUP$top) + throws java.lang.Exception + { + /* object for return from actions */ + java_cup.runtime.symbol CUP$result; + + /* select the action based on the action number */ + switch (CUP$act_num) + { + /*. . . . . . . . . . . . . . . . . . . .*/ + case 39: // pathname ::= ACE_IDENT + { + CUP$result = new java_cup.runtime.str_token(/*pathname*/15); + ((java_cup.runtime.str_token)CUP$result).str_val = new String((/*e*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 38: // pathname ::= ACE_PATHNAME + { + CUP$result = new java_cup.runtime.str_token(/*pathname*/15); + ((java_cup.runtime.str_token)CUP$result).str_val = new String((/*e*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 37: // parameters_opt ::= + { + CUP$result = new java_cup.runtime.str_token(/*parameters_opt*/16); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 36: // parameters_opt ::= ACE_STRING + { + CUP$result = new java_cup.runtime.str_token(/*parameters_opt*/16); + ((java_cup.runtime.str_token)CUP$result).str_val = new String((/*e*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 35: // type ::= ACE_STREAM_T ACE_STAR + { + CUP$result = new java_cup.runtime.str_token(/*type*/18); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 34: // type ::= ACE_SVC_OBJ_T ACE_STAR + { + CUP$result = new java_cup.runtime.str_token(/*type*/18); + ((java_cup.runtime.str_token)CUP$result).str_val = new String("Service Object"); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 33: // type ::= ACE_MODULE_T ACE_STAR + { + CUP$result = new java_cup.runtime.str_token(/*type*/18); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 32: // svc_initializer ::= pathname ACE_COLON ACE_IDENT ACE_LPAREN ACE_RPAREN + { + CUP$result = new java_cup.runtime.str_token(/*svc_initializer*/14); + ((java_cup.runtime.str_token)CUP$result).str_val = new String((/*e1*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-4)).str_val + ":" + (/*e2*/(str_token)CUP$stack.elementAt(CUP$top-2)).str_val); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 31: // svc_initializer ::= pathname ACE_COLON ACE_IDENT + { + CUP$result = new java_cup.runtime.str_token(/*svc_initializer*/14); + ((java_cup.runtime.str_token)CUP$result).str_val = new String((/*e1*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-2)).str_val + ":" + (/*e2*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 30: // status ::= + { + CUP$result = new java_cup.runtime.int_token(/*status*/13); + // Default case + ((java_cup.runtime.int_token)CUP$result).int_val = 0; + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 29: // status ::= ACE_INACTIVE + { + CUP$result = new java_cup.runtime.int_token(/*status*/13); + ((java_cup.runtime.int_token)CUP$result).int_val = 1; + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 28: // status ::= ACE_ACTIVE + { + CUP$result = new java_cup.runtime.int_token(/*status*/13); + ((java_cup.runtime.int_token)CUP$result).int_val = 0; + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 27: // svc_location ::= ACE_IDENT type svc_initializer status + { + CUP$result = new AddServiceObjectNode(/*svc_location*/2); + + boolean suspended = false; + if ((/*e4*/(java_cup.runtime.int_token)CUP$stack.elementAt(CUP$top-0)).int_val == 1) + suspended = true; + + ((AddServiceObjectNode)CUP$result).init((/*e1*/(str_token)CUP$stack.elementAt(CUP$top-3)).str_val, (/*e3*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val, suspended); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 26: // module ::= remove + { + CUP$result = new java_cup.runtime.str_token(/*module*/12); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 25: // module ::= resume + { + CUP$result = new java_cup.runtime.str_token(/*module*/12); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 24: // module ::= suspend + { + CUP$result = new java_cup.runtime.str_token(/*module*/12); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 23: // module ::= static + { + CUP$result = new java_cup.runtime.str_token(/*module*/12); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 22: // module ::= dynamic + { + CUP$result = new java_cup.runtime.str_token(/*module*/12); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 21: // module_list ::= + { + CUP$result = new ParseNode(/*module_list*/6); + ACE.ERROR("Not implemented: module manipulation"); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 20: // module_list ::= module_list module + { + CUP$result = new ParseNode(/*module_list*/6); + ACE.ERROR("Not implemented: module manipulation"); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 19: // stream_modules ::= module_list ACE_RBRACE + { + CUP$result = new java_cup.runtime.str_token(/*stream_modules*/11); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 18: // stream_modules ::= ACE_LBRACE + { + CUP$result = new java_cup.runtime.str_token(/*stream_modules*/11); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 17: // stream_ops ::= static + { + CUP$result = new java_cup.runtime.str_token(/*stream_ops*/17); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 16: // stream_ops ::= dynamic + { + CUP$result = new java_cup.runtime.str_token(/*stream_ops*/17); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 15: // stream ::= ACE_USTREAM ACE_IDENT stream_modules + { + CUP$result = new ParseNode(/*stream*/7); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 14: // stream ::= ACE_USTREAM stream_ops stream_modules + { + CUP$result = new ParseNode(/*stream*/7); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 13: // remove ::= ACE_REMOVE ACE_IDENT + { + CUP$result = new RemoveNode(/*remove*/5); + + ((RemoveNode)CUP$result).init((/*e1*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 12: // resume ::= ACE_RESUME ACE_IDENT + { + CUP$result = new ResumeNode(/*resume*/4); + + ((ResumeNode)CUP$result).init((/*e1*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 11: // suspend ::= ACE_SUSPEND ACE_IDENT + { + CUP$result = new SuspendNode(/*suspend*/3); + + ((SuspendNode)CUP$result).init((/*e1*/(str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 10: // static ::= ACE_STATIC ACE_IDENT parameters_opt + { + CUP$result = new ParseNode(/*static*/10); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 9: // dynamic ::= ACE_DYNAMIC svc_location parameters_opt + { + CUP$result = new AddServiceObjectNode(/*dynamic*/1); + + ((AddServiceObjectNode)CUP$result).init((/*e1*/(AddServiceObjectNode)CUP$stack.elementAt(CUP$top-1)).name(), (/*e1*/(AddServiceObjectNode)CUP$stack.elementAt(CUP$top-1)).locator(), (/*e1*/(AddServiceObjectNode)CUP$stack.elementAt(CUP$top-1)).suspended()); + + ((AddServiceObjectNode)CUP$result).params((/*e2*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 8: // svc_config_entry ::= stream + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + ACE.ERROR("Not implemented: stream loading"); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 7: // svc_config_entry ::= remove + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + + + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 6: // svc_config_entry ::= resume + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + /* Empty -- result auto set to resume */ + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 5: // svc_config_entry ::= suspend + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + + /* Empty -- result auto set to suspend */ + /* CUP$result = (ParseNode)CUP$stack.elementAt(CUP$top-0); */ + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 4: // svc_config_entry ::= static + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + + /* More graceful error system needed here */ + ACE.ERROR("Not implemented: static service loading"); + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 3: // svc_config_entry ::= dynamic + { + CUP$result = new ParseNode(/*svc_config_entry*/8); + + /* Empty -- result auto set to dynamic */ + /* CUP$result = (ParseNode)CUP$stack.elementAt(CUP$top-0); */ + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 2: // svc_config_entries ::= svc_config_entry + { + CUP$result = new ParseNode(/*svc_config_entries*/9); + + if ((/*e1*/(ParseNode)CUP$stack.elementAt(CUP$top-0)) != null) + (/*e1*/(ParseNode)CUP$stack.elementAt(CUP$top-0)).apply(); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 1: // svc_config_entries ::= svc_config_entry svc_config_entries + { + CUP$result = new ParseNode(/*svc_config_entries*/9); + + if ((/*e1*/(ParseNode)CUP$stack.elementAt(CUP$top-1)) != null) + (/*e1*/(ParseNode)CUP$stack.elementAt(CUP$top-1)).apply(); + + } + return CUP$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 0: // $START ::= svc_config_entries EOF + { + CUP$result = new java_cup.runtime.token(/*$START*/0); + + } + /* ACCEPT */ + CUP$parser.done_parsing(); + return CUP$result; + + /* . . . . . .*/ + default: + throw new Exception( + "Invalid action number found in internal parse table"); + + } + } +}; + diff --git a/java/src/sym.java b/java/src/sym.java new file mode 100644 index 00000000000..aeaadf19354 --- /dev/null +++ b/java/src/sym.java @@ -0,0 +1,36 @@ + +//---------------------------------------------------- +// The following code was generated by CUP v0.9e +// Sun Nov 09 13:56:12 CST 1997 +//---------------------------------------------------- + +package JACE.ServiceConfigurator; + +/** Cup generated class containing symbol constants. */ +public class sym { + /* terminals */ + static final int ACE_STATIC = 3; + static final int ACE_ACTIVE = 11; + static final int EOF = 0; + static final int ACE_IDENT = 14; + static final int ACE_USTREAM = 22; + static final int ACE_LPAREN = 16; + static final int ACE_MODULE_T = 8; + static final int error = 1; + static final int ACE_DYNAMIC = 2; + static final int ACE_RESUME = 5; + static final int ACE_LBRACE = 18; + static final int ACE_REMOVE = 6; + static final int ACE_STREAM = 7; + static final int ACE_STRING = 15; + static final int ACE_RPAREN = 17; + static final int ACE_COLON = 21; + static final int ACE_PATHNAME = 13; + static final int ACE_STAR = 20; + static final int ACE_SVC_OBJ_T = 10; + static final int ACE_RBRACE = 19; + static final int ACE_SUSPEND = 4; + static final int ACE_STREAM_T = 9; + static final int ACE_INACTIVE = 12; +}; + |