Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jason
committed
Mar 26, 2012
1 parent
759570b
commit 44834cc
Showing
11 changed files
with
1,032 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version="1.0"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.nju.artemis.aejb</groupId> | ||
<artifactId>aejb-preprocessor</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>AEJB Preprocessor 1.0</name> | ||
<description>The AEJB Jar Preprocessor</description> | ||
|
||
<properties> | ||
<module.name>org.nju.artemis.preprocessor</module.name> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.spec</groupId> | ||
<artifactId>jboss-javaee-6.0</artifactId> | ||
<version>3.0.0.Beta1</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.ow2.asm</groupId> | ||
<artifactId>asm-all</artifactId> | ||
<version>4.0</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
|
||
<!-- Import the Common Annotations API (JSR-250), we use provided scope | ||
as the API is included in JBoss AS 7 --> | ||
<dependency> | ||
<groupId>org.jboss.spec.javax.annotation</groupId> | ||
<artifactId>jboss-annotations-api_1.1_spec</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Import the EJB 3.1 API, we use provided scope as the API is included | ||
in JBoss AS 7 --> | ||
<dependency> | ||
<groupId>org.jboss.spec.javax.ejb</groupId> | ||
<artifactId>jboss-ejb-api_3.1_spec</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.ow2.asm</groupId> | ||
<artifactId>asm-all</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<!-- JBoss AS plugin to deploy the application --> | ||
<plugin> | ||
<groupId>org.jboss.as.plugins</groupId> | ||
<artifactId>jboss-as-maven-plugin</artifactId> | ||
<version>7.1.0.Final</version> | ||
<configuration> | ||
<filename>${project.build.finalName}.jar</filename> | ||
</configuration> | ||
</plugin> | ||
<!-- Compiler plugin enforces Java 1.6 compatibility and activates | ||
annotation processors --> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.1</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<inherited>false</inherited> | ||
<version>1.6</version> | ||
<executions> | ||
<execution> | ||
<id>build-dist</id> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<phase>package</phase> | ||
<configuration> | ||
<target> | ||
<!-- Replace the '.' in ${module.name} with '/' to get its path --> | ||
<tempfile property="temp.file" /> | ||
<echo message="${module.name}" file="${temp.file}" /> | ||
<replace file="${temp.file}" token="." value="/" /> | ||
<loadfile srcfile="${temp.file}" property="module.path" /> | ||
<delete file="${temp.file}" /> | ||
|
||
<delete dir="target/module" /> | ||
<property name="module.dir" value="modules/${module.path}/main" /> | ||
|
||
<copy file="src/main/resources/module/main/module.xml" tofile="${env.JBOSS_HOME}/${module.dir}/module.xml" /> | ||
<copy file="target/${project.artifactId}-${project.version}.jar" todir="${env.JBOSS_HOME}/${module.dir}" /> | ||
|
||
<echo>Module ${module.name} has been created in the JBoss_Home/module directory.</echo> | ||
</target> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
99 changes: 99 additions & 0 deletions
99
aejb-preprocessor/src/main/java/org/nju/artemis/aejb/preprocessor/ControlFlow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package org.nju.artemis.aejb.preprocessor; | ||
|
||
import java.util.Iterator; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import org.objectweb.asm.tree.AbstractInsnNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
|
||
|
||
public class ControlFlow { | ||
|
||
List<flow> con=new LinkedList<flow>(); | ||
|
||
public flow getFlow(int src){ | ||
Iterator<flow> f = con.iterator(); | ||
while(f.hasNext()){ | ||
flow fn=f.next(); | ||
if(fn.src==src) | ||
{ | ||
return fn; | ||
} | ||
} | ||
return null; | ||
} | ||
public void addFlow(int src,int dst){ | ||
flow fl=getFlow(src); | ||
if(fl!=null){ | ||
fl.setDst(dst); | ||
} | ||
else | ||
{ | ||
con.add(new flow(src,dst)); | ||
} | ||
//System.out.println(src+"->"+dst); | ||
} | ||
public int getDstSize(int src){ | ||
return getFlow(src).dst.size(); | ||
} | ||
public List getDst(int src){ | ||
return getFlow(src).getDst(); | ||
} | ||
public List<AbstractInsnNode> getDstNode(MethodNode mn,int src){ | ||
List<AbstractInsnNode> dstnode=new LinkedList<AbstractInsnNode>(); | ||
for(int i=0;i<getDstSize(src);i++){ | ||
dstnode.add((AbstractInsnNode)mn.instructions.get((Integer) getDst(src).get(i))); | ||
} | ||
return dstnode; | ||
|
||
} | ||
public void showControlFlow(){ | ||
Iterator<flow> f = con.iterator(); | ||
while(f.hasNext()){ | ||
flow fn=f.next(); | ||
System.out.print(fn.src+"->"); | ||
List d=getDst(fn.src); | ||
for(int i=0;i<d.size();i++){ | ||
System.out.print(d.get(i)+","); | ||
} | ||
System.out.println(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
class flow | ||
{ | ||
int src; | ||
boolean isWhile; | ||
List dst=new LinkedList(); | ||
public flow(int src,int dst) | ||
{ | ||
this.src=src; | ||
this.dst.add(dst); | ||
isWhile=false; | ||
} | ||
public void setSrc(int s){ | ||
src=s; | ||
} | ||
public void setDst(int d){ | ||
dst.add(d); | ||
} | ||
public int getSrc() | ||
{ | ||
return src; | ||
} | ||
public List getDst(){ | ||
return dst; | ||
} | ||
public boolean getIsWhile() | ||
{ | ||
return isWhile; | ||
} | ||
public void setIsWhile(boolean w){ | ||
isWhile=w; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
aejb-preprocessor/src/main/java/org/nju/artemis/aejb/preprocessor/Event.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.nju.artemis.aejb.preprocessor; | ||
|
||
public class Event { | ||
private int head; | ||
/** | ||
* @return the head | ||
*/ | ||
private int tail; | ||
private String event; | ||
|
||
public Event(int head, int tail, String event) { | ||
super(); | ||
this.head = head; | ||
this.tail = tail; | ||
this.event = event; | ||
System.out.println(head+"-"+event+"-"+tail); | ||
} | ||
|
||
/** | ||
* @param head | ||
* @param tail | ||
* @param event | ||
*/ | ||
public int getHead() { | ||
return head; | ||
} | ||
/** | ||
* @param head the head to set | ||
*/ | ||
public void setHead(int head) { | ||
this.head = head; | ||
} | ||
/** | ||
* @return the tail | ||
*/ | ||
public int getTail() { | ||
return tail; | ||
} | ||
/** | ||
* @param tail the tail to set | ||
*/ | ||
public void setTail(int tail) { | ||
this.tail = tail; | ||
} | ||
/** | ||
* @return the event | ||
*/ | ||
public String getEvent() { | ||
return event; | ||
} | ||
/** | ||
* @param event the event to set | ||
*/ | ||
public void setEvent(String event) { | ||
this.event = event; | ||
} | ||
public String getPort(){ | ||
if(event.contains("Ejb")) | ||
{ | ||
return event.split("\\.")[1]; | ||
} | ||
return null; | ||
|
||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.