From f3e3191c911992ae4b55cf1619206ad7dd2b7c9f Mon Sep 17 00:00:00 2001 From: lresende Date: Mon, 2 Nov 2009 22:21:03 +0000 Subject: Moving LDAP DAS to contrib folder at new SVN structure git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832142 13f79535-47bb-0310-9956-ffa450edef68 --- .../model/model.ecore | 34 - .../model/model.genmodel | 35 - .../pom.xml | 11 - .../META-INF/MANIFEST.MF | 17 - .../build.properties | 14 - .../plugin.properties | 20 - .../das.ldap.configuration.model.v100/plugin.xml | 19 - .../ldap/das.ldap.configuration.model.v100/pom.xml | 173 ----- .../org/apache/tuscany/model/Configuration.java | 296 --------- .../apache/tuscany/model/ConfigurationFactory.java | 45 -- .../java/org/apache/tuscany/model/DASMeta.java | 70 -- .../model/impl/ConfigurationFactoryImpl.java | 130 ---- .../tuscany/model/impl/ConfigurationImpl.java | 692 -------------------- .../model/impl/ConfigurationPackageImpl.java | 726 --------------------- .../org/apache/tuscany/model/impl/DASMetaImpl.java | 234 ------- .../model/util/ConfigurationAdapterFactory.java | 158 ----- .../tuscany/model/util/ConfigurationSwitch.java | 167 ----- java/das/ldap/das.ldap.constants/pom.xml | 20 - .../constants/ApacheDSConnectionConstants.java | 48 -- .../tuscany/das/ldap/constants/DASConstants.java | 95 --- .../das/ldap/constants/SyntaxOIDValues.java | 8 - .../schema/constants/AttributeTypeConstants.java | 25 - .../EnumeratedSchemaAttributeTypeValues.java | 7 - .../schema/constants/ObjectClassConstants.java | 35 - .../ldap/schema/constants/PartitionConstants.java | 8 - .../constants/SchemaAttributeTypeConstants.java | 33 - .../constants/SchemaObjectClassConstants.java | 39 -- .../schema/constants/SystemSchemaConstants.java | 34 - java/das/ldap/das.ldap/pom.xml | 207 ------ .../setup/ADSEmbeddedConnectionTemplate.java | 129 ---- .../setup/ADSEmbeddedConnectionTemplateTest.java | 59 -- .../setup/ADSEmbeddedHotPartitionTemplate.java | 157 ----- .../setup/ADSEmbeddedHotPartitionTemplateTest.java | 50 -- .../testing/setup/JNDIConnectionTemplate.java | 103 --- .../testing/setup/JNDIConnectionTemplateTest.java | 66 -- .../setup/JNDIHotPartitionConnectionTemplate.java | 117 ---- .../JNDIHotPartitionConnectionTemplateTest.java | 73 --- .../das/ldap/connect/ADSEmbeddedConnection.java | 175 ----- .../tuscany/das/ldap/connect/JNDIConnection.java | 96 --- .../das/ldap/create/InitialContextCreator.java | 75 --- .../ldap/create/InitialContextCreatorHelper.java | 143 ---- .../das/ldap/create/MetaContextCreator.java | 65 -- .../das/ldap/destroy/InitialContextDestroyer.java | 74 --- .../das/ldap/destroy/MetaContextDestroyer.java | 53 -- .../org/apache/tuscany/das/ldap/emf/Context.java | 81 --- .../org/apache/tuscany/das/ldap/emf/LdapDAS.java | 379 ----------- .../apache/tuscany/das/ldap/emf/LdapDASHelper.java | 295 --------- .../das/ldap/emf/create/EDataGraphCreator.java | 62 -- .../ldap/emf/create/EDataGraphCreatorHelper.java | 97 --- .../das/ldap/emf/create/EDataObjectCreator.java | 137 ---- .../ldap/emf/create/EDataObjectCreatorHelper.java | 284 -------- .../das/ldap/emf/read/EDataGraphReader.java | 131 ---- .../das/ldap/emf/read/EDataGraphReaderHelper.java | 365 ----------- .../das/ldap/emf/read/EDataObjectReader.java | 100 --- .../das/ldap/emf/read/EDataObjectReaderHelper.java | 161 ----- .../das/ldap/emf/update/EDataGraphUpdater.java | 63 -- .../ldap/emf/update/EDataGraphUpdaterHelper.java | 228 ------- .../encryption/constants/EncryptionConstants.java | 26 - .../das/ldap/encryption/util/ChecksumUtils.java | 38 -- .../das/ldap/oid/create/ComplexTypeOIDCreator.java | 69 -- .../das/ldap/oid/create/OIDCreatorHelper.java | 73 --- .../das/ldap/oid/create/SimpleTypeOIDCreator.java | 66 -- .../das/ldap/prototype/setup/Prototype.java | 74 --- .../ldap/prototype/setup/PrototypeUtilities.java | 243 ------- .../ldap/prototype/setup/test/CommonSetupTest.java | 264 -------- .../prototype/setup/test/EDataGraphSetupTest.java | 138 ---- .../prototype/setup/test/EDataObjectSetupTest.java | 49 -- .../prototype/setup/test/LdapDASSetupTest.java | 218 ------- .../create/AbstractAttributeTypeCreator.java | 40 -- .../ldap/schema/create/AbstractTypeCreator.java | 59 -- .../ldap/schema/create/ComplexTypeRDNCreator.java | 60 -- .../ldap/schema/create/SimpleTypeRDNCreator.java | 63 -- .../schema/create/SyntaxCheckerEntryCreator.java | 94 --- .../das/ldap/schema/create/SyntaxEntryCreator.java | 155 ----- .../embedded/setup/test/AbstractTestSetup.java | 87 --- .../embedded/setup/test/AbstractTestSetupTest.java | 46 -- .../embedded/setup/test/DASContextSetup.java | 47 -- .../embedded/setup/test/DASContextSetupTest.java | 54 -- .../setup/test/DASSchemaContextsSetup.java | 191 ------ .../setup/test/DASSchemaContextsSetupTest.java | 59 -- .../setup/test/EcoreSchemaAndDASContextsSetup.java | 74 --- .../test/EcoreSchemaAndDASContextsSetupTest.java | 56 -- .../setup/test/EcoreSchemaContextsSetup.java | 201 ------ .../setup/test/EcoreSchemaContextsSetupTest.java | 64 -- .../setup/test/XSDSchemaContextsSetup.java | 116 ---- .../setup/test/XSDSchemaContextsSetupTest.java | 49 -- .../emf/create/DataTypeToADSSyntaxMapProvider.java | 54 -- .../schema/emf/create/EAttributeTypeCreator.java | 113 ---- .../schema/emf/create/EObjectClassCreator.java | 202 ------ .../emf/create/EObjectClassCreatorHelper.java | 378 ----------- .../schema/emf/create/EReferenceTypeCreator.java | 95 --- .../schema/emf/create/EcoreTypeSystemHelper.java | 388 ----------- .../schema/emf/create/ModelTypeSystemCreator.java | 56 -- .../destroy/ECascadingObjectClassDestroyer.java | 145 ---- .../schema/emf/destroy/EObjectClassDestroyer.java | 90 --- .../destroy/EStructuralFeatureTypeDestroyer.java | 61 -- .../ldap/schema/emf/provide/SyntaxOIDProvider.java | 62 -- .../ldap/schema/setup/test/AbstractTestSetup.java | 50 -- .../ldap/schema/setup/test/DASContextSetup.java | 56 -- .../schema/setup/test/DASContextSetupTest.java | 34 - .../schema/setup/test/DASSchemaContextsSetup.java | 191 ------ .../setup/test/DASSchemaContextsSetupTest.java | 48 -- .../setup/test/EcoreSchemaAndDASContextsSetup.java | 131 ---- .../test/EcoreSchemaAndDASContextsSetupTest.java | 56 -- .../setup/test/EcoreSchemaContextsSetup.java | 132 ---- .../setup/test/EcoreSchemaContextsSetupTest.java | 45 -- .../ldap/schema/setup/test/SchemaContextSetup.java | 21 - .../schema/setup/test/SchemaContextSetupTest.java | 25 - .../schema/setup/test/SchemaContextsSetup.java | 231 ------- .../schema/setup/test/SchemaContextsSetupTest.java | 71 -- .../schema/setup/test/XSDSchemaContextsSetup.java | 76 --- .../setup/test/XSDSchemaContextsSetupTest.java | 35 - .../testing/constants/DASTestingConstants.java | 9 - .../ldap/util/ComplexTypeNamespaceQualifier.java | 39 -- .../apache/tuscany/das/ldap/util/IDGenerator.java | 10 - .../org/apache/tuscany/das/ldap/util/JNDIUtil.java | 168 ----- .../tuscany/das/ldap/util/LDAPNormalizer.java | 38 -- .../das/ldap/util/QualifiedNameNormalizer.java | 36 - .../ldap/util/SimpleTypeNamespaceQualifier.java | 39 -- .../XSDNamespaceToInitialContextTransformer.java | 49 -- .../das/ldap/util/XSDNamespaceURITokenizer.java | 26 - .../connect/test/ADSEmbeddedConnectionTest.java | 54 -- .../test/InitialContextCreatorHelperTest.java | 189 ------ .../create/test/InitialContextCreatorTest.java | 73 --- .../ldap/create/test/MetaContextCreatorTest.java | 69 -- .../create/test/UniqueOIDCreatorHelperTest.java | 53 -- .../destroy/test/InitialContextDestroyerTest.java | 78 --- .../emf/create/test/EDataGraphCreatorTest.java | 126 ---- .../emf/create/test/EDataObjectCreatorTest.java | 85 --- .../ldap/emf/read/test/EDataGraphReaderTest.java | 156 ----- .../ldap/emf/read/test/EDataObjectReaderTest.java | 62 -- .../das/ldap/emf/test/LdapDASHelperTest.java | 185 ------ .../tuscany/das/ldap/emf/test/LdapDASTest.java | 437 ------------- .../ldap/emf/update/test/EDataGraphUpdateTest.java | 180 ----- .../das/ldap/learning/test/LearningTest.java | 38 -- .../emf/create/test/EAttributeTypeCreatorTest.java | 127 ---- .../create/test/EObjectClassCreatorHelperTest.java | 103 --- .../emf/create/test/EObjectClassCreatorTest.java | 411 ------------ .../emf/create/test/EReferenceTypeCreatorTest.java | 125 ---- .../test/EcoreTypeSystemCreatorHelperTest.java | 58 -- .../test/ECascadingObjectClassDestroyerTest.java | 397 ----------- .../destroy/test/EObjectClassDestroyerTest.java | 457 ------------- .../tuscany/das/ldap/util/test/JNDIUtilTest.java | 109 ---- .../util/test/QualifiedNameNormalizerTest.java | 42 -- .../util/test/XSDNamespaceURITokenizerTest.java | 36 - .../das.ldap/src/test/resources/log4j.properties | 6 - java/das/ldap/pom.xml | 270 -------- 147 files changed, 17177 deletions(-) delete mode 100644 java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.ecore delete mode 100644 java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.genmodel delete mode 100644 java/das/ldap/das.ldap.configuration.model.ecore.v100/pom.xml delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/META-INF/MANIFEST.MF delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/build.properties delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/plugin.properties delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/plugin.xml delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/pom.xml delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/Configuration.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/ConfigurationFactory.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/DASMeta.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationFactoryImpl.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationImpl.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationPackageImpl.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/DASMetaImpl.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationAdapterFactory.java delete mode 100644 java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationSwitch.java delete mode 100644 java/das/ldap/das.ldap.constants/pom.xml delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/ApacheDSConnectionConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/DASConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/SyntaxOIDValues.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/AttributeTypeConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/EnumeratedSchemaAttributeTypeValues.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/ObjectClassConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/PartitionConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaAttributeTypeConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaObjectClassConstants.java delete mode 100644 java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SystemSchemaConstants.java delete mode 100644 java/das/ldap/das.ldap/pom.xml delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/ADSEmbeddedConnection.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/JNDIConnection.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreatorHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/MetaContextCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/InitialContextDestroyer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/MetaContextDestroyer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/Context.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDAS.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDASHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreatorHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreatorHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReader.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReaderHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReader.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReaderHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdater.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdaterHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/constants/EncryptionConstants.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/util/ChecksumUtils.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/ComplexTypeOIDCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/OIDCreatorHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/SimpleTypeOIDCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/CommonSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataGraphSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataObjectSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/LdapDASSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractAttributeTypeCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractTypeCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/ComplexTypeRDNCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SimpleTypeRDNCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/DataTypeToADSSyntaxMapProvider.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/provide/SyntaxOIDProvider.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetup.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetupTest.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/testing/constants/DASTestingConstants.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/ComplexTypeNamespaceQualifier.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/IDGenerator.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/JNDIUtil.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/LDAPNormalizer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/QualifiedNameNormalizer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/SimpleTypeNamespaceQualifier.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceToInitialContextTransformer.java delete mode 100644 java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceURITokenizer.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/connect/test/ADSEmbeddedConnectionTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/MetaContextCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataGraphCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASHelperTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/update/test/EDataGraphUpdateTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/JNDIUtilTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/QualifiedNameNormalizerTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/XSDNamespaceURITokenizerTest.java delete mode 100644 java/das/ldap/das.ldap/src/test/resources/log4j.properties delete mode 100644 java/das/ldap/pom.xml (limited to 'java/das/ldap') diff --git a/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.ecore b/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.ecore deleted file mode 100644 index 0ba9341bcc..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.ecore +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.genmodel b/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.genmodel deleted file mode 100644 index 0535a4bbcc..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.ecore.v100/model/model.genmodel +++ /dev/null @@ -1,35 +0,0 @@ - - - model.ecore - http://www.eclipse.org/emf/2003/SDO - EMF_COMMONJ_SDO=org.eclipse.emf.commonj.sdo - EMF_ECORE_SDO=org.eclipse.emf.ecore.sdo - - - - - - - - - - - - - - - - - - - diff --git a/java/das/ldap/das.ldap.configuration.model.ecore.v100/pom.xml b/java/das/ldap/das.ldap.configuration.model.ecore.v100/pom.xml deleted file mode 100644 index 2d862f55b2..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.ecore.v100/pom.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - tuscany-das-ldap - org.apache.tuscany.das - 1.0-SNAPSHOT - - 4.0.0 - das.ldap.configuration.model.ecore.v100 - - - \ No newline at end of file diff --git a/java/das/ldap/das.ldap.configuration.model.v100/META-INF/MANIFEST.MF b/java/das/ldap/das.ldap.configuration.model.v100/META-INF/MANIFEST.MF deleted file mode 100644 index e9569eefae..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/META-INF/MANIFEST.MF +++ /dev/null @@ -1,17 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: das.ldap.configuration.model.ecore.v100; singleton:=true -Bundle-Version: 1.0.0 -Bundle-ClassPath: . -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.apache.tuscany.model, - org.apache.tuscany.model.impl, - org.apache.tuscany.model.util -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.emf.ecore;visibility:=reexport, - org.eclipse.emf.commonj.sdo;visibility:=reexport, - org.eclipse.emf.ecore.sdo;visibility:=reexport -Eclipse-LazyStart: true diff --git a/java/das/ldap/das.ldap.configuration.model.v100/build.properties b/java/das/ldap/das.ldap.configuration.model.v100/build.properties deleted file mode 100644 index 66d9c2d48b..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/build.properties +++ /dev/null @@ -1,14 +0,0 @@ - -# -# -# -# $Id$ - -bin.includes = .,\ - model/,\ - META-INF/,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -source.. = src/ -output.. = bin/ diff --git a/java/das/ldap/das.ldap.configuration.model.v100/plugin.properties b/java/das/ldap/das.ldap.configuration.model.v100/plugin.properties deleted file mode 100644 index 2eb18d8518..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/plugin.properties +++ /dev/null @@ -1,20 +0,0 @@ - -# -# -# -# $Id$ - -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ==================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ==================================================================== - -pluginName = Model Model -providerName = www.example.org diff --git a/java/das/ldap/das.ldap.configuration.model.v100/plugin.xml b/java/das/ldap/das.ldap.configuration.model.v100/plugin.xml deleted file mode 100644 index d840c5a51b..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/plugin.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - diff --git a/java/das/ldap/das.ldap.configuration.model.v100/pom.xml b/java/das/ldap/das.ldap.configuration.model.v100/pom.xml deleted file mode 100644 index 27da7eddc6..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/pom.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - tuscany-das-ldap - org.apache.tuscany.das - 1.0-SNAPSHOT - - 4.0.0 - das.ldap.configuration.model.v100 - - - http://pyramidetechnologies.com/model/archetype - - - - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - - junit - junit - - - org.eclipse.emf - ant - - - org.eclipse.emf - codegen - - - org.eclipse.emf - codegen-ecore - - - org.eclipse.emf - codegen-ecore-ui - - - org.eclipse.emf - codegen-ui - - - org.eclipse.emf - common - - - org.eclipse.emf - commonj-sdo - - - org.eclipse.emf - common-ui - - - org.eclipse.emf - converter - - - org.eclipse.emf - ecore - - - org.eclipse.emf - ecore-change - - - org.eclipse.emf - ecore-change-edit - - - org.eclipse.emf - ecore-edit - - - org.eclipse.emf - ecore-sdo - - - org.eclipse.emf - ecore-sdo-edit - - - org.eclipse.emf - ecore-xmi - - - org.eclipse.emf - edit - - - org.eclipse.emf - edit-ui - - - org.eclipse.emf - emf - - - org.eclipse.emf - exporter - - - org.eclipse.emf - importer - - - org.eclipse.emf - importer-ecore - - - org.eclipse.emf - importer-java - - - org.eclipse.emf - importer-rose - - - org.eclipse.emf - mapping - - - org.eclipse.emf - mapping-ecore2ecore - - - org.eclipse.emf - mapping-ecore2ecore-editor - - - org.eclipse.emf - mapping-ecore2xml - - - org.eclipse.emf - mapping-ecore2xml-ui - - - org.eclipse.emf - mapping-ui - - - org.eclipse.emf - mapping-xsd2ecore - - - org.eclipse.emf - mapping-xsd2ecore-editor - - - org.eclipse.xsd - ecore-exporter - - - org.eclipse.xsd - ecore-importer - - - org.eclipse.xsd - edit - - - org.eclipse.xsd - xsd - - - \ No newline at end of file diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/Configuration.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/Configuration.java deleted file mode 100644 index f885a91f68..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/Configuration.java +++ /dev/null @@ -1,296 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model; - - -/** - * - * A representation of the model object 'Configuration'. - * - * - *

- * The following features are supported: - *

- *

