You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/01/16 07:22:18 UTC
svn commit: r899890 - in
/directory/apacheds/branches/apacheds-cidit/default-config: pom.xml
src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Author: kayyagari
Date: Sat Jan 16 06:22:16 2010
New Revision: 899890
URL: http://svn.apache.org/viewvc?rev=899890&view=rev
Log:
o added support for instantiating jetty http server
o added dependency on apacheds-http-server-integration
Modified:
directory/apacheds/branches/apacheds-cidit/default-config/pom.xml
directory/apacheds/branches/apacheds-cidit/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Modified: directory/apacheds/branches/apacheds-cidit/default-config/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-cidit/default-config/pom.xml?rev=899890&r1=899889&r2=899890&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-cidit/default-config/pom.xml (original)
+++ directory/apacheds/branches/apacheds-cidit/default-config/pom.xml Sat Jan 16 06:22:16 2010
@@ -68,5 +68,11 @@
<artifactId>apacheds-protocol-ntp</artifactId>
<version>${pom.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.directory.server.http</groupId>
+ <artifactId>apacheds-http-integration</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
</dependencies>
</project>
Modified: directory/apacheds/branches/apacheds-cidit/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-cidit/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=899890&r1=899889&r2=899890&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-cidit/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (original)
+++ directory/apacheds/branches/apacheds-cidit/default-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Sat Jan 16 06:22:16 2010
@@ -54,6 +54,8 @@
import org.apache.directory.server.dhcp.store.DhcpStore;
import org.apache.directory.server.dhcp.store.SimpleDhcpStore;
import org.apache.directory.server.dns.DnsServer;
+import org.apache.directory.server.integration.http.HttpServer;
+import org.apache.directory.server.integration.http.WebApp;
import org.apache.directory.server.kerberos.kdc.KdcServer;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
import org.apache.directory.server.ldap.LdapServer;
@@ -418,6 +420,58 @@
}
+ public HttpServer getHttpServer() throws Exception
+ {
+ EqualityNode filter = new EqualityNode( "objectClass", new ClientStringValue( "ads-httpServer" ) );
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+
+ IndexCursor cursor = se.cursor( configPartition.getSuffixDn(), AliasDerefMode.NEVER_DEREF_ALIASES, filter,
+ controls );
+
+ if ( !cursor.next() )
+ {
+ throw new Exception( "No HTTP server was configured under the DN " + configPartition.getSuffixDn() );
+ }
+
+ ForwardIndexEntry<Long, Long> forwardEntry = ( ForwardIndexEntry<Long, Long> ) cursor.get();
+ cursor.close();
+
+ ClonedServerEntry httpEntry = configPartition.lookup( forwardEntry.getId() );
+ LOG.debug( "HTTP server entry {}", httpEntry );
+ if( !isEnabled( httpEntry ) )
+ {
+ return null;
+ }
+
+ HttpServer httpServer = new HttpServer();
+
+ EntryAttribute portAttr = httpEntry.get( "ads-systemPort" );
+ if( portAttr != null )
+ {
+ httpServer.setPort( Integer.parseInt( portAttr.getString() ) );
+ }
+
+ EntryAttribute confFileAttr = httpEntry.get( "ads-httpConfFile" );
+ if( confFileAttr != null )
+ {
+ httpServer.setConfFile( confFileAttr.getString() );
+ }
+
+ EntryAttribute webAppsAttr = httpEntry.get( "ads-httpWebApps" );
+ if( webAppsAttr != null )
+ {
+ LdapDN webAppsDN = new LdapDN( webAppsAttr.getString() );
+ webAppsDN.normalize( schemaManager.getNormalizerMapping() );
+
+ Set<WebApp> webApps = getWebApps( webAppsDN );
+ httpServer.setWebApps( webApps );
+ }
+
+ return httpServer;
+ }
+
+
/**
*
* instantiates a DirectoryService based on the configuration present in the partition
@@ -887,6 +941,36 @@
}
+ private Set<WebApp> getWebApps( LdapDN webAppsDN ) throws Exception
+ {
+ PresenceNode filter = new PresenceNode( "ads-httpWarFile" );
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ IndexCursor cursor = se.cursor( webAppsDN, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls );
+
+ Set<WebApp> webApps = new HashSet<WebApp>();
+
+ while( cursor.next() )
+ {
+ ForwardIndexEntry<Long, Long> forwardEntry = ( ForwardIndexEntry<Long, Long> ) cursor.get();
+ ServerEntry webAppEntry = configPartition.lookup( forwardEntry.getId() );
+
+ WebApp app = new WebApp();
+ app.setWarFile( getString( "ads-httpWarFile", webAppEntry ) );
+
+ EntryAttribute ctxPathAttr = webAppEntry.get( "ads-httpAppCtxPath" );
+ if( ctxPathAttr != null )
+ {
+ app.setContextPath( ctxPathAttr.getString() );
+ }
+
+ webApps.add( app );
+ }
+
+ return webApps;
+ }
+
+
/**
* internal class used for holding the Interceptor classname and order configuration
*/