You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/10 10:40:23 UTC
svn commit: r279972 [1/2] - in /directory/sandbox/trunk/stub-compiler: ./
src/ src/antlr/ src/docbook/ src/images/ src/java/ src/java/org/
src/java/org/apache/ src/java/org/apache/snickers/
src/java/org/apache/snickers/asn1/ src/java/org/apache/snicker...
Author: elecharny
Date: Sat Sep 10 01:39:28 2005
New Revision: 279972
URL: http://svn.apache.org/viewcvs?rev=279972&view=rev
Log:
Moved stub-compiler from asn1 to sandbox
Added:
directory/sandbox/trunk/stub-compiler/
directory/sandbox/trunk/stub-compiler/LICENSE.txt (with props)
directory/sandbox/trunk/stub-compiler/maven.xml (with props)
directory/sandbox/trunk/stub-compiler/project.properties (with props)
directory/sandbox/trunk/stub-compiler/project.xml (with props)
directory/sandbox/trunk/stub-compiler/src/
directory/sandbox/trunk/stub-compiler/src/antlr/
directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g (with props)
directory/sandbox/trunk/stub-compiler/src/docbook/
directory/sandbox/trunk/stub-compiler/src/images/
directory/sandbox/trunk/stub-compiler/src/java/
directory/sandbox/trunk/stub-compiler/src/java/org/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/Constraint.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstraintSpec.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/DefinedType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/DefinitiveIdentifier.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/IntegerType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/Module.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ModuleIdentifier.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ModuleReference.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/NamedType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ObjectIdentifier.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/OctetStringType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ReferencedType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/SequenceOfType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/SequenceType.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/SubtypeConstraintSpec.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/Tag.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/TagDefaultEnum.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/Type.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/TypeAssignment.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/TypeReference.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/Value.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ValueAssignment.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ValueReference.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/Element.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/ElementSetSpec.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/Intersection.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/LowerEndpoint.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/Union.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/UpperEndpoint.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/element/ValueRange.java (with props)
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x681/
directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x683/
directory/sandbox/trunk/stub-compiler/src/test/
directory/sandbox/trunk/stub-compiler/src/test-data/
directory/sandbox/trunk/stub-compiler/src/test-data/ldap.asn1 (with props)
directory/sandbox/trunk/stub-compiler/src/test/org/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/asn1/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/asn1/CompilerTest.java (with props)
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/asn1/stages/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/asn1/stages/parser/
directory/sandbox/trunk/stub-compiler/src/test/org/apache/snickers/asn1/stages/parser/ASN1SyntaxTest.java (with props)
directory/sandbox/trunk/stub-compiler/src/vm/
directory/sandbox/trunk/stub-compiler/src/vm/class.vm (with props)
directory/sandbox/trunk/stub-compiler/src/vm/copyright.vm (with props)
directory/sandbox/trunk/stub-compiler/velocity.log (with props)
directory/sandbox/trunk/stub-compiler/xdocs/
directory/sandbox/trunk/stub-compiler/xdocs/index.xml (with props)
Added: directory/sandbox/trunk/stub-compiler/LICENSE.txt
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/LICENSE.txt?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/LICENSE.txt (added)
+++ directory/sandbox/trunk/stub-compiler/LICENSE.txt Sat Sep 10 01:39:28 2005
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Propchange: directory/sandbox/trunk/stub-compiler/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/maven.xml
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/maven.xml?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/maven.xml (added)
+++ directory/sandbox/trunk/stub-compiler/maven.xml Sat Sep 10 01:39:28 2005
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 1.1 $ $Date: 2004/03/06 20:36:54 $ -->
+
+<project default="default"
+ xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant"
+ >
+
+ <!-- ==================== -->
+ <!-- Default Global Goals -->
+ <!-- ==================== -->
+
+ <goal name="default">
+ <attainGoal name="jar:install"/>
+ </goal>
+
+ <goal name="build">
+ <attainGoal name="default"/>
+ </goal>
+
+ <goal name="rebuild">
+ <attainGoal name="clean"/>
+ <attainGoal name="build"/>
+ </goal>
+
+ <!-- Check if the tests need to run -->
+ <preGoal name="test:test">
+ <j:if test="${context.getVariable('maven.test.force') == null}">
+ <j:if test="${cloveroverride != 'true'}">
+ <j:set var="uptodatePropName" value="tests.uptodate"/>
+ <j:remove var="${uptodatePropName}"/>
+ <ant:mkdir dir="${basedir}/target/test-code/"/>
+ <ant:mkdir dir="${basedir}/target/test-reports/"/>
+ <j:set var="uptodateFile" value="${basedir}/target/test-reports/tstamp"/>
+
+ <ant:uptodate property="${uptodatePropName}" targetfile="${uptodateFile}">
+ <ant:srcfiles dir="${basedir}/src/" includes="**/*"/>
+ </ant:uptodate>
+
+ <j:if test="${context.getVariable(uptodatePropName) == 'true'}">
+ <ant:echo>NOTICE: Skipping tests; they seem to have passed already</ant:echo>
+ <j:set var="maven.test.skip" value="true"/>
+ <j:set var="unitTestSourcesPresent" value="false"/>
+ </j:if>
+ </j:if>
+ </j:if>
+ </preGoal>
+
+ <!-- Update the timestamp of the last successful test -->
+ <postGoal name="test:test">
+ <j:if test="${context.getVariable('maven.test.failure') == null}">
+ <ant:touch file="${basedir}/target/test-reports/tstamp"/>
+ </j:if>
+ </postGoal>
+</project>
Propchange: directory/sandbox/trunk/stub-compiler/maven.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/project.properties
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/project.properties?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/project.properties (added)
+++ directory/sandbox/trunk/stub-compiler/project.properties Sat Sep 10 01:39:28 2005
@@ -0,0 +1,12 @@
+maven.compile.source=1.4
+maven.compile.target=1.4
+maven.compile.deprecation=true
+maven.compile.debug=true
+maven.compile.optimize=true
+
+maven.junit.fork=true
+
+maven.antlr.src.dir=${basedir}/src/antlr
+maven.antlr.grammars=asn1.g
+maven.xdoc.includeProjectDocumentation=yes
+
Propchange: directory/sandbox/trunk/stub-compiler/project.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/project.xml
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/project.xml?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/project.xml (added)
+++ directory/sandbox/trunk/stub-compiler/project.xml Sat Sep 10 01:39:28 2005
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<project>
+
+ <extend>${basedir}/../project.xml</extend>
+ <id>stub-compiler</id>
+ <name>ASN1 Stub Compiler</name>
+ <package>org.apache.snickers.asn1</package>
+ <inceptionYear>2004</inceptionYear>
+
+ <shortDescription>ASN1 Stub Compiler</shortDescription>
+
+ <description>
+ An ASN1 stub compiler that generates POJOs and their encoders/decoders
+ that work within the snickers framework.
+ </description>
+
+
+ <!-- jar files the project is dependent on -->
+ <dependencies>
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>2.7.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ <url>http://jakarta.apache.org/commons/logging/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>SNAPSHOT</version>
+ <url>http://jakarta.apache.org/commons/collections</url>
+ </dependency>
+
+ <dependency>
+ <groupId>avalon-logkit</groupId>
+ <artifactId>avalon-logkit</artifactId>
+ <version>2.0.0</version>
+ </dependency>
+
+ <dependency>
+ <artifactId>velocity-dep</artifactId>
+ <groupId>velocity</groupId>
+ <version>1.4</version>
+ <url>http://jakarta.apache.org/velocity/</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ <gump.project>jakarta-velocity</gump.project>
+ <gump.id>velocity-dep</gump.id>
+ </properties>
+ </dependency>
+ </dependencies>
+
+ <!-- build information for the project -->
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </unitTest>
+ <resources>
+ <resource>
+ <directory>src/vm</directory>
+ <includes>
+ <include>**/*.vm</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
+
Propchange: directory/sandbox/trunk/stub-compiler/project.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g (added)
+++ directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g Sat Sep 10 01:39:28 2005
@@ -0,0 +1,592 @@
+header {
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.parser;
+
+import java.util.*;
+import org.apache.snickers.asn1.stages.parser.*;
+import org.apache.snickers.asn1.stages.parser.primitive.*;
+import org.apache.snickers.asn1.stages.parser.x680.*;
+import org.apache.snickers.asn1.stages.parser.x680.element.*;
+}
+
+class ASN1Parser extends Parser;
+options {
+ k=5;
+}
+
+tokens {
+ REAL_NUMBER;
+ INTEGER_NUMBER;
+}
+
+compile returns [Environment environment]
+{
+ Module module;
+ environment = new Environment();
+}
+ : (module = module_definition { environment.addModule(module); })+ ;
+
+/*
+ * X.680-0207
+ */
+module_definition returns [Module module]
+{
+ module = new Module();
+ ModuleIdentifier id;
+}
+ : id=module_identifier { module.setModuleIdentifier(id); }
+ DEFINITIONS
+ (tag_default[module])?
+ (extension_default[module])?
+ ASSIGNMENT BEGIN module_body[module] END
+ ;
+
+module_identifier returns [ModuleIdentifier id]
+{
+ ModuleReference mr;
+ DefinitiveIdentifier did;
+ id = new ModuleIdentifier();
+}
+ : mr=module_reference { id.setModuleReference(mr); } (did=definative_identifier { id.setDefinitiveIdentifier(did); } )?
+ ;
+
+definative_identifier returns [DefinitiveIdentifier id]
+{ id = new DefinitiveIdentifier(); }
+ : LEFT_CURLY (definitive_obj_id_component[id])+ RIGHT_CURLY
+ ;
+
+definitive_obj_id_component[DefinitiveIdentifier id]
+ : s1:IDENTIFIER { id.addNameForm(s1); }
+ | n1:INTEGER_NUMBER { id.addNumberForm(new IntegerPrimitive(n1)); }
+ | s2:IDENTIFIER LEFT_PAREN n2:INTEGER_NUMBER RIGHT_PAREN { id.addNameAndNumberForm(s2, new IntegerPrimitive(n2)); }
+ ;
+
+tag_default[Module module]
+ : EXPLICIT TAGS { module.setTagDefault(TagDefaultEnum.EXPLICIT); }
+ | IMPLICIT TAGS { module.setTagDefault(TagDefaultEnum.IMPLICIT); }
+ | AUTOMATIC TAGS { module.setTagDefault(TagDefaultEnum.AUTOMATIC); }
+ ;
+
+extension_default[Module module]
+ : EXTENSIBILITY IMPLIED { module.setExtensibilityImplied(true); }
+ ;
+
+module_body[Module module]
+ : (assignment[module])+
+ ;
+
+assignment[Module module]
+{
+ TypeAssignment ta;
+ ValueAssignment va;
+}
+ : ta=type_assignment { module.addTypeAssignment(ta); }
+ | va=value_assignment { module.addValueAssignment(va); }
+ ;
+
+type_assignment returns [TypeAssignment ta]
+{
+ ta = new TypeAssignment();
+ Type t;
+}
+ : tr:TYPEREFERENCE { ta.setTypeReference(new TypeReference(tr)); } ASSIGNMENT t=type { ta.setType(t); }
+ ;
+
+type_assignment_test returns [TypeAssignment ta] { ta = null; } : ta=type_assignment ;
+
+type returns [Type type]
+{
+ Type t;
+ ConstrainedType ct;
+ Constraint c;
+ type = null;
+}
+ : t=builtin_type { type = t; } (c=constraint { ct = new ConstrainedType(); ct.setType(t); ct.setConstraint(c); type=ct; })?
+ | type=referenced_type
+ ;
+
+builtin_type returns [Type type]
+{ type = null; }
+ : type=bitstring_type
+ | type=boolean_type
+ | type=octet_string_type
+ | type=sequence_type
+ | type=sequence_of_type
+ | type=integer_type
+ ;
+
+bitstring_type returns [BitStringType bitStringType]
+{ bitStringType = new BitStringType(); }
+ : BIT STRING (LEFT_CURLY namedbit (COMMA namedbit)+ RIGHT_CURLY)?
+ ;
+
+namedbit
+ : IDENTIFIER LEFT_PAREN INTEGER_NUMBER RIGHT_PAREN
+ ;
+
+boolean_type returns [BooleanType booleanType]
+{ booleanType = new BooleanType(); }
+ : b:BOOLEAN { booleanType.setToken(b); }
+ ;
+
+octet_string_type returns [OctetStringType octetStringType]
+{ octetStringType = new OctetStringType(); }
+ : o:OCTET STRING { octetStringType.setToken(o); }
+ ;
+
+character_string_type
+ : BMPSTRING
+ | GENERAL_STRING
+ | GRAPHIC_STRING
+ | IA5_STRING
+ | ISO646_STRING
+ | NUMERIC_STRING
+ | PRINTABLE_STRING
+ | TELETEX_STRING
+ | T61_STRING
+ | UNIVERSAL_STRING
+ | UTF8_STRING
+ | VIDEOTEX_STRING
+ | VISIBLE_STRING
+ | CHARACTER STRING
+ ;
+
+sequence_type returns [SequenceType sequenceType]
+{
+ ComponentTypeLists ctl;
+ sequenceType = new SequenceType();
+}
+ : SEQUENCE LEFT_CURLY RIGHT_CURLY
+ | SEQUENCE LEFT_CURLY ctl=component_type_lists RIGHT_CURLY { sequenceType.setComponentTypeLists(ctl); }
+ ;
+
+sequence_of_type returns [SequenceOfType sequenceOfType]
+{
+ Type t;
+ sequenceOfType = new SequenceOfType();
+}
+ : SEQUENCE OF t=type { sequenceOfType.setType(t); }
+ | SEQUENCE OF t=named_type { sequenceOfType.setType(t); }
+ ;
+
+referenced_type returns [ReferencedType referencedType]
+{
+ Object r;
+ referencedType = new ReferencedType();
+}
+ : r=defined_type { referencedType.setReference(r); }
+ ;
+
+defined_type returns [DefinedType definedType]
+{ definedType = new DefinedType(); }
+ : tr:TYPEREFERENCE { definedType.setDefinition(new TypeReference(tr)); }
+ ;
+
+component_type_lists returns [ComponentTypeLists componentTypeLists]
+{
+ ComponentTypeList ctl;
+ componentTypeLists = new ComponentTypeLists();
+}
+ : ctl=root_component_type_list { componentTypeLists.setComponentTypeList(ctl); }
+ ;
+
+root_component_type_list returns [ComponentTypeList componentTypeList]
+{ componentTypeList = null; }
+ : componentTypeList=component_type_list
+ ;
+
+component_type_list returns [ComponentTypeList componentTypeList]
+ {
+ Type t;
+ componentTypeList = new ComponentTypeList();
+ }
+
+ : t=component_type { componentTypeList.add(t); } (COMMA t=component_type { componentTypeList.add(t); })*
+ ;
+
+component_type returns [ComponentType componentType]
+{
+ Type t;
+ Value v;
+ componentType = new ComponentType();
+}
+ : t=named_type { componentType.setType(t); }
+ ( OPTIONAL { componentType.setComponentTypeEnum(ComponentTypeEnum.OPTIONAL); }
+ | DEFAULT v=value { componentType.setValue(v); componentType.setComponentTypeEnum(ComponentTypeEnum.DEFAULT); })?
+ | COMPONENTS OF t=type { componentType.setType(t); componentType.setComponentTypeEnum(ComponentTypeEnum.COMPONENTS_OF); }
+ ;
+
+named_type returns [NamedType namedType]
+{
+ Type t;
+ namedType = new NamedType();
+}
+ : id:IDENTIFIER
+ (LEFT_SQUARE tid:INTEGER_NUMBER RIGHT_SQUARE { namedType.setTag( new Tag(new IntegerPrimitive(tid))); } )?
+ t=type { namedType.setName(id); namedType.setType(t); }
+ ;
+
+integer_type returns [IntegerType t]
+{ t = new IntegerType(); }
+ : i:INTEGER { t.setToken(i); }
+ ;
+
+value returns [Value v]
+{ v = null; }
+ : v=builtin_value
+ | IDENTIFIER
+ ;
+
+builtin_value returns [Value value]
+{ value = null; }
+ : value=boolean_value
+ | value=integer_value
+ ;
+
+boolean_value returns [BooleanPrimitive v]
+{ v = new BooleanPrimitive(); }
+ : b1:TRUE { v.setToken(b1); }
+ | b2:FALSE { v.setToken(b2); }
+ ;
+
+integer_value returns [IntegerPrimitive v]
+{ v = new IntegerPrimitive(); }
+ : MINUS i1:INTEGER_NUMBER { v.setNegative(true); v.setToken(i1); }
+ | i2:INTEGER_NUMBER { v.setToken(i2); }
+ ;
+
+value_assignment returns [ValueAssignment va]
+{
+ va = new ValueAssignment();
+ Type t;
+ Value v;
+}
+ : id:IDENTIFIER { va.setValueReference(new ValueReference(id)); } t=type { va.setType(t); } ASSIGNMENT v=value { va.setValue(v); }
+ ;
+
+constraint returns [Constraint constraint]
+{
+ ConstraintSpec cs;
+ constraint = new Constraint();
+}
+ : LEFT_PAREN cs=constraint_spec RIGHT_PAREN { constraint.setConstraintSpec(cs); }
+ ;
+
+constraint_spec returns [ConstraintSpec constraintSpec]
+{ constraintSpec = null; }
+ : constraintSpec=subtype_constraint
+ ;
+
+subtype_constraint returns [SubtypeConstraintSpec subtypeConstraintSpec]
+{
+ ElementSetSpec ess;
+ subtypeConstraintSpec = new SubtypeConstraintSpec();
+}
+ : ess=element_set_specs { subtypeConstraintSpec.setElementSetSpec(ess); }
+ ;
+
+element_set_specs returns [ElementSetSpec elementSetSpec]
+{ elementSetSpec = null; }
+ : elementSetSpec=root_element_set_spec
+ ;
+
+root_element_set_spec returns [ElementSetSpec elementSetSpec]
+{ elementSetSpec = null; }
+ : elementSetSpec=element_set_spec
+ ;
+
+element_set_spec returns [ElementSetSpec elementSetSpec]
+{ elementSetSpec = null; }
+ : elementSetSpec=unions
+ ;
+
+unions returns [Union union]
+{
+ Intersection i;
+ union = new Union();
+}
+ : i=intersections { union.addIntersection(i); }
+ ;
+
+intersections returns [Intersection intersection]
+{
+ Element ie;
+ intersection = new Intersection();
+}
+ : ie=intersection_elements { intersection.addElement(ie); }
+ ;
+
+intersection_elements returns [Element element]
+{ element = null; }
+ : element=elements
+ ;
+
+elements returns [Element element]
+{ element = null; }
+ : element=subtype_elements
+ ;
+
+subtype_elements returns [Element element]
+{ element = null; }
+ : element=value_range
+ ;
+
+value_range returns [ValueRange valueRange]
+{
+ LowerEndpoint le;
+ UpperEndpoint ue;
+ valueRange = new ValueRange();
+}
+ : le=lower_endpoint RANGE ue=upper_endpoint { valueRange.setLowerEndpoint(le); valueRange.setUpperEndpoint(ue); }
+ ;
+
+lower_endpoint returns [LowerEndpoint le]
+{
+ Value v;
+ le = new LowerEndpoint();
+}
+ : v=value { le.setValue(v); } (LESS_THAN { le.setOpen(true); })?
+ | MIN { le.setMin(true); } (LESS_THAN { le.setOpen(true); })?
+ ;
+
+upper_endpoint returns [UpperEndpoint ue]
+{
+ Value v;
+ ue = new UpperEndpoint();
+}
+ : (LESS_THAN { ue.setOpen(true); })? v=value { ue.setValue(v); }
+ | (LESS_THAN { ue.setOpen(true); })? MAX { ue.setMax(true); }
+ ;
+
+
+/*
+ * X.681-0207
+ */
+
+
+/*
+ * X.682-0207
+ */
+
+/*
+ * X.683-0207
+ */
+
+number
+ : INTEGER_NUMBER
+ | REAL_NUMBER
+ | BINARY_STRING
+ | HEXADECIMAL_STRING
+ ;
+
+module_reference returns [ModuleReference reference]
+{ reference = new ModuleReference(); }
+ : tr:TYPEREFERENCE { reference.setToken(tr); }
+ ;
+
+value_reference : IDENTIFIER;
+type_reference : TYPEREFERENCE;
+object_reference : value_reference;
+word : type_reference;
+object_set_reference : type_reference;
+type_field_reference : AMPERSAND type_reference;
+value_field_reference : AMPERSAND value_reference;
+value_set_field_reference : AMPERSAND value_reference;
+object_field_reference : AMPERSAND object_reference;
+object_set_field_reference : AMPERSAND object_reference;
+object_class_reference : AMPERSAND type_reference;
+
+
+{
+import org.apache.snickers.asn1.*;
+}
+class ASN1Compiler extends TreeParser;
+options {
+ defaultErrorHandler=false;
+}
+
+modules : ( ABSENT );
+
+class ASN1Lexer extends Lexer;
+options {
+ k=3;
+ charVocabulary = '\3'..'\377' | '\u1000'..'\u1fff';
+}
+
+/*
+ * X.680-0207
+ */
+tokens {
+ ABSENT = "ABSENT";
+ ABSTRACT_SYNTAX = "ABSTRACT-SYNTAX";
+ ALL = "ALL";
+ ANY = "ANY";
+ ARGUMENT = "ARGUMENT";
+ APPLICATION = "APPLICATION";
+ AUTOMATIC = "AUTOMATIC";
+ BASEDNUM = "BASEDNUM";
+ BEGIN = "BEGIN";
+ BIT = "BIT";
+ BMPSTRING = "BMPString";
+ BOOLEAN = "BOOLEAN";
+ BY = "BY";
+ CHARACTER = "CHARACTER";
+ CHOICE = "CHOICE";
+ CLASS = "CLASS";
+ COMPONENTS = "COMPONENTS";
+ COMPONENT = "COMPONENT";
+ CONSTRAINED = "CONSTRAINED";
+ DEFAULT = "DEFAULT";
+ DEFINED= "DEFINED";
+ DEFINITIONS = "DEFINITIONS";
+ EMBEDDED = "EMBEDDED";
+ END = "END";
+ ENUMERATED = "ENUMERATED";
+ ERROR = "ERROR";
+ ERRORS = "ERRORS";
+ EXCEPT = "EXCEPT";
+ EXPLICIT = "EXPLICIT";
+ EXPORTS = "EXPORTS";
+ EXTENSIBILITY = "EXTENSIBILITY";
+ EXTERNAL = "EXTERNAL";
+ FALSE = "FALSE";
+ FROM = "FROM";
+ GENERALIZED_TIME = "GeneralizedTime";
+ GENERAL_STRING = "GeneralString";
+ GRAPHIC_STRING = "GraphicString";
+ IA5_STRING = "IA5String";
+ IDENTIFIER = "IDENTIFIER";
+ IMPLICIT = "IMPLICIT";
+ IMPLIED = "IMPLIED";
+ IMPORTS = "IMPORTS";
+ INCLUDES = "INCLUDES";
+ INSTANCE = "INSTANCE";
+ INTEGER = "INTEGER";
+ INTERSECTION = "INTERSECTION";
+ ISO646_STRING = "ISO646String";
+ LINKED = "LINKED";
+ MAX = "MAX";
+ MINUS_INFINITY = "MINUSINFINITY";
+ MIN = "MIN";
+ NULL = "NULL";
+ NUMERIC_STRING = "NumericString";
+ OBJECT_DESCRIPTOR = "ObjectDescriptor";
+ OBJECT = "OBJECT";
+ OCTET = "OCTET";
+ OPERATION = "OPERATION";
+ OF = "OF";
+ OID = "OID";
+ OPTIONAL = "OPTIONAL";
+ PARAMETER = "PARAMETER";
+ PDV = "PDV";
+ PLUS_INFINITY = "PLUSINFINITY";
+ PRESENT = "PRESENT";
+ PRINTABLE_STRING = "PrintableString";
+ PRIVATE = "PRIVATE";
+ REAL = "REAL";
+ RELATIVE = "RELATIVE";
+ RESULT = "RESULT";
+ SEQUENCE = "SEQUENCE";
+ SET = "SET";
+ SIZE = "SIZE";
+ STRING = "STRING";
+ T61_STRING = "T61String";
+ TAGS = "TAGS";
+ TELETEX_STRING = "TeletexString";
+ TRUE = "TRUE";
+ TYPE_IDENTIFIER = "TYPE-IDENTIFIER";
+ UNION = "UNION";
+ UNIQUE = "UNIQUE";
+ UNIVERSAL = "UNIVERSAL";
+ UNIVERSAL_STRING = "UniversalString";
+ UTC_TIME = "UTCTime";
+ UTF8_STRING = "UTF8String";
+ VIDEOTEX_STRING = "VideotexString";
+ VISIBLE_STRING = "VisibleString";
+ WITH = "WITH";
+
+/*
+ * X.680-0207
+ */
+
+ REFERENCE = "Reference";
+}
+
+NEWLINE
+ : ((('\r''\n') => '\r''\n') | '\r' | '\n')
+ { newline(); $setType(Token.SKIP); }
+ ;
+
+WS : ( ' ' | '\t' | '\f' ) { $setType(Token.SKIP); } ;
+
+COMMENT : "--" ;
+
+SL_COMMENT
+ : COMMENT
+ ({ LA(2)!='-' }? '-' | ~('-'|'\n'|'\r'))*
+ (((('\r''\n') => '\r''\n') | '\r' | '\n') {newline();} | COMMENT)
+ { $setType(Token.SKIP); }
+ ;
+
+ASSIGNMENT : "::=";
+
+IDENTIFIER : SMALL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER | DIGIT) )* ;
+TYPEREFERENCE : CAPITAL_LETTER ( (HYPHEN)? (SMALL_LETTER | CAPITAL_LETTER | DIGIT) )* ;
+
+NUMBER : DIGITS (DOT (DIGIT)* (EXPONENT)? { $setType(REAL_NUMBER); } | { $setType(INTEGER_NUMBER); } ) ;
+
+
+protected DIGITS : ( ('1'..'9') (DIGIT)* | '0' );
+
+protected EXPONENT
+ : ('e'|'E') ('+'|'-')? (DIGIT)+
+ ;
+
+NUMBER_STRING : "'" (HEX_DIGIT | WS)* ("'B" {$setType(BINARY_STRING);} | "'H" {$setType(HEXADECIMAL_STRING);} );
+
+protected CAPITAL_LETTER : 'A'..'Z';
+protected SMALL_LETTER : 'a'..'z';
+protected DIGIT : '0'..'9';
+protected HEX_DIGIT : ('0'..'9' | 'A'..'F');
+EXCLAMATION_MARK : '!';
+QUOTATION_MARK : '"';
+AMPERSAND : '&';
+APOSTROPHE : '\'';
+LEFT_PAREN : '(';
+RIGHT_PAREN : ')';
+ASTERISK : '*';
+COMMA : ',';
+HYPHEN : '-';
+DOT : '.';
+SOLIDUS : '/';
+COLON : ':';
+SEMICOLON : ';';
+LESS_THAN : '<';
+EQUALS : '=';
+GREATER_THAN : '>';
+AT : '@';
+LEFT_SQUARE : '[';
+RIGHT_SQUARE : ']';
+CIRCUMFLEX : '^';
+UNDERSCORE : '_';
+LEFT_CURLY : '{';
+BAR : '|';
+RIGHT_CURLY : '}';
+RANGE : "..";
+ELLIPSIS : "...";
+
Propchange: directory/sandbox/trunk/stub-compiler/src/antlr/asn1.g
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1;
+
+import java.util.Map;
+
+import org.apache.snickers.asn1.stages.ProcessException;
+import org.apache.snickers.asn1.stages.codegen.CodeGeneratorStage;
+import org.apache.snickers.asn1.stages.parser.ParseStage;
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class Compiler
+{
+ public void compile( Map environment ) throws ProcessException
+ {
+ new ParseStage().process( environment );
+ new CodeGeneratorStage().process( environment );
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/Compiler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages;
+
+/**
+ * A exception class that is thown by a compiler stage's proccess method.
+ *
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ProcessException extends Exception
+{
+ public ProcessException()
+ {
+ super();
+ }
+
+ public ProcessException( String message )
+ {
+ super( message );
+ }
+
+ public ProcessException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public ProcessException( Throwable cause )
+ {
+ super( cause );
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/ProcessException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,29 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages;
+
+import java.util.Map;
+
+/**
+ * Interface for compiler stages.
+ *
+ * @version $Revision: 123525 $ $Date: $
+ */
+public interface Stage
+{
+ public void process( Map environment ) throws ProcessException;
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/Stage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,163 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.codegen;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.snickers.asn1.stages.parser.Environment;
+import org.apache.snickers.asn1.stages.ProcessException;
+import org.apache.snickers.asn1.stages.Stage;
+import org.apache.snickers.asn1.stages.parser.ParseStage;
+import org.apache.snickers.asn1.stages.parser.x680.Module;
+import org.apache.snickers.asn1.stages.parser.x680.TypeReference;
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class CodeGeneratorStage implements Stage
+{
+ private static Log log = LogFactory.getLog( CodeGeneratorStage.class );
+ public static final String ROOT_PACKAGE = "org.apache.snickers.asn1.stages.codegen.ROOT_PACKAGE";
+ public static final String DESTINATION_PATH = "org.apache.snickers.asn1.stages.codegen.DESTINATION_PATH";
+
+ private File destination;
+ private String packages;
+
+ public void process( Map environment ) throws ProcessException
+ {
+ log.trace( "Code generation stage processing begun" );
+
+
+ try
+ {
+ Properties props = new Properties();
+ props.put( "resource.loader", "class" );
+ props.put( "class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" );
+
+ Velocity.init( props );
+
+ Environment env = (Environment) environment.get( ParseStage.ENVIRONMENT );
+ if ( env == null ) throw new ProcessException( "Missing ENVIRONMENT from Parse stage" );
+
+ destination = generatePackages( environment );
+ Iterator modules = env.getModules();
+ while ( modules.hasNext() )
+ {
+ Module module = (Module) modules.next();
+ Map typeAssignments = module.getTypeAssignments();
+ Iterator typeReferences = typeAssignments.keySet().iterator();
+ while ( typeReferences.hasNext() )
+ {
+ TypeReference typeReference = (TypeReference) typeReferences.next();
+ generateClass( typeReference, environment );
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new ProcessException( e );
+ }
+ finally
+ {
+ log.trace( "Code generation stage processing complete" );
+ }
+ }
+
+ private void generateClass( TypeReference typeReference, Map environment ) throws ProcessException
+ {
+ try
+ {
+ File classFile = new File( destination, typeReference.toString() + ".java" );
+ classFile.createNewFile();
+ PrintStream out = new PrintStream( new FileOutputStream( classFile ) );
+
+ VelocityContext context = new VelocityContext();
+
+ context.put( "package", packages );
+ context.put( "class", typeReference.toString() );
+
+ Vector list = new Vector();
+ list.add( new Test( "ONE" ) );
+ list.add( new Test( "TWO" ) );
+ context.put( "fieldList", list );
+
+ PrintWriter pw = new PrintWriter( out );
+
+ Velocity.mergeTemplate( "copyright.vm", context, pw );
+ Velocity.mergeTemplate( "class.vm", context, pw );
+
+
+ pw.flush();
+ pw.close();
+ }
+ catch ( IOException e )
+ {
+ throw new ProcessException( e );
+ }
+ catch ( ParseErrorException e )
+ {
+ throw new ProcessException( e );
+ }
+ catch ( Exception e )
+ {
+ throw new ProcessException( e );
+ }
+ }
+
+ public class Test
+ {
+ public String Name;
+
+ Test( String Name )
+ {
+ this.Name = Name;
+ }
+
+ public String getName()
+ {
+ return Name;
+ }
+ }
+
+ private File generatePackages( Map environment ) throws ProcessException
+ {
+ packages = (String) environment.get( ROOT_PACKAGE );
+ if ( packages == null ) throw new ProcessException( "Missing ENVIRONMENT from Parse stage" );
+
+ if ( !environment.containsKey( DESTINATION_PATH ) ) throw new ProcessException( "Missing DESTINATION_PATH" );
+ File root = new File( (String) environment.get( DESTINATION_PATH ) );
+ if ( !root.isDirectory() ) throw new ProcessException( "DESTINATION_PATH is not a valid directory" );
+
+ File directories = new File( root, packages.replace( '.', '/' ) );
+ directories.mkdirs();
+
+ return directories;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/codegen/CodeGeneratorStage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.snickers.asn1.stages.parser.x680.Module;
+import org.apache.snickers.asn1.stages.parser.x680.Module;
+
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class Environment
+{
+
+ private ArrayList modules = new ArrayList();
+
+ public void addModule( Module module )
+ {
+ modules.add( module );
+ }
+
+ public Iterator getModules()
+ {
+ return modules.iterator();
+ }
+
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/Environment.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser;
+
+
+/**
+ * @version $Revision: 153453 $ $Date: $
+ */
+public class ParseException extends Exception
+{
+ public ParseException()
+ {
+ super();
+ }
+
+ public ParseException( String message )
+ {
+ super( message );
+ }
+
+ public ParseException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public ParseException( Throwable cause )
+ {
+ super( cause );
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,81 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.snickers.asn1.parser.ASN1Lexer;
+import org.apache.snickers.asn1.parser.ASN1Parser;
+import org.apache.snickers.asn1.stages.parser.Environment;
+import org.apache.snickers.asn1.stages.Stage;
+import org.apache.snickers.asn1.stages.ProcessException;
+
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class ParseStage implements Stage
+{
+ private static Log log = LogFactory.getLog(ParseStage.class);
+
+ public static final String SRC_URI = "org.apache.snickers.asn1.stages.parser.SRC_URI";
+ public static final String ENVIRONMENT = "org.apache.snickers.asn1.stages.parser.ENVIRONMENT";
+
+ public void process( Map environment ) throws ProcessException
+ {
+ log.trace( "Parse stage processing begun");
+
+ try
+ {
+ ASN1Lexer lexer = new ASN1Lexer( new URI( (String) environment.get( SRC_URI ) ).toURL().openStream() );
+ Environment env = new ASN1Parser( lexer ).compile();
+ environment.put( ENVIRONMENT, env );
+ }
+ catch ( URISyntaxException e )
+ {
+ throw new ProcessException("SRC_URI is invalid", e);
+ }
+ catch ( MalformedURLException e )
+ {
+ throw new ProcessException("SRC_URI is invalid", e);
+ }
+ catch ( IOException e )
+ {
+ throw new ProcessException("SRC_URI is invalid", e);
+ }
+ catch ( TokenStreamException e )
+ {
+ throw new ProcessException("SRC_URI is invalid", e);
+ }
+ catch ( RecognitionException e )
+ {
+ throw new ProcessException("SRC_URI is invalid", e);
+ }
+ finally
+ {
+ log.trace( "Parse stage processing complete");
+ }
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/ParseStage.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser;
+
+import antlr.Token;
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class TokenBase
+{
+ private Token token;
+
+ public TokenBase()
+ {
+ }
+
+ public TokenBase( Token token )
+ {
+ this.token = token;
+ }
+
+ public Token getToken()
+ {
+ return token;
+ }
+
+ public void setToken( Token token )
+ {
+ this.token = token;
+ }
+
+ public String toString()
+ {
+ return token.getText();
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/TokenBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.primitive;
+
+import antlr.Token;
+
+import org.apache.snickers.asn1.stages.parser.ParseException;
+
+/**
+ * @version $Revision: 153453 $ $Date: $
+ */
+public class BooleanPrimitive extends Primitive
+{
+ private transient Boolean value;
+
+ public BooleanPrimitive()
+ {
+ super();
+ }
+
+ public BooleanPrimitive( Token token )
+ {
+ super( token );
+ }
+
+ public Object toPrimitive() throws ParseException
+ {
+ if ( value == null )
+ {
+ value = new Boolean( getToken().getText() );
+ }
+
+ return value;
+ }
+
+ public String toString()
+ {
+ try
+ {
+ return ( (Integer) toPrimitive() ).toString();
+ }
+ catch ( ParseException e )
+ {
+ return "[PARSE ERROR]";
+ }
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/BooleanPrimitive.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,79 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.primitive;
+
+import antlr.Token;
+
+import org.apache.snickers.asn1.stages.parser.ParseException;
+
+/**
+ * @version $Revision: 153453 $ $Date: $
+ */
+public class IntegerPrimitive extends Primitive
+{
+ private transient Integer value;
+ private boolean negative;
+
+ public IntegerPrimitive()
+ {
+ super();
+ }
+
+ public IntegerPrimitive( Token token )
+ {
+ super( token );
+ }
+
+ public boolean isNegative()
+ {
+ return negative;
+ }
+
+ public void setNegative( boolean negative )
+ {
+ this.negative = negative;
+ }
+
+ public Object toPrimitive() throws ParseException
+ {
+ if ( value == null )
+ {
+ try
+ {
+ value = new Integer( ( negative ? "-" : "" ) + getToken().getText() );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ throw new ParseException( nfe );
+ }
+ }
+
+ return value;
+ }
+
+ public String toString()
+ {
+ try
+ {
+ return ( (Integer) toPrimitive() ).toString();
+ }
+ catch ( ParseException e )
+ {
+ return "[PARSE ERROR]";
+ }
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/IntegerPrimitive.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.primitive;
+
+import antlr.Token;
+
+import org.apache.snickers.asn1.stages.parser.ParseException;
+import org.apache.snickers.asn1.stages.parser.x680.Value;
+
+/**
+ * @version $Revision: 153453 $ $Date: $
+ */
+abstract public class Primitive extends Value
+{
+ public Primitive()
+ {
+ }
+
+ public Primitive( Token token )
+ {
+ super( token );
+ }
+
+ abstract public Object toPrimitive() throws ParseException;
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/primitive/Primitive.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+import org.apache.snickers.asn1.stages.parser.TokenBase;
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class BitStringType extends TokenBase implements Type
+{
+ private Tag tag;
+
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ public void setTag( Tag tag )
+ {
+ this.tag = tag;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BitStringType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+import org.apache.snickers.asn1.stages.parser.TokenBase;
+
+/**
+ * @version $Revision: 154412 $ $Date: $
+ */
+public class BooleanType extends TokenBase implements Type
+{
+ private Tag tag;
+
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ public void setTag( Tag tag )
+ {
+ this.tag = tag;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/BooleanType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,68 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ComponentType implements Type
+{
+ private Tag tag;
+ private Type type;
+ private Value value;
+ private ComponentTypeEnum componentTypeEnum;
+
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ public void setTag( Tag tag )
+ {
+ this.tag = tag;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public void setType( Type type )
+ {
+ this.type = type;
+ }
+
+ public Value getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Value value )
+ {
+ this.value = value;
+ }
+
+ public ComponentTypeEnum getComponentTypeEnum()
+ {
+ return componentTypeEnum;
+ }
+
+ public void setComponentTypeEnum( ComponentTypeEnum componentTypeEnum )
+ {
+ this.componentTypeEnum = componentTypeEnum;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+import org.apache.commons.lang.enum.ValuedEnum;
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ComponentTypeEnum extends ValuedEnum
+{
+ public static final ComponentTypeEnum OPTIONAL = new ComponentTypeEnum( "OPTIONAL", 0 );
+ public static final ComponentTypeEnum DEFAULT = new ComponentTypeEnum( "DEFAULT", 1 );
+ public static final ComponentTypeEnum COMPONENTS_OF = new ComponentTypeEnum( "COMPONENTS_OF", 2 );
+
+ public ComponentTypeEnum( String s, int i )
+ {
+ super( s, i );
+ }
+}
\ No newline at end of file
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeEnum.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+import java.util.ArrayList;
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ComponentTypeList extends ArrayList implements Type
+{
+ private Tag tag;
+
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ public void setTag( Tag tag )
+ {
+ this.tag = tag;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeList.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+import org.apache.snickers.asn1.stages.parser.x680.ComponentTypeList;
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ComponentTypeLists
+{
+ private ComponentTypeList componentTypeList;
+
+ public ComponentTypeList getComponentTypeList()
+ {
+ return componentTypeList;
+ }
+
+ public void setComponentTypeList( ComponentTypeList componentTypeList )
+ {
+ this.componentTypeList = componentTypeList;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ComponentTypeLists.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java?rev=279972&view=auto
==============================================================================
--- directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java (added)
+++ directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java Sat Sep 10 01:39:28 2005
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.snickers.asn1.stages.parser.x680;
+
+
+
+/**
+ * @version $Revision: 123525 $ $Date: $
+ */
+public class ConstrainedType implements Type
+{
+ private Tag tag;
+ private Type type;
+ private Constraint constraint;
+
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ public void setTag( Tag tag )
+ {
+ this.tag = tag;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public void setType( Type type )
+ {
+ this.type = type;
+ }
+
+ public Constraint getConstraint()
+ {
+ return constraint;
+ }
+
+ public void setConstraint( Constraint constraint )
+ {
+ this.constraint = constraint;
+ }
+}
Propchange: directory/sandbox/trunk/stub-compiler/src/java/org/apache/snickers/asn1/stages/parser/x680/ConstrainedType.java
------------------------------------------------------------------------------
svn:eol-style = native