directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r519786 - in /directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/eclipse/ src/main/java/org/eclipse/emf/ src/main/java/org/eclipse/emf/ecore/ src...
Date Mon, 19 Mar 2007 01:27:17 GMT
Author: oersoy
Date: Sun Mar 18 18:27:16 2007
New Revision: 519786

URL: http://svn.apache.org/viewvc?view=rev&rev=519786
Log:
For reading xml documents without proper namespacing.

See:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166127

Added:
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/pom.xml
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/OptionalNamespaceExtendedMetaData.java
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/test/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/test/java/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/OptionalNamespaceExtendedMetaData-1.0-SNAPSHOT.jar
  (with props)
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/classes/
    directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/test-classes/

Added: directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/pom.xml?view=auto&rev=519786
==============================================================================
--- directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/pom.xml (added)
+++ directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/pom.xml Sun
Mar 18 18:27:16 2007
@@ -0,0 +1,265 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.eclipse.emf.ecore.util</groupId>
+	<artifactId>OptionalNamespaceExtendedMetaData</artifactId>
+	<version>1.0-SNAPSHOT</version>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+		<dependencies>
+
+			<dependency>
+				<groupId>junit</groupId>
+				<artifactId>junit</artifactId>
+				<version>3.8.1</version>
+				<scope>test</scope>
+			</dependency>
+
+
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf</artifactId>
+				<version>2.2.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ant</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.codegen</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.codegen.ecore</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.codegen.ecore.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.codegen.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.common</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.commonj.sdo</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.common.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.converter</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.change</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.change.edit</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.edit</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.editor</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.sdo</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.sdo.edit</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.sdo.editor</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.ecore.xmi</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.edit</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.edit.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.exporter</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.importer</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.importer.ecore</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.importer.java</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.importer.rose</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.ecore2ecore</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.ecore2ecore.editor</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.ecore2xml</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.ecore2xml.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.ui</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.xsd2ecore</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.mapping.xsd2ecore.editor</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.xsd</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.xsd.ecore.exporter</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.xsd.ecore.importer</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.xsd.edit</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.eclipse</groupId>
+				<artifactId>emf.xsd.editor</artifactId>
+				<version>2.3.0</version>
+				<scope>compile</scope>
+			</dependency>
+		</dependencies>
+</project>

Added: directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/OptionalNamespaceExtendedMetaData.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/OptionalNamespaceExtendedMetaData.java?view=auto&rev=519786
==============================================================================
--- directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/OptionalNamespaceExtendedMetaData.java
(added)
+++ directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/src/main/java/org/eclipse/emf/ecore/util/OptionalNamespaceExtendedMetaData.java
Sun Mar 18 18:27:16 2007
@@ -0,0 +1,90 @@
+package org.eclipse.emf.ecore.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
+
+public class OptionalNamespaceExtendedMetaData extends BasicExtendedMetaData {
+
+	private EPackage ePackage;
+
+	protected Map extendedMetaDataHolderCache;
+
+	/*
+	 * Set the EPackage for the model in the constructor so that we don't get a
+	 * nullpointer exception when looking it up in the registry when simulating
+	 * a null namespace.
+	 * 
+	 * We assign a HasMap instance to the extendedMetaDataHolderCache reference
+	 * so that the Resource.load process does not put a reference here that
+	 * causes the validator to attempt a namespace validation using the EPackage
+	 * non-null namespace.
+	 */
+
+	public OptionalNamespaceExtendedMetaData(EPackage ePackage) {
+		this.ePackage = ePackage;
+		this.extendedMetaDataHolderCache = new HashMap();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.emf.ecore.util.ExtendedMetaData#getElement(java.lang.String,
+	 *      java.lang.String)
+	 * 
+	 * We first call the parent method in case the document really conforms to
+	 * the namespace and can thus get the EPackage using it.
+	 * 
+	 * Otherwise we skip EPackage lookup using the namespace and just provide it
+	 * to the getDocumentRoot method using the EPackage provided in the
+	 * constructor.
+	 */
+
+	@Override
+	public EStructuralFeature getElement(String namespace, String name) {
+
+		if (namespace == null) {
+			namespace = this.ePackage.getNsURI();
+		}
+		return super.getElement(namespace, name);
+	}
+
+	@Override
+	public EStructuralFeature getElement(EClass eClass, String namespace,
+			String name) {
+		
+		if (namespace == null)
+		{
+			namespace = this.ePackage.getNsURI();
+		}
+		
+		return super.getElement(eClass, namespace, name);
+	}
+
+	@Override
+	protected EStructuralFeature getLocalElement(EClass eClass, String namespace, String name)
+	{
+		if (namespace == null) 
+		{
+			namespace = this.ePackage.getNsURI();
+		}
+		return super.getLocalElement(eClass, namespace, name);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.emf.ecore.util.ExtendedMetaData#getPackage(java.lang.String)
+	 */
+	@Override
+	public EPackage getPackage(String namespace) {
+		if (namespace == null) {
+			return ePackage;
+		}
+		return super.getPackage(namespace);
+	}
+}

Added: directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/OptionalNamespaceExtendedMetaData-1.0-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/OptionalNamespaceExtendedMetaData-1.0-SNAPSHOT.jar?view=auto&rev=519786
==============================================================================
Binary file - no diff available.

Propchange: directory/sandbox/oersoy/rpm.factory.all/OptionalNamespaceExtendedMetadata/target/OptionalNamespaceExtendedMetaData-1.0-SNAPSHOT.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message