You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by jc...@apache.org on 2007/01/29 21:38:29 UTC
svn commit: r501176 [1/6] - in
/directory/sandbox/jconlon/osgi-services/configuration-service: ./ src/
src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/configuration/
src/main/java/org/apache/configuration/...
Author: jconlon
Date: Mon Jan 29 12:38:25 2007
New Revision: 501176
URL: http://svn.apache.org/viewvc?view=rev&rev=501176
Log:
OSGi Configuration Admin project.
Added:
directory/sandbox/jconlon/osgi-services/configuration-service/
directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/JndiConfigurationDaoNotifierImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/KeyMapper.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ListCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/SimpleDirContextAdapter.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/SimpleReadCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/UpdateCommand.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/AsyncExecutorService.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ConfigurationChangeManager.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ConfigurationEventBroadcaster.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceFactoryTrackerCustomizer.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceFactoryTrackingAdapter.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceTrackerCustomizer.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceTrackingAdapter.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/PluginManager.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/FilterImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/StringMap.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationAdminServiceFactory.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationStore.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationStoreImpl.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationTransformer.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/BundleContextFactory.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/ServiceTracking.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/ServiceTrackingAdapter.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/package-info.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/configuration-osgi.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/configuration.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/daoJndi.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/event.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/ConfigurationAdminImplTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/ConfigurationImplTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoIntegrationTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/MockInitialContextFactory.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationChangeIntegrationTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationChangeTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationNotifier.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockConfigurationDaoListener.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockConfigurationListener.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockManagedServiceFactoryTrackingDelegate.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockManagedServiceTrackingDelegate.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml
directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml
Added: directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml Mon Jan 29 12:38:25 2007
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.directory.osgi.services</groupId>
+ <artifactId>build</artifactId>
+ <version>1.0.6-SNAPSHOT</version>
+ </parent>
+
+ <description>
+ An OSGi Bundle offering an implementation of the OSGi ConfigAdmin Service.
+ </description>
+ <artifactId>configuration-service</artifactId>
+ <version>0.4.0</version>
+ <packaging>bundle</packaging>
+ <name>${pom.artifactId} bundle</name>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.osgi.service.cm</Export-Package>
+ <Private-Package>org.apache.configuration.*,org.apache.felix.framework.util.ldap</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+
+
+ <!-- For the OSGi interfaces. -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>0.9.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <!-- For the FilterImpl class. -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>0.9.0-incubator-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- To be removed.
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.servicebinder</artifactId>
+ <version>0.8.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>-->
+
+
+
+
+
+
+ <!-- To be replaced with logback -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <version>1.2.25</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xerces</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jdmk</groupId>
+ <artifactId>jmxtools</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.jmx</groupId>
+ <artifactId>jmxri</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>checkstyle</groupId>
+ <artifactId>checkstyle</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Will replace logging with these deps.
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-mock</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-mock</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-dao</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-core</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.configuration.dao;
+
+
+import java.util.List;
+
+import org.apache.configuration.impl.ConfigurationDictionary;
+
+/**
+ *
+ * ConfigurationDao.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConfigurationDao extends ConfigurationDaoNotifier
+{
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#create(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ public String create( ConfigurationDictionary configurationDictionary );
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#findByPrimaryKey(java.lang.String)
+ */
+ public ConfigurationDictionary read( String pid );
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#update(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ void update( ConfigurationDictionary configurationDictionary );
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#delete(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ public void delete( ConfigurationDictionary configurationDictionary );
+
+ /**
+ *
+ *
+ *
+ * @return list of {@link ConfigurationDictionary} or an empty list.
+ */
+ public List<ConfigurationDictionary> findAll();
+
+}
\ No newline at end of file
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.configuration.dao;
+
+/**
+ * Signals that a failure occured during a data access operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConfigurationDaoException extends RuntimeException
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2227350478329832413L;
+
+
+ /**
+ * Creates a new instance of ConfigurationDaoException.
+ *
+ */
+ public ConfigurationDaoException()
+ {
+
+ }
+
+
+ /**
+ * Creates a new instance of ConfigurationDaoException.
+ *
+ * @param message
+ */
+ public ConfigurationDaoException( String message )
+ {
+ super( message );
+
+ }
+
+
+ /**
+ * Creates a new instance of ConfigurationDaoException.
+ *
+ * @param cause
+ */
+ public ConfigurationDaoException( Throwable cause )
+ {
+ super( cause );
+
+ }
+
+
+ /**
+ * Creates a new instance of ConfigurationDaoException.
+ *
+ * @param message
+ * @param cause
+ */
+ public ConfigurationDaoException( String message, Throwable cause )
+ {
+ super( message, cause );
+
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.configuration.dao;
+
+import org.apache.configuration.impl.ConfigurationDictionary;
+
+/**
+ *
+ * ConfigurationDaoListener listens to configuration changes on a ConfigurationDao.
+ *
+ *
+ * @see ConfigurationDao
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConfigurationDaoListener
+{
+ /**
+ * ChangeType.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum ChangeType { CREATED, DELETED, UPDATED }
+
+ /**
+ *
+ * ConfigurationDictionary in the persisted store has changed.
+ *
+ * @see ConfigurationDao
+ * @param changeType that occured on the persisted configurationDictionary
+ * @param configurationDictionary that changed
+ */
+ public void configurationChanged( ChangeType changeType, ConfigurationDictionary configurationDictionary );
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.configuration.dao;
+
+
+/**
+ *
+ * ConfigurationDaoNotifier notifies ConfigurationDaoListeners of changes to the DAOs.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ConfigurationDaoNotifier
+{
+ void setConfigurationListener( ConfigurationDaoListener configurationListener );
+
+ public void removeConfigurationListener();
+
+}
\ No newline at end of file
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.configuration.dao.jndi;
+
+import javax.naming.directory.DirContext;
+
+/**
+ * Command is a command object that provides a specific directory service functionality.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface Command <T>
+{
+ /**
+ *
+ * execute the command
+ *
+ * @param dirContext
+ * @return results
+ */
+ T execute(DirContext dirContext);
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.configuration.dao.jndi;
+
+/**
+ * CommandProcessing is a processor of <code>Command</code>s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface CommandProcessing
+{
+
+ /**
+ *
+ * @param <T> type of result
+ * @param dirCommand to process
+ * @return result
+ */
+ <T> T submit(Command<T> dirCommand);
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.configuration.dao.jndi;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+
+import org.apache.configuration.impl.ConfigurationDictionary;
+
+/**
+ *
+ * ContextMapping.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ContextMapping extends KeyMapping
+{
+ /**
+ *
+ */
+ public static final String APACHEDS_SERVICE_PID = "apacheservicepid";
+ public static final String APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS = "apacheServiceConfiguration";
+
+
+
+ DirContext transform(ConfigurationDictionary configurationDictionary);
+
+ ConfigurationDictionary transform( Attributes atts )throws NamingException;
+
+ void addValueToAttribute(Object value,Attribute attribute );
+
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.configuration.dao.jndi;
+
+import javax.naming.event.NamespaceChangeListener;
+import javax.naming.event.ObjectChangeListener;
+
+import org.apache.configuration.dao.ConfigurationDaoNotifier;
+
+/**
+ * JndiConfigurationDaoNotifier listens to JNDI events and notifies ConfigurationDaoListeners
+ * of changes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface JndiConfigurationDaoNotifier extends ConfigurationDaoNotifier,
+ NamespaceChangeListener, ObjectChangeListener
+{
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.configuration.dao.jndi;
+
+import java.util.Dictionary;
+
+/**
+ * KeyMapping.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface KeyMapping
+{
+
+ /**
+ *
+ * ChangeType a dictionary from the directory format to an OSGi configuration.
+ * @param directoryDictionary
+ */
+
+ public void translateDirctoryKeysToOsgiKeys(Dictionary directoryDictionary) ;
+
+
+ /**
+ *
+ * ChangeType a OSGi configuration to a dictionary suitable for the directory.
+ *
+ * @param configurationDictionary
+ */
+ public void translateOsgiKeysToDirectoryKeys(Dictionary configurationDictionary) ;
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,94 @@
+/*
+ * 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.configuration.dao.jndi;
+
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+import javax.naming.ldap.LdapName;
+
+import org.apache.configuration.impl.ConfigurationDictionary;
+
+/**
+ * NameMapping creates a name from a given object.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface NameMapping
+{
+
+ /**
+ * APACHEDS_NAMIMG_KEY is the name of a ConfigurationAdmin properties key that
+ * specifies the distinguished ldap name to use for persisting a property. If
+ * it is missing from a configuration a default name will be choosen.
+ */
+ public static final String APACHEDS_NAMIMG_KEY ="apache.configuration.ldap.dn";
+
+
+ /**
+ *
+ * Add an APACHEDS_NAMIMG_KEY and value to the configurationDictionary if the name does not fit the default
+ * pattern.
+ *
+ * @param configurationDictionary
+ * @param name
+ */
+ public void addAlternateName(ConfigurationDictionary configurationDictionary, String name);
+ /**
+ *
+ * Creates a name for the given configurationDictionary. If the configurationDictionary
+ * contains a APACHEDS_NAMIMG_KEY it will be used for the name and then removed
+ * from the configurationDictioanry. If configurationDictionary does not contain
+ * the a APACHEDS_NAMIMG_KEY a default name will be created based on the value
+ * returned from the <code>getDefaultNamingBaseName<code> method.
+ *
+ * @param configurationDictionary
+ * @return name
+ */
+ Name getDistinguishedName(ConfigurationDictionary configurationDictionary);
+
+ /**
+ *
+ * get a Pid for the given configurationDictionary
+ *
+ * @param configurationDictionary
+ * @return
+ */
+ String getPid(ConfigurationDictionary configurationDictionary);
+
+ /**
+ *
+ * get a mutable name for the search base dn.
+ *
+ * @return Name of the baseDn
+ * @throws InvalidNameException
+ */
+ LdapName getSearchBaseName() throws InvalidNameException;
+
+ /**
+ *
+ * get a mutable name for the default naming dn.
+ *
+ * @return Name of the baseDn for creating default names.
+ * @throws InvalidNameException
+ */
+ LdapName getDefaultNamingBaseName() throws InvalidNameException;
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.spi.InitialContextFactory;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.jndi.Command;
+import org.apache.configuration.dao.jndi.CommandProcessing;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CommandProcessor that obtains a dirContext and closes a dirContext for every operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CommandProcessor implements CommandProcessing
+{
+ private static final Logger log = LoggerFactory.getLogger( CommandProcessor.class );
+ private final InitialContextFactory initialContextFactory;
+
+
+
+
+ /**
+ * Creates a new instance of CommandProcessor.
+ *
+ * @param initialContextFactory
+ */
+ public CommandProcessor( final InitialContextFactory initialContextFactory )
+ {
+ super();
+ this.initialContextFactory = initialContextFactory;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.jndi.CommandProcessing#submit(org.apache.configuration.dao.jndi.Command)
+ */
+ public <T> T submit( Command<T> dirCommand )
+ {
+ DirContext dirContext = null;
+ T results = null;
+ ConfigurationDaoException exception = null;
+ try
+ {
+ dirContext = (DirContext)initialContextFactory.getInitialContext( null );
+ if(dirContext == null){
+ throw new IllegalStateException("DirContext is null.");
+ }
+ }
+ catch ( NamingException e )
+ {
+ log.error( "Failed to retrieve a dirContext.",e );
+ throw new ConfigurationDaoException("Failed to retrieve a dirContext.",e);
+ }
+
+ try
+ {
+ results = dirCommand.execute( dirContext );
+ }
+ catch ( ConfigurationDaoException e )
+ {
+ exception= e;
+ }finally{
+ try
+ {
+ if(dirContext!=null){
+ dirContext.close();
+ }
+ }
+ catch ( NamingException e )
+ {
+ log.error( "Failed to close the dirContext.",e );
+ }
+ }
+ if(exception!=null){
+ throw exception;
+ }
+ return results;
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,169 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.configuration.dao.ConfigurationDao;
+import org.apache.configuration.dao.ConfigurationDaoListener;
+import org.apache.configuration.dao.ConfigurationDaoNotifier;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.dao.jndi.Command;
+import org.apache.configuration.dao.jndi.CommandProcessing;
+import org.apache.configuration.dao.jndi.NameMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * ConfigurationDaoImpl is a JNDI based ConfiguarationDao
+ *
+ * Consider extending org.springframework.dao.support.DaoSupport.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConfigurationDaoImpl implements ConfigurationDao
+{
+
+ private static final Logger log = LoggerFactory.getLogger( ConfigurationDaoImpl.class );
+ private static final String ALL_FILTER = "(objectclass="
+ + ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS + ")";
+
+ private ContextMapping contextMapping;
+ private NameMapping nameMapping;
+ private CommandProcessing commandProcessing;
+ private ConfigurationDaoNotifier configurationDaoNotifier;
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#create(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ public String create( ConfigurationDictionary configurationDictionary )
+ {
+ Command<String> createCommand = new CreateCommand( nameMapping, contextMapping, configurationDictionary.createCopy() );
+ return commandProcessing.submit( createCommand );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#read(java.lang.String)
+ */
+ public ConfigurationDictionary read( String pid )
+ {
+ if(pid ==null){
+ throw new IllegalArgumentException("pid argument cannot be null.");
+ }
+ Command<ConfigurationDictionary> readCommand = new DefaultReadCommand( nameMapping, contextMapping, pid );
+ return commandProcessing.submit( readCommand );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#update(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ public void update( ConfigurationDictionary configurationDictionary )
+ {
+ Command<Boolean> updateCommand = new UpdateCommand( nameMapping, contextMapping, configurationDictionary );
+ boolean updated = commandProcessing.submit( updateCommand );
+ if(!updated){
+ log.debug( "Create the initial configurationDictionary.");
+ create( configurationDictionary );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#delete(org.apache.configuration.util.ConfigurationDictionary)
+ */
+ public void delete( ConfigurationDictionary configurationDictionary )
+ {
+ Command<Void> deleteCommand = new DeleteCommand( nameMapping.getDistinguishedName( configurationDictionary ) );
+ commandProcessing.submit( deleteCommand );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDao#findAll()
+ */
+
+ public List<ConfigurationDictionary> findAll()
+ {
+ log.debug( "Listing all configuration entries." );
+ Command<List<ConfigurationDictionary>> listCommand = new ListCommand( ALL_FILTER, nameMapping,
+ contextMapping );
+ List<ConfigurationDictionary> results = commandProcessing.submit( listCommand );
+ if(results!=null){
+ return results;
+ }
+ return Collections.emptyList();
+ }
+
+
+ public void setContextMapping( ContextMapping contextMapping )
+ {
+ this.contextMapping = contextMapping;
+ }
+
+
+ public void setNameMapping( NameMapping nameMapping )
+ {
+ this.nameMapping = nameMapping;
+ }
+
+
+ public void setDirCommandProcessor( CommandProcessing commandProcessing )
+ {
+ this.commandProcessing = commandProcessing;
+ }
+
+
+ public void setConfigurationListener( ConfigurationDaoListener configurationListener )
+ {
+
+
+ configurationDaoNotifier.setConfigurationListener( configurationListener );
+
+ }
+
+
+ public void removeConfigurationListener()
+ {
+ configurationDaoNotifier.removeConfigurationListener();
+
+ }
+
+
+ public ConfigurationDaoNotifier getConfigurationDaoEventGenerator()
+ {
+ return configurationDaoNotifier;
+ }
+
+
+ public void setConfigurationDaoEventGenerator( ConfigurationDaoNotifier configurationDaoNotifier )
+ {
+ this.configurationDaoNotifier = configurationDaoNotifier;
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,166 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+
+import javax.naming.InvalidNameException;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.event.EventContext;
+import javax.naming.event.EventDirContext;
+import javax.naming.spi.InitialContextFactory;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.ConfigurationDaoListener;
+import org.apache.configuration.dao.ConfigurationDaoNotifier;
+import org.apache.configuration.dao.jndi.JndiConfigurationDaoNotifier;
+import org.apache.configuration.dao.jndi.NameMapping;
+
+
+/**
+ * ConfigurationDaoNotifierImpl notifies ConfigurationDaoListeners of changes to the
+ * JNDI store.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConfigurationDaoNotifierImpl implements ConfigurationDaoNotifier
+{
+
+ private JndiConfigurationDaoNotifier jndiConfigurationDaoNotifier;
+ private NameMapping nameMapping;
+ private InitialContextFactory initialContextFactory;
+
+ private EventDirContext eventDirContext = null;
+
+
+ /**
+ * Creates a new instance of ConfigurationDaoNotifierImpl.
+ *
+ */
+ public ConfigurationDaoNotifierImpl()
+ {
+ super();
+
+ }
+
+
+ /**
+ *
+ * setChangeListener to listen to configuration changes on the backend.
+ *
+ * @param listener
+ * @throws NamingException
+ */
+ public void setConfigurationListener( ConfigurationDaoListener configurationListener )
+ {
+ if ( jndiConfigurationDaoNotifier == null )
+ {
+ throw new IllegalStateException( "jndiConfigurationDaoNotifier cannot be null." );
+ }
+ jndiConfigurationDaoNotifier.setConfigurationListener( configurationListener );
+
+ try
+ {
+ if ( eventDirContext == null )
+ {
+ DirContext dirContext = (DirContext)initialContextFactory.getInitialContext( null );
+ eventDirContext =(EventDirContext) dirContext.lookup( "" );
+ }
+ eventDirContext.addNamingListener( nameMapping.getSearchBaseName(), EventContext.SUBTREE_SCOPE,
+ jndiConfigurationDaoNotifier );
+ }
+ catch ( InvalidNameException e )
+ {
+ throw new ConfigurationDaoException( "Could not create a eventDirContext to set a configurationListener.",
+ e );
+ }
+ catch ( NamingException e )
+ {
+ throw new ConfigurationDaoException( "Could not set a configurationListener with search base.", e );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.ConfigurationDaoNotifier#removeConfigurationListener()
+ */
+ public void removeConfigurationListener()
+ {
+ if ( jndiConfigurationDaoNotifier == null )
+ {
+ return;
+ }
+ else
+ {
+ jndiConfigurationDaoNotifier.removeConfigurationListener();
+ }
+ if ( eventDirContext != null )
+ {
+ try
+ {
+ eventDirContext.close();
+ }
+ catch ( NamingException e )
+ {
+ //ignore
+ }
+ finally
+ {
+ eventDirContext = null;
+ }
+
+ }
+
+ }
+
+
+ public JndiConfigurationDaoNotifier getConfigurationDaoNotifier()
+ {
+ return jndiConfigurationDaoNotifier;
+ }
+
+
+ public void setJndiConfigurationDaoNotifier(
+ JndiConfigurationDaoNotifier jndiConfigurationDaoNotifier )
+ {
+ this.jndiConfigurationDaoNotifier = jndiConfigurationDaoNotifier;
+ }
+
+
+ public void setNameMapping( NameMapping nameMapping )
+ {
+ this.nameMapping = nameMapping;
+ }
+
+
+ public InitialContextFactory getInitialContextFactory()
+ {
+ return initialContextFactory;
+ }
+
+
+ public void setInitialContextFactory( InitialContextFactory initialContextFactory )
+ {
+ this.initialContextFactory = initialContextFactory;
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,182 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.naming.NamingEnumeration;
+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.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.dao.jndi.KeyMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+
+/**
+ * ContextMapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ContextMapper implements ContextMapping
+{
+
+ private KeyMapping keyMapping;
+ /**
+ *
+ * Map a Configuration From Attributes.
+ *
+ * @param atts
+ * @return
+ */
+ public ConfigurationDictionary transform( Attributes atts ) throws NamingException
+ {
+ ConfigurationDictionary configurationDictionary = new ConfigurationDictionary();
+
+ NamingEnumeration<? extends Attribute> enumer = atts.getAll();
+ while ( enumer.hasMoreElements() )
+ {
+ Attribute attribute = enumer.nextElement();
+ addAttribute( attribute, configurationDictionary );
+
+ }
+ return configurationDictionary;
+ }
+
+ /**
+ *
+ * Map a configuration to a Context.
+ *
+ * @param configurationDictionary
+ * @param context
+ */
+ public DirContext transform( ConfigurationDictionary configurationDictionaryIn )
+ {
+ if(configurationDictionaryIn.get("objectclass" )==null){
+ throw new IllegalArgumentException("There was no objectclass properties defined.");
+ }
+ ConfigurationDictionary configurationDictionary = configurationDictionaryIn.createCopy();
+ SimpleDirContextAdapter context = new SimpleDirContextAdapter();
+ Enumeration keys = configurationDictionary.keys();
+ while ( keys.hasMoreElements() )
+ {
+ String key = (String)keys.nextElement();
+ Attribute attribute = new BasicAttribute(key);
+ Object value= configurationDictionary.get( key );
+ addValueToAttribute(value, attribute);
+ context.setAttribute( attribute );
+ }
+ return context;
+ }
+
+
+ /**
+ *
+ * Add an attribute as a value to a configurationDictionary
+ *
+ * @param configurationDictionary .
+ * @param attribute
+ * @throws NamingException
+ * @throws NamingException
+ */
+ private void addAttribute(Attribute attribute, ConfigurationDictionary configurationDictionary ) throws NamingException {
+ if(attribute.size( )>1){
+ Vector<Object> vector = new Vector<Object>(attribute.size( ));
+ NamingEnumeration<?> enumer = attribute.getAll();
+ while ( enumer.hasMoreElements() )
+ {
+ Object o = enumer.nextElement();
+ vector.add( o );
+
+ }
+ configurationDictionary.put( attribute.getID(), vector );
+ }else if (attribute.size( )==1) {
+ String key = attribute.getID();
+ Object value = attribute.get();
+ configurationDictionary.put( key, value );
+ }else{
+ throw new IllegalStateException("No attribute found for "+attribute);
+ }
+ }
+
+ /**
+ *
+ * Add a value as an attribute.
+ *
+ * @param value maybe an object, array of values, or a vector of values.
+ * @param attribute to add values to.
+ */
+ public void addValueToAttribute(Object value,Attribute attribute ){
+ if(value == null){
+ throw new IllegalArgumentException("Argument value cannot be null");
+ }
+ if(attribute == null){
+ throw new IllegalArgumentException("Argument attribute cannot be null");
+ }
+ if (value.getClass().isArray()){
+ addArray((Object[]) value, attribute);
+ }else if(value instanceof Vector){
+ addVector((Vector)value, attribute);
+ }else {
+ attribute.add(value);
+ }
+ }
+
+ private void addArray(Object[] value,Attribute attribute ){
+ for ( int i = 0; i < value.length; i++ )
+ {
+ attribute.add(value[i]);
+ }
+ }
+
+ private void addVector(Vector value,Attribute attribute ){
+ for ( Object object : value )
+ {
+ attribute.add(object);
+ }
+ }
+
+ public void translateDirctoryKeysToOsgiKeys( Dictionary directoryDictionary )
+ {
+ keyMapping.translateDirctoryKeysToOsgiKeys( directoryDictionary);
+
+ }
+
+ public void translateOsgiKeysToDirectoryKeys( Dictionary configurationDictionary )
+ {
+ keyMapping.translateOsgiKeysToDirectoryKeys( configurationDictionary);
+
+ }
+
+ public void setKeyMapping( KeyMapping keyMapping )
+ {
+ this.keyMapping = keyMapping;
+ }
+
+
+
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,106 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.jndi.Command;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.dao.jndi.NameMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CreateCommand.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CreateCommand implements Command<String>
+{
+ private static final Logger log = LoggerFactory.getLogger( CreateCommand.class );
+ private final ContextMapping contextMapping;
+ private final ConfigurationDictionary configurationDictionary;
+ private final String pid;
+ private final Name name;
+
+ /**
+ * Creates a new instance of CreateCommand.
+ *
+ */
+ public CreateCommand(NameMapping nameMapping, ContextMapping contextMapping, ConfigurationDictionary configurationDictionary)
+ {
+ this.contextMapping=contextMapping;
+ this.configurationDictionary=configurationDictionary.createCopy();
+ this.pid = nameMapping.getPid( this.configurationDictionary );
+ this.name = nameMapping.getDistinguishedName( this.configurationDictionary ) ;
+ modifyConfiguration( this.configurationDictionary);
+
+ if(pid==null){
+ throw new IllegalArgumentException( " could not find a Pid in "+configurationDictionary);
+ }
+ if(name==null){
+ throw new IllegalArgumentException( " could not find a DistinguishedName in "+configurationDictionary);
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.jndi.Command#execute(javax.naming.directory.DirContext)
+ */
+ public String execute( DirContext dirContext )
+ {
+ DirContext obj = createDirContext();
+
+ try
+ {
+ dirContext.bind( name, obj );
+ }
+ catch ( NamingException e )
+ {
+ log.error( "Failed to create an entry "+configurationDictionary+" named "+name,e );
+ throw new ConfigurationDaoException("Failed to execute the create. ",e);
+ }
+ log.debug( "Created an entry for {} with DN [{}].",configurationDictionary, name );
+ return pid;
+ }
+
+
+
+
+ private void modifyConfiguration(ConfigurationDictionary configurationDictionary)
+ {
+ contextMapping.translateOsgiKeysToDirectoryKeys( configurationDictionary);
+ }
+
+ private DirContext createDirContext(){
+ DirContext result= contextMapping.transform( configurationDictionary );
+ if(result==null){
+ throw new IllegalStateException("Could not transform the configuration Dictionary "+configurationDictionary);
+ }
+ return result;
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,141 @@
+package org.apache.configuration.dao.jndi.impl;
+
+
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+import javax.naming.ldap.LdapName;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.dao.jndi.NameMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.osgi.framework.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DefaultNameMapper implements NameMapping
+{
+
+ /** the log for this class */
+ private static final Logger log = LoggerFactory.getLogger( DefaultNameMapper.class );
+
+ private String searchBase;
+
+ private String defaultNamingBase;
+
+
+ /**
+ *
+ * Creates a name for the given configurationDictionary. If the configurationDictionary
+ * contains a APACHEDS_NAMIMG_KEY it will be used for the name and then removed
+ * from the configurationDictioanry. If configurationDictionary does not contain
+ * the a APACHEDS_NAMIMG_KEY a default name will be created based on the value
+ * returned from the <code>getDefaultNamingBaseName<code> method.
+ *
+ * @param configurationDictionary
+ * @return name
+ */
+ public Name getDistinguishedName( ConfigurationDictionary configurationDictionary )
+ {
+ Object nameObject = configurationDictionary.remove( APACHEDS_NAMIMG_KEY );
+ if ( nameObject == null )
+ {
+ String pid = getPid( configurationDictionary );
+ return getDefaultedDistinguishedName( pid );
+ }
+
+ String explicitName = (String) nameObject;
+ try
+ {
+ log.debug("Found explicitNaming Object {} ",nameObject);
+ return new LdapName( explicitName );
+ }
+ catch ( InvalidNameException e )
+ {
+ throw new ConfigurationDaoException( "Could not form a distinguished Name from " + explicitName,e );
+ }
+ }
+
+
+ public String getPid( ConfigurationDictionary configurationDictionary )
+ {
+ if ( configurationDictionary.get( Constants.SERVICE_PID ) != null )
+ {
+ return ( String ) configurationDictionary.get( Constants.SERVICE_PID );
+ }
+ else if ( configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID ) != null )
+ {
+ return ( String ) configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID );
+ }
+ throw new IllegalArgumentException( "Could not determine the service pid." );
+ }
+
+
+ public LdapName getSearchBaseName() throws InvalidNameException
+ {
+ return new LdapName( searchBase );
+ }
+
+
+ public LdapName getDefaultNamingBaseName() throws InvalidNameException
+ {
+
+ return new LdapName( defaultNamingBase );
+ }
+
+
+ public void setSearchBase( String searchBase )
+ {
+ this.searchBase = searchBase;
+ }
+
+
+ public void setDefaultNamingBase( String defaultNamingBase )
+ {
+ this.defaultNamingBase = defaultNamingBase;
+ }
+
+
+ private Name getDefaultedDistinguishedName( String pid )
+ {
+
+ LdapName dn;
+ try
+ {
+ dn = getDefaultNamingBaseName();
+ dn.add( ContextMapping.APACHEDS_SERVICE_PID + '=' + pid );
+ }
+ catch ( InvalidNameException e )
+ {
+ throw new ConfigurationDaoException( "Invalid Name " + pid + ' ' + e.toString() );
+ }
+
+ return dn;
+ }
+
+
+ /**
+ *
+ * Add an APACHEDS_NAMIMG_KEY and value to the configurationDictionary if the name does not fit the default
+ * pattern.
+ *
+ * @param configurationDictionary
+ * @param name
+ */
+ public void addAlternateName( ConfigurationDictionary configurationDictionary, String name )
+ {
+ String pid = (String) configurationDictionary.get(ContextMapping.APACHEDS_SERVICE_PID);
+ Name lName = getDefaultedDistinguishedName( pid );
+
+ if(lName.toString().equals( name )){
+ log.debug( "{} of entry equals the default name {}.",name,lName.toString());
+ }else{
+ log.debug( "{} of entry does not equals the default name {}.",name,lName.toString());
+ configurationDictionary.put( APACHEDS_NAMIMG_KEY, name );
+ }
+
+ }
+
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+
+import java.util.List;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.directory.DirContext;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.jndi.ContextMapping;
+import org.apache.configuration.dao.jndi.Command;
+import org.apache.configuration.dao.jndi.NameMapping;
+import org.apache.configuration.impl.ConfigurationDictionary;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * DefaultReadCommand delegates to a search based lookup to
+ * read a configurationDictionary from the directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DefaultReadCommand implements Command<ConfigurationDictionary>
+{
+
+ private static final Logger log = LoggerFactory.getLogger( DefaultReadCommand.class );
+ private final Command<List<ConfigurationDictionary>> delegate;
+ public static final String FILTER_PART_ONE = "(&(objectclass="
+ + ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS + ") (" + ContextMapping.APACHEDS_SERVICE_PID + "=";
+ private final String pid;
+
+
+ /**
+ * Creates a new instance of SimpleReadCommand.
+ *
+ */
+ public DefaultReadCommand( NameMapping nameMapping, ContextMapping contextMapping, String pid )
+ {
+ if(pid==null){
+ throw new IllegalArgumentException("pid argument cannot be null.");
+ }
+ this.pid = pid;
+ String filter = FILTER_PART_ONE + pid + "))";
+
+ this.delegate = new ListCommand( filter, nameMapping, contextMapping );
+
+ }
+
+
+ /**
+ *
+ * execute delegates to a search based lookup to find the pid.
+ *
+ * @param dirContext
+ * @return
+ */
+ public ConfigurationDictionary execute( DirContext dirContext )
+ {
+ try
+ {
+ List<ConfigurationDictionary> list = delegate.execute( dirContext );
+ if ( list==null || list.isEmpty() )
+ {
+ ConfigurationDaoException e = new ConfigurationDaoException(
+ "Search for pid:" + pid + " returned no entries.", new NameNotFoundException() );
+ throw e;
+ }
+ else if ( list.size() > 1 )
+ {
+ throw new ConfigurationDaoException( "Primary Key Integrity Failure. Search for " + pid + " returned "
+ + list.size() + " entries." );
+ }
+ return list.get(0);
+ }
+ catch ( ConfigurationDaoException e )
+ {
+ log.error( pid + " could not be read with a delegated search.", e );
+ throw e;
+ }
+
+ }
+
+}
Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java?view=auto&rev=501176
==============================================================================
--- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java (added)
+++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java Mon Jan 29 12:38:25 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.configuration.dao.jndi.impl;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.configuration.dao.ConfigurationDaoException;
+import org.apache.configuration.dao.jndi.Command;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * DeleteCommand deletes a configurationDictionary from the directory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteCommand implements Command<Void>
+{
+
+ private static final Logger log = LoggerFactory.getLogger( DeleteCommand.class );
+ private final Name name;
+ /**
+ * Creates a new instance of SimpleReadCommand.
+ *
+ */
+ public DeleteCommand(Name name)
+ {
+ this.name=name;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.configuration.dao.jndi.Command#execute(javax.naming.directory.DirContext)
+ */
+ public Void execute( DirContext dirContext )
+ {
+
+ try
+ {
+ dirContext.destroySubcontext( name );
+ }
+ catch ( NamingException e )
+ {
+ log.error( name+" could not be read.",e );
+ throw new ConfigurationDaoException(name+" could not be deleted.", e);
+ }
+
+
+ return null;
+ }
+
+
+
+}
Re: svn commit: r501176 [1/6] - in /directory/sandbox/jconlon/osgi-services/configuration-service:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/configuration/ src/main/java/org/apache/configuration/...
Posted by "John E. Conlon" <jc...@verticon.com>.
Hi Alex,
Modified the pom.xml by adding the reporting plugin: maven-javadoc-plugin.
Is that what you meant?
cheers,
John
Alex Karasulu wrote:
>
> Just a reminder. It might be nice to add some Javadocs so we can
> navigate this code especially when it makes it's way into the trunk.
>
Re: svn commit: r501176 [1/6] - in /directory/sandbox/jconlon/osgi-services/configuration-service:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/configuration/ src/main/java/org/apache/configuration/...
Posted by Alex Karasulu <ak...@apache.org>.
Hi John,
Just a reminder. It might be nice to add some Javadocs so we can
navigate this code especially when it makes it's way into the trunk.
Thanks,
Alex
jconlon@apache.org wrote:
> Author: jconlon
> Date: Mon Jan 29 12:38:25 2007
> New Revision: 501176
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=501176
> Log:
> OSGi Configuration Admin project.
>
> Added:
> directory/sandbox/jconlon/osgi-services/configuration-service/
> directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/JndiConfigurationDaoNotifierImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/KeyMapper.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ListCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/SimpleDirContextAdapter.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/SimpleReadCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/UpdateCommand.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/AsyncExecutorService.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ConfigurationChangeManager.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ConfigurationEventBroadcaster.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceFactoryTrackerCustomizer.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceFactoryTrackingAdapter.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceTrackerCustomizer.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/ManagedServiceTrackingAdapter.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/PluginManager.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/event/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/FilterImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/StringMap.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/felix/framework/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationAdminImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationAdminServiceFactory.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationDictionary.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationStore.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationStoreImpl.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/ConfigurationTransformer.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/impl/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/BundleContextFactory.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/ServiceTracking.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/ServiceTrackingAdapter.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/springosgi/package-info.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/configuration-osgi.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/configuration.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/daoJndi.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/main/resources/META-INF/spring/event.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/ConfigurationAdminImplTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/ConfigurationImplTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoIntegrationTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/dao/jndi/impl/MockInitialContextFactory.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationChangeIntegrationTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationChangeTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/ConfigurationNotifier.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockConfigurationDaoListener.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockConfigurationListener.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockManagedServiceFactoryTrackingDelegate.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/MockManagedServiceTrackingDelegate.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/event/RegistrationChangeIntegrationTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/ConfigurationStoreImplTest.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/impl/MockConfigurationTransformer.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/java/org/apache/configuration/util/ApacheDSUtil.java
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/event.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/log4j.properties
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/logback.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockBundleContextFactory.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockConfigurationDaoEventListener.xml
> directory/sandbox/jconlon/osgi-services/configuration-service/src/test/resources/mockInitialContextFactory.xml
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/pom.xml Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,207 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> + <modelVersion>4.0.0</modelVersion>
> + <parent>
> + <groupId>org.apache.directory.osgi.services</groupId>
> + <artifactId>build</artifactId>
> + <version>1.0.6-SNAPSHOT</version>
> + </parent>
> +
> + <description>
> + An OSGi Bundle offering an implementation of the OSGi ConfigAdmin Service.
> + </description>
> + <artifactId>configuration-service</artifactId>
> + <version>0.4.0</version>
> + <packaging>bundle</packaging>
> + <name>${pom.artifactId} bundle</name>
> + <build>
> + <plugins>
> +
> + <plugin>
> + <groupId>org.apache.maven.plugins</groupId>
> + <artifactId>maven-compiler-plugin</artifactId>
> + <configuration>
> + <source>1.5</source>
> + <target>1.5</target>
> + </configuration>
> + </plugin>
> +
> + <plugin>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>maven-bundle-plugin</artifactId>
> + <extensions>true</extensions>
> + <configuration>
> + <instructions>
> + <Export-Package>org.osgi.service.cm</Export-Package>
> + <Private-Package>org.apache.configuration.*,org.apache.felix.framework.util.ldap</Private-Package>
> + </instructions>
> + </configuration>
> + </plugin>
> + </plugins>
> + </build>
> + <dependencies>
> +
> +
> +
> + <!-- For the OSGi interfaces. -->
> + <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.osgi.compendium</artifactId>
> + <version>0.9.0-incubator-SNAPSHOT</version>
> + </dependency>
> +
> + <!-- For the FilterImpl class. -->
> + <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.framework</artifactId>
> + <version>0.9.0-incubator-SNAPSHOT</version>
> + </dependency>
> +
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-osgi-core</artifactId>
> + <version>1.0-SNAPSHOT</version>
> + <scope>provided</scope>
> + </dependency>
> +
> + <dependency>
> + <groupId>commons-lang</groupId>
> + <artifactId>commons-lang</artifactId>
> + <version>2.1</version>
> + <scope>provided</scope>
> + </dependency>
> +
> + <dependency>
> + <groupId>commons-collections</groupId>
> + <artifactId>commons-collections</artifactId>
> + <version>3.2</version>
> + <scope>provided</scope>
> + </dependency>
> +
> + <!-- To be removed.
> + <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.servicebinder</artifactId>
> + <version>0.8.0-SNAPSHOT</version>
> + <scope>provided</scope>
> + </dependency>-->
> +
> +
> +
> +
> +
> +
> + <!-- To be replaced with logback -->
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>nlog4j</artifactId>
> + <version>1.2.25</version>
> + <scope>provided</scope>
> + <exclusions>
> + <exclusion>
> + <groupId>xerces</groupId>
> + <artifactId>xerces</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>com.sun.jdmk</groupId>
> + <artifactId>jmxtools</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>javax.jms</groupId>
> + <artifactId>jms</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>javax.mail</groupId>
> + <artifactId>mail</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>javax.activation</groupId>
> + <artifactId>activation</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>com.sun.jmx</groupId>
> + <artifactId>jmxri</artifactId>
> + </exclusion>
> + <exclusion>
> + <groupId>checkstyle</groupId>
> + <artifactId>checkstyle</artifactId>
> + </exclusion>
> + </exclusions>
> + </dependency>
> +
> +
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>jcl104-over-slf4j</artifactId>
> + <version>1.2</version>
> + <scope>test</scope>
> + </dependency>
> +
> + <!-- Will replace logging with these deps.
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>slf4j-api</artifactId>
> + <version>1.2</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>ch.qos.logback</groupId>
> + <artifactId>logback-core</artifactId>
> + <version>0.9-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>ch.qos.logback</groupId>
> + <artifactId>logback-classic</artifactId>
> + <version>0.9-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + -->
> +
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-mock</artifactId>
> + <version>2.1-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> +
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-osgi-mock</artifactId>
> + <version>1.0-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> +
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-core</artifactId>
> + <version>2.1-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-context</artifactId>
> + <version>2.1-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-beans</artifactId>
> + <version>2.1-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.springframework.osgi</groupId>
> + <artifactId>spring-dao</artifactId>
> + <version>2.1-SNAPSHOT</version>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.directory.server</groupId>
> + <artifactId>apacheds-core</artifactId>
> + <version>1.0.0</version>
> + <scope>test</scope>
> + </dependency>
> +
> + </dependencies>
> +</project>
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDao.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,67 @@
> +/*
> + * 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.configuration.dao;
> +
> +
> +import java.util.List;
> +
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +
> +/**
> + *
> + * ConfigurationDao.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDao extends ConfigurationDaoNotifier
> +{
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#create(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + public String create( ConfigurationDictionary configurationDictionary );
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#findByPrimaryKey(java.lang.String)
> + */
> + public ConfigurationDictionary read( String pid );
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#update(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + void update( ConfigurationDictionary configurationDictionary );
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#delete(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + public void delete( ConfigurationDictionary configurationDictionary );
> +
> + /**
> + *
> + *
> + *
> + * @return list of {@link ConfigurationDictionary} or an empty list.
> + */
> + public List<ConfigurationDictionary> findAll();
> +
> +}
> \ No newline at end of file
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoException.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,84 @@
> +/*
> + * 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.configuration.dao;
> +
> +/**
> + * Signals that a failure occured during a data access operation.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ConfigurationDaoException extends RuntimeException
> +{
> +
> + /**
> + *
> + */
> + private static final long serialVersionUID = -2227350478329832413L;
> +
> +
> + /**
> + * Creates a new instance of ConfigurationDaoException.
> + *
> + */
> + public ConfigurationDaoException()
> + {
> +
> + }
> +
> +
> + /**
> + * Creates a new instance of ConfigurationDaoException.
> + *
> + * @param message
> + */
> + public ConfigurationDaoException( String message )
> + {
> + super( message );
> +
> + }
> +
> +
> + /**
> + * Creates a new instance of ConfigurationDaoException.
> + *
> + * @param cause
> + */
> + public ConfigurationDaoException( Throwable cause )
> + {
> + super( cause );
> +
> + }
> +
> +
> + /**
> + * Creates a new instance of ConfigurationDaoException.
> + *
> + * @param message
> + * @param cause
> + */
> + public ConfigurationDaoException( String message, Throwable cause )
> + {
> + super( message, cause );
> +
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoListener.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,50 @@
> +/*
> + * Copyright 2005 The Apache Software Foundation
> + *
> + * Licensed 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.configuration.dao;
> +
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +
> +/**
> + *
> + * ConfigurationDaoListener listens to configuration changes on a ConfigurationDao.
> + *
> + *
> + * @see ConfigurationDao
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDaoListener
> +{
> + /**
> + * ChangeType.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> + public enum ChangeType { CREATED, DELETED, UPDATED }
> +
> + /**
> + *
> + * ConfigurationDictionary in the persisted store has changed.
> + *
> + * @see ConfigurationDao
> + * @param changeType that occured on the persisted configurationDictionary
> + * @param configurationDictionary that changed
> + */
> + public void configurationChanged( ChangeType changeType, ConfigurationDictionary configurationDictionary );
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,36 @@
> +/*
> + * 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.configuration.dao;
> +
> +
> +/**
> + *
> + * ConfigurationDaoNotifier notifies ConfigurationDaoListeners of changes to the DAOs.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDaoNotifier
> +{
> + void setConfigurationListener( ConfigurationDaoListener configurationListener );
> +
> + public void removeConfigurationListener();
> +
> +}
> \ No newline at end of file
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/Command.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,41 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +import javax.naming.directory.DirContext;
> +
> +/**
> + * Command is a command object that provides a specific directory service functionality.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface Command <T>
> +{
> + /**
> + *
> + * execute the command
> + *
> + * @param dirContext
> + * @return results
> + */
> + T execute(DirContext dirContext);
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/CommandProcessing.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,39 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +/**
> + * CommandProcessing is a processor of <code>Command</code>s.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface CommandProcessing
> +{
> +
> + /**
> + *
> + * @param <T> type of result
> + * @param dirCommand to process
> + * @return result
> + */
> + <T> T submit(Command<T> dirCommand);
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/ContextMapping.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,53 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +import javax.naming.NamingException;
> +import javax.naming.directory.Attribute;
> +import javax.naming.directory.Attributes;
> +import javax.naming.directory.DirContext;
> +
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +
> +/**
> + *
> + * ContextMapping.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ContextMapping extends KeyMapping
> +{
> + /**
> + *
> + */
> + public static final String APACHEDS_SERVICE_PID = "apacheservicepid";
> + public static final String APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS = "apacheServiceConfiguration";
> +
> +
> +
> + DirContext transform(ConfigurationDictionary configurationDictionary);
> +
> + ConfigurationDictionary transform( Attributes atts )throws NamingException;
> +
> + void addValueToAttribute(Object value,Attribute attribute );
> +
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,39 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +import javax.naming.event.NamespaceChangeListener;
> +import javax.naming.event.ObjectChangeListener;
> +
> +import org.apache.configuration.dao.ConfigurationDaoNotifier;
> +
> +/**
> + * JndiConfigurationDaoNotifier listens to JNDI events and notifies ConfigurationDaoListeners
> + * of changes.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface JndiConfigurationDaoNotifier extends ConfigurationDaoNotifier,
> + NamespaceChangeListener, ObjectChangeListener
> +{
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/KeyMapping.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,50 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +import java.util.Dictionary;
> +
> +/**
> + * KeyMapping.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface KeyMapping
> +{
> +
> + /**
> + *
> + * ChangeType a dictionary from the directory format to an OSGi configuration.
> + * @param directoryDictionary
> + */
> +
> + public void translateDirctoryKeysToOsgiKeys(Dictionary directoryDictionary) ;
> +
> +
> + /**
> + *
> + * ChangeType a OSGi configuration to a dictionary suitable for the directory.
> + *
> + * @param configurationDictionary
> + */
> + public void translateOsgiKeysToDirectoryKeys(Dictionary configurationDictionary) ;
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/NameMapping.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,94 @@
> +/*
> + * 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.configuration.dao.jndi;
> +
> +import javax.naming.InvalidNameException;
> +import javax.naming.Name;
> +import javax.naming.ldap.LdapName;
> +
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +
> +/**
> + * NameMapping creates a name from a given object.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface NameMapping
> +{
> +
> + /**
> + * APACHEDS_NAMIMG_KEY is the name of a ConfigurationAdmin properties key that
> + * specifies the distinguished ldap name to use for persisting a property. If
> + * it is missing from a configuration a default name will be choosen.
> + */
> + public static final String APACHEDS_NAMIMG_KEY ="apache.configuration.ldap.dn";
> +
> +
> + /**
> + *
> + * Add an APACHEDS_NAMIMG_KEY and value to the configurationDictionary if the name does not fit the default
> + * pattern.
> + *
> + * @param configurationDictionary
> + * @param name
> + */
> + public void addAlternateName(ConfigurationDictionary configurationDictionary, String name);
> + /**
> + *
> + * Creates a name for the given configurationDictionary. If the configurationDictionary
> + * contains a APACHEDS_NAMIMG_KEY it will be used for the name and then removed
> + * from the configurationDictioanry. If configurationDictionary does not contain
> + * the a APACHEDS_NAMIMG_KEY a default name will be created based on the value
> + * returned from the <code>getDefaultNamingBaseName<code> method.
> + *
> + * @param configurationDictionary
> + * @return name
> + */
> + Name getDistinguishedName(ConfigurationDictionary configurationDictionary);
> +
> + /**
> + *
> + * get a Pid for the given configurationDictionary
> + *
> + * @param configurationDictionary
> + * @return
> + */
> + String getPid(ConfigurationDictionary configurationDictionary);
> +
> + /**
> + *
> + * get a mutable name for the search base dn.
> + *
> + * @return Name of the baseDn
> + * @throws InvalidNameException
> + */
> + LdapName getSearchBaseName() throws InvalidNameException;
> +
> + /**
> + *
> + * get a mutable name for the default naming dn.
> + *
> + * @return Name of the baseDn for creating default names.
> + * @throws InvalidNameException
> + */
> + LdapName getDefaultNamingBaseName() throws InvalidNameException;
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,105 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +import javax.naming.NamingException;
> +import javax.naming.directory.DirContext;
> +import javax.naming.spi.InitialContextFactory;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.jndi.Command;
> +import org.apache.configuration.dao.jndi.CommandProcessing;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +/**
> + * CommandProcessor that obtains a dirContext and closes a dirContext for every operation.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class CommandProcessor implements CommandProcessing
> +{
> + private static final Logger log = LoggerFactory.getLogger( CommandProcessor.class );
> + private final InitialContextFactory initialContextFactory;
> +
> +
> +
> +
> + /**
> + * Creates a new instance of CommandProcessor.
> + *
> + * @param initialContextFactory
> + */
> + public CommandProcessor( final InitialContextFactory initialContextFactory )
> + {
> + super();
> + this.initialContextFactory = initialContextFactory;
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.jndi.CommandProcessing#submit(org.apache.configuration.dao.jndi.Command)
> + */
> + public <T> T submit( Command<T> dirCommand )
> + {
> + DirContext dirContext = null;
> + T results = null;
> + ConfigurationDaoException exception = null;
> + try
> + {
> + dirContext = (DirContext)initialContextFactory.getInitialContext( null );
> + if(dirContext == null){
> + throw new IllegalStateException("DirContext is null.");
> + }
> + }
> + catch ( NamingException e )
> + {
> + log.error( "Failed to retrieve a dirContext.",e );
> + throw new ConfigurationDaoException("Failed to retrieve a dirContext.",e);
> + }
> +
> + try
> + {
> + results = dirCommand.execute( dirContext );
> + }
> + catch ( ConfigurationDaoException e )
> + {
> + exception= e;
> + }finally{
> + try
> + {
> + if(dirContext!=null){
> + dirContext.close();
> + }
> + }
> + catch ( NamingException e )
> + {
> + log.error( "Failed to close the dirContext.",e );
> + }
> + }
> + if(exception!=null){
> + throw exception;
> + }
> + return results;
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,169 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +
> +import java.util.Collections;
> +import java.util.List;
> +
> +import org.apache.configuration.dao.ConfigurationDao;
> +import org.apache.configuration.dao.ConfigurationDaoListener;
> +import org.apache.configuration.dao.ConfigurationDaoNotifier;
> +import org.apache.configuration.dao.jndi.ContextMapping;
> +import org.apache.configuration.dao.jndi.Command;
> +import org.apache.configuration.dao.jndi.CommandProcessing;
> +import org.apache.configuration.dao.jndi.NameMapping;
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +
> +/**
> + * ConfigurationDaoImpl is a JNDI based ConfiguarationDao
> + *
> + * Consider extending org.springframework.dao.support.DaoSupport.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ConfigurationDaoImpl implements ConfigurationDao
> +{
> +
> + private static final Logger log = LoggerFactory.getLogger( ConfigurationDaoImpl.class );
> + private static final String ALL_FILTER = "(objectclass="
> + + ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS + ")";
> +
> + private ContextMapping contextMapping;
> + private NameMapping nameMapping;
> + private CommandProcessing commandProcessing;
> + private ConfigurationDaoNotifier configurationDaoNotifier;
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#create(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + public String create( ConfigurationDictionary configurationDictionary )
> + {
> + Command<String> createCommand = new CreateCommand( nameMapping, contextMapping, configurationDictionary.createCopy() );
> + return commandProcessing.submit( createCommand );
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#read(java.lang.String)
> + */
> + public ConfigurationDictionary read( String pid )
> + {
> + if(pid ==null){
> + throw new IllegalArgumentException("pid argument cannot be null.");
> + }
> + Command<ConfigurationDictionary> readCommand = new DefaultReadCommand( nameMapping, contextMapping, pid );
> + return commandProcessing.submit( readCommand );
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#update(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + public void update( ConfigurationDictionary configurationDictionary )
> + {
> + Command<Boolean> updateCommand = new UpdateCommand( nameMapping, contextMapping, configurationDictionary );
> + boolean updated = commandProcessing.submit( updateCommand );
> + if(!updated){
> + log.debug( "Create the initial configurationDictionary.");
> + create( configurationDictionary );
> + }
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#delete(org.apache.configuration.util.ConfigurationDictionary)
> + */
> + public void delete( ConfigurationDictionary configurationDictionary )
> + {
> + Command<Void> deleteCommand = new DeleteCommand( nameMapping.getDistinguishedName( configurationDictionary ) );
> + commandProcessing.submit( deleteCommand );
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDao#findAll()
> + */
> +
> + public List<ConfigurationDictionary> findAll()
> + {
> + log.debug( "Listing all configuration entries." );
> + Command<List<ConfigurationDictionary>> listCommand = new ListCommand( ALL_FILTER, nameMapping,
> + contextMapping );
> + List<ConfigurationDictionary> results = commandProcessing.submit( listCommand );
> + if(results!=null){
> + return results;
> + }
> + return Collections.emptyList();
> + }
> +
> +
> + public void setContextMapping( ContextMapping contextMapping )
> + {
> + this.contextMapping = contextMapping;
> + }
> +
> +
> + public void setNameMapping( NameMapping nameMapping )
> + {
> + this.nameMapping = nameMapping;
> + }
> +
> +
> + public void setDirCommandProcessor( CommandProcessing commandProcessing )
> + {
> + this.commandProcessing = commandProcessing;
> + }
> +
> +
> + public void setConfigurationListener( ConfigurationDaoListener configurationListener )
> + {
> +
> +
> + configurationDaoNotifier.setConfigurationListener( configurationListener );
> +
> + }
> +
> +
> + public void removeConfigurationListener()
> + {
> + configurationDaoNotifier.removeConfigurationListener();
> +
> + }
> +
> +
> + public ConfigurationDaoNotifier getConfigurationDaoEventGenerator()
> + {
> + return configurationDaoNotifier;
> + }
> +
> +
> + public void setConfigurationDaoEventGenerator( ConfigurationDaoNotifier configurationDaoNotifier )
> + {
> + this.configurationDaoNotifier = configurationDaoNotifier;
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,166 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +
> +import javax.naming.InvalidNameException;
> +import javax.naming.NamingException;
> +import javax.naming.directory.DirContext;
> +import javax.naming.event.EventContext;
> +import javax.naming.event.EventDirContext;
> +import javax.naming.spi.InitialContextFactory;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.ConfigurationDaoListener;
> +import org.apache.configuration.dao.ConfigurationDaoNotifier;
> +import org.apache.configuration.dao.jndi.JndiConfigurationDaoNotifier;
> +import org.apache.configuration.dao.jndi.NameMapping;
> +
> +
> +/**
> + * ConfigurationDaoNotifierImpl notifies ConfigurationDaoListeners of changes to the
> + * JNDI store.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ConfigurationDaoNotifierImpl implements ConfigurationDaoNotifier
> +{
> +
> + private JndiConfigurationDaoNotifier jndiConfigurationDaoNotifier;
> + private NameMapping nameMapping;
> + private InitialContextFactory initialContextFactory;
> +
> + private EventDirContext eventDirContext = null;
> +
> +
> + /**
> + * Creates a new instance of ConfigurationDaoNotifierImpl.
> + *
> + */
> + public ConfigurationDaoNotifierImpl()
> + {
> + super();
> +
> + }
> +
> +
> + /**
> + *
> + * setChangeListener to listen to configuration changes on the backend.
> + *
> + * @param listener
> + * @throws NamingException
> + */
> + public void setConfigurationListener( ConfigurationDaoListener configurationListener )
> + {
> + if ( jndiConfigurationDaoNotifier == null )
> + {
> + throw new IllegalStateException( "jndiConfigurationDaoNotifier cannot be null." );
> + }
> + jndiConfigurationDaoNotifier.setConfigurationListener( configurationListener );
> +
> + try
> + {
> + if ( eventDirContext == null )
> + {
> + DirContext dirContext = (DirContext)initialContextFactory.getInitialContext( null );
> + eventDirContext =(EventDirContext) dirContext.lookup( "" );
> + }
> + eventDirContext.addNamingListener( nameMapping.getSearchBaseName(), EventContext.SUBTREE_SCOPE,
> + jndiConfigurationDaoNotifier );
> + }
> + catch ( InvalidNameException e )
> + {
> + throw new ConfigurationDaoException( "Could not create a eventDirContext to set a configurationListener.",
> + e );
> + }
> + catch ( NamingException e )
> + {
> + throw new ConfigurationDaoException( "Could not set a configurationListener with search base.", e );
> + }
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.ConfigurationDaoNotifier#removeConfigurationListener()
> + */
> + public void removeConfigurationListener()
> + {
> + if ( jndiConfigurationDaoNotifier == null )
> + {
> + return;
> + }
> + else
> + {
> + jndiConfigurationDaoNotifier.removeConfigurationListener();
> + }
> + if ( eventDirContext != null )
> + {
> + try
> + {
> + eventDirContext.close();
> + }
> + catch ( NamingException e )
> + {
> + //ignore
> + }
> + finally
> + {
> + eventDirContext = null;
> + }
> +
> + }
> +
> + }
> +
> +
> + public JndiConfigurationDaoNotifier getConfigurationDaoNotifier()
> + {
> + return jndiConfigurationDaoNotifier;
> + }
> +
> +
> + public void setJndiConfigurationDaoNotifier(
> + JndiConfigurationDaoNotifier jndiConfigurationDaoNotifier )
> + {
> + this.jndiConfigurationDaoNotifier = jndiConfigurationDaoNotifier;
> + }
> +
> +
> + public void setNameMapping( NameMapping nameMapping )
> + {
> + this.nameMapping = nameMapping;
> + }
> +
> +
> + public InitialContextFactory getInitialContextFactory()
> + {
> + return initialContextFactory;
> + }
> +
> +
> + public void setInitialContextFactory( InitialContextFactory initialContextFactory )
> + {
> + this.initialContextFactory = initialContextFactory;
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,182 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +import java.util.Dictionary;
> +import java.util.Enumeration;
> +import java.util.Vector;
> +
> +import javax.naming.NamingEnumeration;
> +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.configuration.dao.jndi.ContextMapping;
> +import org.apache.configuration.dao.jndi.KeyMapping;
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +
> +/**
> + * ContextMapper.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ContextMapper implements ContextMapping
> +{
> +
> + private KeyMapping keyMapping;
> + /**
> + *
> + * Map a Configuration From Attributes.
> + *
> + * @param atts
> + * @return
> + */
> + public ConfigurationDictionary transform( Attributes atts ) throws NamingException
> + {
> + ConfigurationDictionary configurationDictionary = new ConfigurationDictionary();
> +
> + NamingEnumeration<? extends Attribute> enumer = atts.getAll();
> + while ( enumer.hasMoreElements() )
> + {
> + Attribute attribute = enumer.nextElement();
> + addAttribute( attribute, configurationDictionary );
> +
> + }
> + return configurationDictionary;
> + }
> +
> + /**
> + *
> + * Map a configuration to a Context.
> + *
> + * @param configurationDictionary
> + * @param context
> + */
> + public DirContext transform( ConfigurationDictionary configurationDictionaryIn )
> + {
> + if(configurationDictionaryIn.get("objectclass" )==null){
> + throw new IllegalArgumentException("There was no objectclass properties defined.");
> + }
> + ConfigurationDictionary configurationDictionary = configurationDictionaryIn.createCopy();
> + SimpleDirContextAdapter context = new SimpleDirContextAdapter();
> + Enumeration keys = configurationDictionary.keys();
> + while ( keys.hasMoreElements() )
> + {
> + String key = (String)keys.nextElement();
> + Attribute attribute = new BasicAttribute(key);
> + Object value= configurationDictionary.get( key );
> + addValueToAttribute(value, attribute);
> + context.setAttribute( attribute );
> + }
> + return context;
> + }
> +
> +
> + /**
> + *
> + * Add an attribute as a value to a configurationDictionary
> + *
> + * @param configurationDictionary .
> + * @param attribute
> + * @throws NamingException
> + * @throws NamingException
> + */
> + private void addAttribute(Attribute attribute, ConfigurationDictionary configurationDictionary ) throws NamingException {
> + if(attribute.size( )>1){
> + Vector<Object> vector = new Vector<Object>(attribute.size( ));
> + NamingEnumeration<?> enumer = attribute.getAll();
> + while ( enumer.hasMoreElements() )
> + {
> + Object o = enumer.nextElement();
> + vector.add( o );
> +
> + }
> + configurationDictionary.put( attribute.getID(), vector );
> + }else if (attribute.size( )==1) {
> + String key = attribute.getID();
> + Object value = attribute.get();
> + configurationDictionary.put( key, value );
> + }else{
> + throw new IllegalStateException("No attribute found for "+attribute);
> + }
> + }
> +
> + /**
> + *
> + * Add a value as an attribute.
> + *
> + * @param value maybe an object, array of values, or a vector of values.
> + * @param attribute to add values to.
> + */
> + public void addValueToAttribute(Object value,Attribute attribute ){
> + if(value == null){
> + throw new IllegalArgumentException("Argument value cannot be null");
> + }
> + if(attribute == null){
> + throw new IllegalArgumentException("Argument attribute cannot be null");
> + }
> + if (value.getClass().isArray()){
> + addArray((Object[]) value, attribute);
> + }else if(value instanceof Vector){
> + addVector((Vector)value, attribute);
> + }else {
> + attribute.add(value);
> + }
> + }
> +
> + private void addArray(Object[] value,Attribute attribute ){
> + for ( int i = 0; i < value.length; i++ )
> + {
> + attribute.add(value[i]);
> + }
> + }
> +
> + private void addVector(Vector value,Attribute attribute ){
> + for ( Object object : value )
> + {
> + attribute.add(object);
> + }
> + }
> +
> + public void translateDirctoryKeysToOsgiKeys( Dictionary directoryDictionary )
> + {
> + keyMapping.translateDirctoryKeysToOsgiKeys( directoryDictionary);
> +
> + }
> +
> + public void translateOsgiKeysToDirectoryKeys( Dictionary configurationDictionary )
> + {
> + keyMapping.translateOsgiKeysToDirectoryKeys( configurationDictionary);
> +
> + }
> +
> + public void setKeyMapping( KeyMapping keyMapping )
> + {
> + this.keyMapping = keyMapping;
> + }
> +
> +
> +
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,106 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +import javax.naming.Name;
> +import javax.naming.NamingException;
> +import javax.naming.directory.DirContext;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.jndi.Command;
> +import org.apache.configuration.dao.jndi.ContextMapping;
> +import org.apache.configuration.dao.jndi.NameMapping;
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +/**
> + * CreateCommand.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class CreateCommand implements Command<String>
> +{
> + private static final Logger log = LoggerFactory.getLogger( CreateCommand.class );
> + private final ContextMapping contextMapping;
> + private final ConfigurationDictionary configurationDictionary;
> + private final String pid;
> + private final Name name;
> +
> + /**
> + * Creates a new instance of CreateCommand.
> + *
> + */
> + public CreateCommand(NameMapping nameMapping, ContextMapping contextMapping, ConfigurationDictionary configurationDictionary)
> + {
> + this.contextMapping=contextMapping;
> + this.configurationDictionary=configurationDictionary.createCopy();
> + this.pid = nameMapping.getPid( this.configurationDictionary );
> + this.name = nameMapping.getDistinguishedName( this.configurationDictionary ) ;
> + modifyConfiguration( this.configurationDictionary);
> +
> + if(pid==null){
> + throw new IllegalArgumentException( " could not find a Pid in "+configurationDictionary);
> + }
> + if(name==null){
> + throw new IllegalArgumentException( " could not find a DistinguishedName in "+configurationDictionary);
> + }
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.jndi.Command#execute(javax.naming.directory.DirContext)
> + */
> + public String execute( DirContext dirContext )
> + {
> + DirContext obj = createDirContext();
> +
> + try
> + {
> + dirContext.bind( name, obj );
> + }
> + catch ( NamingException e )
> + {
> + log.error( "Failed to create an entry "+configurationDictionary+" named "+name,e );
> + throw new ConfigurationDaoException("Failed to execute the create. ",e);
> + }
> + log.debug( "Created an entry for {} with DN [{}].",configurationDictionary, name );
> + return pid;
> + }
> +
> +
> +
> +
> + private void modifyConfiguration(ConfigurationDictionary configurationDictionary)
> + {
> + contextMapping.translateOsgiKeysToDirectoryKeys( configurationDictionary);
> + }
> +
> + private DirContext createDirContext(){
> + DirContext result= contextMapping.transform( configurationDictionary );
> + if(result==null){
> + throw new IllegalStateException("Could not transform the configuration Dictionary "+configurationDictionary);
> + }
> + return result;
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,141 @@
> +package org.apache.configuration.dao.jndi.impl;
> +
> +
> +import javax.naming.InvalidNameException;
> +import javax.naming.Name;
> +import javax.naming.ldap.LdapName;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.jndi.ContextMapping;
> +import org.apache.configuration.dao.jndi.NameMapping;
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +import org.osgi.framework.Constants;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +
> +public class DefaultNameMapper implements NameMapping
> +{
> +
> + /** the log for this class */
> + private static final Logger log = LoggerFactory.getLogger( DefaultNameMapper.class );
> +
> + private String searchBase;
> +
> + private String defaultNamingBase;
> +
> +
> + /**
> + *
> + * Creates a name for the given configurationDictionary. If the configurationDictionary
> + * contains a APACHEDS_NAMIMG_KEY it will be used for the name and then removed
> + * from the configurationDictioanry. If configurationDictionary does not contain
> + * the a APACHEDS_NAMIMG_KEY a default name will be created based on the value
> + * returned from the <code>getDefaultNamingBaseName<code> method.
> + *
> + * @param configurationDictionary
> + * @return name
> + */
> + public Name getDistinguishedName( ConfigurationDictionary configurationDictionary )
> + {
> + Object nameObject = configurationDictionary.remove( APACHEDS_NAMIMG_KEY );
> + if ( nameObject == null )
> + {
> + String pid = getPid( configurationDictionary );
> + return getDefaultedDistinguishedName( pid );
> + }
> +
> + String explicitName = (String) nameObject;
> + try
> + {
> + log.debug("Found explicitNaming Object {} ",nameObject);
> + return new LdapName( explicitName );
> + }
> + catch ( InvalidNameException e )
> + {
> + throw new ConfigurationDaoException( "Could not form a distinguished Name from " + explicitName,e );
> + }
> + }
> +
> +
> + public String getPid( ConfigurationDictionary configurationDictionary )
> + {
> + if ( configurationDictionary.get( Constants.SERVICE_PID ) != null )
> + {
> + return ( String ) configurationDictionary.get( Constants.SERVICE_PID );
> + }
> + else if ( configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID ) != null )
> + {
> + return ( String ) configurationDictionary.get( ContextMapping.APACHEDS_SERVICE_PID );
> + }
> + throw new IllegalArgumentException( "Could not determine the service pid." );
> + }
> +
> +
> + public LdapName getSearchBaseName() throws InvalidNameException
> + {
> + return new LdapName( searchBase );
> + }
> +
> +
> + public LdapName getDefaultNamingBaseName() throws InvalidNameException
> + {
> +
> + return new LdapName( defaultNamingBase );
> + }
> +
> +
> + public void setSearchBase( String searchBase )
> + {
> + this.searchBase = searchBase;
> + }
> +
> +
> + public void setDefaultNamingBase( String defaultNamingBase )
> + {
> + this.defaultNamingBase = defaultNamingBase;
> + }
> +
> +
> + private Name getDefaultedDistinguishedName( String pid )
> + {
> +
> + LdapName dn;
> + try
> + {
> + dn = getDefaultNamingBaseName();
> + dn.add( ContextMapping.APACHEDS_SERVICE_PID + '=' + pid );
> + }
> + catch ( InvalidNameException e )
> + {
> + throw new ConfigurationDaoException( "Invalid Name " + pid + ' ' + e.toString() );
> + }
> +
> + return dn;
> + }
> +
> +
> + /**
> + *
> + * Add an APACHEDS_NAMIMG_KEY and value to the configurationDictionary if the name does not fit the default
> + * pattern.
> + *
> + * @param configurationDictionary
> + * @param name
> + */
> + public void addAlternateName( ConfigurationDictionary configurationDictionary, String name )
> + {
> + String pid = (String) configurationDictionary.get(ContextMapping.APACHEDS_SERVICE_PID);
> + Name lName = getDefaultedDistinguishedName( pid );
> +
> + if(lName.toString().equals( name )){
> + log.debug( "{} of entry equals the default name {}.",name,lName.toString());
> + }else{
> + log.debug( "{} of entry does not equals the default name {}.",name,lName.toString());
> + configurationDictionary.put( APACHEDS_NAMIMG_KEY, name );
> + }
> +
> + }
> +
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,105 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +
> +import java.util.List;
> +
> +import javax.naming.NameNotFoundException;
> +import javax.naming.directory.DirContext;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.jndi.ContextMapping;
> +import org.apache.configuration.dao.jndi.Command;
> +import org.apache.configuration.dao.jndi.NameMapping;
> +import org.apache.configuration.impl.ConfigurationDictionary;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +
> +/**
> + * DefaultReadCommand delegates to a search based lookup to
> + * read a configurationDictionary from the directory.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class DefaultReadCommand implements Command<ConfigurationDictionary>
> +{
> +
> + private static final Logger log = LoggerFactory.getLogger( DefaultReadCommand.class );
> + private final Command<List<ConfigurationDictionary>> delegate;
> + public static final String FILTER_PART_ONE = "(&(objectclass="
> + + ContextMapping.APACHEDS_SERVICE_CONFIGURATION_OBJECTCLASS + ") (" + ContextMapping.APACHEDS_SERVICE_PID + "=";
> + private final String pid;
> +
> +
> + /**
> + * Creates a new instance of SimpleReadCommand.
> + *
> + */
> + public DefaultReadCommand( NameMapping nameMapping, ContextMapping contextMapping, String pid )
> + {
> + if(pid==null){
> + throw new IllegalArgumentException("pid argument cannot be null.");
> + }
> + this.pid = pid;
> + String filter = FILTER_PART_ONE + pid + "))";
> +
> + this.delegate = new ListCommand( filter, nameMapping, contextMapping );
> +
> + }
> +
> +
> + /**
> + *
> + * execute delegates to a search based lookup to find the pid.
> + *
> + * @param dirContext
> + * @return
> + */
> + public ConfigurationDictionary execute( DirContext dirContext )
> + {
> + try
> + {
> + List<ConfigurationDictionary> list = delegate.execute( dirContext );
> + if ( list==null || list.isEmpty() )
> + {
> + ConfigurationDaoException e = new ConfigurationDaoException(
> + "Search for pid:" + pid + " returned no entries.", new NameNotFoundException() );
> + throw e;
> + }
> + else if ( list.size() > 1 )
> + {
> + throw new ConfigurationDaoException( "Primary Key Integrity Failure. Search for " + pid + " returned "
> + + list.size() + " entries." );
> + }
> + return list.get(0);
> + }
> + catch ( ConfigurationDaoException e )
> + {
> + log.error( pid + " could not be read with a delegated search.", e );
> + throw e;
> + }
> +
> + }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java
> URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java?view=auto&rev=501176
> ==============================================================================
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java Mon Jan 29 12:38:25 2007
> @@ -0,0 +1,75 @@
> +/*
> + * 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.configuration.dao.jndi.impl;
> +
> +import javax.naming.Name;
> +import javax.naming.NamingException;
> +import javax.naming.directory.DirContext;
> +
> +import org.apache.configuration.dao.ConfigurationDaoException;
> +import org.apache.configuration.dao.jndi.Command;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +/**
> + * DeleteCommand deletes a configurationDictionary from the directory.
> + *
> + * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class DeleteCommand implements Command<Void>
> +{
> +
> + private static final Logger log = LoggerFactory.getLogger( DeleteCommand.class );
> + private final Name name;
> + /**
> + * Creates a new instance of SimpleReadCommand.
> + *
> + */
> + public DeleteCommand(Name name)
> + {
> + this.name=name;
> + }
> +
> +
> + /* (non-Javadoc)
> + * @see org.apache.configuration.dao.jndi.Command#execute(javax.naming.directory.DirContext)
> + */
> + public Void execute( DirContext dirContext )
> + {
> +
> + try
> + {
> + dirContext.destroySubcontext( name );
> + }
> + catch ( NamingException e )
> + {
> + log.error( name+" could not be read.",e );
> + throw new ConfigurationDaoException(name+" could not be deleted.", e);
> + }
> +
> +
> + return null;
> + }
> +
> +
> +
> +}
>
>
>