Author: jboynes
Date: Wed Apr 26 08:22:26 2006
New Revision: 397219
URL: http://svn.apache.org/viewcvs?rev=397219&view=rev
Log:
skeleton for class introspection
Added:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
(with props)
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
(with props)
Added:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java?rev=397219&view=auto
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
(added)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
Wed Apr 26 08:22:26 2006
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * 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.tuscany.core.config;
+
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Attribute;
+import org.objectweb.asm.FieldVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.apache.tuscany.model.assembly.ComponentInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCAVisitor implements ClassVisitor {
+ private final ComponentInfo componentType;
+
+ public SCAVisitor(ComponentInfo componentType) {
+ this.componentType = componentType;
+ }
+
+ public ComponentInfo getComponentType() {
+ return componentType;
+ }
+
+ public void visit(int version,
+ int access,
+ String name,
+ String signature,
+ String superName,
+ String[] interfaces) {
+ }
+
+ public void visitSource(String string, String string1) {
+ }
+
+ public void visitOuterClass(String string, String string1, String string2)
{
+ }
+
+ public AnnotationVisitor visitAnnotation(String string, boolean b) {
+ return null;
+ }
+
+ public void visitAttribute(Attribute attribute) {
+ }
+
+ public void visitInnerClass(String string, String string1, String string2,
int i) {
+ }
+
+ public FieldVisitor visitField(int i, String string, String string1,
String string2, Object object) {
+ return null;
+ }
+
+ public MethodVisitor visitMethod(int i, String string, String string1,
String string2, String[] strings) {
+ return null;
+ }
+
+ public void visitEnd() {
+ }
+}
Propchange:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/config/SCAVisitor.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added:
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java?rev=397219&view=auto
==============================================================================
---
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
(added)
+++
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
Wed Apr 26 08:22:26 2006
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * 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.tuscany.core.config;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.objectweb.asm.ClassReader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ASMProcessorTestCase extends TestCase {
+ private AssemblyFactory factory;
+
+ public void testFoo() throws IOException {
+ ClassReader reader = new
ClassReader(Bean1.class.getResourceAsStream("Bean1.class"));
+ SCAVisitor visitor = new SCAVisitor(factory.createComponentInfo());
+ reader.accept(visitor, true);
+ visitor.getComponentType();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ factory = new AssemblyFactoryImpl();
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/ASMProcessorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date