JBoss Tools SVN: r19426 - in trunk/esb/plugins/org.jboss.tools.esb.core: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-17 11:53:24 -0500 (Thu, 17 Dec 2009)
New Revision: 19426
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddJBRListerer12Handler.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta
Log:
https://jira.jboss.org/jira/browse/JBIDE-5488
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2009-12-17 15:58:30 UTC (rev 19425)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2009-12-17 16:53:24 UTC (rev 19426)
@@ -37,6 +37,8 @@
class="org.jboss.tools.esb.core.model.handlers.AddGenericActionSupport"/>
<xclass id="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"
class="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"/>
+ <xclass id="org.jboss.tools.esb.core.model.handlers.AddJBRListerer12Handler"
+ class="org.jboss.tools.esb.core.model.handlers.AddJBRListerer12Handler"/>
<xclass id="org.jboss.tools.esb.core.model.ESBResourceTree"
class="org.jboss.tools.esb.core.model.ESBResourceTree"/>
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2009-12-17 15:58:30 UTC (rev 19425)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2009-12-17 16:53:24 UTC (rev 19426)
@@ -1649,77 +1649,78 @@
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
+ <XActionItem kind="list" name="Separator"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="Scheduled Listener..." kind="action" name="AddScheduledListener">
- <EntityData EntityName="ESBScheduledListener101">
+ displayName="FTP Listener..." kind="action" name="AddFTPListener">
+ <EntityData EntityName="ESBFTPListener101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="event processor" Mandatory="no"/>
+ <AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="JCA Gateway..." kind="action" name="AddJCAGateway">
- <EntityData EntityName="ESBJCAGateway101">
+ displayName="FS Listener..." kind="action" name="AddFSListener">
+ <EntityData EntityName="ESBFSListener101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="adapter"/>
- <AttributeData AttributeName="endpoint class"/>
+ <AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="JMS Listener..." kind="action" name="AddJMSListener">
- <EntityData EntityName="ESBJMSListener101">
+ displayName="Groovy Listener..." kind="action" name="AddGroovyListener">
+ <EntityData EntityName="ESBGroovyListener101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="channel id ref" Mandatory="no"/>
+ <AttributeData AttributeName="script"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="FS Listener..." kind="action" name="AddFSListener">
- <EntityData EntityName="ESBFSListener101">
+ displayName="Hibernate Listener..." kind="action" name="AddHibernateListener">
+ <EntityData EntityName="ESBHibernateListener101">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="FTP Listener..." kind="action" name="AddFTPListener">
- <EntityData EntityName="ESBFTPListener101">
+ displayName="JBR Listener..." kind="action" name="AddJBRListener">
+ <EntityData EntityName="ESBJBRListener101">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="SQL Listener..." kind="action" name="AddSQLListener">
- <EntityData EntityName="ESBSQLListener101">
+ displayName="JCA Gateway..." kind="action" name="AddJCAGateway">
+ <EntityData EntityName="ESBJCAGateway101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="channel id ref" Mandatory="no"/>
+ <AttributeData AttributeName="adapter"/>
+ <AttributeData AttributeName="endpoint class"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="Hibernate Listener..." kind="action" name="AddHibernateListener">
- <EntityData EntityName="ESBHibernateListener101">
+ displayName="JMS Listener..." kind="action" name="AddJMSListener">
+ <EntityData EntityName="ESBJMSListener101">
<AttributeData AttributeName="name"/>
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="JBR Listener..." kind="action" name="AddJBRListener">
- <EntityData EntityName="ESBJBRListener101">
+ displayName="Scheduled Listener..." kind="action" name="AddScheduledListener">
+ <EntityData EntityName="ESBScheduledListener101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="channel id ref" Mandatory="no"/>
+ <AttributeData AttributeName="event processor" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="Groovy Listener..." kind="action" name="AddGroovyListener">
- <EntityData EntityName="ESBGroovyListener101">
+ displayName="SQL Listener..." kind="action" name="AddSQLListener">
+ <EntityData EntityName="ESBSQLListener101">
<AttributeData AttributeName="name"/>
- <AttributeData AttributeName="script"/>
+ <AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
<XActionItem HIDE="always"
@@ -1779,22 +1780,13 @@
<XActionItem ICON="action.empty" displayName="New" group="1"
kind="list" name="CreateActions">
<XActionItemReference entity="ESBListeners101" name="AddListener" path="CreateActions/AddListener"/>
- <XActionItemReference entity="ESBListeners101"
- name="AddScheduledListener" path="CreateActions/AddScheduledListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddJCAGateway" path="CreateActions/AddJCAGateway"/>
- <XActionItemReference entity="ESBListeners101" name="AddJMSListener" path="CreateActions/AddJMSListener"/>
+ <XActionItem kind="list" name="Separator"/>
<XActionItemReference entity="ESBListeners101" name="AddFSListener" path="CreateActions/AddFSListener"/>
<XActionItemReference entity="ESBListeners101" name="AddFTPListener" path="CreateActions/AddFTPListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddSQLListener" path="CreateActions/AddSQLListener"/>
<XActionItemReference entity="ESBListeners101"
+ name="AddGroovyListener" path="CreateActions/AddGroovyListener"/>
+ <XActionItemReference entity="ESBListeners101"
name="AddHibernateListener" path="CreateActions/AddHibernateListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddJBRListener" path="CreateActions/AddJBRListener"/>
- <XActionItemReference entity="ESBListeners101"
- name="AddGroovyListener" path="CreateActions/AddGroovyListener"/>
- <XActionItem HIDE="always"
- HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.ShowMenuHandler"
- PROPERTIES="actionList=CreateActions" displayName="Listener..."
- kind="action" name="AddAnyListener"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="HTTP Listener..." kind="action" name="AddHTTPListener">
@@ -1803,6 +1795,12 @@
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
+ <XActionItemReference entity="ESBListeners101" name="AddJBRListener" path="CreateActions/AddJBRListener"/>
+ <XActionItemReference entity="ESBListeners101" name="AddJCAGateway" path="CreateActions/AddJCAGateway"/>
+ <XActionItemReference entity="ESBListeners101" name="AddJMSListener" path="CreateActions/AddJMSListener"/>
+ <XActionItemReference entity="ESBListeners101"
+ name="AddScheduledListener" path="CreateActions/AddScheduledListener"/>
+ <XActionItemReference entity="ESBListeners101" name="AddSQLListener" path="CreateActions/AddSQLListener"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="UDP Listener..." kind="action" name="AddUDPListener">
@@ -1812,6 +1810,10 @@
<AttributeData AttributeName="port"/>
</EntityData>
</XActionItem>
+ <XActionItem HIDE="always"
+ HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.ShowMenuHandler"
+ PROPERTIES="actionList=CreateActions" displayName="Listener..."
+ kind="action" name="AddAnyListener"/>
</XActionItem>
<XActionItemReference entity="ESBListeners101" name="CopyActions"/>
<XActionItemReference entity="ESBListeners101" name="DeleteActions"/>
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta 2009-12-17 15:58:30 UTC (rev 19425)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb12.meta 2009-12-17 16:53:24 UTC (rev 19426)
@@ -590,10 +590,31 @@
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
+ <XActionItem kind="list" name="Separator"/>
+ <XActionItemReference entity="ESBListeners101" name="AddFSListener" path="CreateActions/AddFSListener"/>
+ <XActionItemReference entity="ESBListeners101" name="AddFTPListener" path="CreateActions/AddFTPListener"/>
<XActionItemReference entity="ESBListeners101"
- name="AddScheduledListener" path="CreateActions/AddScheduledListener"/>
+ name="AddGroovyListener" path="CreateActions/AddGroovyListener"/>
+ <XActionItemReference entity="ESBListeners101"
+ name="AddHibernateListener" path="CreateActions/AddHibernateListener"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="HTTP Gateway..." kind="action" name="AddHTTPGateway">
+ <EntityData EntityName="ESBHTTPGateway120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="channel id ref" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="org.jboss.tools.esb.core.model.handlers.AddJBRListerer12Handler" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="JBR Listener..." kind="action" name="AddJBRListener">
+ <EntityData EntityName="ESBJBRListener101">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="channel id ref" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="JCA Gateway..." kind="action" name="AddJCAGateway">
<EntityData EntityName="ESBJCAGateway120">
<AttributeData AttributeName="name"/>
@@ -602,8 +623,8 @@
</EntityData>
</XActionItem>
<XActionItemReference entity="ESBListeners101" name="AddJMSListener" path="CreateActions/AddJMSListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddFSListener" path="CreateActions/AddFSListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddFTPListener" path="CreateActions/AddFTPListener"/>
+ <XActionItemReference entity="ESBListeners101"
+ name="AddScheduledListener" path="CreateActions/AddScheduledListener"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="SQL Listener..." kind="action" name="AddSQLListener">
@@ -612,19 +633,6 @@
<AttributeData AttributeName="channel id ref" Mandatory="no"/>
</EntityData>
</XActionItem>
- <XActionItemReference entity="ESBListeners101"
- name="AddHibernateListener" path="CreateActions/AddHibernateListener"/>
- <XActionItemReference entity="ESBListeners101" name="AddJBRListener" path="CreateActions/AddJBRListener"/>
- <XActionItemReference entity="ESBListeners101"
- name="AddGroovyListener" path="CreateActions/AddGroovyListener"/>
- <XActionItem HandlerClassName="%Create%" ICON="action.empty"
- PROPERTIES="validator.add=true" WizardClassName="%Default%"
- displayName="HTTP Gateway..." kind="action" name="AddHTTPGateway">
- <EntityData EntityName="ESBHTTPGateway120">
- <AttributeData AttributeName="name"/>
- <AttributeData AttributeName="channel id ref" Mandatory="no"/>
- </EntityData>
- </XActionItem>
<XActionItemReference entity="ESBListeners110" name="AddUDPListener" path="CreateActions/AddUDPListener"/>
<XActionItem HIDE="always"
HandlerClassName="org.jboss.tools.common.meta.action.impl.handlers.ShowMenuHandler"
Added: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddJBRListerer12Handler.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddJBRListerer12Handler.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddJBRListerer12Handler.java 2009-12-17 16:53:24 UTC (rev 19426)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.model.handlers;
+
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class AddJBRListerer12Handler extends DefaultCreateHandler {
+
+ public AddJBRListerer12Handler() {}
+
+ protected XModelObject modifyCreatedObject(XModelObject o) {
+ o.setAttributeValue("is gateway", "true");
+ return o;
+ }
+
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddJBRListerer12Handler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
JBoss Tools SVN: r19425 - in trunk/smooks: tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-17 10:58:30 -0500 (Thu, 17 Dec 2009)
New Revision: 19425
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5515
XSDModelBuilder not getting XSD reference type names from the right place
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2009-12-17 15:52:05 UTC (rev 19424)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2009-12-17 15:58:30 UTC (rev 19425)
@@ -186,7 +186,6 @@
}
private void expand(XSDElementDeclaration elementDeclaration, int minOccurs, int maxOccurs, Node parent, Document document) {
- String elementName = elementDeclaration.getName();
XSDTypeDefinition typeDef;
if(elementDeclaration.isElementDeclarationReference()) {
@@ -196,8 +195,9 @@
typeDef = elementDeclaration.getTypeDefinition();
}
+ String elementName = elementDeclaration.getName();
if(elementDeclaration.isAbstract()) {
- if(typeDef == null) {
+ if(typeDef != null) {
addTypeImpls(typeDef, minOccurs, maxOccurs, parent, document);
}
return;
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 15:52:05 UTC (rev 19424)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 15:58:30 UTC (rev 19425)
@@ -21,6 +21,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -148,7 +149,11 @@
builder.setRootElementName("smooks-resource-list");
XMLFreeMarkerTemplateBuilder templateBuilder = new XMLFreeMarkerTemplateBuilder(builder);
Document document = templateBuilder.getModel();
- checkNodeName(document.getDocumentElement());
+
+ StringWriter writer = new StringWriter();
+ XmlUtil.serialize(document, true, writer);
+ System.out.println(writer);
+ //checkNodeName(document.getDocumentElement());
}
private void checkNodeName(Node node) {
16 years, 4 months
JBoss Tools SVN: r19424 - trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-17 10:52:05 -0500 (Thu, 17 Dec 2009)
New Revision: 19424
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Added opportunity to recognize entity by file name even if xml doctype/schema is missing.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java 2009-12-17 15:50:22 UTC (rev 19423)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.xml/src/org/jboss/tools/cdi/xml/beans/model/CDIBeansEntityRecognizer.java 2009-12-17 15:52:05 UTC (rev 19424)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.cdi.xml.beans.model;
-import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerExtension;
-public class CDIBeansEntityRecognizer implements EntityRecognizer, CDIBeansConstants {
+public class CDIBeansEntityRecognizer implements EntityRecognizerExtension, CDIBeansConstants {
public CDIBeansEntityRecognizer() {}
@@ -23,7 +23,19 @@
}
return null;
}
-
+
+ public String getEntityName(String fileName, String ext, String body) {
+ if(body == null) return null;
+ String result = getEntityName(ext, body);
+ if(result != null) {
+ return result;
+ }
+ if("beans.xml".equals(fileName) && body.indexOf("<beans") >= 0) {
+ return ENT_CDI_BEANS;
+ }
+ return null;
+ }
+
private boolean isComponentsSchema(String body) {
int i = body.indexOf("<beans"); //$NON-NLS-1$
if(i < 0) return false;
@@ -32,5 +44,5 @@
String s = body.substring(i, j);
return s.indexOf("\"" + BEANS_NAMESPACE + "\"") > 0; //$NON-NLS-1$
}
-
+
}
16 years, 4 months
JBoss Tools SVN: r19423 - in trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model: filesystems/impl and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-17 10:50:22 -0500 (Thu, 17 Dec 2009)
New Revision: 19423
Added:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/EntityRecognizerExtension.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModel.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarFolderImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Added opportunity to recognize entity by file name even if xml doctype/schema is missing.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModel.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/XModel.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -16,6 +16,7 @@
import org.jboss.tools.common.model.event.*;
import org.jboss.tools.common.model.undo.XUndoManager;
import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerExtension;
import org.jboss.tools.common.model.filesystems.impl.FileSystemPeer;
/**
@@ -179,7 +180,7 @@
* Returns a singleton used to resolve entity of a file object.
* @return
*/
- public EntityRecognizer getEntityRecognizer();
+ public EntityRecognizerExtension getEntityRecognizer();
/**
* Returns registry keeping time stamps of loaded file objects.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -163,7 +163,7 @@
if(body == null) return;
if(!isForceLoadOn() && body.equals(getAsText())) return;
- String entity = getModel().getEntityRecognizer().getEntityName(getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION), body);
+ String entity = getModel().getEntityRecognizer().getEntityName(toFileName(this), getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION), body);
if(entity == null || !entity.equals(getModelEntity().getName())) {
String[] errors = (body.length() == 0) ? null : XMLUtil.getXMLErrors(new java.io.StringReader(body), false);
if(errors == null || errors.length == 0) errors = new String[]{"Doctype has been changed. Please save file for the change to take effect in object model. :0:0"};
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FolderImpl.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -205,14 +205,14 @@
parseFileName(p, f.getName());
String ext = p.getProperty(XModelObjectConstants.ATTR_NAME_EXTENSION);
String body = null;
- String entity = getModel().getEntityRecognizer().getEntityName(ext, body);
+ String entity = getModel().getEntityRecognizer().getEntityName(f.getName(), ext, body);
if("FileAny".equals(entity)) { //$NON-NLS-1$
boolean isText = XModelObjectLoaderUtil.isTextFile(f, 100);
if(f.length() > 100000 || !isText) entity = XModelObjectConstants.ENT_FILE_ANY_LONG;
else if(isText) entity = "FileTXT"; //$NON-NLS-1$
} else /*if(entity == null)*/ {
body = getBodySource(f).get();
- entity = getModel().getEntityRecognizer().getEntityName(ext, body);
+ entity = getModel().getEntityRecognizer().getEntityName(f.getName(), ext, body);
}
if(entity == null || getModel().getMetaData().getEntity(entity) == null) entity = "FileAny"; //$NON-NLS-1$
p.setProperty(XMetaDataConstants.ENTITY, entity);
@@ -707,6 +707,9 @@
}
private static int question(XModelObject o) {
+ if(Display.getCurrent() == null) {
+ //TODO we cannot display dialog. What should we do?
+ }
return o.getModel().getService().showDialog("Update",
MessageFormat
.format(
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarFolderImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarFolderImpl.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarFolderImpl.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -84,13 +84,13 @@
FolderImpl.parseFileName(p, name);
String ext = p.getProperty(XModelObjectConstants.ATTR_NAME_EXTENSION);
String body = null;
- String entity = getModel().getEntityRecognizer().getEntityName(ext, body);
+ String entity = getModel().getEntityRecognizer().getEntityName(name, ext, body);
if("FileAny".equals(entity)) { //$NON-NLS-1$
if(jar.getSize(cpath) > 100000) entity = XModelObjectConstants.ENT_FILE_ANY_LONG;
else if(jar.isTextEntry(cpath, 100)) entity = "FileTXT"; //$NON-NLS-1$
} else /*if(entity == null)*/ {
body = jar.getContent(cpath);
- entity = getModel().getEntityRecognizer().getEntityName(ext, body);
+ entity = getModel().getEntityRecognizer().getEntityName(name, ext, body);
}
if(entity == null || getModel().getMetaData().getEntity(entity) == null) entity = "FileAny"; //$NON-NLS-1$
XModelObject c = getModel().createModelObject(entity, p);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -48,6 +48,7 @@
import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
import org.jboss.tools.common.model.filesystems.impl.FileSystemPeer;
import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.EntityRecognizerExtension;
import org.jboss.tools.common.model.loaders.XObjectLoader;
import org.jboss.tools.common.model.loaders.impl.ModelEntityRecognizer;
import org.jboss.tools.common.model.plugin.ModelMessages;
@@ -120,7 +121,7 @@
return buffer;
}
- public EntityRecognizer getEntityRecognizer() {
+ public EntityRecognizerExtension getEntityRecognizer() {
return recognizer;
}
Added: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/EntityRecognizerExtension.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/EntityRecognizerExtension.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/EntityRecognizerExtension.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.model.loaders;
+
+/**
+ *
+ * Interface is used for cases when file name is sufficient to define entity of file model object.
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface EntityRecognizerExtension extends EntityRecognizer {
+
+ public String getEntityName(String fileName, String ext, String body);
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/EntityRecognizerExtension.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -16,7 +16,7 @@
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
-public class ModelEntityRecognizer implements EntityRecognizer {
+public class ModelEntityRecognizer implements EntityRecognizerExtension {
private XModelMetaData meta = null;
private HashMap<String,EntityRecognizer[]> recognizers = new HashMap<String,EntityRecognizer[]>();
@@ -30,6 +30,22 @@
load();
}
+ public String getEntityName(String fileName, String ext, String body) {
+ if(ext != null) ext = ext.toLowerCase();
+ EntityRecognizer[] list = recognizers.get(ext);
+ if(list == null || list.length == 0) return "FileAny"; //$NON-NLS-1$
+ for (EntityRecognizer r: list) {
+ String n = null;
+ if(r instanceof EntityRecognizerExtension) {
+ n = ((EntityRecognizerExtension)r).getEntityName(fileName, ext, body);
+ } else {
+ n = r.getEntityName(ext, body);
+ }
+ if(n != null) return n;
+ }
+ return null;
+ }
+
public String getEntityName(String ext, String body) {
if(ext != null) ext = ext.toLowerCase();
EntityRecognizer[] list = recognizers.get(ext);
@@ -142,21 +158,34 @@
}
}
- private class EntityRecognizerWrapper implements EntityRecognizer {
+ private class EntityRecognizerWrapper implements EntityRecognizerExtension {
String clsname;
EntityRecognizer resolved;
public EntityRecognizerWrapper(String clsname) {
this.clsname = clsname;
}
-
- public String getEntityName(String ext, String body) {
+
+ boolean checkResolved() {
if(resolved == null && clsname != null) {
resolved = find(clsname);
clsname = null;
}
- return (resolved != null) ? resolved.getEntityName(ext, body) : null;
+ return resolved != null;
+ }
+
+ public String getEntityName(String ext, String body) {
+ return checkResolved() ? resolved.getEntityName(ext, body) : null;
}
+
+ public String getEntityName(String fileName, String ext, String body) {
+ if(!checkResolved()) return null;
+ if(resolved instanceof EntityRecognizerExtension) {
+ return ((EntityRecognizerExtension)resolved).getEntityName(fileName, ext, body);
+ } else {
+ return resolved.getEntityName(ext, body);
+ }
+ }
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2009-12-17 14:40:21 UTC (rev 19422)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2009-12-17 15:50:22 UTC (rev 19423)
@@ -79,6 +79,13 @@
public static String resolveType(IType type, String typeName) {
if(type == null) return null;
if(type.isBinary() || typeName == null) return typeName;
+ int i = typeName.indexOf("<");
+ if(i >= 0) {
+ int j = typeName.lastIndexOf(">");
+ if(j >= i) {
+// typeName = typeName.substring(0, i);
+ }
+ }
String n = getKey(type);
Resolved r = resolved.get(n);
@@ -123,6 +130,8 @@
return typeName;
} catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
+ } catch (IllegalArgumentException ee) {
+ System.out.println("Illegal " + typeName);
}
return null;
}
16 years, 4 months
JBoss Tools SVN: r19422 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/proposal.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-12-17 09:40:21 -0500 (Thu, 17 Dec 2009)
New Revision: 19422
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/proposal/FacetNameProposalType.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3875
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/proposal/FacetNameProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/proposal/FacetNameProposalType.java 2009-12-17 14:00:53 UTC (rev 19421)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/proposal/FacetNameProposalType.java 2009-12-17 14:40:21 UTC (rev 19422)
@@ -66,10 +66,12 @@
if(lib instanceof IFacesConfigTagLibrary) {
for (String type : types) {
IComponent comp = lib.getComponentByType(type);
- Facet[] facets = comp.getFacets();
- if(facets!=null) {
- for (int i = 0; i < facets.length; i++) {
- facetNames.add(facets[i].getName());
+ if(comp!=null) {
+ Facet[] facets = comp.getFacets();
+ if(facets!=null) {
+ for (int i = 0; i < facets.length; i++) {
+ facetNames.add(facets[i].getName());
+ }
}
}
}
@@ -87,6 +89,7 @@
if(ICON==null) {
ICON = ImageDescriptor.createFromFile(WebKbPlugin.class, IMAGE_NAME).createImage();
}
+ proposal.setImage(ICON);
proposals.add(proposal);
}
}
16 years, 4 months
JBoss Tools SVN: r19421 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-12-17 09:00:53 -0500 (Thu, 17 Dec 2009)
New Revision: 19421
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java 2009-12-17 14:00:53 UTC (rev 19421)
@@ -18,9 +18,9 @@
public interface IQualifierDeclaration extends IAnnotationDeclaration {
/**
- * Returns the corresponding stereotype.
+ * Returns the corresponding qualifier.
*
- * @return the corresponding stereotype.
+ * @return the corresponding qualifier.
*/
IQualifier getQualifier();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java 2009-12-17 14:00:53 UTC (rev 19421)
@@ -18,9 +18,9 @@
public interface IScopeDeclaration extends IAnnotationDeclaration {
/**
- * Returns the corresponding stereotype.
+ * Returns the corresponding scope.
*
- * @return the corresponding stereotype.
+ * @return the corresponding scope.
*/
IScope getScope();
}
\ No newline at end of file
16 years, 4 months
JBoss Tools SVN: r19420 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-17 08:47:34 -0500 (Thu, 17 Dec 2009)
New Revision: 19420
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -16,6 +16,8 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingElement;
+import org.jboss.tools.cdi.internal.core.impl.QualifierElement;
+import org.jboss.tools.cdi.internal.core.impl.ScopeElement;
import org.jboss.tools.common.text.INodeReference;
/**
@@ -125,6 +127,23 @@
public InterceptorBindingElement getInterceptorBinding(String qualifiedName);
/**
+ * Returns qualifier model element for fully qualified name
+ * of qualifier annotation type
+ * @param qualifiedName
+ * @return Returns qualifier model element for fully qualified name
+ * of qualifier annotation type
+ */
+ public QualifierElement getQualifier(String qualifiedName);
+
+ /**
+ * Returns scope model element for fully qualified name
+ * of scope annotation type
+ * @param qualifiedName
+ * @return Returns scope model element for fully qualified name
+ * of scope annotation type
+ */
+ public ScopeElement getScope(String qualifiedName);
+ /**
* Returns the set of observers for an event which is injected by given
* injection point.
*
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,17 @@
+package org.jboss.tools.cdi.core;
+
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Common interface for qualifier, stereotype, intercepror binding and scope objects.
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface ICDIAnnotation extends ICDIElement {
+
+ public IType getSourceType();
+
+ public IAnnotationDeclaration getInheritedDeclaration();
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinding.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -19,7 +19,7 @@
*
* @author Alexey Kazakov
*/
-public interface IInterceptorBinding extends ICDIElement {
+public interface IInterceptorBinding extends ICDIAnnotation {
/**
* Returns the corresponding IType of the interceptor binding.
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core;
+
+/**
+ * Represents an interceptor binding type.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IQualifier extends ICDIAnnotation {
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifier.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core;
+
+/**
+ * Represents a qualifier declaration.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IQualifierDeclaration extends IAnnotationDeclaration {
+
+ /**
+ * Returns the corresponding stereotype.
+ *
+ * @return the corresponding stereotype.
+ */
+ IQualifier getQualifier();
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IQualifierDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core;
+
+/**
+ * Represents an interceptor binding type.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IScope extends ICDIAnnotation {
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScope.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core;
+
+/**
+ * Represents a qualifier declaration.
+ *
+ * @author Viacheslav Kabanovich
+ */
+public interface IScopeDeclaration extends IAnnotationDeclaration {
+
+ /**
+ * Returns the corresponding stereotype.
+ *
+ * @return the corresponding stereotype.
+ */
+ IScope getScope();
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScopeDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.ICDIAnnotation;
+import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class CDIAnnotationElement extends CDIElement implements ICDIAnnotation {
+ protected AnnotationDefinition definition;
+
+ public CDIAnnotationElement() {}
+
+ public void setDefinition(AnnotationDefinition definition) {
+ this.definition = definition;
+ }
+
+ public IType getSourceType() {
+ return definition.getType();
+ }
+
+ public IAnnotationDeclaration getInheritedDeclaration() {
+ return definition.getInheritedAnnotation();
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -50,6 +50,8 @@
private Map<String, StereotypeElement> stereotypes = new HashMap<String, StereotypeElement>();
private Map<String, InterceptorBindingElement> interceptorBindings = new HashMap<String, InterceptorBindingElement>();
+ private Map<String, QualifierElement> qualifiers = new HashMap<String, QualifierElement>();
+ private Map<String, ScopeElement> scopes = new HashMap<String, ScopeElement>();
private Map<IPath, Set<IBean>> beansByPath = new HashMap<IPath, Set<IBean>>();
private Map<String, Set<IBean>> beansByName = new HashMap<String, Set<IBean>>();
@@ -340,6 +342,14 @@
return interceptorBindings.get(qualifiedName);
}
+ public QualifierElement getQualifier(String qualifiedName) {
+ return qualifiers.get(qualifiedName);
+ }
+
+ public ScopeElement getScope(String qualifiedName) {
+ return scopes.get(qualifiedName);
+ }
+
public void update() {
rebuildAnnotationTypes();
rebuildBeans();
@@ -349,30 +359,39 @@
void rebuildAnnotationTypes() {
stereotypes.clear();
interceptorBindings.clear();
+ qualifiers.clear();
+ scopes.clear();
List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
for (AnnotationDefinition d: ds) {
if(d.getKind() == AnnotationDefinition.STEREOTYPE) {
StereotypeElement s = new StereotypeElement();
- s.setDefinition(d);
- s.setParent(this);
- IPath r = d.getType().getPath();
- if(r != null) {
- s.setSourcePath(r);
- }
+ initAnnotationElement(s, d);
stereotypes.put(d.getQualifiedName(), s);
} else if(d.getKind() == AnnotationDefinition.INTERCEPTOR_BINDING) {
InterceptorBindingElement s = new InterceptorBindingElement();
- s.setDefinition(d);
- s.setParent(this);
- IPath r = d.getType().getPath();
- if(r != null) {
- s.setSourcePath(r);
- }
+ initAnnotationElement(s, d);
interceptorBindings.put(d.getQualifiedName(), s);
+ } else if(d.getKind() == AnnotationDefinition.QUALIFIER) {
+ QualifierElement s = new QualifierElement();
+ initAnnotationElement(s, d);
+ qualifiers.put(d.getQualifiedName(), s);
+ } else if(d.getKind() == AnnotationDefinition.SCOPE) {
+ ScopeElement s = new ScopeElement();
+ initAnnotationElement(s, d);
+ scopes.put(d.getQualifiedName(), s);
}
}
}
+ private void initAnnotationElement(CDIAnnotationElement s, AnnotationDefinition d) {
+ s.setDefinition(d);
+ s.setParent(this);
+ IPath r = d.getType().getPath();
+ if(r != null) {
+ s.setSourcePath(r);
+ }
+ }
+
void rebuildBeans() {
synchronized (beansByPath) {
beansByPath.clear();
@@ -404,6 +423,9 @@
}
}
System.out.println("Project=" + getNature().getProject());
+ System.out.println("Qualifiers=" + qualifiers.size());
+ System.out.println("Stereotypes=" + stereotypes.size());
+ System.out.println("Scopes=" + scopes.size());
System.out.println("Named beans=" + beansByName.size());
System.out.println("Bean paths=" + beansByPath.size());
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -17,22 +17,16 @@
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
-import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
/**
*
* @author Viacheslav Kabanovich
*
*/
-public class InterceptorBindingElement extends CDIElement implements IInterceptorBinding {
- AnnotationDefinition definition;
+public class InterceptorBindingElement extends CDIAnnotationElement implements IInterceptorBinding {
public InterceptorBindingElement() {}
- public void setDefinition(AnnotationDefinition definition) {
- this.definition = definition;
- }
-
public Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations() {
Set<IInterceptorBindingDeclaration> result = new HashSet<IInterceptorBindingDeclaration>();
List<AnnotationDeclaration> as = definition.getAnnotations();
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.core.IQualifierDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class QualifierDeclaration extends AnnotationDeclaration implements IQualifierDeclaration {
+
+ public QualifierDeclaration() {}
+
+ public QualifierDeclaration(AnnotationDeclaration d) {
+ d.copyTo(this);
+ }
+
+ public IQualifier getQualifier() {
+ return project.getDelegate().getQualifier(getTypeName());
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IQualifier;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class QualifierElement extends CDIAnnotationElement implements IQualifier {
+
+ public QualifierElement() {}
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/QualifierElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IScope;
+import org.jboss.tools.cdi.core.IScopeDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ScopeDeclaration extends AnnotationDeclaration implements IScopeDeclaration {
+
+ public ScopeDeclaration() {}
+
+ public ScopeDeclaration(AnnotationDeclaration d) {
+ d.copyTo(this);
+ }
+
+ public IScope getScope() {
+ return project.getDelegate().getScope(getTypeName());
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeDeclaration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IScope;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ScopeElement extends CDIAnnotationElement implements IScope {
+
+ public ScopeElement() {}
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ScopeElement.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -16,27 +16,20 @@
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IType;
-import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
-import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
/**
*
* @author Viacheslav Kabanovich
*
*/
-public class StereotypeElement extends CDIElement implements IStereotype {
- AnnotationDefinition definition;
+public class StereotypeElement extends CDIAnnotationElement implements IStereotype {
public StereotypeElement() {}
- public void setDefinition(AnnotationDefinition definition) {
- this.definition = definition;
- }
-
public AnnotationDeclaration getAlternativeDeclaration() {
return definition.getAlternativeAnnotation();
}
@@ -60,10 +53,6 @@
return getNameDeclaration() != null ? getNameDeclaration().getDeclaration() : null;
}
- public IType getSourceType() {
- return definition.getType();
- }
-
public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
Set<IStereotypeDeclaration> result = new HashSet<IStereotypeDeclaration>();
for (AnnotationDeclaration d: definition.getAnnotations()) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -23,6 +23,8 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.internal.core.impl.AnnotationDeclaration;
import org.jboss.tools.cdi.internal.core.impl.InterceptorBindingDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.QualifierDeclaration;
+import org.jboss.tools.cdi.internal.core.impl.ScopeDeclaration;
import org.jboss.tools.cdi.internal.core.impl.StereotypeDeclaration;
/**
@@ -52,13 +54,20 @@
AnnotationDeclaration a = new AnnotationDeclaration();
a.setProject(context.getProject());
a.setDeclaration(ts[i], contextType);
- if(context.getAnnotationKind(a.getType()) == AnnotationDefinition.STEREOTYPE) {
+ int kind = context.getAnnotationKind(a.getType());
+ if(kind == AnnotationDefinition.STEREOTYPE) {
a = new StereotypeDeclaration(a);
- } else if(context.getAnnotationKind(a.getType()) == AnnotationDefinition.INTERCEPTOR_BINDING) {
+ } else if(kind == AnnotationDefinition.INTERCEPTOR_BINDING) {
a = new InterceptorBindingDeclaration(a);
+ } else if(kind == AnnotationDefinition.QUALIFIER) {
+ a = new QualifierDeclaration(a);
+ } else if(kind == AnnotationDefinition.SCOPE) {
+ a = new ScopeDeclaration(a);
}
annotations.add(a);
- annotationsByType.put(a.getTypeName(), a);
+ if(a.getTypeName() != null) {
+ annotationsByType.put(a.getTypeName(), a);
+ }
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -75,4 +75,8 @@
}
}
+ public AnnotationDeclaration getInheritedAnnotation() {
+ return annotationsByType.get(CDIConstants.INHERITED_ANNOTATION_TYPE_NAME);
+ }
+
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationHelper.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -24,6 +24,7 @@
public static final Set<String> BASIC_ANNOTATION_TYPES = new HashSet<String>();
public static final Set<String> CDI_ANNOTATION_TYPES = new HashSet<String>();
public static final Set<String> SCOPE_ANNOTATION_TYPES = new HashSet<String>();
+ public static final Set<String> QUALIFIER_ANNOTATION_TYPES = new HashSet<String>();
public static final Set<String> STEREOTYPE_ANNOTATION_TYPES = new HashSet<String>();
static {
@@ -44,11 +45,12 @@
STEREOTYPE_ANNOTATION_TYPES.add(DECORATOR_STEREOTYPE_TYPE_NAME);
STEREOTYPE_ANNOTATION_TYPES.add(DELEGATE_STEREOTYPE_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(ANY_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(DEFAULT_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(NEW_QUALIFIER_TYPE_NAME);
+ QUALIFIER_ANNOTATION_TYPES.add(NAMED_QUALIFIER_TYPE_NAME);
+
CDI_ANNOTATION_TYPES.add(QUALIFIER_ANNOTATION_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(NAMED_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(ANY_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(DEFAULT_QUALIFIER_TYPE_NAME);
- CDI_ANNOTATION_TYPES.add(NEW_QUALIFIER_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(STEREOTYPE_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(TYPED_ANNOTATION_TYPE_NAME);
CDI_ANNOTATION_TYPES.add(PRODUCES_ANNOTATION_TYPE_NAME);
@@ -62,6 +64,7 @@
CDI_ANNOTATION_TYPES.addAll(SCOPE_ANNOTATION_TYPES);
CDI_ANNOTATION_TYPES.addAll(STEREOTYPE_ANNOTATION_TYPES);
+ CDI_ANNOTATION_TYPES.addAll(QUALIFIER_ANNOTATION_TYPES);
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-17 13:17:08 UTC (rev 19419)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2009-12-17 13:47:34 UTC (rev 19420)
@@ -159,6 +159,10 @@
createAnnotation(annotationType, name);
return AnnotationDefinition.STEREOTYPE;
}
+ if(AnnotationHelper.QUALIFIER_ANNOTATION_TYPES.contains(name)) {
+ createAnnotation(annotationType, name);
+ return AnnotationDefinition.QUALIFIER;
+ }
if(AnnotationHelper.BASIC_ANNOTATION_TYPES.contains(name)) {
return AnnotationDefinition.BASIC;
}
16 years, 4 months
JBoss Tools SVN: r19419 - trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-12-17 08:17:08 -0500 (Thu, 17 Dec 2009)
New Revision: 19419
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
Log:
JBIDE-5205
write a test case
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 13:09:59 UTC (rev 19418)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 13:17:08 UTC (rev 19419)
@@ -141,18 +141,20 @@
assertEquals(template, builder2.buildTemplate());
}
- public void test_elementname() throws IOException, ModelBuilderException{
- File xsdFile = new File("src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd");
- URI uri = URI.createFileURI(xsdFile.getCanonicalFile().toString());
- XSDModelBuilder builder = new XSDModelBuilder(uri);
+ public void test_elementname() throws IOException, ModelBuilderException {
+ File xsdFile = new File("src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd");
+ URI uri = URI.createFileURI(xsdFile.getCanonicalFile().toString());
+ XSDModelBuilder builder = new XSDModelBuilder(uri);
builder.setRootElementName("smooks-resource-list");
XMLFreeMarkerTemplateBuilder templateBuilder = new XMLFreeMarkerTemplateBuilder(builder);
Document document = templateBuilder.getModel();
checkNodeName(document.getDocumentElement());
- }
-
- private void checkNodeName(Node node){
- assertNotNull(node.getNodeName());
+ }
+
+ private void checkNodeName(Node node) {
+ if (node instanceof Element) {
+ assertNotNull(((Element)node).getTagName());
+ }
System.out.println(node.getNodeName());
assertTrue(node.getNodeName().indexOf("null") == -1);
NodeList nodeList = node.getChildNodes();
16 years, 4 months
JBoss Tools SVN: r19418 - trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-12-17 08:09:59 -0500 (Thu, 17 Dec 2009)
New Revision: 19418
Added:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
Log:
JBIDE-5205
write a test case
Modified: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 13:05:07 UTC (rev 19417)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/XMLFreeMarkerTemplateBuilderTest.java 2009-12-17 13:09:59 UTC (rev 19418)
@@ -19,57 +19,64 @@
*/
package org.jboss.tools.smooks.templating.template.xml;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPathExpressionException;
+
import junit.framework.TestCase;
+import org.eclipse.emf.common.util.URI;
import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
import org.jboss.tools.smooks.templating.template.Mapping;
import org.jboss.tools.smooks.templating.template.TemplateBuilder;
import org.jboss.tools.smooks.templating.template.TestUtil;
import org.jboss.tools.smooks.templating.template.exception.TemplateBuilderException;
import org.jboss.tools.smooks.templating.template.exception.UnmappedCollectionNodeException;
-import org.jboss.tools.smooks.templating.template.xml.XMLFreeMarkerTemplateBuilder;
import org.milyn.util.FreeMarkerTemplate;
import org.milyn.xml.XmlUtil;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
*/
public class XMLFreeMarkerTemplateBuilderTest extends TestCase {
-
- public void test_SimplePerson_01() throws IOException, ParserConfigurationException, TemplateBuilderException, SAXException, ModelBuilderException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"), "person");
- String theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/simple-person-01.xml", getClass());
+ public void test_SimplePerson_01() throws IOException, ParserConfigurationException, TemplateBuilderException,
+ SAXException, ModelBuilderException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"), "person");
+ String theTemplate = builder.buildTemplate();
- // Now, test that we can parse the template ....
- XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
- }
-
- public void test_SimplePerson_02() throws IOException, ParserConfigurationException, TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"), "person");
+ TestUtil.assertXMLEquals(theTemplate, "expected/simple-person-01.xml", getClass());
- builder.addValueMapping("male", builder.getModelNode("ns0:person/name/smk:compositor/male"));
- builder.addValueMapping("firstName", builder.getModelNode("ns0:person/name/@first"));
- builder.addValueMapping("lastName", builder.getModelNode("ns0:person/name/@last"));
- builder.addValueMapping("address", builder.getModelNode("ns0:person/address"));
- builder.addValueMapping("age", builder.getModelNode("ns0:person/age"));
-
- Map javaCtx = createPersonObj("Tom", "Fennelly", "Ireland", 21);
+ // Now, test that we can parse the template ....
+ XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+ }
+
+ public void test_SimplePerson_02() throws IOException, ParserConfigurationException, TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/simple-person.xsd"), "person");
+
+ builder.addValueMapping("male", builder.getModelNode("ns0:person/name/smk:compositor/male"));
+ builder.addValueMapping("firstName", builder.getModelNode("ns0:person/name/@first"));
+ builder.addValueMapping("lastName", builder.getModelNode("ns0:person/name/@last"));
+ builder.addValueMapping("address", builder.getModelNode("ns0:person/address"));
+ builder.addValueMapping("age", builder.getModelNode("ns0:person/age"));
+
+ Map javaCtx = createPersonObj("Tom", "Fennelly", "Ireland", 21);
String template = builder.buildTemplate();
// System.out.println(template);
FreeMarkerTemplate freemarker = new FreeMarkerTemplate(template);
@@ -78,139 +85,184 @@
TestUtil.assertXMLEquals(templateRes, "expected/simple-person-02.xml", getClass());
TestUtil.validate(builder, templateRes);
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
- assertEquals(5, builder2.getMappings().size());
- assertEquals(template, builder2.buildTemplate());
- }
-
- public void test_people_01() throws IOException, ParserConfigurationException, TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("src/org/jboss/tools/smooks/templating/template/xml/people.xsd"), "people");
-
- // Try adding a value mapping before adding the collection mapping. Should get an exception...
- try {
- builder.addValueMapping("personObj.firtName", builder.getModelNode("ns0:people/person/name/@first"));
- fail("Expected UnmappedCollectionNodeException");
- } catch(UnmappedCollectionNodeException e) {
- assertEquals("Unmapped collection node 'person'.", e.getMessage());
- }
- }
-
- public void test_people_02() throws IOException, ParserConfigurationException, TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("src/org/jboss/tools/smooks/templating/template/xml/people.xsd"), "people");
-
- builder.addCollectionMapping("people", (Element) builder.getModelNode("ns0:people/person"), "personObj");
- builder.addValueMapping("personObj.male", builder.getModelNode("ns0:people/person/name/smk:compositor/male"));
- builder.addValueMapping("personObj.firstName", builder.getModelNode("ns0:people/person/name/@first"));
- builder.addValueMapping("personObj.lastName", builder.getModelNode("ns0:people/person/name/@last"));
- builder.addValueMapping("personObj.address", builder.getModelNode("ns0:people/person/address"));
- builder.addValueMapping("personObj.age", builder.getModelNode("ns0:people/person/age"));
-
- assertEquals(6, builder.getMappings().size());
-
- Map javaCtx = new HashMap();
- List people = new ArrayList();
- people.add(createPersonObj("Tom", "Fennelly", "Ireland", 6));
- people.add(createPersonObj("Mike", "Fennelly", "Ireland", 5));
- javaCtx.put("people", people);
-
- String template = builder.buildTemplate();
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
+ assertEquals(5, builder2.getMappings().size());
+ assertEquals(template, builder2.buildTemplate());
+ }
+
+ public void test_people_01() throws IOException, ParserConfigurationException, TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/people.xsd"), "people");
+
+ // Try adding a value mapping before adding the collection mapping.
+ // Should get an exception...
+ try {
+ builder.addValueMapping("personObj.firtName", builder.getModelNode("ns0:people/person/name/@first"));
+ fail("Expected UnmappedCollectionNodeException");
+ } catch (UnmappedCollectionNodeException e) {
+ assertEquals("Unmapped collection node 'person'.", e.getMessage());
+ }
+ }
+
+ public void test_people_02() throws IOException, ParserConfigurationException, TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/people.xsd"), "people");
+
+ builder.addCollectionMapping("people", (Element) builder.getModelNode("ns0:people/person"), "personObj");
+ builder.addValueMapping("personObj.male", builder.getModelNode("ns0:people/person/name/smk:compositor/male"));
+ builder.addValueMapping("personObj.firstName", builder.getModelNode("ns0:people/person/name/@first"));
+ builder.addValueMapping("personObj.lastName", builder.getModelNode("ns0:people/person/name/@last"));
+ builder.addValueMapping("personObj.address", builder.getModelNode("ns0:people/person/address"));
+ builder.addValueMapping("personObj.age", builder.getModelNode("ns0:people/person/age"));
+
+ assertEquals(6, builder.getMappings().size());
+
+ Map javaCtx = new HashMap();
+ List people = new ArrayList();
+ people.add(createPersonObj("Tom", "Fennelly", "Ireland", 6));
+ people.add(createPersonObj("Mike", "Fennelly", "Ireland", 5));
+ javaCtx.put("people", people);
+
+ String template = builder.buildTemplate();
+
FreeMarkerTemplate freemarker = new FreeMarkerTemplate(template);
String templateRes = freemarker.apply(javaCtx);
-
- TestUtil.assertXMLEquals(templateRes, "expected/people-01.xml", getClass());
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
- assertEquals(6, builder2.getMappings().size());
- assertEquals(template, builder2.buildTemplate());
+ TestUtil.assertXMLEquals(templateRes, "expected/people-01.xml", getClass());
+
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), template);
+ assertEquals(6, builder2.getMappings().size());
+ assertEquals(template, builder2.buildTemplate());
+ }
+
+ public void test_elementname() throws IOException, ModelBuilderException{
+ File xsdFile = new File("src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd");
+ URI uri = URI.createFileURI(xsdFile.getCanonicalFile().toString());
+ XSDModelBuilder builder = new XSDModelBuilder(uri);
+ builder.setRootElementName("smooks-resource-list");
+ XMLFreeMarkerTemplateBuilder templateBuilder = new XMLFreeMarkerTemplateBuilder(builder);
+ Document document = templateBuilder.getModel();
+ checkNodeName(document.getDocumentElement());
}
-
- public void test_creature_01() throws IOException, ParserConfigurationException, TemplateBuilderException, SAXException, ModelBuilderException, XPathExpressionException {
- TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("src/org/jboss/tools/smooks/templating/template/xml/creature.xsd"), "creature");
+
+ private void checkNodeName(Node node){
+ assertNotNull(node.getNodeName());
+ System.out.println(node.getNodeName());
+ assertTrue(node.getNodeName().indexOf("null") == -1);
+ NodeList nodeList = node.getChildNodes();
+ int length = nodeList.getLength();
+ for (int i = 0; i < length; i++) {
+ checkNodeName(nodeList.item(i));
+ }
+ }
- Mapping mapping = builder.addValueMapping("dog", builder.getModelNode("ns0:creature/smk:compositor/dog/@name"));
-
- // The mapping onto the <dog> node should result in the <person> and <cat> nodes being hidden...
- assertEquals(2, mapping.getHideNodes().size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), mapping.getHideNodes().get(1));
-
- String theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-01.xml", getClass());
+ public void test_creature_01() throws IOException, ParserConfigurationException, TemplateBuilderException,
+ SAXException, ModelBuilderException, XPathExpressionException {
+ TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File(
+ "src/org/jboss/tools/smooks/templating/template/xml/creature.xsd"), "creature");
+
+ Mapping mapping = builder.addValueMapping("dog", builder.getModelNode("ns0:creature/smk:compositor/dog/@name"));
+
+ // The mapping onto the <dog> node should result in the <person> and
+ // <cat> nodes being hidden...
+ assertEquals(2, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), mapping.getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), mapping.getHideNodes().get(1));
+
+ String theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-01.xml", getClass());
TestUtil.validate(builder, theTemplate);
- // Now, test that we can parse the template and extract the mappings from it....
- XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ XMLFreeMarkerTemplateBuilder builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+
// ========================================================
-
- // Remove the <dog> mapping... should reshow the <person> and <cat> nodes...
+
+ // Remove the <dog> mapping... should reshow the <person> and <cat>
+ // nodes...
List<Node> showNodes = builder.removeMapping(mapping);
- assertEquals(2, showNodes.size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), showNodes.get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), showNodes.get(1));
-
- mapping = builder.addValueMapping("cat", builder.getModelNode("ns0:creature/smk:compositor/cat"));
-
- // The mapping onto the <cat> node should result in the <person> and <dog> nodes being hidden...
- assertEquals(2, mapping.getHideNodes().size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), mapping.getHideNodes().get(1));
-
- theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-02.xml", getClass());
+ assertEquals(2, showNodes.size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), showNodes.get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), showNodes.get(1));
+
+ mapping = builder.addValueMapping("cat", builder.getModelNode("ns0:creature/smk:compositor/cat"));
+
+ // The mapping onto the <cat> node should result in the <person> and
+ // <dog> nodes being hidden...
+ assertEquals(2, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), mapping.getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), mapping.getHideNodes().get(1));
+
+ theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-02.xml", getClass());
TestUtil.validate(builder, theTemplate);
- // Now, test that we can parse the template and extract the mappings from it....
- builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
-
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+
// ========================================================
-
- // Remove the <cat> mapping... should reshow the <person> and <dog> nodes...
+
+ // Remove the <cat> mapping... should reshow the <person> and <dog>
+ // nodes...
showNodes = builder.removeMapping(mapping);
- assertEquals(2, showNodes.size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), showNodes.get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), showNodes.get(1));
-
- // Map the person... there are nested choice compositors on this one...
- mapping = builder.addValueMapping("male", builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/male"));
- builder.addValueMapping("firstName", builder.getModelNode("ns0:creature/smk:compositor/person/name/@first"));
- builder.addValueMapping("lastName", builder.getModelNode("ns0:creature/smk:compositor/person/name/@last"));
- builder.addValueMapping("address", builder.getModelNode("ns0:creature/smk:compositor/person/address"));
- builder.addValueMapping("age", builder.getModelNode("ns0:creature/smk:compositor/person/age"));
-
- // The mapping onto the <person> node should result in the <female>, <dog> and <cat> nodes being hidden...
- assertEquals(3, mapping.getHideNodes().size());
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/female"), mapping.getHideNodes().get(0));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), mapping.getHideNodes().get(1));
- assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), mapping.getHideNodes().get(2));
-
- theTemplate = builder.buildTemplate();
- TestUtil.assertXMLEquals(theTemplate, "expected/creature-03.xml", getClass());
+ assertEquals(2, showNodes.size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), showNodes.get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person"), showNodes.get(1));
- // Now, test that we can parse the template and extract the mappings from it....
- builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
- assertEquals(theTemplate, builder2.buildTemplate());
- }
+ // Map the person... there are nested choice compositors on this one...
+ mapping = builder.addValueMapping("male", builder
+ .getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/male"));
+ builder.addValueMapping("firstName", builder.getModelNode("ns0:creature/smk:compositor/person/name/@first"));
+ builder.addValueMapping("lastName", builder.getModelNode("ns0:creature/smk:compositor/person/name/@last"));
+ builder.addValueMapping("address", builder.getModelNode("ns0:creature/smk:compositor/person/address"));
+ builder.addValueMapping("age", builder.getModelNode("ns0:creature/smk:compositor/person/age"));
-// public void test_OrderStatusRequest() throws IOException, ParserConfigurationException, ModelBuilderException, SAXException, TemplateBuilderException {
-// TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"), "OrderStatusResult");
-// String theTemplate = builder.buildTemplate();
-//
-// TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml", getClass());
-// }
+ // The mapping onto the <person> node should result in the <female>,
+ // <dog> and <cat> nodes being hidden...
+ assertEquals(3, mapping.getHideNodes().size());
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/person/name/smk:compositor/female"), mapping
+ .getHideNodes().get(0));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/dog"), mapping.getHideNodes().get(1));
+ assertEquals(builder.getModelNode("ns0:creature/smk:compositor/cat"), mapping.getHideNodes().get(2));
- private Map createPersonObj(String first, String last, String address, int age) {
+ theTemplate = builder.buildTemplate();
+ TestUtil.assertXMLEquals(theTemplate, "expected/creature-03.xml", getClass());
+
+ // Now, test that we can parse the template and extract the mappings
+ // from it....
+ builder2 = new XMLFreeMarkerTemplateBuilder(builder.getModelBuilder(), theTemplate);
+ assertEquals(theTemplate, builder2.buildTemplate());
+ }
+
+ // public void test_OrderStatusRequest() throws IOException,
+ // ParserConfigurationException, ModelBuilderException, SAXException,
+ // TemplateBuilderException {
+ // TemplateBuilder builder = TestUtil.createXSDFreeMarkerTemplateBuilder(new
+ // File("resources/xcbl40/schema/org/xcbl/path_delim/schemas/xcbl/v4_0/ordermanagement/v1_0/ordermanagement.xsd"),
+ // "OrderStatusResult");
+ // String theTemplate = builder.buildTemplate();
+ //
+ // TestUtil.assertXMLEquals(theTemplate, "expected/order-status-01.xml",
+ // getClass());
+ // }
+
+ private Map createPersonObj(String first, String last, String address, int age) {
Map javaCtx = new HashMap();
- javaCtx.put("male", true);
- javaCtx.put("firstName", first);
- javaCtx.put("lastName", last);
- javaCtx.put("address", address);
- javaCtx.put("age", age);
+ javaCtx.put("male", true);
+ javaCtx.put("firstName", first);
+ javaCtx.put("lastName", last);
+ javaCtx.put("address", address);
+ javaCtx.put("age", age);
return javaCtx;
}
Added: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd 2009-12-17 13:09:59 UTC (rev 19418)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:smooks="http://www.milyn.org/xsd/smooks-1.0.xsd" targetNamespace="http://www.milyn.org/xsd/smooks-1.0.xsd" elementFormDefault="qualified">
+
+ <xs:element name="smooks-resource-list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">List of Smooks Resource Configuration.</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" ref="smooks:profiles"/>
+ <xs:element minOccurs="1" maxOccurs="unbounded" ref="smooks:abstract-resource-config"/>
+ </xs:sequence>
+ <xs:attribute name="default-target-profile" type="xs:string"/>
+ <xs:attribute name="default-selector" type="xs:string"/>
+ <xs:attribute name="default-selector-namespace" type="xs:anyURI"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="profiles">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">List of Profiles</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="1" maxOccurs="unbounded" ref="smooks:profile"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="profile">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Profile Configuration. Basically allows you to specify the name of a
+ base profile along with a list of its sub-profiles.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="base-profile" type="xs:string" use="required"/>
+ <xs:attribute name="sub-profiles" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="abstract-resource-config" abstract="true"/>
+ <xs:element name="abstract-resource-config" type="smooks:abstract-resource-config" abstract="true"/>
+
+ <xs:element name="import" substitutionGroup="smooks:abstract-resource-config">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="smooks:abstract-resource-config">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Smooks Resource Configuration Import</xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="file" use="required" type="xs:anyURI"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="resource-config" substitutionGroup="smooks:abstract-resource-config">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="smooks:abstract-resource-config">
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Smooks Resource Configuration</xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" ref="smooks:resource"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="smooks:condition"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="smooks:param"/>
+ </xs:sequence>
+ <xs:attribute name="selector" type="xs:string"/>
+ <xs:attribute name="selector-namespace" type="xs:anyURI"/>
+ <xs:attribute name="target-profile" type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="resource">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource Configuration Resource Type (xsl, class etc)</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:anyType">
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="condition">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource Targetting Condition</xs:documentation>
+ </xs:annotation>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="evaluator" type="xs:string" default="org.milyn.javabean.expression.BeanMapExpressionEvaluator"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="param">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:documentation xml:lang="en">Resource Parameter</xs:documentation>
+ </xs:annotation>
+ <xs:complexContent>
+ <xs:extension base="xs:anyType">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Property changes on: trunk/smooks/tests/org.jboss.tools.smooks.templating.test/src/org/jboss/tools/smooks/templating/template/xml/smooks1_0.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
JBoss Tools SVN: r19417 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-12-17 08:05:07 -0500 (Thu, 17 Dec 2009)
New Revision: 19417
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/context/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/decorators/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/definition/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/deployment/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/event/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/extensions/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/implementation/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/inheritance/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/interceptors/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/lookup/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/policy/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/xml/
Log:
Tests will be added in another way
16 years, 4 months