JBoss Tools SVN: r6381 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-02-18 09:28:20 -0500 (Mon, 18 Feb 2008)
New Revision: 6381
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1615Test.java
Log:
Code adjustment
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1615Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1615Test.java 2008-02-18 14:11:35 UTC (rev 6380)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1615Test.java 2008-02-18 14:28:20 UTC (rev 6381)
@@ -24,6 +24,12 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
+/**
+ * Test JBIDE-1615
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
public class JBIDE1615Test extends VpeTest {
public static final String IMPORT_PROJECT_NAME = "jsfTest";
@@ -31,12 +37,11 @@
private static final String TEST_PAGE_NAME = "JBIDE/1615/JBIDE-1615.xhtml";
public JBIDE1615Test(String name) {
-
super(name);
}
- //test method for JBIDE 1484
- public void testJBIDE_1484() throws Throwable {
+ //test method for JBIDE 1615
+ public void testJBIDE_1615() throws Throwable {
// wait
TestUtil.waitForJobs();
// set exception
@@ -54,7 +59,7 @@
assertNotNull("Editor input is null", input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
-
+
// get dom document
nsIDOMDocument document = getVpeVisualDocument(part);
nsIDOMElement element = document.getDocumentElement();
16 years, 8 months
JBoss Tools SVN: r6380 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-18 09:11:35 -0500 (Mon, 18 Feb 2008)
New Revision: 6380
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
Log:
JBIDE-1780
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2008-02-18 14:10:54 UTC (rev 6379)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2008-02-18 14:11:35 UTC (rev 6380)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.web.model.handlers;
import java.io.File;
+import java.io.IOException;
import java.util.*;
import org.jboss.tools.common.meta.action.impl.WizardDataValidator;
import org.jboss.tools.common.model.XModel;
@@ -168,7 +169,7 @@
setValueList(1, "taglibs", s);
}
- void initSelectedTaglibs() throws Exception {
+ void initSelectedTaglibs() throws IOException {
String template = getAttributeValue(0, "template");
String value = template == null ? null : (String)selectedTaglibs.get(template.trim());
if(value != null && template.trim().length() > 0) {
@@ -188,15 +189,17 @@
setAttributeValue(1, "taglibs", value);
}
- protected String modifyBody(String body) {
+ protected String modifyBody(String body) throws IOException {
if(getEntityData().length < 2 || taglibs == null) return body;
+ if(taglibs == null) return body;
+ if(getStepId() == 0) initSelectedTaglibs();
String ts = getAttributeValue(1, "taglibs");
- if(ts.length() == 0 && getStepId() == 0) return body;
String[] selected = toArray(ts);
return taglibs.modifyBody(body, selected);
}
String[] toArray(String s) {
+ if(s == null || s.length() == 0) return new String[0];
StringTokenizer st = new StringTokenizer(s, ";,");
String[] a = new String[st.countTokens()];
for (int i = 0; i < a.length; i++) a[i] = st.nextToken();
16 years, 8 months
JBoss Tools SVN: r6379 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/files/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-18 09:10:54 -0500 (Mon, 18 Feb 2008)
New Revision: 6379
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/files/handlers/CreateFileSupport.java
Log:
JBIDE-1780
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/files/handlers/CreateFileSupport.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/files/handlers/CreateFileSupport.java 2008-02-18 14:08:53 UTC (rev 6378)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/files/handlers/CreateFileSupport.java 2008-02-18 14:10:54 UTC (rev 6379)
@@ -14,7 +14,6 @@
import java.util.*;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.common.meta.XMapping;
@@ -24,7 +23,6 @@
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.filesystems.impl.*;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.*;
import org.jboss.tools.common.util.FileUtil;
@@ -184,17 +182,17 @@
return createFile(targetHolder.target, path, body, extractStepData(0));
}
- protected String getTemplateBody() throws Exception {
+ protected String getTemplateBody() throws IOException {
File templateFile = null;
String template = getAttributeValue(0, "template");
if(template != null && template.trim().length() > 0) {
templateFile = findTemplate(template.trim());
- if(templateFile == null || !templateFile.isFile()) throw new Exception("Template " + template + " is not found.");
+ if(templateFile == null || !templateFile.isFile()) throw new IOException("Template " + template + " is not found.");
}
return (templateFile == null) ? "" : FileUtil.readFile(templateFile);
}
- protected String modifyBody(String body) {
+ protected String modifyBody(String body) throws IOException {
return body;
}
16 years, 8 months
JBoss Tools SVN: r6378 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-02-18 09:08:53 -0500 (Mon, 18 Feb 2008)
New Revision: 6378
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1744, border creation updated, footer and header css classes processing updated.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java 2008-02-18 14:03:01 UTC (rev 6377)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java 2008-02-18 14:08:53 UTC (rev 6378)
@@ -14,6 +14,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeDataTableElements.SourceColumnElements;
+import org.jboss.tools.vpe.editor.template.VpeDataTableElements.SourceDataTableElements;
import org.jboss.tools.vpe.editor.template.VpeDataTableElements.VisualColumnElements;
import org.jboss.tools.vpe.editor.template.VpeDataTableElements.VisualDataTableElements;
import org.jboss.tools.vpe.editor.util.HTML;
@@ -45,6 +46,7 @@
}
SourceColumnElements columnElements = new SourceColumnElements(sourceNode);
+
if (visualParent != null && HTML.TAG_TABLE.equalsIgnoreCase(visualParent.getNodeName()) && columnElements != null) {
VisualDataTableElements visualDataTableElements = VpeDataTableElements.getVisualDataTableElements(visualParent);
VisualColumnElements visualColumnElements = new VisualColumnElements();
@@ -60,7 +62,16 @@
info.addSourceChild(columnElements.getHeader());
}
creatorInfo.addChildrenInfo(info);
- setCellClass(cell, getColumnAttrValue(sourceNode, "headerClass"));
+
+ String styleClass = "";
+ String tableHeaderClass = getNodeAttrValue(sourceNode.getParentNode(), "headerClass");
+ String columnHeaderClass = getNodeAttrValue(sourceNode, "headerClass");
+ if (null != columnHeaderClass && !"".equalsIgnoreCase(columnHeaderClass)) {
+ styleClass = columnHeaderClass;
+ } else if (null != tableHeaderClass && !"".equalsIgnoreCase(tableHeaderClass)) {
+ styleClass = tableHeaderClass;
+ }
+ setCellClass(cell, styleClass);
visualColumnElements.setHeaderCell(cell);
cell = VpeDataTableElements.makeCell(visualDataTableElements.getColumnsFooterRow(), index, HTML.TAG_TD, visualDocument);
@@ -69,7 +80,16 @@
info.addSourceChild(columnElements.getFooter());
}
creatorInfo.addChildrenInfo(info);
- setCellClass(cell, getColumnAttrValue(sourceNode, "footerClass"));
+
+ styleClass = "";
+ String tableFooterClass = getNodeAttrValue(sourceNode.getParentNode(), "footerClass");
+ String columnFooterClass = getNodeAttrValue(sourceNode, "footerClass");
+ if (null != columnFooterClass && !"".equalsIgnoreCase(columnFooterClass)) {
+ styleClass = columnFooterClass;
+ } else if (null != tableFooterClass && !"".equalsIgnoreCase(tableFooterClass)) {
+ styleClass = tableFooterClass;
+ }
+ setCellClass(cell, styleClass);
visualColumnElements.setFooterCell(cell);
cell = VpeDataTableElements.makeCell(visualDataTableElements.getBodyRow(), index, HTML.TAG_TD, visualDocument);
@@ -155,13 +175,14 @@
}
}
- private String getColumnAttrValue(Node columnNode, String attrName) {
- if (columnNode != null) {
- Node attr = columnNode.getAttributes().getNamedItem(attrName);
+ private String getNodeAttrValue(Node node, String attrName) {
+ if (node != null) {
+ Node attr = node.getAttributes().getNamedItem(attrName);
if (attr != null) {
return attr.getNodeValue();
}
}
return null;
}
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-02-18 14:03:01 UTC (rev 6377)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-02-18 14:08:53 UTC (rev 6378)
@@ -182,8 +182,8 @@
row = visualDocument.createElement(HTML.TAG_TR);
section.appendChild(row);
visualTable.appendChild(section);
- visualElements.setBodyRow(row);
- visualElements.setBody(section);
+ //visualElements.setBodyRow(row);
+ //visualElements.setBody(section);
}
VpeChildrenInfo info = null;
@@ -207,6 +207,9 @@
outterTR.appendChild(outterTD);
outterTBODY.appendChild(outterTR);
outterTable.appendChild(outterTBODY);
+
+ visualElements.setBodyRow(outterTR);
+ visualElements.setBody(outterTBODY);
Object[] elements = new Object[2];
elements[0] = visualElements;
@@ -219,8 +222,13 @@
VpeCreatorInfo info1 = creator.create(pageContext, (Element) sourceNode, visualDocument, visualTable, visualNodeMap);
if (info1 != null && info1.getVisualNode() != null) {
nsIDOMAttr attr = (nsIDOMAttr) info1.getVisualNode();
- // TODO creates border=1 here
- visualTable.setAttributeNode(attr);
+ // Fixes creation 'border="1"'
+ // when setting border attribute to the table
+ if (VpeTemplateManager.ATTR_ANY_BORDER.equalsIgnoreCase(attr.getNodeName())
+ && (null == attr.getNodeValue() || "".equalsIgnoreCase(attr.getNodeValue()))) {
+ attr.setNodeValue("0");
+ }
+ outterTable.setAttributeNode(attr);
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java 2008-02-18 14:03:01 UTC (rev 6377)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java 2008-02-18 14:08:53 UTC (rev 6378)
@@ -132,9 +132,9 @@
if (captionStyle != null && captionStyle.trim().length() > 0) {
resultStyle += captionStyle;
}
- if (!(captionStyle.lastIndexOf("width") > -1)) {
- resultStyle += "width: 100%; ";
- }
+// if (!(captionStyle.lastIndexOf("width") > -1)) {
+// resultStyle += "width: 100%; ";
+// }
((nsIDOMElement)cell).setAttribute(HTML.ATTR_STYLE, resultStyle);
}
}
16 years, 8 months
JBoss Tools SVN: r6377 - trunk/documentation/qa/reports.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2008-02-18 09:03:01 -0500 (Mon, 18 Feb 2008)
New Revision: 6377
Added:
trunk/documentation/qa/reports/JBossToolsRegression04.02.2008.doc
Removed:
trunk/documentation/qa/reports/JBossToolsRegressionTests.doc
Log:
Renamed remotely
Copied: trunk/documentation/qa/reports/JBossToolsRegression04.02.2008.doc (from rev 6376, trunk/documentation/qa/reports/JBossToolsRegressionTests.doc)
===================================================================
(Binary files differ)
Deleted: trunk/documentation/qa/reports/JBossToolsRegressionTests.doc
===================================================================
(Binary files differ)
16 years, 8 months
JBoss Tools SVN: r6376 - trunk/documentation/qa/reports.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2008-02-18 09:01:14 -0500 (Mon, 18 Feb 2008)
New Revision: 6376
Added:
trunk/documentation/qa/reports/JBossToolsRegressionTests.doc
Log:
Added a file remotely
Added: trunk/documentation/qa/reports/JBossToolsRegressionTests.doc
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/reports/JBossToolsRegressionTests.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 8 months
JBoss Tools SVN: r6375 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-18 06:48:27 -0500 (Mon, 18 Feb 2008)
New Revision: 6375
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLConstants.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java
Log:
JBIDE-1785 Initial input with base functionality
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IValueInfo.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import java.util.Properties;
+
+import org.w3c.dom.Element;
+
/**
* @author Viacheslav Kabanovich
*/
@@ -20,4 +24,8 @@
* @return
*/
public String getValue();
+
+ public Element toXML(Element parent, Properties context);
+
+ public void loadXML(Element element, Properties context);
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -10,9 +10,13 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import java.io.File;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -46,7 +50,27 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ cleanCachedProjects();
}
+
+ static void cleanCachedProjects() {
+ IPath path = SeamCorePlugin.getDefault().getStateLocation();
+ File file = new File(path.toFile(), "projects"); //$NON-NLS-1$
+ if(file.isDirectory()) {
+ File[] fs = file.listFiles();
+ if(fs != null) {
+ for (int i = 0; i < fs.length; i++) {
+ if(!fs[i].isFile()) continue;
+ String n = fs[i].getName();
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(n);
+ if(p == null || !p.isAccessible()) {
+ fs[i].delete();
+ }
+ }
+ }
+ }
+
+ }
/*
* (non-Javadoc)
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,17 +11,19 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.jboss.tools.seam.core.ISeamContextVariable;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
*/
-public class AbstractContextVariable extends AbstractSeamDeclaration implements ISeamContextVariable {
+public abstract class AbstractContextVariable extends AbstractSeamDeclaration implements ISeamContextVariable {
protected ScopeType scopeType;
protected String scope;
@@ -82,4 +84,19 @@
AbstractContextVariable c = (AbstractContextVariable)super.clone();
return c;
}
-}
\ No newline at end of file
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+ if(scope != null) element.setAttribute(SeamXMLConstants.ATTR_SCOPE, scope);
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+ if(element.hasAttribute(SeamXMLConstants.ATTR_SCOPE)) {
+ scope = element.getAttribute(SeamXMLConstants.ATTR_SCOPE);
+ setScopeAsString(scope);
+ }
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -13,12 +13,15 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.seam.core.IOpenableElement;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -98,4 +101,46 @@
return changes;
}
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ XModelObject old = pushModelObject(context);
+
+ if(name != null) element.setAttribute(SeamXMLConstants.ATTR_NAME, name);
+ SeamXMLHelper.saveMap(element, attributes, "attributes", context);
+
+ popModelObject(context, old);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ XModelObject old = pushModelObject(context);
+
+ name = element.getAttribute(SeamXMLConstants.ATTR_NAME);
+ SeamXMLHelper.loadMap(element, attributes, "attributes", context);
+
+ popModelObject(context, old);
+ }
+
+ protected XModelObject pushModelObject(Properties context) {
+ XModelObject old = (XModelObject)context.get(SeamXMLConstants.KEY_MODEL_OBJECT);
+
+ if(id instanceof XModelObject) {
+ context.put(SeamXMLConstants.KEY_MODEL_OBJECT, id);
+ }
+
+ return old;
+ }
+
+ protected void popModelObject(Properties context, XModelObject old) {
+ if(old != null) {
+ context.put(SeamXMLConstants.KEY_MODEL_OBJECT, old);
+ } else {
+ context.remove(SeamXMLConstants.KEY_MODEL_OBJECT);
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/BijectedAttribute.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -10,12 +10,15 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -86,4 +89,40 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_BIJECTED_ATTRIBUTE;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ if(types != null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < types.length; i++) sb.append(types[i].toString()).append(';');
+ element.setAttribute("attr-types", sb.toString());
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ if(element.hasAttribute("attr-types")) {
+ String v = element.getAttribute("attr-types");
+ if(v != null && v.length() > 0) {
+ String[] cs = v.split(";");
+ List<BijectedAttributeType> list = new ArrayList<BijectedAttributeType>();
+ for (int i = 0; i < cs.length; i++) {
+ try {
+ list.add(BijectedAttributeType.valueOf(cs[i]));
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+ types = list.toArray(new BijectedAttributeType[0]);
+ }
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/DataModelSelectionAttribute.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,8 +11,11 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
+
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -48,4 +51,22 @@
return changes;
}
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_DATA_MODEL;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ if(attributes.get(VALUE) != null) {
+ setValue(attributes.get(VALUE));
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -48,4 +48,9 @@
}
return returnScopeType;
}
-}
\ No newline at end of file
+
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_ROLE;
+ }
+
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamAnnotatedFactory.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,6 +11,7 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.eclipse.jdt.core.IMethod;
import org.jboss.tools.seam.core.ISeamAnnotatedFactory;
@@ -18,6 +19,7 @@
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -80,4 +82,26 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_FACTORY;
+ }
+
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_JAVA;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ element.setAttribute(SeamXmlComponentDeclaration.AUTO_CREATE, "" + autoCreate);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ autoCreate = "true".equals(element.getAttribute(SeamXmlComponentDeclaration.AUTO_CREATE));
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -66,4 +66,8 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_COMPONENT;
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentMethod.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,6 +12,7 @@
import java.util.HashSet;
import java.util.List;
+import java.util.Properties;
import java.util.Set;
import org.eclipse.core.resources.IResource;
@@ -20,6 +21,7 @@
import org.jboss.tools.seam.core.ISeamComponentMethod;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -107,4 +109,42 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_METHOD;
+ }
+
+ static String ATTR_COMP_TYPES = "comp-types";
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ if(types != null) {
+ StringBuffer sb = new StringBuffer();
+ for (SeamComponentMethodType t : types) {
+ sb.append(t.toString()).append(';');
+ }
+ element.setAttribute(ATTR_COMP_TYPES, sb.toString());
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ if(element.hasAttribute(ATTR_COMP_TYPES)) {
+ String v = element.getAttribute(ATTR_COMP_TYPES);
+ if(v != null && v.length() > 0) {
+ String[] cs = v.split(";");
+ for (int i = 0; i < cs.length; i++) {
+ try {
+ types.add(SeamComponentMethodType.valueOf(cs[i]));
+ } catch (Exception e) {
+ //ignore
+ }
+ }
+ }
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -15,6 +15,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.eclipse.jdt.core.IMember;
@@ -22,6 +23,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
@@ -37,6 +39,7 @@
import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
public class SeamJavaComponentDeclaration extends SeamComponentDeclaration
implements ISeamJavaComponentDeclaration {
@@ -465,4 +468,157 @@
return c;
}
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_JAVA;
+ }
+
+ static String ATTR_CLASS_NAME = "class-name";
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ if(scopeType != null) {
+ element.setAttribute(SeamXMLConstants.ATTR_SCOPE, scopeType.toString());
+ }
+
+ if(types != null) {
+ Element e_types = XMLUtilities.createElement(element, "bean-types");
+ for (BeanType t: types.keySet()) {
+ IValueInfo v = types.get(t);
+ if(v == null) continue;
+ Element e_type = XMLUtilities.createElement(e_types, "bean-type");
+ e_type.setAttribute(SeamXMLConstants.ATTR_NAME, t.toString());
+ SeamXMLHelper.saveValueInfo(e_type, v, context);
+ }
+ }
+
+ element.setAttribute(SeamXmlComponentDeclaration.PRECEDENCE, "" + precedence);
+
+ if(type != null && type != id) {
+ SeamXMLHelper.saveType(element, type, "type", context);
+ }
+ if(type != null) context.put(SeamXMLConstants.ATTR_TYPE, type);
+
+ if(className != null && (type == null || !className.equals(type.getFullyQualifiedName()))) {
+ element.setAttribute(ATTR_CLASS_NAME, className);
+ }
+
+ if(bijectedAttributes.size() > 0) {
+ Element b = XMLUtilities.createElement(element, "bijected");
+ for (IBijectedAttribute a: bijectedAttributes) {
+ SeamObject o = (SeamObject)a;
+ o.toXML(b, context);
+ }
+ }
+
+ if(componentMethods.size() > 0) {
+ Element b = XMLUtilities.createElement(element, "methods");
+ for (ISeamComponentMethod a: componentMethods) {
+ SeamObject o = (SeamObject)a;
+ o.toXML(b, context);
+ }
+ }
+
+ if(roles.size() > 0) {
+ Element b = XMLUtilities.createElement(element, "roles");
+ for (IRole a: roles) {
+ SeamObject o = (SeamObject)a;
+ o.toXML(b, context);
+ }
+ }
+
+ context.remove(SeamXMLConstants.ATTR_TYPE);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ setScope(element.getAttribute(SeamXMLConstants.ATTR_SCOPE));
+
+ Element e_types = XMLUtilities.getUniqueChild(element, "bean-types");
+ if(e_types != null) {
+ types = new HashMap<BeanType, IValueInfo>();
+ Element[] e_type = XMLUtilities.getChildren(e_types, "bean-type");
+ for (int i = 0; i < e_type.length; i++) {
+ String name = e_type[i].getAttribute(SeamXMLConstants.ATTR_NAME);
+ BeanType t = null;
+ try {
+ t = BeanType.valueOf(name);
+ } catch (Exception e) {
+ continue;
+ }
+ if(t == null) continue;
+ IValueInfo value = SeamXMLHelper.loadValueInfo(e_type[i], context);
+ if(value != null) {
+ types.put(t, value);
+ }
+ }
+ }
+
+ if(element.hasAttribute(SeamXmlComponentDeclaration.PRECEDENCE)) {
+ String v = element.getAttribute(SeamXmlComponentDeclaration.PRECEDENCE);
+ if(v != null && v.length() > 0) {
+ try {
+ precedence = Integer.parseInt(v);
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+ }
+
+ Element e_type = XMLUtilities.getUniqueChild(element, "type");
+ if(e_type != null) {
+ type = SeamXMLHelper.loadType(e_type, context);
+ } else if(id instanceof IType) {
+ type = (IType)id;
+ }
+ if(type != null) context.put(SeamXMLConstants.ATTR_TYPE, type);
+
+ if(element.hasAttribute(ATTR_CLASS_NAME)) {
+ className = element.getAttribute(ATTR_CLASS_NAME);
+ } else if(type != null) {
+ className = type.getFullyQualifiedName();
+ }
+
+ Element b = XMLUtilities.getUniqueChild(element, "bijected");
+ if(b != null) {
+ Element[] cs = XMLUtilities.getChildren(b, SeamXMLConstants.TAG_BIJECTED_ATTRIBUTE);
+ for (int i = 0; i < cs.length; i++) {
+ String cls = cs[i].getAttribute(SeamXMLConstants.ATTR_CLASS);
+ BijectedAttribute a = null;
+ if(SeamXMLConstants.CLS_DATA_MODEL.equals(cls)) {
+ a = new DataModelSelectionAttribute();
+ } else {
+ a = new BijectedAttribute();
+ }
+ a.loadXML(cs[i], context);
+ addBijectedAttribute(a);
+ }
+ }
+
+ b = XMLUtilities.getUniqueChild(element, "methods");
+ if(b != null) {
+ Element[] cs = XMLUtilities.getChildren(b, SeamXMLConstants.TAG_METHOD);
+ for (int i = 0; i < cs.length; i++) {
+ SeamComponentMethod a = new SeamComponentMethod();
+ a.loadXML(cs[i], context);
+ addMethod(a);
+ }
+ }
+
+ b = XMLUtilities.getUniqueChild(element, "roles");
+ if(b != null) {
+ Element[] cs = XMLUtilities.getChildren(b, SeamXMLConstants.TAG_ROLE);
+ for (int i = 0; i < cs.length; i++) {
+ Role a = new Role();
+ a.loadXML(cs[i], context);
+ addRole(a);
+ }
+ }
+
+ context.remove(SeamXMLConstants.ATTR_TYPE);
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,15 +12,22 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamJavaSourceReference;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
-public class SeamJavaContextVariable extends AbstractContextVariable implements ISeamJavaSourceReference {
+public abstract class SeamJavaContextVariable extends AbstractContextVariable implements ISeamJavaSourceReference {
protected IMember javaSource = null;
+
+ public SeamJavaContextVariable() {}
public IMember getSourceMember() {
return javaSource;
@@ -72,5 +79,34 @@
SeamJavaContextVariable c = (SeamJavaContextVariable)super.clone();
return c;
}
+
+ static String TAG_JAVA_SOURCE = "java-source";
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ if(javaSource instanceof IField) {
+ SeamXMLHelper.saveField(element, (IField)javaSource, TAG_JAVA_SOURCE, context);
+ } else if(javaSource instanceof IMethod) {
+ SeamXMLHelper.saveMethod(element, (IMethod)javaSource, TAG_JAVA_SOURCE, context);
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ Element c = XMLUtilities.getUniqueChild(element, TAG_JAVA_SOURCE);
+ if(c != null) {
+ String cls = c.getAttribute(SeamXMLConstants.ATTR_CLASS);
+ if(SeamXMLConstants.CLS_FIELD.equals(cls)) {
+ javaSource = SeamXMLHelper.loadField(c, context);
+ } else if(SeamXMLConstants.CLS_METHOD.equals(cls)) {
+ javaSource = SeamXMLHelper.loadMethod(c, context);
+ }
+ }
+
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamObject.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,13 +11,21 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamElement;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -132,5 +140,69 @@
//do not copy parent
return c;
}
+
+ //Serializing to XML
+
+ public String getXMLName() {
+ return "object";
+ }
+
+ public String getXMLClass() {
+ return null;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = XMLUtilities.createElement(parent, getXMLName());
+ if(getXMLClass() != null) {
+ element.setAttribute(SeamXMLConstants.ATTR_CLASS, getXMLClass());
+ }
+ if(source != null && !source.equals(context.get(SeamXMLConstants.ATTR_PATH))) {
+ element.setAttribute(SeamXMLConstants.ATTR_PATH, source.toString());
+ }
+ if(id != null) {
+ if(id instanceof String) {
+ Element eid = XMLUtilities.createElement(element, SeamXMLConstants.TAG_ID);
+ eid.setAttribute(SeamXMLConstants.ATTR_CLASS, SeamXMLConstants.CLS_STRING);
+ eid.setAttribute(SeamXMLConstants.ATTR_VALUE, id.toString());
+ } else if(id instanceof IType) {
+ SeamXMLHelper.saveType(element, ((IType)id), SeamXMLConstants.TAG_ID, context);
+ } else if(id instanceof IField) {
+ SeamXMLHelper.saveField(element, ((IField)id), SeamXMLConstants.TAG_ID, context);
+ } else if(id instanceof IMethod) {
+ SeamXMLHelper.saveMethod(element, ((IMethod)id), SeamXMLConstants.TAG_ID, context);
+ } else if(id instanceof XModelObject) {
+ XModelObject o = (XModelObject)id;
+ SeamXMLHelper.saveModelObject(element, o, SeamXMLConstants.TAG_ID, context);
+ }
+ }
+ return element;
+ }
+ public void loadXML(Element element, Properties context) {
+ String s = element.getAttribute(SeamXMLConstants.ATTR_PATH);
+ if(s != null && s.length() > 0) {
+ source = new Path(s);
+ } else {
+ source = (IPath)context.get(SeamXMLConstants.ATTR_PATH);
+ }
+ if(source == null) {
+ System.out.println("Cannot load source");
+ }
+ Element e_id = XMLUtilities.getUniqueChild(element, SeamXMLConstants.TAG_ID);
+ if(e_id != null) {
+ String cls = e_id.getAttribute(SeamXMLConstants.ATTR_CLASS);
+ if(SeamXMLConstants.CLS_STRING.equals(cls)) {
+ id = e_id.getAttribute("string");
+ } else if(SeamXMLConstants.CLS_TYPE.equals(cls)) {
+ id = SeamXMLHelper.loadType(e_id, context);
+ } else if(SeamXMLConstants.CLS_FIELD.equals(cls)) {
+ id = SeamXMLHelper.loadField(e_id, context);
+ } else if(SeamXMLConstants.CLS_METHOD.equals(cls)) {
+ id = SeamXMLHelper.loadMethod(e_id, context);
+ } else if(SeamXMLConstants.CLS_MODEL_OBJECT.equals(cls)) {
+ id = SeamXMLHelper.loadModelObject(e_id, context);
+ }
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -19,6 +19,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import org.eclipse.core.resources.ICommand;
@@ -32,13 +33,8 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
@@ -56,11 +52,8 @@
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
-import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
-import org.jboss.tools.seam.core.project.facet.SeamVersion;
-import org.jboss.tools.seam.internal.core.project.facet.ISeamCoreConstants;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
import org.jboss.tools.seam.internal.core.validation.SeamValidationContext;
@@ -82,6 +75,8 @@
Set<IPath> sourcePaths = new HashSet<IPath>();
+ Map<IPath, LoadedDeclarations> sourcePaths2 = new HashMap<IPath, LoadedDeclarations>();
+
private boolean isStorageResolved = false;
SeamScope[] scopes = new SeamScope[ScopeType.values().length];
@@ -339,6 +334,7 @@
p.usedBy.remove(this);
dependsOn.remove(p);
IPath[] ps = sourcePaths.toArray(new IPath[0]);
+ //TODO use sourcePaths2
for (int i = 0; i < ps.length; i++) {
IPath pth = ps[i];
if(p.getSourcePath().isPrefixOf(pth)) {
@@ -385,19 +381,33 @@
long begin = System.currentTimeMillis();
- if(getClassPath().update()) {
+ boolean b = getClassPath().update();
+ if(b) {
+ getClassPath().validateProjectDependencies();
+ }
+ File file = getStorageFile();
+ Element root = null;
+ if(file != null && file.isFile()) {
+ root = XMLUtilities.getElement(file, null);
+ if(root != null) {
+ loadProjectDependencies(root);
+ loadSourcePaths2(root);
+// loadSourcePaths(root);
+ }
+ }
+
+ if(b) {
getClassPath().process();
}
- File file = getStorageFile();
- if(file == null || !file.isFile()) return;
- Element root = XMLUtilities.getElement(file, null);
+
if(root != null) {
- loadProjectDependencies(root);
- loadSourcePaths(root);
getValidationContext().load(root);
}
+
+ long e = System.currentTimeMillis();
- long e = System.currentTimeMillis();
+ //TODO replace with proper testing
+ System.out.println("Seam project " + project.getName() + " started in " + (e - begin));
}
/**
@@ -412,6 +422,7 @@
Element root = XMLUtilities.createDocumentElement("seam-project"); //$NON-NLS-1$
storeProjectDependencies(root);
storeSourcePaths(root);
+ storeSourcePaths2(root);
if(validationContext != null) validationContext.store(root);
@@ -450,6 +461,46 @@
}
}
+ private void storeSourcePaths2(Element root) {
+ Properties context = new Properties();
+ Element sourcePathsElement = XMLUtilities.createElement(root, "paths"); //$NON-NLS-1$
+ for (IPath path : sourcePaths2.keySet()) {
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f != null && f.exists() && f.getProject() != project) {
+ continue;
+ }
+ context.put(SeamXMLConstants.ATTR_PATH, path);
+ LoadedDeclarations ds = sourcePaths2.get(path);
+ Element pathElement = XMLUtilities.createElement(sourcePathsElement, "path"); //$NON-NLS-1$
+ pathElement.setAttribute("value", path.toString()); //$NON-NLS-1$
+ List<ISeamComponentDeclaration> cs = ds.getComponents();
+ if(cs != null && cs.size() > 0) {
+ Element cse = XMLUtilities.createElement(pathElement, "components"); //$NON-NLS-1$
+ for (ISeamComponentDeclaration d: cs) {
+ SeamObject o = (SeamObject)d;
+ o.toXML(cse, context);
+ }
+ }
+ List<ISeamFactory> fs = ds.getFactories();
+ if(fs != null && fs.size() > 0) {
+ Element cse = XMLUtilities.createElement(pathElement, "factories"); //$NON-NLS-1$
+ for (ISeamFactory d: fs) {
+ SeamObject o = (SeamObject)d;
+ o.toXML(cse, context);
+ }
+ }
+ List<String> imports = ds.getImports();
+ if(imports != null && imports.size() > 0) {
+ Element cse = XMLUtilities.createElement(pathElement, "imports"); //$NON-NLS-1$
+ for (String d: imports) {
+ Element e = XMLUtilities.createElement(cse, SeamXMLConstants.TAG_IMPORT); //$NON-NLS-1$
+ e.setAttribute(SeamXMLConstants.ATTR_VALUE, d);
+ }
+ }
+
+ }
+ }
+
/*
*
*/
@@ -487,6 +538,75 @@
}
}
+ private void loadSourcePaths2(Element root) {
+ Properties context = new Properties();
+ Element sourcePathsElement = XMLUtilities.getUniqueChild(root, "paths"); //$NON-NLS-1$
+ if(sourcePathsElement == null) return;
+ Element[] paths = XMLUtilities.getChildren(sourcePathsElement, "path"); //$NON-NLS-1$
+ if(paths != null) for (int i = 0; i < paths.length; i++) {
+ String p = paths[i].getAttribute("value"); //$NON-NLS-1$
+ if(p == null || p.trim().length() == 0) continue;
+ IPath path = new Path(p.trim());
+ if(sourcePaths2.containsKey(path)) continue;
+
+ if(!getClassPath().hasPath(path)) {
+ IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if(f == null || !f.exists() || !f.isSynchronized(IResource.DEPTH_ZERO)) continue;
+ }
+
+ context.put(SeamXMLConstants.ATTR_PATH, path);
+
+ LoadedDeclarations ds = new LoadedDeclarations();
+ Element components = XMLUtilities.getUniqueChild(paths[i], "components");
+ if(components != null) {
+ Element[] cs = XMLUtilities.getChildren(components, SeamXMLConstants.TAG_COMPONENT);
+ for (int j = 0; j < cs.length; j++) {
+ String cls = cs[j].getAttribute(SeamXMLConstants.ATTR_CLASS);
+ SeamComponentDeclaration d = null;
+ if(SeamXMLConstants.CLS_JAVA.equals(cls)) {
+ d = new SeamJavaComponentDeclaration();
+ } else if(SeamXMLConstants.CLS_XML.equals(cls)) {
+ d = new SeamXmlComponentDeclaration();
+ } else if(SeamXMLConstants.CLS_PROPERTIES.equals(cls)) {
+ d = new SeamPropertiesDeclaration();
+ }
+ if(d == null) continue;
+ d.loadXML(cs[j], context);
+ ds.getComponents().add(d);
+ }
+ }
+ Element factories = XMLUtilities.getUniqueChild(paths[i], "factories");
+ if(factories != null) {
+ Element[] cs = XMLUtilities.getChildren(factories, SeamXMLConstants.TAG_FACTORY);
+ for (int j = 0; j < cs.length; j++) {
+ String cls = cs[j].getAttribute(SeamXMLConstants.ATTR_CLASS);
+ AbstractContextVariable d = null;
+ if(SeamXMLConstants.CLS_XML.equals(cls)) {
+ d = new SeamXmlFactory();
+ } else if(SeamXMLConstants.CLS_JAVA.equals(cls)) {
+ d = new SeamAnnotatedFactory();
+ }
+ if(d == null) continue;
+ d.loadXML(cs[j], context);
+ ds.getFactories().add((ISeamFactory)d);
+ }
+ }
+ Element imports = XMLUtilities.getUniqueChild(paths[i], "imports");
+ if(imports != null) {
+ Element[] cs = XMLUtilities.getChildren(imports, SeamXMLConstants.TAG_IMPORT);
+ for (int j = 0; j < cs.length; j++) {
+ String v = cs[j].getAttribute(SeamXMLConstants.ATTR_VALUE);
+ if(v != null && v.length() > 0) {
+ ds.getImports().add(v);
+ }
+ }
+
+ }
+ getClassPath().pathLoaded(path);
+ registerComponents(ds, path);
+ }
+ }
+
/*
*
*/
@@ -575,6 +695,8 @@
return;
}
if(!sourcePaths.contains(source)) sourcePaths.add(source);
+
+ sourcePaths2.put(source, ds); //TODO
if(ds.getImports().size() > 0) {
setImports(source.toString(), ds.getImports());
@@ -658,6 +780,7 @@
cii.addDeclaration(loaded);
List<Change> changes = Change.addChange(null, new Change(ci, null, null, loaded));
fireChanges(changes);
+ affectedComponents.add(cii);
}
} else if(loaded instanceof ISeamXmlComponentDeclaration) {
ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)loaded;
@@ -749,7 +872,7 @@
if(newClassName == null || newClassName.length() == 0) return false;
return !oldClassName.equals(newClassName);
}
-
+
/*
*
*/
@@ -782,6 +905,7 @@
public void pathRemoved(IPath source) {
if(!sourcePaths.contains(source)) return;
sourcePaths.remove(source);
+ sourcePaths2.remove(source);
removeImports(source.toString());
Iterator<SeamComponent> iterator = allComponents.values().iterator();
while(iterator.hasNext()) {
@@ -1473,4 +1597,5 @@
c.setProjectPackage(p);
p.getComponents().add(c);
}
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -16,6 +16,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IWorkbench;
@@ -25,10 +26,12 @@
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.FindObjectHelper;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
public class SeamPropertiesDeclaration extends SeamComponentDeclaration
implements ISeamPropertiesDeclaration {
@@ -122,7 +125,7 @@
}
}
-
+
public SeamPropertiesDeclaration clone() throws CloneNotSupportedException {
SeamPropertiesDeclaration c = (SeamPropertiesDeclaration)super.clone();
c.properties = new HashMap<String, ISeamProperty>();
@@ -133,4 +136,38 @@
return c;
}
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_PROPERTIES;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ XModelObject old = pushModelObject(context);
+
+ for (String name: properties.keySet()) {
+ SeamProperty p = (SeamProperty)properties.get(name);
+ p.toXML(element, context);
+ }
+
+ popModelObject(context, old);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ XModelObject old = pushModelObject(context);
+
+ Element[] cs = XMLUtilities.getChildren(element, SeamXMLConstants.TAG_PROPERTY);
+ for (int i = 0; i < cs.length; i++) {
+ SeamProperty p = new SeamProperty();
+ p.loadXML(cs[i], context);
+ addProperty(p);
+ }
+
+ popModelObject(context, old);
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProperty.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,12 +11,16 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamProperty;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValue;
+import org.w3c.dom.Element;
public class SeamProperty extends AbstractSeamDeclaration implements ISeamProperty {
protected ISeamValue value;
@@ -57,17 +61,21 @@
if(value == null) {
if(d.value != null) {
setValue(d.value);
- changes = Change.addChange(changes, new Change(this, "value", null, value)); //$NON-NLS-1$
+ changes = Change.addChange(changes, new Change(this, SeamXMLConstants.ATTR_VALUE, null, value));
}
} else if(d.value == null) {
if(value != null) {
- changes = Change.addChange(changes, new Change(this, "value", value, null)); //$NON-NLS-1$
+ changes = Change.addChange(changes, new Change(this, SeamXMLConstants.ATTR_VALUE, value, null));
}
- value = null;
- } else {
+ value = null;
+ } else if(!value.getClass().getName().equals(d.value.getClass().getName())) {
+ Object old = value;
+ setValue(d.value);
+ changes = Change.addChange(changes, new Change(this, SeamXMLConstants.ATTR_VALUE, old, value));
+ } else {
List<Change> cs = ((SeamObject)value).merge((SeamObject)d.value);
if(cs != null && cs.size() > 0) {
- Change c = new Change(this, "value", value, value); //$NON-NLS-1$
+ Change c = new Change(this, SeamXMLConstants.ATTR_VALUE, value, value);
c.addChildren(cs);
changes = Change.addChange(changes, c);
}
@@ -86,4 +94,48 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_PROPERTY;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ XModelObject old = pushModelObject(context);
+
+ if(value instanceof SeamObject) {
+ SeamObject o = (SeamObject)value;
+ o.toXML(element, context);
+ }
+
+ popModelObject(context, old);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ XModelObject old = pushModelObject(context);
+
+ Element c = XMLUtilities.getUniqueChild(element, SeamXMLConstants.TAG_VALUE);
+ if(c != null) {
+ SeamObject v = null;
+ String cls = element.getAttribute(SeamXMLConstants.ATTR_CLASS);
+ if(SeamXMLConstants.CLS_MAP.equals(cls)) {
+ v = new SeamValueMap();
+ } else if(SeamXMLConstants.CLS_LIST.equals(cls)) {
+ v = new SeamValueList();
+ } else {
+ v = new SeamValueString();
+ }
+ if(v != null) {
+ v.loadXML(c, context);
+ setValue((ISeamValue)v);
+ }
+ }
+
+ popModelObject(context, old);
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueList.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,10 +12,13 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValueList;
import org.jboss.tools.seam.core.event.ISeamValueString;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -59,4 +62,33 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_VALUE;
+ }
+
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_LIST;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ for (ISeamValueString entry: values) {
+ SeamObject o = (SeamObject)entry;
+ o.toXML(element, context);
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+ Element[] cs = XMLUtilities.getChildren(element, SeamXMLConstants.TAG_VALUE);
+ for (int i = 0; i < cs.length; i++) {
+ SeamValueString entry = new SeamValueString();
+ entry.loadXML(cs[i], context);
+ addValue(entry);
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMap.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,10 +12,13 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValueMap;
import org.jboss.tools.seam.core.event.ISeamValueMapEntry;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -59,4 +62,33 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_VALUE;
+ }
+
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_MAP;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ for (ISeamValueMapEntry entry: entries) {
+ SeamObject o = (SeamObject)entry;
+ o.toXML(element, context);
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+ Element[] cs = XMLUtilities.getChildren(element, SeamValueMapEntry.TAG_ENTRY);
+ for (int i = 0; i < cs.length; i++) {
+ SeamValueMapEntry entry = new SeamValueMapEntry();
+ entry.loadXML(cs[i], context);
+ addEntry(entry);
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueMapEntry.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,10 +11,13 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValueMapEntry;
import org.jboss.tools.seam.core.event.ISeamValueString;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -72,4 +75,48 @@
return c;
}
+ public String getXMLName() {
+ return TAG_ENTRY;
+ }
+
+ public String getXMLClass() {
+ return null;
+ }
+
+ static String TAG_ENTRY = "entry";
+ static String TAG_KEY = "key";
+ static String TAG_VALUE = "value";
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+ if(key != null) {
+ Element e_key = XMLUtilities.createElement(element, TAG_KEY);
+ key.toXML(e_key, context);
+ }
+ if(value != null) {
+ value.toXML(element, context);
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+ Element c = XMLUtilities.getUniqueChild(element, SeamXMLConstants.TAG_VALUE);
+ if(c != null) {
+ value = new SeamValueString();
+ value.loadXML(c, context);
+ adopt(value);
+ }
+ c = XMLUtilities.getUniqueChild(element, TAG_KEY);
+ if(c != null) {
+ c = XMLUtilities.getUniqueChild(c, SeamXMLConstants.TAG_VALUE);
+ if(c != null) {
+ key = new SeamValueString();
+ key.toXML(c, context);
+ adopt(key);
+ }
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamValueString.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,10 +11,12 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.core.event.ISeamValueString;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -51,4 +53,27 @@
return c;
}
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_VALUE;
+ }
+
+ public String getXMLClass() {
+ return null;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ if(value != null) {
+ SeamXMLHelper.saveValueInfo(element, value, context);
+ }
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+ setValue(SeamXMLHelper.loadValueInfo(element, context));
+ }
+
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLConstants.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLConstants.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLConstants.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -0,0 +1,45 @@
+package org.jboss.tools.seam.internal.core;
+
+public interface SeamXMLConstants {
+
+ public String TAG_VALUE_INFO = "value-info";
+ public String TAG_ID = "id";
+ public String TAG_VALUE = "value";
+ public String TAG_PROPERTY = "property";
+ public String TAG_COMPONENT = "component";
+ public String TAG_ENTRY = "entry";
+ public String TAG_BIJECTED_ATTRIBUTE = "bijected-attribute";
+ public String TAG_METHOD = "method";
+ public String TAG_ROLE = "role";
+ public String TAG_FACTORY = "factory";
+ public String TAG_IMPORT = "import";
+
+ public String CLS_XML = "xml";
+ public String CLS_MODEL_OBJECT = "model-object";
+ public String CLS_STRING = "string";
+ public String CLS_TYPE = "type";
+ public String CLS_FIELD = "field";
+ public String CLS_METHOD = "method";
+
+ public String CLS_PROPERTIES = "properties";
+ public String CLS_JAVA = "java";
+
+ public String CLS_MAP = "map";
+ public String CLS_LIST = "list";
+
+ public String CLS_DATA_MODEL = "datamodel";
+
+ public String ATTR_CLASS = "class";
+ public String ATTR_NAME = "name";
+ public String ATTR_VALUE = "value";
+ public String ATTR_PARAMS = "params";
+
+ public String KEY_MODEL_OBJECT = "model-object";
+
+ public String ATTR_PROJECT = "project";
+ public String ATTR_TYPE = "type";
+
+ public String ATTR_PATH = "path";
+
+ public String ATTR_SCOPE = "scope";
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXMLHelper.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -0,0 +1,219 @@
+package org.jboss.tools.seam.internal.core;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
+import org.jboss.tools.seam.core.IValueInfo;
+import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
+import org.jboss.tools.seam.internal.core.scanner.xml.XMLValueInfo;
+import org.w3c.dom.Element;
+
+public class SeamXMLHelper implements SeamXMLConstants {
+
+ public static void saveValueInfo(Element parent, IValueInfo value, Properties context) {
+ value.toXML(parent, context);
+ }
+
+ public static IValueInfo loadValueInfo(Element parent, Properties context) {
+ Element c = XMLUtilities.getUniqueChild(parent, TAG_VALUE_INFO);
+ if(c == null) return null;
+ IValueInfo v = null;
+ if(CLS_XML.equals(c.getAttribute(ATTR_CLASS))) {
+ v = new XMLValueInfo();
+ } else {
+ v = new ValueInfo();
+ }
+ v.loadXML(c, context);
+ return v;
+ }
+
+ public static void saveModelObject(Element element, XModelObject object, Properties context) {
+ if(object == null) return;
+ String path = object.getPath();
+ XModelObject base = (XModelObject)context.get(SeamXMLConstants.KEY_MODEL_OBJECT);
+ if(base != null && base.getModel() == object.getModel()) {
+ String basePath = base.getPath();
+ if(path.startsWith("" + basePath + "/")) {
+ path = path.substring(basePath.length());
+ } else if(path.equals(basePath)) {
+ path = ".";
+ }
+ }
+
+ if(path != null) element.setAttribute(ATTR_PATH, path);
+ IProject p = EclipseResourceUtil.getProject(object);
+ if(p == null) return;
+ element.setAttribute(ATTR_PROJECT, p.getName());
+ }
+
+ public static void saveModelObject(Element parent, XModelObject object, String child, Properties context) {
+ Element element = XMLUtilities.createElement(parent, child);
+ element.setAttribute(ATTR_CLASS, CLS_MODEL_OBJECT);
+ saveModelObject(element, object, context);
+ }
+
+ public static XModelObject loadModelObject(Element element, Properties context) {
+ String path = element.getAttribute(ATTR_PATH);
+ XModelObject base = (XModelObject)context.get(SeamXMLConstants.KEY_MODEL_OBJECT);
+ if(path == null || path.length() == 0) {
+ //TODO reporting
+ return null;
+ } else if(path.equals(".")) {
+ if(base == null) {
+ //TODO reporting
+ }
+ return base;
+ }
+ if(path.startsWith("/")) {
+ if(base != null) {
+ if(base.getChildByPath(path.substring(1)) == null) {
+ //TODO reporting
+ }
+ return base.getChildByPath(path.substring(1));
+ }
+ //TODO reporting
+ return null;
+ }
+ IProject project = loadProject(element, context);
+ if(project == null || !project.isAccessible()) return null;
+ XModel model = InnerModelHelper.createXModel(project);
+ if(model == null) return null;
+ return model.getByPath(path);
+ }
+
+ public static XModelObject loadModelObject(Element parent, String child, Properties context) {
+ Element element = XMLUtilities.getUniqueChild(parent, child);
+ if(element == null) return null;
+ return loadModelObject(element, context);
+ }
+
+ public static void saveType(Element element, IType type, Properties context) {
+ if(type == null) return;
+ if(context != null && type == context.get(ATTR_TYPE)) return;
+ element.setAttribute(ATTR_PROJECT, type.getJavaProject().getProject().getName());
+ element.setAttribute(ATTR_TYPE, type.getFullyQualifiedName());
+ }
+
+ public static void saveType(Element parent, IType type, String child, Properties context) {
+ if(type == null) return;
+ if(context != null && type == context.get(ATTR_TYPE)) return;
+ Element element = XMLUtilities.createElement(parent, child);
+ element.setAttribute(ATTR_CLASS, CLS_TYPE);
+ saveType(element, type, context);
+ }
+
+ public static IProject loadProject(Element element, Properties context) {
+ String project = element.getAttribute(ATTR_PROJECT);
+ if(project == null || project.length() == 0) return null;
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(project);
+ }
+
+ public static IType loadType(Element element, Properties context) {
+ String name = element.getAttribute(ATTR_TYPE);
+ if(name == null || name.length() == 0) {
+ if(context != null && context.containsKey(ATTR_TYPE)) {
+ return (IType)context.get(ATTR_TYPE);
+ }
+ //TODO reporting
+ return null;
+ }
+ IProject project = loadProject(element, context);
+ if(project == null || !project.isAccessible()) return null;
+ IJavaProject jp = JavaCore.create(project);
+ if(jp != null) {
+ try {
+ return jp.findType(name);
+ } catch (JavaModelException e) {
+ //ignore
+ }
+ }
+ return null;
+ }
+
+ public static void saveField(Element element, IField field, Properties context) {
+ if(field == null) return;
+ saveType(element, field.getDeclaringType(), context);
+ element.setAttribute(ATTR_NAME, field.getElementName());
+ }
+
+ public static void saveField(Element parent, IField field, String child, Properties context) {
+ if(field == null) return;
+ Element element = XMLUtilities.createElement(parent, child);
+ element.setAttribute(ATTR_CLASS, CLS_FIELD);
+ saveField(element, field, context);
+ }
+
+ public static IField loadField(Element element, Properties context) {
+ IType type = loadType(element, context);
+ if(type == null) return null;
+ String name = element.getAttribute(ATTR_NAME);
+ if(name == null || name.length() == 0) return null;
+ return type.getField(name);
+ }
+
+ public static void saveMethod(Element element, IMethod method, Properties context) {
+ if(method == null) return;
+ saveType(element, method.getDeclaringType(), context);
+ element.setAttribute(ATTR_NAME, method.getElementName());
+ String[] s = method.getParameterTypes();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < s.length; i++) sb.append(s[i]).append(';');
+ element.setAttribute(ATTR_PARAMS, sb.toString());
+ }
+
+ public static void saveMethod(Element parent, IMethod method, String child, Properties context) {
+ if(method == null) return;
+ Element element = XMLUtilities.createElement(parent, child);
+ element.setAttribute(ATTR_CLASS, CLS_METHOD);
+ saveMethod(element, method, context);
+ }
+
+ public static IMethod loadMethod(Element element, Properties context) {
+ IType type = loadType(element, context);
+ if(type == null) return null;
+ String name = element.getAttribute(ATTR_NAME);
+ if(name == null || name.length() == 0) return null;
+ String params = element.getAttribute(ATTR_PARAMS);
+ String[] ps = new String[0];
+ if(params != null && params.length() > 0) {
+ ps = params.split(";");
+ }
+ return type.getMethod(name, ps);
+ }
+
+ public static void saveMap(Element parent, Map<String, IValueInfo> map, String child, Properties context) {
+ if(map == null || map.size() == 0) return;
+ Element element = XMLUtilities.createElement(parent, child);
+ for (String name: map.keySet()) {
+ IValueInfo value = map.get(name);
+ Element c = XMLUtilities.createElement(element, TAG_ENTRY);
+ c.setAttribute(ATTR_NAME, name);
+ value.toXML(c, context);
+ }
+ }
+
+ public static void loadMap(Element parent, Map<String, IValueInfo> map, String child, Properties context) {
+ Element element = XMLUtilities.getUniqueChild(parent, child);
+ if(element == null) return;
+ Element[] cs = XMLUtilities.getChildren(element, TAG_ENTRY);
+ for (int i = 0; i < cs.length; i++) {
+ String name = cs[i].getAttribute(ATTR_NAME);
+ IValueInfo value = loadValueInfo(cs[i], context);
+ if(name != null && value != null) {
+ map.put(name, value);
+ }
+ }
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,11 +12,15 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.event.Change;
+import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
+import org.w3c.dom.Element;
public class SeamXmlComponentDeclaration extends SeamPropertiesDeclaration
implements ISeamXmlComponentDeclaration {
@@ -166,4 +170,35 @@
return c;
}
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_XML;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ setAutoCreate(attributes.get(AUTO_CREATE));
+ setInstalled(attributes.get(INSTALLED));
+ setJndiName(attributes.get(JNDI_NAME));
+ setPrecedence(attributes.get(PRECEDENCE));
+ setScope(attributes.get(SCOPE));
+ setClassName(attributes.get(CLASS));
+
+ if(className == null && id instanceof XModelObject) {
+ XModelObject c = (XModelObject)id;
+ if(c.getModelEntity().getName().equals("FileSeamComponent12")) {
+ className = XMLScanner.getImpliedClassName(c, source);
+ } else {
+ className = XMLScanner.getDefaultClassName(c);
+ }
+ }
+
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlFactory.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -11,15 +11,20 @@
package org.jboss.tools.seam.internal.core;
import java.util.List;
+import java.util.Properties;
import org.jboss.tools.seam.core.ISeamXmlFactory;
import org.jboss.tools.seam.core.IValueInfo;
import org.jboss.tools.seam.core.event.Change;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
*/
public class SeamXmlFactory extends AbstractContextVariable implements ISeamXmlFactory {
+ static String METHOD = "method";
+ static String VALUE = "value";
+
String method = null;
String value = null;
@@ -36,7 +41,7 @@
}
public void setMethod(IValueInfo value) {
- attributes.put("method", value); //$NON-NLS-1$
+ attributes.put(METHOD, value); //$NON-NLS-1$
setMethod(value == null ? null : value.getValue());
}
@@ -45,7 +50,7 @@
}
public void setValue(IValueInfo value) {
- attributes.put("value", value); //$NON-NLS-1$
+ attributes.put(VALUE, value); //$NON-NLS-1$
setValue(value == null ? null : value.getValue());
}
@@ -54,11 +59,11 @@
SeamXmlFactory xf = (SeamXmlFactory)s;
if(!stringsEqual(value, xf.value)) {
- changes = Change.addChange(changes, new Change(this, "value", value, xf.value)); //$NON-NLS-1$
+ changes = Change.addChange(changes, new Change(this, VALUE, value, xf.value)); //$NON-NLS-1$
value = xf.value;
}
if(!stringsEqual(method, xf.method)) {
- changes = Change.addChange(changes, new Change(this, "method", method, xf.method)); //$NON-NLS-1$
+ changes = Change.addChange(changes, new Change(this, METHOD, method, xf.method)); //$NON-NLS-1$
method = xf.method;
}
@@ -69,5 +74,31 @@
SeamXmlFactory c = (SeamXmlFactory)super.clone();
return c;
}
+
+ public String getXMLName() {
+ return SeamXMLConstants.TAG_FACTORY;
+ }
+ public String getXMLClass() {
+ return SeamXMLConstants.CLS_XML;
+ }
+
+ public Element toXML(Element parent, Properties context) {
+ Element element = super.toXML(parent, context);
+
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ super.loadXML(element, context);
+
+ if(attributes.get(METHOD) != null) {
+ setMethod(attributes.get(METHOD));
+ }
+
+ if(attributes.get(VALUE) != null) {
+ setValue(attributes.get(VALUE));
+ }
+ }
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ValueInfo.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -12,6 +12,7 @@
package org.jboss.tools.seam.internal.core.scanner.java;
import java.util.List;
+import java.util.Properties;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.Expression;
@@ -20,7 +21,10 @@
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.StringLiteral;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.IValueInfo;
+import org.jboss.tools.seam.internal.core.SeamXMLConstants;
+import org.w3c.dom.Element;
public class ValueInfo implements IValueInfo {
String value;
@@ -98,4 +102,34 @@
this.value = value;
}
+ public Element toXML(Element parent, Properties context) {
+ Element element = XMLUtilities.createElement(parent, SeamXMLConstants.TAG_VALUE_INFO);
+ if(value != null) element.setAttribute(SeamXMLConstants.ATTR_VALUE, value);
+ if(valueStartPosition != 0) element.setAttribute(ATTR_START, "" + valueStartPosition);
+ if(valueLength != 0) element.setAttribute(ATTR_LENGTH, "" + valueLength);
+ return element;
+ }
+
+ static String ATTR_START = "start";
+ static String ATTR_LENGTH = "length";
+
+ public void loadXML(Element element, Properties context) {
+ value = element.getAttribute(SeamXMLConstants.ATTR_VALUE);
+ String start = element.getAttribute(ATTR_START);
+ if(start != null && start.length() > 0) {
+ try {
+ valueStartPosition = Integer.parseInt(start);
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+ String length = element.getAttribute(ATTR_LENGTH);
+ if(length != null && length.length() > 0) {
+ try {
+ valueLength = Integer.parseInt(length);
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/lib/ClassPath.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -16,9 +16,11 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
@@ -54,6 +56,7 @@
ClassLoader classLoader = null;
List<String> paths = null;
+ Map<IPath, String> paths2 = new HashMap<IPath, String>();
Set<String> processedPaths = new HashSet<String>();
@@ -105,7 +108,7 @@
if(paths == null && newPaths == null) return false;
if((newPaths == null || paths == null) || (paths.size() != newPaths.size())) {
paths = newPaths;
- } else {
+ } else {
boolean b = false;
for (int i = 0; i < paths.size() && !b; i++) {
if(!paths.get(i).equals(newPaths.get(i))) b = true;
@@ -113,6 +116,7 @@
if(!b) return false;
paths = newPaths;
}
+ createMap();
XModelObject object = model.getByPath("FileSystems"); //$NON-NLS-1$
XModelObject[] fs = object.getChildren("FileSystemJar"); //$NON-NLS-1$
Set<XModelObject> fss = new HashSet<XModelObject>();
@@ -151,6 +155,15 @@
return true;
}
+ private void createMap() {
+ paths2.clear();
+ if(paths != null) {
+ for (String p : paths) {
+ paths2.put(new Path(p), p);
+ }
+ }
+ }
+
/**
* Loads seam components from items recently added to class path.
*/
@@ -182,9 +195,15 @@
} catch (ScannerException e) {
SeamCorePlugin.getDefault().logError(e);
}
- if(c != null) componentsLoaded(c, new Path(p));
+ if(c != null) {
+ componentsLoaded(c, new Path(p));
+ }
}
+ validateProjectDependencies();
+ }
+
+ public void validateProjectDependencies() {
List<SeamProject> ps = null;
try {
@@ -205,7 +224,7 @@
project.removeSeamProject(p);
}
}
- }
+ }
void componentsLoaded(LoadedDeclarations c, IPath path) {
if(c == null || c.getComponents().size() + c.getFactories().size() == 0) return;
@@ -286,5 +305,16 @@
}
return list;
}
+
+ public void pathLoaded(IPath path) {
+ String p = paths2.get(path);
+ if(p != null) {
+ processedPaths.add(p);
+ }
+ }
+
+ public boolean hasPath(IPath path) {
+ return paths2.get(path) != null;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -267,7 +267,7 @@
return value != null && value.length() > 0;
}
- private String getImpliedClassName(XModelObject c, IPath path) {
+ public static String getImpliedClassName(XModelObject c, IPath path) {
if(path.toString().endsWith(".jar")) { //$NON-NLS-1$
String suffix = ".component"; //$NON-NLS-1$
String cn = c.getAttributeValue("name"); //$NON-NLS-1$
@@ -300,7 +300,7 @@
* @param c
* @return
*/
- private String getDefaultClassName(XModelObject c) {
+ public static String getDefaultClassName(XModelObject c) {
String s = c.getModelEntity().getXMLSubPath();
int d = s.indexOf(':');
if(d < 0) return null;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java 2008-02-18 11:07:36 UTC (rev 6374)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLValueInfo.java 2008-02-18 11:48:27 UTC (rev 6375)
@@ -10,9 +10,15 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.scanner.xml;
+import java.util.Properties;
+
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.PositionHolder;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.IValueInfo;
+import org.jboss.tools.seam.internal.core.SeamXMLConstants;
+import org.jboss.tools.seam.internal.core.SeamXMLHelper;
+import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
@@ -23,6 +29,9 @@
PositionHolder h = null;
+ public XMLValueInfo() {
+ }
+
public XMLValueInfo(XModelObject object, String attribute) {
this.object = object;
this.attribute = attribute;
@@ -51,4 +60,19 @@
return h;
}
+ public Element toXML(Element parent, Properties context) {
+ Element element = XMLUtilities.createElement(parent, SeamXMLConstants.TAG_VALUE_INFO);
+ element.setAttribute(SeamXMLConstants.ATTR_CLASS, SeamXMLConstants.CLS_XML);
+ if(attribute != null) element.setAttribute("attr", attribute);
+ if(object != null) {
+ SeamXMLHelper.saveModelObject(element, object, "object", context);
+ }
+ return element;
+ }
+
+ public void loadXML(Element element, Properties context) {
+ attribute = element.getAttribute("attr");
+ object = SeamXMLHelper.loadModelObject(element, "object", context);
+ }
+
}
16 years, 8 months
JBoss Tools SVN: r6374 - in trunk/esb/tests/org.jboss.tools.esb.core.test: META-INF and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-18 06:07:36 -0500 (Mon, 18 Feb 2008)
New Revision: 6374
Added:
trunk/esb/tests/org.jboss.tools.esb.core.test/.classpath
trunk/esb/tests/org.jboss.tools.esb.core.test/.cvsignore
trunk/esb/tests/org.jboss.tools.esb.core.test/.project
trunk/esb/tests/org.jboss.tools.esb.core.test/META-INF/
trunk/esb/tests/org.jboss.tools.esb.core.test/META-INF/MANIFEST.MF
trunk/esb/tests/org.jboss.tools.esb.core.test/about.html
trunk/esb/tests/org.jboss.tools.esb.core.test/ant.properties
trunk/esb/tests/org.jboss.tools.esb.core.test/build.properties
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/.project
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-fs.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-ftp.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-hibernate.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jbr.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jms.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-sql.xml
trunk/esb/tests/org.jboss.tools.esb.core.test/src/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBAllTests.java
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
Log:
JBIDE-1670
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/.classpath
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/.classpath (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/.classpath 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/.cvsignore
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/.cvsignore (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/.cvsignore 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1 @@
+bin
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/.project
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/.project (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/.project 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.esb.core.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/META-INF/MANIFEST.MF 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESB Core Tests Plug-in
+Bundle-SymbolicName: org.jboss.tools.esb.core.test;singleton:=true
+Bundle-Version: 2.0.0
+Bundle-ClassPath: esb-core-tests.jar
+Bundle-Vendor: Red Hat, Inc.
+Export-Package: org.jboss.tools.esb.core.test
+Require-Bundle:
+ org.junit,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.jboss.tools.common.model,
+ org.jboss.tools.esb.core,
+ org.jboss.tools.common.test,
+ org.eclipse.wst.common.project.facet.core,
+ org.jboss.tools.tests,
+ org.eclipse.ui.workbench,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.jface,
+ org.jboss.tools.jst.firstrun,
+ org.eclipse.wst.server.core,
+ org.eclipse.datatools.connectivity
+Provide-Package: org.jboss.tools.esb.core.test
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/about.html
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/about.html (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/about.html 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/ant.properties
===================================================================
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/build.properties
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/build.properties (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/build.properties 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,13 @@
+bin.includes = META-INF/,\
+ esb-core-tests.jar,\
+ projects/,\
+ about.html,\
+ ant.properties
+src.includes = META-INF/,\
+ ant.properties,\
+ build.properties,\
+ src/,\
+ projects/,\
+ about.html
+source.esb-core-tests.jar = src/
+jars.compile.order = esb-core-tests.jar
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/.project
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/.project (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/.project 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-fs.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-fs.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-fs.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,70 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5" >
+
+ <providers>
+ <fs-provider name="FSprovider1">
+ <fs-bus busid="helloFileChannel" >
+ <fs-message-filter
+ directory="@INPUTDIR@"
+ input-suffix=".dat"
+ work-suffix=".esbWorking"
+ post-delete="false"
+ post-directory="@OUTPUTDIR@"
+ post-suffix=".sentToEsb"
+ error-delete="false"
+ error-directory="@ERRORDIR@"
+ error-suffix=".IN_ERROR"
+ />
+ </fs-bus>
+ </fs-provider>
+
+ <jms-provider name="JBossMessaging"
+ connection-factory="ConnectionFactory"
+ >
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_file_esb"
+ selector="type='fromHelloworldFileAction'"
+ />
+ </jms-bus>
+
+ </jms-provider>
+
+ </providers>
+
+ <services>
+
+ <service
+ category="myCategory"
+ name="myFileListener"
+ description="Hello World File Action (esb listener)" >
+ <listeners>
+ <fs-listener name="FileGateway"
+ busidref="helloFileChannel"
+ maxThreads="1"
+ is-gateway="true"
+ poll-frequency-seconds="10"
+ />
+ <jms-listener name="helloWorldFileAction"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="testAction" class="org.jboss.soa.esb.actions.SystemPrintln" />
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldfileaction.MyAction"
+ process="displayMessage,playWithMessage"
+ />
+ <action name="dump" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="printfull" value="true"/>
+ </action>
+ <!-- The next action is for Continuous Integration testing -->
+ <action name="testStore" class="org.jboss.soa.esb.actions.StoreMessageToFile" />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-ftp.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-ftp.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-ftp.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,68 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5">
+
+ <providers>
+ <ftp-provider name="FTPprovider" hostname="@FTP_HOSTNAME@" >
+ <ftp-bus busid="helloFTPChannel" >
+ <ftp-message-filter
+ username="@FTP_USERNAME@"
+ password="@FTP_PASSWORD@"
+ read-only="true"
+ passive="false"
+ directory="@FTP_DIRECTORY@"
+ input-suffix=".dat"
+ work-suffix=".esbWorking"
+ post-delete="false"
+ post-suffix=".COMPLETE"
+ error-delete="false"
+ error-suffix=".HAS_ERROR"
+ />
+ </ftp-bus>
+ </ftp-provider>
+
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost" >
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_ftp_esb"
+ selector="source='fromHelloworldFTPAction'"
+ />
+ </jms-bus>
+
+ </jms-provider>
+
+ </providers>
+
+ <services>
+ <service
+ category="myCategory"
+ name="myFileListener"
+ description="Hello World File Action (esb listener)" >
+ <listeners>
+ <ftp-listener name="FtpGateway"
+ busidref="helloFTPChannel"
+ maxThreads="1"
+ is-gateway="true"
+ schedule-frequency="5">
+ <property name="remoteFileSystemStrategy-configFile" value="/ftpfile-cache-config.xml"/>
+ <property name="remoteFileSystemStrategy-cacheListener" value="org.jboss.soa.esb.listeners.gateway.remotestrategies.cache.DeleteOnEvictTreeCacheListener"/>
+ </ftp-listener>
+ <jms-listener name="helloWorldFileAction"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldftpaction.MyAction"
+ process="displayMessage,playWithMessage"
+ />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-hibernate.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-hibernate.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-hibernate.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,55 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5">
+
+ <providers>
+ <hibernate-provider name="Hibernateprovider"
+ hibernate-cfg-file="hibernate.cfg.xml">
+ <hibernate-bus busid="helloHibernateChannel" >
+ <hibernate-message-filter
+ classname="org.jboss.soa.esb.samples.quickstart.hibernateaction.Order"
+ event="onLoad,onDelete"/>
+ </hibernate-bus>
+ </hibernate-provider>
+
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost" >
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/A"
+ selector="source='fromHelloworldHibernateAction'"
+ />
+ </jms-bus>
+
+ </jms-provider>
+
+ </providers>
+
+ <services>
+ <service
+ category="myCategory"
+ name="myJmsListener"
+ description="Hello World Hibernate Action (esb hibernate listener)">
+ <listeners>
+ <hibernate-listener name="HibernateGateway"
+ busidref="helloHibernateChannel"
+ maxThreads="1"
+ is-gateway="true"/>
+ <jms-listener name="helloWorldJmsAction"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.hibernateaction.MyAction"
+ process="displayMessage"
+ />
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jbr.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jbr.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jbr.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,47 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..."
+ parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost">
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/quickstart_webservice_wss_esb"/>
+ </jms-bus>
+ </jms-provider>
+
+ <jbr-provider name="JBR-Http" protocol="http" host="localhost">
+ <jbr-bus busid="Http-1" port="9876" />
+ </jbr-provider>
+
+ </providers>
+
+ <services>
+
+ <service category="MyServiceCategory" name="MyWssService" description="WS Frontend speaks natively to the ESB">
+
+ <listeners>
+ <jbr-listener name="Http-Gateway" busidref="Http-1" is-gateway="true" maxThreads="1"/>
+
+ <jms-listener name="JMS-ESBListener" busidref="quickstartEsbChannel" maxThreads="1"/>
+ </listeners>
+ <actions>
+ <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message"
+ value="[Quickstart_webservice_wssecurity] Message before invoking jbossws endpoint"/>
+ </action>
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
+ <property name="jbossws-endpoint" value="HelloService"/>
+ </action>
+ <action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="message"
+ value="[Quickstart_webservice_wssecurity] Message after invoking jbossws endpoint"/>
+ </action>
+ </actions>
+ </service>
+
+ </services>
+
+</jbossesb>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jms.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jms.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-jms.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,114 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory"
+ jndi-URL="jnp://127.0.0.1:1099" jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
+
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_file_notifier_Request_gw"
+ />
+ </jms-bus>
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_file_notifier_Request_esb"
+ />
+ </jms-bus>
+
+ <jms-bus busid="quickstartFileChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_file_notifier_file_gw"
+ />
+ </jms-bus>
+
+ <jms-bus busid="quickstartConsoleChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_file_notifier_console_gw"
+ />
+ </jms-bus>
+
+
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service
+ category="FirstServiceESB"
+ name="SimpleListener"
+ description="Hello World">
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ maxThreads="1"
+ is-gateway="true"
+ />
+ <jms-listener name="helloWorld"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="routeAction" class="org.jboss.soa.esb.actions.StaticRouter">
+ <property name="destinations">
+ <route-to service-category="routerToDisplay" service-name="DisplayRouterListener" />
+ <route-to service-category="routerToFile" service-name="FileRouterListener" />
+ </property>
+ </action>
+ </actions>
+ </service>
+ <service
+ category="routerToDisplay"
+ name="DisplayRouterListener"
+ description="Static route display destination">
+ <listeners>
+ <jms-listener name="helloWorldconsole"
+ busidref="quickstartConsoleChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldfilenotifier.MyJMSListenerAction"
+ process="displayMessage"
+ />
+ </actions>
+ </service>
+ <service
+ category="routerToFile"
+ name="FileRouterListener"
+ description="Static route file destination">
+ <listeners>
+ <jms-listener name="helloWorldfile"
+ busidref="quickstartFileChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions>
+ <action name="notificationAction" class="org.jboss.soa.esb.actions.Notifier">
+ <property name="okMethod" value="notifyOK" />
+ <property name="notification-details">
+ <NotificationList type="ok">
+ <target class="NotifyConsole"/>
+ <target class="NotifyFiles">
+ <file append="false" URI="@results.dir(a)/results.log"/>
+ </target>
+ </NotificationList>
+ <NotificationList type="err">
+ <target class="NotifyConsole"/>
+ <target class="NotifyFiles">
+ <file append="false" URI="@results.dir(a)/results.log"/>
+ </target>
+ </NotificationList>
+ </property>
+ </action>
+ </actions>
+ </service>
+ </services>
+</jbossesb>
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-sql.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-sql.xml (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.0.1/jboss-esb-sql.xml 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,66 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5">
+
+ <providers>
+ <sql-provider name="SQLprovider"
+ url="jdbc:hsqldb:hsql://localhost:1703"
+ driver="org.hsqldb.jdbcDriver"
+ username="sa"
+ password="">
+ <sql-bus busid="helloSQLChannel" >
+ <sql-message-filter
+ tablename="GATEWAY_TABLE"
+ status-column="STATUS_COL"
+ order-by="DATA_COLUMN"
+ where-condition="DATA_COLUMN like 'data%'"
+
+ message-id-column="UNIQUE_ID"
+ />
+ </sql-bus>
+ </sql-provider>
+
+ <jms-provider name="JBossMQ"
+ connection-factory="ConnectionFactory"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-URL="localhost" >
+
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/A"
+ selector="source='fromHelloworldSQLAction'"
+ />
+ </jms-bus>
+
+ </jms-provider>
+
+ </providers>
+
+ <services>
+ <service
+ category="myCategory"
+ name="myJmsListener"
+ description="Hello World SQL Action (esb jdbc listener)">
+ <listeners>
+ <sql-listener name="SqlGateway"
+ busidref="helloSQLChannel"
+ maxThreads="1"
+ is-gateway="true"/>
+ <jms-listener name="helloWorldJmsAction"
+ busidref="quickstartEsbChannel"
+ maxThreads="1"
+ />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="action1"
+ class="org.jboss.soa.esb.samples.quickstart.helloworldsqlaction.MyAction"
+ process="displayMessage"
+ />
+ <action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln" />
+ </actions>
+
+ </service>
+ </services>
+
+</jbossesb>
+
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBAllTests.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBAllTests.java (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBAllTests.java 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class ESBAllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test ESB model");
+ suite.addTestSuite(ESBModelTest.class);
+ return suite;
+ }
+
+}
Added: trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2008-02-18 11:07:36 UTC (rev 6374)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.test;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.esb.core.model.ESBConstants;
+
+import junit.framework.TestCase;
+
+public class ESBModelTest extends TestCase {
+ TestProjectProvider provider = null;
+ IProject project = null;
+ boolean makeCopy = true;
+
+ public ESBModelTest() {}
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.esb.core.test", null, "Test", false);
+ project = provider.getProject();
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+/*
+ public void testPaths() {
+ IModelNature n = EclipseResourceUtil.getModelNature(project);
+ String testName = "ESBModelTest:testPaths";
+ ArrayList<TestDescription> tests = provider.getTestDescriptions(testName);
+ System.out.println(testName + " " + (tests == null ? -1 : tests.size()));
+ StringBuffer sb = new StringBuffer();
+ int errorCount = 0;
+ if(tests != null) for (int i = 0; i < tests.size(); i++) {
+ TestDescription t = tests.get(i);
+ String path = t.getProperty("path");
+ XModelObject o = n.getModel().getByPath(path);
+ if(o == null) {
+ sb.append(path).append("\n");
+ errorCount++;
+ }
+ }
+ assertTrue("Cannot find objects at " + errorCount + " paths\n" + sb.toString(), errorCount == 0);
+ }
+*/
+
+ public void testJMSExample() {
+ IFile f = project.getFile(new Path("esb-1.0.1/jboss-esb-jms.xml"));
+ assertTrue("Cannot find jboss-esb-jms.xml", f != null);
+ XModelObject object = EclipseResourceUtil.createObjectForResource(f);
+ assertTrue("Cannot create model for jboss-esb-jms.xml", object != null);
+ assertTrue("Wrong entity for jboss-esb-jms.xml", ESBConstants.ENT_ESB_FILE_101.equals(object.getModelEntity().getName()));
+
+ StringBuffer errorList = new StringBuffer();
+ checkAttributeValue(object,
+ "Providers/JBossMQ",
+ "connection factory",
+ "ConnectionFactory",
+ errorList);
+ checkAttributeValue(object,
+ "Providers/JBossMQ/quickstartGwChannel/Filter",
+ "dest name",
+ "queue/quickstart_helloworld_file_notifier_Request_gw",
+ errorList);
+ checkAttributeValue(object,
+ "Services/FileRouterListener/Actions/notificationAction/notification-details/NotificationList1",
+ "tag",
+ "NotificationList",
+ errorList);
+
+ assertTrue(errorList.toString(), errorList.length() == 0);
+ }
+
+ protected boolean checkAttributeValue(XModelObject object, String path, String attribute, String testValue, StringBuffer errorList) {
+ XModelObject child = object.getChildByPath(path);
+ if(child == null) {
+ errorList.append("Cannot find object at " + path).append("\n");
+ return false;
+ }
+ if(child.getModelEntity().getAttribute(attribute) == null) {
+ errorList.append("Attribute " + attribute + " is not found in object " + path).append("\n");
+ return false;
+ }
+ String realValue = child.getAttributeValue(attribute);
+ if(realValue == null || !realValue.equals(testValue)) {
+ errorList.append("Attribute " + attribute + " in object " + path + " has unexpected value '" + realValue + "'").append("\n");
+ return false;
+ }
+
+ return true;
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+
+}
16 years, 8 months
JBoss Tools SVN: r6373 - trunk/esb/tests.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-18 06:06:46 -0500 (Mon, 18 Feb 2008)
New Revision: 6373
Added:
trunk/esb/tests/org.jboss.tools.esb.core.test/
Log:
JBIDE-1670
16 years, 8 months