001: /*
002: * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: /*
026: * COMPONENT_NAME: idl.parser
027: *
028: * ORIGINS: 27
029: *
030: * Licensed Materials - Property of IBM
031: * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
032: * RMI-IIOP v1.0
033: *
034: * @(#)Factories.java 1.20 07/05/05
035: */
036:
037: package com.sun.tools.corba.se.idl;
038:
039: // NOTES:
040:
041: /**
042: * If the framework is being extended, this class must be extended.
043: * At very least, the genFactory method must be overridden to return
044: * the code generator extensions. The remaining methods may be overridden
045: * if necessary:
046: * <dl>
047: * <dt>symtabFactory
048: * <dd>If you wish to extend the symbol table entries, this method must return the factory which constructs those extensions. If you only want to extend a few of the symbol table entries, it may be useful to extend com.sun.tools.corba.se.idl.DefaultSymtabFactory and only override the pertinent methods.
049: * <dt>exprFactory
050: * <dd>If you wish to extend the expression classes, this method must return the factory which constructs those extensions. If you only want to extend a few of the expression classes, it may be useful to extend com.sun.tools.corba.se.idl.constExpr.DefaultSymtabFactory and only override the pertinent methods.
051: * <dt>arguments
052: * <dd>If you wish to add additional arguments to the base set of arguments, extend com.sun.tools.corba.se.idl.Arguments and override this method to return that class.
053: * <dt>languageKeywords
054: * <dd>If the language you are generating code in has keywords other than IDL keywords, these keywords should be returned by this method. The framework will prepend any IDL identifiers it encounters which are in this list with an underscore (`_') to avoid compilation errors. For instance, `catch' is a Java keyword. If the generators are emitting Java code for the following IDL, emitting `catch' as is will cause compile errors, so it is changed to `_catch':
055: * <br>
056: * IDL:
057: * <br>
058: * const long catch = 22;
059: * <br>
060: * Possible generated code:
061: * <br>
062: * public static final int _catch = 22;
063: * </dl>
064: **/
065: public class Factories {
066: /** Return the implementation of the GenFactory interface. If this
067: returns null, then the compiler cannot generate anything. */
068: public GenFactory genFactory() {
069: return null;
070: } // genFactory
071:
072: /** Return the implementation of the SymtabFactory interface. If this
073: returns null, the default symbol table entries will be used. */
074: public SymtabFactory symtabFactory() {
075: return new DefaultSymtabFactory();
076: } // symtabFactory
077:
078: /** Return the implementation of the ExprFactory interface. If this
079: returns null, the default expressions will be used. */
080: public com.sun.tools.corba.se.idl.constExpr.ExprFactory exprFactory() {
081: return new com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory();
082: } // exprFactory
083:
084: /** Return a subclass of the Arguments class. If this returns null,
085: the default will be used. */
086: public Arguments arguments() {
087: return new Arguments();
088: } // arguments
089:
090: /** Return the list of keywords in the generated language.
091: Note that these keywords may contain the following wildcards:
092: <dl>
093: <dt>`*'
094: <dd>matches zero or more characters
095: <dt>`+'
096: <dd>matches one or more characters
097: <dt>`.'
098: <dd>matches any single character
099: </dl> */
100: public String[] languageKeywords() {
101: return null;
102: } // languageKeywords
103: } // interface Factories
|