Re: svn commit: r501176 [1/6] - in /directory/sandbox/jconlon/osgi-services/configurat
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Directory Project > Re: svn commit: r501176 [1/6] - in /directory/sandbox/jconlon/osgi-services/configurat




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: svn commit: r501176 [1/6] - in /directory/sandbox/jconlon/osgi-services/configurat  
Alex Karasulu


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-07 12:11 AM

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-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.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.ja
va
>     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/JndiConfigurationDaoNotifierImp
l.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.ja
va
>     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/MockManagedServiceFactoryTrackingDelega
te.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.x
ml
> URL: http://svn.apache.org/viewvc/direct...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 Servic
e.
> +	</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.feli
x.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/m
ain/java/org/apache/configuration/dao/ConfigurationDao.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDao extends ConfigurationDaoNotifier
> +{
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#create(org.apac
he.configuration.util.ConfigurationDictionary)
> +     */
> +    public String create( ConfigurationDictionary configurationDictionary
 );
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#findByPrimaryKe
y(java.lang.String)
> +     */
> +    public ConfigurationDictionary read( String pid );
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#update(org.apac
he.configuration.util.ConfigurationDictionary)
> +     */
> +    void update( ConfigurationDictionary configurationDictionary );
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#delete(org.apac
he.configuration.util.ConfigurationDictionary)
> +     */
> +    public void delete( ConfigurationDictionary configurationDictionary )
;
> +
> +    /**
> +     *
> +     *
> +     *
> +     * @return list of {@link ConfigurationDictionary} or an empty l
ist.
> +     */
> +    public List<ConfigurationDictionary> findAll();
> +
> +}
> \ No newline at end of file
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/ConfigurationDaoException.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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/m
ain/java/org/apache/configuration/dao/ConfigurationDaoListener.java
> URL: http://svn.apache.org/viewvc/direct...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 impl
ied.
> + *   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 Configu
rationDao.
> + *
> + *
> + * @see ConfigurationDao
> + * @author <a href="mailto:dev-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDaoListener
> +{
> +    /**
> +     * ChangeType.
> +     *
> +     * @author <a href="mailto:dev-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@publi
c.gmane.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 configurationDicti
onary
> +     * @param configurationDictionary that changed
> +     */
> +    public void configurationChanged( ChangeType changeType, Configuratio
nDictionary configurationDictionary );
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/ConfigurationDaoNotifier.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface ConfigurationDaoNotifier
> +{
> +    void setConfigurationListener( ConfigurationDaoListener configuration
Listener );
> +
> +    public void removeConfigurationListener();
> +
> +}
> \ No newline at end of file
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/Command.java
> URL: http://svn.apache.org/viewvc/direct...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 200
7
> @@ -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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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/m
ain/java/org/apache/configuration/dao/jndi/CommandProcessing.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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/m
ain/java/org/apache/configuration/dao/jndi/ContextMapping.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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_OBJECTCLA
SS
 = "apacheServiceConfiguration";
> +
> +
> +
> +    DirContext transform(ConfigurationDictionary configurationDictionary)
;
> +
> +    ConfigurationDictionary transform( Attributes atts )throws NamingExce
ption;
> +
> +    void addValueToAttribute(Object value,Attribute attribute );
> +
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java
> URL: http://svn.apache.org/viewvc/direct...auto&rev=501176
>  ========================================
==================================
====
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java (a
dded)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/JndiConfigurationDaoNotifier.java Mo
n 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 Confi
gurationDaoListeners
> + * of changes.
> + *
> + * @author <a href="mailto:dev-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface JndiConfigurationDaoNotifier extends ConfigurationDaoNot
ifier,
> +    NamespaceChangeListener, ObjectChangeListener
> +{
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/KeyMapping.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public interface KeyMapping
> +{
> +
> +    /**
> +     *
> +     *  ChangeType a dictionary from the directory format to an OSGi conf
iguration.
> +     *  @param directoryDictionary
> +     */
> +
> +     public void  translateDirctoryKeysToOsgiKeys(Dictiona
ry directoryDict
ionary) ;
> +
> +
> +    /**
> +      *
> +      * ChangeType a OSGi configuration to a dictionary suitable for the 
directory.
> +      *
> +      * @param configurationDictionary
> +     */
> +     public void  translateOsgiKeysToDirectoryKeys(Diction
ary configuratio
nDictionary) ;
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/NameMapping.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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 prop
erty. 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 configurationDictionar
y if the name does not fit the default
> +     * pattern.
> +     *
> +     * @param configurationDictionary
> +     * @param name
> +     */
> +    public void  addAlternateName(ConfigurationDictionary
 configurationDic
tionary, String name);
> +    /**
> +     *
> +     * Creates a name for the given configurationDictionary. If the confi
gurationDictionary
> +     * contains a APACHEDS_NAMIMG_KEY it will be used for the name and th
en 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(ConfigurationDictio
nary configurationDictio
nary);
> +
> +    /**
> +     *
> +     * 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/m
ain/java/org/apache/configuration/dao/jndi/impl/CommandProcessor.java
> URL: http://svn.apache.org/viewvc/direct...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 2
9 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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class CommandProcessor implements CommandProcessing
> +{
> +    private static final Logger log = LoggerFactory.getLogger( CommandPro
cessor.class );
> +    private final InitialContextFactory initialContextFactory;
> +
> +
> +
> +
> +    /**
> +     * Creates a new instance of CommandProcessor.
> +     *
> +     * @param initialContextFactory
> +     */
> +    public CommandProcessor( final InitialContextFactory initialContextFa
ctory )
> +    {
> +        super();
> +        this.initialContextFactory = initialContextFactory;
> +    }
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.jndi.CommandProcessing#submit(or
g.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.getInitialCont
ext( 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 dirC
ontext.",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/m
ain/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java
> URL: http://svn.apache.org/viewvc/direct...auto&rev=501176
>  ========================================
==================================
====
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java (adde
d)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoImpl.java Mon J
an 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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ConfigurationDaoImpl implements ConfigurationDao
> +{
> +
> +    private static final Logger log = LoggerFactory.getLogger( Configurat
ionDaoImpl.class );
> +    private static final String ALL_FILTER = "(objectclass="
> +        + ContextMapping. APACHEDS_SERVICE_CONFIGURATION_OBJECTCLA
SS + ")"
;
> +
> +    private ContextMapping contextMapping;
> +    private NameMapping nameMapping;
> +    private CommandProcessing commandProcessing;
> +    private ConfigurationDaoNotifier configurationDaoNotifier;
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#create(org.apac
he.configuration.util.ConfigurationDictionary)
> +     */
> +    public String create( ConfigurationDictionary configurationDictionary
 )
> +    {
> +        Command<String> createCommand = new CreateCommand( nameMapping, c
ontextMapping, 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 nu
ll.");
> +        }
> +        Command<ConfigurationDictionary> readCommand = new DefaultReadCom
mand( nameMapping, contextMapping, pid );
> +        return commandProcessing.submit( readCommand );
> +    }
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDao#update(org.apac
he.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.apac
he.configuration.util.ConfigurationDictionary)
> +     */
> +    public void delete( ConfigurationDictionary configurationDictionary )
> +    {
> +        Command<Void> deleteCommand = new DeleteCommand( nameMapping.getD
istinguishedName( 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 ListComm
and( 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 commandProcessi
ng )
> +    {
> +        this.commandProcessing = commandProcessing;
> +    }
> +
> +
> +    public void setConfigurationListener( ConfigurationDaoListener config
urationListener )
> +    {
> +
> +
> +        configurationDaoNotifier.setConfigurationListener( configurationL
istener );
> +
> +    }
> +
> +
> +    public void removeConfigurationListener()
> +    {
> +        configurationDaoNotifier.removeConfigurationListener();
> +
> +    }
> +
> +
> +    public ConfigurationDaoNotifier getConfigurationDaoEventGenerator()
> +    {
> +        return configurationDaoNotifier;
> +    }
> +
> +
> +    public void setConfigurationDaoEventGenerator( ConfigurationDaoNotifi
er configurationDaoNotifier )
> +    {
> +        this.configurationDaoNotifier = configurationDaoNotifier;
> +    }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl
.java
> URL: http://svn.apache.org/viewvc/direct...auto&rev=501176
>  ========================================
==================================
====
> --- directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.ja
va (added)
> +++ directory/sandbox/jconlon/osgi-services/configuration-service/src/main
/java/org/apache/configuration/dao/jndi/impl/ConfigurationDaoNotifierImpl.ja
va 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 cha
nges to the
> + * JNDI store.
> + *
> + * @author <a href="mailto:dev-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class ConfigurationDaoNotifierImpl implements ConfigurationDaoNoti
fier
> +{
> +
> +    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 backen
d.
> +     *
> +     * @param listener
> +     * @throws NamingException
> +     */
> +    public void setConfigurationListener( ConfigurationDaoListener config
urationListener )
> +    {
> +        if ( jndiConfigurationDaoNotifier == null )
> +        {
> +            throw new IllegalStateException( "jndiConfigurationDaoNotifie
r cannot be null." );
> +        }
> +        jndiConfigurationDaoNotifier.setConfigurationListener( configurat
ionListener );
> +
> +        try
> +        {
> +            if ( eventDirContext == null )
> +            {
> +                 DirContext dirContext = (DirContext)initialContextFactor
y.getInitialContext( null );
> +                 eventDirContext =(EventDirContext) dirContext.lookup( ""
 );
> +            }
> +            eventDirContext.addNamingListener( nameMapping.getSearchBaseN
ame(), EventContext.SUBTREE_SCOPE,
> +                jndiConfigurationDaoNotifier );
> +        }
> +        catch ( InvalidNameException e )
> +        {
> +            throw new ConfigurationDaoException( "Could not create a even
tDirContext to set a configurationListener.",
> +                e );
> +        }
> +        catch ( NamingException e )
> +        {
> +            throw new ConfigurationDaoException( "Could not set a configu
rationListener with search base.", e );
> +        }
> +    }
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.ConfigurationDaoNotifier#removeC
onfigurationListener()
> +     */
> +    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 initialCo
ntextFactory )
> +    {
> +        this.initialContextFactory = initialContextFactory;
> +    }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/impl/ContextMapper.java
> URL: http://svn.apache.org/viewvc/direct...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 1
2: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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.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 Na
mingException
> +    {
> +        ConfigurationDictionary configurationDictionary = new Configurati
onDictionary();
> +
> +        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 configurationDic
tionaryIn )
> +    {
> +        if(configurationDictionaryIn.get("objectclass"  )==null){
> +            throw new IllegalArgumentException("There was no objectclass 
properties defined.");
> +        }
> +        ConfigurationDictionary configurationDictionary = configurationDi
ctionaryIn.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, ConfigurationDictionar
y 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 "+att
ribute);
> +        }
> +    }
> +
> +    /**
> +     *
> +     * Add a value as an attribute.
> +     *
> +     * @param value maybe an object, array of values, or a vector of valu
es.
> +     * @param attribute to add values to.
> +     */
> +    public void addValueToAttribute(Object value,Attribute attribute )
23;
> +        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 directoryDict
ionary )
> +    {
> +        keyMapping.translateDirctoryKeysToOsgiKeys(  directoryDictionary)
;
> +
> +    }
> +
> +    public void translateOsgiKeysToDirectoryKeys( Dictionary configuratio
nDictionary )
> +    {
> +        keyMapping.translateOsgiKeysToDirectoryKeys(  configurationDictio
nary);
> +
> +    }
> +
> +    public void setKeyMapping( KeyMapping keyMapping )
> +    {
> +        this.keyMapping = keyMapping;
> +    }
> +
> +
> +
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/impl/CreateCommand.java
> URL: http://svn.apache.org/viewvc/direct...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 1
2: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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class CreateCommand implements Command<String>
> +{
> +    private static final Logger log = LoggerFactory.getLogger( CreateComm
and.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 contextM
apping, ConfigurationDictionary configurationDictionary)
> +    {
> +        this.contextMapping=contextMapping;
> +        this. configurationDictionary=configurationDic
tionary.createCopy()
;
> +        this.pid =  nameMapping.getPid( this.configurationDictionary );
> +        this.name = nameMapping.getDistinguishedName( this.configurationD
ictionary ) ;
> +        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 Distin
guishedName in "+configurationDictionary);
> +        }
> +    }
> +
> +
> +    /* (non-Javadoc)
> +     * @see org.apache.configuration.dao.jndi.Command#execute(javax.namin
g.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 "+configurationDictiona
ry+" named "+name,e );
> +            throw new ConfigurationDaoException("Failed to execute the cr
eate. ",e);
> +        }
> +        log.debug( "Created an entry for {} with DN [{}].",
configurationDictionary, name );
> +        return pid;
> +    }
> +
> +
> +
> +
> +    private void  modifyConfiguration(ConfigurationDiction
ary configuratio
nDictionary)
> +    {
> +        contextMapping.translateOsgiKeysToDirectoryKeys(  configurationDi
ctionary);
> +    }
> +
> +    private DirContext createDirContext(){
> +        DirContext result= contextMapping.transform( configurationDiction
ary );
> +        if(result==null){
> +            throw new IllegalStateException("Could not transform the conf
iguration Dictionary "+configurationDictionary);
> +        }
> +        return result;
> +    }
> +
> +}
>
> Added: directory/sandbox/jconlon/osgi-services/configuration-service/src/m
ain/java/org/apache/configuration/dao/jndi/impl/DefaultNameMapper.java
> URL: http://svn.apache.org/viewvc/direct...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( DefaultNam
eMapper.class );
> +
> +    private String searchBase;
> +
> +    private String defaultNamingBase;
> +
> +
> +    /**
> +     *
> +     * Creates a name for the given configurationDictionary. If the confi
gurationDictionary
> +     * contains a APACHEDS_NAMIMG_KEY it will be used for the name and th
en 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 configurati
onDictionary )
> +    {
> +        Object nameObject = configurationDictionary.remove( APACHEDS_NAMI
MG_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 distin
guished Name from " + explicitName,e );
> +        }
> +    }
> +
> +
> +    public String getPid( ConfigurationDictionary configurationDictionary
 )
> +    {
> +        if ( configurationDictionary.get( Constants.SERVICE_PID ) != null
 )
> +        {
> +            return ( String ) configurationDictionary.get( Constants.SERV
ICE_PID );
> +        }
> +        else if ( configurationDictionary.get( ContextMapping.APACHEDS_SE
RVICE_PID ) != null )
> +        {
> +            return ( String ) configurationDictionary.get( ContextMapping
.APACHEDS_SERVICE_PID );
> +        }
> +        throw new IllegalArgumentException( "Could not determine the serv
ice pid." );
> +    }
> +
> +
> +    public LdapName getSearchBaseName() throws InvalidNameException
> +    {
> +        return new LdapName( searchBase );
> +    }
> +
> +
> +    public LdapName getDefaultNamingBaseName() throws InvalidNameExceptio
n
> +    {
> +
> +        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 configurationDictionar
y if the name does not fit the default
> +     * pattern.
> +     *
> +     * @param configurationDictionary
> +     * @param name
> +     */
> +    public void addAlternateName( ConfigurationDictionary configurationDi
ctionary, 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/m
ain/java/org/apache/configuration/dao/jndi/impl/DefaultReadCommand.java
> URL: http://svn.apache.org/viewvc/direct...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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class DefaultReadCommand implements Command<ConfigurationDictionar
y>
> +{
> +
> +    private static final Logger log = LoggerFactory.getLogger( DefaultRea
dCommand.class );
> +    private final Command<List<ConfigurationDictionary>> delegate;
> +    public static final String FILTER_PART_ONE = "(&(objectclass="
> +        + ContextMapping. APACHEDS_SERVICE_CONFIGURATION_OBJECTCLA
SS + ") 
(" + ContextMapping.APACHEDS_SERVICE_PID + "=";
> +    private final String pid;
> +
> +
> +    /**
> +     * Creates a new instance of SimpleReadCommand.
> +     *
> +     */
> +    public DefaultReadCommand( NameMapping nameMapping, ContextMapping co
ntextMapping, String pid )
> +    {
> +        if(pid==null){
> +            throw new IllegalArgumentException("pid argument cannot be nu
ll.");
> +        }
> +        this.pid = pid;
> +        String filter = FILTER_PART_ONE + pid + "))";
> +
> +        this.delegate = new ListCommand( filter, nameMapping, contextMapp
ing );
> +
> +    }
> +
> +
> +    /**
> +     *
> +     * 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( dirCon
text );
> +            if ( list==null || list.isEmpty() )
> +            {
> +                ConfigurationDaoException e = new ConfigurationDaoExcepti
on(
> +                    "Search for pid:" + pid + " returned no entries.", ne
w NameNotFoundException() );
> +                throw e;
> +            }
> +            else if ( list.size() > 1 )
> +            {
> +                throw new ConfigurationDaoException( "Primary Key Integri
ty 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/m
ain/java/org/apache/configuration/dao/jndi/impl/DeleteCommand.java
> URL: http://svn.apache.org/viewvc/direct...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 1
2: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-aYN4UCa7k1r1N9kud6OZbmD2FQJk+8+b@public.gm
ane.org">Apache Directory Project</a>
> + * @version $Rev$, $Date$
> + */
> +public class DeleteCommand implements Command<Void>
> +{
> +
> +    private static final Logger log = LoggerFactory.getLogger( DeleteComm
and.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.namin
g.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 delet
ed.", e);
> +        }
> +
> +
> +       return null;
> +    }
> +
> +
> +
> +}
>
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:18 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump: