JBoss Tools SVN: r22044 - in branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui: internal/libprov and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-05-12 18:53:22 -0400 (Wed, 12 May 2010)
New Revision: 22044
Modified:
branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6223 EPP 5.0 as Portlet Target Runtime Provider
Modified: branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java
===================================================================
--- branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java 2010-05-12 17:02:40 UTC (rev 22043)
+++ branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/PortletUIActivator.java 2010-05-12 22:53:22 UTC (rev 22044)
@@ -18,6 +18,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IRuntime;
@@ -115,23 +116,7 @@
IProject project = ProjectUtilities.getProject(projectName);
try {
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
- if (facetedProject != null) {
- org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime = facetedProject.getPrimaryRuntime();
- if (facetRuntime == null) {
- return null;
- }
- IRuntime runtime = PortletCoreActivator.getRuntime(facetRuntime);
- if (runtime == null) {
- return null;
- }
- IJBossServerRuntime jbossRuntime = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- if (jbossRuntime == null) {
- return null;
- }
- IPath jbossLocation = runtime.getLocation();
- IPath configPath = jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
- return configPath;
- }
+ return getJBossConfigPath(facetedProject);
} catch (CoreException e) {
PortletUIActivator.log(e);
}
@@ -139,6 +124,27 @@
return null;
}
+ public static IPath getJBossConfigPath(IFacetedProjectBase facetedProject) {
+ if (facetedProject != null) {
+ org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime = facetedProject.getPrimaryRuntime();
+ if (facetRuntime == null) {
+ return null;
+ }
+ IRuntime runtime = PortletCoreActivator.getRuntime(facetRuntime);
+ if (runtime == null) {
+ return null;
+ }
+ IJBossServerRuntime jbossRuntime = (IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if (jbossRuntime == null) {
+ return null;
+ }
+ IPath jbossLocation = runtime.getLocation();
+ IPath configPath = jbossLocation.append(IJBossServerConstants.SERVER).append(jbossRuntime.getJBossConfiguration());
+ return configPath;
+ }
+ return null;
+ }
+
public static boolean isJBossPortalRuntime(IDataModel model) {
IPath configPath = getJBossConfigPath(model);
if (configPath == null) {
Modified: branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java
===================================================================
--- branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java 2010-05-12 17:02:40 UTC (rev 22043)
+++ branches/jbosstools-3.1.x/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/libprov/JSFPortletbridgeRuntimeProviderInstallPanel.java 2010-05-12 22:53:22 UTC (rev 22044)
@@ -1,8 +1,10 @@
package org.jboss.tools.portlet.ui.internal.libprov;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -16,6 +18,7 @@
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
import org.jboss.tools.portlet.core.IPortletConstants;
import org.jboss.tools.portlet.core.libprov.JSFPortletbridgeRuntimeLibraryProviderInstallOperationConfig;
import org.jboss.tools.portlet.ui.Messages;
@@ -68,6 +71,22 @@
}
config.setPortletbridgeHome(portletbridgeRuntime);
}
+ if (portletbridgeRuntime == null || portletbridgeRuntime.length() == 0 ) {
+ IFacetedProjectBase facetedProject = config.getFacetedProject();
+ IPath configPath = PortletUIActivator.getJBossConfigPath(facetedProject);
+ if (configPath != null) {
+ IPath portalPath = configPath.append(IPortletConstants.SERVER_DEFAULT_DEPLOY_GATEIN);
+ File portalFile = portalPath.toFile();
+ if (portalFile != null && portalFile.exists()) {
+ IPath eppHome = configPath.removeLastSegments(3);
+ IPath pbPath = eppHome.append("portletbridge"); //$NON-NLS-1$
+ File pbFile = pbPath.toFile();
+ if (pbFile != null && pbFile.exists()) {
+ portletbridgeRuntime = pbFile.getAbsolutePath();
+ }
+ }
+ }
+ }
folderText.setText(portletbridgeRuntime);
Button folderButton = new Button(portletBridgeGroup, SWT.PUSH);
15 years, 11 months
JBoss Tools SVN: r22043 - in trunk/cdi: plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-12 13:02:40 -0400 (Wed, 12 May 2010)
New Revision: 22043
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new CDI validation rule: Managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-12 16:38:12 UTC (rev 22042)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-12 17:02:40 UTC (rev 22043)
@@ -745,6 +745,43 @@
CDICorePlugin.getDefault().logError(e);
}
}
+ /*
+ * 3.1.4. Specializing a managed bean
+ * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ */
+ IAnnotationDeclaration specializesDeclaration = bean.getSpecializesAnnotationDeclaration();
+ if(specializesDeclaration!=null) {
+ try {
+ IBean sBean = bean.getSpecializedBean();
+ if(sBean!=null) {
+ if(sBean instanceof ISessionBean || sBean.getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME)!=null) {
+ // The specializing bean directly extends an enterprise bean class
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ } else {
+ // Validate the specializing bean extends a non simple bean
+ boolean hasDefaultConstructor = true;
+ IMethod[] methods = sBean.getBeanClass().getMethods();
+ for (IMethod method : methods) {
+ if(method.isConstructor()) {
+ if(Flags.isPublic(method.getFlags()) && method.getParameterNames().length==0) {
+ hasDefaultConstructor = true;
+ break;
+ }
+ hasDefaultConstructor = false;
+ }
+ }
+ if(!hasDefaultConstructor) {
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ }
+ }
+ } else {
+ // The specializing bean extends nothing
+ addError(CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, specializesDeclaration, bean.getResource());
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
}
private void validateInterceptor(IInterceptor interceptor) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-12 16:38:12 UTC (rev 22042)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-12 17:02:40 UTC (rev 22043)
@@ -35,14 +35,14 @@
- managed bean with a public field declares any scope other than @Dependent
- managed bean with a parameterized bean class declares any scope other than @Dependent
+3.1.4. Specializing a managed bean
+- managed bean class annotated @Specializes does not directly extend
+ the bean class of another managed bean
-3.1.4. Specializing a managed bean
-- managed bean class annotated @Specializes does not directly extend
- the bean class of another managed bean
3.2. Session beans
- session bean specifies an illegal scope (a stateless session bean must belong
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-12 16:38:12 UTC (rev 22042)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-12 17:02:40 UTC (rev 22043)
@@ -119,20 +119,20 @@
CDICorePlugin.PLUGIN_ID
);
-// private static SectionDescription SECTION_SPECIALIZATION = new SectionDescription(
-// CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_specializing,
-// new String[][]{
-// {CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingManagedBean_label},
+ private static SectionDescription SECTION_SPECIALIZATION = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_specializing,
+ new String[][]{
+ {CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingManagedBean_label},
// {CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingSessionBean_label},
// {CDIPreferences.ILLEGAL_SPECIALIZING_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingProducer_label},
// {CDIPreferences.MISSING_TYPE_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingTypeInSpecializingBean_label},
// {CDIPreferences.CONFLICTING_NAME_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingNameInSpecializingBean_label},
// {CDIPreferences.INTERCEPTOR_ANNOTATED_SPECIALIZES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorAnnotatedSpecializes_label},
// {CDIPreferences.DECORATOR_ANNOTATED_SPECIALIZES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_decoratorAnnotatedSpecializes_label},
-// },
-// CDICorePlugin.PLUGIN_ID
-// );
-//
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
private static SectionDescription SECTION_MISCELLANEOUS = new SectionDescription(
CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_miscellaneous,
new String[][]{
@@ -149,7 +149,7 @@
SECTION_SCOPE,
SECTION_MEMBER,
SECTION_INTERCEPTOR,
-// SECTION_SPECIALIZATION,
+ SECTION_SPECIALIZATION,
SECTION_MISCELLANEOUS
};
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-12 16:38:12 UTC (rev 22042)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-12 17:02:40 UTC (rev 22043)
@@ -218,6 +218,54 @@
}
/**
+ * 3.1.4. Specializing a managed bean
+ * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ * (Test a specializing bean extending a non simple bean)
+ *
+ * @throws Exception
+ */
+ public void testSpecializingClassExtendsNonSimpleBean() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend3/Cow_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ }
+
+ /**
+ * 3.1.4. Specializing a managed bean
+ * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ * (Test a specializing bean extending nothing)
+ *
+ * @throws Exception
+ */
+ public void testSpecializingClassDirectlyExtendsNothing() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend2/Cow_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ }
+
+ /**
+ * 3.1.4. Specializing a managed bean
+ * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ * (Test a specializing bean directly extending an enterprise bean class)
+ *
+ * @throws Exception
+ */
+ public void testSpecializingClassDirectlyExtendsEnterpriseBean() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/extendejb/Tractor_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ }
+
+ /**
+ * 3.1.4. Specializing a managed bean
+ * - managed bean class annotated @Specializes does not directly extend the bean class of another managed bean
+ * (Test a specializing bean implementing an interface and extending nothing)
+ *
+ * @throws Exception
+ */
+ public void testSpecializingClassImplementsInterfaceAndExtendsNothing() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/broken/noextend1/Donkey_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SPECIALIZING_MANAGED_BEAN, 21);
+ }
+
+ /**
* 3.5.1. Declaring a resource
* - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
15 years, 11 months
JBoss Tools SVN: r22042 - branches/modular_build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-05-12 12:38:12 -0400 (Wed, 12 May 2010)
New Revision: 22042
Added:
branches/modular_build/pom-all-components.xml
Log:
new all-in-one pom.xml for use with Hudson
Added: branches/modular_build/pom-all-components.xml
===================================================================
--- branches/modular_build/pom-all-components.xml (rev 0)
+++ branches/modular_build/pom-all-components.xml 2010-05-12 16:38:12 UTC (rev 22042)
@@ -0,0 +1,47 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <relativePath>parent-pom.xml</relativePath>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>trunk</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <!-- this order is important! make sure you've run genpom.xml first! -->
+ <module>tests</module>
+ <module>common</module>
+ <module>flow</module>
+ <module>jbpm</module>
+ <module>jmx</module>
+ <module>archives</module>
+ <module>as</module>
+ <module>drools</module>
+ <module>bpel</module>
+ <module>smooks</module>
+ <module>freemarker</module>
+ <module>profiler</module>
+ <module>portlet</module>
+ <module>modeshape</module>
+ <module>xulrunner</module>
+ <module>jst</module>
+ <module>vpe</module>
+ <module>jsf</module>
+ <module>esb</module>
+ <module>tptp</module>
+ <module>ws</module>
+ <module>cdi</module>
+ <module>struts</module>
+ <module>hibernatetools</module>
+ <module>seam</module>
+ <module>examples</module>
+ <module>birt</module>
+ <module>maven</module>
+ <module>site</module>
+ </modules>
+</project>
+
15 years, 11 months
JBoss Tools SVN: r22041 - in branches/hibernatetools-multiversion/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl and 21 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-05-12 12:34:01 -0400 (Wed, 12 May 2010)
New Revision: 22041
Added:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java
Removed:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java
Modified:
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java
branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - fix bugs, fix with Hibernate 3.5
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -47,7 +47,11 @@
import org.hibernate.mediator.x.Session;
import org.hibernate.mediator.x.cfg.Configuration;
import org.hibernate.mediator.x.cfg.ConfigurationFactory;
+import org.hibernate.mediator.x.cfg.JDBCMetaDataConfiguration;
import org.hibernate.mediator.x.cfg.Settings;
+import org.hibernate.mediator.x.cfg.reveng.DefaultDatabaseCollector;
+import org.hibernate.mediator.x.cfg.reveng.DefaultReverseEngineeringStrategy;
+import org.hibernate.mediator.x.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.mediator.x.tool.ide.completion.HQLCodeAssist;
import org.xml.sax.EntityResolver;
@@ -479,6 +483,32 @@
}
} );
}
+
+ public ReverseEngineeringStrategy createDefReverseEngineeringStrategy() {
+ return (ReverseEngineeringStrategy)execute(new ExecutionContext.Command() {
+ public Object execute() {
+ return DefaultReverseEngineeringStrategy.newInstance();
+ }
+ } );
+ }
+
+ public DefaultDatabaseCollector createDefaultDatabaseCollector() {
+ return (DefaultDatabaseCollector)execute(new ExecutionContext.Command() {
+ public Object execute() {
+ return DefaultDatabaseCollector.newInstance();
+ }
+ } );
+ }
+
+ public JDBCMetaDataConfiguration createJDBCMetaDataConfiguration() {
+ return (JDBCMetaDataConfiguration)execute(new ExecutionContext.Command() {
+ public Object execute() {
+ ConfigurationFactory configStubFactory = new ConfigurationFactory(null);
+ final JDBCMetaDataConfiguration cfg = configStubFactory.createConfigurationJDBCMetaData();
+ return cfg;
+ }
+ } );
+ }
@SuppressWarnings("unchecked")
public Iterator<Throwable> doSchemaExport() {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -120,7 +120,8 @@
Exporter exporter = null;
try {
- exporter = (Exporter) ReflectHelper.classForName( classname ).newInstance();
+ Object obj = ReflectHelper.classForName( classname ).newInstance();
+ exporter = org.hibernate.mediator.x.tool.hbm2x.ExporterFactory.createExporterStub(obj);
}
catch (InstantiationException e) {
throw new HibernateConsoleRuntimeException(HibernateConsoleMessages.ExporterDefinition_problem_creating_exporter_class + classname);
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -18,12 +18,11 @@
import java.util.Iterator;
import java.util.List;
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.VisitorSupport;
-import org.dom4j.io.SAXReader;
+import org.dom4j.mediator.x.Attribute;
+import org.dom4j.mediator.x.Document;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.Visitor;
+import org.dom4j.mediator.x.io.SAXReader;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
@@ -51,7 +50,6 @@
import org.hibernate.mediator.execution.ExecutionContext;
import org.hibernate.mediator.stubs.util.OpenMappingUtilsEjb3;
import org.hibernate.mediator.stubs.util.StringHelper;
-import org.hibernate.mediator.stubs.util.XMLHelper;
import org.hibernate.mediator.x.mapping.Collection;
import org.hibernate.mediator.x.mapping.Column;
import org.hibernate.mediator.x.mapping.Component;
@@ -67,6 +65,7 @@
import org.hibernate.mediator.x.mapping.ToOne;
import org.hibernate.mediator.x.mapping.Value;
import org.hibernate.mediator.x.tool.hbm2x.Cfg2HbmTool;
+import org.hibernate.mediator.x.util.XMLHelper;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -328,7 +327,7 @@
return visitor.iterator();
}
- private static class LVS extends VisitorSupport {
+ private static class LVS extends Visitor {
private String nodeName;
private String attrName;
private String attrValue;
@@ -395,15 +394,19 @@
}
try {
List<Throwable> errors = new ArrayList<Throwable>();
- XMLHelper helper = new XMLHelper();
+ XMLHelper helper = XMLHelper.newInstance();
SAXReader saxReader = helper.createSAXReader(configXMLFile.getPath(), errors, entityResolver);
doc = saxReader.read(new InputSource( stream));
if (errors.size() != 0) {
HibernateConsolePlugin.getDefault().logErrorMessage("invalid configuration", (Throwable)null); //$NON-NLS-1$
}
}
- catch (DocumentException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e); //$NON-NLS-1$
+ catch (Exception e) {
+ if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e); //$NON-NLS-1$
+ } else {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e); //$NON-NLS-1$
+ }
}
finally {
try {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -28,9 +28,8 @@
import java.util.Iterator;
import java.util.List;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.io.SAXReader;
import org.eclipse.core.internal.resources.File;
import org.eclipse.core.internal.resources.ICoreConstants;
import org.eclipse.core.internal.resources.ResourceInfo;
@@ -401,15 +400,19 @@
return new String[0];
}
InputStream is = null;
- org.dom4j.Document doc = null;
+ org.dom4j.mediator.x.Document doc = null;
try {
is = file.getContents();
- SAXReader saxReader = new SAXReader();
+ SAXReader saxReader = SAXReader.newInstance();
doc = saxReader.read(new InputSource(is));
} catch (CoreException e) {
HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
- } catch (DocumentException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("DocumentException: ", e); //$NON-NLS-1$
+ } catch (Exception e) {
+ if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("DocumentException: ", e); //$NON-NLS-1$
+ } else {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
+ }
} finally {
try {
if (is != null) is.close();
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -23,6 +23,9 @@
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.mediator.execution.ExecutionContext;
import org.hibernate.mediator.x.Session;
public class EntityPropertySource implements IPropertySource2
@@ -30,25 +33,45 @@
private Object reflectedObj;
private IPropertyDescriptor[] propertyDescriptors;
private final Session sessionStub;
+ private String consoleConfigName;
- public EntityPropertySource(final Object obj, final Session sessionStub) {
+ public EntityPropertySource(final Object obj, final Session sessionStub, String consoleConfigName) {
this.sessionStub = sessionStub;
- reflectedObj = obj;
+ this.reflectedObj = obj;
+ this.consoleConfigName = consoleConfigName;
}
public Object getEditableValue() {
return ""; //$NON-NLS-1$
}
+ public ConsoleConfiguration getConsoleConfig() {
+ final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
+ ConsoleConfiguration consoleConfig = knownConfigurations.find(consoleConfigName);
+ return consoleConfig;
+ }
+
public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- propertyDescriptors = sessionStub.getPropertyDescriptors(reflectedObj);
+ if (propertyDescriptors == null && getConsoleConfig() != null) {
+ propertyDescriptors = (IPropertyDescriptor[])getConsoleConfig().execute(new ExecutionContext.Command() {
+ public Object execute() {
+ return sessionStub.getPropertyDescriptors(reflectedObj);
+ }
+ });
}
return propertyDescriptors;
}
- public Object getPropertyValue(Object id) {
- return sessionStub.getPropertyValue(reflectedObj, id);
+ public Object getPropertyValue(final Object id) {
+ Object val = null;
+ if (getConsoleConfig() != null) {
+ val = getConsoleConfig().execute(new ExecutionContext.Command() {
+ public Object execute() {
+ return sessionStub.getPropertyValue(reflectedObj, id);
+ }
+ });
+ }
+ return val;
}
public boolean isPropertySet(Object id) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -50,7 +50,7 @@
String consoleConfigName = qp.getConsoleConfigName();
if ((sessionStub.isOpen() && sessionStub.contains(obj)) ||
(obj != null && sessionStub.hasMetaData(obj))) {
- res = new EntityPropertySource(obj, sessionStub);
+ res = new EntityPropertySource(obj, sessionStub, consoleConfigName);
}
}
}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -22,7 +22,6 @@
package org.hibernate.eclipse.console.workbench;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mediator.x.cfg.reveng.DefaultReverseEngineeringStrategy;
import org.hibernate.mediator.x.cfg.reveng.ReverseEngineeringStrategy;
public class LazyDatabaseSchema {
@@ -31,7 +30,7 @@
private final ReverseEngineeringStrategy res;
public LazyDatabaseSchema(ConsoleConfiguration ccfg) {
- this(ccfg, DefaultReverseEngineeringStrategy.newInstance());
+ this(ccfg, ccfg.createDefReverseEngineeringStrategy());
}
public LazyDatabaseSchema(ConsoleConfiguration ccfg, ReverseEngineeringStrategy res) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -53,9 +53,9 @@
public synchronized Object[] getChildren(Object o, final IProgressMonitor monitor) {
LazyDatabaseSchema dbs = getLazyDatabaseSchema( o );
- final DefaultDatabaseCollector db = DefaultDatabaseCollector.newInstance();
ConsoleConfiguration consoleConfiguration = dbs.getConsoleConfiguration();
+ final DefaultDatabaseCollector db = consoleConfiguration.createDefaultDatabaseCollector();
try{
readDatabaseSchema(monitor, db, consoleConfiguration, dbs.getReverseEngineeringStrategy());
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -27,7 +27,7 @@
import org.eclipse.jface.text.rules.ICharacterScanner;
import org.eclipse.jface.text.rules.IRule;
import org.eclipse.jface.text.rules.IToken;
-import org.hibernate.mediator.stubs.util.HqlBaseLexerStub;
+import org.hibernate.mediator.x.hql.antlr.HqlBaseLexer;
public class HQLLexerRule implements IRule {
@@ -38,7 +38,7 @@
}
public IToken evaluate(final ICharacterScanner scanner) {
- HqlBaseLexerStub lexer = HqlBaseLexerStub.newInstance(new Reader() {
+ HqlBaseLexer lexer = HqlBaseLexer.newInstance(new Reader() {
public void close() throws IOException {
// noop
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -271,9 +271,7 @@
configuration = cc.buildWith( null, false );
}
- // vitali: TODO: use execution context
- ConfigurationFactory configStubFactory = new ConfigurationFactory(null);
- final JDBCMetaDataConfiguration cfg = configStubFactory.createConfigurationJDBCMetaData();
+ final JDBCMetaDataConfiguration cfg = cc.createJDBCMetaDataConfiguration();
Properties properties = configuration.getProperties();
cfg.setProperties( properties );
cc.buildWith(cfg,false);
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -231,7 +231,7 @@
//}
//}
- LazyDatabaseSchema lazyDatabaseSchema = new LazyDatabaseSchema(configuration, repository.getReverseEngineeringStrategy(DefaultReverseEngineeringStrategy.newInstance()));
+ LazyDatabaseSchema lazyDatabaseSchema = new LazyDatabaseSchema(configuration, repository.getReverseEngineeringStrategy(configuration.createDefReverseEngineeringStrategy()));
return lazyDatabaseSchema;
} catch(RuntimeException he) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath 2010-05-12 16:34:01 UTC (rev 22041)
@@ -3,42 +3,42 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/log4j-1.2.15.jar"/>
+ <classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/slf4j-log4j12-1.5.8.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/commons-logging-1.0.4.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="D:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar "/>
+ <classpathentry kind="lib" path="lib/hibernate/dom4j-1.6.1.jar" sourcepath="D:/Temp/_hibernate/dom4j-1.6.1-sources.jar "/>
+ <classpathentry kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
+ <classpathentry kind="lib" path="lib/annotations/hibernate-annotations.jar"/>
+ <classpathentry kind="lib" path="lib/annotations/hibernate-commons-annotations.jar"/>
+ <classpathentry kind="lib" path="lib/annotations/hibernate-entitymanager.jar"/>
+ <classpathentry kind="lib" path="lib/annotations/hibernate-validator.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/asm-attrs.jar"/>
<classpathentry kind="lib" path="lib/hibernate/asm.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/asm-attrs.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/dom4j-1.6.1.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/c3p0-0.9.1.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/concurrent-1.3.2.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/connector.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/ehcache-1.2.3.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/hibernate-jmx.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/jaas.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/javassist.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jboss-cache.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jboss-common.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jboss-jmx.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jboss-system.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jdbc2_0-stdext.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
<classpathentry kind="lib" path="lib/hibernate/jta.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/jaas.jar"/>
<classpathentry kind="lib" path="lib/hibernate/oscache-2.1.jar"/>
<classpathentry kind="lib" path="lib/hibernate/proxool-0.8.3.jar"/>
<classpathentry kind="lib" path="lib/hibernate/swarmcache-1.0rc2.jar"/>
- <classpathentry kind="lib" path="lib/annotations/hibernate-annotations.jar" sourcepath="D:/Temp/_hibernate/hibernate-annotations-3.4.0.GA-sources.jar "/>
- <classpathentry kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
- <classpathentry kind="lib" path="lib/annotations/hibernate-entitymanager.jar" sourcepath="D:/Temp/_hibernate/hibernate-entitymanager-3.4.0.GA-sources.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/javassist.jar"/>
- <classpathentry kind="lib" path="lib/annotations/hibernate-validator.jar" sourcepath="D:/Temp/_hibernate/hibernate-validator-3.1.0.GA-sources.jar "/>
- <classpathentry kind="lib" path="lib/hibernate/log4j-1.2.15.jar" sourcepath="D:/Temp/_hibernate/log4j-1.2.15-sources.jar "/>
- <classpathentry kind="lib" path="lib/hibernate/hibernate-jmx.jar" sourcepath="D:/Temp/_hibernate/hibernate-jmx-3.3.2.GA-sources.jar "/>
- <classpathentry kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar" sourcepath="D:/Temp/_hibernate/slf4j-api-1.5.8-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar" sourcepath="D:/Temp/_hibernate/cglib-src-2.2.jar"/>
- <classpathentry kind="lib" path="lib/annotations/hibernate-commons-annotations.jar" sourcepath="D:/Temp/_hibernate/hibernate-commons-annotations-3.1.0.GA-sources.jar "/>
- <classpathentry kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/c3p0-0.9.1.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/commons-logging-1.0.4.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/concurrent-1.3.2.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/connector.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/ehcache-1.2.3.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/slf4j-log4j12-1.5.8.jar"/>
<classpathentry kind="lib" path="lib/tools/freemarker.jar"/>
- <classpathentry kind="lib" path="lib/tools/hibernate-tools.jar" sourcepath="C:/RHDS/hibernate/branches/Branch_3_2/HibernateExt_without_changes"/>
+ <classpathentry kind="lib" path="lib/tools/hibernate-tools.jar"/>
<classpathentry kind="lib" path="lib/tools/jtidy-r8-20060801.jar"/>
- <classpathentry kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="D:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar "/>
- <classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar" sourcepath="D:/Temp/_hibernate/bsh/src/BeanShell/src/bsh.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF 2010-05-12 16:34:01 UTC (rev 22041)
@@ -72,8 +72,9 @@
org.hibernate.mediator.x.tool.hbm2x.pojo,
org.hibernate.mediator.x.tool.ide.completion,
org.hibernate.mediator.x.type,
- org.dom4j,
- org.dom4j.io,
+ org.hibernate.mediator.x.util,
+ org.dom4j.mediator.x,
+ org.dom4j.mediator.x.io,
net.sf.cglib.core,
net.sf.cglib.proxy,
net.sf.cglib.reflect
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,25 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Attribute extends Node {
+
+ public static final String CL = "org.dom4j.Attribute"; //$NON-NLS-1$
+
+ protected Attribute(Object attribute) {
+ super(attribute, CL);
+ }
+
+ public static Attribute newInstance() {
+ return new Attribute(HObject.newInstance(CL));
+ }
+
+ public String getValue() {
+ return (String)invoke(mn());
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visit(this);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,28 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Document extends Node {
+ public static final String CL = "org.dom4j.Document"; //$NON-NLS-1$
+
+ protected Document(Object document) {
+ super(document, CL);
+ }
+
+ public static Document newInstance() {
+ return new Document(HObject.newInstance(CL));
+ }
+
+ public static Document create(Object obj) {
+ return new Document(obj);
+ }
+
+ public Element getRootElement() {
+ return new Element(invoke(mn()));
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visit(this);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,73 @@
+package org.dom4j.mediator.x;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Element extends Node {
+
+ public static final String CL = "org.dom4j.Element"; //$NON-NLS-1$
+
+ protected Element(Object element) {
+ super(element, CL);
+ }
+
+ public static Element newInstance() {
+ return new Element(HObject.newInstance(CL));
+ }
+
+ public Element element(String name) {
+ return new Element(invoke(mn(), name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Element> elements() {
+ List list = (List)invoke(mn());
+ Iterator it = list.iterator();
+ ArrayList<Element> al = new ArrayList<Element>();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj != null) {
+ al.add(new Element(obj));
+ }
+ }
+ return al;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<Element> elements(String name) {
+ List list = (List)invoke(mn(), name);
+ Iterator it = list.iterator();
+ ArrayList<Element> al = new ArrayList<Element>();
+ while (it.hasNext()) {
+ Object obj = it.next();
+ if (obj != null) {
+ al.add(new Element(obj));
+ }
+ }
+ return al;
+ }
+
+ public boolean remove(Node node) {
+ return (Boolean)invoke(mn(), node);
+ }
+
+ public String attributeValue(String name) {
+ return (String)invoke(mn(), name);
+ }
+
+ public Attribute attribute(String name) {
+ return new Attribute(invoke(mn(), name));
+ }
+
+ public String getName() {
+ return (String)invoke(mn());
+ }
+
+ @Override
+ public void accept(Visitor visitor) {
+ visitor.visit(this);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,27 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Node extends HObject {
+
+ public static final String CL = "org.dom4j.Node"; //$NON-NLS-1$
+
+ protected Node(Object node) {
+ super(node, CL);
+ }
+
+ protected Node(Object node, String cn) {
+ super(node, cn);
+ }
+
+ public static Node newInstance() {
+ return new Node(HObject.newInstance(CL));
+ }
+
+ public Element getParent() {
+ return new Element(invoke(mn()));
+ }
+
+ public void accept(Visitor visitor) {
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,13 @@
+package org.dom4j.mediator.x;
+
+public abstract class Visitor {
+
+ public void visit(Document document) {
+ }
+
+ public void visit(Element node) {
+ }
+
+ public void visit(Attribute node) {
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,20 @@
+package org.dom4j.mediator.x.io;
+
+import org.dom4j.mediator.x.Document;
+import org.hibernate.mediator.base.HObject;
+
+public class DOMWriter extends HObject {
+ public static final String CL = "org.dom4j.io.DOMWriter"; //$NON-NLS-1$
+
+ protected DOMWriter(Object saxReader) {
+ super(saxReader, CL);
+ }
+
+ public static DOMWriter newInstance() {
+ return new DOMWriter(HObject.newInstance(CL));
+ }
+
+ public org.w3c.dom.Document write(Document document) {
+ return (org.w3c.dom.Document)invoke(mn(), document);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,26 @@
+package org.dom4j.mediator.x.io;
+
+import org.dom4j.mediator.x.Document;
+import org.hibernate.mediator.base.HObject;
+import org.xml.sax.InputSource;
+
+public class SAXReader extends HObject {
+ public static final String CL = "org.dom4j.io.SAXReader"; //$NON-NLS-1$
+
+ protected SAXReader(Object saxReader) {
+ super(saxReader, CL);
+ }
+
+ public static SAXReader newInstance() {
+ return new SAXReader(HObject.newInstance(CL));
+ }
+
+ public static SAXReader create(Object obj) {
+ return new SAXReader(obj);
+ }
+
+ public Document read(InputSource in) {
+ Object obj = invoke(mn(), in);
+ return Document.create(obj);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,23 @@
+package org.hibernate.mediator.stubs.util;
+
+import java.io.InputStream;
+
+import org.hibernate.mediator.base.HObject;
+
+public class ConfigHelper extends HObject {
+
+ public static final String CL = "org.hibernate.util.ConfigHelper"; //$NON-NLS-1$
+
+ protected ConfigHelper(Object configHelper) {
+ super(configHelper, CL);
+ }
+
+ public static InputStream getResourceAsStream(String resource) {
+ return (InputStream)invokeStaticMethod(CL, "getResourceAsStream", resource); //$NON-NLS-1$
+ }
+
+ public static InputStream getUserResourceAsStream(String resource) {
+ return (InputStream)invokeStaticMethod(CL, "getUserResourceAsStream", resource); //$NON-NLS-1$
+ }
+
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,115 @@
+package org.hibernate.mediator.stubs.util;
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+
+import java.io.InputStream;
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * An {@link EntityResolver} implementation which attempts to resolve
+ * various systemId URLs to local classpath lookups<ol>
+ * <li>Any systemId URL beginning with <tt>http://hibernate.sourceforge.net/</tt> is
+ * searched for as a classpath resource in the classloader which loaded the
+ * Hibernate classes.</li>
+ * <li>Any systemId URL using <tt>classpath</tt> as the scheme (i.e. starting
+ * with <tt>classpath://</tt> is searched for as a classpath resource using first
+ * the current thread context classloader and then the classloader which loaded
+ * the Hibernate classes.
+ * </ol>
+ * <p/>
+ * Any entity references which cannot be resolved in relation to the above
+ * rules result in returning null, which should force the SAX reader to
+ * handle the entity reference in its default manner.
+ *
+ * @author Markus Meissner
+ * @author Gavin King
+ * @author Steve Ebersole
+ */
+public class DTDEntityResolver implements EntityResolver, Serializable {
+
+ private static final Logger log = LoggerFactory.getLogger( DTDEntityResolver.class );
+
+ private static final String HIBERNATE_NAMESPACE = "http://hibernate.sourceforge.net/";
+ private static final String USER_NAMESPACE = "classpath://";
+
+ public InputSource resolveEntity(String publicId, String systemId) {
+ if ( systemId != null ) {
+ log.debug( "trying to resolve system-id [" + systemId + "]" );
+ if ( systemId.startsWith( HIBERNATE_NAMESPACE ) ) {
+ log.debug( "recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/" );
+ String path = "org/hibernate/" + systemId.substring( HIBERNATE_NAMESPACE.length() );
+ InputStream dtdStream = resolveInHibernateNamespace( path );
+ if ( dtdStream == null ) {
+ log.debug( "unable to locate [" + systemId + "] on classpath" );
+ if ( systemId.substring( HIBERNATE_NAMESPACE.length() ).indexOf( "2.0" ) > -1 ) {
+ log.error( "Don't use old DTDs, read the Hibernate 3.x Migration Guide!" );
+ }
+ }
+ else {
+ log.debug( "located [" + systemId + "] in classpath" );
+ InputSource source = new InputSource( dtdStream );
+ source.setPublicId( publicId );
+ source.setSystemId( systemId );
+ return source;
+ }
+ }
+ else if ( systemId.startsWith( USER_NAMESPACE ) ) {
+ log.debug( "recognized local namespace; attempting to resolve on classpath" );
+ String path = systemId.substring( USER_NAMESPACE.length() );
+ InputStream stream = resolveInLocalNamespace( path );
+ if ( stream == null ) {
+ log.debug( "unable to locate [" + systemId + "] on classpath" );
+ }
+ else {
+ log.debug( "located [" + systemId + "] in classpath" );
+ InputSource source = new InputSource( stream );
+ source.setPublicId( publicId );
+ source.setSystemId( systemId );
+ return source;
+ }
+ }
+ }
+ // use default behavior
+ return null;
+ }
+
+ protected InputStream resolveInHibernateNamespace(String path) {
+ return this.getClass().getClassLoader().getResourceAsStream( path );
+ }
+
+ protected InputStream resolveInLocalNamespace(String path) {
+ try {
+ return ConfigHelper.getUserResourceAsStream( path );
+ }
+ catch( Throwable t ) {
+ return null;
+ }
+ }
+}
Deleted: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,44 +0,0 @@
-package org.hibernate.mediator.stubs.util;
-
-import java.io.Reader;
-
-import org.hibernate.hql.antlr.HqlBaseLexer;
-import org.hibernate.mediator.HibernateConsoleRuntimeException;
-import org.hibernate.mediator.Messages;
-import org.hibernate.mediator.x.hql.antlr.HqlSqlTokenTypes;
-
-import antlr.Token;
-import antlr.TokenStreamException;
-
-public class HqlBaseLexerStub {
-
- protected HqlBaseLexer hqlBaseLexer;
-
- protected HqlBaseLexerStub(HqlBaseLexer hqlBaseLexer) {
- if (hqlBaseLexer == null) {
- throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
- }
- this.hqlBaseLexer = hqlBaseLexer;
- }
-
- public static HqlBaseLexerStub newInstance(Reader in) {
- return new HqlBaseLexerStub(new HqlBaseLexer(in));
- }
-
- private Token nextToken() {
- try {
- return hqlBaseLexer.nextToken();
- } catch (TokenStreamException e) {
- return null;
- }
- }
-
- public boolean isNextTokenIdent() {
- Token token = nextToken();
- if (token != null && token.getType() == HqlSqlTokenTypes.IDENT) {
- return true;
- }
- return false;
- }
-
-}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,9 +1,9 @@
package org.hibernate.mediator.stubs.util;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
-import org.hibernate.util.ArrayHelper;
-
// org.hibernate.util.StringHelper
public final class StringHelper {
public static final String WHITESPACE = " \n\r\f\t"; //$NON-NLS-1$
@@ -74,6 +74,17 @@
locations.add( new Integer( indx ) );
}
}
- return ArrayHelper.toIntArray( locations );
+ return toIntArray(locations);
}
+
+ @SuppressWarnings("unchecked")
+ public static int[] toIntArray(Collection coll) {
+ Iterator iter = coll.iterator();
+ int[] arr = new int[ coll.size() ];
+ int i=0;
+ while (iter.hasNext()) {
+ arr[i++] = ((Integer)iter.next()).intValue();
+ }
+ return arr;
+ }
}
Deleted: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,45 +0,0 @@
-package org.hibernate.mediator.stubs.util;
-
-import java.util.List;
-
-import org.dom4j.io.SAXReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXParseException;
-
-@SuppressWarnings("unchecked")
-public class XMLHelper {
-
- private static final Logger log = LoggerFactory.getLogger(XMLHelper.class);
- private SAXReader saxReader;
-
- public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
- if (saxReader==null) saxReader = new SAXReader();
- saxReader.setEntityResolver(entityResolver);
- saxReader.setErrorHandler(new ErrorLogger(file, errorsList));
- saxReader.setMergeAdjacentText(true);
- saxReader.setValidation(true);
- return saxReader;
- }
-
- public static class ErrorLogger implements ErrorHandler {
- private String file;
- private List errors;
- ErrorLogger(String file, List errors) {
- this.file=file;
- this.errors = errors;
- }
- public void error(SAXParseException error) {
- log.error( "Error parsing XML: " + file + '(' + error.getLineNumber() + ") " + error.getMessage() ); //$NON-NLS-1$ //$NON-NLS-2$
- errors.add(error);
- }
- public void fatalError(SAXParseException error) {
- error(error);
- }
- public void warning(SAXParseException warn) {
- log.warn( "Warning parsing XML: " + file + '(' + warn.getLineNumber() + ") " + warn.getMessage() ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -23,7 +23,7 @@
for (int i = 0; i < returnTypes.length; i++) {
res[i] = TypeFactory.createTypeStub(returnTypes[i]);
}
- return null;
+ return res;
}
public void setMaxResults(int intValue) {
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -15,9 +15,8 @@
import java.util.Map;
import java.util.Properties;
-import org.dom4j.DocumentException;
-import org.dom4j.Node;
-import org.dom4j.io.DOMWriter;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.io.DOMWriter;
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.osgi.util.NLS;
@@ -25,11 +24,11 @@
import org.hibernate.mediator.Messages;
import org.hibernate.mediator.preferences.ConsoleConfigurationPreferences;
import org.hibernate.mediator.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.mediator.stubs.util.ConfigHelper;
import org.hibernate.mediator.stubs.util.ReflectHelper;
import org.hibernate.mediator.stubs.util.StringHelper;
import org.hibernate.mediator.x.dialect.Dialect;
-import org.hibernate.util.ConfigHelper;
-import org.hibernate.util.XMLHelper;
+import org.hibernate.mediator.x.util.XMLHelper;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -234,13 +233,12 @@
return localCfg;
}
- @SuppressWarnings("unchecked")
private Configuration loadConfigurationXML(Configuration localCfg, boolean includeMappings,
EntityResolver entityResolver) {
File configXMLFile = prefs.getConfigXMLFile();
if (!includeMappings) {
- org.dom4j.Document doc;
- XMLHelper xmlHelper = new XMLHelper();
+ org.dom4j.mediator.x.Document doc;
+ XMLHelper xmlHelper = XMLHelper.newInstance();
InputStream stream = null;
String resourceName = "<unknown>"; //$NON-NLS-1$
if (configXMLFile != null) {
@@ -273,20 +271,26 @@
.get(0));
}
- List<Node> list = doc.getRootElement()
+ List<Element> list = doc.getRootElement()
.element("session-factory").elements("mapping"); //$NON-NLS-1$ //$NON-NLS-2$
- for (Node element : list) {
+ for (Element element : list) {
element.getParent().remove(element);
}
- DOMWriter dw = new DOMWriter();
+ DOMWriter dw = DOMWriter.newInstance();
Document document = dw.write(doc);
return localCfg.configure(document);
- } catch (DocumentException e) {
- throw new HibernateConsoleRuntimeException(
- Messages.ConsoleConfiguration_could_not_parse_configuration
- + resourceName, e);
+ } catch (Exception e) {
+ if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+ throw new HibernateConsoleRuntimeException(
+ Messages.ConsoleConfiguration_could_not_parse_configuration
+ + resourceName, e);
+ } else {
+ throw new HibernateConsoleRuntimeException(
+ Messages.ConsoleConfiguration_could_not_parse_configuration
+ + resourceName, e);
+ }
} finally {
try {
if (stream != null)
@@ -312,6 +316,8 @@
InputStream is = null;
try {
is = ConfigHelper.getResourceAsStream(resource);
+ } catch (HibernateConsoleRuntimeException hcre) {
+ // just ignore
} catch (RuntimeException he) {
// TODO: RuntimeException ? - find correct solution
if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,5 +1,6 @@
package org.hibernate.mediator.x.cfg.reveng;
+import org.hibernate.mediator.HibernateConsoleRuntimeException;
import org.hibernate.mediator.base.HObject;
public class ReverseEngineeringSettings extends HObject {
@@ -10,7 +11,24 @@
}
public static ReverseEngineeringSettings newInstance(ReverseEngineeringStrategy reverseEngineeringStrategy) {
- return new ReverseEngineeringSettings(newInstance(CL, reverseEngineeringStrategy));
+ ReverseEngineeringSettings resNewInstance = null;
+ HibernateConsoleRuntimeException hcre = null;
+ try {
+ resNewInstance = new ReverseEngineeringSettings(newInstance(CL, reverseEngineeringStrategy));
+ } catch (HibernateConsoleRuntimeException hcre1) {
+ hcre = hcre1;
+ }
+ if (resNewInstance == null) { // hibernate 3.5 & new hibernate-tools
+ try {
+ resNewInstance = new ReverseEngineeringSettings(newInstance(CL));
+ } catch (HibernateConsoleRuntimeException hcre2) {
+ //hcre = hcre2;
+ }
+ }
+ if (resNewInstance == null) {
+ throw hcre;
+ }
+ return resNewInstance;
}
public ReverseEngineeringSettings setDefaultPackageName(String defaultPackageName) {
@@ -24,7 +42,11 @@
}
public ReverseEngineeringSettings setDetectOneToOne(boolean b) {
- invoke(mn(), b);
+ try {
+ invoke(mn(), b);
+ } catch (HibernateConsoleRuntimeException hcre1) {
+ // hibernate 3.5 & new hibernate-tools
+ }
return this;
}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,40 @@
+package org.hibernate.mediator.x.hql.antlr;
+
+import java.io.Reader;
+
+import org.hibernate.mediator.base.HObject;
+import org.hibernate.mediator.x.hql.antlr.HqlSqlTokenTypes;
+
+import antlr.Token;
+
+public class HqlBaseLexer extends HObject {
+
+ public static final String CL = "org.hibernate.hql.antlr.HqlBaseLexer"; //$NON-NLS-1$
+
+ public HqlBaseLexer(Object hqlBaseLexer) {
+ super(hqlBaseLexer, CL);
+ }
+
+ public static HqlBaseLexer newInstance(Reader in) {
+ return new HqlBaseLexer(HObject.newInstance(CL, in));
+ }
+
+ private Token nextToken() {
+ try {
+ return (Token)invoke(mn());
+ } catch (Exception e) {
+ //if (e.getClass().getName().contains("TokenStreamException")) { //$NON-NLS-1$
+ //}
+ }
+ return null;
+ }
+
+ public boolean isNextTokenIdent() {
+ Token token = nextToken();
+ if (token != null && token.getType() == HqlSqlTokenTypes.IDENT) {
+ return true;
+ }
+ return false;
+ }
+
+}
Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java 2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -54,5 +54,4 @@
public Serializable getIdentifier(Object entity, EntityMode pojo) {
return (Serializable)invoke(mn(), entity, pojo);
}
-
}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,17 @@
+package org.hibernate.mediator.x.tool.hbm2x;
+
+public class ExporterFactory {
+ @SuppressWarnings("unchecked")
+ public static Exporter createExporterStub(Object exporter) {
+ if (exporter == null) {
+ return null;
+ }
+ final Class cl = exporter.getClass();
+ if (0 == HibernateConfigurationExporter.CL.compareTo(cl.getName())) {
+ return new HibernateConfigurationExporter(exporter);
+ } else if (0 == GenericExporter.CL.compareTo(cl.getName())) {
+ return new GenericExporter(exporter);
+ }
+ return new GenericExporter(exporter);
+ }
+}
Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java 2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,28 @@
+package org.hibernate.mediator.x.util;
+
+import java.util.List;
+
+import org.dom4j.mediator.x.io.SAXReader;
+import org.hibernate.mediator.base.HObject;
+import org.xml.sax.EntityResolver;
+
+public class XMLHelper extends HObject {
+
+ public static final String CL = "org.hibernate.util.XMLHelper"; //$NON-NLS-1$
+
+ public static final EntityResolver DEFAULT_DTD_RESOLVER = (EntityResolver)HObject.readStaticFieldValue(CL, "DEFAULT_DTD_RESOLVER"); //$NON-NLS-1$
+
+ protected XMLHelper(Object xmlHelper) {
+ super(xmlHelper, CL);
+ }
+
+ public static XMLHelper newInstance() {
+ return new XMLHelper(HObject.newInstance(CL));
+ }
+
+ @SuppressWarnings("unchecked")
+ public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
+ Object obj = invoke(mn(), file, errorsList, entityResolver);
+ return SAXReader.create(obj);
+ }
+}
15 years, 11 months
JBoss Tools SVN: r22040 - trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-05-12 11:34:42 -0400 (Wed, 12 May 2010)
New Revision: 22040
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
Log:
Fix for [JBIDE-6275] [tester] REST POST/PUT requests are not sending SOAP body
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-12 14:35:33 UTC (rev 22039)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView.java 2010-05-12 15:34:42 UTC (rev 22040)
@@ -613,7 +613,7 @@
*/
private IStatus handleRSTest(final IProgressMonitor monitor, String address, String method, String body, String parms, String headersStr) {
- if (!method.equalsIgnoreCase(GET))
+ if (method.equalsIgnoreCase(GET))
body = EMPTY_STRING;
// if no actual text in the request body, set to null
15 years, 11 months
JBoss Tools SVN: r22039 - in branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test: src/org/jboss/tools/esb/core/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-05-12 10:35:33 -0400 (Wed, 12 May 2010)
New Revision: 22039
Added:
branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.2/jboss-esb-uninique.xml
Modified:
branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
Log:
https://jira.jboss.org/jira/browse/JBDS-1197
Added: branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.2/jboss-esb-uninique.xml
===================================================================
--- branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.2/jboss-esb-uninique.xml (rev 0)
+++ branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.2/jboss-esb-uninique.xml 2010-05-12 14:35:33 UTC (rev 22039)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<jbossesb parameterReloadSecs="18"
+ xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..."
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml... http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml...">
+ <providers>
+ <http-provider name="http">
+ <http-bus busid="secureFriends">
+ <protected-methods>
+ <method name="GET"/>
+ <method name="POST"/>
+ </protected-methods>
+ <!-- Only users in the "friend" role are allowed
+ access via the "GET" method. Unspecified
+ methods are not protected (i.e. are allowed)... -->
+ <allowed-roles>
+ <role name="friend"/>
+ </allowed-roles>
+ </http-bus>
+ <!-- Global exception mappings file... -->
+ <exception mappingsFile="/http-exception-mappings.properties"/>
+ </http-provider>
+ <http-provider name="http">
+ <http-bus busid="insecureFriends"/>
+ </http-provider>
+ </providers>
+</jbossesb>
Property changes on: branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/projects/Test/esb-1.2/jboss-esb-uninique.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
===================================================================
--- branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2010-05-12 14:34:08 UTC (rev 22038)
+++ branches/jbosstools-3.1.x/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2010-05-12 14:35:33 UTC (rev 22039)
@@ -303,6 +303,18 @@
assertTrue(errorList.toString(), errorList.length() == 0);
}
+ public void testNonUniqueProviders() {
+ XModelObject object = getFileObject("esb-1.2", "jboss-esb-uninique.xml", ESBConstants.ENT_ESB_FILE_120);
+ XModelObject[] os = object.getChildByPath("Providers").getChildren();
+ assertEquals(2, os.length);
+
+ for (int i = 0; i < os.length; i++) {
+ String name = os[i].getAttributeValue("name");
+ assertEquals("http", name);
+ }
+
+ }
+
XModelObject getFileObject(String parentPath, String xmlname) {
return getFileObject(parentPath, xmlname, ESBConstants.ENT_ESB_FILE_101);
}
15 years, 11 months
JBoss Tools SVN: r22038 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-05-12 10:34:08 -0400 (Wed, 12 May 2010)
New Revision: 22038
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeStereotype.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added new CDI validation rule: The bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes; Managed bean with a public field declares any scope other than @Dependent; Managed bean with a parameterized bean class declares any scope other than @Dependent
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -23,6 +23,7 @@
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.IKbProject;
/**
@@ -39,8 +40,7 @@
try {
EclipseUtil.addNatureToProject(project, CDICoreNature.NATURE_ID);
if (!project.hasNature(IKbProject.NATURE_ID)) {
- EclipseResourceUtil.addNatureToProject(project,
- IKbProject.NATURE_ID);
+ EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
}
EclipseResourceUtil.addBuilderToProject(project, ValidationPlugin.VALIDATION_BUILDER_ID);
} catch (CoreException e) {
@@ -55,62 +55,190 @@
*/
public static void disableCDI(IProject project) {
try {
- EclipseUtil.removeNatureFromProject(project,
- CDICoreNature.NATURE_ID);
+ EclipseUtil.removeNatureFromProject(project, CDICoreNature.NATURE_ID);
} catch (CoreException e) {
CDICorePlugin.getDefault().logError(e);
}
}
-
+
/**
* Finds CDI injected point in beans for particular java element.
*
* @param beans
* @param element
*/
- public static IInjectionPoint findInjectionPoint(Set<IBean> beans, IJavaElement element){
- if(!(element instanceof IField) && (element instanceof IMethod) )
+ public static IInjectionPoint findInjectionPoint(Set<IBean> beans, IJavaElement element) {
+ if (!(element instanceof IField) && (element instanceof IMethod)) {
return null;
-
- for(IBean bean : beans){
+ }
+
+ for (IBean bean : beans) {
Set<IInjectionPoint> injectionPoints = bean.getInjectionPoints();
- for(IInjectionPoint iPoint : injectionPoints){
- if(element instanceof IField && iPoint instanceof IInjectionPointField){
- if(((IInjectionPointField)iPoint).getField() != null && ((IInjectionPointField)iPoint).getField().equals(element))
+ for (IInjectionPoint iPoint : injectionPoints) {
+ if (element instanceof IField && iPoint instanceof IInjectionPointField) {
+ if (((IInjectionPointField) iPoint).getField() != null && ((IInjectionPointField) iPoint).getField().equals(element)) {
return iPoint;
- }else if(element instanceof IMethod && iPoint instanceof IInjectionPointMethod){
- if(((IInjectionPointMethod)iPoint).getMethod() != null && ((IInjectionPointMethod)iPoint).getMethod().equals(element))
+ }
+ } else if (element instanceof IMethod && iPoint instanceof IInjectionPointMethod) {
+ if (((IInjectionPointMethod) iPoint).getMethod() != null && ((IInjectionPointMethod) iPoint).getMethod().equals(element)) {
return iPoint;
-
+ }
}
}
}
- return null;
+ return null;
}
/**
- * Sorts CDI beans which may be injected. Sets for alternative beans higher position and for nonalternative beans lower position.
+ * Sorts CDI beans which may be injected. Sets for alternative beans higher
+ * position and for nonalternative beans lower position.
*
* @param beans
* @param element
*/
- public static List<IBean> sortBeans(Set<IBean> beans){
+ public static List<IBean> sortBeans(Set<IBean> beans) {
Set<IBean> alternativeBeans = new HashSet<IBean>();
Set<IBean> nonAlternativeBeans = new HashSet<IBean>();
-
- for(IBean bean : beans){
- if(bean == null || bean instanceof IDecorator || bean instanceof IInterceptor)
+
+ for (IBean bean : beans) {
+ if (bean == null || bean instanceof IDecorator || bean instanceof IInterceptor) {
continue;
-
- if(bean.isAlternative())
+ }
+ if (bean.isAlternative()) {
alternativeBeans.add(bean);
- else
+ } else {
nonAlternativeBeans.add(bean);
+ }
}
-
+
ArrayList<IBean> sortedBeans = new ArrayList<IBean>();
sortedBeans.addAll(alternativeBeans);
sortedBeans.addAll(nonAlternativeBeans);
return sortedBeans;
}
+
+ /**
+ * Checks if the bean has @Depended scope. If it has different scope then @Depended
+ * then returns this scope declaration or a stereotype which declares the
+ * scope. Otherwise returns null.
+ *
+ * @param bean
+ * @param scopeTypeName
+ * @return
+ */
+ public static IAnnotationDeclaration getDifferentScopeDeclarationThanDepentend(IScoped scoped) {
+ return getAnotherScopeDeclaration(scoped, CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME);
+ }
+
+ /**
+ * Checks if the bean has given scope. If it has different scope then given
+ * then returns this scope declaration or a stereotype which declares the
+ * scope. Otherwise returns null.
+ *
+ * @param bean
+ * @param scopeTypeName
+ * @return
+ */
+ public static IAnnotationDeclaration getAnotherScopeDeclaration(IScoped scoped, String scopeTypeName) {
+ IScope scope = scoped.getScope();
+ if (!scopeTypeName.equals(scope.getSourceType().getFullyQualifiedName())) {
+ Set<IScopeDeclaration> scopeDeclarations = scoped.getScopeDeclarations();
+ if (!scopeDeclarations.isEmpty()) {
+ return scopeDeclarations.iterator().next();
+ }
+ if (scoped instanceof IStereotyped) {
+ Set<IStereotypeDeclaration> stereoTypeDeclarations = ((IStereotyped) scoped).getStereotypeDeclarations();
+ for (IStereotypeDeclaration stereotypeDeclaration : stereoTypeDeclarations) {
+ IStereotype stereotype = stereotypeDeclaration.getStereotype();
+ IScope stereotypeScope = stereotype.getScope();
+ if (stereotypeScope != null && !scopeTypeName.equals(stereotypeScope.getSourceType().getFullyQualifiedName())) {
+ return stereotypeDeclaration;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the scope annotation declaration if it exists in the bean. If the
+ * scope declared in a stereotype then returns this stereotype declaration.
+ * Returns null if there is not this scope declaration neither corresponding
+ * stereotype declaration.
+ *
+ * @param bean
+ * @param scopeTypeName
+ * @return
+ */
+ public static IAnnotationDeclaration getScopeDeclaration(IBean bean, String scopeTypeName) {
+ IScope scope = bean.getScope();
+ if (scopeTypeName.equals(scope.getSourceType().getFullyQualifiedName())) {
+ Set<IScopeDeclaration> scopeDeclarations = bean.getScopeDeclarations();
+ for (IScopeDeclaration scopeDeclaration : scopeDeclarations) {
+ if (scopeTypeName.equals(scopeDeclaration.getScope().getSourceType().getFullyQualifiedName())) {
+ return scopeDeclaration;
+ }
+ }
+ Set<IStereotypeDeclaration> stereoTypeDeclarations = bean.getStereotypeDeclarations();
+ for (IStereotypeDeclaration stereotypeDeclaration : stereoTypeDeclarations) {
+ IScope stereotypeScope = stereotypeDeclaration.getStereotype().getScope();
+ if (stereotypeScope != null && scopeTypeName.equals(stereotypeScope.getSourceType().getFullyQualifiedName())) {
+ return stereotypeDeclaration;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return @Named declaration or the stereotype declaration if it declares
+ *
+ * @Named.
+ *
+ * @param stereotyped
+ * @return
+ */
+ public static IAnnotationDeclaration getNamedDeclaration(IBean bean) {
+ IAnnotationDeclaration declaration = bean.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
+ if (declaration == null) {
+ return getNamedStereotypeDeclaration(bean);
+ }
+ return declaration;
+ }
+
+ /**
+ * Return the stereotype declaration which declares @Named.
+ *
+ * @param stereotyped
+ * @return
+ */
+ public static IAnnotationDeclaration getNamedStereotypeDeclaration(IStereotyped stereotyped) {
+ Set<IStereotypeDeclaration> declarations = stereotyped.getStereotypeDeclarations();
+ for (IStereotypeDeclaration declaration : declarations) {
+ if (CDIConstants.NAMED_QUALIFIER_TYPE_NAME.equals(declaration.getType().getFullyQualifiedName())
+ || getNamedStereotypeDeclaration(declaration.getStereotype()) != null) {
+ return declaration;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns all found annotations for parameters of the method.
+ *
+ * @param method
+ * @param annotationTypeName
+ * @return
+ */
+ public static Set<ITextSourceReference> getAnnotationPossitions(IBeanMethod method, String annotationTypeName) {
+ List<IParameter> params = method.getParameters();
+ Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
+ for (IParameter param : params) {
+ ITextSourceReference declaration = param.getAnnotationPosition(annotationTypeName);
+ if (declaration != null) {
+ declarations.add(declaration);
+ }
+ }
+ return declarations;
+ }
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -28,6 +28,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
@@ -39,6 +40,7 @@
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanMethod;
@@ -59,7 +61,6 @@
import org.jboss.tools.cdi.core.ISessionBean;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
-import org.jboss.tools.cdi.core.IStereotyped;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
@@ -311,6 +312,9 @@
private void validateClassBean(IClassBean bean) {
validateDisposers(bean);
+ if(!(bean instanceof ISessionBean)) {
+ validateManagedBean(bean);
+ }
}
private void validateDisposers(IClassBean bean) {
@@ -332,7 +336,7 @@
* - there are multiple disposer methods for a single producer method
*/
for (IBeanMethod disposerMethod : disposerMethods) {
- Set<ITextSourceReference> disposerDeclarations = getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
for (ITextSourceReference declaration : disposerDeclarations) {
addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean.getResource());
}
@@ -446,18 +450,6 @@
}
}
- private Set<ITextSourceReference> getAnnotationPossitions(IBeanMethod method, String annotationTypeName) {
- List<IParameter> params = method.getParameters();
- Set<ITextSourceReference> declarations = new HashSet<ITextSourceReference>();
- for (IParameter param : params) {
- ITextSourceReference declaration = param.getAnnotationPosition(annotationTypeName);
- if(declaration!=null) {
- declarations.add(declaration);
- }
- }
- return declarations;
- }
-
/**
* If the method is not a static method and is not a business method of the session bean and is observer or disposer then mark it as incorrect.
*
@@ -553,21 +545,13 @@
* - producer field with a parameterized type with a type variable declares any scope other than @Dependent
*/
if(paramTypes.length>0) {
- IScope scope = producer.getScope();
- if(!CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME.equals(scope.getSourceType().getFullyQualifiedName())) {
- ITextSourceReference declaration = typeDeclaration;
- Set<IScopeDeclaration> decls = producer.getScopeDeclarations();
- for (IScopeDeclaration decl : decls) {
- if(decl.getParentMember().getResource().equals(producer.getResource())) {
- declaration = decl;
- break;
- }
- }
+ IAnnotationDeclaration scopeOrStereotypeDeclaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(producer);
+ if(scopeOrStereotypeDeclaration!=null) {
boolean field = producer instanceof IProducerField;
addError(
field?CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD:CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
field?CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD:CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD,
- declaration, producer.getResource());
+ scopeOrStereotypeDeclaration, producer.getResource());
}
}
}
@@ -722,6 +706,47 @@
}
}
+ private void validateManagedBean(IClassBean bean) {
+ /*
+ * 3.1. Managed beans
+ * - the bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
+ */
+ IAnnotationDeclaration decorator = bean.getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
+ IAnnotationDeclaration interceptor = bean.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
+ if(decorator!=null && interceptor!=null) {
+ addError(CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, decorator, bean.getResource());
+ addError(CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, interceptor, bean.getResource());
+ }
+
+ IAnnotationDeclaration declaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
+ if(declaration!=null) {
+ IType type = bean.getBeanClass();
+ try {
+ /*
+ * 3.1. Managed beans
+ * - managed bean with a public field declares any scope other than @Dependent
+ */
+ IField[] fields = type.getFields();
+ for (IField field : fields) {
+ if(Flags.isPublic(field.getFlags())) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, declaration, bean.getResource());
+ break;
+ }
+ }
+ /*
+ * 3.1. Managed beans
+ * - managed bean with a parameterized bean class declares any scope other than @Dependent
+ */
+ String[] typeVariables = type.getTypeParameterSignatures();
+ if(typeVariables.length>0) {
+ addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, declaration, bean.getResource());
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ }
+
private void validateInterceptor(IInterceptor interceptor) {
/*
* 2.5.3. Beans with no EL name
@@ -733,7 +758,7 @@
declaration = interceptor.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
}
if(declaration==null) {
- declaration = getNamedStereotypeDeclaration(interceptor);
+ declaration = CDIUtil.getNamedStereotypeDeclaration(interceptor);
}
addError(CDIValidationMessages.INTERCEPTOR_HAS_NAME, CDIPreferences.INTERCEPTOR_HAS_NAME, declaration, interceptor.getResource());
}
@@ -742,8 +767,11 @@
* 2.6.1. Declaring an alternative
* - interceptor is an alternative (Non-Portable behavior)
*/
- ITextSourceReference declaration = interceptor.getAlternativeDeclaration();
- if(declaration!=null) {
+ if(interceptor.isAlternative()) {
+ ITextSourceReference declaration = interceptor.getAlternativeDeclaration();
+ if(declaration==null) {
+ declaration = interceptor.getInterceptorAnnotation();
+ }
addError(CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration, interceptor.getResource());
}
}
@@ -759,7 +787,7 @@
declaration = decorator.getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
}
if(declaration==null) {
- declaration = getNamedStereotypeDeclaration(decorator);
+ declaration = CDIUtil.getNamedStereotypeDeclaration(decorator);
}
addError(CDIValidationMessages.DECORATOR_HAS_NAME, CDIPreferences.DECORATOR_HAS_NAME, declaration, decorator.getResource());
}
@@ -768,23 +796,15 @@
* 2.6.1. Declaring an alternative
* - decorator is an alternative (Non-Portable behavior)
*/
- ITextSourceReference declaration = decorator.getAlternativeDeclaration();
- if(declaration!=null) {
+ if(decorator.isAlternative()) {
+ ITextSourceReference declaration = decorator.getAlternativeDeclaration();
+ if(declaration==null) {
+ declaration = decorator.getDecoratorAnnotation();
+ }
addError(CDIValidationMessages.DECORATOR_IS_ALTERNATIVE, CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, declaration, decorator.getResource());
}
}
- private IAnnotationDeclaration getNamedStereotypeDeclaration(IStereotyped stereotyped) {
- Set<IStereotypeDeclaration> declarations = stereotyped.getStereotypeDeclarations();
- for (IStereotypeDeclaration declaration : declarations) {
- if(CDIConstants.NAMED_QUALIFIER_TYPE_NAME.equals(declaration.getType().getFullyQualifiedName()) ||
- getNamedStereotypeDeclaration(declaration.getStereotype())!=null) {
- return declaration;
- }
- }
- return null;
- }
-
/*
* 2.2.2. Restricting the bean types of a bean
* - bean class or producer method or field specifies a @Typed annotation,
@@ -853,28 +873,15 @@
boolean interceptor = bean instanceof IInterceptor;
boolean decorator = bean instanceof IDecorator;
if(interceptor || decorator) {
- IScope scope = bean.getScope();
- if(!CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME.equals(scope.getSourceType().getFullyQualifiedName())) {
- String key;
- String message;
- ITextSourceReference declaration = null;
- if(!scopes.isEmpty()) {
- declaration = scopes.iterator().next();
- }
+ IAnnotationDeclaration scopeOrStereotypeDeclaration = CDIUtil.getDifferentScopeDeclarationThanDepentend(bean);
+ if(scopeOrStereotypeDeclaration!=null) {
+ String key = CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR;
+ String message = CDIValidationMessages.ILLEGAL_SCOPE_FOR_DECORATOR;
if(interceptor) {
key = CDIPreferences.ILLEGAL_SCOPE_FOR_INTERCEPTOR;
message = CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR;
- if(declaration==null) {
- declaration = ((IInterceptor)bean).getInterceptorAnnotation();
- }
- } else {
- key = CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR;
- message = CDIValidationMessages.ILLEGAL_SCOPE_FOR_DECORATOR;
- if(declaration==null) {
- declaration = ((IDecorator)bean).getDecoratorAnnotation();
- }
}
- addError(message, key, declaration, bean.getResource());
+ addError(message, key, scopeOrStereotypeDeclaration, bean.getResource());
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -41,7 +41,8 @@
public static String MULTIPLE_SCOPE_TYPE_ANNOTATIONS;
public static String MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE;
public static String STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE;
- public static String ILLEGAL_SCOPE_FOR_MANAGED_BEAN;
+ public static String ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD;
+ public static String ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE;
public static String ILLEGAL_SCOPE_FOR_SESSION_BEAN;
public static String ILLEGAL_SCOPE_FOR_PRODUCER_METHOD;
public static String ILLEGAL_SCOPE_FOR_PRODUCER_FIELD;
@@ -68,6 +69,7 @@
public static String ILLEGAL_CONDITIONAL_OBSERVER;
public static String BOTH_INTERCEPTOR_AND_DECORATOR;
+ public static String SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR;
public static String PRODUCER_IN_INTERCEPTOR;
public static String PRODUCER_IN_DECORATOR;
public static String DISPOSER_IN_INTERCEPTOR;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-05-12 14:34:08 UTC (rev 22038)
@@ -29,16 +29,17 @@
- stereotype declares any other qualifier annotation
- stereotype is annotated @Typed
-
-
-
-
3.1. Managed beans
- the bean class of a managed bean is annotated with both
the @Interceptor and @Decorator stereotypes
- managed bean with a public field declares any scope other than @Dependent
- managed bean with a parameterized bean class declares any scope other than @Dependent
+
+
+
+
+
3.1.4. Specializing a managed bean
- managed bean class annotated @Specializes does not directly extend
the bean class of another managed bean
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-05-12 14:34:08 UTC (rev 22038)
@@ -20,7 +20,8 @@
MULTIPLE_SCOPE_TYPE_ANNOTATIONS=Bean class or producer method or field specifies multiple scope type annotations
MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE=Bean does not explicitly declare a scope when there is no default scope
STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE=Stereotype declares more than one scope
-ILLEGAL_SCOPE_FOR_MANAGED_BEAN=Managed bean with a public field or a parameterized bean class declares any scope other than @Dependent
+ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD=Managed bean with a public field declares any scope other than @Dependent
+ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE=Managed bean with a parameterized bean class declares any scope other than @Dependent
ILLEGAL_SCOPE_FOR_SESSION_BEAN=Session bean specifies an illegal scope (a stateless session bean must belong to the @Dependent pseudo-scope; a singleton bean must belong to either the @ApplicationScoped scope or to the @Dependent pseudo-scope, a stateful session bean may have any scope)
ILLEGAL_SCOPE_FOR_PRODUCER_METHOD=Producer method with a parameterized return type with a type variable declares any scope other than @Dependent
ILLEGAL_SCOPE_FOR_PRODUCER_FIELD=Producer field with a parameterized type with a type variable declares any scope other than @Dependent
@@ -46,7 +47,7 @@
ILLEGAL_OBSERVER_IN_SESSION_BEAN=Non-static method of a session bean class has a parameter annotated @Observes, and the method is not a business method of the EJB
ILLEGAL_CONDITIONAL_OBSERVER=Bean with scope @Dependent has an observer method declared receive=IF_EXISTS
-BOTH_INTERCEPTOR_AND_DECORATOR=the bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
+BOTH_INTERCEPTOR_AND_DECORATOR=The bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR=Bean class of a session bean is annotated @Interceptor or @Decorator
PRODUCER_IN_INTERCEPTOR=Interceptor has a member annotated @Produces
PRODUCER_IN_OR_DECORATOR=Decorator has a member annotated @Produces
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -62,7 +62,7 @@
{CDIPreferences.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleScopeTypeAnnotations_label},
{CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingScopeWhenThereIsNoDefaultScope_label},
{CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresMoreThanOneScope_label},
-// {CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForManagedBean_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForManagedBean_label},
// {CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForSessionBean_label},
{CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerMethod_label},
{CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerField_label},
@@ -100,7 +100,7 @@
private static SectionDescription SECTION_INTERCEPTOR = new SectionDescription(
CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_interceptor_and_decorator,
new String[][]{
-// {CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_bothInterceptorAndDecorator_label},
+ {CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_bothInterceptorAndDecorator_label},
// {CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_sessionBeanAnnotatedInterceptorOrDecorator_label},
// {CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
{CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerInInterceptorOrDecorator_label},
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -1,12 +1,11 @@
package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
-import javax.enterprise.inject.Alternative;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
@Interceptor
-@Alternative
+@AlternativeStereotype
public class AlternativeInterceptorBroken {
@AroundInvoke
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeStereotype.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeStereotype.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeStereotype.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.interceptors;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Inherited
+@Alternative
+@interface AlternativeStereotype {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/interceptors/AlternativeStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-12 14:31:35 UTC (rev 22037)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-05-12 14:34:08 UTC (rev 22038)
@@ -43,7 +43,7 @@
*/
public void testInterceptorWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/InterceptorWithWrongScopeBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR, 7);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_INTERCEPTOR, 8);
}
/**
@@ -118,7 +118,7 @@
*/
public void testAlternativeInterceptor() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/interceptors/AlternativeInterceptorBroken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, 9);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.INTERCEPTOR_IS_ALTERNATIVE, 7);
}
/**
@@ -185,6 +185,39 @@
}
/**
+ * 3.1. Managed beans
+ * - the bean class of a managed bean is annotated with both the @Interceptor and @Decorator stereotypes
+ *
+ * @throws Exception
+ */
+ public void testInterceptorCanNotAlsoBeDecorator() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/interceptors/definition/broken/interceptorCanNotBeDecorator/InterceptingDecorator.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.BOTH_INTERCEPTOR_AND_DECORATOR, 24, 25);
+ }
+
+ /**
+ * 3.1. Managed beans
+ * - managed bean with a public field declares any scope other than @Dependent
+ *
+ * @throws Exception
+ */
+ public void testNonDependentScopedBeanCanNotHavePublicField() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/simple/definition/dependentWithPublicField/Leopard_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD, 21);
+ }
+
+ /**
+ * 3.1. Managed beans
+ * - managed bean with a parameterized bean class declares any scope other than @Dependent
+ *
+ * @throws Exception
+ */
+ public void testNonDependentGenericManagedBeanNotOk() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/definition/bean/genericbroken/FooBroken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_GENERIC_TYPE, 21);
+ }
+
+ /**
* 3.5.1. Declaring a resource
* - producer field declaration specifies an EL name (together with one of @Resource, @PersistenceContext, @PersistenceUnit, @EJB, @WebServiceRef)
*
@@ -368,10 +401,10 @@
*/
public void testParameterizedReturnTypeWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 41);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 25, 39);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 21);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 35);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 32);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, 31);
}
/**
@@ -382,7 +415,7 @@
*/
public void testParameterizedTypeWithWrongScope() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/producers/ParameterizedTypeWithWrongScope_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 11, 19);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 11, 18);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 9);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 14);
AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_SCOPE_FOR_PRODUCER_FIELD, 16);
15 years, 11 months
JBoss Tools SVN: r22037 - trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-05-12 10:31:35 -0400 (Wed, 12 May 2010)
New Revision: 22037
Modified:
trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
Log:
https://jira.jboss.org/jira/browse/JBDS-1197
Modified: trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2010-05-12 14:25:17 UTC (rev 22036)
+++ trunk/esb/tests/org.jboss.tools.esb.core.test/src/org/jboss/tools/esb/core/test/ESBModelTest.java 2010-05-12 14:31:35 UTC (rev 22037)
@@ -15,7 +15,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.test.util.TestProjectProvider;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
15 years, 11 months
JBoss Tools SVN: r22036 - in branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common: model/engines/impl and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-05-12 10:25:17 -0400 (Wed, 12 May 2010)
New Revision: 22036
Modified:
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
Log:
https://jira.jboss.org/jira/browse/JBDS-1197
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -14,7 +14,7 @@
import org.w3c.dom.*;
public class XAttributeConstraintInt extends XAttributeConstraintProperties {
- protected boolean mandatory = true;
+ protected boolean mandatory = false;
protected int min = Integer.MIN_VALUE;
protected int max = Integer.MAX_VALUE;
public XAttributeConstraintInt() {
@@ -23,7 +23,7 @@
public void load(Element element) {
super.load(element);
- mandatory = getBoolean("mandatory", true); //$NON-NLS-1$
+ mandatory = getBoolean("mandatory", false); //$NON-NLS-1$
min = getInt("minimum", Integer.MIN_VALUE); //$NON-NLS-1$
max = getInt("maximum", Integer.MAX_VALUE); //$NON-NLS-1$
}
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -86,11 +86,18 @@
c = cs[i].copy();
object.addChild(c);
} else {
- boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null;
+ boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null
+ || ((XModelObjectImpl)c).hasIdAttr();
if(has_id) {
c.removeFromParent();
EnginesLoader.merge(c, cs[i], false);
- object.addChild(c);
+ if(!object.addChild(c)) {
+ c.set(XModelObjectImpl.DUPLICATE, "1234");
+ object.addChild(c);
+ }
+ if(c.get(XModelObjectImpl.DUPLICATE) != null) {
+ c.set(XModelObjectImpl.DUPLICATE, "");
+ }
} else {
EnginesLoader.merge(c, cs[i], fire);
}
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -117,6 +117,18 @@
k++;
}
return;
+ } else if(hasIdAttr()) {
+ int k = 1;
+ while(c != null) {
+ super.set(XModelObjectImpl.DUPLICATE, "" + k); //$NON-NLS-1$
+ npp = getPathPart();
+ if(k == 1 && npp.indexOf(XModelObjectImpl.DUPLICATE) < 0) {
+ elementExists(c, name, value);
+ return;
+ }
+ c = p.children.change(this, opp, npp);
+ k++;
+ }
} else {
if(ov == null) properties.remove(name); else super.set(name, ov);
elementExists(c, name, value);
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -40,6 +40,7 @@
public class XModelObjectImpl implements XModelObject, Serializable, Cloneable {
private static final long serialVersionUID = 3860648580262144825L;
// protected static final String ENTITY = XModelConstants.XMODEL_ENTITY_ATTR;
+ public static final String DUPLICATE = "__duplicate";
private XModel model = null;
private XModelEntity entity = null;
private XModelObjectImpl parent = null;
@@ -136,6 +137,21 @@
properties.put(name.intern(), value);
}
+ private Boolean hasIdAttr = null;
+
+ public boolean hasIdAttr() {
+ if(hasIdAttr != null) return hasIdAttr.booleanValue();
+ hasIdAttr = Boolean.FALSE;
+ for (int i = 0; i < getModelEntity().getAttributes().length; i++) {
+ if("true".equals(getModelEntity().getAttributes()[i].getProperty("id"))) {
+ hasIdAttr = Boolean.TRUE;
+ break;
+ }
+ }
+
+ return hasIdAttr.booleanValue();
+ }
+
protected String get_0(String name) {
XAttribute a = getModelEntity().getAttribute(name);
return (a == null || a.getAdapter() == null) ? null : a.getAdapter().getProperty(this);
@@ -300,8 +316,17 @@
public String getPathPart() {
String p = name();
- return (p == null || p.indexOf('/') < 0) ? p : p.replace('/', '#');
+ p = ((p == null || p.indexOf('/') < 0) ? p : p.replace('/', '#'));
+ return applyDuplicate(p);
}
+
+ protected final String applyDuplicate(String pathpart) {
+ String duplicate = get(DUPLICATE);
+ return (duplicate == null || duplicate.length() == 0)
+ ? pathpart
+ : pathpart + DUPLICATE + duplicate;
+
+ }
public XModelObject getChildByPath(String path) {
int i = path.indexOf(XModelObjectConstants.SEPARATOR);
@@ -360,6 +385,10 @@
String entity = (transform) ? getEntityForCopy() : getModelEntity().getName();
XModelObject c = getModel().createModelObject(entity, p);
if(c != null) c.setModified(true);
+ String d = get(DUPLICATE);
+ if(d != null && d.length() > 0) {
+ c.set(DUPLICATE, d);
+ }
return c;
}
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -39,12 +39,19 @@
private void check(XModelObject o) {
XAttribute[] as = o.getModelEntity().getAttributes();
+ String idAttr = null;
for (int i = 0; i < as.length; i++) {
String error = as[i].getConstraint().getError(o.getAttributeValue(as[i].getName()));
if(error != null) addProblem(o, as[i].getName(), "Value " + error);
+ if("true".equals(as[i].getProperty("id"))) idAttr = as[i].getName();
}
XModelObject[] cs = ((XModelObjectImpl)o).getLoadedChildren();
for (int i = 0; i < cs.length; i++) check(cs[i]);
+
+ String duplicate = o.get(XModelObjectImpl.DUPLICATE);
+ if(duplicate != null && duplicate.length() > 0 && idAttr != null) {
+ addProblem(o, idAttr, "Value " + o.getAttributeValue(idAttr) + " is not unique.");
+ }
}
protected void addProblem(XModelObject o, String attr, String msg) {
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -30,7 +30,7 @@
public class ResourceMarkers {
public static String TEXT_PROBLEM = "org.jboss.tools.common.model.textproblemmarker"; //$NON-NLS-1$
- public static String CONSTRAINT_PROBLEM = "org.jboss.tools.common.model.web.ui.constraintsmarker"; //$NON-NLS-1$
+ public static String CONSTRAINT_PROBLEM = "org.jboss.tools.jst.web.ui.constraintsmarker"; //$NON-NLS-1$
public static String JST_WEB_PROBLEM = "org.jboss.tools.jst.web.ui.strutsmarker"; //$NON-NLS-1$
private XModelObject object;
Modified: branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
===================================================================
--- branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2010-05-12 13:47:06 UTC (rev 22035)
+++ branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2010-05-12 14:25:17 UTC (rev 22036)
@@ -223,9 +223,13 @@
XModelEntity entity = o.getModelEntity();
XAttribute[] as = entity.getAttributes();
for (int i = 0; i < as.length; i++) {
+ String n = as[i].getName();
+ if("attributes".equals(n) && "true".equals(as[i].getProperty("any"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ loadAnyAtributes(element, o);
+ continue;
+ }
String xmlname = as[i].getXMLName();
if (xmlname == null || xmlname.length() == 0) continue;
- String n = as[i].getName();
String value = getAttribute(element, xmlname, as[i]);
if (value != null) o.setAttributeValue(n, value);
String commentName = getAttributeCommentName(xmlname);
@@ -332,6 +336,17 @@
if(q != null) EnginesLoader.merge(q, co, false);
} catch (XModelException exc) {
ModelPlugin.getPluginLog().logError("XModelObjectLoaderUtil:loadChildren:" + exc.getMessage(), exc); //$NON-NLS-1$
+ } else {
+ int k = 1;
+ String pp = co.getPathPart();
+ while(o.getChildByPath(pp) != null) {
+ co.set(XModelObjectImpl.DUPLICATE, "" + k); //$NON-NLS-1$
+ String ppn = co.getPathPart();
+ if(ppn.equals(pp)) break;
+ pp = ppn;
+ ++k;
+ }
+ o.addChild(co);
}
continue;
}
@@ -443,9 +458,13 @@
}
for (int i = 0; i < as.length; i++) {
if (as[i].isFake()) continue;
+ String n = as[i].getName();
+ if("attributes".equals(n) && "true".equals(as[i].getProperty("any"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ saveAnyAtributes(element, o);
+ continue;
+ }
String xmlname = as[i].getXMLName();
if (xmlname == null || xmlname.length() == 0) continue;
- String n = as[i].getName();
String v = o.getAttributeValue(n);
if (isSaveable(entity, n, v, as[i].getDefaultValue())) {
saveAttribute(element, xmlname, v);
@@ -843,24 +862,35 @@
protected void loadAnyElement(Element element, XModelObject o) {
o.setAttributeValue("tag", element.getTagName()); //$NON-NLS-1$
+ loadAnyAtributes(element, o);
+ String text = getAttribute(element, "#text").trim(); //$NON-NLS-1$
+ if(text.length() > 0) {
+ while(text.startsWith("\n") || text.startsWith("\r")) text = text.substring(1); //$NON-NLS-1$ //$NON-NLS-2$
+ while(text.endsWith("\n") || text.endsWith("\r")) text = text.substring(0, text.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
+ o.setAttributeValue("text", text); //$NON-NLS-1$
+ }
+ loadChildren(element, o);
+ }
+
+ public static void loadAnyAtributes(Element element, XModelObject o) {
+ HashSet<String> attrs = new HashSet<String>();
+ XAttribute[] oas = o.getModelEntity().getAttributes();
+ for (XAttribute a: oas) {
+ String xml = a.getXMLName();
+ if(xml != null && xml.length() > 0) attrs.add(xml);
+ }
StringBuffer sb = new StringBuffer();
NamedNodeMap as = element.getAttributes();
for (int i = 0; i < as.getLength(); i++) {
Node n = as.item(i);
String nm = n.getNodeName();
+ if(attrs.contains(nm)) continue;
String v = n.getNodeValue();
if(v == null) continue;
if(sb.length() > 0) sb.append(";"); //$NON-NLS-1$
sb.append(nm).append("=").append(v); //$NON-NLS-1$
}
o.setAttributeValue("attributes", sb.toString()); //$NON-NLS-1$
- String text = getAttribute(element, "#text").trim(); //$NON-NLS-1$
- if(text.length() > 0) {
- while(text.startsWith("\n") || text.startsWith("\r")) text = text.substring(1); //$NON-NLS-1$ //$NON-NLS-2$
- while(text.endsWith("\n") || text.endsWith("\r")) text = text.substring(0, text.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
- o.setAttributeValue("text", text); //$NON-NLS-1$
- }
- loadChildren(element, o);
}
protected void saveAnyElement(Element parent, XModelObject o) {
@@ -870,6 +900,18 @@
xmlname = namespace + ":" + xmlname; //$NON-NLS-1$
}
Element element = XMLUtil.createElement(parent, xmlname);
+ saveAnyAtributes(element, o);
+ String text = o.getAttributeValue("text"); //$NON-NLS-1$
+ if(text != null && text.length() > 0) {
+ saveAttribute(element, "#text", text); //$NON-NLS-1$
+ }
+ XModelObject[] cs = o.getChildren();
+ for (int i = 0; i < cs.length; i++) {
+ saveAnyElement(element, cs[i]);
+ }
+ }
+
+ public static void saveAnyAtributes(Element element, XModelObject o) {
String attrs = o.getAttributeValue("attributes"); //$NON-NLS-1$
StringTokenizer st = new StringTokenizer(attrs, ";"); //$NON-NLS-1$
while(st.hasMoreTokens()) {
@@ -880,14 +922,6 @@
String v = t.substring(i + 1);
element.setAttribute(n, v);
}
- String text = o.getAttributeValue("text"); //$NON-NLS-1$
- if(text != null && text.length() > 0) {
- saveAttribute(element, "#text", text); //$NON-NLS-1$
- }
- XModelObject[] cs = o.getChildren();
- for (int i = 0; i < cs.length; i++) {
- saveAnyElement(element, cs[i]);
- }
}
protected void eitherOr(Element element, String attr1, String attr2) {
@@ -941,6 +975,9 @@
}
}
mergeFinalComment(destination, source, fire);
+
+ String d = destination.get(XModelObjectImpl.DUPLICATE);
+ if(d != null && d.length() > 0) destination.set(XModelObjectImpl.DUPLICATE, "");
}
public static void mergeAttributeComment(XModelObject destination, XModelObject source, XAttribute attr, boolean fire) {
15 years, 11 months
JBoss Tools SVN: r22035 - in trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common: model/engines/impl and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-05-12 09:47:06 -0400 (Wed, 12 May 2010)
New Revision: 22035
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
Log:
https://jira.jboss.org/jira/browse/JBDS-1197
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/constraint/impl/XAttributeConstraintInt.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -14,7 +14,7 @@
import org.w3c.dom.*;
public class XAttributeConstraintInt extends XAttributeConstraintProperties {
- protected boolean mandatory = true;
+ protected boolean mandatory = false;
protected int min = Integer.MIN_VALUE;
protected int max = Integer.MAX_VALUE;
public XAttributeConstraintInt() {
@@ -23,7 +23,7 @@
public void load(Element element) {
super.load(element);
- mandatory = getBoolean("mandatory", true); //$NON-NLS-1$
+ mandatory = getBoolean("mandatory", false); //$NON-NLS-1$
min = getInt("minimum", Integer.MIN_VALUE); //$NON-NLS-1$
max = getInt("maximum", Integer.MAX_VALUE); //$NON-NLS-1$
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -86,11 +86,18 @@
c = cs[i].copy();
object.addChild(c);
} else {
- boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null;
+ boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null
+ || ((XModelObjectImpl)c).hasIdAttr();
if(has_id) {
c.removeFromParent();
EnginesLoader.merge(c, cs[i], false);
- object.addChild(c);
+ if(!object.addChild(c)) {
+ c.set(XModelObjectImpl.DUPLICATE, "1234");
+ object.addChild(c);
+ }
+ if(c.get(XModelObjectImpl.DUPLICATE) != null) {
+ c.set(XModelObjectImpl.DUPLICATE, "");
+ }
} else {
EnginesLoader.merge(c, cs[i], fire);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -117,6 +117,18 @@
k++;
}
return;
+ } else if(hasIdAttr()) {
+ int k = 1;
+ while(c != null) {
+ super.set(XModelObjectImpl.DUPLICATE, "" + k); //$NON-NLS-1$
+ npp = getPathPart();
+ if(k == 1 && npp.indexOf(XModelObjectImpl.DUPLICATE) < 0) {
+ elementExists(c, name, value);
+ return;
+ }
+ c = p.children.change(this, opp, npp);
+ k++;
+ }
} else {
if(ov == null) properties.remove(name); else super.set(name, ov);
elementExists(c, name, value);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelObjectImpl.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -40,6 +40,7 @@
public class XModelObjectImpl implements XModelObject, Serializable, Cloneable {
private static final long serialVersionUID = 3860648580262144825L;
// protected static final String ENTITY = XModelConstants.XMODEL_ENTITY_ATTR;
+ public static final String DUPLICATE = "__duplicate";
private XModel model = null;
private XModelEntity entity = null;
private XModelObjectImpl parent = null;
@@ -136,6 +137,21 @@
properties.put(name.intern(), value);
}
+ private Boolean hasIdAttr = null;
+
+ public boolean hasIdAttr() {
+ if(hasIdAttr != null) return hasIdAttr.booleanValue();
+ hasIdAttr = Boolean.FALSE;
+ for (int i = 0; i < getModelEntity().getAttributes().length; i++) {
+ if("true".equals(getModelEntity().getAttributes()[i].getProperty("id"))) {
+ hasIdAttr = Boolean.TRUE;
+ break;
+ }
+ }
+
+ return hasIdAttr.booleanValue();
+ }
+
protected String get_0(String name) {
XAttribute a = getModelEntity().getAttribute(name);
return (a == null || a.getAdapter() == null) ? null : a.getAdapter().getProperty(this);
@@ -300,8 +316,17 @@
public String getPathPart() {
String p = name();
- return (p == null || p.indexOf('/') < 0) ? p : p.replace('/', '#');
+ p = ((p == null || p.indexOf('/') < 0) ? p : p.replace('/', '#'));
+ return applyDuplicate(p);
}
+
+ protected final String applyDuplicate(String pathpart) {
+ String duplicate = get(DUPLICATE);
+ return (duplicate == null || duplicate.length() == 0)
+ ? pathpart
+ : pathpart + DUPLICATE + duplicate;
+
+ }
public XModelObject getChildByPath(String path) {
int i = path.indexOf(XModelObjectConstants.SEPARATOR);
@@ -360,6 +385,10 @@
String entity = (transform) ? getEntityForCopy() : getModelEntity().getName();
XModelObject c = getModel().createModelObject(entity, p);
if(c != null) c.setModified(true);
+ String d = get(DUPLICATE);
+ if(d != null && d.length() > 0) {
+ c.set(DUPLICATE, d);
+ }
return c;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ConstraintChecker.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -39,12 +39,19 @@
private void check(XModelObject o) {
XAttribute[] as = o.getModelEntity().getAttributes();
+ String idAttr = null;
for (int i = 0; i < as.length; i++) {
String error = as[i].getConstraint().getError(o.getAttributeValue(as[i].getName()));
if(error != null) addProblem(o, as[i].getName(), "Value " + error);
+ if("true".equals(as[i].getProperty("id"))) idAttr = as[i].getName();
}
XModelObject[] cs = ((XModelObjectImpl)o).getLoadedChildren();
for (int i = 0; i < cs.length; i++) check(cs[i]);
+
+ String duplicate = o.get(XModelObjectImpl.DUPLICATE);
+ if(duplicate != null && duplicate.length() > 0 && idAttr != null) {
+ addProblem(o, idAttr, "Value " + o.getAttributeValue(idAttr) + " is not unique.");
+ }
}
protected void addProblem(XModelObject o, String attr, String msg) {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -30,7 +30,7 @@
public class ResourceMarkers {
public static String TEXT_PROBLEM = "org.jboss.tools.common.model.textproblemmarker"; //$NON-NLS-1$
- public static String CONSTRAINT_PROBLEM = "org.jboss.tools.common.model.web.ui.constraintsmarker"; //$NON-NLS-1$
+ public static String CONSTRAINT_PROBLEM = "org.jboss.tools.jst.web.ui.constraintsmarker"; //$NON-NLS-1$
public static String JST_WEB_PROBLEM = "org.jboss.tools.jst.web.ui.strutsmarker"; //$NON-NLS-1$
private XModelObject object;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2010-05-12 13:36:39 UTC (rev 22034)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/XModelObjectLoaderUtil.java 2010-05-12 13:47:06 UTC (rev 22035)
@@ -223,9 +223,13 @@
XModelEntity entity = o.getModelEntity();
XAttribute[] as = entity.getAttributes();
for (int i = 0; i < as.length; i++) {
+ String n = as[i].getName();
+ if("attributes".equals(n) && "true".equals(as[i].getProperty("any"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ loadAnyAtributes(element, o);
+ continue;
+ }
String xmlname = as[i].getXMLName();
if (xmlname == null || xmlname.length() == 0) continue;
- String n = as[i].getName();
String value = getAttribute(element, xmlname, as[i]);
if (value != null) o.setAttributeValue(n, value);
String commentName = getAttributeCommentName(xmlname);
@@ -332,6 +336,17 @@
if(q != null) EnginesLoader.merge(q, co, false);
} catch (XModelException exc) {
ModelPlugin.getPluginLog().logError("XModelObjectLoaderUtil:loadChildren:" + exc.getMessage(), exc); //$NON-NLS-1$
+ } else {
+ int k = 1;
+ String pp = co.getPathPart();
+ while(o.getChildByPath(pp) != null) {
+ co.set(XModelObjectImpl.DUPLICATE, "" + k); //$NON-NLS-1$
+ String ppn = co.getPathPart();
+ if(ppn.equals(pp)) break;
+ pp = ppn;
+ ++k;
+ }
+ o.addChild(co);
}
continue;
}
@@ -443,9 +458,13 @@
}
for (int i = 0; i < as.length; i++) {
if (as[i].isFake()) continue;
+ String n = as[i].getName();
+ if("attributes".equals(n) && "true".equals(as[i].getProperty("any"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ saveAnyAtributes(element, o);
+ continue;
+ }
String xmlname = as[i].getXMLName();
if (xmlname == null || xmlname.length() == 0) continue;
- String n = as[i].getName();
String v = o.getAttributeValue(n);
if (isSaveable(entity, n, v, as[i].getDefaultValue())) {
saveAttribute(element, xmlname, v);
@@ -843,24 +862,35 @@
protected void loadAnyElement(Element element, XModelObject o) {
o.setAttributeValue("tag", element.getTagName()); //$NON-NLS-1$
+ loadAnyAtributes(element, o);
+ String text = getAttribute(element, "#text").trim(); //$NON-NLS-1$
+ if(text.length() > 0) {
+ while(text.startsWith("\n") || text.startsWith("\r")) text = text.substring(1); //$NON-NLS-1$ //$NON-NLS-2$
+ while(text.endsWith("\n") || text.endsWith("\r")) text = text.substring(0, text.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
+ o.setAttributeValue("text", text); //$NON-NLS-1$
+ }
+ loadChildren(element, o);
+ }
+
+ public static void loadAnyAtributes(Element element, XModelObject o) {
+ HashSet<String> attrs = new HashSet<String>();
+ XAttribute[] oas = o.getModelEntity().getAttributes();
+ for (XAttribute a: oas) {
+ String xml = a.getXMLName();
+ if(xml != null && xml.length() > 0) attrs.add(xml);
+ }
StringBuffer sb = new StringBuffer();
NamedNodeMap as = element.getAttributes();
for (int i = 0; i < as.getLength(); i++) {
Node n = as.item(i);
String nm = n.getNodeName();
+ if(attrs.contains(nm)) continue;
String v = n.getNodeValue();
if(v == null) continue;
if(sb.length() > 0) sb.append(";"); //$NON-NLS-1$
sb.append(nm).append("=").append(v); //$NON-NLS-1$
}
o.setAttributeValue("attributes", sb.toString()); //$NON-NLS-1$
- String text = getAttribute(element, "#text").trim(); //$NON-NLS-1$
- if(text.length() > 0) {
- while(text.startsWith("\n") || text.startsWith("\r")) text = text.substring(1); //$NON-NLS-1$ //$NON-NLS-2$
- while(text.endsWith("\n") || text.endsWith("\r")) text = text.substring(0, text.length() - 1); //$NON-NLS-1$ //$NON-NLS-2$
- o.setAttributeValue("text", text); //$NON-NLS-1$
- }
- loadChildren(element, o);
}
protected void saveAnyElement(Element parent, XModelObject o) {
@@ -870,6 +900,18 @@
xmlname = namespace + ":" + xmlname; //$NON-NLS-1$
}
Element element = XMLUtil.createElement(parent, xmlname);
+ saveAnyAtributes(element, o);
+ String text = o.getAttributeValue("text"); //$NON-NLS-1$
+ if(text != null && text.length() > 0) {
+ saveAttribute(element, "#text", text); //$NON-NLS-1$
+ }
+ XModelObject[] cs = o.getChildren();
+ for (int i = 0; i < cs.length; i++) {
+ saveAnyElement(element, cs[i]);
+ }
+ }
+
+ public static void saveAnyAtributes(Element element, XModelObject o) {
String attrs = o.getAttributeValue("attributes"); //$NON-NLS-1$
StringTokenizer st = new StringTokenizer(attrs, ";"); //$NON-NLS-1$
while(st.hasMoreTokens()) {
@@ -880,14 +922,6 @@
String v = t.substring(i + 1);
element.setAttribute(n, v);
}
- String text = o.getAttributeValue("text"); //$NON-NLS-1$
- if(text != null && text.length() > 0) {
- saveAttribute(element, "#text", text); //$NON-NLS-1$
- }
- XModelObject[] cs = o.getChildren();
- for (int i = 0; i < cs.length; i++) {
- saveAnyElement(element, cs[i]);
- }
}
protected void eitherOr(Element element, String attr1, String attr2) {
@@ -941,6 +975,9 @@
}
}
mergeFinalComment(destination, source, fire);
+
+ String d = destination.get(XModelObjectImpl.DUPLICATE);
+ if(d != null && d.length() > 0) destination.set(XModelObjectImpl.DUPLICATE, "");
}
public static void mergeAttributeComment(XModelObject destination, XModelObject source, XAttribute attr, boolean fire) {
15 years, 11 months