- * - * @model - * @generated - */ -public interface Configuration -{ - /** - * Returns the value of the 'Host' attribute. - * The default value is "localhost". - * - *

- * If the meaning of the 'Host' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Host' attribute. - * @see #setHost(String) - * @model default="localhost" - * @generated - */ - String getHost(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getHost Host}' attribute. - * - * - * @param value the new value of the 'Host' attribute. - * @see #getHost() - * @generated - */ - void setHost(String value); - - /** - * Returns the value of the 'Port' attribute. - * The default value is "10389". - * - *

- * If the meaning of the 'Port' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Port' attribute. - * @see #setPort(String) - * @model default="10389" - * @generated - */ - String getPort(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getPort Port}' attribute. - * - * - * @param value the new value of the 'Port' attribute. - * @see #getPort() - * @generated - */ - void setPort(String value); - - /** - * Returns the value of the 'Initial Context Factory' attribute. - * The default value is "org.apache.directory.server.core.jndi.CoreContextFactory". - * - *

- * If the meaning of the 'Initial Context Factory' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Initial Context Factory' attribute. - * @see #setInitialContextFactory(String) - * @model default="org.apache.directory.server.core.jndi.CoreContextFactory" - * @generated - */ - String getInitialContextFactory(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getInitialContextFactory Initial Context Factory}' attribute. - * - * - * @param value the new value of the 'Initial Context Factory' attribute. - * @see #getInitialContextFactory() - * @generated - */ - void setInitialContextFactory(String value); - - /** - * Returns the value of the 'Das Partition Name' attribute. - * The default value is "das". - * - *

- * If the meaning of the 'Das Partition Name' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Das Partition Name' attribute. - * @see #setDasPartitionName(String) - * @model default="das" - * @generated - */ - String getDasPartitionName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getDasPartitionName Das Partition Name}' attribute. - * - * - * @param value the new value of the 'Das Partition Name' attribute. - * @see #getDasPartitionName() - * @generated - */ - void setDasPartitionName(String value); - - /** - * Returns the value of the 'Schema Partition Name' attribute. - * The default value is "schema". - * - *

- * If the meaning of the 'Schema Partition Name' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Schema Partition Name' attribute. - * @see #setSchemaPartitionName(String) - * @model default="schema" - * @generated - */ - String getSchemaPartitionName(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getSchemaPartitionName Schema Partition Name}' attribute. - * - * - * @param value the new value of the 'Schema Partition Name' attribute. - * @see #getSchemaPartitionName() - * @generated - */ - void setSchemaPartitionName(String value); - - /** - * Returns the value of the 'Security Principal' attribute. - * The default value is "uid=admin,ou=system". - * - *

- * If the meaning of the 'Security Principal' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Security Principal' attribute. - * @see #setSecurityPrincipal(String) - * @model default="uid=admin,ou=system" - * @generated - */ - String getSecurityPrincipal(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getSecurityPrincipal Security Principal}' attribute. - * - * - * @param value the new value of the 'Security Principal' attribute. - * @see #getSecurityPrincipal() - * @generated - */ - void setSecurityPrincipal(String value); - - /** - * Returns the value of the 'Security Authentication Type' attribute. - * The default value is "simple". - * - *

- * If the meaning of the 'Security Authentication Type' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Security Authentication Type' attribute. - * @see #setSecurityAuthenticationType(String) - * @model default="simple" - * @generated - */ - String getSecurityAuthenticationType(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getSecurityAuthenticationType Security Authentication Type}' attribute. - * - * - * @param value the new value of the 'Security Authentication Type' attribute. - * @see #getSecurityAuthenticationType() - * @generated - */ - void setSecurityAuthenticationType(String value); - - /** - * Returns the value of the 'Security Credentials' attribute. - * The default value is "secret". - * - *

- * If the meaning of the 'Security Credentials' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Security Credentials' attribute. - * @see #setSecurityCredentials(String) - * @model default="secret" - * @generated - */ - String getSecurityCredentials(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getSecurityCredentials Security Credentials}' attribute. - * - * - * @param value the new value of the 'Security Credentials' attribute. - * @see #getSecurityCredentials() - * @generated - */ - void setSecurityCredentials(String value); - - /** - * Returns the value of the 'Nlog4j Configuration File Path' attribute. - * The default value is "src/test/resources/log4j.properties". - * - *

- * If the meaning of the 'Nlog4j Configuration File Path' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Nlog4j Configuration File Path' attribute. - * @see #setNlog4jConfigurationFilePath(String) - * @model default="src/test/resources/log4j.properties" - * @generated - */ - String getNlog4jConfigurationFilePath(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#getNlog4jConfigurationFilePath Nlog4j Configuration File Path}' attribute. - * - * - * @param value the new value of the 'Nlog4j Configuration File Path' attribute. - * @see #getNlog4jConfigurationFilePath() - * @generated - */ - void setNlog4jConfigurationFilePath(String value); - - /** - * Returns the value of the 'Embedded' attribute. - * The default value is "false". - * - *

- * If the meaning of the 'Embedded' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Embedded' attribute. - * @see #setEmbedded(boolean) - * @model default="false" - * @generated - */ - boolean isEmbedded(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.Configuration#isEmbedded Embedded}' attribute. - * - * - * @param value the new value of the 'Embedded' attribute. - * @see #isEmbedded() - * @generated - */ - void setEmbedded(boolean value); - -} // Configuration diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/ConfigurationFactory.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/ConfigurationFactory.java deleted file mode 100644 index 5edfd1230e..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/ConfigurationFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model; - - -/** - * - * The Factory for the model. - * It provides a create method for each non-abstract class of the model. - * - * @generated - */ -public interface ConfigurationFactory -{ - /** - * The singleton instance of the factory. - * - * - * @generated - */ - ConfigurationFactory INSTANCE = org.apache.tuscany.model.impl.ConfigurationFactoryImpl.eINSTANCE; - - /** - * Returns a new object of class 'Configuration'. - * - * - * @return a new object of class 'Configuration'. - * @generated - */ - Configuration createConfiguration(); - - /** - * Returns a new object of class 'DAS Meta'. - * - * - * @return a new object of class 'DAS Meta'. - * @generated - */ - DASMeta createDASMeta(); - -} //ConfigurationFactory diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/DASMeta.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/DASMeta.java deleted file mode 100644 index cd424ffa9c..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/DASMeta.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model; - -import java.util.List; - -/** - * - * A representation of the model object 'DAS Meta'. - * - * - *

- * The following features are supported: - *

- *

- * - * @model - * @generated - */ -public interface DASMeta -{ - /** - * Returns the value of the 'Supported Schemas' attribute list. - * The list contents are of type {@link java.lang.String}. - * - *

- * If the meaning of the 'Supported Schemas' attribute list isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Supported Schemas' attribute list. - * @model default="localhost" - * @generated - */ - List getSupportedSchemas(); - - /** - * Returns the value of the 'Id' attribute. - * The default value is "0". - * - *

- * If the meaning of the 'Id' attribute isn't clear, - * there really should be more of a description here... - *

- * - * @return the value of the 'Id' attribute. - * @see #setId(String) - * @model default="0" id="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.apache.tuscany.model.DASMeta#getId Id}' attribute. - * - * - * @param value the new value of the 'Id' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - -} // DASMeta diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationFactoryImpl.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationFactoryImpl.java deleted file mode 100644 index e22a4e1a30..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationFactoryImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.impl; - -import org.apache.tuscany.model.*; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -/** - * - * An implementation of the model Factory. - * - * @generated - */ -public class ConfigurationFactoryImpl extends EFactoryImpl implements ConfigurationFactory -{ - /** - * The singleton instance of the factory. - * - * - * @generated - */ - public static final ConfigurationFactoryImpl eINSTANCE = init(); - - /** - * Creates the default factory implementation. - * - * - * @generated - */ - public static ConfigurationFactoryImpl init() - { - try - { - ConfigurationFactoryImpl theConfigurationFactory = (ConfigurationFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("http://org.apache.tuscany/das.ldap.configuration.model.ecore.v100"); - if (theConfigurationFactory != null) - { - return theConfigurationFactory; - } - } - catch (Exception exception) - { - EcorePlugin.INSTANCE.log(exception); - } - return new ConfigurationFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * - * - * @generated - */ - public ConfigurationFactoryImpl() - { - super(); - } - - /** - * - * - * @generated - */ - @Override - public EObject create(EClass eClass) - { - switch (eClass.getClassifierID()) - { - case ConfigurationPackageImpl.CONFIGURATION: return (EObject)createConfiguration(); - case ConfigurationPackageImpl.DAS_META: return (EObject)createDASMeta(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); - } - } - - /** - * - * - * @generated - */ - public Configuration createConfiguration() - { - ConfigurationImpl configuration = new ConfigurationImpl(); - return configuration; - } - - /** - * - * - * @generated - */ - public DASMeta createDASMeta() - { - DASMetaImpl dasMeta = new DASMetaImpl(); - return dasMeta; - } - - /** - * - * - * @generated - */ - public ConfigurationPackageImpl getConfigurationPackageImpl() - { - return (ConfigurationPackageImpl)getEPackage(); - } - - /** - * - * - * @deprecated - * @generated - */ - @Deprecated - public static ConfigurationPackageImpl getPackage() - { - return ConfigurationPackageImpl.eINSTANCE; - } - -} //ConfigurationFactoryImpl diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationImpl.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationImpl.java deleted file mode 100644 index cbc280ebf5..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationImpl.java +++ /dev/null @@ -1,692 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.impl; - -import org.apache.tuscany.model.Configuration; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.sdo.impl.EDataObjectImpl; - -/** - * - * An implementation of the model object 'Configuration'. - * - *

- * The following features are implemented: - *

- *

- * - * @generated - */ -public class ConfigurationImpl extends EDataObjectImpl implements Configuration -{ - /** - * - * - * @generated - */ - private static final long serialVersionUID = 1L; - - /** - * The default value of the '{@link #getHost() Host}' attribute. - * - * - * @see #getHost() - * @generated - * @ordered - */ - protected static final String HOST_EDEFAULT = "localhost"; - - /** - * The cached value of the '{@link #getHost() Host}' attribute. - * - * - * @see #getHost() - * @generated - * @ordered - */ - protected String host = HOST_EDEFAULT; - - /** - * The default value of the '{@link #getPort() Port}' attribute. - * - * - * @see #getPort() - * @generated - * @ordered - */ - protected static final String PORT_EDEFAULT = "10389"; - - /** - * The cached value of the '{@link #getPort() Port}' attribute. - * - * - * @see #getPort() - * @generated - * @ordered - */ - protected String port = PORT_EDEFAULT; - - /** - * The default value of the '{@link #getInitialContextFactory() Initial Context Factory}' attribute. - * - * - * @see #getInitialContextFactory() - * @generated - * @ordered - */ - protected static final String INITIAL_CONTEXT_FACTORY_EDEFAULT = "org.apache.directory.server.core.jndi.CoreContextFactory"; - - /** - * The cached value of the '{@link #getInitialContextFactory() Initial Context Factory}' attribute. - * - * - * @see #getInitialContextFactory() - * @generated - * @ordered - */ - protected String initialContextFactory = INITIAL_CONTEXT_FACTORY_EDEFAULT; - - /** - * The default value of the '{@link #getDasPartitionName() Das Partition Name}' attribute. - * - * - * @see #getDasPartitionName() - * @generated - * @ordered - */ - protected static final String DAS_PARTITION_NAME_EDEFAULT = "das"; - - /** - * The cached value of the '{@link #getDasPartitionName() Das Partition Name}' attribute. - * - * - * @see #getDasPartitionName() - * @generated - * @ordered - */ - protected String dasPartitionName = DAS_PARTITION_NAME_EDEFAULT; - - /** - * The default value of the '{@link #getSchemaPartitionName() Schema Partition Name}' attribute. - * - * - * @see #getSchemaPartitionName() - * @generated - * @ordered - */ - protected static final String SCHEMA_PARTITION_NAME_EDEFAULT = "schema"; - - /** - * The cached value of the '{@link #getSchemaPartitionName() Schema Partition Name}' attribute. - * - * - * @see #getSchemaPartitionName() - * @generated - * @ordered - */ - protected String schemaPartitionName = SCHEMA_PARTITION_NAME_EDEFAULT; - - /** - * The default value of the '{@link #getSecurityPrincipal() Security Principal}' attribute. - * - * - * @see #getSecurityPrincipal() - * @generated - * @ordered - */ - protected static final String SECURITY_PRINCIPAL_EDEFAULT = "uid=admin,ou=system"; - - /** - * The cached value of the '{@link #getSecurityPrincipal() Security Principal}' attribute. - * - * - * @see #getSecurityPrincipal() - * @generated - * @ordered - */ - protected String securityPrincipal = SECURITY_PRINCIPAL_EDEFAULT; - - /** - * The default value of the '{@link #getSecurityAuthenticationType() Security Authentication Type}' attribute. - * - * - * @see #getSecurityAuthenticationType() - * @generated - * @ordered - */ - protected static final String SECURITY_AUTHENTICATION_TYPE_EDEFAULT = "simple"; - - /** - * The cached value of the '{@link #getSecurityAuthenticationType() Security Authentication Type}' attribute. - * - * - * @see #getSecurityAuthenticationType() - * @generated - * @ordered - */ - protected String securityAuthenticationType = SECURITY_AUTHENTICATION_TYPE_EDEFAULT; - - /** - * The default value of the '{@link #getSecurityCredentials() Security Credentials}' attribute. - * - * - * @see #getSecurityCredentials() - * @generated - * @ordered - */ - protected static final String SECURITY_CREDENTIALS_EDEFAULT = "secret"; - - /** - * The cached value of the '{@link #getSecurityCredentials() Security Credentials}' attribute. - * - * - * @see #getSecurityCredentials() - * @generated - * @ordered - */ - protected String securityCredentials = SECURITY_CREDENTIALS_EDEFAULT; - - /** - * The default value of the '{@link #getNlog4jConfigurationFilePath() Nlog4j Configuration File Path}' attribute. - * - * - * @see #getNlog4jConfigurationFilePath() - * @generated - * @ordered - */ - protected static final String NLOG4J_CONFIGURATION_FILE_PATH_EDEFAULT = "src/test/resources/log4j.properties"; - - /** - * The cached value of the '{@link #getNlog4jConfigurationFilePath() Nlog4j Configuration File Path}' attribute. - * - * - * @see #getNlog4jConfigurationFilePath() - * @generated - * @ordered - */ - protected String nlog4jConfigurationFilePath = NLOG4J_CONFIGURATION_FILE_PATH_EDEFAULT; - - /** - * The default value of the '{@link #isEmbedded() Embedded}' attribute. - * - * - * @see #isEmbedded() - * @generated - * @ordered - */ - protected static final boolean EMBEDDED_EDEFAULT = false; - - /** - * The cached value of the '{@link #isEmbedded() Embedded}' attribute. - * - * - * @see #isEmbedded() - * @generated - * @ordered - */ - protected boolean embedded = EMBEDDED_EDEFAULT; - - /** - * - * - * @generated - */ - protected ConfigurationImpl() - { - super(); - } - - /** - * - * - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ConfigurationPackageImpl.Literals.CONFIGURATION; - } - - /** - * - * - * @generated - */ - public String getHost() - { - return host; - } - - /** - * - * - * @generated - */ - public void setHost(String newHost) - { - String oldHost = host; - host = newHost; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__HOST, oldHost, host)); - } - - /** - * - * - * @generated - */ - public String getPort() - { - return port; - } - - /** - * - * - * @generated - */ - public void setPort(String newPort) - { - String oldPort = port; - port = newPort; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__PORT, oldPort, port)); - } - - /** - * - * - * @generated - */ - public String getInitialContextFactory() - { - return initialContextFactory; - } - - /** - * - * - * @generated - */ - public void setInitialContextFactory(String newInitialContextFactory) - { - String oldInitialContextFactory = initialContextFactory; - initialContextFactory = newInitialContextFactory; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__INITIAL_CONTEXT_FACTORY, oldInitialContextFactory, initialContextFactory)); - } - - /** - * - * - * @generated - */ - public String getDasPartitionName() - { - return dasPartitionName; - } - - /** - * - * - * @generated - */ - public void setDasPartitionName(String newDasPartitionName) - { - String oldDasPartitionName = dasPartitionName; - dasPartitionName = newDasPartitionName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__DAS_PARTITION_NAME, oldDasPartitionName, dasPartitionName)); - } - - /** - * - * - * @generated - */ - public String getSchemaPartitionName() - { - return schemaPartitionName; - } - - /** - * - * - * @generated - */ - public void setSchemaPartitionName(String newSchemaPartitionName) - { - String oldSchemaPartitionName = schemaPartitionName; - schemaPartitionName = newSchemaPartitionName; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__SCHEMA_PARTITION_NAME, oldSchemaPartitionName, schemaPartitionName)); - } - - /** - * - * - * @generated - */ - public String getSecurityPrincipal() - { - return securityPrincipal; - } - - /** - * - * - * @generated - */ - public void setSecurityPrincipal(String newSecurityPrincipal) - { - String oldSecurityPrincipal = securityPrincipal; - securityPrincipal = newSecurityPrincipal; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__SECURITY_PRINCIPAL, oldSecurityPrincipal, securityPrincipal)); - } - - /** - * - * - * @generated - */ - public String getSecurityAuthenticationType() - { - return securityAuthenticationType; - } - - /** - * - * - * @generated - */ - public void setSecurityAuthenticationType(String newSecurityAuthenticationType) - { - String oldSecurityAuthenticationType = securityAuthenticationType; - securityAuthenticationType = newSecurityAuthenticationType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__SECURITY_AUTHENTICATION_TYPE, oldSecurityAuthenticationType, securityAuthenticationType)); - } - - /** - * - * - * @generated - */ - public String getSecurityCredentials() - { - return securityCredentials; - } - - /** - * - * - * @generated - */ - public void setSecurityCredentials(String newSecurityCredentials) - { - String oldSecurityCredentials = securityCredentials; - securityCredentials = newSecurityCredentials; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__SECURITY_CREDENTIALS, oldSecurityCredentials, securityCredentials)); - } - - /** - * - * - * @generated - */ - public String getNlog4jConfigurationFilePath() - { - return nlog4jConfigurationFilePath; - } - - /** - * - * - * @generated - */ - public void setNlog4jConfigurationFilePath(String newNlog4jConfigurationFilePath) - { - String oldNlog4jConfigurationFilePath = nlog4jConfigurationFilePath; - nlog4jConfigurationFilePath = newNlog4jConfigurationFilePath; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH, oldNlog4jConfigurationFilePath, nlog4jConfigurationFilePath)); - } - - /** - * - * - * @generated - */ - public boolean isEmbedded() - { - return embedded; - } - - /** - * - * - * @generated - */ - public void setEmbedded(boolean newEmbedded) - { - boolean oldEmbedded = embedded; - embedded = newEmbedded; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.CONFIGURATION__EMBEDDED, oldEmbedded, embedded)); - } - - /** - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ConfigurationPackageImpl.CONFIGURATION__HOST: - return getHost(); - case ConfigurationPackageImpl.CONFIGURATION__PORT: - return getPort(); - case ConfigurationPackageImpl.CONFIGURATION__INITIAL_CONTEXT_FACTORY: - return getInitialContextFactory(); - case ConfigurationPackageImpl.CONFIGURATION__DAS_PARTITION_NAME: - return getDasPartitionName(); - case ConfigurationPackageImpl.CONFIGURATION__SCHEMA_PARTITION_NAME: - return getSchemaPartitionName(); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_PRINCIPAL: - return getSecurityPrincipal(); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_AUTHENTICATION_TYPE: - return getSecurityAuthenticationType(); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_CREDENTIALS: - return getSecurityCredentials(); - case ConfigurationPackageImpl.CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH: - return getNlog4jConfigurationFilePath(); - case ConfigurationPackageImpl.CONFIGURATION__EMBEDDED: - return isEmbedded() ? Boolean.TRUE : Boolean.FALSE; - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ConfigurationPackageImpl.CONFIGURATION__HOST: - setHost((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__PORT: - setPort((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__INITIAL_CONTEXT_FACTORY: - setInitialContextFactory((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__DAS_PARTITION_NAME: - setDasPartitionName((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__SCHEMA_PARTITION_NAME: - setSchemaPartitionName((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_PRINCIPAL: - setSecurityPrincipal((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_AUTHENTICATION_TYPE: - setSecurityAuthenticationType((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_CREDENTIALS: - setSecurityCredentials((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH: - setNlog4jConfigurationFilePath((String)newValue); - return; - case ConfigurationPackageImpl.CONFIGURATION__EMBEDDED: - setEmbedded(((Boolean)newValue).booleanValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ConfigurationPackageImpl.CONFIGURATION__HOST: - setHost(HOST_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__PORT: - setPort(PORT_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__INITIAL_CONTEXT_FACTORY: - setInitialContextFactory(INITIAL_CONTEXT_FACTORY_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__DAS_PARTITION_NAME: - setDasPartitionName(DAS_PARTITION_NAME_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__SCHEMA_PARTITION_NAME: - setSchemaPartitionName(SCHEMA_PARTITION_NAME_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_PRINCIPAL: - setSecurityPrincipal(SECURITY_PRINCIPAL_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_AUTHENTICATION_TYPE: - setSecurityAuthenticationType(SECURITY_AUTHENTICATION_TYPE_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_CREDENTIALS: - setSecurityCredentials(SECURITY_CREDENTIALS_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH: - setNlog4jConfigurationFilePath(NLOG4J_CONFIGURATION_FILE_PATH_EDEFAULT); - return; - case ConfigurationPackageImpl.CONFIGURATION__EMBEDDED: - setEmbedded(EMBEDDED_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ConfigurationPackageImpl.CONFIGURATION__HOST: - return HOST_EDEFAULT == null ? host != null : !HOST_EDEFAULT.equals(host); - case ConfigurationPackageImpl.CONFIGURATION__PORT: - return PORT_EDEFAULT == null ? port != null : !PORT_EDEFAULT.equals(port); - case ConfigurationPackageImpl.CONFIGURATION__INITIAL_CONTEXT_FACTORY: - return INITIAL_CONTEXT_FACTORY_EDEFAULT == null ? initialContextFactory != null : !INITIAL_CONTEXT_FACTORY_EDEFAULT.equals(initialContextFactory); - case ConfigurationPackageImpl.CONFIGURATION__DAS_PARTITION_NAME: - return DAS_PARTITION_NAME_EDEFAULT == null ? dasPartitionName != null : !DAS_PARTITION_NAME_EDEFAULT.equals(dasPartitionName); - case ConfigurationPackageImpl.CONFIGURATION__SCHEMA_PARTITION_NAME: - return SCHEMA_PARTITION_NAME_EDEFAULT == null ? schemaPartitionName != null : !SCHEMA_PARTITION_NAME_EDEFAULT.equals(schemaPartitionName); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_PRINCIPAL: - return SECURITY_PRINCIPAL_EDEFAULT == null ? securityPrincipal != null : !SECURITY_PRINCIPAL_EDEFAULT.equals(securityPrincipal); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_AUTHENTICATION_TYPE: - return SECURITY_AUTHENTICATION_TYPE_EDEFAULT == null ? securityAuthenticationType != null : !SECURITY_AUTHENTICATION_TYPE_EDEFAULT.equals(securityAuthenticationType); - case ConfigurationPackageImpl.CONFIGURATION__SECURITY_CREDENTIALS: - return SECURITY_CREDENTIALS_EDEFAULT == null ? securityCredentials != null : !SECURITY_CREDENTIALS_EDEFAULT.equals(securityCredentials); - case ConfigurationPackageImpl.CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH: - return NLOG4J_CONFIGURATION_FILE_PATH_EDEFAULT == null ? nlog4jConfigurationFilePath != null : !NLOG4J_CONFIGURATION_FILE_PATH_EDEFAULT.equals(nlog4jConfigurationFilePath); - case ConfigurationPackageImpl.CONFIGURATION__EMBEDDED: - return embedded != EMBEDDED_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * - * - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (host: "); - result.append(host); - result.append(", port: "); - result.append(port); - result.append(", initialContextFactory: "); - result.append(initialContextFactory); - result.append(", dasPartitionName: "); - result.append(dasPartitionName); - result.append(", schemaPartitionName: "); - result.append(schemaPartitionName); - result.append(", securityPrincipal: "); - result.append(securityPrincipal); - result.append(", securityAuthenticationType: "); - result.append(securityAuthenticationType); - result.append(", securityCredentials: "); - result.append(securityCredentials); - result.append(", nlog4jConfigurationFilePath: "); - result.append(nlog4jConfigurationFilePath); - result.append(", embedded: "); - result.append(embedded); - result.append(')'); - return result.toString(); - } - -} //ConfigurationImpl diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationPackageImpl.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationPackageImpl.java deleted file mode 100644 index 15afe8aa32..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/ConfigurationPackageImpl.java +++ /dev/null @@ -1,726 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.impl; - -import org.apache.tuscany.model.Configuration; -import org.apache.tuscany.model.ConfigurationFactory; -import org.apache.tuscany.model.DASMeta; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -/** - * - * The Package for the model. - * It contains accessors for the meta objects to represent - * - * - * @see org.apache.tuscany.model.ConfigurationFactory - * @model kind="package" - * @generated - */ -public class ConfigurationPackageImpl extends EPackageImpl -{ - /** - * The package name. - * - * - * @generated - */ - public static final String eNAME = "model"; - - /** - * The package namespace URI. - * - * - * @generated - */ - public static final String eNS_URI = "http://org.apache.tuscany/das.ldap.configuration.model.ecore.v100"; - - /** - * The package namespace name. - * - * - * @generated - */ - public static final String eNS_PREFIX = "tuscany"; - - /** - * The singleton instance of the package. - * - * - * @generated - */ - public static final ConfigurationPackageImpl eINSTANCE = org.apache.tuscany.model.impl.ConfigurationPackageImpl.init(); - - /** - * The meta object id for the '{@link org.apache.tuscany.model.impl.ConfigurationImpl Configuration}' class. - * - * - * @see org.apache.tuscany.model.impl.ConfigurationImpl - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl#getConfiguration() - * @generated - */ - public static final int CONFIGURATION = 0; - - /** - * The feature id for the 'Host' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__HOST = 0; - - /** - * The feature id for the 'Port' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__PORT = 1; - - /** - * The feature id for the 'Initial Context Factory' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__INITIAL_CONTEXT_FACTORY = 2; - - /** - * The feature id for the 'Das Partition Name' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__DAS_PARTITION_NAME = 3; - - /** - * The feature id for the 'Schema Partition Name' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__SCHEMA_PARTITION_NAME = 4; - - /** - * The feature id for the 'Security Principal' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__SECURITY_PRINCIPAL = 5; - - /** - * The feature id for the 'Security Authentication Type' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__SECURITY_AUTHENTICATION_TYPE = 6; - - /** - * The feature id for the 'Security Credentials' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__SECURITY_CREDENTIALS = 7; - - /** - * The feature id for the 'Nlog4j Configuration File Path' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH = 8; - - /** - * The feature id for the 'Embedded' attribute. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION__EMBEDDED = 9; - - /** - * The number of structural features of the 'Configuration' class. - * - * - * @generated - * @ordered - */ - public static final int CONFIGURATION_FEATURE_COUNT = 10; - - /** - * The meta object id for the '{@link org.apache.tuscany.model.impl.DASMetaImpl DAS Meta}' class. - * - * - * @see org.apache.tuscany.model.impl.DASMetaImpl - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl#getDASMeta() - * @generated - */ - public static final int DAS_META = 1; - - /** - * The feature id for the 'Supported Schemas' attribute list. - * - * - * @generated - * @ordered - */ - public static final int DAS_META__SUPPORTED_SCHEMAS = 0; - - /** - * The feature id for the 'Id' attribute. - * - * - * @generated - * @ordered - */ - public static final int DAS_META__ID = 1; - - /** - * The number of structural features of the 'DAS Meta' class. - * - * - * @generated - * @ordered - */ - public static final int DAS_META_FEATURE_COUNT = 2; - - /** - * - * - * @generated - */ - private EClass configurationEClass = null; - - /** - * - * - * @generated - */ - private EClass dasMetaEClass = null; - - /** - * Creates an instance of the model Package, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - *

Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * - * - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl#eNS_URI - * @see #init() - * @generated - */ - private ConfigurationPackageImpl() - { - super(eNS_URI, ((EFactory)ConfigurationFactory.INSTANCE)); - } - - /** - * - * - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the Package for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - *

Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - *

Invocation of this method will not affect any packages that have - * already been initialized. - * - * - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ConfigurationPackageImpl init() - { - if (isInited) return (ConfigurationPackageImpl)EPackage.Registry.INSTANCE.getEPackage(ConfigurationPackageImpl.eNS_URI); - - // Obtain or create and register package - ConfigurationPackageImpl theConfigurationPackageImpl = (ConfigurationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ConfigurationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ConfigurationPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theConfigurationPackageImpl.createPackageContents(); - - // Initialize created meta-data - theConfigurationPackageImpl.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theConfigurationPackageImpl.freeze(); - - return theConfigurationPackageImpl; - } - - - /** - * Returns the meta object for class '{@link org.apache.tuscany.model.Configuration Configuration}'. - * - * - * @return the meta object for class 'Configuration'. - * @see org.apache.tuscany.model.Configuration - * @generated - */ - public EClass getConfiguration() - { - return configurationEClass; - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getHost Host}'. - * - * - * @return the meta object for the attribute 'Host'. - * @see org.apache.tuscany.model.Configuration#getHost() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_Host() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getPort Port}'. - * - * - * @return the meta object for the attribute 'Port'. - * @see org.apache.tuscany.model.Configuration#getPort() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_Port() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getInitialContextFactory Initial Context Factory}'. - * - * - * @return the meta object for the attribute 'Initial Context Factory'. - * @see org.apache.tuscany.model.Configuration#getInitialContextFactory() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_InitialContextFactory() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(2); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getDasPartitionName Das Partition Name}'. - * - * - * @return the meta object for the attribute 'Das Partition Name'. - * @see org.apache.tuscany.model.Configuration#getDasPartitionName() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_DasPartitionName() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(3); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getSchemaPartitionName Schema Partition Name}'. - * - * - * @return the meta object for the attribute 'Schema Partition Name'. - * @see org.apache.tuscany.model.Configuration#getSchemaPartitionName() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_SchemaPartitionName() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(4); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getSecurityPrincipal Security Principal}'. - * - * - * @return the meta object for the attribute 'Security Principal'. - * @see org.apache.tuscany.model.Configuration#getSecurityPrincipal() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_SecurityPrincipal() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(5); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getSecurityAuthenticationType Security Authentication Type}'. - * - * - * @return the meta object for the attribute 'Security Authentication Type'. - * @see org.apache.tuscany.model.Configuration#getSecurityAuthenticationType() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_SecurityAuthenticationType() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(6); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getSecurityCredentials Security Credentials}'. - * - * - * @return the meta object for the attribute 'Security Credentials'. - * @see org.apache.tuscany.model.Configuration#getSecurityCredentials() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_SecurityCredentials() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(7); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#getNlog4jConfigurationFilePath Nlog4j Configuration File Path}'. - * - * - * @return the meta object for the attribute 'Nlog4j Configuration File Path'. - * @see org.apache.tuscany.model.Configuration#getNlog4jConfigurationFilePath() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_Nlog4jConfigurationFilePath() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(8); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.Configuration#isEmbedded Embedded}'. - * - * - * @return the meta object for the attribute 'Embedded'. - * @see org.apache.tuscany.model.Configuration#isEmbedded() - * @see #getConfiguration() - * @generated - */ - public EAttribute getConfiguration_Embedded() - { - return (EAttribute)configurationEClass.getEStructuralFeatures().get(9); - } - - /** - * Returns the meta object for class '{@link org.apache.tuscany.model.DASMeta DAS Meta}'. - * - * - * @return the meta object for class 'DAS Meta'. - * @see org.apache.tuscany.model.DASMeta - * @generated - */ - public EClass getDASMeta() - { - return dasMetaEClass; - } - - /** - * Returns the meta object for the attribute list '{@link org.apache.tuscany.model.DASMeta#getSupportedSchemas Supported Schemas}'. - * - * - * @return the meta object for the attribute list 'Supported Schemas'. - * @see org.apache.tuscany.model.DASMeta#getSupportedSchemas() - * @see #getDASMeta() - * @generated - */ - public EAttribute getDASMeta_SupportedSchemas() - { - return (EAttribute)dasMetaEClass.getEStructuralFeatures().get(0); - } - - /** - * Returns the meta object for the attribute '{@link org.apache.tuscany.model.DASMeta#getId Id}'. - * - * - * @return the meta object for the attribute 'Id'. - * @see org.apache.tuscany.model.DASMeta#getId() - * @see #getDASMeta() - * @generated - */ - public EAttribute getDASMeta_Id() - { - return (EAttribute)dasMetaEClass.getEStructuralFeatures().get(1); - } - - /** - * Returns the factory that creates the instances of the model. - * - * - * @return the factory that creates the instances of the model. - * @generated - */ - public ConfigurationFactory getConfigurationFactory() - { - return (ConfigurationFactory)getEFactoryInstance(); - } - - /** - * - * - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * - * - * @generated - */ - public void createPackageContents() - { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - configurationEClass = createEClass(CONFIGURATION); - createEAttribute(configurationEClass, CONFIGURATION__HOST); - createEAttribute(configurationEClass, CONFIGURATION__PORT); - createEAttribute(configurationEClass, CONFIGURATION__INITIAL_CONTEXT_FACTORY); - createEAttribute(configurationEClass, CONFIGURATION__DAS_PARTITION_NAME); - createEAttribute(configurationEClass, CONFIGURATION__SCHEMA_PARTITION_NAME); - createEAttribute(configurationEClass, CONFIGURATION__SECURITY_PRINCIPAL); - createEAttribute(configurationEClass, CONFIGURATION__SECURITY_AUTHENTICATION_TYPE); - createEAttribute(configurationEClass, CONFIGURATION__SECURITY_CREDENTIALS); - createEAttribute(configurationEClass, CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH); - createEAttribute(configurationEClass, CONFIGURATION__EMBEDDED); - - dasMetaEClass = createEClass(DAS_META); - createEAttribute(dasMetaEClass, DAS_META__SUPPORTED_SCHEMAS); - createEAttribute(dasMetaEClass, DAS_META__ID); - } - - /** - * - * - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * - * - * @generated - */ - public void initializePackageContents() - { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(configurationEClass, Configuration.class, "Configuration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getConfiguration_Host(), ecorePackage.getEString(), "host", "localhost", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_Port(), ecorePackage.getEString(), "port", "10389", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_InitialContextFactory(), ecorePackage.getEString(), "initialContextFactory", "org.apache.directory.server.core.jndi.CoreContextFactory", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_DasPartitionName(), ecorePackage.getEString(), "dasPartitionName", "das", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_SchemaPartitionName(), ecorePackage.getEString(), "schemaPartitionName", "schema", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_SecurityPrincipal(), ecorePackage.getEString(), "securityPrincipal", "uid=admin,ou=system", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_SecurityAuthenticationType(), ecorePackage.getEString(), "securityAuthenticationType", "simple", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_SecurityCredentials(), ecorePackage.getEString(), "securityCredentials", "secret", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_Nlog4jConfigurationFilePath(), ecorePackage.getEString(), "nlog4jConfigurationFilePath", "src/test/resources/log4j.properties", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getConfiguration_Embedded(), ecorePackage.getEBoolean(), "embedded", "false", 0, 1, Configuration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - initEClass(dasMetaEClass, DASMeta.class, "DASMeta", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getDASMeta_SupportedSchemas(), ecorePackage.getEString(), "supportedSchemas", "localhost", 0, -1, DASMeta.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - initEAttribute(getDASMeta_Id(), ecorePackage.getEString(), "id", "0", 0, 1, DASMeta.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); - - // Create resource - createResource(eNS_URI); - } - - /** - * - * Defines literals for the meta objects that represent - *

- * - * @generated - */ - public interface Literals - { - /** - * The meta object literal for the '{@link org.apache.tuscany.model.impl.ConfigurationImpl Configuration}' class. - * - * - * @see org.apache.tuscany.model.impl.ConfigurationImpl - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl#getConfiguration() - * @generated - */ - public static final EClass CONFIGURATION = eINSTANCE.getConfiguration(); - - /** - * The meta object literal for the 'Host' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__HOST = eINSTANCE.getConfiguration_Host(); - - /** - * The meta object literal for the 'Port' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__PORT = eINSTANCE.getConfiguration_Port(); - - /** - * The meta object literal for the 'Initial Context Factory' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__INITIAL_CONTEXT_FACTORY = eINSTANCE.getConfiguration_InitialContextFactory(); - - /** - * The meta object literal for the 'Das Partition Name' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__DAS_PARTITION_NAME = eINSTANCE.getConfiguration_DasPartitionName(); - - /** - * The meta object literal for the 'Schema Partition Name' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__SCHEMA_PARTITION_NAME = eINSTANCE.getConfiguration_SchemaPartitionName(); - - /** - * The meta object literal for the 'Security Principal' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__SECURITY_PRINCIPAL = eINSTANCE.getConfiguration_SecurityPrincipal(); - - /** - * The meta object literal for the 'Security Authentication Type' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__SECURITY_AUTHENTICATION_TYPE = eINSTANCE.getConfiguration_SecurityAuthenticationType(); - - /** - * The meta object literal for the 'Security Credentials' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__SECURITY_CREDENTIALS = eINSTANCE.getConfiguration_SecurityCredentials(); - - /** - * The meta object literal for the 'Nlog4j Configuration File Path' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__NLOG4J_CONFIGURATION_FILE_PATH = eINSTANCE.getConfiguration_Nlog4jConfigurationFilePath(); - - /** - * The meta object literal for the 'Embedded' attribute feature. - * - * - * @generated - */ - public static final EAttribute CONFIGURATION__EMBEDDED = eINSTANCE.getConfiguration_Embedded(); - - /** - * The meta object literal for the '{@link org.apache.tuscany.model.impl.DASMetaImpl DAS Meta}' class. - * - * - * @see org.apache.tuscany.model.impl.DASMetaImpl - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl#getDASMeta() - * @generated - */ - public static final EClass DAS_META = eINSTANCE.getDASMeta(); - - /** - * The meta object literal for the 'Supported Schemas' attribute list feature. - * - * - * @generated - */ - public static final EAttribute DAS_META__SUPPORTED_SCHEMAS = eINSTANCE.getDASMeta_SupportedSchemas(); - - /** - * The meta object literal for the 'Id' attribute feature. - * - * - * @generated - */ - public static final EAttribute DAS_META__ID = eINSTANCE.getDASMeta_Id(); - - } - -} //ConfigurationPackageImpl diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/DASMetaImpl.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/DASMetaImpl.java deleted file mode 100644 index 2f14d4011a..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/impl/DASMetaImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.impl; - -import java.util.Collection; -import java.util.List; - -import org.apache.tuscany.model.DASMeta; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; - -import org.eclipse.emf.ecore.sdo.impl.EDataObjectImpl; - -import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; - -/** - * - * An implementation of the model object 'DAS Meta'. - * - *

- * The following features are implemented: - *

- *

