public static Type createType(TypeHelper scope, String uri, String name, boolean isDataType)
{
ExtendedMetaData extendedMetaData = ((TypeHelperImpl)scope).getExtendedMetaData();
EPackage ePackage = extendedMetaData.getPackage(uri);
if (ePackage == null)
{
ePackage = EcoreFactory.eINSTANCE.createEPackage();
ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
ePackage.setNsURI(uri);
String packagePrefix = URI.createURI(uri).trimFileExtension().lastSegment();
ePackage.setName(packagePrefix);
ePackage.setNsPrefix(packagePrefix);
extendedMetaData.putPackage(uri, ePackage);
}
EClassifier eClassifier = ePackage.getEClassifier(name);
if (eClassifier != null) // already defined?
{
//throw new IllegalArgumentException();
return null;
}
if (name != null)
{
eClassifier = isDataType ? (EClassifier)SDOFactory.eINSTANCE.createDataType() : (EClassifier)SDOFactory.eINSTANCE.createClass();
eClassifier.setName(name);
}
else
{
eClassifier = DataObjectUtil.createDocumentRoot();
}
ePackage.getEClassifiers().add(eClassifier);
return (Type)eClassifier;
}