Author: mvitenkov
Date: 2008-10-22 09:30:59 -0400 (Wed, 22 Oct 2008)
New Revision: 10864
Modified:
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java
===================================================================
---
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-10-22
11:49:30 UTC (rev 10863)
+++
trunk/test-applications/jsp/src/main/java/util/componentInfo/ComponentInfo.java 2008-10-22
13:30:59 UTC (rev 10864)
@@ -86,6 +86,9 @@
}
TLDParser parser = new TLDParser(richName);
ArrayList<String> allAttributes = parser.getAllAttributes();
+ for(String s:allAttributes){
+ System.out.println(s);
+ }
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
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-22
11:49:30 UTC (rev 10863)
+++ trunk/test-applications/jsp/src/main/java/util/parser/TLDParser.java 2008-10-22
13:30:59 UTC (rev 10864)
@@ -10,7 +10,7 @@
public class TLDParser {
- protected String component;
+ protected String component;
protected JarEntry tld;
protected JarFile richfacesUI;
protected ArrayList<String> allAttributes;
@@ -18,7 +18,7 @@
public TLDParser(String str) {
this.component = str;
allAttributes = new ArrayList<String>();
- }
+ }
public ArrayList<String> getAllAttributes() {
@@ -26,28 +26,39 @@
InputStream input = null;
try {
input = richfacesUI.getInputStream(tld);
-
- InputStreamReader isr = new InputStreamReader(input);
- BufferedReader reader = new BufferedReader(isr);
- String line, attribute;
- int position, end;
- while ((line = reader.readLine()) != null) {
- if ((position = line.indexOf("<name>")) != -1) {
+
+ InputStreamReader isr = new InputStreamReader(input);
+ BufferedReader reader = new BufferedReader(isr);
+ String line, 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();
- allAttributes.add(attribute);
- }
- }
- reader.close();
- } catch (IOException e) {
+ if (attribute.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();
+ allAttributes.add(attribute);
+ }
+ }
+ flag = false;
+ }
+ }
+ }
+ reader.close();
+ } catch (IOException e) {
e.printStackTrace();
}
return allAttributes;
}
- public String getExtPath() {
+ public String getExtPath() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- String resource = "META-INF/richfaces.tld";
+ String resource = "META-INF/richfaces.tld";
return loader.getResource(resource).toString();
}
@@ -57,9 +68,9 @@
public void setComponent(String component) {
this.component = component;
- }
+ }
- public JarFile getRichfacesUI() {
+ public JarFile getRichfacesUI() {
String temp = null;
int position;
try {
@@ -67,7 +78,7 @@
temp = getExtPath().substring("jar:file:\\".length(), position);
}
richfacesUI = new JarFile(temp);
- } catch (IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
return richfacesUI;
Show replies by date