You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/06/10 08:20:18 UTC

svn commit: r189905 - in /directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration: ./ Configuration.java ShutdownConfiguration.java StartupConfiguration.java SyncConfiguration.java

Author: trustin
Date: Thu Jun  9 23:20:17 2005
New Revision: 189905

URL: http://svn.apache.org/viewcvs?rev=189905&view=rev
Log:
Implementing configuration package...

Added:
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ShutdownConfiguration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java?rev=189905&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java (added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java Thu Jun  9 23:20:17 2005
@@ -0,0 +1,79 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 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.ldap.server.configuration;
+
+import java.io.Serializable;
+import java.util.Hashtable;
+
+/**
+ * A configuration that provides required, optional, or default properties
+ * to configure ApacheDS.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 189903 $, $Date$
+ */
+public abstract class Configuration implements Cloneable, Serializable
+{
+    /**
+     * A JNDI environment key that configuration instance is put on. 
+     */
+    public static final String JNDI_KEY = Configuration.class.getName();
+
+    /**
+     * Gets {@link Configuration} instance from the specified JNDI environment
+     * {@link Hashtable}.
+     * 
+     * @throws IllegalArgumentException if the specified environment doesn't
+     *                                  contain the configuration instance.
+     */
+    public static Configuration toConfiguration( Hashtable jndiEnvironment )
+    {
+        Object value = jndiEnvironment.get( JNDI_KEY );
+        if( value == null || !( value instanceof Configuration ) )
+        {
+            throw new IllegalArgumentException( "Not an ApacheDS configuration: " + value );
+        }
+        
+        return ( Configuration ) value;
+    }
+
+    /**
+     * Converts this configuration to JNDI environment {@link Hashtable}.
+     * This method simple returns a {@link Hashtable} that contains an entry
+     * whose key is {@link #JNDI_KEY} and whose value is <tt>this</tt>.
+     */
+    public Hashtable toJndiEnvironment()
+    {
+        Hashtable env = new Hashtable();
+        env.put( JNDI_KEY, this );
+        return env;
+    }
+    
+    public Object clone()
+    {
+        try
+        {
+            return super.clone();
+        }
+        catch( CloneNotSupportedException e )
+        {
+            throw new InternalError();
+        }
+    }
+}

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ShutdownConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ShutdownConfiguration.java?rev=189905&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ShutdownConfiguration.java (added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ShutdownConfiguration.java Thu Jun  9 23:20:17 2005
@@ -0,0 +1,30 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 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.ldap.server.configuration;
+
+/**
+ * A {@link Configuration} that shuts down ApacheDS.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 189903 $, $Date$
+ */
+public class ShutdownConfiguration extends Configuration
+{
+    private static final long serialVersionUID = 3141844093107051149L;
+}

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java?rev=189905&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java (added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java Thu Jun  9 23:20:17 2005
@@ -0,0 +1,36 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 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.ldap.server.configuration;
+
+import java.io.File;
+
+/**
+ * A {@link Configuration} that starts up ApacheDS.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 189903 $, $Date$
+ */
+public class StartupConfiguration extends Configuration
+{
+    private static final long serialVersionUID = 4826762196566871677L;
+
+    protected File workingDirectory;
+    
+    
+}

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java?rev=189905&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java (added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java Thu Jun  9 23:20:17 2005
@@ -0,0 +1,30 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 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.ldap.server.configuration;
+
+/**
+ * A {@link Configuration} that syncs ApacheDS backend storage with disk.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 189903 $, $Date$
+ */
+public class SyncConfiguration extends Configuration
+{
+    private static final long serialVersionUID = -3260859085299322327L;
+}