- * - * @generated - */ -public class DASMetaImpl extends EDataObjectImpl implements DASMeta -{ - /** - * - * - * @generated - */ - private static final long serialVersionUID = 1L; - - /** - * The cached value of the '{@link #getSupportedSchemas() Supported Schemas}' attribute list. - * - * - * @see #getSupportedSchemas() - * @generated - * @ordered - */ - protected EList supportedSchemas; - - /** - * The default value of the '{@link #getId() Id}' attribute. - * - * - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = "0"; - - /** - * The cached value of the '{@link #getId() Id}' attribute. - * - * - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * - * - * @generated - */ - protected DASMetaImpl() - { - super(); - } - - /** - * - * - * @generated - */ - @Override - protected EClass eStaticClass() - { - return ConfigurationPackageImpl.Literals.DAS_META; - } - - /** - * - * - * @generated - */ - public List getSupportedSchemas() - { - if (supportedSchemas == null) - { - supportedSchemas = new EDataTypeUniqueEList(String.class, this, ConfigurationPackageImpl.DAS_META__SUPPORTED_SCHEMAS); - } - return supportedSchemas; - } - - /** - * - * - * @generated - */ - public String getId() - { - return id; - } - - /** - * - * - * @generated - */ - public void setId(String newId) - { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackageImpl.DAS_META__ID, oldId, id)); - } - - /** - * - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) - { - switch (featureID) - { - case ConfigurationPackageImpl.DAS_META__SUPPORTED_SCHEMAS: - return getSupportedSchemas(); - case ConfigurationPackageImpl.DAS_META__ID: - return getId(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) - { - switch (featureID) - { - case ConfigurationPackageImpl.DAS_META__SUPPORTED_SCHEMAS: - getSupportedSchemas().clear(); - getSupportedSchemas().addAll((Collection)newValue); - return; - case ConfigurationPackageImpl.DAS_META__ID: - setId((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * - * - * @generated - */ - @Override - public void eUnset(int featureID) - { - switch (featureID) - { - case ConfigurationPackageImpl.DAS_META__SUPPORTED_SCHEMAS: - getSupportedSchemas().clear(); - return; - case ConfigurationPackageImpl.DAS_META__ID: - setId(ID_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) - { - switch (featureID) - { - case ConfigurationPackageImpl.DAS_META__SUPPORTED_SCHEMAS: - return supportedSchemas != null && !supportedSchemas.isEmpty(); - case ConfigurationPackageImpl.DAS_META__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - } - return super.eIsSet(featureID); - } - - /** - * - * - * @generated - */ - @Override - public String toString() - { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (supportedSchemas: "); - result.append(supportedSchemas); - result.append(", id: "); - result.append(id); - result.append(')'); - return result.toString(); - } - -} //DASMetaImpl diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationAdapterFactory.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationAdapterFactory.java deleted file mode 100644 index 7d0d4e154d..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationAdapterFactory.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.util; - -import org.apache.tuscany.model.*; - -import org.apache.tuscany.model.impl.ConfigurationPackageImpl; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -/** - * - * The Adapter Factory for the model. - * It provides an adapter createXXX method for each class of the model. - * - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl - * @generated - */ -public class ConfigurationAdapterFactory extends AdapterFactoryImpl -{ - /** - * The cached model package. - * - * - * @generated - */ - protected static ConfigurationPackageImpl modelPackage; - - /** - * Creates an instance of the adapter factory. - * - * - * @generated - */ - public ConfigurationAdapterFactory() - { - if (modelPackage == null) - { - modelPackage = ConfigurationPackageImpl.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * - * This implementation returns true if the object is either the model's package or is an instance object of the model. - * - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) - { - if (object == modelPackage) - { - return true; - } - if (object instanceof EObject) - { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the createXXX methods. - * - * - * @generated - */ - protected ConfigurationSwitch modelSwitch = - new ConfigurationSwitch() - { - @Override - public Adapter caseConfiguration(Configuration object) - { - return createConfigurationAdapter(); - } - @Override - public Adapter caseDASMeta(DASMeta object) - { - return createDASMetaAdapter(); - } - @Override - public Adapter defaultCase(EObject object) - { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the target. - * - * - * @param target the object to adapt. - * @return the adapter for the target. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) - { - return modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.apache.tuscany.model.Configuration Configuration}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * @return the new adapter. - * @see org.apache.tuscany.model.Configuration - * @generated - */ - public Adapter createConfigurationAdapter() - { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.apache.tuscany.model.DASMeta DAS Meta}'. - * - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * - * @return the new adapter. - * @see org.apache.tuscany.model.DASMeta - * @generated - */ - public Adapter createDASMetaAdapter() - { - return null; - } - - /** - * Creates a new adapter for the default case. - * - * This default implementation returns null. - * - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() - { - return null; - } - -} //ConfigurationAdapterFactory diff --git a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationSwitch.java b/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationSwitch.java deleted file mode 100644 index 81668705b6..0000000000 --- a/java/das/ldap/das.ldap.configuration.model.v100/src/main/java/org/apache/tuscany/model/util/ConfigurationSwitch.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * - * - * - * $Id$ - */ -package org.apache.tuscany.model.util; - -import java.util.List; - -import org.apache.tuscany.model.*; - -import org.apache.tuscany.model.impl.ConfigurationPackageImpl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -/** - * - * The Switch for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the caseXXX method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * - * @see org.apache.tuscany.model.impl.ConfigurationPackageImpl - * @generated - */ -public class ConfigurationSwitch -{ - /** - * The cached model package - * - * - * @generated - */ - protected static ConfigurationPackageImpl modelPackage; - - /** - * Creates an instance of the switch. - * - * - * @generated - */ - public ConfigurationSwitch() - { - if (modelPackage == null) - { - modelPackage = ConfigurationPackageImpl.eINSTANCE; - } - } - - /** - * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. - * - * - * @return the first non-null result returned by a caseXXX call. - * @generated - */ - public T doSwitch(EObject theEObject) - { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. - * - * - * @return the first non-null result returned by a caseXXX call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) - { - if (theEClass.eContainer() == modelPackage) - { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - else - { - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. - * - * - * @return the first non-null result returned by a caseXXX call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) - { - switch (classifierID) - { - case ConfigurationPackageImpl.CONFIGURATION: - { - Configuration configuration = (Configuration)theEObject; - T result = caseConfiguration(configuration); - if (result == null) result = defaultCase(theEObject); - return result; - } - case ConfigurationPackageImpl.DAS_META: - { - DASMeta dasMeta = (DASMeta)theEObject; - T result = caseDASMeta(dasMeta); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of 'Configuration'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of 'Configuration'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseConfiguration(Configuration object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'DAS Meta'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch. - * - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of 'DAS Meta'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseDASMeta(DASMeta object) - { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of 'EObject'. - * - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of 'EObject'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) - { - return null; - } - -} //ConfigurationSwitch diff --git a/java/das/ldap/das.ldap.constants/pom.xml b/java/das/ldap/das.ldap.constants/pom.xml deleted file mode 100644 index e501f8b1e5..0000000000 --- a/java/das/ldap/das.ldap.constants/pom.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - tuscany-das-ldap - org.apache.tuscany.das - 1.0-SNAPSHOT - - 4.0.0 - das.ldap.constants - das.ldap.constants - - http://maven.apache.org - - - junit - junit - 3.8.1 - test - - - diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/ApacheDSConnectionConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/ApacheDSConnectionConstants.java deleted file mode 100644 index 01e4d63789..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/ApacheDSConnectionConstants.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.constants; - -public interface ApacheDSConnectionConstants -{ - String APACHE_CONTEXT_FACTORY = - "org.apache.directory.server.core.jndi.CoreContextFactory"; - - String SUN_CONTEXT_FACTORY = - "com.sun.jndi.ldap.LdapCtxFactory"; - - String SIMPLE_SECURITY_AUTHENTICATION_VALUE = - "simple"; - - String DEFAULT_SECURITY_PRINCIPAL_VALUE = - "uid=admin,ou=system"; - - String DEFAULT_SECURITY_CREDENTIALS_VALUE = - "secret"; - - String SCHEMA_PROVIDER_PATH = - "ou=schema"; - - String SYSTEM_PROVIDER_PATH = - "ou=system"; - - String NLOG4J_CONFIGURATION_FILEPATH = - "src/test/resources/log4j.properties"; - -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/DASConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/DASConstants.java deleted file mode 100644 index 91745e0980..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/DASConstants.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.constants; - -public interface DASConstants { - String DAS_META_ID_DEFAULT = - "0"; - - - String DAS_XSD_NAMESPACE = - "http://org.apache.tuscany/das/ldap"; - - String M_META_TOP_SDO_OBJECT_CLASS = - "metaTopSDO"; - - String M_COMPLEX_MAY = - "m-complexMay"; - - String M_COMPLEX_MAY_DESCRIPTION = - "SDO Type member that is a reference"; - - String M_COMPLEX_MUST = - "m-complexMust"; - - String M_COMPLEX_MUST_DESCRIPTION = - "Required SDO Type member reference."; - - String ID = - "id"; - - String ID_DESCRIPTION = - "Unique DataObject Instance Integer ID"; - - //================================================== - String XSD_CONTEXT_NAME = - "xsd"; - - String ECORE_CONTEXT_NAME = - "ecore"; - - String DAS_CONTEXT_NAME = - "das"; - - String SYNTAXES_CONTEXT_NAME = - "syntaxes"; - - String SYNTAX_CHECKERS_CONTEXT_NAME = - "syntaxCheckers"; - - String ATTRIBUTE_TYPES_CONTEXT_NAME = - "attributeTypes"; - - String OBJECT_CLASSES_CONTEXT_NAME = - "objectClasses"; - - String META_CONTEXT_NAME = - "meta"; - //================================================== - - String LDAP_USER_APPLICATIONS = - "USER_APPLICATIONS"; - - String LDAP_FALSE = - "FALSE"; - - String TUSCANY_OID_PREFIX_VALUE = - "1.3.6.1.4.1.18060.4"; - - - String OID_SYNTAX_OID_VALUE = - "1.3.6.1.4.1.1466.115.121.1.38"; - - String INTEGER_SYNTAX_OID_VALUE = - "1.3.6.1.4.1.1466.115.121.1.27"; - - String DISTINGUISHED_NAME_SYNTAX_OID_VALUE = - "1.3.6.1.4.1.1466.115.121.1.12"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/SyntaxOIDValues.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/SyntaxOIDValues.java deleted file mode 100644 index 32dece8648..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/constants/SyntaxOIDValues.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.apache.tuscany.das.ldap.constants; - -public interface SyntaxOIDValues { - - String SYNTAX_STRING_OID_VALUE = "1.3.6.1.4.1.1466.115.121.1.15"; - String SYNTAX_INTEGER_OID_VALUE = "1.3.6.1.4.1.1466.115.121.1.27"; - String SYNTAX_BOOLEAN_OID_VALUE = "1.3.6.1.4.1.1466.115.121.1.7"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/AttributeTypeConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/AttributeTypeConstants.java deleted file mode 100644 index 9a61986318..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/AttributeTypeConstants.java +++ /dev/null @@ -1,25 +0,0 @@ - -package org.apache.tuscany.das.ldap.schema.constants; - -public interface AttributeTypeConstants -{ - String CN = "cn"; - String OU = "ou"; - String OBJECT_CLASS = "objectClass"; - String CREATORS_NAME = "creatorsName"; - String CREATE_TIMESTAMP = "createTimestamp"; - String MODIFY_TIMESTAMP = "modifyTimestamp"; - String MODIFIERS_NAME = "modifiersName"; - - String LDAP_SYNTAXES = "ldapSyntaxes"; - String SYNTAXES = "syntaxes"; - String SYNTAX_CHECKERS = "syntaxCheckers"; - String MATCHING_RULES = "matchingRules"; - String ATTRIBUTE_TYPES = "attributeTypes"; - String OBJECT_CLASSES = "objectClasses"; - String MATCHING_RULE = "matchingRuleUse"; - String DIT_STRUCTURE = "ditStructureRules"; - String DIT_CONTENT = "ditContentRules"; - String NAME_FORMS = "nameForms"; - String UNIQUE_IDENTIFIER = "uniqueIdentifier"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/EnumeratedSchemaAttributeTypeValues.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/EnumeratedSchemaAttributeTypeValues.java deleted file mode 100644 index 6658beeafa..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/EnumeratedSchemaAttributeTypeValues.java +++ /dev/null @@ -1,7 +0,0 @@ - -package org.apache.tuscany.das.ldap.schema.constants; - -public interface EnumeratedSchemaAttributeTypeValues -{ - String M_EQUALITY__NAME_OR_NUMERIC_ID_MATCH="nameOrNumericIdMatch"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/ObjectClassConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/ObjectClassConstants.java deleted file mode 100644 index c722ef8631..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/ObjectClassConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.constants; - - -/** - * These constants are used by the DAS and DAS Clients. - * - */ -public interface ObjectClassConstants -{ - String TOP = "top"; - String ORGANIZATIONAL_UNIT = "organizationalUnit"; - - String ABSTRACT = "ABSTRACT"; - String STRUCTURAL = "STRUCTURAL"; - String AUXILIARY = "AUXILIARY"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/PartitionConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/PartitionConstants.java deleted file mode 100644 index c5ef1f2392..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/PartitionConstants.java +++ /dev/null @@ -1,8 +0,0 @@ - -package org.apache.tuscany.das.ldap.schema.constants; - -public interface PartitionConstants -{ - - -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaAttributeTypeConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaAttributeTypeConstants.java deleted file mode 100644 index 8cf39ce172..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaAttributeTypeConstants.java +++ /dev/null @@ -1,33 +0,0 @@ - -package org.apache.tuscany.das.ldap.schema.constants; - -public interface SchemaAttributeTypeConstants -{ - String M_SUP_OBJECT_CLASS = "m-supObjectClass"; - String M_BYTECODE = "m-bytecode"; - String M_FQCN = "m-fqcn"; - String M_DEPENDENCIES = "m-dependencies"; - String M_DISABLED = "m-disabled"; - String M_DESCRIPTION = "m-description"; - String M_OBSOLETE = "m-obsolete"; - String M_NAME = "m-name"; - String M_OID = "m-oid"; - String M_OC = "m-oc"; - String M_AUX = "m-aux"; - String M_USAGE = "m-usage"; - String M_NO_USER_MODIFICATION = "m-noUserModification"; - String M_SINGLE_VALUE = "m-singleValue"; - String M_COLLECTIVE = "m-collective"; - String M_SUBSTR = "m-substr"; - String M_SUP = "m-supAttributeType"; - String M_ORDERING = "m-ordering"; - String M_EQUALITY = "m-equality"; - String M_SYNTAX = "m-syntax"; - String M_MUST = "m-must"; - String M_MAY = "m-may"; - String M_TYPE_OBJECT_CLASS = "m-typeObjectClass"; - String X_HUMAN_READIBLE = "x-humanReadible";//TODO Fix spelling once fixed in ADS - - String M_FQCN_DEFAULT_VALUE = - "org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaObjectClassConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaObjectClassConstants.java deleted file mode 100644 index 34f04d3498..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SchemaObjectClassConstants.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.constants; - - -/** - * These constants are used by the DAS and DAS Clients. - */ -public interface SchemaObjectClassConstants -{ - String META_TOP = "metaTop"; - String META_SCHEMA = "metaSchema"; - String META_OBJECT_CLASS = "metaObjectClass"; - String META_ATTRIBUTE_TYPE = "metaAttributeType"; - String META_MATCHING_RULE = "metaMatchingRule"; - String META_NORMALIZER = "metaNormalizer"; - String META_SYNTAX = "metaSyntax"; - String META_SYNTAX_CHECKER = "metaSyntaxChecker"; - String META_COMPARATOR = "metaComparator"; - String META_NAME_FORM = "metaNameForm"; - String META_DIT_CONTENT_RULE = "metaDITContentRule"; -} diff --git a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SystemSchemaConstants.java b/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SystemSchemaConstants.java deleted file mode 100644 index 2e8dac3cbb..0000000000 --- a/java/das/ldap/das.ldap.constants/src/main/java/org/apache/tuscany/das/ldap/schema/constants/SystemSchemaConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.constants; - - -/** - * Constants for the System schema. - * - * @author Apache Directory Project - * @version $Rev$, $Date$ - */ -public interface SystemSchemaConstants -{ - String SCHEMA_NAME = "system"; - - -} diff --git a/java/das/ldap/das.ldap/pom.xml b/java/das/ldap/das.ldap/pom.xml deleted file mode 100644 index 68524253b6..0000000000 --- a/java/das/ldap/das.ldap/pom.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - org.apache.tuscany.das - tuscany-das-ldap - 1.0-SNAPSHOT - - 4.0.0 - das.ldap - - - http://pyramidetechnologies.com/model/archetype - - - - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - - - org.apache.tuscany.das - das.ldap.configuration.model.v100 - 1.0-SNAPSHOT - - - - org.apache.tuscany.das - das.ldap.constants - 1.0-SNAPSHOT - - - - - org.apache.directory.server - apacheds-core - 1.5.1-SNAPSHOT - - - - org.slf4j - nlog4j - 1.2.25 - - - - commons-io - commons-io - 1.3.1 - - - - - - junit - junit - - - org.eclipse.emf - ant - - - org.eclipse.emf - codegen - - - org.eclipse.emf - codegen-ecore - - - org.eclipse.emf - codegen-ecore-ui - - - org.eclipse.emf - codegen-ui - - - org.eclipse.emf - common - - - org.eclipse.emf - commonj-sdo - - - org.eclipse.emf - common-ui - - - org.eclipse.emf - converter - - - org.eclipse.emf - ecore - - - org.eclipse.emf - ecore-change - - - org.eclipse.emf - ecore-change-edit - - - org.eclipse.emf - ecore-edit - - - org.eclipse.emf - ecore-sdo - - - org.eclipse.emf - ecore-sdo-edit - - - org.eclipse.emf - ecore-xmi - - - org.eclipse.emf - edit - - - org.eclipse.emf - edit-ui - - - org.eclipse.emf - emf - - - org.eclipse.emf - exporter - - - org.eclipse.emf - importer - - - org.eclipse.emf - importer-ecore - - - org.eclipse.emf - importer-java - - - org.eclipse.emf - importer-rose - - - org.eclipse.emf - mapping - - - org.eclipse.emf - mapping-ecore2ecore - - - org.eclipse.emf - mapping-ecore2ecore-editor - - - org.eclipse.emf - mapping-ecore2xml - - - org.eclipse.emf - mapping-ecore2xml-ui - - - org.eclipse.emf - mapping-ui - - - org.eclipse.emf - mapping-xsd2ecore - - - org.eclipse.emf - mapping-xsd2ecore-editor - - - org.eclipse.xsd - ecore-exporter - - - org.eclipse.xsd - ecore-importer - - - org.eclipse.xsd - edit - - - org.eclipse.xsd - xsd - - - diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java deleted file mode 100644 index 7977f60545..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.server.core.configuration.MutableStartupConfiguration; -import org.apache.directory.server.core.configuration.ShutdownConfiguration; -import org.apache.log4j.PropertyConfigurator; - -/** - * The Class JNDIEmbeddedConnectionTemplate. - */ -public abstract class ADSEmbeddedConnectionTemplate -extends JNDIConnectionTemplate -{ - public void tearDown() throws NamingException, Exception - { - Hashtable env = - new Hashtable(); - - env = createEnvironment(env); - - env.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory" ); - env.putAll( - new ShutdownConfiguration().toJndiEnvironment() ); - - new InitialContext( env ); - Runtime.getRuntime().gc(); - super.tearDown(); - } - - - - public void setUp() throws Exception - { - PropertyConfigurator. - configure(NLOG4J_CONFIGURATION_FILEPATH); - super.setUp(); - } - - /** - * Connect to an embedded ApacheDS server. - * - * @param providerPath the provider path ("ou=schema", ou="system", etc.) - * - * @return the ldap context - * - * @throws NamingException the naming exception - */ - public LdapContext connect( String providerPath ) throws NamingException - { - MutableStartupConfiguration mutableStartupConfiguration = - new MutableStartupConfiguration(); - - Hashtable adminEnv = - new Hashtable( ); - - adminEnv.putAll( - mutableStartupConfiguration. - toJndiEnvironment()); - - adminEnv.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - adminEnv.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - adminEnv.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - adminEnv.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE ); - new InitialLdapContext( adminEnv, null ); - - - - Hashtable env = - new Hashtable(); - - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory" ); - env.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - env.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - env.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE ); - env.put( Context.PROVIDER_URL, providerPath ); - - env.put( Context.PROVIDER_URL, providerPath ); - - return new InitialLdapContext( env, null ); - - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java deleted file mode 100644 index f5426b3424..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -public class ADSEmbeddedConnectionTemplateTest -extends ADSEmbeddedConnectionTemplate -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - } - - public void testSchemaConnect() throws NamingException - { - LdapContext ldapContext =null; - - ldapContext =connect("ou=schema"); - - assertEquals( - "ou=schema", - ldapContext.getNameInNamespace()); - } - - public void testRootDSEConnect() throws NamingException - { - LdapContext ldapContext =null; - - ldapContext =connect(""); - - assertEquals( - "", - ldapContext.getNameInNamespace()); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java deleted file mode 100644 index fae915a0a2..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.server.core.configuration.Configuration; -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; -import org.apache.directory.server.core.configuration.MutableStartupConfiguration; -import org.apache.directory.server.core.configuration.ShutdownConfiguration; -import org.apache.log4j.PropertyConfigurator; - -/** - * The Class JNDIEmbeddedConnectionTemplate. - */ -public abstract class ADSEmbeddedHotPartitionTemplate -extends JNDIConnectionTemplate -{ - public void tearDown() throws NamingException, Exception - { - Hashtable env = - new Hashtable(); - - env = createEnvironment(env); - - env.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory" ); - env.putAll( - new ShutdownConfiguration().toJndiEnvironment() ); - - new InitialContext( env ); - Runtime.getRuntime().gc(); - super.tearDown(); - } - - - - public void setUp() throws Exception - { - PropertyConfigurator. - configure(NLOG4J_CONFIGURATION_FILEPATH); - super.setUp(); - } - - /** - * Connect to an embedded ApacheDS server. - * - * @param partitionName the provider path ("ou=schema", ou="system", etc.) - * - * @return the ldap context - * - * @throws NamingException the naming exception - */ - public LdapContext connect( String partitionName ) throws NamingException - { - MutableStartupConfiguration mutableStartupConfiguration = - new MutableStartupConfiguration(); - - Hashtable adminEnv = - new Hashtable( ); - - adminEnv.putAll( - mutableStartupConfiguration. - toJndiEnvironment()); - - adminEnv.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - adminEnv.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - adminEnv.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - adminEnv.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE ); - new InitialLdapContext( adminEnv, null ); - - - MutablePartitionConfiguration dasPartition = - new MutablePartitionConfiguration(); - - Attributes suffixAttributes = new BasicAttributes(); - suffixAttributes.put( "objectClass", "top"); - suffixAttributes.get( "objectClass" ).add( "organizationalUnit" ); - suffixAttributes.put( "ou", partitionName ); - - dasPartition.setId( partitionName); - dasPartition.setSuffix( "ou=" +partitionName ); - dasPartition.setContextEntry( suffixAttributes ); - - Set partitions = - new HashSet (); - - partitions.add( dasPartition ); - - mutableStartupConfiguration. - setPartitionConfigurations( partitions ); - - Hashtable env = - new Hashtable(); - - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory" ); - env.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - env.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - env.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE ); - env.put( - Context.PROVIDER_URL, - "ou=" + partitionName ); - - env.put( - Configuration.JNDI_KEY, - mutableStartupConfiguration ); - - return new InitialLdapContext( env, null ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java deleted file mode 100644 index aba1ff7940..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -public class ADSEmbeddedHotPartitionTemplateTest -extends ADSEmbeddedHotPartitionTemplate -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - } - - public void testCreateHotPartition() throws NamingException - { - LdapContext ldapContext = - null; - - ldapContext = - connect("test"); - - assertEquals( - "ou=test", - ldapContext.getNameInNamespace()); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java deleted file mode 100644 index ae267144eb..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.ApacheDSConnectionConstants; - -import junit.framework.TestCase; - -/* - * Just a class template class - */ -public abstract class JNDIConnectionTemplate -extends TestCase -implements ApacheDSConnectionConstants -{ - protected String providerHost = - "ldap://localhost:10389/"; - - protected String providerPath = - SYSTEM_PROVIDER_PATH; - - private String providerURL = - providerHost + providerPath; - - protected String initialContextFactory = - SUN_CONTEXT_FACTORY; - - protected String securityAuthentication = - SIMPLE_SECURITY_AUTHENTICATION_VALUE; - - protected String securityPrincipal = - DEFAULT_SECURITY_PRINCIPAL_VALUE; - - protected String credentials = - DEFAULT_SECURITY_CREDENTIALS_VALUE; - - public Hashtable createEnvironment( - Hashtable env) - { - providerURL = - providerHost + providerPath; - - env.put( - Context.PROVIDER_URL, - providerURL); - - env.put( - Context.INITIAL_CONTEXT_FACTORY, - initialContextFactory ); - - env.put( - Context.SECURITY_AUTHENTICATION, - securityAuthentication); - - env.put( - Context.SECURITY_PRINCIPAL, - securityPrincipal ); - - env.put( - Context.SECURITY_CREDENTIALS, - credentials ); - - return env; - } - - public LdapContext connect() throws NamingException - { - Hashtable env = - new Hashtable(); - - return new InitialLdapContext( - createEnvironment(env), null); - } - - public void setUp() throws Exception - { - super.setUp(); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java deleted file mode 100644 index 883a556167..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -/* - * These tests require a running server. - */ -public class JNDIConnectionTemplateTest extends JNDIConnectionTemplate -{ - private static LdapContext systemContext = null; - private static LdapContext schemaContext = null; - - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testSystemContextConnection() - throws NamingException - { - systemContext = connect(); - assertNotNull( systemContext ); - assertNotNull( connect() ); - assertEquals( - systemContext. - getNameInNamespace(), - "ou=system"); - } - - public void testSchemaContextConnection() - throws NamingException - { - providerPath = SCHEMA_PROVIDER_PATH; - schemaContext = connect(); - assertNotNull (schemaContext); - assertNotNull(connect()); - assertEquals( - schemaContext.getNameInNamespace(), - "ou=schema"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java deleted file mode 100644 index 546ccea0d5..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.server.core.configuration.Configuration; -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; -import org.apache.directory.server.core.configuration.MutableStartupConfiguration; -import org.apache.tuscany.das.ldap.constants.ApacheDSConnectionConstants; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -import junit.framework.TestCase; - -/* - * Just a class template class - */ -public abstract class JNDIHotPartitionConnectionTemplate -extends AbstractTestSetup -implements ApacheDSConnectionConstants -{ - - public Hashtable createEnvironment( - Hashtable env, - String partitionName) throws NamingException - { - MutableStartupConfiguration mutableStartupConfiguration = - new MutableStartupConfiguration(); - - MutablePartitionConfiguration dasPartition = - new MutablePartitionConfiguration(); - - Attributes suffixAttributes = new BasicAttributes(); - suffixAttributes.put( "objectClass", "top"); - suffixAttributes.get( "objectClass" ).add( "organizationalUnit" ); - suffixAttributes.put( "ou", partitionName ); - - dasPartition.setId( partitionName); - dasPartition.setSuffix( "ou=" +partitionName ); - dasPartition.setContextEntry( suffixAttributes ); - - Set partitions = - new HashSet (); - - partitions.add( dasPartition ); - - mutableStartupConfiguration. - setPartitionConfigurations( partitions ); - - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory" ); - - env.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - - env.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - - env.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE ); - - env.put( - Context.PROVIDER_URL, - "ou=" + partitionName ); - - env.put( - Configuration.JNDI_KEY, - mutableStartupConfiguration ); - - return env; - } - - public LdapContext connect( String partitionName ) - throws NamingException - { - Hashtable env = - new Hashtable(); - - return new InitialLdapContext( - createEnvironment(env, partitionName), null); - } - - public void setUp() throws Exception - { - super.setUp(); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java deleted file mode 100644 index 85b9f5eb10..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.directory.apacheds.testing.setup; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -/* - * These tests require a running server. - */ -public class JNDIHotPartitionConnectionTemplateTest -extends JNDIHotPartitionConnectionTemplate -{ - private static LdapContext testContext = null; - private static LdapContext systemContext = null; - private static LdapContext schemaContext = null; - - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testTestContextConnection() - throws NamingException - { - testContext = connect("test"); - assertNotNull(testContext ); - assertEquals( - testContext.getNameInNamespace(), "ou=test"); - } - - - public void testSystemContextConnection() - throws NamingException - { - systemContext = connect("system"); - assertNotNull( systemContext ); - assertEquals( - systemContext.getNameInNamespace(), "ou=system"); - } - - public void testSchemaContextConnection() - throws NamingException - { - schemaContext = connect("schema"); - assertNotNull( schemaContext ); - assertEquals( - schemaContext.getNameInNamespace(), - "ou=schema"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/ADSEmbeddedConnection.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/ADSEmbeddedConnection.java deleted file mode 100644 index b547f1447b..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/ADSEmbeddedConnection.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.connect; - -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Set; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; -import org.apache.directory.server.core.configuration.MutableStartupConfiguration; -import org.apache.directory.server.core.configuration.ShutdownConfiguration; -import org.apache.log4j.PropertyConfigurator; -import org.apache.tuscany.model.Configuration; - -/** - * The Class JNDIEmbeddedConnectionTemplate. - */ -public class ADSEmbeddedConnection extends JNDIConnection { - private Configuration configuration = null; - - public ADSEmbeddedConnection(Configuration configuration) { - super(configuration); - this.configuration = configuration; - } - - /** - * Shutdown. - * - * Shuts down an embedded instance of ADS. - * - * @throws NamingException - * the naming exception - * @throws Exception - * the exception - */ - public void shutdown() throws NamingException, Exception { - Hashtable env = new Hashtable(); - - env = createEnvironment(env); - - env.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - env.put( - Context.INITIAL_CONTEXT_FACTORY, - APACHE_CONTEXT_FACTORY); - env.putAll( - new ShutdownConfiguration().toJndiEnvironment()); - - new InitialContext(env); - Runtime.getRuntime().gc(); - } - - /** - * Startup. - * - * Starts an embedded instance of ADS and creates the the DAS partition, if - * it does not already exist. - * - * @throws NamingException - * the naming exception - */ - public LdapContext startup(String partitionName) - throws NamingException { - PropertyConfigurator. - configure( - configuration. - getNlog4jConfigurationFilePath()); - - MutableStartupConfiguration mutableStartupConfiguration = - new MutableStartupConfiguration(); - - Hashtable adminEnv = - new Hashtable(); - - adminEnv.putAll(mutableStartupConfiguration.toJndiEnvironment()); - - adminEnv.put( - Context.PROVIDER_URL, - SYSTEM_PROVIDER_PATH); - adminEnv.put( - Context.SECURITY_PRINCIPAL, - configuration.getSecurityPrincipal()); - adminEnv.put( - Context.SECURITY_CREDENTIALS, - configuration.getSecurityCredentials()); - adminEnv.put( - Context.SECURITY_AUTHENTICATION, - configuration.getSecurityAuthenticationType()); - new InitialLdapContext(adminEnv, null); - - MutablePartitionConfiguration dasPartition = - new MutablePartitionConfiguration(); - - Attributes suffixAttributes = - new BasicAttributes(); - suffixAttributes.put(OBJECT_CLASS, TOP); - suffixAttributes.get(OBJECT_CLASS).add(ORGANIZATIONAL_UNIT); - suffixAttributes.put(OU, partitionName); - - dasPartition.setId(partitionName); - dasPartition.setSuffix(getProviderPath(partitionName)); - dasPartition.setContextEntry(suffixAttributes); - - Set partitions = - new HashSet(); - - partitions.add(dasPartition); - - mutableStartupConfiguration.setPartitionConfigurations(partitions); - - Hashtable env = - new Hashtable(); - - env.put( - Context.INITIAL_CONTEXT_FACTORY, - "org.apache.directory.server.core.jndi.CoreContextFactory"); - env.put( - Context.SECURITY_PRINCIPAL, - DEFAULT_SECURITY_PRINCIPAL_VALUE); - env.put( - Context.SECURITY_CREDENTIALS, - DEFAULT_SECURITY_CREDENTIALS_VALUE); - env.put( - Context.SECURITY_AUTHENTICATION, - SIMPLE_SECURITY_AUTHENTICATION_VALUE); - env.put( - Context.PROVIDER_URL, getProviderPath(partitionName)); - - env.put( - org.apache.directory.server.core.configuration.Configuration.JNDI_KEY, - mutableStartupConfiguration); - - return new InitialLdapContext(env, null); - } - - public LdapContext connect(String partitionName) throws NamingException - { - return startup(partitionName); - } - - /** - * Gets the provider path. TODO Move to helper - * - * @return the provider path - */ - public String getProviderPath(String partitionName) { - return OU + "=" + partitionName; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/JNDIConnection.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/JNDIConnection.java deleted file mode 100644 index d36dacc952..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/connect/JNDIConnection.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.connect; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.ldap.InitialLdapContext; -import javax.naming.ldap.LdapContext; -import org.apache.tuscany.model.Configuration; - -import org.apache.tuscany.das.ldap.constants.ApacheDSConnectionConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -/* - * Just a class template class - */ -public class JNDIConnection -implements -ApacheDSConnectionConstants, -AttributeTypeConstants, -ObjectClassConstants -{ - private Configuration configuration = null; - - public JNDIConnection(Configuration configuration) - { - this.configuration=configuration; - } - - public Hashtable createEnvironment( - Hashtable env) - { - env.put( - Context.INITIAL_CONTEXT_FACTORY, - configuration.getInitialContextFactory() ); - - env.put( - Context.SECURITY_AUTHENTICATION, - configuration.getSecurityAuthenticationType()); - - env.put( - Context.SECURITY_PRINCIPAL, - configuration.getSecurityPrincipal() ); - - env.put( - Context.SECURITY_CREDENTIALS, - configuration.getSecurityCredentials() ); - - return env; - } - - public LdapContext connect(String partitionName) throws NamingException - { - Hashtable env = - new Hashtable(); - - env = createEnvironment(env); - - env.put( - Context.PROVIDER_URL, - getProviderURL(partitionName)); - - return new InitialLdapContext(env, null); - } - - public String getProviderURL(String partitionName) - { - return "ldap://" + - configuration.getHost() + - ":" + - configuration.getPort() + - "/" + - OU + - "=" + - partitionName; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreator.java deleted file mode 100644 index 8e50e72178..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreator.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.util.XSDNamespaceURITokenizer; -import org.eclipse.emf.common.util.URI; - -/** - * The InitialContextCreator for a model's directory namespace - */ -public class InitialContextCreator -{ - /** - * Creates the parent context for the root DataObject instance - * - * @param dasContext the dir context - * @param xsdNamespace the xml namespace of the DataObjects - * - * @return the directory context - * - * @throws NamingException the naming exception - */ - public static LdapContext create( - String xsdNamespace, - LdapContext dasContext) throws NamingException - { - URI xsdNamespaceURI = - URI.createURI( - xsdNamespace ); - - String[] pathTokens = - XSDNamespaceURITokenizer. - createPathTokens( - xsdNamespaceURI ); - - String[] authorityTokens = - XSDNamespaceURITokenizer. - createAuthorityTokens( - xsdNamespaceURI ); - - dasContext = - InitialContextCreatorHelper. - createAuthorityContext( - dasContext, - authorityTokens ); - - dasContext = - InitialContextCreatorHelper. - createPathContext( - dasContext, - pathTokens ); - - return dasContext; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreatorHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreatorHelper.java deleted file mode 100644 index 0be0975082..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/InitialContextCreatorHelper.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; - -/** - * The Class InitialContextCreatorHelper. - */ -public class InitialContextCreatorHelper -implements -ObjectClassConstants, -SchemaObjectClassConstants, -AttributeTypeConstants -{ - - /** - * Creates the sub context if it does not already exist. - * - * @param ldapContext the ldap context - * @param subContextRDN the sub context - * @param attributes the attributes - * - * @return the ldap context - * - * @throws NamingException the naming exception - */ - public static LdapContext createSubContext( - LdapContext ldapContext, - String subContextRDN, - Attributes attributes) - throws NamingException - { - try - { - ldapContext = - ( LdapContext ) - ldapContext. - lookup( subContextRDN ); - } - catch ( NamingException e ) - { - if (attributes == null) - { - ldapContext = - ( LdapContext ) - ldapContext. - createSubcontext( subContextRDN ); - } - else - { - ldapContext = - ( LdapContext ) - ldapContext. - createSubcontext( - subContextRDN, - attributes ); - } - } - return ldapContext; - } - - /** - * Creates the authority context. Authority - * means the Authority component of a URL. - * For example if the authority is "example.com", - * then the authority context will be "cn=example, cn=com". - * - * @param ldapContext the ldap context - * @param authorityTokens the authority tokens - * - * @return the ldap context - * - * @throws NamingException the naming exception - * - */ - public static LdapContext createAuthorityContext( - LdapContext ldapContext, - String[] authorityTokens) - throws NamingException - { - for (int i = authorityTokens.length-1; i >= (0); i--) - { - String subContext = CN+ "=" + authorityTokens[i]; - ldapContext = (LdapContext) createSubContext( - ldapContext, - subContext, null ); - } - return ldapContext; - } - - /** - * Creates the path context. - * Path means the path component of a URL. - * For example if the authority is "example.com/users/accounts", - * then the path context will be "cn=accounts, cn=users". The full - * model namespaced context will be "cn=accounts, cn=users, cn=example, cn=com" - * - * @param authorityContext the ldap context - * @param pathTokens the path tokens - * - * @return the ldap context - * - * @throws NamingException the naming exception - */ - public static LdapContext createPathContext( - LdapContext authorityContext, - String[] pathTokens) - throws NamingException - { - for (int i = 1; i < (pathTokens.length); i++) - { - String subContext = CN + "=" + pathTokens[i]; - authorityContext = (LdapContext) createSubContext( - authorityContext, - subContext, null ); - } - return authorityContext; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/MetaContextCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/MetaContextCreator.java deleted file mode 100644 index 4caa380258..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/create/MetaContextCreator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; - -/** - * The Class MetaContextCreator. - */ -public class MetaContextCreator -implements -DASConstants, -AttributeTypeConstants -{ - /** - * Create a meta context below the provided parent context. - * - * @param metaParentContext the context - * - * @return the ldap context - * - * @throws NamingException the naming exception - */ - public static LdapContext create( - LdapContext metaParentContext) throws NamingException - { - String rdn = - CN + "=" + META_CONTEXT_NAME; - - try - { - return - ( LdapContext ) - metaParentContext.lookup( rdn ); - } - catch(Exception e) - { - return - ( LdapContext ) - metaParentContext. - createSubcontext( rdn ); - } - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/InitialContextDestroyer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/InitialContextDestroyer.java deleted file mode 100644 index 2cc3fc7d36..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/InitialContextDestroyer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.destroy; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.util.JNDIUtil; - -// TODO: Auto-generated Javadoc -/** - * The Class InitialContextDestroyer. - */ -public class InitialContextDestroyer -{ - - /** - * Destroys the initial naming context - * when the parent entries do not contain - * other child entries. If the initial - * naming context also supports other - * entries, then a NamingException will - * be thrown. - * - * @param partitionContext the partition context - * @param initialContext the initial context - * - * @throws NamingException the naming exception - */ - public static void destroy( - DirContext initialContext, - DirContext partitionContext) - throws NamingException - { - String[] initialContextComponents = - JNDIUtil. - calculateDNComponents( initialContext ); - - String[] partitionContextComponents = - JNDIUtil.calculateDNComponents( partitionContext ); - - int numberOfPossibleSubcontexts = - initialContextComponents.length - - partitionContextComponents.length; - - for (int i = 0; i < numberOfPossibleSubcontexts; i++) - { - String rdn = initialContextComponents[i]; - - initialContext = JNDIUtil.getParentContext( - initialContext, - partitionContext ); - - initialContext.destroySubcontext( rdn ); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/MetaContextDestroyer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/MetaContextDestroyer.java deleted file mode 100644 index 7849b33edb..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/destroy/MetaContextDestroyer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.destroy; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; - -/** - * The Class MetaContextDestroyer. - */ -public class MetaContextDestroyer -implements -DASConstants, -AttributeTypeConstants -{ - /** - * Destroys an empty meta context - * - * @param initialContext the initial context - * - * @throws NamingException the naming exception thrown when the meta context has child entries - */ - public static void destroy( - DirContext initialContext) - throws NamingException - { - String rdn = - CN + "=" + META_CONTEXT_NAME; - - initialContext. - destroySubcontext( rdn ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/Context.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/Context.java deleted file mode 100644 index 31d6d8d11e..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/Context.java +++ /dev/null @@ -1,81 +0,0 @@ - -package org.apache.tuscany.das.ldap.emf; - -import java.util.Hashtable; -import java.util.Map; - -import javax.naming.ldap.LdapContext; - -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class Context -{ - private Map xsdNamespaceToLdapContextMap = null; - private Map dataObjectToRelativeDNCache = null; - - - private LdapContext dasContext = null; - private LdapContext schemaContext = null; - private LdapContext dasMetaContext = null; - private LdapContext ecoreObjectClassesContext = null; - private LdapContext ecoreAttributeTypesContext = null; - - public Context() - { - xsdNamespaceToLdapContextMap = - new Hashtable(); - - dataObjectToRelativeDNCache = - new Hashtable(); - } - - public LdapContext getDasContext() - { - return dasContext; - } - public void setDasContext( LdapContext dasContext ) - { - this.dasContext = dasContext; - } - public LdapContext getSchemaContext() - { - return schemaContext; - } - public void setSchemaContext( LdapContext schemaContext ) - { - this.schemaContext = schemaContext; - } - public LdapContext getDasMetaContext() - { - return dasMetaContext; - } - public void setDasMetaContext( LdapContext dasMetaContext ) - { - this.dasMetaContext = dasMetaContext; - } - public LdapContext getEcoreObjectClassesContext() - { - return ecoreObjectClassesContext; - } - public void setEcoreObjectClassesContext( LdapContext ecoreObjectClassesContext ) - { - this.ecoreObjectClassesContext = ecoreObjectClassesContext; - } - public LdapContext getEcoreAttributeTypesContext() - { - return ecoreAttributeTypesContext; - } - public void setEcoreAttributeTypesContext( LdapContext ecoreAttributeTypesContext ) - { - this.ecoreAttributeTypesContext = ecoreAttributeTypesContext; - } - public Map getXsdNamespaceToLdapContextMap() - { - return xsdNamespaceToLdapContextMap; - } - - public Map getDataObjectToRelativeDNCache() - { - return dataObjectToRelativeDNCache; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDAS.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDAS.java deleted file mode 100644 index 43e556714f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDAS.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf; - -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException; -import org.apache.tuscany.das.ldap.connect.ADSEmbeddedConnection; -import org.apache.tuscany.das.ldap.connect.JNDIConnection; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.create.MetaContextCreator; -import org.apache.tuscany.das.ldap.emf.create.EDataGraphCreator; -import org.apache.tuscany.das.ldap.emf.read.EDataGraphReader; -import org.apache.tuscany.das.ldap.emf.update.EDataGraphUpdater; -import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper; -import org.apache.tuscany.das.ldap.schema.emf.create.ModelTypeSystemCreator; -import org.apache.tuscany.model.Configuration; -import org.apache.tuscany.model.DASMeta; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class LdapDAS -implements DASConstants -{ - private Map metaDataObjectToRelativeDNCache = null; - - private Configuration configuration = null; - private DASMeta dasMeta = null; - private EDataGraph dasMetaDataGraph = null; - private Context context = null; - private ADSEmbeddedConnection adsEmbeddedConnection = null; - - - public LdapDAS(Configuration configuration) - throws NamingException - { - metaDataObjectToRelativeDNCache = - new Hashtable(); - - - this.configuration = - configuration; - - context = - new Context(); - - JNDIConnection jndiConnection = null; - - if (configuration.isEmbedded()) - { - adsEmbeddedConnection = - new ADSEmbeddedConnection(configuration); - context. - setDasContext( - adsEmbeddedConnection. - connect( - configuration. - getDasPartitionName() )); - - context. - setSchemaContext( - adsEmbeddedConnection. - connect( - configuration. - getSchemaPartitionName() )); - } - else - { - jndiConnection = - new JNDIConnection(configuration); - - context. - setDasContext( - jndiConnection.connect( - configuration. - getDasPartitionName() )); - - context. - setSchemaContext( - jndiConnection.connect( - configuration. - getSchemaPartitionName() )); - } - - context. - setDasMetaContext( - MetaContextCreator. - create( - context. - getDasContext() )); - - context.setEcoreObjectClassesContext( - LdapDASHelper. - createEcoreObjectClassesContext( - context. - getSchemaContext() )); - - context.setEcoreAttributeTypesContext( - LdapDASHelper. - createEcoreAttributeTypesContext( - context. - getSchemaContext() )); - } - - /** - * Write. - * - * @param eDataGraph the e data graph - * @param dasContext the das context - * - * @return the map< E data object, string> - * - * @throws NamingException the naming exception - * - * First tries to find a LdapContext that matches the xsdNamespace - * of the DataGraph that is about to be written. If it finds one, then - * it know that the type system has been written, thus it can skip this - * step. - * - * If the LdapContext lookup fails, the type system may still exist - * the check: - * - * configuration.getSupportedSchemas().contains(xsdNamespace) - * - * is performed. - * - * If the supported schema list contains the xsdNamespace, the - * corresponding the LdapContext parent context of the root DataObject - * instance is created and the DataGraph written. - * - * If the xsdNamespace is not contained by the supported schemas list, - * a final check is performed to see whether the type system exists. If this - * check succeeds and exception is thrown, because it should not. This could happen - * if the configuration write that occurs as the supported schema list is updated failed, - * or the the read of the supported schemas from the DIT failed. - * - */ - public void create( - EDataGraph eDataGraph) - throws NamingException, Exception - { - - EObject rootEObject = - eDataGraph. - getERootObject(); - - EPackage ePackage = - rootEObject. - eClass(). - getEPackage(); - - String xsdNamespace = - ePackage. - getNsURI(); - - LdapContext rootContext = - context. - getXsdNamespaceToLdapContextMap(). - get(xsdNamespace); - - if (rootContext != null) - { - EDataGraphCreator.create( - eDataGraph, - rootContext, - context. - getDataObjectToRelativeDNCache()); - } - - /* - * The root context was not yet created so we check if the - * schema is written for the model instance, and if it is - * we create the root context and add it to the context map. - */ - metaDataObjectToRelativeDNCache = - new Hashtable(); - - dasMetaDataGraph = - LdapDASHelper.readDasMeta( - context, - metaDataObjectToRelativeDNCache ); - - dasMeta = ( DASMeta ) dasMetaDataGraph.getRootObject(); - - if (LdapDASHelper.isSchemaReady(xsdNamespace, dasMeta)) - { - rootContext = - InitialContextCreator. - create( - xsdNamespace, - context. - getDasContext() ); - - context.getXsdNamespaceToLdapContextMap(). - put(xsdNamespace, rootContext); - - EDataGraphCreator.create( - eDataGraph, - rootContext, - context.getDataObjectToRelativeDNCache()); - } - - /* - * The model's schema is not yet written (We also do a validation - * check to make sure the server is not in an inconsistent state) - * so we need to write the schema and then write the model instance. - */ - - if (LdapDASHelper.isSchemaWritten( - rootEObject.eClass(), - context. - getEcoreObjectClassesContext() )) - { - throw new RuntimeException("This should not happen");//TODO better message + constant - } - - List eClassifiers = - EcoreTypeSystemHelper. - createEClassifiersList(ePackage); - - rootContext = - InitialContextCreator. - create( - xsdNamespace, - context.getDasContext() ); - - context.getXsdNamespaceToLdapContextMap(). - put(xsdNamespace, rootContext); - - LdapContext dasModelMetaContext = - MetaContextCreator. - create(rootContext); - - ModelTypeSystemCreator.create( - dasModelMetaContext, - context.getEcoreAttributeTypesContext(), - context.getEcoreObjectClassesContext(), - eClassifiers, - TUSCANY_OID_PREFIX_VALUE); - - dasMetaDataGraph. - getChangeSummary(). - beginLogging(); - - dasMeta. - getSupportedSchemas(). - add(xsdNamespace); - - dasMetaDataGraph. - getChangeSummary(). - endLogging(); - - EDataGraphUpdater.update( - dasMetaDataGraph, - context.getDasMetaContext(), - metaDataObjectToRelativeDNCache); - - EDataGraphCreator.create( - eDataGraph, - rootContext, - context. - getDataObjectToRelativeDNCache()); - - } - - - public EDataGraph read( - EClass rootDataObjectEClass, - String id) - throws LdapNameNotFoundException, NamingException - { - String xsdNamespace = - rootDataObjectEClass. - getEPackage(). - getNsURI(); - - LdapContext rootContext = - context. - getXsdNamespaceToLdapContextMap(). - get(xsdNamespace); - - if (rootContext == null) - { - rootContext = - InitialContextCreator. - create( - xsdNamespace, - context. - getDasContext() ); - - context. - getXsdNamespaceToLdapContextMap(). - put(xsdNamespace, rootContext); - } - - return EDataGraphReader.read( - rootDataObjectEClass, - id, - rootContext, - context. - getDataObjectToRelativeDNCache()); - } - - public void update(EDataGraph eDataGraph) - throws NamingException - { - EDataObject rootDataObject = - ( EDataObject ) eDataGraph.getRootObject(); - - EClass rootDataObjectEClass = - rootDataObject.eClass(); - - String xsdNamespace = - rootDataObjectEClass. - getEPackage(). - getNsURI(); - - LdapContext rootContext = - context. - getXsdNamespaceToLdapContextMap(). - get(xsdNamespace); - - if (rootContext == null) - { - rootContext = - InitialContextCreator. - create( - xsdNamespace, - context. - getDasContext() ); - - context. - getXsdNamespaceToLdapContextMap(). - put(xsdNamespace, rootContext); - } - - EDataGraphUpdater.update( - eDataGraph, - rootContext, - context. - getDataObjectToRelativeDNCache()); - } - - public Context getContext() - { - return context; - } - - public ADSEmbeddedConnection getAdsEmbeddedConnection() - { - return adsEmbeddedConnection; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDASHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDASHelper.java deleted file mode 100644 index d9d2f9a0bd..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/LdapDASHelper.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf; - -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.emf.create.EDataGraphCreator; -import org.apache.tuscany.das.ldap.emf.read.EDataGraphReader; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper; -import org.apache.tuscany.das.ldap.schema.emf.create.ModelTypeSystemCreator; -import org.apache.tuscany.model.ConfigurationFactory; -import org.apache.tuscany.model.DASMeta; -import org.apache.tuscany.model.impl.ConfigurationPackageImpl; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; -import org.eclipse.emf.ecore.sdo.SDOFactory; - -public class LdapDASHelper -implements -DASConstants, -ObjectClassConstants, -AttributeTypeConstants, -SchemaObjectClassConstants -{ - public static EDataGraph readDasMeta( - Context context, - Map metaDataObjectToRelativeDNCache) - throws Exception - { - EDataGraph dasMetaDataGraph = null; - - try - { - dasMetaDataGraph = - EDataGraphReader.read( - ConfigurationPackageImpl. - eINSTANCE.getDASMeta(), - DAS_META_ID_DEFAULT, - context. - getDasMetaContext(), - metaDataObjectToRelativeDNCache); - } - catch(NamingException e) - { - List eClassifiers = - EcoreTypeSystemHelper. - createEClassifiersList( - ConfigurationPackageImpl. - eINSTANCE); - - ModelTypeSystemCreator. - create( - context.getDasMetaContext(), - context.getEcoreAttributeTypesContext(), - context.getEcoreObjectClassesContext(), - eClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - DASMeta dasMeta = - ConfigurationFactory. - INSTANCE. - createDASMeta(); - - dasMetaDataGraph = - SDOFactory. - eINSTANCE. - createEDataGraph(); - - dasMetaDataGraph. - setERootObject( - ( EObject ) dasMeta ); - - EDataGraphCreator.create( - dasMetaDataGraph, - context. - getDasMetaContext(), - metaDataObjectToRelativeDNCache); - } - return dasMetaDataGraph; - } - - public static boolean isSchemaReady( - String xsdNamespace, - DASMeta dasMeta) - { - return - dasMeta. - getSupportedSchemas(). - contains(xsdNamespace); - } - - public static boolean isSchemaWritten( - EClass eClass, - LdapContext ecoreObjectClassesContext) - throws Exception - { - String xsdNamespace = - eClass.getEPackage().getNsURI(); - - String eObjectClassRDN = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClass.getName()); - try { - ecoreObjectClassesContext. - lookup( eObjectClassRDN ); - } - catch (Exception e) - { - return false; - } - return true; - } - - - public static boolean isSchemaSupported( - String xsdNamespaceURI, - DASMeta dasMeta) - { - return - dasMeta. - getSupportedSchemas(). - contains(xsdNamespaceURI); - } - - public static void initializeSchemaContexts( - LdapContext schemaContext, - LdapContext ecoreObjectClassesContext, - LdapContext ecoreAttributeTypesContext) - throws NamingException - { - LdapContext ecoreContext = - createEcoreContext(schemaContext); - - ecoreObjectClassesContext = - createEcoreObjectClassesContext(ecoreContext); - - ecoreAttributeTypesContext = - createEcoreAttributeTypesContext( ecoreContext ); - } - - - public static LdapContext createEcoreContext( - LdapContext schemaContext) - throws NamingException - { - String ecoreContextRDN = - CN + "=" + ECORE_CONTEXT_NAME; - - try - { - return ( LdapContext ) schemaContext.lookup( ecoreContextRDN ); - } - catch (Exception e) - { - //Create the context - } - - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - contextAttributes.put( objectClassAttribute ); - contextAttributes.put( CN, ECORE_CONTEXT_NAME ); - - return - ( LdapContext ) - schemaContext. - createSubcontext( - ecoreContextRDN, - contextAttributes ); - } - - public static LdapContext createEcoreObjectClassesContext( - LdapContext schemaContext) - throws NamingException - { - LdapContext ecoreContext = - createEcoreContext(schemaContext); - - String ecoreObjectClassesContextRDN = - OU + "=" + OBJECT_CLASSES_CONTEXT_NAME; - - try - { - return - ( LdapContext ) - ecoreContext. - lookup( - ecoreObjectClassesContextRDN ); - } - catch (Exception e) - { - //Create the context - } - - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return - ( LdapContext ) - ecoreContext. - createSubcontext( - ecoreObjectClassesContextRDN, - contextAttributes ); - } - - public static LdapContext createEcoreAttributeTypesContext( - LdapContext schemaContext) - throws NamingException - { - LdapContext ecoreContext = - createEcoreContext(schemaContext); - - String ecoreAttributeTypesContextRDN = - OU + "=" + ATTRIBUTE_TYPES_CONTEXT_NAME; - - try - { - return - ( LdapContext ) - ecoreContext. - lookup( - ecoreAttributeTypesContextRDN ); - } - catch (Exception e) - { - //Create the context - } - - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - contextAttributes.put( OU, ATTRIBUTE_TYPES_CONTEXT_NAME ); - contextAttributes.put( objectClassAttribute ); - - return - ( LdapContext ) - ecoreContext.createSubcontext( - ecoreAttributeTypesContextRDN, - contextAttributes ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreator.java deleted file mode 100644 index bfba12d3b5..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create; - -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphCreator -implements AttributeTypeConstants -{ - public static void create( - EDataGraph eDataGraph, - LdapContext rootContext, - Map dataObjectToRelativeDNCache) - throws NamingException - { - EDataObject rootDataObject = - (EDataObject) - eDataGraph.getRootObject(); - - EDataObjectCreator.create( - rootDataObject, - rootContext, - dataObjectToRelativeDNCache); - - EList children = - rootDataObject.eContents(); - - if (children.size() > 0) - { - EDataGraphCreatorHelper.createChildren( - children, - rootContext, - dataObjectToRelativeDNCache); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreatorHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreatorHelper.java deleted file mode 100644 index ab1209224a..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataGraphCreatorHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create; - -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphCreatorHelper -implements AttributeTypeConstants -{ - /* - * TODO Make mutlithreaded - */ - public static void createChildren( - EList children, - LdapContext rootContext, - Map dataObjectToRelativeDNCache) - throws NamingException - { - LdapContext eContainmentFeatureContext = - null; - - for (EObject eObject : children) - { - String parentContextRDN = - dataObjectToRelativeDNCache.get(eObject.eContainer()); - - LdapContext parentContext = - (LdapContext) - rootContext. - lookup(parentContextRDN); - - EStructuralFeature eContainmentFeature = - eObject.eContainingFeature(); - - String eContainingFeatureContextName = - CN + "="+ eContainmentFeature.getName(); - - try - { - eContainmentFeatureContext = - (LdapContext) - parentContext.lookup( - eContainingFeatureContextName); - } - catch (Exception e) - { - eContainmentFeatureContext = - (LdapContext) - parentContext. - createSubcontext( - eContainingFeatureContextName); - } - - EDataObjectCreator.create(( - EDataObject) eObject, - eContainmentFeatureContext, - dataObjectToRelativeDNCache); - - children = - eObject.eContents(); - - if ( children.size()> 0) - { - createChildren( - children, - rootContext, - dataObjectToRelativeDNCache); - } - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreator.java deleted file mode 100644 index 5d79d40fb5..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreator.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create; - -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataObjectCreator -implements DASConstants -{ - /** - * Create the LDAP entry for the EDataObject argument - * - * @param eDataObject the e data object - * @param containerContext the container context - * - * @throws NamingException the naming exception - */ - public static void create( - EDataObject eDataObject, - LdapContext containerContext, - Map dataObjectToRelativeDNCache) - throws NamingException - { - String rdn = - null; - Object dataObjectID = - null; - - EClass eClass = - eDataObject.eClass(); - - EAttribute idEAttribute = - eClass.getEIDAttribute(); - - String namespaceURI = - eClass.getEPackage().getNsURI(); - - String qualifiedEAttributeName = - null; - String normalizedEAttributeName = - null; - - Attributes attributes = - new BasicAttributes(); - - attributes = - EDataObjectCreatorHelper.processEAttributes( - attributes, - eDataObject, - eClass, - namespaceURI); - - attributes = - EDataObjectCreatorHelper.processEReferences( - attributes, - eDataObject, - eClass, - namespaceURI); - - String qualifiedEClassName = - ComplexTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName() ); - - String normalizedEClassName = - QualifiedNameNormalizer. - normalize(qualifiedEClassName); - - Attribute objectClassAttribute = - new BasicAttribute("objectClass"); - - objectClassAttribute. - add(normalizedEClassName); - - attributes.put(objectClassAttribute); - - dataObjectID = - eDataObject.eGet(idEAttribute ); - - qualifiedEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - idEAttribute.getName() ); - - normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeName); - - rdn = - normalizedEAttributeName + "=" + dataObjectID; - - containerContext.createSubcontext( - rdn, - attributes ); - - EDataObjectCreatorHelper. - updateDataObjectToRelativeDNCache( - eDataObject, - dataObjectToRelativeDNCache, - rdn); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreatorHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreatorHelper.java deleted file mode 100644 index 90ec5701ad..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/create/EDataObjectCreatorHelper.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create; - -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataObjectCreatorHelper -implements DASConstants -{ - - public static void updateDataObjectToRelativeDNCache( - EDataObject eDataObject, - Map dataObjectToRelativeDNCache, - String rdn) - { - EDataObject parentDataObject = - (EDataObject) eDataObject.eContainer(); - - if (parentDataObject !=null) - { - String parentRDN = - dataObjectToRelativeDNCache. - get(parentDataObject); - rdn = - rdn + - "," + - "cn=" + - eDataObject.eContainingFeature().getName() + - "," + - parentRDN; - dataObjectToRelativeDNCache.put(eDataObject, rdn); - } - else - { - dataObjectToRelativeDNCache.put(eDataObject, rdn); - } - } - - - /** - * Process EAttributes adding the normalized EAttribute instance's - * name and corresponding values to the attributes argument. - * - * @param attributes the attributes - * @param eDataObject the e data object - * @param eClass the e class - * @param namespaceURI the namespace URI - * - * @return the attributes - * - * @throws NamingException the naming exception - * - * Note that ApacheDS supports the Syntaxes (DataTypes) - * Boolean, Integer, String. This means that all values that - * are not Boolean or Integer are stored as Strings. - */ - public static Attributes processEAttributes( - Attributes attributes, - EDataObject eDataObject, - EClass eClass, - String namespaceURI) - throws NamingException - { - EcorePackage ecorePackage = - EcorePackage.eINSTANCE; - - EAttribute idEAttribute = - eClass.getEIDAttribute(); - - List eAttributes = - eClass.getEAllAttributes(); - - String qualifiedEAttributeName = - null; - String normalizedEAttributeName = - null; - - for (EAttribute eAttribute : eAttributes) - { - Attribute attribute = - processEAttribute( - eAttribute, - namespaceURI, - eClass, eDataObject); - attributes.put(attribute); - } - return attributes; - } - - /* - * TODO This is also used in updates so consider moving to a utility - */ - public static Attribute processEAttribute( - EAttribute eAttribute, - String namespaceURI, - EClass eClass, - EDataObject eDataObject) - { - String qualifiedEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eAttribute.getName() ); - - String normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeName); - - Attribute attribute = - new BasicAttribute(normalizedEAttributeName); - - if (eAttribute.isMany()) - { - if ( !(eAttribute.getEType() == EcorePackage.eINSTANCE.getEBoolean() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEBooleanObject() ) ) - { - EList eAttributeValues = - ( EList ) eDataObject.eGet( eAttribute ); - - for (Object eAttributeValue : eAttributeValues) - { - attribute.add(eAttributeValue.toString() ); - } - } - else - { - EList eAttributeValues = - ( EList ) eDataObject.eGet( eAttribute ); - - for (Boolean eAttributeValue : eAttributeValues) - { - if (eAttributeValue == false) - { - attribute.add(Boolean.FALSE.toString().toUpperCase() ); - } - else - { - attribute.add(Boolean.TRUE.toString().toUpperCase() ); - } - } - } - return attribute; - } - - if ( !(eAttribute.getEType() == EcorePackage.eINSTANCE.getEBoolean() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEBooleanObject() ) ) - { - Object eAttributeValue = - eDataObject.eGet( eAttribute ); - - attribute.add(eAttributeValue.toString() ); - } - else - { - Boolean eAttributeValue = - (Boolean) eDataObject.eGet( eAttribute ); - - if (eAttributeValue == false) - { - attribute.add(Boolean.FALSE.toString().toUpperCase() ); - } - else - { - attribute.add(Boolean.TRUE.toString().toUpperCase() ); - } - } - return attribute; - } - - /** - * Process references adding the normalized EReference instance's - * name and corresponding id (IDs for multiplicity many references) - * to the attributes argument. - * - * @param attributes the attributes - * @param eDataObject the e data object - * @param eClass the e class - * @param namespaceURI the namespace URI - * - * @return the attributes - */ - public static Attributes processEReferences( - Attributes attributes, - EDataObject eDataObject, - EClass eClass, - String namespaceURI) - { - List eReferences = - eClass.getEAllReferences(); - - for (EReference eReference : eReferences) - { - String qualifiedEReferenceName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eReference.getName() ); - - String normalizedEReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceName); - - if (eReference.isMany()) - { - List referencedEDataObjects = - (List) eDataObject.eGet(eReference); - - Attribute idAttribute = - new BasicAttribute(normalizedEReferenceName); - - for (EDataObject containedEDataObject : referencedEDataObjects) - { - EClass containedEDataObjectEClass = - containedEDataObject.eClass(); - - String containedEDataObjectID = - (String) containedEDataObject.eGet( - containedEDataObjectEClass. - getEIDAttribute()); - - idAttribute.add(containedEDataObjectID); - } - attributes.put(idAttribute); - } - else - { - EDataObject containedEDataObject = - (EDataObject) - eDataObject.eGet(eReference); - - if (containedEDataObject != null) - { - EClass containedEDataObjectEClass = - containedEDataObject.eClass(); - - String containedEDataObjectID = - (String) containedEDataObject.eGet( - containedEDataObjectEClass. - getEIDAttribute()); - - attributes.put( - normalizedEReferenceName, - containedEDataObjectID); - } - } - } - return attributes; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReader.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReader.java deleted file mode 100644 index 9add9b7677..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReader.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read; - -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; -import org.eclipse.emf.ecore.sdo.SDOFactory; - -public class EDataGraphReader -implements DASConstants -{ - public static EDataGraph read( - EClass rootDataObjectEClass, - String id, - LdapContext rootContext, - Map dataObjectToRelativeDNCache) - throws NamingException, LdapNameNotFoundException - { - EDataGraph eDataGraph = - SDOFactory.eINSTANCE.createEDataGraph(); - - String namespaceURI = - rootDataObjectEClass.getEPackage(). - getNsURI(); - - EAttribute idEAttribute = - rootDataObjectEClass.getEIDAttribute(); - - String qualifiedIDEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - rootDataObjectEClass.getName(), - idEAttribute.getName() ); - - String normalizedIDEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedIDEAttributeName); - - String eDataObjectRDN = - normalizedIDEAttributeName + "=" + id; - - LdapContext eDataObjectContext = - (LdapContext) - rootContext. - lookup(eDataObjectRDN); - - Attributes attributes = - rootContext. - getAttributes(eDataObjectRDN); - - Map>> crossReferenceIDCache = - new Hashtable>>(); - - EDataObject rootDataObject = - EDataGraphReaderHelper. - restoreEDataObject( - crossReferenceIDCache, - rootDataObjectEClass, - namespaceURI, - attributes); - - String relativeDN = - EDataGraphReaderHelper.calculateRelativeDN( - rootContext, - eDataObjectContext); - - dataObjectToRelativeDNCache. - put(rootDataObject, relativeDN); - - List eReferences = - rootDataObjectEClass.getEAllContainments(); - - if (rootDataObjectEClass.getEAllContainments().size() > 0) - { - EDataGraphReaderHelper. - addContainmentDataObjects( - crossReferenceIDCache, - dataObjectToRelativeDNCache, - rootDataObject, - attributes, - namespaceURI, - eDataObjectContext, - rootContext); - } - - eDataGraph.setERootObject(rootDataObject); - - Resource resource = eDataGraph.getRootResource(); - - EDataGraphReaderHelper.restoreCrossReferences( - crossReferenceIDCache, - resource); - - return eDataGraph; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReaderHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReaderHelper.java deleted file mode 100644 index 1496d91dab..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataGraphReaderHelper.java +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read; - -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.impl.EClassImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphReaderHelper -implements DASConstants -{ - public static String calculateRelativeDN( - LdapContext containerContext, - LdapContext dataObjectContext) throws NamingException - { - String containerDN = containerContext.getNameInNamespace(); - String dataObjectDN = dataObjectContext.getNameInNamespace(); - - int beginIndex = 0; - int endIndex = - dataObjectDN.length() - containerDN.length() - 1; - - String result = - dataObjectDN.substring( - beginIndex, - endIndex); - - return result; - } - - - public static EDataObject restoreEDataObject( - Map>> crossReferenceIDCache, - EClass eClass, - String namespaceURI, - Attributes attributes) - throws NamingException - { - EDataObject eDataObject = - (EDataObject) - eClass.getEPackage(). - getEFactoryInstance(). - create(eClass); - - EDataObjectReaderHelper. - restoreEAttributes( - eClass, - eDataObject, - namespaceURI, - attributes ); - - EStructuralFeature[] eCrossReferences = - ((EClassImpl.FeatureSubsetSupplier) - eDataObject. - eClass(). - getEAllStructuralFeatures()). - crossReferences(); - - if (eCrossReferences != null) - { - Map> eReferenceToEObjectIDs = - new Hashtable>(); - - for (EStructuralFeature eReference : eCrossReferences) - { - String qualifiedEReferenceName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eReference.getName() ); - - String normalizedEReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceName); - - if (eReference.isMany()) - { - List idList = - new ArrayList(); - - Attribute eReferenceAttribute = - attributes.get(normalizedEReferenceName); - - NamingEnumeration namingEnumeration = - eReferenceAttribute.getAll(); - - while (namingEnumeration.hasMore()) - { - String id = (String) namingEnumeration.next(); - idList.add(id); - eReferenceToEObjectIDs.put(eReference, idList); - } - } - else - { - List idList = - new ArrayList(); - - String value = - (String) - attributes. - get(normalizedEReferenceName). - get(); - - idList.add(value); - eReferenceToEObjectIDs.put(eReference, idList); - } - crossReferenceIDCache.put( - eDataObject, - eReferenceToEObjectIDs); - } - } - return eDataObject; - } - - public static void restoreCrossReferences( - Map>> crossReferenceIDCache, - Resource resource) - { - for (EDataObject eDataObject : crossReferenceIDCache.keySet()) - { - Map> eReferenceToIDListMap = - crossReferenceIDCache.get(eDataObject); - - for (EStructuralFeature eStructuralFeature : eReferenceToIDListMap.keySet()) - { - if (eStructuralFeature.isMany()) - { - List eReferenceIDs = - eReferenceToIDListMap. - get(eStructuralFeature); - - EList multiplicityManyList = null; - if (eReferenceIDs.size() > 0) - { - multiplicityManyList = - new BasicEList(); - } - for (String eReferenceID : eReferenceIDs) - { - Object referencedDataObject = resource.getEObject(eReferenceID); - multiplicityManyList.add((EDataObject) referencedDataObject); - eDataObject.eSet( - eStructuralFeature, - multiplicityManyList); - } - } - else - { - String eReferenceID = - eReferenceToIDListMap. - get(eStructuralFeature). - get(0); - - Object referencedDataObject = resource.getEObject(eReferenceID); - eDataObject.eSet( - eStructuralFeature, - referencedDataObject); - } - } - } - } - - public static void addContainmentDataObjects( - Map crossReferenceIDCache, - Map dataObjectToRelativeDNCache, - EDataObject containerDataObject, - Attributes attributes, - String namespaceURI, - LdapContext eDataObjectContext, - LdapContext rootContext) throws NamingException - { - EClass eClass = - containerDataObject.eClass(); - - List eReferences = - eClass.getEAllContainments(); - - for (EReference eReference : eReferences) - { - String qualifiedEReferenceName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eReference.getName() ); - - String normalizedReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceName); - - Attribute attribute = - attributes. - get(normalizedReferenceName); - - if (attribute.size() > 0) - { - LdapContext eReferenceContainmentContext = - (LdapContext) - eDataObjectContext. - lookup("cn=" + eReference.getName()); - - EClass eReferenceType = - (EClass) eReference.getEType(); - - EAttribute eReferenceTypeEIDAttribute = - eReferenceType.getEIDAttribute(); - - String qualifiedEReferenceTypeIDEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eReferenceType.getName(), - eReferenceTypeEIDAttribute.getName() ); - - String normalizedReferenceTypeEIDAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceTypeIDEAttributeName); - - if (eReference.isMany()) - { - EList containmentList = - new BasicEList(); - - NamingEnumeration idNamingEnumeration = - attribute.getAll(); - - while(idNamingEnumeration.hasMore()) - { - String containedDataObjectID = - (String) idNamingEnumeration.next(); - - String containedDataObjectEntryRDN = - normalizedReferenceTypeEIDAttributeName - + "=" + containedDataObjectID; - - Attributes eReferenceAttributes = - eReferenceContainmentContext. - getAttributes(containedDataObjectEntryRDN); - - - EDataObject eReferenceDataObject = - EDataGraphReaderHelper. - restoreEDataObject( - crossReferenceIDCache, - eReferenceType, - namespaceURI, - eReferenceAttributes); - - //TODO Consider using aspects - String relativeDN = - calculateRelativeDN( - rootContext, - (LdapContext) - eReferenceContainmentContext. - lookup(containedDataObjectEntryRDN)); - dataObjectToRelativeDNCache.put(eReferenceDataObject, relativeDN); - //End of Aspect - - containmentList.add(eReferenceDataObject); - - if (eReferenceDataObject.eClass().getEAllContainments().size() > 0) - { - addContainmentDataObjects( - crossReferenceIDCache, - dataObjectToRelativeDNCache, - eReferenceDataObject, - eReferenceAttributes, - namespaceURI, - (LdapContext) eReferenceContainmentContext. - lookup(containedDataObjectEntryRDN), - rootContext); - } - } - containerDataObject.eSet(eReference, containmentList); - } - else - { - String containedDataObjectID = - (String) attribute.get(); - - String containedDataObjectEntryRDN = - normalizedReferenceTypeEIDAttributeName - + "=" + containedDataObjectID; - - Attributes eReferenceAttributes = - eReferenceContainmentContext. - getAttributes(containedDataObjectEntryRDN); - - EDataObject eReferenceDataObject = - EDataGraphReaderHelper. - restoreEDataObject( - crossReferenceIDCache, - eReferenceType, - namespaceURI, - eReferenceAttributes); - - //TODO Consider using aspects - String relativeDN = - calculateRelativeDN( - rootContext, - (LdapContext) - eReferenceContainmentContext. - lookup(containedDataObjectEntryRDN)); - - dataObjectToRelativeDNCache.put(eReferenceDataObject, relativeDN); - //End of Aspect - - containerDataObject.eSet(eReference, eReferenceDataObject); - - if (eReferenceDataObject.eClass().getEAllContainments().size() > 0) - { - addContainmentDataObjects( - crossReferenceIDCache, - dataObjectToRelativeDNCache, - eReferenceDataObject, - eReferenceAttributes, - namespaceURI, - (LdapContext) eReferenceContainmentContext. - lookup(containedDataObjectEntryRDN), - rootContext); - } - } - } - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReader.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReader.java deleted file mode 100644 index 0c812f4bfc..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReader.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataObjectReader -implements DASConstants -{ - /** - * Read. - * - * @param eClass the e class - * @param id the id - * @param containerContext the container context - * - * @return the e data object - * - * @throws NamingException the naming exception - * - * Note that this is more of a utility, as only this class's - * helper is used in restoring the EDataGraph. - */ - public static EDataObject read( - EClass eClass, - String id, - LdapContext containerContext) - throws NamingException - { - String namespaceURI = - eClass.getEPackage(). - getNsURI(); - - EAttribute idEAttribute = - eClass.getEIDAttribute(); - - String qualifiedIDEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - idEAttribute.getName() ); - - String normalizedIDEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedIDEAttributeName); - - String eDataObjectRDN = - normalizedIDEAttributeName + "=" + id; - - LdapContext eDataObjectContext = - (LdapContext) - containerContext. - lookup(eDataObjectRDN); - - Attributes attributes = - eDataObjectContext.getAttributes(""); - - EDataObject eDataObject = - (EDataObject) - eClass.getEPackage(). - getEFactoryInstance(). - create(eClass); - - EDataObjectReaderHelper. - restoreEAttributes( - eClass, - eDataObject, - namespaceURI, - attributes ); - - return eDataObject; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReaderHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReaderHelper.java deleted file mode 100644 index 2fa6321a65..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/read/EDataObjectReaderHelper.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read; - -import java.util.List; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.sdo.EDataObject; -import org.eclipse.emf.ecore.util.EcoreUtil; - -public class EDataObjectReaderHelper -implements DASConstants -{ - public static void restoreEAttributes( - EClass eClass, - EDataObject eDataObject, - String namespaceURI, - Attributes attributes) - throws NamingException - { - List eAttributes = - eClass.getEAllAttributes(); - - for (EAttribute eAttribute : eAttributes) - { - String qualifiedEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eAttribute.getName() ); - - String normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeName); - - if (eAttribute.isMany()) - { - EList values = - new BasicEList(); - - Attribute attribute = - attributes. - get(normalizedEAttributeName); - - for (int i = 0; i < attribute.size(); i++) - { - String value = (String) attribute.get(i); - - values.add(EcoreUtil.createFromString( - eAttribute.getEAttributeType(), - value)); - } - - eDataObject.eSet( - eAttribute, values); - } - else - { - String value = - (String) - attributes. - get(normalizedEAttributeName). - get(); - - eDataObject.eSet( - eAttribute, - EcoreUtil.createFromString( - eAttribute.getEAttributeType(), - value)); - } - } - } - - - //TODO Test all of these verifying that we get out what we put in - //TODO Move to helper - //TODO Note that we are using eDataObject.eSet(eAttribute, EcoreUtil.createFromString(eAttribute.getEAttributeType(), value)); instead - /* - public static void setEDataObjectFeature( - EDataObject eDataObject, - String value, - EAttribute eAttribute) - { - if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEString()) - { - eDataObject.eSet(eAttribute, value); - } - else if ( - eAttribute.getEType() == EcorePackage.eINSTANCE.getEInt() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEIntegerObject()) - { - eDataObject.eSet(eAttribute, new Integer(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEBoolean() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEBooleanObject()) - { - eDataObject.eSet(eAttribute, new Boolean(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEFloat() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEFloatObject()) - { - eDataObject.eSet(eAttribute, new Float(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEDouble() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEDoubleObject()) - { - eDataObject.eSet(eAttribute, new Double(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEBigDecimal()) - { - eDataObject.eSet(eAttribute, new BigDecimal(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEBigInteger() ) - { - eDataObject.eSet(eAttribute, new BigInteger(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEByte() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEByteObject()) - { - eDataObject.eSet(eAttribute, new Byte(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEByte() || - eAttribute.getEType() == EcorePackage.eINSTANCE.getEByteObject()) - { - eDataObject.eSet(eAttribute, new Byte(value)); - } - else if (eAttribute.getEType() == EcorePackage.eINSTANCE.getEByteArray()) - { - throw new RuntimeException("Sorry - ByteArrays are not supported."); - } - } - */ -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdater.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdater.java deleted file mode 100644 index 4c22faf1ce..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdater.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.update; - -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.eclipse.emf.ecore.sdo.EChangeSummary; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphUpdater -implements DASConstants -{ - public static void update( - EDataGraph eDataGraph, - LdapContext rootContext, - Map dataObjectToRelativeDNCache ) - throws NamingException - { - EChangeSummary eChangeSummary = - (EChangeSummary) - eDataGraph.getChangeSummary(); - - EDataGraphUpdaterHelper. - processChangedDataObjects( - eChangeSummary, - rootContext, - dataObjectToRelativeDNCache); - - EDataGraphUpdaterHelper. - processCreatedDataObjects( - eChangeSummary, - rootContext, - dataObjectToRelativeDNCache); - - EDataGraphUpdaterHelper. - processDestroyedDataObjects( - eChangeSummary, - rootContext, - dataObjectToRelativeDNCache); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdaterHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdaterHelper.java deleted file mode 100644 index a53b5547fb..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/emf/update/EDataGraphUpdaterHelper.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.update; - -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.DirContext; -import javax.naming.directory.ModificationItem; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.emf.create.EDataGraphCreatorHelper; -import org.apache.tuscany.das.ldap.emf.create.EDataObjectCreatorHelper; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.EMap; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.change.FeatureChange; -import org.eclipse.emf.ecore.sdo.EChangeSummary; -import org.eclipse.emf.ecore.sdo.EDataObject; - - -public class EDataGraphUpdaterHelper -{ - public static void processDestroyedDataObjects( - EChangeSummary eChangeSummary, - LdapContext containerContext, - Map dataObjectToRelativeDNCache) - throws NamingException - { - EList destroyedObjects = - eChangeSummary. - getObjectsToAttach(); - - for (EObject destroyedObject : destroyedObjects) - { - String destroyedObjectRelativeDN = dataObjectToRelativeDNCache.get(destroyedObject); - containerContext.destroySubcontext(destroyedObjectRelativeDN); - dataObjectToRelativeDNCache.remove(destroyedObject); - } - } - - public static void processCreatedDataObjects( - EChangeSummary eChangeSummary, - LdapContext rootContext, - Map dataObjectToRelativeDNCache ) - throws NamingException - { - EList createdObjects = - eChangeSummary. - getObjectsToDetach(); - - EDataGraphCreatorHelper.createChildren( - createdObjects, - rootContext, - dataObjectToRelativeDNCache); - } - - public static void processChangedDataObjects( - EChangeSummary eChangeSummary, - LdapContext containerContext, - Map dataObjectToRelativeDNCache ) - throws NamingException - { - EMap> objectChanges = - eChangeSummary.getObjectChanges(); - - for (EObject changedDataObject : objectChanges.keySet()) - { - EList featureChanges = - objectChanges.get(changedDataObject); - - ModificationItem[] modificationItems = - new ModificationItem[featureChanges.size()]; - - EClass changedDataObjectEClass = - changedDataObject.eClass(); - - String namespaceURI = - changedDataObjectEClass. - getEPackage(). - getNsURI(); - - for (int i = 0; i < featureChanges.size(); i++) - { - FeatureChange featureChange = - featureChanges.get(i); - - EStructuralFeature eStructuralFeature = - featureChange.getFeature(); - - if (eStructuralFeature instanceof EAttribute) - { - //TODO Note that we are not checking multiplicity many on EAttributes - String qualifiedEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - changedDataObjectEClass.getName(), - eStructuralFeature.getName() ); - - String normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeName); - - //TODO PUt processEAttribute in a more generic class - Attribute attribute = - EDataObjectCreatorHelper.processEAttribute( - (EAttribute)eStructuralFeature, - namespaceURI, - changedDataObjectEClass, - (EDataObject) changedDataObject); - - modificationItems[i] = - new ModificationItem( - DirContext.REPLACE_ATTRIBUTE, - attribute); - } - else - { - String qualifiedEReferenceName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - changedDataObjectEClass.getName(), - eStructuralFeature.getName() ); - - String normalizedEReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceName); - - Attribute attribute = - new BasicAttribute(normalizedEReferenceName); - - if (eStructuralFeature.isMany()) - { - EList referenceList = - (EList) changedDataObject.eGet(eStructuralFeature); - - if (referenceList.size() > 0 && referenceList!=null) - { - for (EDataObject eDataObject : referenceList) - { - attribute.add( - eDataObject. - eGet( - eDataObject. - eClass(). - getEIDAttribute())); - - modificationItems[i] = - new ModificationItem( - DirContext.REPLACE_ATTRIBUTE, - attribute); - } - } - else - { - modificationItems[i] = - new ModificationItem( - DirContext.REMOVE_ATTRIBUTE, - attribute); - } - } - else - { - EDataObject eDataObject = - (EDataObject) - changedDataObject. - eGet(eStructuralFeature); - - if (eDataObject != null) - { - attribute.add( - eDataObject. - eGet( - eDataObject. - eClass(). - getEIDAttribute())); - - modificationItems[i] = - new ModificationItem( - DirContext.REPLACE_ATTRIBUTE, - attribute); - } - else - { - modificationItems[i] = - new ModificationItem( - DirContext.REMOVE_ATTRIBUTE, - attribute); - } - } - } - } - String relativeDN = - dataObjectToRelativeDNCache. - get(changedDataObject); - - containerContext.modifyAttributes( - relativeDN, - modificationItems); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/constants/EncryptionConstants.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/constants/EncryptionConstants.java deleted file mode 100644 index 59b726b4f3..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/constants/EncryptionConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.encryption.constants; - -public interface EncryptionConstants -{ - String MD5 = "MD5"; - String SHA1 = "SHA-1";//Produces longer hashes than MD5 -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/util/ChecksumUtils.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/util/ChecksumUtils.java deleted file mode 100644 index 7c77ddf510..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/encryption/util/ChecksumUtils.java +++ /dev/null @@ -1,38 +0,0 @@ - -package org.apache.tuscany.das.ldap.encryption.util; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -import org.apache.tuscany.das.ldap.encryption.constants.EncryptionConstants; - -public class ChecksumUtils -implements EncryptionConstants -{ - public static String computeMD5Hash(String string) - throws NoSuchAlgorithmException - { - MessageDigest messageDigest = MessageDigest.getInstance(MD5); - - byte[] digest = - messageDigest.digest(string.getBytes()); - - StringBuffer hexString = new StringBuffer(); - for (int i=0;i MAX_OID_SEGMENT_LENGTH ) - { - segmentedOID += oid.substring( endIndex + 1,endIndex + 9 ) + "."; - segmentedOID += oid.substring( endIndex + 10, oid.length() ); - } - else - { - segmentedOID += oid.substring( endIndex + 1, oid.length() ); - } - return segmentedOID; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/SimpleTypeOIDCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/SimpleTypeOIDCreator.java deleted file mode 100644 index 3c083fc42f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/oid/create/SimpleTypeOIDCreator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.oid.create; - -import org.apache.tuscany.das.ldap.encryption.constants.EncryptionConstants; -import org.apache.tuscany.das.ldap.encryption.util.ChecksumUtils; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; - -/** - * The Class SimpleTypeOIDCreator. - * Creates unique OIDs for namespaced - * metadata such as the XSD DataType - * with (Class specific term) qualifiedNameURI - * http://www.w3.org/2001/XMLSchema/string - * - */ -public class SimpleTypeOIDCreator implements EncryptionConstants -{ - /** - * Creates a unique OID. - * - * @param instanceClassName the instance class name - * @param oidPrefix the OID Branch - * @param complexTypeName the name - * @param namespaceURI the metadata namespace URI - * - * @return the string - * - * @throws Exception the exception - */ - public static String create( - String oidPrefix, - String namespaceURI, - String complexTypeName, - String simpleTypeName) - throws Exception - { - String qualifiedNameURI = - SimpleTypeNamespaceQualifier.qualify( - namespaceURI, - complexTypeName, - simpleTypeName); - - String postfixOID = ChecksumUtils.computeMD5Hash(qualifiedNameURI); - - postfixOID = OIDCreatorHelper.calculateSegmentedOID(postfixOID); - return oidPrefix + "." + postfixOID; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java deleted file mode 100644 index 17f011e971..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.apache.tuscany.das.ldap.prototype.setup; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; - -public interface Prototype { - EClass userEClass = - PrototypeUtilities.createUserEClass(); - EClass authorizationEClass = - PrototypeUtilities.createAuthorizationEClass(); - EClass configurationEClass = - PrototypeUtilities.createConfigurationEClass(); - - EAttribute userNameEAttribute = - PrototypeUtilities.createUserNameEAttribute(); - EAttribute userAliasesEAttribute = - PrototypeUtilities.createUserAliasesEAttribute(); - - EAttribute userPasswordEAttribute = - PrototypeUtilities.createUserPasswordEAttribute(); - EAttribute userIDEAttribute = - PrototypeUtilities.createUserIDEAttribute(); - EAttribute userAgeEAttribute = - PrototypeUtilities.createUserAgeEAttribute(); - EAttribute userHeightEAttribute = - PrototypeUtilities.createUserHeightEAttribute(); - EAttribute userIsMaleEAttribute = - PrototypeUtilities.createUserIsMaleEAttribute(); - EReference userAuthorizationEReference = - PrototypeUtilities.createUserAuthorizationEReference(); - - EReference userConfigurationEReference = - PrototypeUtilities.createUserConfigurationEReference(); - - - - - EAttribute authorizationFileEAttribute = - PrototypeUtilities.createFileEAttribute(); - EAttribute authorizationReadEAttribute = - PrototypeUtilities.createReadAuthorizationEAttribute(); - EAttribute authorizationWriteEAttribute= - PrototypeUtilities.createWriteAuthorizationEAttribute(); - EAttribute authorizationExecuteEAttribute = - PrototypeUtilities.createExecuteAuthorizationEAttribute(); - EAttribute authorizationIDEAttribute = - PrototypeUtilities.createAuthorizationIDEAttribute(); - - EAttribute configurationIDEAttribute = - PrototypeUtilities.createConfigurationIDEAttribute(); - - EReference configurationAuthorizationEReference = - PrototypeUtilities.createConfigurationAuthorizationEReference(); - - EReference configurationAuthorizationsEReference = - PrototypeUtilities.createConfigurationAuthorizationsEReference(); - - - EPackage userEPackage = - PrototypeUtilities.createUserEPackage(); - - EFactory userEFactory = - userEPackage.getEFactoryInstance(); - - EcoreFactory ecoreFactory = - EcoreFactory.eINSTANCE; - EcorePackage ecorePackage = - EcorePackage.eINSTANCE; -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java deleted file mode 100644 index 11af604dfa..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java +++ /dev/null @@ -1,243 +0,0 @@ -package org.apache.tuscany.das.ldap.prototype.setup; - -import org.apache.tuscany.das.ldap.testing.constants.DASTestingConstants; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.ETypedElement; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.sdo.impl.DynamicEDataObjectImpl; - -public class PrototypeUtilities -implements DASTestingConstants { - - /* - * The User EClass is intended to be the root of the DataGraph - * It should have a multiplicity many containment reference of type - * Authorization and a containment reference of type Configuration - * The Configuration should have a single non-containment reference - * of type Authorization. - */ - - public static EClass createUserEClass() - { - EClass userEClass = - EcoreFactory.eINSTANCE.createEClass(); - - userEClass.setName("User"); - - return userEClass; - } - - public static EAttribute createUserIDEAttribute() - { - EAttribute id = - EcoreFactory.eINSTANCE.createEAttribute(); - id.setName( "id" ); - id.setEType( EcorePackage.eINSTANCE.getEString() ); - id.setID(true); - return id; - } - - public static EAttribute createUserNameEAttribute() - { - EAttribute userName = - EcoreFactory.eINSTANCE.createEAttribute(); - userName.setName( "userName" ); - userName.setEType( EcorePackage.eINSTANCE.getEString() ); - return userName; - } - - public static EAttribute createUserAliasesEAttribute() - { - EAttribute userAliases = - EcoreFactory.eINSTANCE.createEAttribute(); - userAliases.setName( "userAliases" ); - userAliases.setLowerBound( 0 ); - userAliases.setUpperBound( -1 ); - userAliases.setEType( EcorePackage.eINSTANCE.getEString() ); - return userAliases; - } - - public static EAttribute createUserPasswordEAttribute() - { - EAttribute userPassword = - EcoreFactory.eINSTANCE.createEAttribute(); - userPassword.setName( "userPassword" ); - userPassword.setEType( EcorePackage.eINSTANCE.getEString() ); - return userPassword; - } - - public static EAttribute createUserAgeEAttribute() - { - EAttribute userAge = - EcoreFactory.eINSTANCE.createEAttribute(); - userAge.setName( "userAge" ); - userAge.setEType( EcorePackage.eINSTANCE.getEInt() ); - return userAge; - } - - public static EAttribute createUserHeightEAttribute() - { - EAttribute userHeight = - EcoreFactory.eINSTANCE.createEAttribute(); - userHeight.setName( "userHeight" ); - userHeight.setEType( EcorePackage.eINSTANCE.getEDouble() ); - return userHeight; - } - - public static EAttribute createUserIsMaleEAttribute() - { - EAttribute isMale = - EcoreFactory.eINSTANCE.createEAttribute(); - isMale.setName( "isMale" ); - isMale.setEType( EcorePackage.eINSTANCE.getEBoolean() ); - return isMale; - } - - public static EReference createUserAuthorizationEReference() - { - EReference userAuthorizationEReference = - EcoreFactory.eINSTANCE.createEReference(); - userAuthorizationEReference.setLowerBound(0); - userAuthorizationEReference.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY); - userAuthorizationEReference.setContainment(true); - userAuthorizationEReference.setName("authorizationList"); - - return userAuthorizationEReference; - } - - public static EReference createUserConfigurationEReference() - { - EReference userConfigurationEReference = - EcoreFactory.eINSTANCE.createEReference(); - userConfigurationEReference.setLowerBound(0); - userConfigurationEReference.setUpperBound(1); - userConfigurationEReference.setContainment(true); - userConfigurationEReference.setName("configuration"); - - return userConfigurationEReference; - } - - - public static EPackage createUserEPackage() - { - EPackage userEPackage = - EcoreFactory.eINSTANCE.createEPackage(); - userEPackage.setName( "userPackage" ); - userEPackage.setNsPrefix( "user" ); - userEPackage.setNsURI( xsdNamespace ); - - userEPackage.setEFactoryInstance( - new DynamicEDataObjectImpl.FactoryImpl()); - - return userEPackage; - } - - public static EClass createAuthorizationEClass() - { - EClass authorizationEClass = - EcoreFactory.eINSTANCE.createEClass(); - - authorizationEClass.setName("Authorization"); - - return authorizationEClass; - } - - public static EAttribute createAuthorizationIDEAttribute() - { - EAttribute id = - EcoreFactory.eINSTANCE.createEAttribute(); - id.setName( "id" ); - id.setEType( EcorePackage.eINSTANCE.getEString() ); - id.setID(true); - return id; - } - - public static EAttribute createFileEAttribute() - { - EAttribute fileNameEAttribute = - EcoreFactory.eINSTANCE.createEAttribute(); - fileNameEAttribute.setName( "fileName" ); - fileNameEAttribute.setEType( EcorePackage.eINSTANCE.getEString() ); - return fileNameEAttribute; - - } - - public static EAttribute createWriteAuthorizationEAttribute() - { - EAttribute writeAuthorizationEAttribute = - EcoreFactory.eINSTANCE.createEAttribute(); - writeAuthorizationEAttribute.setName( "writeAuthorization" ); - writeAuthorizationEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() ); - return writeAuthorizationEAttribute; - } - - public static EAttribute createReadAuthorizationEAttribute() - { - EAttribute readAuthorizationEAttribute = - EcoreFactory.eINSTANCE.createEAttribute(); - readAuthorizationEAttribute.setName( "readAuthorization" ); - readAuthorizationEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() ); - return readAuthorizationEAttribute; - } - - public static EAttribute createExecuteAuthorizationEAttribute() - { - EAttribute readExecuteEAttribute = - EcoreFactory.eINSTANCE.createEAttribute(); - readExecuteEAttribute.setName( "executeAuthorization" ); - readExecuteEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() ); - return readExecuteEAttribute; - } - - - public static EClass createConfigurationEClass() - { - EClass configurationEClass = - EcoreFactory.eINSTANCE.createEClass(); - - configurationEClass.setName("Configuration"); - - return configurationEClass; - } - - public static EAttribute createConfigurationIDEAttribute() - { - EAttribute id = - EcoreFactory.eINSTANCE.createEAttribute(); - id.setName( "id" ); - id.setEType( EcorePackage.eINSTANCE.getEString() ); - id.setID(true); - return id; - } - - public static EReference createConfigurationAuthorizationEReference() - { - EReference authorizationEReference = - EcoreFactory.eINSTANCE.createEReference(); - authorizationEReference.setLowerBound(0); - authorizationEReference.setUpperBound(1); - authorizationEReference.setContainment(false); - //authorizationEReference.setEType(createAuthorizationEClass()); Do this in the testing code. - authorizationEReference.setName("authorization"); - - return authorizationEReference; - } - - public static EReference createConfigurationAuthorizationsEReference() - { - EReference authorizationsEReference = - EcoreFactory.eINSTANCE.createEReference(); - authorizationsEReference.setLowerBound(0); - authorizationsEReference.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY); - authorizationsEReference.setContainment(false); - //authorizationEReference.setEType(createAuthorizationEClass()); Do this in the testing code. - authorizationsEReference.setName("authorizations"); - - return authorizationsEReference; - } - -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/CommonSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/CommonSetupTest.java deleted file mode 100644 index 9b7673efe6..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/CommonSetupTest.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.prototype.setup.test; - -import java.io.File; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.commons.io.FileUtils; -import org.apache.tuscany.das.ldap.prototype.setup.Prototype; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup; -import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class CommonSetupTest -extends EcoreSchemaAndDASContextsSetup -implements Prototype -{ - protected EObjectClassCreator eObjectClassCreator = null; - - protected EDataObject userDataObject = null; - protected EDataObject authorizationDataObject0 = null; - protected EDataObject authorizationDataObject1 = null; - protected EDataObject configurationDataObject = null; - - protected static List - processedEClassifiers = null; - - protected String userDataObjectRDN = - "example-com-users-accounts-User-id=1"; - protected String authorizationDataObject1RDN = - "example-com-users-accounts-Authorization-id=2,cn=authorizationList,example-com-users-accounts-User-id=1"; - protected String authorizationDataObject2RDN = - "example-com-users-accounts-Authorization-id=3,cn=authorizationList,example-com-users-accounts-User-id=1"; - protected String configurationDataObjectRDN = - "example-com-users-accounts-Configuration-id=5,cn=configuration,example-com-users-accounts-User-id=1"; - - protected String configurationContainingFeatureRDN = - "cn=configuration"; - protected String authorizationListContainingFeatureRDN= - "cn=authorizationList"; - - protected LdapContext authorizationContainerContext = null; - protected LdapContext configurationContainerContext = null; - protected LdapContext userContainerContext = null; - - protected Map dataObjectToRelativeDNCache = null; - - public void tearDown() throws NamingException, Exception - { - rootContext.destroySubcontext(userDataObjectRDN); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - userEClass, - TUSCANY_OID_PREFIX_VALUE ); - - super.tearDown(); - } - - public void setUp() throws Exception - { - FileUtils.deleteDirectory(new File("server-work")); - - dataObjectToRelativeDNCache = - new Hashtable(); - - super.setUp(); - - userAuthorizationEReference. - setEType(authorizationEClass); - - userConfigurationEReference. - setEType(configurationEClass); - - configurationAuthorizationEReference. - setEType(authorizationEClass); - - configurationAuthorizationsEReference. - setEType(authorizationEClass); - - userEClass. - getEStructuralFeatures(). - add( userNameEAttribute ); - - userEClass. - getEStructuralFeatures(). - add( userAliasesEAttribute ); - - userEClass. - getEStructuralFeatures(). - add( userPasswordEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userAgeEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userHeightEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userIsMaleEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userIDEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userAuthorizationEReference ); - userEClass. - getEStructuralFeatures(). - add( userConfigurationEReference ); - - userEPackage.getEClassifiers().add(userEClass); - - userDataObject = - (EDataObject) - userEFactory.create(userEClass); - - userDataObject.eSet(userNameEAttribute,"ole"); - userDataObject.eSet(userPasswordEAttribute,"secret"); - userDataObject.eSet(userIDEAttribute, "1"); - userDataObject.eSet(userAgeEAttribute, 33); - userDataObject.eSet(userHeightEAttribute, 6.11); - userDataObject.eSet(userIsMaleEAttribute, true); - - EList userAliases = new BasicEList(); - userAliases.add("neo"); - userAliases.add("trinity"); - userAliases.add("morpheus"); - - userDataObject.eSet( userAliasesEAttribute, userAliases ); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationFileEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationWriteEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationReadEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationExecuteEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationIDEAttribute); - - userEPackage.getEClassifiers(). - add(authorizationEClass); - - authorizationDataObject0 = - (EDataObject) - userEFactory.create(authorizationEClass); - - authorizationDataObject1 = - (EDataObject) - userEFactory.create(authorizationEClass); - - authorizationDataObject0.eSet(authorizationFileEAttribute,"somefile.text"); - authorizationDataObject0.eSet(authorizationWriteEAttribute, true); - authorizationDataObject0.eSet(authorizationReadEAttribute,true); - authorizationDataObject0.eSet(authorizationExecuteEAttribute,true); - authorizationDataObject0.eSet(authorizationIDEAttribute, "2"); - - authorizationDataObject1.eSet(authorizationFileEAttribute,"someOtherfile.text"); - authorizationDataObject1.eSet(authorizationWriteEAttribute,Boolean.TRUE); - authorizationDataObject1.eSet(authorizationReadEAttribute,true); - authorizationDataObject1.eSet(authorizationExecuteEAttribute,true); - authorizationDataObject1.eSet(authorizationIDEAttribute, "3"); - - EList userDataObjectAuthorizationList = - new BasicEList(); - - userDataObjectAuthorizationList.add(authorizationDataObject0); - userDataObjectAuthorizationList.add(authorizationDataObject1); - - userDataObject.eSet( - userAuthorizationEReference, - userDataObjectAuthorizationList); - - configurationEClass. - getEStructuralFeatures(). - add(configurationIDEAttribute); - - configurationEClass. - getEStructuralFeatures(). - add(configurationAuthorizationEReference); - - configurationEClass. - getEStructuralFeatures(). - add(configurationAuthorizationsEReference); - - userEPackage.getEClassifiers(). - add(configurationEClass); - - configurationDataObject = - (EDataObject) - userEFactory.create(configurationEClass); - - userDataObject.eSet( - userConfigurationEReference, - configurationDataObject); - - configurationDataObject.eSet( - configurationIDEAttribute, - "5"); - - configurationDataObject.eSet( - configurationAuthorizationEReference, - authorizationDataObject0); - - configurationDataObject.eSet( - configurationAuthorizationsEReference, - userDataObjectAuthorizationList); - - processedEClassifiers = - new ArrayList(); - - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - userEClass, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataGraphSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataGraphSetupTest.java deleted file mode 100644 index c05db9f7e2..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataGraphSetupTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.prototype.setup.test; - -import javax.naming.NamingException; - -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.emf.create.EDataGraphCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.SDOFactory; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; - -public class EDataGraphSetupTest -extends CommonSetupTest -{ - protected EDataGraph eDataGraph = null; - protected boolean readException = false; - - public void tearDown() throws NamingException, Exception - { - if (dataObjectToRelativeDNCache.containsValue(authorizationDataObject1RDN) - || readException) - { - rootContext.destroySubcontext(authorizationDataObject1RDN); - } - if (dataObjectToRelativeDNCache.containsValue(authorizationDataObject2RDN) - || readException) - { - rootContext.destroySubcontext(authorizationDataObject2RDN); - } - if (dataObjectToRelativeDNCache.containsValue(configurationDataObjectRDN) - || readException) - { - rootContext.destroySubcontext(configurationDataObjectRDN); - } - userContainerContext.destroySubcontext(configurationContainingFeatureRDN); - - userContainerContext.destroySubcontext(authorizationListContainingFeatureRDN); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - authorizationEClass, - TUSCANY_OID_PREFIX_VALUE ); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - configurationEClass, - TUSCANY_OID_PREFIX_VALUE ); - - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - authorizationEClass, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - configurationEClass, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - eDataGraph = - SDOFactory. - eINSTANCE. - createEDataGraph(); - - eDataGraph.setERootObject(userDataObject); - - ResourceSet resourceSet = new ResourceSetImpl(); - resourceSet.getResourceFactoryRegistry(). - getExtensionToFactoryMap().put - ("xml", - new XMLResourceFactoryImpl()); - - eDataGraph.setResourceSet(resourceSet); - - EDataGraphCreator.create( - eDataGraph, - rootContext, - dataObjectToRelativeDNCache); - - userContainerContext = - (LdapContext) - rootContext. - lookup(userDataObjectRDN); - - authorizationContainerContext = - (LdapContext) - userContainerContext. - lookup(authorizationListContainingFeatureRDN); - - configurationContainerContext = - (LdapContext) - userContainerContext. - lookup(configurationContainingFeatureRDN); - - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataObjectSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataObjectSetupTest.java deleted file mode 100644 index 4c91f34e07..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/EDataObjectSetupTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.prototype.setup.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.emf.create.EDataObjectCreator; - -public class EDataObjectSetupTest -extends CommonSetupTest -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - - EDataObjectCreator.create( - userDataObject, - rootContext, - dataObjectToRelativeDNCache); - - userContainerContext = - (LdapContext) - rootContext. - lookup(userDataObjectRDN); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/LdapDASSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/LdapDASSetupTest.java deleted file mode 100644 index 3225868ffe..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/prototype/setup/test/LdapDASSetupTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.prototype.setup.test; - -import java.io.File; -import java.util.Hashtable; -import java.util.Map; - -import javax.naming.NamingException; - -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.tuscany.das.ldap.prototype.setup.Prototype; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; -import org.eclipse.emf.ecore.sdo.SDOFactory; - -public class LdapDASSetupTest -extends TestCase -implements Prototype -{ - protected Map dataObjectToRelativeDNCache = null; - protected EDataGraph eDataGraph = null; - protected EDataObject userDataObject = null; - protected EDataObject authorizationDataObject0 = null; - protected EDataObject authorizationDataObject1 = null; - protected EDataObject configurationDataObject = null; - - public void tearDown() throws NamingException, Exception - { - FileUtils.deleteDirectory(new File("server-work")); - } - - public void setUp() throws Exception - { - dataObjectToRelativeDNCache = - new Hashtable(); - - userAuthorizationEReference. - setEType(authorizationEClass); - - userConfigurationEReference. - setEType(configurationEClass); - - configurationAuthorizationEReference. - setEType(authorizationEClass); - - configurationAuthorizationsEReference. - setEType(authorizationEClass); - - userEClass. - getEStructuralFeatures(). - add( userNameEAttribute ); - - userEClass. - getEStructuralFeatures(). - add( userAliasesEAttribute ); - - userEClass. - getEStructuralFeatures(). - add( userPasswordEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userAgeEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userHeightEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userIsMaleEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userIDEAttribute ); - userEClass. - getEStructuralFeatures(). - add( userAuthorizationEReference ); - userEClass. - getEStructuralFeatures(). - add( userConfigurationEReference ); - - userEPackage.getEClassifiers().add(userEClass); - - userDataObject = - (EDataObject) - userEFactory.create(userEClass); - - userDataObject.eSet(userNameEAttribute,"ole"); - userDataObject.eSet(userPasswordEAttribute,"secret"); - userDataObject.eSet(userIDEAttribute, "1"); - userDataObject.eSet(userAgeEAttribute, 33); - userDataObject.eSet(userHeightEAttribute, 6.11); - userDataObject.eSet(userIsMaleEAttribute, true); - - EList userAliases = new BasicEList(); - userAliases.add("neo"); - userAliases.add("trinity"); - userAliases.add("morpheus"); - - userDataObject.eSet( userAliasesEAttribute, userAliases ); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationFileEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationWriteEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationReadEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationExecuteEAttribute); - - authorizationEClass. - getEStructuralFeatures(). - add(authorizationIDEAttribute); - - userEPackage.getEClassifiers(). - add(authorizationEClass); - - authorizationDataObject0 = - (EDataObject) - userEFactory.create(authorizationEClass); - - authorizationDataObject1 = - (EDataObject) - userEFactory.create(authorizationEClass); - - authorizationDataObject0.eSet(authorizationFileEAttribute,"somefile.text"); - authorizationDataObject0.eSet(authorizationWriteEAttribute, true); - authorizationDataObject0.eSet(authorizationReadEAttribute,true); - authorizationDataObject0.eSet(authorizationExecuteEAttribute,true); - authorizationDataObject0.eSet(authorizationIDEAttribute, "2"); - - authorizationDataObject1.eSet(authorizationFileEAttribute,"someOtherfile.text"); - authorizationDataObject1.eSet(authorizationWriteEAttribute,Boolean.TRUE); - authorizationDataObject1.eSet(authorizationReadEAttribute,true); - authorizationDataObject1.eSet(authorizationExecuteEAttribute,true); - authorizationDataObject1.eSet(authorizationIDEAttribute, "3"); - - EList userDataObjectAuthorizationList = - new BasicEList(); - - userDataObjectAuthorizationList.add(authorizationDataObject0); - userDataObjectAuthorizationList.add(authorizationDataObject1); - - userDataObject.eSet( - userAuthorizationEReference, - userDataObjectAuthorizationList); - - configurationEClass. - getEStructuralFeatures(). - add(configurationIDEAttribute); - - configurationEClass. - getEStructuralFeatures(). - add(configurationAuthorizationEReference); - - configurationEClass. - getEStructuralFeatures(). - add(configurationAuthorizationsEReference); - - userEPackage.getEClassifiers(). - add(configurationEClass); - - configurationDataObject = - (EDataObject) - userEFactory.create(configurationEClass); - - userDataObject.eSet( - userConfigurationEReference, - configurationDataObject); - - configurationDataObject.eSet( - configurationIDEAttribute, - "5"); - - configurationDataObject.eSet( - configurationAuthorizationEReference, - authorizationDataObject0); - - configurationDataObject.eSet( - configurationAuthorizationsEReference, - userDataObjectAuthorizationList); - - - eDataGraph = - SDOFactory. - eINSTANCE. - createEDataGraph(); - - eDataGraph.setERootObject(userDataObject); - - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractAttributeTypeCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractAttributeTypeCreator.java deleted file mode 100644 index c021607a2c..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractAttributeTypeCreator.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -/** - * The Class AbstractAttributeTypeCreator. - */ -public abstract class AbstractAttributeTypeCreator -extends AbstractTypeCreator -{ - - public AbstractAttributeTypeCreator() - { - super(); - - objectClassAttribute.add( META_ATTRIBUTE_TYPE ); - basicAttributes.put( M_COLLECTIVE, LDAP_FALSE ); - basicAttributes.put( M_EQUALITY, M_EQUALITY__NAME_OR_NUMERIC_ID_MATCH ); - basicAttributes.put( M_NO_USER_MODIFICATION, LDAP_FALSE); - basicAttributes.put( M_SINGLE_VALUE, LDAP_FALSE ); - basicAttributes.put( M_USAGE, LDAP_USER_APPLICATIONS); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractTypeCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractTypeCreator.java deleted file mode 100644 index 6fbf988646..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/AbstractTypeCreator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; - -public abstract class AbstractTypeCreator -implements -EnumeratedSchemaAttributeTypeValues, -SchemaAttributeTypeConstants, -AttributeTypeConstants, -SchemaObjectClassConstants, -ObjectClassConstants, -DASConstants -{ - protected Attribute objectClassAttribute; - protected Attributes basicAttributes; - - public AbstractTypeCreator() - { - objectClassAttribute = - new BasicAttribute( - OBJECT_CLASS, TOP ); - - objectClassAttribute.add( - META_TOP ); - - basicAttributes = new BasicAttributes(); - basicAttributes.put(objectClassAttribute); - basicAttributes.put( M_OBSOLETE, LDAP_FALSE ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/ComplexTypeRDNCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/ComplexTypeRDNCreator.java deleted file mode 100644 index 47e3e8a716..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/ComplexTypeRDNCreator.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -import org.apache.tuscany.das.ldap.oid.create.ComplexTypeOIDCreator; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; - -/** - * The Class DataTypeRDNCreator. - */ -public class ComplexTypeRDNCreator -implements SchemaAttributeTypeConstants -{ - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param namespaceURI the namespace URI - * @param complexTypeName the complex type name - * - * @return the string that is the rdn - * - * @throws Exception the exception - */ - public static String create( - String oidPrefix, - String namespaceURI, - String complexTypeName - ) - throws Exception - { - String oid = - ComplexTypeOIDCreator.create( - oidPrefix, - namespaceURI, - complexTypeName ); - - String rdn = - M_OID + "=" + oid; - - return rdn; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SimpleTypeRDNCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SimpleTypeRDNCreator.java deleted file mode 100644 index 6e8eaba018..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SimpleTypeRDNCreator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -import org.apache.tuscany.das.ldap.oid.create.SimpleTypeOIDCreator; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; - -/** - * The Class DataTypeRDNCreator. - */ -public class SimpleTypeRDNCreator -implements SchemaAttributeTypeConstants -{ - - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param namespaceURI the namespace URI - * @param complexTypeName the name - * @param simpleTypeName the simple type name - * - * @return the string - * - * @throws Exception the exception - */ - public static String create( - String oidPrefix, - String namespaceURI, - String complexTypeName, - String simpleTypeName) - throws Exception - { - String oid = - SimpleTypeOIDCreator.create( - oidPrefix, - namespaceURI, - complexTypeName, - simpleTypeName); - - String rdn = - M_OID + "=" + oid; - - return rdn; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java deleted file mode 100644 index 6b115fd71f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxCheckerEntryCreator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; - -/** - * The Class SyntaxEntryCreator. - */ -public class SyntaxCheckerEntryCreator -implements -AttributeTypeConstants, -SchemaAttributeTypeConstants, -ObjectClassConstants, -SchemaObjectClassConstants -{ - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param namespaceURI the namespace URI - * @param dataTypeName the name of the DataType - * @param syntaxesContext the directory context - * - * @throws Exception the exception - */ - public static void create( - String rdn, - LdapContext syntaxCheckerContext) - throws Exception - { - - Attributes attributes = - prepareSyntaxCheckerAttributes(); - - syntaxCheckerContext.createSubcontext( - rdn, - attributes); - } - - /** - * TODO - Move to helper - * Prepare SyntaxChecker attributes. - * - * @return the attributes - */ - public static Attributes prepareSyntaxCheckerAttributes() - { - Attribute objectClassAttribute = - new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add( META_TOP ); - objectClassAttribute.add( META_SYNTAX_CHECKER ); - - Attribute fqcnAttribute = - new BasicAttribute( - M_FQCN, - M_FQCN_DEFAULT_VALUE); - - Attributes attributes = new BasicAttributes(); - - attributes.put( objectClassAttribute ); - attributes.put( fqcnAttribute ); - - return attributes; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java deleted file mode 100644 index 024ef1e7b9..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/create/SyntaxEntryCreator.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.create; - -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; -import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier; - -/** - * The Class SyntaxEntryCreator. - */ -public class SyntaxEntryCreator -implements -AttributeTypeConstants, -SchemaAttributeTypeConstants, -ObjectClassConstants, -SchemaObjectClassConstants -{ - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param namespaceURI the namespace URI - * @param dataTypeName the name of the DataType - * @param syntaxesContext the directory context - * - * @throws Exception the exception - */ - public static void create( - String oidPrefix, - String namespaceURI, - String dataTypeName, - LdapContext syntaxesContext, - LdapContext syntaxCheckersContext) - throws Exception - { - String syntaxDescription = - ComplexTypeNamespaceQualifier. - qualify( - namespaceURI, - dataTypeName); - - String rdn = - ComplexTypeRDNCreator. - create( - oidPrefix, - namespaceURI, - dataTypeName); - - Attributes syntaxAttributes = - prepareSyntaxAttributes( - syntaxDescription ); - - Attributes syntaxCheckerAttributes = - prepareSyntaxCheckerAttributes(); - - //TODO Put back in when bug gets resolved. - //TODO Remember to apply the namespace qualifier or we could just leave because it's in the description effectively - //attributes.put(M_NAME, name ); - //attributes.put("x-humandReadible", "false"); - //attributes.put("m-obsolete, "false"); - syntaxesContext.createSubcontext( - rdn, - syntaxAttributes); - - syntaxCheckersContext.createSubcontext( - rdn, - syntaxCheckerAttributes); - } - - /** - * TODO - Move to helper - * TODO - Optimize - we are prepping these each time when they could be cached - * Prepare syntax attributes. - * - * @param syntaxDescription the syntax description - * - * @return the attributes - */ - public static Attributes prepareSyntaxAttributes( - String syntaxDescription) - { - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, TOP); - objectClassAttribute.add( META_TOP ); - objectClassAttribute.add( META_SYNTAX ); - - Attribute descriptionAttribute = new BasicAttribute( - M_DESCRIPTION, - syntaxDescription); - - Attributes attributes = new BasicAttributes(); - - attributes.put( objectClassAttribute ); - attributes.put( descriptionAttribute ); - - return attributes; - } - - /** - * TODO - Move to helper - * TODO - Optimize - we are prepping these each time when they could be cached - * Prepare SyntaxChecker attributes. - * - * @return the attributes - */ - public static Attributes prepareSyntaxCheckerAttributes() - { - Attribute objectClassAttribute = - new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add( META_TOP ); - objectClassAttribute.add( META_SYNTAX_CHECKER ); - - Attribute fqcnAttribute = - new BasicAttribute( - M_FQCN, - M_FQCN_DEFAULT_VALUE); - - Attributes attributes = new BasicAttributes(); - - attributes.put( objectClassAttribute ); - attributes.put( fqcnAttribute ); - - return attributes; - } - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetup.java deleted file mode 100644 index 010baa800b..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetup.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.apacheds.testing.setup.ADSEmbeddedHotPartitionTemplate; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; -import org.apache.tuscany.das.ldap.testing.constants.DASTestingConstants; - -public abstract class AbstractTestSetup -extends ADSEmbeddedHotPartitionTemplate -implements -EnumeratedSchemaAttributeTypeValues, -SchemaAttributeTypeConstants, -AttributeTypeConstants, -SchemaObjectClassConstants, -ObjectClassConstants, -DASConstants, -DASTestingConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - - dasPartitionContext = - connect("das"); - - schemaPartitionContext = - connect("schema"); - } - - protected LdapContext schemaPartitionContext = - null; - - protected LdapContext dasPartitionContext = - null; - - protected static final String SYNTAXES_CONTEXT_RDN = - OU + "=" + SYNTAXES_CONTEXT_NAME; - - protected static final String SYNTAX_CHECKERS_CONTEXT_RDN = - OU + "=" + SYNTAX_CHECKERS_CONTEXT_NAME; - - protected static final String ATTRIBUTE_TYPES_CONTEXT_RDN = - OU + "=" + ATTRIBUTE_TYPES_CONTEXT_NAME; - - protected static final String OBJECT_CLASSES_CONTEXT_RDN = - OU + "=" + OBJECT_CLASSES_CONTEXT_NAME; - - - - protected static final String XSD_CONTEXT_RDN = - CN + "=" + XSD_CONTEXT_NAME; - protected static final String DAS_CONTEXT_RDN = - CN + "=" + DAS_CONTEXT_NAME; - protected static final String ECORE_CONTEXT_RDN = - CN + "=" + ECORE_CONTEXT_NAME; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java deleted file mode 100644 index 6477225e1c..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -public class AbstractTestSetupTest -extends AbstractTestSetup -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - dasPartitionContext = - connect("das"); - schemaPartitionContext = - connect("schema"); - } - - public void testConnect() throws NamingException - { - assertNotNull(dasPartitionContext); - assertNotNull(schemaPartitionContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetup.java deleted file mode 100644 index fafd0144fb..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetup.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.create.MetaContextCreator; -import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer; -import org.apache.tuscany.das.ldap.destroy.MetaContextDestroyer; - -public class DASContextSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - MetaContextDestroyer. - destroy( modelContext ); - - InitialContextDestroyer. - destroy( - modelContext, - dasPartitionContext ); - super.tearDown(); - - dasPartitionContext.close(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - modelContext = - InitialContextCreator. - create( - xsdNamespace, - dasPartitionContext); - - metaContext = - MetaContextCreator. - create( modelContext); - } - - protected LdapContext modelContext = null; - protected LdapContext metaContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetupTest.java deleted file mode 100644 index d6ecc250c6..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetupTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class DASContextSetupTest -extends DASContextSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testModelContext() throws NamingException - { - assertNotNull(modelContext); - assertEquals( - "cn=accounts,cn=users,cn=example,cn=com,ou=das", - modelContext.getNameInNamespace()); - } - - public void testMetaContext() throws NamingException - { - assertNotNull(metaContext); - assertEquals("cn=meta,cn=accounts,cn=users,cn=example,cn=com,ou=das", - metaContext.getNameInNamespace()); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java deleted file mode 100644 index da620aaf34..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; - -public class DASSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - dasSyntaxesContext.close(); - - dasSchemaSubContext.destroySubcontext( - SYNTAXES_CONTEXT_RDN ); - - dasAttributeTypesContext.close(); - - dasSchemaSubContext.destroySubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN ); - - dasSchemaSubContext.destroySubcontext( - OBJECT_CLASSES_CONTEXT_RDN ); - - dasSchemaSubContext.close(); - - schemaPartitionContext.destroySubcontext( - DAS_CONTEXT_RDN ); - - schemaPartitionContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - dasSchemaSubContext = - createDasSchemaSubContext(); - dasSyntaxesContext = - createDasSyntaxesContext(); - dasAttributeTypesContext = - createDasAttributeTypesContext(); - dasObjectClassesContext = - createDasObjectClassesContext(); - - mComplexMayRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - M_COMPLEX_MAY); - - mComplexMustRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - M_COMPLEX_MUST); - - idRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - ID); - - metaTopSDORDN = - ComplexTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS); - } - - private DirContext createDasSchemaSubContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - DAS_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaPartitionContext.createSubcontext( - DAS_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasAttributeTypesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return dasSchemaSubContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return dasSchemaSubContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute attributeTypes = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( attributeTypes ); - contextAttributes.put( objectClassAttribute ); - - return dasSchemaSubContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, - contextAttributes ); - } - - protected DirContext dasSchemaSubContext = null; - protected DirContext dasAttributeTypesContext = null; - protected DirContext dasSyntaxesContext = null; - protected DirContext dasObjectClassesContext = null; - - protected String mComplexMayRDN = null; - protected String mComplexMustRDN = null; - protected String idRDN = null; - protected String metaTopSDORDN = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java deleted file mode 100644 index 9adbe07463..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class DASSchemaContextsSetupTest -extends DASSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testCreateDASSchemaSubContext() - { - assertNotNull(dasSchemaSubContext); - } - - public void testCreateDasAttributeTypesContext() - { - assertNotNull(dasAttributeTypesContext); - } - - public void testCreateDasSyntaxesContext() - { - assertNotNull(dasSyntaxesContext); - } - - public void testCreateDasObjectClassesContext() - { - assertNotNull(dasObjectClassesContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java deleted file mode 100644 index 4fdaaea4b2..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.create.MetaContextCreator; -import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer; -import org.apache.tuscany.das.ldap.destroy.MetaContextDestroyer; - -/* - * TODO Document that the name of a root object cannot be "meta" - * TODO Change "meta" to meta-inf - */ -public class EcoreSchemaAndDASContextsSetup -extends EcoreSchemaContextsSetup -implements DASConstants -{ - public void tearDown() - throws NamingException, Exception - { - MetaContextDestroyer. - destroy( rootContext ); - - InitialContextDestroyer. - destroy( - rootContext, - dasPartitionContext ); - - super.tearDown(); - - dasPartitionContext.close(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - - rootContext = - (LdapContext) - InitialContextCreator. - create( - xsdNamespace, - dasPartitionContext); - - metaContext = - (LdapContext) - MetaContextCreator. - create( rootContext); - } - - protected LdapContext rootContext = null; - protected LdapContext metaContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java deleted file mode 100644 index e272262998..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaAndDASContextsSetupTest -extends EcoreSchemaAndDASContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaPartitionContext); - } - - public void testCreateEcoreSchemaSubContext() - { - assertNotNull(ecoreSchemaSubContext); - } - - public void testCreateEcoreObjectClassesContext() - { - assertNotNull(ecoreObjectClassesContext); - } - - public void testCreateEcoreAttributeTypesContext() - { - assertNotNull(ecoreAttributeTypesContext); - } - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(ecoreSyntaxesContext); - } - - public void testCreateDasModelContext() - { - assertNotNull(rootContext); - } - - public void testCreateDasMetaContext() - { - assertNotNull(metaContext); - } - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java deleted file mode 100644 index 88bd21f318..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() - throws NamingException, Exception - { - ecoreSyntaxesContext. - close(); - - ecoreSchemaSubContext. - destroySubcontext( - SYNTAXES_CONTEXT_RDN ); - - ecoreSyntaxCheckersContext. - close(); - - ecoreSchemaSubContext. - destroySubcontext( - SYNTAX_CHECKERS_CONTEXT_RDN ); - - ecoreAttributeTypesContext. - close(); - ecoreSchemaSubContext. - destroySubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN ); - - ecoreObjectClassesContext. - close(); - - ecoreSchemaSubContext. - destroySubcontext( - OBJECT_CLASSES_CONTEXT_RDN ); - - ecoreSchemaSubContext. - close(); - schemaPartitionContext. - destroySubcontext( - ECORE_CONTEXT_RDN ); - - schemaPartitionContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - ecoreSchemaSubContext = createEcoreSchemaSubContext(); - ecoreSyntaxesContext = createEcoreSyntaxesContext(); - ecoreSyntaxCheckersContext = createEcoreSyntaxCheckersContext(); - ecoreObjectClassesContext = createEcoreObjectClassesContext(); - ecoreAttributeTypesContext = createEcoreAttributeTypesContext(); - } - - private LdapContext createEcoreSchemaSubContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - ECORE_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) - schemaPartitionContext.createSubcontext( - ECORE_CONTEXT_RDN, contextAttributes ); - } - - - private LdapContext createEcoreObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) - ecoreSchemaSubContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, contextAttributes ); - } - - - - private LdapContext createEcoreAttributeTypesContext() - throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) - ecoreSchemaSubContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - private LdapContext createEcoreSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) - ecoreSchemaSubContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - private LdapContext createEcoreSyntaxCheckersContext() - throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAX_CHECKERS_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) - ecoreSchemaSubContext.createSubcontext( - SYNTAX_CHECKERS_CONTEXT_RDN, - contextAttributes); - } - - protected LdapContext ecoreSchemaSubContext = null; - protected LdapContext ecoreObjectClassesContext = null; - protected LdapContext ecoreAttributeTypesContext = null; - protected LdapContext ecoreSyntaxesContext = null; - protected LdapContext ecoreSyntaxCheckersContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java deleted file mode 100644 index f2c746dceb..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaContextsSetupTest -extends EcoreSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testCreateEcoreSchemaSubContext() - { - assertNotNull(ecoreSchemaSubContext); - } - - public void testCreateEcoreObjectClassesContext() - { - assertNotNull(ecoreObjectClassesContext); - } - - public void testCreateEcoreAttributeTypesContext() - { - assertNotNull(ecoreAttributeTypesContext); - } - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(ecoreSyntaxesContext); - } - - public void testCreateEcoreSyntaxCheckersContext() - { - assertNotNull(ecoreSyntaxCheckersContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java deleted file mode 100644 index 619bc7a94f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class XSDSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - xsdSyntaxesContext. - close(); - - xsdContext. - destroySubcontext( - SYNTAXES_CONTEXT_RDN ); - - xsdContext. - close(); - - schemaPartitionContext. - destroySubcontext( - XSD_CONTEXT_RDN ); - - schemaPartitionContext. - close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - xsdContext = - createXsdContext(); - xsdSyntaxesContext = - createXsdSyntaxesContext(); - } - - private LdapContext createXsdContext() throws NamingException - { - Attributes contextAttributes = - new BasicAttributes(); - - Attribute objectClassAttribute = - new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = - new BasicAttribute( - CN, - XSD_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) schemaPartitionContext.createSubcontext( - XSD_CONTEXT_RDN, contextAttributes ); - } - - private LdapContext createXsdSyntaxesContext() throws NamingException - { - Attributes contextAttributes = - new BasicAttributes(); - - Attribute objectClassAttribute = - new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = - new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return (LdapContext) xsdContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - protected LdapContext xsdContext = - null; - protected LdapContext xsdSyntaxCheckersContext = - null; - protected LdapContext xsdSyntaxesContext = - null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java deleted file mode 100644 index 24ce5e6df1..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.embedded.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class XSDSchemaContextsSetupTest -extends XSDSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testCreateXsdContext() - { - assertNotNull(xsdContext); - } - - public void testCreateXsdSyntaxesContext() - { - assertNotNull(xsdSyntaxesContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/DataTypeToADSSyntaxMapProvider.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/DataTypeToADSSyntaxMapProvider.java deleted file mode 100644 index 8bd50fb4cc..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/DataTypeToADSSyntaxMapProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.das.ldap.constants.SyntaxOIDValues; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EcorePackage; - -public class DataTypeToADSSyntaxMapProvider -implements SyntaxOIDValues { - - EcorePackage ecorePackage = - EcorePackage.eINSTANCE; - - private static Map dataTypeToADSSyntaxOIDMap = null; - - //TODO Make this a singleton - public DataTypeToADSSyntaxMapProvider() - { - dataTypeToADSSyntaxOIDMap = new HashMap(); - create(); - } - - public Map getDataTypeToADSSyntaxMap() - { - return dataTypeToADSSyntaxOIDMap; - } - - private Map create() - { - dataTypeToADSSyntaxOIDMap.put( - ecorePackage.getEString(), - SYNTAX_STRING_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - ecorePackage.getEInt(), - SYNTAX_INTEGER_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - ecorePackage.getEIntegerObject(), - SYNTAX_INTEGER_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - ecorePackage.getEBoolean(), - SYNTAX_BOOLEAN_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - ecorePackage.getEBooleanObject(), - SYNTAX_BOOLEAN_OID_VALUE); - - return dataTypeToADSSyntaxOIDMap; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java deleted file mode 100644 index 5b8e65c221..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EAttributeTypeCreator.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator; -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.provide.SyntaxOIDProvider; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; - -public class EAttributeTypeCreator -extends AbstractAttributeTypeCreator -{ - public EAttributeTypeCreator() - { - super(); - } - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param eAttribute the e attribute - * @param attributeTypesContext the attribute types context - * - * @throws Exception the exception - * @throws NamingException the naming exception - */ - public void create( - DirContext attributeTypesContext, - EAttribute eAttribute, - String oidPrefix) - throws NamingException, Exception - { - String eAttributeName = - eAttribute.getName(); - - EClass eContainingClass = - eAttribute.getEContainingClass(); - - String eContainingClassName = - eContainingClass.getName(); - - String namespaceURI = - eContainingClass. - getEPackage().getNsURI(); - - String qualifiedEAttributeNameURI = - SimpleTypeNamespaceQualifier.qualify( - namespaceURI, - eContainingClassName, - eAttributeName); - - String normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeNameURI); - - EClassifier eDataType = - eAttribute.getEType(); - - SyntaxOIDProvider dataTypeToADSSyntaxMapProvider = - new SyntaxOIDProvider(); - - String syntaxOID = - dataTypeToADSSyntaxMapProvider. - getSyntaxOID(eDataType); - - basicAttributes.put( - M_DESCRIPTION, - eAttributeName); - - basicAttributes.put( - M_SYNTAX, - syntaxOID); - - basicAttributes.put( - M_NAME, - normalizedEAttributeName ); - - String rdn = - SimpleTypeRDNCreator.create( - oidPrefix, - namespaceURI, - eContainingClassName, - eAttributeName); - - attributeTypesContext.createSubcontext( - rdn, - basicAttributes); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java deleted file mode 100644 index 684509e0d9..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreator.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import java.util.List; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.AbstractTypeCreator; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.eclipse.emf.ecore.EClass; - -public class EObjectClassCreator -extends AbstractTypeCreator -{ - public EObjectClassCreator() - { - super(); - } - /** - * Create. - * - * @param oidPrefix the oid prefix - * @param eAttribute the e attribute - * @param attributeTypesContext the attribute types context - * - * @throws Exception the exception - * @throws NamingException the naming exception - * - * Note that null can passed for the processedEClassifiers list - * only when the EClass has not parents. - */ - public void create( - DirContext metaContext, - DirContext attributeTypesContext, - DirContext objectClassesContext, - EClass eClass, - List processedEClassifiers, - String oidPrefix) - throws NamingException, Exception - { - if ( processedEClassifiers != null ) - { - EClass eClassParent = - EcoreTypeSystemHelper. - getEClassParent( eClass ); - - if (eClassParent != null) - { - boolean isEClassProcessed = - EObjectClassCreatorHelper. - isEClassProcessed( - eClassParent, - processedEClassifiers); - - if (!isEClassProcessed) - { - this.create( - metaContext, - attributeTypesContext, - objectClassesContext, - eClassParent, - processedEClassifiers, - oidPrefix); - } - } - } - - objectClassAttribute.add( META_OBJECT_CLASS ); - - EcoreTypeSystemHelper. - createAttributeTypes( - attributeTypesContext, - eClass, - oidPrefix ); - - String namespaceURI = - eClass.getEPackage(). - getNsURI(); - - String qualifiedEClassNameURI = - ComplexTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName()); - - String normalizedEObjectName = - QualifiedNameNormalizer. - normalize(qualifiedEClassNameURI); - - - basicAttributes.put( - M_NAME, - normalizedEObjectName ); - - basicAttributes.put( - M_DESCRIPTION, - eClass.getName() ); - - basicAttributes.put( - M_OBSOLETE, - LDAP_FALSE ); - - //TODO Remember to test with parent combination. - EObjectClassCreatorHelper. - addParentAttribute( - basicAttributes, - namespaceURI, - eClass ); - - if (!eClass.isAbstract()) - { - basicAttributes.put( - M_TYPE_OBJECT_CLASS, - STRUCTURAL ); - } - else - { - basicAttributes.put( - M_TYPE_OBJECT_CLASS, - ABSTRACT ); - } - - - /* - EObjectClassCreatorHelper. - addEAttributes( - basicAttributes, - namespaceURI, - eClass ); - - EObjectClassCreatorHelper. - addEReferences( - basicAttributes, - namespaceURI, - eClass ); - */ - - - EObjectClassCreatorHelper. - addEStructuralFeatures( - basicAttributes, - namespaceURI, - eClass ); - - String rdn = - ComplexTypeRDNCreator. - create( - oidPrefix, - namespaceURI, - eClass.getName()); - - EObjectClassCreatorHelper. - createInheritanceMetaData( - metaContext, - eClass ); - - /* TODO - Remove once everything is simmered down - NamingEnumeration namingEnumeration = - basicAttributes.getAll(); - - while (namingEnumeration.hasMore()) - { - Attribute attribute = (Attribute) namingEnumeration.next(); - System.out.println(attribute); - } - */ - - - objectClassesContext. - createSubcontext( - rdn, - basicAttributes ); - - - if ( processedEClassifiers != null ) - { - processedEClassifiers.add(eClass); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java deleted file mode 100644 index 2a99ef8fb8..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EObjectClassCreatorHelper.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import java.util.Iterator; -import java.util.List; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; -import org.apache.tuscany.das.ldap.util.ComplexTypeNamespaceQualifier; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * The Class EObjectClassCreatorHelper. - */ -public class EObjectClassCreatorHelper -implements -EnumeratedSchemaAttributeTypeValues, -SchemaAttributeTypeConstants, -AttributeTypeConstants, -SchemaObjectClassConstants, -ObjectClassConstants, -DASConstants -{ - /** - * Adds the parent attribute. - * - * @param namespaceURI the namespace URI - * @param objectClassAttributes the object class attributes - * @param eClass the e class - */ - public static void addParentAttribute( - Attributes objectClassAttributes, - String namespaceURI, - EClass eClass) - { - EClass eClassParent = - EcoreTypeSystemHelper.getEClassParent( eClass ); - - if(eClassParent !=null) - { - String qualifiedEClassParentNameURI = - ComplexTypeNamespaceQualifier. - qualify( - namespaceURI, - eClassParent. - getName()); - - String normalizedEObjectName = - QualifiedNameNormalizer. - normalize(qualifiedEClassParentNameURI); - - objectClassAttributes.put( - M_SUP_OBJECT_CLASS, - normalizedEObjectName); - } - else - { - objectClassAttributes.put( - M_SUP_OBJECT_CLASS, - META_OBJECT_CLASS ); - } - } - - /** - * Adds the E attributes. - * - * @param namespaceURI the namespace URI - * @param objectClassAttributes the object class attributes - * @param eClass the e class - */ - public static void addEAttributes( - Attributes objectClassAttributes, - String namespaceURI, - EClass eClass) - { - List eAttributes = - eClass.getEAttributes(); - - Iterator eAttributeIterator = - eAttributes.iterator(); - - EAttribute eAttribute = - null; - - String qualifiedEAttributeName = - null; - - Attribute mMayAttribute = - null; - - Attribute mMustAttribute = - null; - - while( eAttributeIterator.hasNext()) - { - eAttribute = eAttributeIterator.next(); - - qualifiedEAttributeName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eAttribute.getName()); - - String normalizedEAttributeName = - QualifiedNameNormalizer. - normalize(qualifiedEAttributeName); - - if (!eAttribute.isRequired()) - { - if (mMayAttribute == null) - { - mMayAttribute = new BasicAttribute(M_MAY); - } - mMayAttribute.add(normalizedEAttributeName); - } - else - { - if (mMustAttribute == null) - { - mMustAttribute = new BasicAttribute(M_MUST); - } - mMustAttribute.add(normalizedEAttributeName); - } - } - - if (mMayAttribute != null) - { - objectClassAttributes.put( mMayAttribute ); - } - if (mMustAttribute != null) - { - objectClassAttributes.put( mMustAttribute ); - } - } - - /** - * Adds the E references. - * - * @param namespaceURI the namespace URI - * @param objectClassAttributes the object class attributes - * @param eClass the e class - */ - public static void addEReferences( - Attributes objectClassAttributes, - String namespaceURI, - EClass eClass) - { - List eReferences = - eClass.getEReferences(); - - Iterator eReferenceIterator = - eReferences.iterator(); - - EReference eReference = - null; - - String qualifiedEReferenceName = - null; - - Attribute mMayAttribute = - null; - - Attribute mMustAttribute = - null; - - while ( eReferenceIterator.hasNext()) - { - eReference = eReferenceIterator.next(); - - qualifiedEReferenceName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eReference.getName()); - - String normalizedEReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceName); - - if (!eReference.isRequired()) - { - if (mMayAttribute == null) - { - mMayAttribute = new BasicAttribute(M_MAY); - } - mMayAttribute.add( normalizedEReferenceName ); - } - else - { - if (mMustAttribute == null) - { - mMustAttribute = new BasicAttribute(M_MUST); - } - mMustAttribute.add( normalizedEReferenceName ); - } - } - if (mMayAttribute != null) - { - objectClassAttributes.put( mMayAttribute ); - } - if (mMustAttribute != null) - { - objectClassAttributes.put( mMustAttribute ); - } - } - - /** - * Adds the E references. - * - * @param namespaceURI the namespace URI - * @param objectClassAttributes the object class attributes - * @param eClass the e class - */ - public static void addEStructuralFeatures( - Attributes objectClassAttributes, - String namespaceURI, - EClass eClass) - { - List eStructuralFeatures = - eClass.getEStructuralFeatures(); - - Iterator eStructuralFeatureIterator = - eStructuralFeatures.iterator(); - - EStructuralFeature eStructuralFeature = - null; - - String qualifiedEStructuralFeatureName = - null; - - Attribute mMayAttribute = - null; - - Attribute mMustAttribute = - null; - - while ( eStructuralFeatureIterator.hasNext()) - { - eStructuralFeature = - eStructuralFeatureIterator.next(); - - qualifiedEStructuralFeatureName = - SimpleTypeNamespaceQualifier. - qualify( - namespaceURI, - eClass.getName(), - eStructuralFeature.getName()); - - String normalizedEStructuralFeatureName = - QualifiedNameNormalizer. - normalize(qualifiedEStructuralFeatureName); - - - if (!eStructuralFeature.isRequired()) - { - if (mMayAttribute == null) - { - mMayAttribute = new BasicAttribute(M_MAY); - } - mMayAttribute.add( normalizedEStructuralFeatureName ); - } - else - { - if (mMustAttribute == null) - { - mMustAttribute = new BasicAttribute(M_MUST); - } - mMustAttribute.add( normalizedEStructuralFeatureName ); - } - } - if (mMayAttribute != null) - { - objectClassAttributes.put( mMayAttribute ); - } - if (mMustAttribute != null) - { - objectClassAttributes.put( mMustAttribute ); - } - - } - - - /** - * Checks if is E class processed. - * - * @param processedEClassifiers the processed E classifiers - * @param eClass the e class - * - * @return true, if is E class processed - */ - public static boolean isEClassProcessed( - EClass eClass, - List processedEClassifiers) - { - return processedEClassifiers.contains( eClass ); - } - - /** - * Creates the inheritance meta data. - * - * @param metaContext the das model meta context - * @param eClass the e class - * - * @throws NamingException the naming exception - */ - public static void createInheritanceMetaData( - DirContext metaContext, - EClass eClass) - throws NamingException - { - EClass eClassParent = - EcoreTypeSystemHelper.getEClassParent( eClass ); - - String rdn = null; - - if (eClassParent != null) - { - DirContext eClassParentMetaContext = - null; - try - { - eClassParentMetaContext = - ( DirContext ) - metaContext. - lookup(eClassParent.getName()); - } - catch ( NamingException e ) - { - rdn = - CN + "=" + eClassParent.getName(); - - eClassParentMetaContext = - ( DirContext ) - metaContext. - createSubcontext( rdn ); - } - - rdn = CN + "=" + eClass.getName(); - - eClassParentMetaContext. - createSubcontext( rdn ); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java deleted file mode 100644 index 74c7faff71..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EReferenceTypeCreator.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.constants.SyntaxOIDValues; -import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator; -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; -import org.apache.tuscany.das.ldap.util.SimpleTypeNamespaceQualifier; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EReference; - -public class EReferenceTypeCreator -extends AbstractAttributeTypeCreator -implements SyntaxOIDValues -{ - public EReferenceTypeCreator() - { - super(); - } - - public void create( - DirContext attributeTypesContext, - EReference eReference, - String oidPrefix) - throws NamingException, Exception - { - String eReferenceName = - eReference.getName(); - - EClass eContainingClass = - eReference.getEContainingClass(); - - String eContainingClassName = - eContainingClass.getName(); - - String namespaceURI = - eContainingClass. - getEPackage(). - getNsURI(); - - String qualifiedEReferenceNameURI = - SimpleTypeNamespaceQualifier.qualify( - namespaceURI, - eContainingClassName, - eReferenceName); - - - String normalizedEReferenceName = - QualifiedNameNormalizer. - normalize(qualifiedEReferenceNameURI); - - basicAttributes.put( - M_DESCRIPTION, - eReferenceName); - - basicAttributes.put( - M_SYNTAX, - SYNTAX_STRING_OID_VALUE); - - basicAttributes.put( - M_NAME, - normalizedEReferenceName ); - - String rdn = - SimpleTypeRDNCreator.create( - oidPrefix, - namespaceURI, - eContainingClassName, - eReferenceName); - - attributeTypesContext.createSubcontext( - rdn, - basicAttributes); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java deleted file mode 100644 index b9e8fac0fa..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/EcoreTypeSystemHelper.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Stack; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.create.SyntaxEntryCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * The Class EcoreTypeSystemCreatorHelper. - */ -public class EcoreTypeSystemHelper -{ - - /** - * Creates the E data types list. - * - * @param ePackage the e package - * - * @return the list< E data type> - */ - public static List createEDataTypesList( - EPackage ePackage) - { - List list = ePackage.eContents(); - List eDataTypes = new ArrayList(); - Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - Object object = iterator.next(); - if (object instanceof EDataType ) - { - eDataTypes.add( ( EDataType ) object ); - } - } - return eDataTypes; - } - - public static void createSyntaxCheckerEntries( - String oidPrefix, - LdapContext syntaxCheckersContext) throws Exception - - { - - } - - /** - * Creates the syntax entries. - * - * @param oidPrefix the oid prefix - * @param eDataTypes the e data types - * @param syntaxesContext the syntaxes context - * - * @throws Exception the exception - */ - public static void createSyntaxEntries( - List eDataTypes, - String oidPrefix, - LdapContext syntaxesContext, - LdapContext syntaxCheckersContext) throws Exception - { - Iterator eDataTypeIterator = - eDataTypes.iterator(); - - String eDataTypeName = - null; - String eDataTypeNamespaceURI = - null; - - while (eDataTypeIterator.hasNext()) - { - EDataType eDataType = - eDataTypeIterator.next(); - eDataTypeName = - eDataType.getName(); - eDataTypeNamespaceURI = - eDataType.getEPackage().getNsURI(); - - SyntaxEntryCreator.create( - oidPrefix, - eDataTypeNamespaceURI, - eDataTypeName, - syntaxesContext, - syntaxCheckersContext); - } - } - - /** - * Creates the E classifiers list. - * - * @param ePackage the e package - * - * @return the list< E class> - */ - public static List createEClassifiersList( - EPackage ePackage) - { - List list = ePackage.eContents(); - List eClassifiers = new ArrayList(); - Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - Object object = iterator.next(); - if (object instanceof EClassifier ) - { - eClassifiers.add( ( EClass ) object ); - } - } - return eClassifiers; - } - - /** - * Creates the E classifier entries. - * - * @param eClassifiers the e classifiers - */ - public static void createEClassifierEntries( - List eClassifiers) - { - - } - - /** - * Load parent E classifier stack. - * - * @param parentEClassifierStack the parent E classifier stack - * @param eClass the e class - * - * @return the stack< E class> - * - * Note that clients should pass null for the - * parentEClassifierStack argument. The method - * creates the stack when needed, and uses - * it during recursion. - */ - public static Stack loadParentEClassifierStack( - EClass eClass, - Stack parentEClassifierStack) - { - List eClassParents = - eClass.getESuperTypes(); - - if (eClassParents.size() > 0) - { - Iterator eClassParentIterator = - eClassParents.iterator(); - - while(eClassParentIterator.hasNext()) - { - EClass parentEClass = - eClassParentIterator.next(); - - if (!parentEClass.isInterface()) - { - if (parentEClassifierStack == null) - { - parentEClassifierStack = new Stack(); - } - - parentEClassifierStack.push( parentEClass ); - - eClassParents = parentEClass.getESuperTypes(); - - if (eClassParents.size() == 0) - { - return parentEClassifierStack; - } - else - { - loadParentEClassifierStack( - parentEClass, - parentEClassifierStack ); - } - } - } - } - return parentEClassifierStack; - } - - /** - * Creates the E object class parents. - * - * @param oidPrefix the oid prefix - * @param objectClassesContext the object classes context - * @param eClass the e class - * - * @throws Exception the exception - * @throws NamingException the naming exception - */ - public static void createEObjectClassParents( - DirContext dasModelMetaContext, - DirContext attributeTypesContext, - DirContext objectClassesContext, - EClass eClass, - String oidPrefix) - throws NamingException, Exception - { - Stack parentEClassifierStack = - EcoreTypeSystemHelper. - loadParentEClassifierStack( - eClass, - null); - - EClass parentEClass = null; - - for (int i=0; i eAttributes = - eClass.getEAttributes(); - - Iterator eAttributeIterator = - eAttributes.iterator(); - - while (eAttributeIterator.hasNext()) - { - EAttribute eAttribute = eAttributeIterator.next(); - - EAttributeTypeCreator - eAttributeTypeCreator = - new EAttributeTypeCreator(); - - eAttributeTypeCreator.create( - attributeTypesContext, - eAttribute, - oidPrefix ); - } - - List eReferences = - eClass.getEReferences(); - - Iterator eReferenceIterator = - eReferences.iterator(); - - while(eReferenceIterator.hasNext()) - { - EReference eReference = - eReferenceIterator. - next(); - - EReferenceTypeCreator - eReferenceTypeCreator = - new EReferenceTypeCreator(); - - eReferenceTypeCreator.create( - attributeTypesContext, - eReference, - oidPrefix); - } - } - - /** - * Destroy attribute types. - * - * @param oidPrefix the oid prefix - * @param eClass the e class - * @param attributeTypesContext the attribute types context - * - * @throws Exception the exception - * @throws NamingException the naming exception - */ - public static void destroyAttributeTypes( - DirContext attributeTypesContext, - EClass eClass, - String oidPrefix) - throws NamingException, Exception - { - List - eStructuralFeatures = - eClass. - getEStructuralFeatures(); - - Iterator - eStructuralFeatureIterator = - eStructuralFeatures.iterator(); - - while (eStructuralFeatureIterator.hasNext()) - { - EStructuralFeature - eStructuralFeature = - eStructuralFeatureIterator.next(); - - EStructuralFeatureTypeDestroyer.destroy( - attributeTypesContext, - eStructuralFeature, - oidPrefix ); - } - } - - /** - * Gets the E class parent. - * - * @param eClass the e class - * - * @return the e class parent - */ - public static EClass getEClassParent(EClass eClass) - { - List eClassParents = - eClass.getESuperTypes(); - - if (eClassParents.size() > 0) - { - Iterator eClassParentIterator = - eClassParents.iterator(); - - while(eClassParentIterator.hasNext()) - { - EClass parentEClass = - eClassParentIterator.next(); - - if (!parentEClass.isInterface()) - { - return parentEClass; - } - else - { - return null; - } - } - } - return null; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java deleted file mode 100644 index 3a92143dc5..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/create/ModelTypeSystemCreator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create; - -import java.util.ArrayList; -import java.util.List; - -import javax.naming.ldap.LdapContext; - -import org.eclipse.emf.ecore.EClass; - -public class ModelTypeSystemCreator -{ - private static List processedEClassifiers = - new ArrayList(); - - public static void create( - LdapContext dasModelMetaContext, - LdapContext attributeTypesContext, - LdapContext objectClassesContext, - List eClassifiers, - String oidPrefix) - throws Exception - { - EObjectClassCreator eObjectClassCreator = - new EObjectClassCreator(); - - for (EClass eClass : eClassifiers) - { - eObjectClassCreator.create( - dasModelMetaContext, - attributeTypesContext, - objectClassesContext, - eClass, - processedEClassifiers, - oidPrefix ); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java deleted file mode 100644 index 1ad3a1eb21..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/ECascadingObjectClassDestroyer.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.destroy; - -import java.util.Map; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import javax.naming.directory.SearchResult; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.eclipse.emf.ecore.EClass; - -/** - * The Class ECascadingObjectClassDestroyer. - * - * The purose of this class is to destroy a ObjectClass - * that is the parent of other ObjectClass entries. - * - * It first checks to see whether the EClass instance - * is a parent of other EClassifiers by examining - * whether the metaContext contains the EClass - * instance's name. - * - * If the EClass instance has an an metaContext child entry, - * then this instance is a parent of other EClassifiers. - * Therefore we check to see whether there are EClass - * instances left to delete that inherit from this EClass. - * - * If none are left we delete the parentMetaContext entry. - * If there are more children left, we leave the parentMetaContext - * entry in place and delete the children. - * - * If there is no parentMetaEntryContext, it means that this - * EClass instance does not have any children. Therefore it's - * safe to delete the corresponding ObjectClass. - */ -public class ECascadingObjectClassDestroyer -implements AttributeTypeConstants -{ - - - public static void destroy( - Map eClassNameToEClassMap, - DirContext metaContext, - DirContext attributeTypesContext, - DirContext objectClassesContext, - EClass eClass, - String oidPrefix) - throws NamingException, Exception - { - String rdn = - null; - DirContext eClassParentMetaContext = - null; - try - { - eClassParentMetaContext = - ( DirContext ) - metaContext. - lookup( CN + "=" + eClass.getName() ); - } - catch (Exception e) - { - //This eClass can be deleted, because it is not used a super class. - } - - if (eClassParentMetaContext == null) - { - EObjectClassDestroyer.destroy( - metaContext, - attributeTypesContext, - objectClassesContext, - eClass, - oidPrefix ); - } - else - { - Attributes searchAttributes = - new BasicAttributes(true); - - searchAttributes.put(new BasicAttribute(CN)); - - NamingEnumeration childEntries = - eClassParentMetaContext.search("", searchAttributes); - - if (childEntries.hasMore()) - { - while (childEntries.hasMore()) - { - SearchResult childEntry = - childEntries.next(); - - Attributes childEntryAttributes = - childEntry.getAttributes(); - - String eClassName = - ( String ) - childEntryAttributes.get( CN ).get(); - - EClass childEClass = - eClassNameToEClassMap.get( eClassName ); - - destroy( - eClassNameToEClassMap, - metaContext, - attributeTypesContext, - objectClassesContext, - childEClass, - oidPrefix ); - - EObjectClassDestroyer.destroy( - metaContext, - attributeTypesContext, - objectClassesContext, - eClass, - oidPrefix ); - - rdn = CN + "=" + eClass.getName(); - metaContext.destroySubcontext( rdn ); - } - } - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java deleted file mode 100644 index 16c7f893d6..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EObjectClassDestroyer.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.destroy; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper; -import org.eclipse.emf.ecore.EClass; - -/** - * The Class EObjectClassDestroyer. - */ -public class EObjectClassDestroyer -implements AttributeTypeConstants -{ - public static void destroy( - DirContext metaContext, - DirContext attributeTypesContext, - DirContext objectClassesContext, - EClass eClass, - String oidPrefix) - throws NamingException, Exception - { - String namespaceURI = - eClass.getEPackage(). - getNsURI(); - - String rdn = - ComplexTypeRDNCreator. - create( - oidPrefix, - namespaceURI, - eClass.getName()); - - objectClassesContext. - destroySubcontext( - rdn); - - EcoreTypeSystemHelper. - destroyAttributeTypes( - attributeTypesContext, - eClass, - oidPrefix ); - - LdapContext parentMetaContext = - null; - - EClass eClassParent = - EcoreTypeSystemHelper. - getEClassParent( eClass ); - - /* - * After destroying the ObjecClass and its attributes - * we must also clean up the meta context. - */ - - if (eClassParent != null) - { - rdn = CN + "=" + eClassParent.getName(); - - parentMetaContext = - ( LdapContext ) - metaContext.lookup( rdn ); - - rdn = CN + "=" + eClass.getName(); - - parentMetaContext.destroySubcontext( rdn ); - } - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java deleted file mode 100644 index 2d88bc8803..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/destroy/EStructuralFeatureTypeDestroyer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.destroy; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.AbstractAttributeTypeCreator; -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; - -public class EStructuralFeatureTypeDestroyer -extends AbstractAttributeTypeCreator -{ - public static void destroy( - DirContext attributeTypesContext, - EStructuralFeature eStructuralFeature, - String oidPrefix) - throws NamingException, Exception - { - EClass eContainingClass = - eStructuralFeature. - getEContainingClass(); - - String eContainingClassName = - eContainingClass. - getName(); - - String namespaceURI = - eContainingClass. - getEPackage(). - getNsURI(); - - String rdn = - SimpleTypeRDNCreator.create( - oidPrefix, - namespaceURI, - eContainingClassName, - eStructuralFeature.getName()); - - attributeTypesContext.destroySubcontext( - rdn); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/provide/SyntaxOIDProvider.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/provide/SyntaxOIDProvider.java deleted file mode 100644 index be0da66292..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/emf/provide/SyntaxOIDProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.emf.provide; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.das.ldap.constants.SyntaxOIDValues; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EcorePackage; - -public class SyntaxOIDProvider -implements SyntaxOIDValues { - - private static Map dataTypeToADSSyntaxOIDMap = null; - - private EcorePackage ecorePackage = EcorePackage.eINSTANCE; - - //TODO Make this a singleton - public SyntaxOIDProvider() - { - dataTypeToADSSyntaxOIDMap = - new HashMap(); - - this.create(); - ecorePackage = - EcorePackage.eINSTANCE; - } - - public String getSyntaxOID(EClassifier eClassifier) - { - String syntaxOID = dataTypeToADSSyntaxOIDMap.get(eClassifier); - if (syntaxOID == null) - { - return SYNTAX_STRING_OID_VALUE; - } - return syntaxOID; - } - - private Map create() - { - dataTypeToADSSyntaxOIDMap.put( - EcorePackage.eINSTANCE.getEString(), - SYNTAX_STRING_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - EcorePackage.eINSTANCE.getEInt(), - SYNTAX_INTEGER_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - EcorePackage.eINSTANCE.getEIntegerObject(), - SYNTAX_INTEGER_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - EcorePackage.eINSTANCE.getEBoolean(), - SYNTAX_BOOLEAN_OID_VALUE); - - dataTypeToADSSyntaxOIDMap.put( - EcorePackage.eINSTANCE.getEBooleanObject(), - SYNTAX_BOOLEAN_OID_VALUE); - - return dataTypeToADSSyntaxOIDMap; - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java deleted file mode 100644 index 95bbd23f8b..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java +++ /dev/null @@ -1,50 +0,0 @@ - -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.apacheds.testing.setup.JNDIConnectionTemplate; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues; -import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants; -import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants; - -public abstract class AbstractTestSetup -extends JNDIConnectionTemplate -implements -EnumeratedSchemaAttributeTypeValues, -SchemaAttributeTypeConstants, -AttributeTypeConstants, -SchemaObjectClassConstants, -ObjectClassConstants, -DASConstants -{ - protected LdapContext schemaContext = - null; - - protected static String PROVIDER_URL_VALUE = - "ldap://localhost:10389/ou=schema"; - - protected static final String SYNTAXES_CONTEXT_RDN = - OU + "=" + SYNTAXES_CONTEXT_NAME; - - protected static final String ATTRIBUTE_TYPES_CONTEXT_RDN = - OU + "=" + ATTRIBUTE_TYPES_CONTEXT_NAME; - - protected static final String OBJECT_CLASSES_CONTEXT_RDN = - OU + "=" + OBJECT_CLASSES_CONTEXT_NAME; - - protected static final String XSD_CONTEXT_RDN = - CN + "=" + XSD_CONTEXT_NAME; - protected static final String DAS_CONTEXT_RDN = - CN + "=" + DAS_CONTEXT_NAME; - protected static final String ECORE_CONTEXT_RDN = - CN + "=" + ECORE_CONTEXT_NAME; - - protected String xsdNamespace = - "http://example.com/users/accounts"; - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java deleted file mode 100644 index 7eef04e56d..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.directory.apacheds.testing.setup.JNDIHotPartitionConnectionTemplate; -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.create.MetaContextCreator; -import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer; -import org.apache.tuscany.das.ldap.destroy.MetaContextDestroyer; - -public class DASContextSetup -extends JNDIHotPartitionConnectionTemplate -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - MetaContextDestroyer. - destroy( modelContext ); - - InitialContextDestroyer. - destroy( - modelContext, - dasPartitionContext ); - super.tearDown(); - - dasPartitionContext.close(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - dasPartitionContext = - connect("das"); - - modelContext = - (LdapContext) - InitialContextCreator. - create( - xsdNamespace, - dasPartitionContext); - - //Meta Context - //---------------------------------------------- - metaContext = - (LdapContext) MetaContextCreator. - create( - modelContext); - } - protected LdapContext dasPartitionContext = null; - protected LdapContext modelContext = null; - protected LdapContext metaContext = null; - protected LdapContext schemaContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java deleted file mode 100644 index 8e0d4674dc..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class DASContextSetupTest -extends DASContextSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testCreateDASPartitionContext() - { - assertNotNull(dasPartitionContext); - } - - public void testModelContext() - { - assertNotNull(modelContext); - } - public void testMetaContext() - { - assertNotNull(metaContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java deleted file mode 100644 index 9f4d2bb330..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; - -public class DASSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - dasSyntaxesContext.close(); - - dasContext.destroySubcontext( - SYNTAXES_CONTEXT_RDN ); - - dasAttributeTypesContext.close(); - - dasContext.destroySubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN ); - - dasContext.destroySubcontext( - OBJECT_CLASSES_CONTEXT_RDN ); - - dasContext.close(); - - schemaContext.destroySubcontext( - DAS_CONTEXT_RDN ); - - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect(); - dasContext = (LdapContext) createDasContext(); - dasSyntaxesContext = (LdapContext) createDasSyntaxesContext(); - dasAttributeTypesContext = (LdapContext) createDasAttributeTypesContext(); - dasObjectClassesContext = (LdapContext) createDasObjectClassesContext(); - - mComplexMayRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - M_COMPLEX_MAY); - - mComplexMustRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - M_COMPLEX_MUST); - - idRDN = - SimpleTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS, - ID); - - - metaTopSDORDN = - ComplexTypeRDNCreator.create( - TUSCANY_OID_PREFIX_VALUE, - DAS_XSD_NAMESPACE, - M_META_TOP_SDO_OBJECT_CLASS); - } - - private DirContext createDasContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - DAS_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - DAS_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasAttributeTypesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return dasContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return dasContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createDasObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute attributeTypes = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( attributeTypes ); - contextAttributes.put( objectClassAttribute ); - - return dasContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, - contextAttributes ); - } - - protected LdapContext dasContext = null; - protected LdapContext dasAttributeTypesContext = null; - protected LdapContext dasSyntaxesContext = null; - protected LdapContext dasObjectClassesContext = null; - - protected String mComplexMayRDN = null; - protected String mComplexMustRDN = null; - protected String idRDN = null; - protected String metaTopSDORDN = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java deleted file mode 100644 index 35c1f79524..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class DASSchemaContextsSetupTest -extends DASSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - - public void testConnect() - { - assertNotNull(schemaContext); - } - - public void testCreateEcoreContext() - { - assertNotNull(dasContext); - } - - - public void testCreateDasAttributeTypesContext() - { - assertNotNull(dasAttributeTypesContext); - } - - public void testCreateDasSyntaxesContext() - { - assertNotNull(dasSyntaxesContext); - } - - public void testCreateDasObjectClassesContext() - { - assertNotNull(dasObjectClassesContext); - } - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java deleted file mode 100644 index 6d9164c755..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaAndDASContextsSetup -extends DASContextSetup -implements DASConstants -{ - public void tearDown() - throws NamingException, Exception - { - ecoreSyntaxesContext.close(); - ecoreContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - - ecoreAttributeTypesContext.close(); - ecoreContext.destroySubcontext( ATTRIBUTE_TYPES_CONTEXT_RDN ); - - ecoreObjectClassesContext.close(); - ecoreContext.destroySubcontext( OBJECT_CLASSES_CONTEXT_RDN ); - - ecoreContext.close(); - schemaContext.destroySubcontext( ECORE_CONTEXT_RDN ); - - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect("schema"); - ecoreContext = createEcoreContext(); - ecoreSyntaxesContext = createEcoreSyntaxesContext(); - ecoreObjectClassesContext = createEcoreObjectClassesContext(); - ecoreAttributeTypesContext = createEcoreAttributeTypesContext(); - } - - private DirContext createEcoreContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - ECORE_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - ECORE_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createEcoreObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, contextAttributes ); - } - - - - private DirContext createEcoreAttributeTypesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createEcoreSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - protected DirContext ecoreContext = null; - protected DirContext ecoreObjectClassesContext = null; - protected DirContext ecoreAttributeTypesContext = null; - protected DirContext ecoreSyntaxesContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java deleted file mode 100644 index b7a7a7834b..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaAndDASContextsSetupTest -extends EcoreSchemaAndDASContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaContext); - } - - public void testCreateEcoreContext() - { - assertNotNull(ecoreContext); - } - - public void testCreateEcoreObjectClassesContext() - { - assertNotNull(ecoreObjectClassesContext); - } - - public void testCreateEcoreAttributeTypesContext() - { - assertNotNull(ecoreAttributeTypesContext); - } - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(ecoreSyntaxesContext); - } - - public void testCreateDasModelContext() - { - assertNotNull(modelContext); - } - - public void testCreateDasMetaContext() - { - assertNotNull(metaContext); - } - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java deleted file mode 100644 index fb8ca08b5f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() - throws NamingException, Exception - { - ecoreSyntaxesContext.close(); - ecoreContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - - ecoreAttributeTypesContext.close(); - ecoreContext.destroySubcontext( ATTRIBUTE_TYPES_CONTEXT_RDN ); - - ecoreObjectClassesContext.close(); - ecoreContext.destroySubcontext( OBJECT_CLASSES_CONTEXT_RDN ); - - ecoreContext.close(); - schemaContext.destroySubcontext( ECORE_CONTEXT_RDN ); - - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect(); - ecoreContext = createEcoreContext(); - ecoreSyntaxesContext = createEcoreSyntaxesContext(); - ecoreObjectClassesContext = createEcoreObjectClassesContext(); - ecoreAttributeTypesContext = createEcoreAttributeTypesContext(); - } - - private DirContext createEcoreContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - ECORE_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - ECORE_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createEcoreObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, contextAttributes ); - } - - - - private DirContext createEcoreAttributeTypesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createEcoreSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - protected DirContext ecoreContext = null; - protected DirContext ecoreObjectClassesContext = null; - protected DirContext ecoreAttributeTypesContext = null; - protected DirContext ecoreSyntaxesContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java deleted file mode 100644 index 060f017e35..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class EcoreSchemaContextsSetupTest -extends EcoreSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaContext); - } - - public void testCreateEcoreContext() - { - assertNotNull(ecoreContext); - } - - public void testCreateEcoreObjectClassesContext() - { - assertNotNull(ecoreObjectClassesContext); - } - - public void testCreateEcoreAttributeTypesContext() - { - assertNotNull(ecoreAttributeTypesContext); - } - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(ecoreSyntaxesContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java deleted file mode 100644 index 11fb2a3af9..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class SchemaContextSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect(); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java deleted file mode 100644 index dacbf2b2ec..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class SchemaContextSetupTest -extends SchemaContextSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetup.java deleted file mode 100644 index 92f86bc402..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetup.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; - -public class SchemaContextsSetup -extends AbstractTestSetup -{ - public void tearDown() throws NamingException, Exception - { - dasSyntaxesContext.close(); - dasContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - - dasAttributeTypesContext.close(); - dasContext.destroySubcontext( ATTRIBUTE_TYPES_CONTEXT_RDN ); - - dasObjectClassesContext.close(); - dasContext.destroySubcontext( OBJECT_CLASSES_CONTEXT_RDN ); - dasContext.close(); - - xsdSyntaxesContext.close(); - xsdContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - - xsdContext.close(); - schemaContext.destroySubcontext( XSD_CONTEXT_RDN ); - - ecoreSyntaxesContext.close(); - ecoreContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - - ecoreContext.close(); - schemaContext.destroySubcontext( ECORE_CONTEXT_RDN ); - - schemaContext.destroySubcontext( DAS_CONTEXT_RDN ); - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect(); - dasContext = createDASContext(); - dasSyntaxesContext = createSyntaxesContext(); - dasAttributeTypesContext = createAttributeTypesContext(); - dasObjectClassesContext = createObjectClassesContext(); - xsdContext = createXSDContext(); - xsdSyntaxesContext = createXSDSyntaxesContext(); - ecoreContext = createEcoreContext(); - ecoreSyntaxesContext = createEcoreSyntaxesContext(); - } - - private DirContext createDASContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute dasAttribute = new BasicAttribute( - CN, - DAS_CONTEXT_NAME); - - contextAttributes.put( dasAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - DAS_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createXSDContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute xsdAttribute = new BasicAttribute( - CN, - XSD_CONTEXT_NAME); - - contextAttributes.put( xsdAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - XSD_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createXSDSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute xsdAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( xsdAttribute ); - contextAttributes.put( objectClassAttribute ); - - return xsdContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createEcoreContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - ECORE_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - ECORE_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createEcoreSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return ecoreContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute syntaxesRDNAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( objectClassAttribute ); - contextAttributes.put( syntaxesRDNAttribute ); - - return dasContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - - private DirContext createAttributeTypesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute attributeTypes = new BasicAttribute( - OU, - ATTRIBUTE_TYPES_CONTEXT_NAME); - - contextAttributes.put( attributeTypes ); - contextAttributes.put( objectClassAttribute ); - - return dasContext.createSubcontext( - ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createObjectClassesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute attributeTypes = new BasicAttribute( - OU, - OBJECT_CLASSES_CONTEXT_NAME); - - contextAttributes.put( attributeTypes ); - contextAttributes.put( objectClassAttribute ); - - return dasContext.createSubcontext( - OBJECT_CLASSES_CONTEXT_RDN, - contextAttributes ); - } - - protected DirContext dasContext = null; - protected DirContext xsdContext = null; - protected DirContext xsdSyntaxesContext = null; - protected DirContext ecoreContext = null; - protected DirContext ecoreSyntaxesContext = null; - protected DirContext dasSyntaxesContext = null; - protected DirContext dasAttributeTypesContext = null; - protected DirContext dasObjectClassesContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetupTest.java deleted file mode 100644 index dfea532518..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextsSetupTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -public class SchemaContextsSetupTest -extends SchemaContextsSetup -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaContext); - } - - - public void testCreateDASContext() - { - assertNotNull(dasContext); - } - - - public void testCreateXSDContext() - { - assertNotNull(xsdContext); - } - - - - public void testCreateXSDSyntaxesContext() - { - assertNotNull(xsdSyntaxesContext); - } - - - public void testCreateEcoreContext() - { - assertNotNull(ecoreContext); - } - - - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(ecoreSyntaxesContext); - } - - public void testCreateSyntaxesContext() - { - assertNotNull(dasSyntaxesContext); - } - - public void testCreateAttributeTypesContext() - { - assertNotNull(dasAttributeTypesContext); - } - - - public void testCreateObjectClassesContext() - { - assertNotNull(dasObjectClassesContext); - } - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetup.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetup.java deleted file mode 100644 index 4b9cd22e44..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetup.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class XSDSchemaContextsSetup -extends AbstractTestSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - xsdSyntaxesContext.close(); - xsdContext.destroySubcontext( SYNTAXES_CONTEXT_RDN ); - xsdContext.close(); - schemaContext.destroySubcontext( XSD_CONTEXT_RDN ); - schemaContext.close(); - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - schemaContext = connect(); - xsdContext = createXsdContext(); - xsdSyntaxesContext = createXsdSyntaxesContext(); - } - - private DirContext createXsdContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(META_SCHEMA); - - Attribute ecoreAttribute = new BasicAttribute( - CN, - XSD_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return schemaContext.createSubcontext( - XSD_CONTEXT_RDN, contextAttributes ); - } - - private DirContext createXsdSyntaxesContext() throws NamingException - { - Attributes contextAttributes = new BasicAttributes(); - - Attribute objectClassAttribute = new BasicAttribute( - OBJECT_CLASS, - TOP); - objectClassAttribute.add(ORGANIZATIONAL_UNIT); - - Attribute ecoreAttribute = new BasicAttribute( - OU, - SYNTAXES_CONTEXT_NAME); - - contextAttributes.put( ecoreAttribute ); - contextAttributes.put( objectClassAttribute ); - - return xsdContext.createSubcontext( - SYNTAXES_CONTEXT_RDN, contextAttributes ); - } - - protected DirContext xsdContext = null; - protected DirContext xsdSyntaxesContext = null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetupTest.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetupTest.java deleted file mode 100644 index a0bb8fb69d..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/schema/setup/test/XSDSchemaContextsSetupTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.tuscany.das.ldap.schema.setup.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.constants.DASConstants; - -public class XSDSchemaContextsSetupTest -extends XSDSchemaContextsSetup -implements DASConstants -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void testConnect() - { - assertNotNull(schemaContext); - } - - public void testCreateEcoreContext() - { - assertNotNull(xsdContext); - } - - public void testCreateEcoreSyntaxesContext() - { - assertNotNull(xsdSyntaxesContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/testing/constants/DASTestingConstants.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/testing/constants/DASTestingConstants.java deleted file mode 100644 index 2ee1d37650..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/testing/constants/DASTestingConstants.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.apache.tuscany.das.ldap.testing.constants; - -public interface DASTestingConstants { - - String xsdNamespace = - "http://example.com/users/accounts"; - - -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/ComplexTypeNamespaceQualifier.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/ComplexTypeNamespaceQualifier.java deleted file mode 100644 index 1185d968d3..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/ComplexTypeNamespaceQualifier.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.util; - -// TODO: Auto-generated Javadoc -/** - * The Class DataTypeNamespaceQualifier. - */ -public class ComplexTypeNamespaceQualifier -{ - /** - * Qualify. - * - * @param namespaceURI the namespace URI - * @param complexTypeName the name - * - * @return the string - */ - public static String qualify(String namespaceURI, String complexTypeName ) - { - return namespaceURI + "/" + complexTypeName; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/IDGenerator.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/IDGenerator.java deleted file mode 100644 index f41d192bd0..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/IDGenerator.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.apache.tuscany.das.ldap.util; - -public class IDGenerator { - - static long currentID= System.currentTimeMillis(); - - static public synchronized long generate(){ - return currentID++; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/JNDIUtil.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/JNDIUtil.java deleted file mode 100644 index be19f0b6c4..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/JNDIUtil.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.apache.tuscany.das.ldap.util; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -/** - * The Class JNDIUtil. - */ -public class JNDIUtil -{ - /** - * Calculate DN components. - * - * @param context the context - * - * @return the string[] containing the components of the DN - * - * @throws NamingException the naming exception - */ - public static String[] calculateDNComponents( - DirContext context) - throws NamingException - { - String contextDN = - context.getNameInNamespace(); - - String[] initialContextComponents = - contextDN.split( "[,]" ); - - return initialContextComponents; - } - - - /** - * Calculate DN components. - * - * @param contextDN the context DN - * - * @return the string[] containing the components of the DN - * - * @throws NamingException the naming exception - */ - public static String[] calculateDNComponents( - String contextDN) - throws NamingException - { - String[] initialContextComponents = - contextDN.split( "[,]" ); - - return initialContextComponents; - } - - /** - * Gets the parent context. - * - * @param partitionContext the partition context - * @param childContext the child context - * - * @return the parent context (Null if the child context is the root) - * - * @throws NamingException the naming exception - */ - public static DirContext getParentContext( - DirContext childContext, - DirContext partitionContext) - throws NamingException - { - String[] childContextDNComponents = - calculateDNComponents( childContext ); - - String[] partitionDNComponents = - calculateDNComponents( partitionContext ); - - DirContext parentContext = null; - - if (childContextDNComponents.length == partitionDNComponents.length) - { - return null; - } - else if ( (childContextDNComponents.length - 1) == partitionDNComponents.length) - { - return partitionContext; - } - else - { - String parentLookupDN = - calculateParentRelativeDN( - childContext, partitionContext.getNameInNamespace() ); - - - - parentContext = - ( DirContext ) partitionContext.lookup( parentLookupDN ); - } - return parentContext; - } - - - /** - * Calculate parent relative DN. - * The parent relative DN is the - * DN of the parent context, relative - * to the partition context. - * - * So if the partition context is - * ou=system and - * the child context has DN - * cn=accounts, cn=users, cn=example, ou=system - * - * then the parent relative DN is - * cn=users, cn=example - * - * @param childContext the child context - * @param partitionDN the partition DN - * - * @return the string - * - * @throws NamingException the naming exception - */ - public static String calculateParentRelativeDN( - DirContext childContext, - String partitionDN) - throws NamingException - { - String parentRelativeDN = null; - - String[] childContextDNComponents = - calculateDNComponents( childContext ); - - String[] partitionDNComponents = - calculateDNComponents( partitionDN ); - - if (childContextDNComponents.length == - partitionDNComponents.length) - { - return null; - } - else if (childContextDNComponents.length == - partitionDNComponents.length + 1) - { - String childRDN = childContextDNComponents[0]; - String childContextDN = childContext.getNameInNamespace(); - - int beginIndex = childRDN.length() + 1; - int endIndex = childContextDN.length(); - - parentRelativeDN = childContextDN.substring( - beginIndex, endIndex ); - - return parentRelativeDN; - } - else - { - String childRDN = childContextDNComponents[0]; - String childContextDN = childContext.getNameInNamespace(); - - int beginIndex = childRDN.length() + 1; - int endIndex = - childContextDN.length() - - ( partitionDN.length() +1); - - parentRelativeDN = childContextDN.substring( - beginIndex, endIndex ); - } - return parentRelativeDN; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/LDAPNormalizer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/LDAPNormalizer.java deleted file mode 100644 index 2d0be469bc..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/LDAPNormalizer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.util; - -public class LDAPNormalizer -{ - - /** - * Normalize a qualified string for LDAP - * by replacing periods with dashes. - * - * @param qualifiedName the qualified name - */ - public static void normalize(String qualifiedName) - { - qualifiedName = qualifiedName.replace( ".", "-" ); - } - - - -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/QualifiedNameNormalizer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/QualifiedNameNormalizer.java deleted file mode 100644 index 51b34f5d0f..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/QualifiedNameNormalizer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.util; - -public class QualifiedNameNormalizer -{ - /** - * Normalize a qualified string for LDAP - * by replacing periods with dashes. - * - * @param qualifiedName the qualified name - */ - public static String normalize(String qualifiedName) - { - qualifiedName = qualifiedName.replace("http://", ""); - qualifiedName = qualifiedName.replace("/", "-"); - return qualifiedName.replace(".", "-"); - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/SimpleTypeNamespaceQualifier.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/SimpleTypeNamespaceQualifier.java deleted file mode 100644 index 40dc6e0b09..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/SimpleTypeNamespaceQualifier.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.util; - -// TODO: Auto-generated Javadoc -/** - * The Class DataTypeNamespaceQualifier. - */ -public class SimpleTypeNamespaceQualifier -{ - /** - * Qualify. - * - * @param namespaceURI the namespace URI - * @param complexTypeName the name - * - * @return the string - */ - public static String qualify(String namespaceURI, String complexTypeName, String simpleTypeName ) - { - return namespaceURI + "/" + complexTypeName + "/" + simpleTypeName; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceToInitialContextTransformer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceToInitialContextTransformer.java deleted file mode 100644 index 87ff89071a..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceToInitialContextTransformer.java +++ /dev/null @@ -1,49 +0,0 @@ - -package org.apache.tuscany.das.ldap.util; - -import org.eclipse.emf.common.util.URI; - -/** - * The Class XSDNamespaceToInitialContextTransformer. - * - * Takes the XSD Namespace used by the DataObjects - * and transforms it into the DN of the initial context - * used for the root DataObject entry. - */ -public class XSDNamespaceToInitialContextTransformer -{ - /** - * Transform. - * - * @param namespaceURIString the namespace URI string - * - * @return the DN of the initial context - * - * @throws Exception the exception - */ - public static String transform(String namespaceURIString) throws Exception - { - URI namespaceURI = URI.createURI(namespaceURIString); - String authority = namespaceURI.authority(); - - String path = namespaceURI.path(); - - String[] authorityTokens = authority.split( "[.]" ); - String[] pathTokens = path.split("[/]"); - - String DN = new String(""); - - for (int i = (pathTokens.length-1); i > 0; i--) - { - DN = DN + "cn=" + pathTokens[i] + ", "; - } - - for (int i = 0; i <= (authorityTokens.length-2); i++) - { - DN = DN + "cn=" + authorityTokens[i] + ", "; - } - - DN = DN + "ou=" + authorityTokens[authorityTokens.length-1]; - return DN; - } -} diff --git a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceURITokenizer.java b/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceURITokenizer.java deleted file mode 100644 index 833cf0e7ae..0000000000 --- a/java/das/ldap/das.ldap/src/main/java/org/apache/tuscany/das/ldap/util/XSDNamespaceURITokenizer.java +++ /dev/null @@ -1,26 +0,0 @@ - -package org.apache.tuscany.das.ldap.util; - -import org.eclipse.emf.common.util.URI; - -public class XSDNamespaceURITokenizer -{ - - public static String[] createAuthorityTokens( URI xsdNamespaceURI ) - { - String authority = xsdNamespaceURI.authority(); - String[] authorityTokens = authority.split( "[.]" ); - return authorityTokens; - } - - public static String[] createPathTokens(URI xsdNamespace) - { - String path = xsdNamespace.path(); - if (path != null) - { - return path.split("[/]"); - } - else - return null; - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/connect/test/ADSEmbeddedConnectionTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/connect/test/ADSEmbeddedConnectionTest.java deleted file mode 100644 index d77b4491a4..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/connect/test/ADSEmbeddedConnectionTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.tuscany.das.ldap.connect.test; - -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.connect.ADSEmbeddedConnection; -import org.apache.tuscany.model.Configuration; -import org.apache.tuscany.model.ConfigurationFactory; - -import junit.framework.TestCase; - -public class ADSEmbeddedConnectionTest extends TestCase { - - public void testConnect() throws Exception - { - Configuration configuration = - ConfigurationFactory. - INSTANCE. - createConfiguration(); - - ADSEmbeddedConnection adsEmbeddedConnection = - new ADSEmbeddedConnection(configuration); - - LdapContext dasContext = - adsEmbeddedConnection. - connect( - configuration. - getDasPartitionName()); - - assertEquals( - dasContext.getNameInNamespace(), - "ou=das"); - - LdapContext schemaContext = - adsEmbeddedConnection. - connect( - configuration. - getSchemaPartitionName()); - - assertEquals( - schemaContext.getNameInNamespace(), - "ou=schema"); - - configuration.setDasPartitionName("system"); - - LdapContext systemContext = - adsEmbeddedConnection.connect(configuration.getDasPartitionName()); - - assertEquals( - systemContext.getNameInNamespace(), - "ou=system"); - - adsEmbeddedConnection.shutdown(); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java deleted file mode 100644 index 96c449099d..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.create.InitialContextCreatorHelper; - -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; -import org.apache.tuscany.das.ldap.util.XSDNamespaceURITokenizer; -import org.eclipse.emf.common.util.URI; - -/* - * Note these tests require a running instance of ApacheDS - */ - -public class InitialContextCreatorHelperTest -extends AbstractTestSetup -{ - protected String xsdNamespace = "http://example.com/users/accounts"; - protected URI xsdNamespaceURI = URI.createURI( xsdNamespace ); - - LdapContext comContext = null; - LdapContext exampleContext = null; - LdapContext usersContext = null; - - public void setUp() throws Exception - { - super.setUp(); - } - - public void tearDown() throws Exception - { - super.tearDown(); - } - - public void testCreateSystemSubContext() throws NamingException - { - String testContextRDN = "cn=newContext"; - - Object testContext = null; - - try { - testContext = dasPartitionContext.lookup( testContextRDN ); - } - catch (Exception e) - { - //good - } - - assertNull(testContext); - - InitialContextCreatorHelper.createSubContext( - dasPartitionContext, - testContextRDN, - null); - - testContext = dasPartitionContext.lookup( testContextRDN ); - - assertNotNull(testContext); - dasPartitionContext.destroySubcontext( testContextRDN ); - } - - public void testCreateExistingSystemSubContext() throws NamingException - { - String testContextRDN = "cn=newContext"; - Object testContext = null; - - try { - testContext = dasPartitionContext.lookup( testContextRDN ); - } - catch (Exception e) - { - //good - } - - assertNull(testContext); - - InitialContextCreatorHelper.createSubContext( - dasPartitionContext, - testContextRDN, - null); - - //Run the same code again. - InitialContextCreatorHelper.createSubContext( - dasPartitionContext, - testContextRDN, - null); - - testContext = dasPartitionContext.lookup( testContextRDN ); - - assertNotNull(testContext); - dasPartitionContext.destroySubcontext( testContextRDN ); - } - - - public void testCreateAuthorityContext() - throws NamingException - { - try - { - comContext = - ( LdapContext ) - dasPartitionContext.lookup("cn=com"); - } - catch ( NamingException e ) - { - //Good - the subcontext does not exist - } - assertTrue(comContext==null); - - String[] authorityTokens = - XSDNamespaceURITokenizer.createAuthorityTokens(xsdNamespaceURI); - - InitialContextCreatorHelper.createAuthorityContext( - dasPartitionContext, - authorityTokens ); - - comContext = - ( LdapContext ) dasPartitionContext.lookup("cn=com"); - - assertNotNull(comContext); - - exampleContext = - ( LdapContext ) comContext.lookup("cn=example"); - - assertNotNull(exampleContext); - - comContext.destroySubcontext( "cn=example" ); - dasPartitionContext.destroySubcontext( "cn=com" ); - } - - public void testCreatePathContext() throws NamingException - { - String[] authorityTokens = - XSDNamespaceURITokenizer. - createAuthorityTokens(xsdNamespaceURI); - - exampleContext = - InitialContextCreatorHelper. - createAuthorityContext( - dasPartitionContext, - authorityTokens ); - - String[] pathTokens = - XSDNamespaceURITokenizer. - createPathTokens(xsdNamespaceURI); - - InitialContextCreatorHelper. - createPathContext( - exampleContext, - pathTokens ); - - comContext = - ( LdapContext ) - dasPartitionContext. - lookup("cn=com"); - - exampleContext = - ( LdapContext ) - comContext. - lookup("cn=example"); - - usersContext = ( LdapContext ) exampleContext.lookup("cn=users"); - - usersContext.destroySubcontext( "cn=accounts" ); - exampleContext.destroySubcontext( "cn=users" ); - comContext.destroySubcontext( "cn=example" ); - dasPartitionContext.destroySubcontext( "cn=com" ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java deleted file mode 100644 index 75834a7502..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -public class InitialContextCreatorTest -extends AbstractTestSetup -{ - public void testCreate() throws NamingException - { - LdapContext comContext = null; - LdapContext exampleContext = null; - LdapContext usersContext = null; - LdapContext accountsContext = null; - LdapContext rootContext = null; - - rootContext = - InitialContextCreator.create( - xsdNamespace, - dasPartitionContext ); - - assertEquals( - rootContext.getNameInNamespace(), - "cn=accounts,cn=users,cn=example,cn=com,ou=das"); - - comContext = - ( LdapContext ) - dasPartitionContext.lookup( "cn=com" ); - exampleContext = ( LdapContext )comContext.lookup( "cn=example" ); - usersContext = ( LdapContext ) exampleContext.lookup( "cn=users" ); - accountsContext = ( LdapContext ) usersContext.lookup( "cn=accounts" ); - accountsContext = ( LdapContext ) usersContext.lookup( "cn=accounts" ); - - assertNotNull(comContext); - assertNotNull(exampleContext); - assertNotNull(usersContext); - assertNotNull(accountsContext); - - usersContext. - destroySubcontext( "cn=accounts" ); - - exampleContext. - destroySubcontext( "cn=users" ); - - comContext. - destroySubcontext( "cn=example" ); - - dasPartitionContext. - destroySubcontext( "cn=com" ); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/MetaContextCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/MetaContextCreatorTest.java deleted file mode 100644 index 904ef2f2c6..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/MetaContextCreatorTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create.test; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.create.InitialContextCreator; -import org.apache.tuscany.das.ldap.create.MetaContextCreator; -import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer; -import org.apache.tuscany.das.ldap.destroy.MetaContextDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -public class MetaContextCreatorTest -extends AbstractTestSetup -{ - private LdapContext modelContext = null; - private LdapContext metaContext = null; - - public void tearDown() - throws NamingException - { - MetaContextDestroyer.destroy( modelContext ); - - InitialContextDestroyer.destroy( - modelContext, - dasPartitionContext ); - } - - public void setUp() throws Exception - { - super.setUp(); - modelContext = - InitialContextCreator. - create( - xsdNamespace, - dasPartitionContext); - - metaContext = - MetaContextCreator. - create(modelContext ); - } - - public void testCreate() throws NamingException - { - assertTrue(true); - - assertEquals( - "cn=meta,cn=accounts,cn=users,cn=example,cn=com,ou=das", - metaContext.getNameInNamespace() ); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java deleted file mode 100644 index 6e9ba56779..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.create.test; - -import org.apache.tuscany.das.ldap.oid.create.OIDCreatorHelper; - -import junit.framework.TestCase; - -public class UniqueOIDCreatorHelperTest -extends TestCase -{ - public void testCalculateSegmentedOID() throws Exception - { - String input1 = "56102578"; - String input2 = "5610257834"; - - String result = - "will not pass if exception not caught"; - try { - result = - OIDCreatorHelper. - calculateSegmentedOID( input1 ); - } - catch (Exception e) - { - result = "passed"; - } - assertEquals(result, "passed"); - - result = - OIDCreatorHelper. - calculateSegmentedOID( input2 ); - - assertEquals(result, "56102578.4"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java deleted file mode 100644 index 5ce43587df..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.destroy.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -public class InitialContextDestroyerTest extends AbstractTestSetup -{ - DirContext test1Context = null; - DirContext test2Context = null; - DirContext test3Context = null; - - /* - * Tests that the initial context destroyer - * destroys child projects before parent projects. - */ - public void testDestroy() throws NamingException - { - test1Context = - ( DirContext ) - dasPartitionContext. - createSubcontext( "cn=test1" ); - - test2Context = - ( DirContext ) - test1Context. - createSubcontext( "cn=test2" ); - - test3Context = - ( DirContext ) - test2Context. - createSubcontext( "cn=test3" ); - - Object test = null; - test = - dasPartitionContext. - lookup( "cn=test1" ); - - assertNotNull(test); - - InitialContextDestroyer. - destroy( - test3Context, - dasPartitionContext); - - try - { - test = dasPartitionContext.lookup( "cn=test1" ); - } - catch (Exception e) - { - test = "caught"; - } - - assertSame("caught", test); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataGraphCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataGraphCreatorTest.java deleted file mode 100644 index 2f2b8a24de..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataGraphCreatorTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.prototype.setup.test.EDataGraphSetupTest; - - -public class EDataGraphCreatorTest -extends EDataGraphSetupTest -{ - public void testCreate() throws NamingException - { - assertEquals( - "example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - userContainerContext.getNameInNamespace()); - - Attributes userEntryAttributes = - userContainerContext.getAttributes(""); - - assertEquals( - userEntryAttributes.get( - "example-com-users-accounts-User-userPassword").get(), - "secret"); - - assertEquals( - userEntryAttributes.get( - "example-com-users-accounts-User-authorizationList").get(0), "2"); - - assertEquals( - userEntryAttributes.get( - "example-com-users-accounts-User-authorizationList").get(1), "3"); - - assertEquals( - userEntryAttributes.get("example-com-users-accounts-User-userName").get(), - "ole"); - - assertEquals( - "cn=authorizationList,example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - authorizationContainerContext.getNameInNamespace()); - - LdapContext authorizationEntry1Context = - (LdapContext) - rootContext. - lookup(authorizationDataObject1RDN); - - assertEquals( - "example-com-users-accounts-Authorization-id=2,cn=authorizationList,example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - authorizationEntry1Context.getNameInNamespace()); - - Attributes authorizationEntry1Attributes = - rootContext. - getAttributes(authorizationDataObject1RDN); - - assertEquals( - authorizationEntry1Attributes.get("example-com-users-accounts-Authorization-fileName").get(), - "somefile.text"); - - assertEquals( - authorizationEntry1Attributes.get("example-com-users-accounts-Authorization-writeAuthorization").get(), - "TRUE"); - - - LdapContext authorizationEntry2Context = - (LdapContext) - rootContext. - lookup(authorizationDataObject2RDN); - - assertEquals( - "example-com-users-accounts-Authorization-id=3,cn=authorizationList,example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - authorizationEntry2Context.getNameInNamespace()); - - - Attributes authorizationEntry2Attributes = - rootContext. - getAttributes(authorizationDataObject2RDN); - - assertEquals( - authorizationEntry2Attributes.get("example-com-users-accounts-Authorization-fileName").get(), - "someOtherfile.text"); - - assertEquals( - "cn=configuration,example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - configurationContainerContext.getNameInNamespace()); - - String configurationEntryRDN = - "example-com-users-accounts-Configuration-id=5"; - - LdapContext configurationEntryContext = - (LdapContext) - configurationContainerContext. - lookup(configurationEntryRDN); - - assertEquals( - "example-com-users-accounts-Configuration-id=5,cn=configuration,example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - configurationEntryContext.getNameInNamespace()); - - Attributes configurationEntryAttributes = - configurationContainerContext. - getAttributes(configurationEntryRDN); - - assertEquals( - configurationEntryAttributes.get("example-com-users-accounts-Configuration-authorization").get(), - "2"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java deleted file mode 100644 index c3b6fc5475..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.create.test; - -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.prototype.setup.test.EDataObjectSetupTest; - -public class EDataObjectCreatorTest -extends EDataObjectSetupTest -{ - protected String eDataObjectRDN = null; - protected LdapContext namedContainerContext = null; - - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - } - - public void testCreate() throws NamingException - { - assertEquals( - "example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das", - userContainerContext.getNameInNamespace()); - - Attributes attributes = - userContainerContext.getAttributes(""); - - assertEquals( - attributes.get("example-com-users-accounts-User-userPassword").get(), - "secret"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userName").get(), - "ole"); - assertEquals( - attributes.get("example-com-users-accounts-User-userPassword").get(), - "secret"); - assertEquals( - attributes.get("example-com-users-accounts-User-userAge").get(), - "33"); - assertEquals( - attributes.get("example-com-users-accounts-User-userHeight").get(), - "6.11"); - - assertEquals( - attributes.get("example-com-users-accounts-User-authorizationList").size(), - 2); - - Attribute aliasesAttribute = attributes.get("example-com-users-accounts-User-userAliases"); - - assertEquals( - aliasesAttribute.size(), - 3); - - assertEquals(aliasesAttribute.get(0), "neo"); - assertEquals(aliasesAttribute.get(1), "trinity"); - assertEquals(aliasesAttribute.get(2), "morpheus"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java deleted file mode 100644 index ea609544cf..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read.test; - -import java.util.Hashtable; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.emf.read.EDataGraphReader; -import org.apache.tuscany.das.ldap.prototype.setup.test.EDataGraphSetupTest; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphReaderTest -extends EDataGraphSetupTest -{ - public void testRead() throws NamingException - { - dataObjectToRelativeDNCache = - new Hashtable(); - - eDataGraph = - EDataGraphReader.read( - userEClass, - "1", - rootContext, - dataObjectToRelativeDNCache); - - EDataObject retrievedUserDataObject = - (EDataObject) eDataGraph.getRootObject(); - - assertEquals( - dataObjectToRelativeDNCache. - get(retrievedUserDataObject).toString(), - "example-com-users-accounts-User-id=1"); - - assertEquals(retrievedUserDataObject.eGet(userNameEAttribute), "ole"); - assertEquals(retrievedUserDataObject.eGet(userPasswordEAttribute), "secret"); - assertEquals(retrievedUserDataObject.eGet(userAgeEAttribute), 33); - assertEquals(retrievedUserDataObject.eGet(userHeightEAttribute), 6.11); - assertEquals(retrievedUserDataObject.eGet(userIsMaleEAttribute), true); - - EList retrievedAuthorizationContainmentList = - (EList) - retrievedUserDataObject. - eGet(userAuthorizationEReference); - - assertEquals(retrievedAuthorizationContainmentList.size(), 2); - - EDataObject retrievedAuthorizationEDataObject1 = - retrievedAuthorizationContainmentList.get(0); - - assertEquals( - dataObjectToRelativeDNCache. - get(retrievedAuthorizationEDataObject1).toString(), - "example-com-users-accounts-Authorization-id=2,cn=authorizationList,example-com-users-accounts-User-id=1"); - - assertEquals( - retrievedAuthorizationEDataObject1. - eGet(authorizationIDEAttribute), "2"); - assertEquals( - retrievedAuthorizationEDataObject1. - eGet(authorizationFileEAttribute), "somefile.text"); - assertEquals( - retrievedAuthorizationEDataObject1. - eGet(authorizationWriteEAttribute), true); - assertEquals( - retrievedAuthorizationEDataObject1. - eGet(authorizationReadEAttribute), true); - assertEquals( - retrievedAuthorizationEDataObject1. - eGet(authorizationExecuteEAttribute), true); - - EDataObject retrievedAuthorizationEDataObject2 = - retrievedAuthorizationContainmentList.get(1); - - assertEquals( - dataObjectToRelativeDNCache. - get(retrievedAuthorizationEDataObject2).toString(), - "example-com-users-accounts-Authorization-id=3,cn=authorizationList,example-com-users-accounts-User-id=1"); - - assertEquals( - retrievedAuthorizationEDataObject2. - eGet(authorizationIDEAttribute), "3"); - - EDataObject retrievedConfigurationEDataObject = - (EDataObject) retrievedUserDataObject. - eGet(userConfigurationEReference); - - assertEquals( - dataObjectToRelativeDNCache. - get(retrievedConfigurationEDataObject).toString(), - "example-com-users-accounts-Configuration-id=5,cn=configuration,example-com-users-accounts-User-id=1"); - - assertEquals( - "5", - retrievedConfigurationEDataObject. - eGet(configurationIDEAttribute)); - - EDataObject referencedAuthorizationDataObject = - (EDataObject) retrievedConfigurationEDataObject. - eGet(configurationAuthorizationEReference); - - assertSame( - retrievedAuthorizationEDataObject1, - referencedAuthorizationDataObject); - - EList referenceAuthorizationsList = - (EList) retrievedConfigurationEDataObject. - eGet(configurationAuthorizationsEReference); - - assertEquals(2, referenceAuthorizationsList.size() ); - } - - public void testReadException() - { - dataObjectToRelativeDNCache = - new Hashtable(); - - try - { - eDataGraph = - EDataGraphReader.read( - userEClass, - "1", - metaContext, - dataObjectToRelativeDNCache); - } - catch ( NamingException e ) - { - readException = true; - } - - assertTrue(readException); - } - - - -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java deleted file mode 100644 index 9617599acb..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.read.test; - -import javax.naming.NamingException; - -import org.apache.tuscany.das.ldap.emf.read.EDataObjectReader; -import org.apache.tuscany.das.ldap.prototype.setup.test.EDataObjectSetupTest; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataObjectReaderTest -extends EDataObjectSetupTest -{ - public void tearDown() throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() throws Exception - { - super.setUp(); - } - - public void testRead() throws NamingException - { - EDataObject eDataObject = - EDataObjectReader.read( - userEClass, - "1", - rootContext); - - assertEquals(eDataObject.eGet(userNameEAttribute), "ole"); - assertEquals(eDataObject.eGet(userPasswordEAttribute), "secret"); - assertEquals(eDataObject.eGet(userAgeEAttribute), 33); - assertEquals(eDataObject.eGet(userHeightEAttribute), 6.11); - assertEquals(eDataObject.eGet(userIsMaleEAttribute), true); - - EList userAliases = ( EList ) eDataObject.eGet(userAliasesEAttribute); - assertEquals(userAliases.size(), 3); - assertEquals(userAliases.get(0), "neo"); - assertEquals(userAliases.get(1), "trinity"); - assertEquals(userAliases.get(2), "morpheus"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASHelperTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASHelperTest.java deleted file mode 100644 index ef8a197f7c..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASHelperTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.test; - -import java.io.File; -import java.util.Hashtable; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import junit.framework.TestCase; - -import org.apache.commons.io.FileUtils; -import org.apache.tuscany.das.ldap.connect.ADSEmbeddedConnection; -import org.apache.tuscany.das.ldap.emf.Context; -import org.apache.tuscany.das.ldap.emf.LdapDAS; -import org.apache.tuscany.das.ldap.emf.LdapDASHelper; -import org.apache.tuscany.model.Configuration; -import org.apache.tuscany.model.ConfigurationFactory; -import org.apache.tuscany.model.DASMeta; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class LdapDASHelperTest extends TestCase -{ - - private LdapContext schemaContext = null; - private ADSEmbeddedConnection adsEmbeddedConnection; - Configuration configuration = null; - - public void tearDown() throws NamingException, Exception - { - adsEmbeddedConnection.shutdown(); - } - - public void setUp() throws Exception - { - /* - * Note that I had to move the schemaContext - * creation inside each test method due to a - * bug in ADS. - */ - FileUtils.deleteDirectory(new File("server-work")); - - configuration = - ConfigurationFactory. - INSTANCE. - createConfiguration(); - - adsEmbeddedConnection = - new ADSEmbeddedConnection( - configuration); - } - - - public void testReadDasMeta() throws Exception - { - Configuration configuration = - ConfigurationFactory. - INSTANCE. - createConfiguration(); - - configuration.setEmbedded( true ); - - LdapDAS ldapDAS = new LdapDAS(configuration); - - Context context = ldapDAS.getContext(); - - - Map metaDataObjectToRelativeDNCache = - new Hashtable(); - - EDataGraph dasMetaDataGraph = - LdapDASHelper.readDasMeta( - context, - metaDataObjectToRelativeDNCache ); - - assertEquals( - "org-apache-tuscany-das-ldap-configuration-model-ecore-v100-DASMeta-id=0", - metaDataObjectToRelativeDNCache.values().toArray()[0]); - - DASMeta dasMeta = ( DASMeta ) dasMetaDataGraph.getRootObject(); - - assertEquals( - dasMeta, - metaDataObjectToRelativeDNCache.keySet().toArray()[0] ); - - assertEquals( - "org-apache-tuscany-das-ldap-configuration-model-ecore-v100-DASMeta-id=0", - metaDataObjectToRelativeDNCache.get(dasMeta)); - } - - public void testCreateEcoreContext() throws NamingException - { - schemaContext = - adsEmbeddedConnection. - connect( - configuration.getSchemaPartitionName() ); - - LdapContext ecoreContext = - LdapDASHelper.createEcoreContext( - schemaContext); - - assertEquals( - ecoreContext.getNameInNamespace(), - "cn=ecore,ou=schema" ); - - schemaContext.destroySubcontext( "cn=ecore" ); - } - - public void testCreateEcoreObjectClassesContext() throws NamingException - { - schemaContext = - adsEmbeddedConnection. - connect( - configuration.getSchemaPartitionName() ); - - LdapContext ecoreContext = - LdapDASHelper.createEcoreContext( - schemaContext); - - LdapContext ecoreObjectClassesContext = - LdapDASHelper. - createEcoreObjectClassesContext( - schemaContext ); - - ecoreObjectClassesContext = - LdapDASHelper. - createEcoreObjectClassesContext( - schemaContext ); - - assertEquals( - ecoreObjectClassesContext.getNameInNamespace(), - "ou=objectClasses,cn=ecore,ou=schema"); - - - ecoreContext.destroySubcontext( "ou=objectClasses" ); - schemaContext.destroySubcontext( "cn=ecore" ); - } - - public void testCreateEcoreAttributeTypesContext() throws NamingException - { - schemaContext = - adsEmbeddedConnection. - connect( - configuration.getSchemaPartitionName() ); - - LdapContext ecoreContext = - LdapDASHelper.createEcoreContext( - schemaContext); - - LdapContext ecoreAttributeTypesContext = - LdapDASHelper. - createEcoreAttributeTypesContext( schemaContext ); - - ecoreAttributeTypesContext = - LdapDASHelper. - createEcoreAttributeTypesContext( schemaContext ); - - assertEquals( - ecoreAttributeTypesContext.getNameInNamespace(), - "ou=attributeTypes,cn=ecore,ou=schema"); - - ecoreContext.destroySubcontext( "ou=attributeTypes" ); - schemaContext.destroySubcontext( "cn=ecore" ); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASTest.java deleted file mode 100644 index feeed1e253..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/test/LdapDASTest.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.test; - -import java.util.Map; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.emf.Context; -import org.apache.tuscany.das.ldap.emf.LdapDAS; -import org.apache.tuscany.das.ldap.prototype.setup.test.LdapDASSetupTest; -import org.apache.tuscany.model.Configuration; -import org.apache.tuscany.model.ConfigurationFactory; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.sdo.EChangeSummary; -import org.eclipse.emf.ecore.sdo.EDataGraph; -import org.eclipse.emf.ecore.sdo.EDataObject; - - -public class LdapDASTest extends LdapDASSetupTest -{ - Configuration configuration = null; - LdapDAS ldapDAS = null; - - public void setUp() throws Exception - { - super.setUp(); - configuration = - ConfigurationFactory. - INSTANCE. - createConfiguration(); - - configuration.setEmbedded( true ); - ldapDAS = new LdapDAS(configuration); - } - - public void tearDown() throws NamingException, Exception - { - ldapDAS.getAdsEmbeddedConnection().shutdown(); - super.tearDown(); - } - - public void testConstructor() throws NamingException - { - Context context = ldapDAS.getContext(); - assertEquals( - "ou=das", - context.getDasContext().getNameInNamespace()); - assertEquals( - "cn=meta,ou=das", - context.getDasMetaContext().getNameInNamespace()); - assertEquals( - "ou=attributeTypes,cn=ecore,ou=schema", - context.getEcoreAttributeTypesContext().getNameInNamespace()); - assertEquals( - "ou=objectClasses,cn=ecore,ou=schema", - context.getEcoreObjectClassesContext().getNameInNamespace()); - } - - public void testCreate() throws Exception, NamingException - { - ldapDAS.create( eDataGraph ); - - Context context = - ldapDAS.getContext(); - - dataObjectToRelativeDNCache = - context.getDataObjectToRelativeDNCache(); - - Map xsdNamespaceToLdapContextMap = - context. - getXsdNamespaceToLdapContextMap(); - - EDataObject rootObject = - ( EDataObject ) - eDataGraph.getRootObject(); - - String namespace = - rootObject. - eClass(). - getEPackage(). - getNsURI(); - - assertEquals( - "http://example.com/users/accounts", - namespace); - - LdapContext rootContext = - xsdNamespaceToLdapContextMap. - get( namespace ); - - assertEquals( - "cn=accounts,cn=users,cn=example,cn=com,ou=das", - rootContext.getNameInNamespace() ); - - String userDataObjectRDN = - dataObjectToRelativeDNCache.get( rootObject ); - - //============================================================ - //Verify the RDN - //============================================================ - - assertEquals( - "example-com-users-accounts-User-id=1", - userDataObjectRDN ); - - //============================================================ - //Verify the attribute values - //============================================================ - - Attributes attributes = - rootContext. - getAttributes( userDataObjectRDN ); - - assertEquals( - attributes.get("objectClass").get(), - "example-com-users-accounts-User"); - - assertEquals( - attributes.get("objectClass").get(1), - "metaObjectClass"); - - assertEquals( - attributes.get("objectClass").get(2), - "metaTop"); - - assertEquals( - attributes.get("objectClass").get(3), - "top"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userAge").get(), - "33"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userName").get(), - "ole"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userPassword").get(), - "secret"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userHeight").get(), - "6.11"); - - assertEquals( - attributes.get("example-com-users-accounts-User-id").get(), - "1"); - - assertEquals( - attributes.get("example-com-users-accounts-User-isMale").get(), - "TRUE"); - - - assertEquals( - attributes.get("example-com-users-accounts-User-userAliases").get(), - "neo"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userAliases").get(1), - "trinity"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userAliases").get(2), - "morpheus"); - - assertEquals( - attributes.get("example-com-users-accounts-User-configuration").get(), - "5"); - - assertEquals( - attributes.get("example-com-users-accounts-User-authorizationList").get(), - "2"); - - assertEquals( - attributes.get("example-com-users-accounts-User-authorizationList").get(1), - "3"); - - - EDataObject configurationObject = - ( EDataObject ) rootObject. - eGet( userConfigurationEReference ); - - String userConfigurationDataObjectRDN = - dataObjectToRelativeDNCache. - get( configurationObject ); - - //============================================================ - //Verify the RDN - //============================================================ - - assertEquals( - "example-com-users-accounts-Configuration-id=5,cn=configuration,example-com-users-accounts-User-id=1", - userConfigurationDataObjectRDN); - - attributes = rootContext.getAttributes( userConfigurationDataObjectRDN ); - - //============================================================ - //Verify the Attributes - //============================================================ - - assertEquals( - attributes.get("objectClass").get(), - "example-com-users-accounts-Configuration"); - - assertEquals( - attributes.get("objectClass").get(1), - "metaObjectClass"); - - assertEquals( - attributes.get("objectClass").get(2), - "metaTop"); - - assertEquals( - attributes.get("objectClass").get(3), - "top"); - - assertEquals( - attributes.get("example-com-users-accounts-Configuration-authorization").get(), - "2"); - - assertEquals( - attributes.get("example-com-users-accounts-Configuration-id").get(), - "5"); - - assertEquals( - attributes.get("example-com-users-accounts-Configuration-authorizations").get(), - "2"); - - assertEquals( - attributes.get("example-com-users-accounts-Configuration-authorizations").get(1), - "3"); - - EList authorizationList = - ( EList ) rootObject. - eGet( userAuthorizationEReference ); - - EDataObject authorizationDataObject1 = - authorizationList.get( 0 ); - - String userAuthorizationDataObject1RDN = - dataObjectToRelativeDNCache. - get( authorizationDataObject1 ); - - //============================================================ - //Verify the RDN - //============================================================ - - assertEquals( - "example-com-users-accounts-Authorization-id=2,cn=authorizationList,example-com-users-accounts-User-id=1", - userAuthorizationDataObject1RDN); - - attributes = rootContext.getAttributes( userAuthorizationDataObject1RDN ); - - //============================================================ - //Verify the Attributes - //============================================================ - - assertEquals( - attributes.get("objectClass").get(), - "example-com-users-accounts-Authorization"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-id").get(), - "2"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-executeAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-readAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-writeAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-fileName").get(), - "somefile.text"); - - - EDataObject authorizationDataObject2 = - authorizationList.get( 1 ); - - String userAuthorizationDataObject2RDN = - dataObjectToRelativeDNCache. - get( authorizationDataObject2 ); - - //============================================================ - //Verify the RDN - //============================================================ - - assertEquals( - "example-com-users-accounts-Authorization-id=3,cn=authorizationList,example-com-users-accounts-User-id=1", - userAuthorizationDataObject2RDN); - - attributes = rootContext.getAttributes( userAuthorizationDataObject2RDN ); - - //============================================================ - //Verify the Attributes - //============================================================ - - assertEquals( - attributes.get("objectClass").get(), - "example-com-users-accounts-Authorization"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-id").get(), - "3"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-executeAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-readAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-writeAuthorization").get(), - "TRUE"); - - assertEquals( - attributes.get("example-com-users-accounts-Authorization-fileName").get(), - "someOtherfile.text"); - - - /* Finding out the values of the attributes - NamingEnumeration namingEnumeration = attributes.getAll(); - while (namingEnumeration.hasMore()) - { - Attribute attribute = ( Attribute ) namingEnumeration.next(); - System.out.println(attribute); - } - */ - } - - public void testRead() throws NamingException, Exception - { - /* - * More exhaustive testing has been done on the - * class that LdapDAS.read() delegates to. - */ - ldapDAS.create( eDataGraph ); - - EDataGraph newEDataGraph = - ldapDAS.read( userEClass, "1" ); - - EDataObject rootObject = - ( EDataObject ) newEDataGraph.getRootObject(); - - assertEquals( - rootObject.eGet( userNameEAttribute), - "ole"); - - EDataObject configurationObject = - ( EDataObject ) - rootObject.eGet( userConfigurationEReference ); - - assertEquals( - configurationObject.eGet( configurationIDEAttribute), - "5"); - - } - - public void testUpdate() throws NamingException, Exception - { - /* - * More exhaustive testing has been done on the - * class that LdapDAS.update() delegates to. - */ - ldapDAS.create( eDataGraph ); - - EDataGraph newEDataGraph = ldapDAS.read( userEClass, "1" ); - - - //newEDataGraph.getChangeSummary().beginLogging(); - EChangeSummary eChangeSummary = ( EChangeSummary ) newEDataGraph.getChangeSummary(); - eChangeSummary.beginLogging(); - - EDataObject rootObject = - ( EDataObject ) newEDataGraph.getRootObject(); - - rootObject.eSet( userNameEAttribute, "Brooke" ); - rootObject.eSet( userAgeEAttribute, 5 ); - - //newEDataGraph.getChangeSummary().endLogging(); - - eChangeSummary.endLogging(); - ldapDAS.update( newEDataGraph ); - - LdapContext rootContext = ldapDAS.getContext(). - getXsdNamespaceToLdapContextMap(). - get( - rootObject. - eClass(). - getEPackage(). - getNsURI()); - - Attributes attributes = - rootContext. - getAttributes( - "example-com-users-accounts-User-id=1" ); - - assertEquals( - attributes.get("example-com-users-accounts-User-userAge").get(), - "5"); - - assertEquals( - attributes.get("example-com-users-accounts-User-userName").get(), - "Brooke"); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/update/test/EDataGraphUpdateTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/update/test/EDataGraphUpdateTest.java deleted file mode 100644 index d76ccccac0..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/update/test/EDataGraphUpdateTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.emf.update.test; - -import java.util.Hashtable; - -import javax.naming.NamingException; -import javax.naming.directory.Attributes; - -import org.apache.tuscany.das.ldap.emf.read.EDataGraphReader; -import org.apache.tuscany.das.ldap.emf.update.EDataGraphUpdater; -import org.apache.tuscany.das.ldap.prototype.setup.test.EDataGraphSetupTest; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.sdo.EChangeSummary; -import org.eclipse.emf.ecore.sdo.EDataObject; - -public class EDataGraphUpdateTest -extends EDataGraphSetupTest -{ - public void testUpdate() throws NamingException - { - dataObjectToRelativeDNCache = - new Hashtable(); - - eDataGraph = - EDataGraphReader.read( - userEClass, - "1", - rootContext, - dataObjectToRelativeDNCache); - - assertTrue( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject1RDN)); - assertTrue( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject2RDN)); - - userDataObject = - (EDataObject) eDataGraph.getRootObject(); - - String userEntryRDN = dataObjectToRelativeDNCache.get(userDataObject); - Attributes attributes = rootContext.getAttributes(userEntryRDN); - - assertEquals(userDataObject.eGet(userNameEAttribute), "ole"); - assertEquals(userDataObject.eGet(userPasswordEAttribute), "secret"); - assertEquals(userDataObject.eGet(userAgeEAttribute), 33); - assertEquals(userDataObject.eGet(userHeightEAttribute), 6.11); - assertEquals(userDataObject.eGet(userIsMaleEAttribute), true); - assertEquals("2", attributes.get("example-com-users-accounts-User-authorizationList").get(0)); - assertEquals("3", attributes.get("example-com-users-accounts-User-authorizationList").get(1)); - - EChangeSummary eChangeSummary = - (EChangeSummary) eDataGraph.getChangeSummary(); - - eChangeSummary.beginLogging(); - - userDataObject.eSet(userIsMaleEAttribute, false); - userDataObject.eSet(userHeightEAttribute, 2.00); - userDataObject.eSet(userAgeEAttribute, 80); - userDataObject.eSet(userPasswordEAttribute, "totallysecret"); - - EList userAuthorizationReferenceList = - (EList)userDataObject - .eGet(userAuthorizationEReference); - - userAuthorizationReferenceList.remove(0); - - assertEquals(userDataObject.eGet(userIsMaleEAttribute), false); - assertEquals(userDataObject.eGet(userHeightEAttribute), 2.00); - assertEquals(userDataObject.eGet(userAgeEAttribute), 80); - assertEquals(userDataObject.eGet(userPasswordEAttribute), "totallysecret"); - - eChangeSummary.endLogging(); - - EDataGraphUpdater.update( - eDataGraph, - rootContext, - dataObjectToRelativeDNCache); - - attributes = rootContext.getAttributes(userEntryRDN); - - assertEquals("FALSE", attributes.get("example-com-users-accounts-User-isMale").get()); - assertEquals("2.0", attributes.get("example-com-users-accounts-User-userHeight").get()); - assertEquals("80", attributes.get("example-com-users-accounts-User-userAge").get()); - assertEquals("totallysecret", attributes.get("example-com-users-accounts-User-userPassword").get()); - assertEquals("5", attributes.get("example-com-users-accounts-User-configuration").get()); - - /* - * Test that the ID of the Authorization instance with id 2 was removed - */ - assertEquals( - "3", - attributes. - get("example-com-users-accounts-User-authorizationList"). - get(0)); - - /* - * Also make sure that the dataObjectToRelativeDNCache was updated - */ - assertFalse( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject1RDN)); - - eChangeSummary.beginLogging(); - - userDataObject.eUnset(userConfigurationEReference); - userAuthorizationReferenceList.remove(0); - - eChangeSummary.endLogging(); - - EDataGraphUpdater.update( - eDataGraph, - rootContext, - dataObjectToRelativeDNCache); - - attributes = rootContext.getAttributes(userEntryRDN); - - boolean isConfigurationAttributeDeleted = false; - - try { - attributes.get("example-com-users-accounts-User-configuration").get(); - } - catch (Exception e) - { - isConfigurationAttributeDeleted = true; - } - assertTrue(isConfigurationAttributeDeleted); - - boolean isAuthorizationlListAttributeDeleted = false; - - try { - attributes.get("example-com-users-accounts-User-authorizationList").get(); - } - catch (Exception e) - { - isAuthorizationlListAttributeDeleted = true; - } - assertTrue(isAuthorizationlListAttributeDeleted); - assertFalse( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject2RDN)); - - eChangeSummary.beginLogging(); - - userAuthorizationReferenceList.add(authorizationDataObject0); - userAuthorizationReferenceList.add(authorizationDataObject1); - - eChangeSummary.endLogging(); - - EDataGraphUpdater.update( - eDataGraph, - rootContext, - dataObjectToRelativeDNCache); - - assertTrue( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject1RDN)); - assertTrue( - dataObjectToRelativeDNCache. - containsValue(authorizationDataObject2RDN)); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java deleted file mode 100644 index ce603e17f0..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.tuscany.das.ldap.learning.test; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.directory.BasicAttribute; -import javax.naming.directory.BasicAttributes; -import javax.naming.directory.SearchResult; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -public class LearningTest extends AbstractTestSetup { - - public void testSearch() throws NamingException - { - LdapContext contextL0 = - (LdapContext) - dasPartitionContext.createSubcontext("cn=L0"); - - contextL0.createSubcontext("cn=L1"); - - Attributes searchAttributes = - new BasicAttributes(true); - - searchAttributes.put(new BasicAttribute("cn")); - - NamingEnumeration answer = contextL0.search("", searchAttributes); - while (answer.hasMore()) { - - SearchResult result = (SearchResult)answer.next(); - Attributes attributes = result.getAttributes(); - assertEquals("L1", attributes.get("cn").get().toString()); - } - dasPartitionContext.destroySubcontext("cn=L1, cn=L0"); - dasPartitionContext.destroySubcontext("cn=L0"); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java deleted file mode 100644 index c52a9ede1c..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EAttributeTypeCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaContextsSetup; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; - -public class EAttributeTypeCreatorTest -extends EcoreSchemaContextsSetup -{ - private static final String namespaceURI = - "http://org.apache.tuscany/datatypes"; - - private static EcoreFactory ecoreFactory = - EcoreFactory.eINSTANCE; - - private static EcorePackage ecorePackage = - EcorePackage.eINSTANCE; - - private static EAttribute eAttribute = - ecoreFactory.createEAttribute(); - - private static String eAttributeName = - "ole"; - - private static DirContext eAttributeEntryContext = - null; - - public void setUp() throws NamingException, Exception - { - super.setUp(); - } - - public void tearDown() throws NamingException, Exception - { - EStructuralFeatureTypeDestroyer. - destroy( - ecoreAttributeTypesContext, - eAttribute, - TUSCANY_OID_PREFIX_VALUE); - - super.tearDown(); - } - - public void testCreate() throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(namespaceURI); - - EClass eContainingClass = - ecoreFactory. - createEClass(); - - String eContainingClassName = - eContainingClass.getName(); - - ePackage. - getEClassifiers(). - add( eContainingClass ); - - eContainingClass. - getEStructuralFeatures(). - add(eAttribute); - - eAttribute. - setName(eAttributeName); - - eAttribute. - setEType(ecorePackage.getEString()); - - EAttributeTypeCreator - eAttributeTypeCreator = - new EAttributeTypeCreator(); - - eAttributeTypeCreator. - create( - ecoreAttributeTypesContext, - eAttribute, - TUSCANY_OID_PREFIX_VALUE ); - - String rdn = - SimpleTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - namespaceURI, - eContainingClassName, - eAttributeName); - - eAttributeEntryContext = - ( DirContext ) - ecoreAttributeTypesContext. - lookup( rdn ); - - assertNotNull(eAttributeEntryContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java deleted file mode 100644 index 056658b3c1..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreatorHelper; -import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASContextSetup; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EcoreFactory; - -public class EObjectClassCreatorHelperTest -extends DASContextSetup -{ - private static EcoreFactory ecoreFactory = - EcoreFactory.eINSTANCE; - - private EClass eClassL0 = - null; - - private EClass eClassL1 = - null; - - public void setUp() - throws NamingException, Exception - { - super.setUp(); - - eClassL0 = - ecoreFactory. - createEClass(); - eClassL0.setName( "L0" ); - - eClassL1 = - ecoreFactory. - createEClass(); - eClassL1.setName( "L1" ); - - eClassL1. - getESuperTypes(). - add(eClassL0); - } - - public void testCreateInheritanceMetaData() - throws NamingException - { - EObjectClassCreatorHelper. - createInheritanceMetaData( - metaContext, - eClassL1 ); - - DirContext parentContext = - ( DirContext ) - metaContext. - lookup( "cn=" + eClassL0.getName() ); - - assertNotNull(parentContext); - - DirContext childContext = - ( DirContext ) - parentContext. - lookup( "cn=" + eClassL1.getName() ); - - assertNotNull(childContext); - - parentContext.destroySubcontext( - "cn=" + eClassL1.getName() ); - - metaContext.destroySubcontext( - "cn=" + eClassL0.getName() ); - } - - public void testGetEClassParent() - { - EClass eClassParent = - null; - - eClassParent = - EcoreTypeSystemHelper. - getEClassParent(eClassL1); - - assertSame(eClassL0, eClassParent); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java deleted file mode 100644 index 9ef6f6e086..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create.test; - -import java.util.ArrayList; -import java.util.List; - -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.directory.Attributes; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; - -public class EObjectClassCreatorTest -extends EcoreSchemaAndDASContextsSetup -{ - boolean isObjectClassL0Created = false; - boolean isObjectClassL1Created = false; - - public void tearDown() - throws NamingException, Exception - { - if (isObjectClassL1Created) - { - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - TUSCANY_OID_PREFIX_VALUE ); - - metaContext. - destroySubcontext( - "cn="+eClassL0.getName() ); - } - - if (isObjectClassL0Created) - { - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - TUSCANY_OID_PREFIX_VALUE ); - } - - super.tearDown(); - } - - public void setUp() - throws NamingException, Exception - { - super.setUp(); - - ecoreFactory = - EcoreFactory.eINSTANCE; - ecorePackage = - EcorePackage.eINSTANCE; - - processedEClassifiers = - new ArrayList(); - - eClassL0 = - ecoreFactory.createEClass(); - - eClassL1 = - ecoreFactory.createEClass(); - - eClassL0.setName( "L0" ); - eClassL1.setName( "L1" ); - - isObjectClassL0Created = false; - isObjectClassL1Created = false; - - } - - /* - * Tests that eClassL0 and eClassL1 are both - * created an the corresponding entries exist - * in the meta section of the model. - */ - public void testCreate0() - throws NamingException, Exception - { - eClassL1. - getESuperTypes(). - add(eClassL0); - - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - assertNotNull( - eObjectClassL0EntryContext); - - isObjectClassL0Created = true; - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL1EntryContext); - - isObjectClassL1Created = true; - } - - /* - * Test that eClassL0 is added to the list - * of processed eClassifiers and that the - * corresponding ObjectClass is created. - * - * Also test the employeeNameEAttribute - * and departmentEReferences are added. - */ - public void testCreate1() - throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - - EAttribute employeeNameEAttribute = - ecoreFactory.createEAttribute(); - employeeNameEAttribute.setName( - "employeeName" ); - employeeNameEAttribute.setEType( - ecorePackage.getEString() ); - - eClassL0. - getEStructuralFeatures(). - add(employeeNameEAttribute); - - EReference departmentEReference = - ecoreFactory.createEReference(); - departmentEReference.setName( "department" ); - departmentEReference.setEType( eClassL0 ); - - eClassL0. - getEStructuralFeatures(). - add(departmentEReference); - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - assertTrue(processedEClassifiers.contains( eClassL0 )); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - assertNotNull( - eObjectClassL0EntryContext); - - isObjectClassL0Created = true; - - Attributes attributes = - eObjectClassL0EntryContext.getAttributes( "" ); - - NamingEnumeration namingEnumeration = - attributes.get( M_MAY ).getAll(); - - boolean hasDepartmentValue = - false; - boolean hasEmployeeNameValue = - false; - - String departmentValue = - "example-com-users-accounts-L0-department"; - - String employeeNameValue = - "example-com-users-accounts-L0-employeeName"; - - - while (namingEnumeration.hasMore()) - { - String attributeValue = - namingEnumeration.next().toString(); - if (departmentValue.equals(attributeValue)) - { - hasDepartmentValue = true; - } - if (employeeNameValue.equals(attributeValue)) - { - hasEmployeeNameValue = true; - } - } - assertTrue(hasDepartmentValue); - assertTrue(hasEmployeeNameValue); - } - - /* - * Test that both ObjectClasses are created - * when eClassL1 inherits from eClassL0, - * but eClass0's ObjectClass entry - * is already created. - */ - public void testCreate3() - throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - isObjectClassL0Created = true; - - eClassL1. - getESuperTypes(). - add(eClassL0); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - assertNotNull( - eObjectClassL0EntryContext); - - isObjectClassL0Created = true; - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL1EntryContext); - - isObjectClassL1Created = true; - } - - private static EcoreFactory ecoreFactory = - null; - - private static EcorePackage ecorePackage = - null; - - private static EClass eClassL0 = - null; - - private static EClass eClassL1 = - null; - - - private static List - processedEClassifiers = - null; - - private static LdapContext - eObjectClassL0EntryContext = - null; - - private static LdapContext - eObjectClassL1EntryContext = - null; - - private static LdapContext - eClassL0MetaContext = - null; - - private static LdapContext - eClassL1MetaContext = - null; - } \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java deleted file mode 100644 index c316231c99..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.create.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EReferenceTypeCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaContextsSetup; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcoreFactory; - -public class EReferenceTypeCreatorTest -extends EcoreSchemaContextsSetup -{ - private static final String namespaceURI = - "http://org.apache.tuscany/datatypes"; - - private static EcoreFactory ecoreFactory = - EcoreFactory.eINSTANCE; - - private static EReference eReference = - ecoreFactory.createEReference(); - - private static String eReferenceName = - "ole"; - - private static DirContext eReferenceEntryContext = - null; - - public void setUp() - throws NamingException, Exception - { - super.setUp(); - } - - public void tearDown() - throws NamingException, Exception - { - EStructuralFeatureTypeDestroyer. - destroy( - ecoreAttributeTypesContext, - eReference, - TUSCANY_OID_PREFIX_VALUE); - - super.tearDown(); - } - - public void testCreate() throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(namespaceURI); - - EClass eContainingClass = - ecoreFactory. - createEClass(); - - String eContainingClassName = - eContainingClass.getName(); - - ePackage. - getEClassifiers(). - add( eContainingClass ); - - eContainingClass. - getEStructuralFeatures(). - add(eReference); - - eReference. - setName(eReferenceName); - - eReference. - setEType(eContainingClass); - - EReferenceTypeCreator - eReferenceTypeCreator = - new EReferenceTypeCreator(); - - eReferenceTypeCreator. - create( - ecoreAttributeTypesContext, - eReference, - TUSCANY_OID_PREFIX_VALUE ); - - String rdn = - SimpleTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - namespaceURI, - eContainingClassName, - eReferenceName); - - eReferenceEntryContext = - ( DirContext ) - ecoreAttributeTypesContext. - lookup( rdn ); - - assertNotNull(eReferenceEntryContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java deleted file mode 100644 index 02ffe54627..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.das.ldap.schema.emf.create.test; - -import java.util.Stack; - -import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EcoreFactory; - -import junit.framework.TestCase; - -public class EcoreTypeSystemCreatorHelperTest -extends TestCase -{ - EcoreFactory ecoreFactory = - EcoreFactory.eINSTANCE; - - public void testLoadParentEClassifierStack() - { - EClass eClassL0 = - ecoreFactory.createEClass(); - - EClass eClassL1 = - ecoreFactory.createEClass(); - - EClass eClassL2 = - ecoreFactory.createEClass(); - - eClassL2.getESuperTypes().add(eClassL1); - - eClassL1.getESuperTypes().add(eClassL0); - - Stack testStack = - EcoreTypeSystemHelper. - loadParentEClassifierStack( - eClassL2, - null); - - assertEquals(testStack.size(), 2); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java deleted file mode 100644 index 9de0d189ba..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.destroy.test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.ECascadingObjectClassDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; - -/* - * TODO Make sure that we test EAttribute deletion as well. - */ -public class ECascadingObjectClassDestroyerTest -extends EcoreSchemaAndDASContextsSetup -{ - public void tearDown() - throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() - throws NamingException, Exception - { - super.setUp(); - - ecoreFactory = - EcoreFactory.eINSTANCE; - ecorePackage = - EcorePackage.eINSTANCE; - - processedEClassifiers = - new ArrayList(); - - eClassL0 = - ecoreFactory. - createEClass(); - - eClassL1 = - ecoreFactory. - createEClass(); - - eClassL0.setName( "L0" ); - eClassL1.setName( "L1" ); - - eClassNameToEClassMap = - new HashMap(); - - eClassNameToEClassMap.put( - eClassL0.getName(), - eClassL0 ); - - eClassNameToEClassMap.put( - eClassL1.getName(), - eClassL1 ); - - } - - /* - * Test the deletion of two - * single level hierarchy ObjectClasses - */ - public void testCreate1() - throws NamingException, Exception - { - eClassL1. - getESuperTypes(). - add(eClassL0); - - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL0EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - eObjectClassL1EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL0EntryContext); - - assertNotNull( - eObjectClassL1EntryContext); - - eClassL0MetaContext = - ( DirContext ) - metaContext. - lookup( - "cn=" + eClassL0.getName() ); - - assertNotNull( - eClassL0MetaContext ); - - eClassL1MetaContext = - ( DirContext ) - eClassL0MetaContext. - lookup( - "cn=" + eClassL1.getName() ); - - assertNotNull( - eClassL0MetaContext ); - - assertNotNull( - eClassL1MetaContext ); - - - ECascadingObjectClassDestroyer. - destroy( - eClassNameToEClassMap, - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - TUSCANY_OID_PREFIX_VALUE ); - - try - { - eObjectClassL0EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - } - catch (Exception e) - { - eObjectClassL0EntryContext = - null; - } - - try - { - eObjectClassL1EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - } - catch (Exception e) - { - eObjectClassL1EntryContext = - null; - } - - assertNull( - eObjectClassL0EntryContext); - - assertNull( - eObjectClassL1EntryContext); - - try - { - eClassL0MetaContext = - ( DirContext ) - metaContext. - lookup( - "cn=" + eClassL0.getName() ); - - } - catch (Exception e) - { - assertNotNull( - eClassL0MetaContext ); - } - } - - - private static EcoreFactory ecoreFactory = - null; - - private static EcorePackage ecorePackage = - null; - - private static EClass eClassL0 = - null; - - private static EClass eClassL1 = - null; - - private static List - processedEClassifiers = - null; - - private static DirContext - eObjectClassL0EntryContext = - null; - - private static DirContext - eObjectClassL1EntryContext = - null; - - private static DirContext - eClassL0MetaContext = - null; - - private static DirContext - eClassL1MetaContext = - null; - - private Map eClassNameToEClassMap = - null; - - /* - * Test the deletion of two - * single level hierarchy ObjectClasses - */ - public void testCreate0() - throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL0EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - eObjectClassL1EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL0EntryContext); - - assertNotNull( - eObjectClassL1EntryContext); - - ECascadingObjectClassDestroyer. - destroy( - eClassNameToEClassMap, - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - TUSCANY_OID_PREFIX_VALUE ); - - ECascadingObjectClassDestroyer. - destroy( - eClassNameToEClassMap, - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - TUSCANY_OID_PREFIX_VALUE ); - try - { - eObjectClassL0EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - } - catch (Exception e) - { - eObjectClassL0EntryContext = - null; - } - - try - { - eObjectClassL1EntryContext = - ( DirContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - } - catch (Exception e) - { - eObjectClassL1EntryContext = - null; - } - - assertNull( - eObjectClassL0EntryContext); - - assertNull( - eObjectClassL1EntryContext); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java deleted file mode 100644 index 8370eaff52..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.schema.emf.destroy.test; - -import java.util.ArrayList; -import java.util.List; - -import javax.naming.NamingException; -import javax.naming.ldap.LdapContext; - -import org.apache.tuscany.das.ldap.prototype.setup.Prototype; -import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator; -import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator; -import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer; -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; - -/* - * TODO Make sure that we test EAttribute deletion as well. - */ -public class EObjectClassDestroyerTest -extends EcoreSchemaAndDASContextsSetup -implements Prototype -{ - public void tearDown() - throws NamingException, Exception - { - super.tearDown(); - } - - public void setUp() - throws NamingException, Exception - { - super.setUp(); - - ecoreFactory = - EcoreFactory.eINSTANCE; - ecorePackage = - EcorePackage.eINSTANCE; - - - processedEClassifiers = - new ArrayList(); - - eClassL0 = - ecoreFactory. - createEClass(); - - eClassL1 = - ecoreFactory. - createEClass(); - - eClassL0.setName( "L0" ); - eClassL1.setName( "L1" ); - } - - /* - * Test the deletion of two - * single level hierarchy ObjectClasses - */ - public void testDestroy0() - throws NamingException, Exception - { - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL0EntryContext); - - assertNotNull( - eObjectClassL1EntryContext); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - TUSCANY_OID_PREFIX_VALUE ); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - TUSCANY_OID_PREFIX_VALUE ); - - try - { - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - } - catch (Exception e) - { - eObjectClassL0EntryContext = - null; - } - - try - { - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - } - catch (Exception e) - { - eObjectClassL1EntryContext = - null; - } - - assertNull( - eObjectClassL0EntryContext); - - assertNull( - eObjectClassL1EntryContext); - } - - /* - * Testt the deletion of two - * ObjectClasses where L1 inherits from - * L0 - */ - - public void testDestroy1() - throws NamingException, Exception - { - eClassL1. - getESuperTypes(). - add(eClassL0); - - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( eClassL0 ); - - ePackage. - getEClassifiers(). - add( eClassL1 ); - - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL0.getName()); - - String rdnL1 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - eClassL1.getName()); - - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - - assertNotNull( - eObjectClassL0EntryContext); - - assertNotNull( - eObjectClassL1EntryContext); - - eClassL0MetaContext = - ( LdapContext ) - metaContext. - lookup( - "cn=" + eClassL0.getName() ); - - assertNotNull( - eClassL0MetaContext ); - - eClassL1MetaContext = - ( LdapContext ) - eClassL0MetaContext. - lookup( - "cn=" + eClassL1.getName() ); - - assertNotNull( - eClassL0MetaContext ); - - assertNotNull( - eClassL1MetaContext ); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL1, - TUSCANY_OID_PREFIX_VALUE ); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - eClassL0, - TUSCANY_OID_PREFIX_VALUE ); - - try - { - eObjectClassL0EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL0 ); - } - catch (Exception e) - { - eObjectClassL0EntryContext = - null; - } - - try - { - eObjectClassL1EntryContext = - ( LdapContext ) - ecoreObjectClassesContext. - lookup( rdnL1 ); - } - catch (Exception e) - { - eObjectClassL1EntryContext = - null; - } - - assertNull( - eObjectClassL0EntryContext); - - assertNull( - eObjectClassL1EntryContext); - - - eClassL0MetaContext = - ( LdapContext ) - metaContext. - lookup( - "cn=" + eClassL0.getName() ); - - assertNotNull( - eClassL0MetaContext ); - - try - { - eClassL1MetaContext = - ( LdapContext ) - eClassL0MetaContext. - lookup( - "cn=" + eClassL1.getName() ); - - } - catch (Exception e) - { - eClassL1MetaContext = - null; - } - - assertNull( - eClassL1MetaContext); - - metaContext. - destroySubcontext( - "cn=" + eClassL0.getName() ); - } - - /* - * Test the deletion of an ObjectClass that has - * has attributes. - */ - public void testDestroy2() throws NamingException, Exception - { - userEClass.getEStructuralFeatures().add(userIDEAttribute); - userEClass.getEStructuralFeatures().add(userNameEAttribute); - userEClass.getEStructuralFeatures().add(userPasswordEAttribute); - userEClass.getEStructuralFeatures().add(userAuthorizationEReference); - - EPackage ePackage = - ecoreFactory. - createEPackage(); - - ePackage. - setNsURI(xsdNamespace); - - ePackage. - getEClassifiers(). - add( userEClass ); - - EObjectClassCreator - eObjectClassCreator = - new EObjectClassCreator(); - - eObjectClassCreator. - create( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - userEClass, - processedEClassifiers, - TUSCANY_OID_PREFIX_VALUE ); - - String rdnL0 = - ComplexTypeRDNCreator. - create( - TUSCANY_OID_PREFIX_VALUE, - xsdNamespace, - userEClass.getName()); - - EObjectClassDestroyer. - destroy( - metaContext, - ecoreAttributeTypesContext, - ecoreObjectClassesContext, - userEClass, - TUSCANY_OID_PREFIX_VALUE ); - } - - private static EcoreFactory ecoreFactory = - null; - - private static EcorePackage ecorePackage = - null; - - private static EClass eClassL0 = - null; - - private static EClass eClassL1 = - null; - - private static List - processedEClassifiers = - null; - - private static LdapContext - eObjectClassL0EntryContext = - null; - - private static LdapContext - eObjectClassL1EntryContext = - null; - - private static LdapContext - eClassL0MetaContext = - null; - - private static LdapContext - eClassL1MetaContext = - null; -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/JNDIUtilTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/JNDIUtilTest.java deleted file mode 100644 index a962484c8d..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/JNDIUtilTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.tuscany.das.ldap.util.test; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; - -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; -import org.apache.tuscany.das.ldap.util.JNDIUtil; - -/* - * Note that these tests rely on the ADS Partition - * ou=system, which is also the directoryContext - * that the tests start with. - */ -public class JNDIUtilTest -extends AbstractTestSetup -{ - DirContext test1Context = null; - DirContext test2Context = null; - DirContext test3Context = null; - - public void setUp() throws Exception - { - super.setUp(); - test1Context = - ( DirContext ) - dasPartitionContext. - createSubcontext( "cn=test1" ); - - test2Context = - ( DirContext ) - test1Context. - createSubcontext( "cn=test2" ); - - test3Context = - ( DirContext ) - test2Context. - createSubcontext( "cn=test3" ); - } - - public void tearDown() throws Exception - { - test2Context.destroySubcontext( "cn=test3" ); - test1Context.destroySubcontext("cn=test2"); - dasPartitionContext.destroySubcontext("cn=test1"); - super.tearDown(); - } - - public void testCalculateParentRelativeDN() throws NamingException - { - String partitionDN = "ou=das"; - - String testA = - JNDIUtil.calculateParentRelativeDN( - test2Context, partitionDN ); - - String testB = - JNDIUtil.calculateParentRelativeDN( - test3Context, partitionDN ); - - String testC = - JNDIUtil.calculateParentRelativeDN( test1Context, partitionDN ); - - assertTrue(testA.equals( "cn=test1" )); - assertTrue(testB.equals( "cn=test2,cn=test1" )); - assertTrue(testC.equals( "ou=das" )); - - } - - public void testCalculateDNComponents() throws NamingException - { - String[] contextComponents = JNDIUtil.calculateDNComponents( test3Context ); - assertTrue(contextComponents.length==4); - - contextComponents = null; - - contextComponents = JNDIUtil.calculateDNComponents( test3Context.getNameInNamespace() ); - assertTrue(contextComponents.length==4); - } - - public void testGetParentContext() throws NamingException - { - DirContext parentContext = - JNDIUtil. - getParentContext( - test3Context, - dasPartitionContext ); - - assertTrue( - parentContext.getNameInNamespace(). - equals("cn=test2,cn=test1,ou=das")); - - parentContext = - JNDIUtil.getParentContext( - test1Context, - dasPartitionContext ); - - assertTrue( - parentContext.getNameInNamespace(). - equals("ou=das")); - - parentContext = - JNDIUtil. - getParentContext( - dasPartitionContext, - dasPartitionContext ); - - assertTrue(null == parentContext); - } -} diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/QualifiedNameNormalizerTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/QualifiedNameNormalizerTest.java deleted file mode 100644 index 30b37dee91..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/QualifiedNameNormalizerTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.tuscany.das.ldap.util.test; - -import org.apache.tuscany.das.ldap.util.QualifiedNameNormalizer; - -import junit.framework.TestCase; - -public class QualifiedNameNormalizerTest -extends TestCase -{ - public void testNormalize() - { - String qualifiedName = - "http://example.com/users/accounts/L0"; - - String normalizedName = - QualifiedNameNormalizer. - normalize(qualifiedName); - - assertEquals( - "example-com-users-accounts-L0", - normalizedName); - } -} \ No newline at end of file diff --git a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/XSDNamespaceURITokenizerTest.java b/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/XSDNamespaceURITokenizerTest.java deleted file mode 100644 index 708eae7920..0000000000 --- a/java/das/ldap/das.ldap/src/test/java/org/apache/tuscany/das/ldap/util/test/XSDNamespaceURITokenizerTest.java +++ /dev/null @@ -1,36 +0,0 @@ - -package org.apache.tuscany.das.ldap.util.test; - -import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; - -import org.apache.tuscany.das.ldap.util.XSDNamespaceURITokenizer; -import org.eclipse.emf.common.util.URI; - -public class XSDNamespaceURITokenizerTest -extends AbstractTestSetup -{ - public void testCreateAuthorityTokens() - { - String[] authorityTokens = - XSDNamespaceURITokenizer. - createAuthorityTokens( - URI.createURI(xsdNamespace)); - - assertTrue(authorityTokens[0].equals( "example")); - assertTrue(authorityTokens[1].equals( "com")); - assertTrue(authorityTokens.length == 2); - } - - public void testCreatePathTokens() - { - String[] pathTokens = - XSDNamespaceURITokenizer. - createPathTokens( - URI.createURI(xsdNamespace)); - - assertTrue(pathTokens[1].equals("users")); - assertTrue(pathTokens[2].equals("accounts")); - assertTrue(pathTokens.length == 3); - } - -} diff --git a/java/das/ldap/das.ldap/src/test/resources/log4j.properties b/java/das/ldap/das.ldap/src/test/resources/log4j.properties deleted file mode 100644 index 75e557ac3b..0000000000 --- a/java/das/ldap/das.ldap/src/test/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootCategory=ERROR, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n - diff --git a/java/das/ldap/pom.xml b/java/das/ldap/pom.xml deleted file mode 100644 index b6c1b72723..0000000000 --- a/java/das/ldap/pom.xml +++ /dev/null @@ -1,270 +0,0 @@ - - - 4.0.0 - - org.apache.tuscany.das - tuscany-das - 1.0-SNAPSHOT - - tuscany-das-ldap - 1.0-SNAPSHOT - pom - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - - - - junit - junit - 3.8.1 - compile - - - - - org.eclipse.emf - ant - 2.3.0 - - - - org.eclipse.emf - codegen - 2.3.0 - - - - org.eclipse.emf - codegen-ecore - 2.3.0 - - - - org.eclipse.emf - codegen-ecore-ui - 2.3.0 - - - - org.eclipse.emf - codegen-ui - 2.3.0 - - - - org.eclipse.emf - common - 2.3.0 - - - - org.eclipse.emf - commonj-sdo - 2.3.0 - - - - org.eclipse.emf - common-ui - 2.3.0 - - - - org.eclipse.emf - converter - 2.3.0 - - - - org.eclipse.emf - ecore - 2.3.0 - - - - org.eclipse.emf - ecore-change - 2.3.0 - - - - org.eclipse.emf - ecore-change-edit - 2.3.0 - - - - org.eclipse.emf - ecore-edit - 2.3.0 - - - - org.eclipse.emf - ecore-sdo - 2.3.0 - - - - org.eclipse.emf - ecore-sdo-edit - 2.3.0 - - - - org.eclipse.emf - ecore-xmi - 2.3.0 - - - - org.eclipse.emf - edit - 2.3.0 - - - - org.eclipse.emf - edit-ui - 2.3.0 - - - - org.eclipse.emf - emf - 2.3.0 - - - - org.eclipse.emf - exporter - 2.3.0 - - - - org.eclipse.emf - importer - 2.3.0 - - - - org.eclipse.emf - importer-ecore - 2.3.0 - - - - org.eclipse.emf - importer-java - 2.3.0 - - - - org.eclipse.emf - importer-rose - 2.3.0 - - - - org.eclipse.emf - mapping - 2.3.0 - - - - org.eclipse.emf - mapping-ecore2ecore - 2.3.0 - - - - org.eclipse.emf - mapping-ecore2ecore-editor - 2.3.0 - - - - org.eclipse.emf - mapping-ecore2xml - 2.3.0 - - - - org.eclipse.emf - mapping-ecore2xml-ui - 2.3.0 - - - - org.eclipse.emf - mapping-ui - 2.3.0 - - - - org.eclipse.emf - mapping-xsd2ecore - 2.3.0 - - - - org.eclipse.emf - mapping-xsd2ecore-editor - 2.3.0 - - - - org.eclipse.xsd - ecore-exporter - 2.3.0 - - - - org.eclipse.xsd - ecore-importer - 2.3.0 - - - - org.eclipse.xsd - edit - 2.3.0 - - - - org.eclipse.xsd - xsd - 2.3.0 - - - - - - - - emf-maven-mirror - - http://mirrors.cat.pdx.edu/eclipse/tools/emf/maven2/ - - - - - - das.ldap - das.ldap.constants - das.ldap.configuration.model.v100 - das.ldap.configuration.model.ecore.v100 - - -- cgit v1.2.3