Author: mvitenkov
Date: 2008-10-25 09:48:24 -0400 (Sat, 25 Oct 2008)
New Revision: 10905
Added:
trunk/test-applications/jsp/src/main/java/util/parser/Attribute.java
Modified:
trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java
Log:
Added: trunk/test-applications/jsp/src/main/java/util/parser/Attribute.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/parser/Attribute.java
(rev 0)
+++ trunk/test-applications/jsp/src/main/java/util/parser/Attribute.java 2008-10-25
13:48:24 UTC (rev 10905)
@@ -0,0 +1,64 @@
+package util.parser;
+
+public class Attribute {
+ private String name;
+ private String type;
+ private String description;
+ private Status status;
+
+ public Attribute(){
+ this.description = "";
+ }
+
+ public Attribute(String name){
+ this.name = name;
+ this.description = "";
+ }
+
+ public Attribute(String name, String type, String desc, Status status){
+ this.name = name;
+ this.type = type;
+ this.description = desc;
+ this.status = status;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ @Override
+ public String toString(){
+ return "[" + "Name: " + name + "\r\n" +
"Description: " + description + "\r\n" +
+ "Type: " + type + "\r\n" + "Status: " + status +
"]";
+ }
+}
+
+ enum Status {NOT_READY, IMPLEMENTED, FAILED, PASSED}
Modified: trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java 2008-10-25
07:52:44 UTC (rev 10904)
+++ trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java 2008-10-25
13:48:24 UTC (rev 10905)
@@ -13,14 +13,14 @@
protected String component;
protected JarEntry tld;
protected JarFile richfacesUI;
- protected ArrayList<String> allAttributes;
+ protected ArrayList<Attribute> allAttributes;
public TLDParser(String str) {
this.component = str;
- allAttributes = new ArrayList<String>();
+ allAttributes = new ArrayList<Attribute>();
}
- public ArrayList<String> getAllAttributes() {
+ public ArrayList<Attribute> getAllAttributes() {
tld = getRichfacesUI().getJarEntry("META-INF/richfaces.tld");
InputStream input = null;
@@ -29,20 +29,61 @@
InputStreamReader isr = new InputStreamReader(input);
BufferedReader reader = new BufferedReader(isr);
- String line, attribute;
+ String line, attr;
+ Attribute attribute = new Attribute();
int position, end;
boolean flag = true;
while (((line = reader.readLine()) != null) && flag) {
if ((position = line.indexOf("<name>")) != -1) {
end = line.indexOf("</name>");
- attribute = line.substring(position + 6, end).trim();
- if (attribute.equalsIgnoreCase(component)) {
+ attr = line.substring(position + 6, end).trim();
+ if (attr.equalsIgnoreCase(component)) {
while (!(line = reader.readLine()).contains("</tag>")) {
- if ((position = line.indexOf("<name>")) != -1) {
- end = line.indexOf("</name>");
- attribute = line.substring(position + 6, end)
- .trim();
+ if (line.contains("<attribute>")) {
+ do {
+ // find attribute name
+ if ((position = line.indexOf("<name>")) != -1) {
+ end = line.indexOf("</name>");
+ attribute.setName(line.substring(
+ position + 6, end).trim());
+ }
+ // find attribute description
+ if ((position = line
+ .indexOf("<description>")) != -1) {
+
+ if((end = line.indexOf("</description>")) != -1){
+ attribute.setDescription(line.substring(position + 13, line.length()-14));
+ }else{
+ attribute.setDescription(attribute.getDescription()
+ + line.substring(position + 13, line.length()));
+ line = reader.readLine();
+ while ((end = line.indexOf("</description>")) == -1) {
+ attribute.setDescription(attribute.getDescription() + " "
+ + line.substring(0, line.length()).trim());
+ }
+ attribute.setDescription(attribute.getDescription()
+ + line.substring(0, line.length() - 14));
+ }
+ }
+ // find attribute type
+ if ((position = line.indexOf("<type>")) != -1) {
+ end = line.indexOf("</type>");
+
+ /*try {
+ Class<?> cl = Class.forName(line
+ .substring(position + 6,
+ end).trim());*/
+ attribute.setType(line.substring(position + 6, end).trim());
+ /*} catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }*/
+ }
+ } while (!((line = reader.readLine())
+ .contains("</attribute>")));
+ // define attribute status
+ attribute.setStatus(Status.NOT_READY);
allAttributes.add(attribute);
+ attribute = new Attribute();
}
}
flag = false;
Show replies by date