Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-10-06 05:11:20 +0000
committerEike Stepper2016-10-06 05:11:20 +0000
commite40010016985cc5c460fc05a05bccd5adcc7cd17 (patch)
tree7b47f03f603dba62bf2d82b5d096788cb89ee628
parentf801966bba2d41577004de63e7ffda7be837bf92 (diff)
downloadcdo-e40010016985cc5c460fc05a05bccd5adcc7cd17.tar.gz
cdo-e40010016985cc5c460fc05a05bccd5adcc7cd17.tar.xz
cdo-e40010016985cc5c460fc05a05bccd5adcc7cd17.zip
[498732] Ecore validation fails for CDOBlob attribute
https://bugs.eclipse.org/bugs/show_bug.cgi?id=498732
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/model/etypes.ecore6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java38
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesFactoryImpl.java160
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java6
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/HexUtil.java57
9 files changed, 294 insertions, 47 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
index 712ab2b38a..25e3674968 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
@@ -18,7 +18,7 @@ import java.io.IOException;
import java.io.InputStream;
/**
- * A identifiable binary large object with streaming support.
+ * An identifiable binary large object with streaming support.
*
* @author Eike Stepper
* @since 4.0
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
index ec89c1fda2..6c878e8051 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
@@ -18,7 +18,7 @@ import java.io.IOException;
import java.io.Reader;
/**
- * A identifiable character large object with streaming support.
+ * An identifiable character large object with streaming support.
*
* @author Eike Stepper
* @since 4.0
diff --git a/plugins/org.eclipse.emf.cdo/model/etypes.ecore b/plugins/org.eclipse.emf.cdo/model/etypes.ecore
index 98c0747642..093745e7c0 100644
--- a/plugins/org.eclipse.emf.cdo/model/etypes.ecore
+++ b/plugins/org.eclipse.emf.cdo/model/etypes.ecore
@@ -2,10 +2,8 @@
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="etypes" nsURI="http://www.eclipse.org/emf/CDO/Etypes/4.0.0"
nsPrefix="etypes">
- <eClassifiers xsi:type="ecore:EDataType" name="Blob" instanceClassName="org.eclipse.emf.cdo.common.lob.CDOBlob"
- serializable="false"/>
- <eClassifiers xsi:type="ecore:EDataType" name="Clob" instanceClassName="org.eclipse.emf.cdo.common.lob.CDOClob"
- serializable="false"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="Blob" instanceClassName="org.eclipse.emf.cdo.common.lob.CDOBlob"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="Clob" instanceClassName="org.eclipse.emf.cdo.common.lob.CDOClob"/>
<eClassifiers xsi:type="ecore:EClass" name="ModelElement" abstract="true">
<eOperations name="getAnnotation" eType="#//Annotation">
<eParameters name="source" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
index aaea2fe46a..204646eecc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
@@ -127,7 +127,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
+ *
* <p>This method is used to initialize {@link EresourcePackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc
@@ -140,7 +140,9 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public static EresourcePackage init()
{
if (isInited)
+ {
return (EresourcePackage)EPackage.Registry.INSTANCE.getEPackage(EresourcePackage.eNS_URI);
+ }
// Obtain or create and register package
EresourcePackageImpl theEresourcePackage = (EresourcePackageImpl)(EPackage.Registry.INSTANCE
@@ -450,7 +452,9 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public void createPackageContents()
{
if (isCreated)
+ {
return;
+ }
isCreated = true;
// Create classes and their features
@@ -505,7 +509,9 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public void initializePackageContents()
{
if (isInitialized)
+ {
return;
+ }
isInitialized = true;
// Initialize package
@@ -522,15 +528,15 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
// Set bounds for type parameters
// Add supertypes to classes
- cdoResourceFolderEClass.getESuperTypes().add(this.getCDOResourceNode());
- cdoResourceEClass.getESuperTypes().add(this.getCDOResourceLeaf());
- cdoResourceLeafEClass.getESuperTypes().add(this.getCDOResourceNode());
- cdoFileResourceEClass.getESuperTypes().add(this.getCDOResourceLeaf());
- EGenericType g1 = createEGenericType(this.getCDOFileResource());
+ cdoResourceFolderEClass.getESuperTypes().add(getCDOResourceNode());
+ cdoResourceEClass.getESuperTypes().add(getCDOResourceLeaf());
+ cdoResourceLeafEClass.getESuperTypes().add(getCDOResourceNode());
+ cdoFileResourceEClass.getESuperTypes().add(getCDOResourceLeaf());
+ EGenericType g1 = createEGenericType(getCDOFileResource());
EGenericType g2 = createEGenericType(theEtypesPackage.getInputStream());
g1.getETypeArguments().add(g2);
cdoBinaryResourceEClass.getEGenericSuperTypes().add(g1);
- g1 = createEGenericType(this.getCDOFileResource());
+ g1 = createEGenericType(getCDOFileResource());
g2 = createEGenericType(theEtypesPackage.getReader());
g1.getETypeArguments().add(g2);
cdoTextResourceEClass.getEGenericSuperTypes().add(g1);
@@ -538,8 +544,8 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
// Initialize classes and features; add operations and parameters
initEClass(cdoResourceNodeEClass, CDOResourceNode.class, "CDOResourceNode", IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$
IS_GENERATED_INSTANCE_CLASS);
- initEReference(getCDOResourceNode_Folder(), this.getCDOResourceFolder(), this.getCDOResourceFolder_Nodes(),
- "folder", null, 0, 1, CDOResourceNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, //$NON-NLS-1$
+ initEReference(getCDOResourceNode_Folder(), getCDOResourceFolder(), getCDOResourceFolder_Nodes(), "folder", null, 0, //$NON-NLS-1$
+ 1, CDOResourceNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE,
!IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResourceNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, CDOResourceNode.class, //$NON-NLS-1$
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -548,30 +554,30 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
initEClass(cdoResourceFolderEClass, CDOResourceFolder.class, "CDOResourceFolder", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$
IS_GENERATED_INSTANCE_CLASS);
- initEReference(getCDOResourceFolder_Nodes(), this.getCDOResourceNode(), this.getCDOResourceNode_Folder(), "nodes", //$NON-NLS-1$
+ initEReference(getCDOResourceFolder_Nodes(), getCDOResourceNode(), getCDOResourceNode_Folder(), "nodes", //$NON-NLS-1$
null, 0, -1, CDOResourceFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
!IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- EOperation op = addEOperation(cdoResourceFolderEClass, this.getCDOResourceFolder(), "addResourceFolder", 0, 1, //$NON-NLS-1$
+ EOperation op = addEOperation(cdoResourceFolderEClass, getCDOResourceFolder(), "addResourceFolder", 0, 1, //$NON-NLS-1$
IS_UNIQUE, IS_ORDERED);
addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
- op = addEOperation(cdoResourceFolderEClass, this.getCDOResource(), "addResource", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
+ op = addEOperation(cdoResourceFolderEClass, getCDOResource(), "addResource", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
- op = addEOperation(cdoResourceFolderEClass, this.getCDOTextResource(), "addTextResource", 0, 1, IS_UNIQUE, //$NON-NLS-1$
+ op = addEOperation(cdoResourceFolderEClass, getCDOTextResource(), "addTextResource", 0, 1, IS_UNIQUE, //$NON-NLS-1$
IS_ORDERED);
addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
- op = addEOperation(cdoResourceFolderEClass, this.getCDOBinaryResource(), "addBinaryResource", 0, 1, IS_UNIQUE, //$NON-NLS-1$
+ op = addEOperation(cdoResourceFolderEClass, getCDOBinaryResource(), "addBinaryResource", 0, 1, IS_UNIQUE, //$NON-NLS-1$
IS_ORDERED);
addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
initEClass(cdoResourceEClass, CDOResource.class, "CDOResource", !IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$
IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getCDOResource_ResourceSet(), this.getResourceSet(), "resourceSet", null, 0, 1, CDOResource.class, //$NON-NLS-1$
+ initEAttribute(getCDOResource_ResourceSet(), getResourceSet(), "resourceSet", null, 0, 1, CDOResource.class, //$NON-NLS-1$
IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getCDOResource_URI(), this.getURI(), "uRI", null, 0, 1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE, //$NON-NLS-1$
+ initEAttribute(getCDOResource_URI(), getURI(), "uRI", null, 0, 1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE, //$NON-NLS-1$
IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEReference(getCDOResource_Contents(), ecorePackage.getEObject(), null, "contents", null, 0, -1, //$NON-NLS-1$
CDOResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
@@ -583,9 +589,9 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
initEAttribute(getCDOResource_TrackingModification(), ecorePackage.getEBoolean(), "trackingModification", null, 0, //$NON-NLS-1$
1, CDOResource.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
IS_ORDERED);
- initEAttribute(getCDOResource_Errors(), this.getDiagnostic(), "errors", null, 0, -1, CDOResource.class, //$NON-NLS-1$
+ initEAttribute(getCDOResource_Errors(), getDiagnostic(), "errors", null, 0, -1, CDOResource.class, //$NON-NLS-1$
IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getCDOResource_Warnings(), this.getDiagnostic(), "warnings", null, 0, -1, CDOResource.class, //$NON-NLS-1$
+ initEAttribute(getCDOResource_Warnings(), getDiagnostic(), "warnings", null, 0, -1, CDOResource.class, //$NON-NLS-1$
IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_TimeStamp(), ecorePackage.getELong(), "timeStamp", null, 0, 1, CDOResource.class, //$NON-NLS-1$
IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -644,7 +650,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
*/
protected void createDBStoreAnnotations()
{
- String source = "http://www.eclipse.org/CDO/DBStore"; //$NON-NLS-1$
+ String source = "http://www.eclipse.org/CDO/DBStore"; //$NON-NLS-1$
addAnnotation(getCDOResourceNode_Name(), source, new String[] { "columnType", "VARCHAR", //$NON-NLS-1$ //$NON-NLS-2$
"columnLength", "255" //$NON-NLS-1$ //$NON-NLS-2$
});
@@ -659,7 +665,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
*/
protected void createCDOAnnotations()
{
- String source = "http://www.eclipse.org/emf/CDO"; //$NON-NLS-1$
+ String source = "http://www.eclipse.org/emf/CDO"; //$NON-NLS-1$
addAnnotation(getCDOBinaryResource_Contents(), source, new String[] { "persistent", "true" //$NON-NLS-1$ //$NON-NLS-2$
});
addAnnotation(getCDOTextResource_Contents(), source, new String[] { "persistent", "true" //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
index 7a35cf805f..7f56a91c56 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
@@ -98,7 +98,9 @@ public class EresourceSwitch<T>
CDOResourceNode cdoResourceNode = (CDOResourceNode)theEObject;
T result = caseCDOResourceNode(cdoResourceNode);
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_RESOURCE_FOLDER:
@@ -106,9 +108,13 @@ public class EresourceSwitch<T>
CDOResourceFolder cdoResourceFolder = (CDOResourceFolder)theEObject;
T result = caseCDOResourceFolder(cdoResourceFolder);
if (result == null)
+ {
result = caseCDOResourceNode(cdoResourceFolder);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_RESOURCE:
@@ -116,11 +122,17 @@ public class EresourceSwitch<T>
CDOResource cdoResource = (CDOResource)theEObject;
T result = caseCDOResource(cdoResource);
if (result == null)
+ {
result = caseCDOResourceLeaf(cdoResource);
+ }
if (result == null)
+ {
result = caseCDOResourceNode(cdoResource);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_RESOURCE_LEAF:
@@ -128,9 +140,13 @@ public class EresourceSwitch<T>
CDOResourceLeaf cdoResourceLeaf = (CDOResourceLeaf)theEObject;
T result = caseCDOResourceLeaf(cdoResourceLeaf);
if (result == null)
+ {
result = caseCDOResourceNode(cdoResourceLeaf);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_FILE_RESOURCE:
@@ -138,11 +154,17 @@ public class EresourceSwitch<T>
CDOFileResource<?> cdoFileResource = (CDOFileResource<?>)theEObject;
T result = caseCDOFileResource(cdoFileResource);
if (result == null)
+ {
result = caseCDOResourceLeaf(cdoFileResource);
+ }
if (result == null)
+ {
result = caseCDOResourceNode(cdoFileResource);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_BINARY_RESOURCE:
@@ -150,13 +172,21 @@ public class EresourceSwitch<T>
CDOBinaryResource cdoBinaryResource = (CDOBinaryResource)theEObject;
T result = caseCDOBinaryResource(cdoBinaryResource);
if (result == null)
+ {
result = caseCDOFileResource(cdoBinaryResource);
+ }
if (result == null)
+ {
result = caseCDOResourceLeaf(cdoBinaryResource);
+ }
if (result == null)
+ {
result = caseCDOResourceNode(cdoBinaryResource);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EresourcePackage.CDO_TEXT_RESOURCE:
@@ -164,13 +194,21 @@ public class EresourceSwitch<T>
CDOTextResource cdoTextResource = (CDOTextResource)theEObject;
T result = caseCDOTextResource(cdoTextResource);
if (result == null)
+ {
result = caseCDOFileResource(cdoTextResource);
+ }
if (result == null)
+ {
result = caseCDOResourceLeaf(cdoTextResource);
+ }
if (result == null)
+ {
result = caseCDOResourceNode(cdoTextResource);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
default:
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesFactoryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesFactoryImpl.java
index d9e6ba91f5..9a7bbc4f08 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesFactoryImpl.java
@@ -10,11 +10,17 @@
*/
package org.eclipse.emf.cdo.etypes.impl;
+import org.eclipse.emf.cdo.common.lob.CDOBlob;
+import org.eclipse.emf.cdo.common.lob.CDOClob;
import org.eclipse.emf.cdo.common.lob.CDOLob;
import org.eclipse.emf.cdo.etypes.Annotation;
import org.eclipse.emf.cdo.etypes.EtypesFactory;
import org.eclipse.emf.cdo.etypes.EtypesPackage;
+import org.eclipse.net4j.util.HexUtil;
+import org.eclipse.net4j.util.io.IORuntimeException;
+import org.eclipse.net4j.util.io.IOUtil;
+
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
@@ -22,18 +28,29 @@ import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
/**
- * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>.
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
*
* @since 4.0
- * @noextend This interface is not intended to be extended by clients. <!-- end-user-doc -->
+ * @noextend This interface is not intended to be extended by clients.
+ * <!-- end-user-doc -->
* @generated
*/
public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
{
/**
* Creates the default factory implementation.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public static EtypesFactory init()
@@ -55,7 +72,8 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
/**
* Creates an instance of the factory.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public EtypesFactoryImpl()
@@ -64,7 +82,8 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
@Override
@@ -80,7 +99,8 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
@Override
@@ -88,13 +108,18 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
{
switch (eDataType.getClassifierID())
{
+ case EtypesPackage.BLOB:
+ return createBlobFromString(eDataType, initialValue);
+ case EtypesPackage.CLOB:
+ return createClobFromString(eDataType, initialValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
@Override
@@ -102,13 +127,18 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
{
switch (eDataType.getClassifierID())
{
+ case EtypesPackage.BLOB:
+ return convertBlobToString(eDataType, instanceValue);
+ case EtypesPackage.CLOB:
+ return convertClobToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public Annotation createAnnotation()
@@ -119,8 +149,112 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
/**
* <!-- begin-user-doc -->
- *
- * @since 4.1 <!-- end-user-doc -->
+ * @since 4.6
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public CDOBlob createBlobFromString(EDataType eDataType, String initialValue)
+ {
+ if (initialValue == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ HexUtil.hexToBytes(new StringReader(initialValue), baos);
+ return new CDOBlob(new ByteArrayInputStream(baos.toByteArray()));
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * @since 4.6
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String convertBlobToString(EDataType eDataType, Object instanceValue)
+ {
+ if (instanceValue == null)
+ {
+ return null;
+ }
+
+ CDOBlob blob = (CDOBlob)instanceValue;
+
+ try
+ {
+ InputStream inputStream = blob.getContents();
+ StringWriter writer = new StringWriter();
+ HexUtil.bytesToHex(inputStream, writer);
+ return writer.toString();
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * @since 4.6
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public CDOClob createClobFromString(EDataType eDataType, String initialValue)
+ {
+ if (initialValue == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ return new CDOClob(new StringReader(initialValue));
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * @since 4.6
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String convertClobToString(EDataType eDataType, Object instanceValue)
+ {
+ if (instanceValue == null)
+ {
+ return null;
+ }
+
+ CDOClob clob = (CDOClob)instanceValue;
+
+ try
+ {
+ Reader reader = clob.getContents();
+ StringWriter writer = new StringWriter();
+ IOUtil.copyCharacter(reader, writer);
+ return writer.toString();
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * @since 4.1
+ * <!-- end-user-doc -->
* @generated NOT
*/
public CDOLob<?> createLobFromString(EDataType eDataType, String initialValue)
@@ -129,7 +263,8 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
public EtypesPackage getEtypesPackage()
@@ -138,7 +273,8 @@ public class EtypesFactoryImpl extends EFactoryImpl implements EtypesFactory
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @deprecated
* @generated
*/
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java
index 053af6233d..2036c82aac 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/impl/EtypesPackageImpl.java
@@ -108,7 +108,7 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
+ *
* <p>This method is used to initialize {@link EtypesPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
@@ -121,7 +121,9 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
public static EtypesPackage init()
{
if (isInited)
+ {
return (EtypesPackage)EPackage.Registry.INSTANCE.getEPackage(EtypesPackage.eNS_URI);
+ }
// Obtain or create and register package
EtypesPackageImpl theEtypesPackage = (EtypesPackageImpl)(EPackage.Registry.INSTANCE
@@ -290,7 +292,9 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
public void createPackageContents()
{
if (isCreated)
+ {
return;
+ }
isCreated = true;
// Create classes and their features
@@ -327,7 +331,9 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
public void initializePackageContents()
{
if (isInitialized)
+ {
return;
+ }
isInitialized = true;
// Initialize package
@@ -341,16 +347,16 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
// Set bounds for type parameters
// Add supertypes to classes
- annotationEClass.getESuperTypes().add(this.getModelElement());
+ annotationEClass.getESuperTypes().add(getModelElement());
// Initialize classes and features; add operations and parameters
initEClass(modelElementEClass, ModelElement.class, "ModelElement", IS_ABSTRACT, !IS_INTERFACE, //$NON-NLS-1$
IS_GENERATED_INSTANCE_CLASS);
- initEReference(getModelElement_Annotations(), this.getAnnotation(), this.getAnnotation_ModelElement(),
- "annotations", null, 0, -1, ModelElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, //$NON-NLS-1$
+ initEReference(getModelElement_Annotations(), getAnnotation(), getAnnotation_ModelElement(), "annotations", null, 0, //$NON-NLS-1$
+ -1, ModelElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
!IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- EOperation op = addEOperation(modelElementEClass, this.getAnnotation(), "getAnnotation", 0, 1, IS_UNIQUE, //$NON-NLS-1$
+ EOperation op = addEOperation(modelElementEClass, getAnnotation(), "getAnnotation", 0, 1, IS_UNIQUE, //$NON-NLS-1$
IS_ORDERED);
addEParameter(op, ecorePackage.getEString(), "source", 0, 1, IS_UNIQUE, IS_ORDERED); //$NON-NLS-1$
@@ -361,8 +367,8 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
initEReference(getAnnotation_Details(), ecorePackage.getEStringToStringMapEntry(), null, "details", null, 0, -1, //$NON-NLS-1$
Annotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE,
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getAnnotation_ModelElement(), this.getModelElement(), this.getModelElement_Annotations(),
- "modelElement", null, 0, 1, Annotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, //$NON-NLS-1$
+ initEReference(getAnnotation_ModelElement(), getModelElement(), getModelElement_Annotations(), "modelElement", null, //$NON-NLS-1$
+ 0, 1, Annotation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE,
!IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAnnotation_Contents(), ecorePackage.getEObject(), null, "contents", null, 0, -1, Annotation.class, //$NON-NLS-1$
!IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
@@ -372,8 +378,8 @@ public class EtypesPackageImpl extends EPackageImpl implements EtypesPackage
IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Initialize data types
- initEDataType(blobEDataType, CDOBlob.class, "Blob", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
- initEDataType(clobEDataType, CDOClob.class, "Clob", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEDataType(blobEDataType, CDOBlob.class, "Blob", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEDataType(clobEDataType, CDOClob.class, "Clob", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEDataType(lobEDataType, CDOLob.class, "Lob", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEDataType(inputStreamEDataType, InputStream.class, "InputStream", !IS_SERIALIZABLE, //$NON-NLS-1$
!IS_GENERATED_INSTANCE_CLASS);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java
index f2f8280408..b0eb755d60 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/etypes/util/EtypesSwitch.java
@@ -94,7 +94,9 @@ public class EtypesSwitch<T>
ModelElement modelElement = (ModelElement)theEObject;
T result = caseModelElement(modelElement);
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
case EtypesPackage.ANNOTATION:
@@ -102,9 +104,13 @@ public class EtypesSwitch<T>
Annotation annotation = (Annotation)theEObject;
T result = caseAnnotation(annotation);
if (result == null)
+ {
result = caseModelElement(annotation);
+ }
if (result == null)
+ {
result = defaultCase(theEObject);
+ }
return result;
}
default:
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/HexUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/HexUtil.java
index 5370cef0bc..24f7cee73d 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/HexUtil.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/HexUtil.java
@@ -13,6 +13,10 @@ package org.eclipse.net4j.util;
import org.eclipse.net4j.util.io.IORuntimeException;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
/**
* Provides static methods that convert to and from hexadecimal string formats.
@@ -83,6 +87,26 @@ public final class HexUtil
}
}
+ /**
+ * @since 3.7
+ */
+ public static void bytesToHex(InputStream bs, Writer writer)
+ {
+ try
+ {
+ int b;
+ while ((b = bs.read()) != -1)
+ {
+ writer.write(Character.forDigit(b >>> 4 & 0xf, 16));
+ writer.write(Character.forDigit(b & 0xf, 16));
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
public static String bytesToHex(byte[] bs)
{
if (bs == null)
@@ -144,6 +168,39 @@ public final class HexUtil
}
}
+ /**
+ * @since 3.7
+ */
+ public static void hexToBytes(Reader s, OutputStream outputStream) throws NumberFormatException
+ {
+ try
+ {
+ int c1, c2;
+ byte b1, b2;
+ while ((c1 = s.read()) != -1 && (c2 = s.read()) != -1)
+ {
+ b1 = (byte)Character.digit(c1, 16);
+ if (b1 < 0)
+ {
+ throw new NumberFormatException("Wrong character: " + c1);
+ }
+
+ b2 = (byte)Character.digit(c2, 16);
+ if (b2 < 0)
+ {
+ throw new NumberFormatException("Wrong character: " + c2);
+ }
+
+ int b = b1 << 4 | b2;
+ outputStream.write(b);
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+
public static String longToHex(long v)
{
final String hex = Long.toHexString(v);

Back to the top