o Update artifact name and urls
authorStefan Seelmann <seelmann@apache.org>
Thu, 12 Nov 2009 22:28:53 +0000 (22:28 +0000)
committerStefan Seelmann <seelmann@apache.org>
Thu, 12 Nov 2009 22:28:53 +0000 (22:28 +0000)
o Update to ApacheDS 1.5.5 and Jetty 6.1.21
o Set archetype version to 1.5.5-SNAPSHOT to indicate that is works with ApacheDS 1.5.5 only

git-svn-id: https://svn.apache.org/repos/asf/directory/samples/trunk@835609 13f79535-47bb-0310-9956-ffa450edef68

apacheds-archetype-webapp/archetype-catalog.xml
apacheds-archetype-webapp/pom.xml
apacheds-archetype-webapp/src/main/resources/META-INF/maven/archetype-metadata.xml
apacheds-archetype-webapp/src/main/resources/META-INF/maven/archetype.xml
apacheds-archetype-webapp/src/main/resources/archetype-resources/pom.xml
apacheds-archetype-webapp/src/main/resources/archetype-resources/src/main/java/RootDseServlet.java
apacheds-archetype-webapp/src/main/resources/archetype-resources/src/main/java/StartStopListener.java
apacheds-archetype-webapp/src/site/apt/index.apt

index f1d485c..bc03797 100644 (file)
   <archetypes>
     <archetype>
       <groupId>org.apache.directory.samples</groupId>
-      <artifactId>apacheds-webapp</artifactId>
-      <version>1.0-SNAPSHOT</version>
+      <artifactId>apacheds-archetype-webapp</artifactId>
+      <version>1.5.5-SNAPSHOT</version>
       <!-- FIX ME after the first release
       <version>RELEASE</version>
        -->
       <description>Creates ApacheDS as an embedded Web Application</description>
     </archetype>
   </archetypes>
-</archetype-catalog>
\ No newline at end of file
+</archetype-catalog>
index ce1e595..aa9befd 100644 (file)
@@ -28,10 +28,11 @@ under the License.
   </parent>
 
   <groupId>org.apache.directory.samples</groupId>
-  <artifactId>apacheds-webapp</artifactId>
+  <artifactId>apacheds-archetype-webapp</artifactId>
   <packaging>maven-archetype</packaging>
-  <name>Archetype to embed ApacheDS as a Web Application</name>
-  <version>1.0-SNAPSHOT</version>
+  <name>ApacheDS Archetype Web Application</name>
+  <description>Archetype to embed ApacheDS as a Web Application</description>
+  <version>1.5.5-SNAPSHOT</version>
 
   <prerequisites>
     <maven>2.0.9</maven>
@@ -45,9 +46,9 @@ under the License.
   </issueManagement>
 
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-webapp/</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-webapp/</developerConnection>
-    <url>https://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-webapp/</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-archetype-webapp/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-archetype-webapp/</developerConnection>
+    <url>https://svn.apache.org/viewvc/directory/samples/trunk/apacheds-archetype-webapp/</url>
   </scm>
 
   <distributionManagement>
@@ -58,7 +59,7 @@ under the License.
   </distributionManagement>
   
   <properties>
-    <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/samples/apacheds-webapp/gen-docs/${version}/</distMgmtSiteUrl>
+    <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/samples/apacheds-archetype-webapp/gen-docs/${version}/</distMgmtSiteUrl>
     <skin.version>1.0.0</skin.version>
   </properties>
 
@@ -67,13 +68,13 @@ under the License.
       <extension>
         <groupId>org.apache.maven.archetype</groupId>
         <artifactId>archetype-packaging</artifactId>
-        <version>2.0-alpha-3</version>
+        <version>2.0-alpha-4</version>
       </extension>
     </extensions>
     <plugins>
       <plugin>
         <artifactId>maven-archetype-plugin</artifactId>
-        <version>2.0-alpha-3</version>
+        <version>2.0-alpha-4</version>
         <extensions>true</extensions>
       </plugin>
     </plugins>
index 74e921b..d947a14 100644 (file)
@@ -17,7 +17,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 -->
-<archetype-descriptor name="apacheds-webapp">
+<archetype-descriptor name="apacheds-archetype-webapp">
   <requiredProperties>
     <requiredProperty key="groupId">
       <defaultValue>org.example</defaultValue>
index 13e7483..80f0958 100644 (file)
@@ -18,7 +18,7 @@ specific language governing permissions and limitations
 under the License.
 -->
 <archetype>
-  <id>apacheds-webapp</id>
+  <id>apacheds-archetype-webapp</id>
   <sources>
     <source>src/main/java/RootDseServlet.java</source>
     <source>src/main/java/StartStopListener.java</source>
index 89290d6..7b3a44f 100644 (file)
@@ -47,7 +47,7 @@ under the License.
       <plugin>
         <artifactId>maven-jetty-plugin</artifactId>
         <groupId>org.mortbay.jetty</groupId>
-        <version>6.1.10</version>
+        <version>6.1.21</version>
         <configuration>
           <contextPath>/ApacheDS</contextPath>
           <connectors>
@@ -63,153 +63,13 @@ under the License.
   <dependencies>
     <dependency>
       <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-bootstrap-extract</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-bootstrap-partition</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-avl</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-cursor</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-entry</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-jndi</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-core-shared</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-jdbm</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-jdbm-store</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-protocol-ldap</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-protocol-shared</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-schema-bootstrap</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-schema-registries</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-utils</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-xdbm-base</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.server</groupId>
-      <artifactId>apacheds-xdbm-search</artifactId>
-      <version>1.5.4</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-collections</groupId>
-      <artifactId>commons-collections</artifactId>
-      <version>3.2.1</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-lang</groupId>
-      <artifactId>commons-lang</artifactId>
-      <version>2.4</version>
-    </dependency>
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <version>1.2.14</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.mina</groupId>
-      <artifactId>mina-core</artifactId>
-      <version>1.1.7</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.mina</groupId>
-      <artifactId>mina-filter-ssl</artifactId>
-      <version>1.1.7</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-asn1</artifactId>
-      <version>0.9.12</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-asn1-codec</artifactId>
-      <version>0.9.12</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-bouncycastle-reduced</artifactId>
-      <version>0.9.12</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-ldap</artifactId>
-      <version>0.9.12</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-ldap-constants</artifactId>
-      <version>0.9.12</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.5.2</version>
+      <version>1.5.5</version>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
-      <version>1.5.2</version>
-    </dependency>
-    <dependency>
-      <groupId>antlr</groupId>
-      <artifactId>antlr</artifactId>
-      <version>2.7.7</version>
+      <version>1.5.6</version>
     </dependency>
     <dependency>
       <artifactId>servlet-api</artifactId>
index 2cc6bbd..ecc7513 100644 (file)
@@ -19,6 +19,7 @@
  */
 package ${package};
 
+
 import java.io.PrintWriter;
 import java.util.Hashtable;
 
@@ -39,73 +40,81 @@ import javax.servlet.http.HttpServletResponse;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
 
+
 /**
  * A servlet which displays the Root DSE of the embedded server.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory
  *         Project</a>
  */
-public class RootDseServlet extends HttpServlet {
+public class RootDseServlet extends HttpServlet
+{
 
     private static final long serialVersionUID = 1L;
 
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-            throws ServletException {
 
-        try {
-            resp.setContentType("text/plain");
+    protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException
+    {
+        try
+        {
+            resp.setContentType( "text/plain" );
             PrintWriter out = resp.getWriter();
 
-            out.println("*** ApacheDS RootDSE ***\n");
+            out.println( "*** ApacheDS RootDSE ***\n" );
 
-            DirContext ctx = new InitialDirContext(this.createEnv());
+            DirContext ctx = new InitialDirContext( this.createEnv() );
 
             SearchControls ctls = new SearchControls();
-            ctls.setReturningAttributes(new String[] { "*", "+" });
-            ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
+            ctls.setReturningAttributes( new String[]
+                { "*", "+" } );
+            ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
 
-            NamingEnumeration<SearchResult> result = ctx.search("",
-                    "(objectClass=*)", ctls);
-            if (result.hasMore()) {
+            NamingEnumeration<SearchResult> result = ctx.search( "", "(objectClass=*)", ctls );
+            if ( result.hasMore() )
+            {
                 SearchResult entry = result.next();
                 Attributes as = entry.getAttributes();
 
                 NamingEnumeration<String> ids = as.getIDs();
-                while (ids.hasMore()) {
+                while ( ids.hasMore() )
+                {
                     String id = ids.next();
-                    Attribute attr = as.get(id);
-                    for (int i = 0; i < attr.size(); ++i) {
-                        out.println(id + ": " + attr.get(i));
+                    Attribute attr = as.get( id );
+                    for ( int i = 0; i < attr.size(); ++i )
+                    {
+                        out.println( id + ": " + attr.get( i ) );
                     }
                 }
             }
             ctx.close();
 
             out.flush();
-        } catch (Exception e) {
-            throw new ServletException(e);
+        }
+        catch ( Exception e )
+        {
+            throw new ServletException( e );
         }
     }
 
+
     /**
      * Creates an environment configuration for JNDI access.
      */
-    protected Hashtable<Object, Object> createEnv() {
-
+    protected Hashtable<Object, Object> createEnv()
+    {
         // Fetch directory service from servlet context
         ServletContext servletContext = this.getServletContext();
-        DirectoryService directoryService = (DirectoryService) servletContext
-                .getAttribute(DirectoryService.JNDI_KEY);
+        DirectoryService directoryService = ( DirectoryService ) servletContext
+            .getAttribute( DirectoryService.JNDI_KEY );
 
         Hashtable<Object, Object> env = new Hashtable<Object, Object>();
-        env.put(DirectoryService.JNDI_KEY, directoryService);
-        env.put(Context.PROVIDER_URL, "");
-        env.put(Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class
-                .getName());
-
-        env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
-        env.put(Context.SECURITY_CREDENTIALS, "secret");
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put( DirectoryService.JNDI_KEY, directoryService );
+        env.put( Context.PROVIDER_URL, "" );
+        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
+
+        env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+        env.put( Context.SECURITY_CREDENTIALS, "secret" );
+        env.put( Context.SECURITY_AUTHENTICATION, "simple" );
 
         return env;
     }
index 2b0eda1..0582767 100644 (file)
@@ -19,6 +19,7 @@
  */
 package ${package};
 
+
 import java.io.File;
 
 import javax.servlet.ServletContext;
@@ -27,8 +28,9 @@ import javax.servlet.ServletContextListener;
 
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.ldap.LdapService;
-import org.apache.directory.server.protocol.shared.SocketAcceptor;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.protocol.shared.transport.TcpTransport;
+
 
 /**
  * A Servlet context listener to start and stop ApacheDS.
@@ -36,57 +38,63 @@ import org.apache.directory.server.protocol.shared.SocketAcceptor;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory
  *         Project</a>
  */
-public class StartStopListener implements ServletContextListener {
+public class StartStopListener implements ServletContextListener
+{
 
     private DirectoryService directoryService;
 
-    private SocketAcceptor socketAcceptor;
-    private LdapService ldapService;
+    private LdapServer ldapServer;
+
 
     /**
      * Startup ApacheDS embedded.
      */
-    public void contextInitialized(ServletContextEvent evt) {
-
-        try {
+    public void contextInitialized( ServletContextEvent evt )
+    {
+        try
+        {
             directoryService = new DefaultDirectoryService();
-            directoryService.setShutdownHookEnabled(true);
+            directoryService.setShutdownHookEnabled( true );
 
-            socketAcceptor = new SocketAcceptor(null);
-            ldapService = new LdapService();
-            ldapService.setSocketAcceptor(socketAcceptor);
-            ldapService.setDirectoryService(directoryService);
+            ldapServer = new LdapServer();
+            ldapServer.setDirectoryService( directoryService );
+            ldapServer.setAllowAnonymousAccess( true );
 
             // Set LDAP port to 10389
-            ldapService.setIpPort(10389);
+            TcpTransport ldapTransport = new TcpTransport( 10389 );
+            ldapServer.setTransports( ldapTransport );
 
             // Determine an appropriate working directory
             ServletContext servletContext = evt.getServletContext();
-            File workingDir = (File) servletContext
-                    .getAttribute("javax.servlet.context.tempdir");
-            directoryService.setWorkingDirectory(workingDir);
+            File workingDir = ( File ) servletContext.getAttribute( "javax.servlet.context.tempdir" );
+            directoryService.setWorkingDirectory( workingDir );
 
             directoryService.startup();
-            ldapService.start();
+            ldapServer.start();
 
             // Store directoryService in context to provide it to servlets etc.
-            servletContext.setAttribute(DirectoryService.JNDI_KEY,
-                    directoryService);
-
-        } catch (Exception e) {
-            throw new RuntimeException(e);
+            servletContext.setAttribute( DirectoryService.JNDI_KEY, directoryService );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
         }
     }
 
+
     /**
      * Shutdown ApacheDS embedded.
      */
-    public void contextDestroyed(ServletContextEvent evt) {
-        try {
-            ldapService.stop();
+    public void contextDestroyed( ServletContextEvent evt )
+    {
+        try
+        {
+            ldapServer.stop();
             directoryService.shutdown();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
         }
     }
 }
\ No newline at end of file
index 89f1653..7e1d482 100644 (file)
@@ -33,24 +33,41 @@ ApacheDS-Webapp Archetype
 
 * Usage
 
-  Change to your preferred location to create the new project and execute following command:
+  To use the archetype you'll need to check it out and install it to your local repository:
 
 +---
-mvn archetype:generate \
-  -DgroupId=org.example \
-  -DartifactId=myProject \
-  -Dversion=1.0-SNAPSHOT \
-  -DarchetypeGroupId=org.apache.directory.samples \
-  -DarchetypeArtifactId=apacheds-webapp \
-  -DarchetypeVersion=1.0-SNAPSHOT \
-  -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
+svn co http://svn.apache.org/repos/asf/directory/samples/trunk/apacheds-archetype-webapp
+cd apacheds-archetype-webapp
+mvn install
 +---
 
-  or
-  
+  Then change to your preferred location to create the new project and execute following command: 
+
 +---
-mvn archetype:generate -DarchetypeCatalog=http://directory.apache.org -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
+mvn archetype:generate -DarchetypeGroupId=org.apache.directory.samples \
+                       -DarchetypeArtifactId=apacheds-archetype-webapp \
+                       -DarchetypeVersion=1.5.5-SNAPSHOT \
+                       -DgroupId=org.example -DartifactId=myProject -Dversion=1.0-SNAPSHOT 
 +---
+~~
+~~  Change to your preferred location to create the new project and execute following command:
+~~
+~~+---
+~~mvn archetype:generate \
+~~  -DgroupId=org.example \
+~~  -DartifactId=myProject \
+~~  -Dversion=1.0-SNAPSHOT \
+~~  -DarchetypeGroupId=org.apache.directory.samples \
+~~  -DarchetypeArtifactId=apacheds-webapp \
+~~  -DarchetypeVersion=1.0-SNAPSHOT \
+~~  -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
+~~+---
+~~
+~~  or
+~~  
+~~+---
+~~mvn archetype:generate -DarchetypeCatalog=http://directory.apache.org -DarchetypeRepository=http://vm094.oxylos.org/mirror-maven2/
+~~+---
 
   \
   Then change to the created directory (myProject by default) and run the created webapp
@@ -62,4 +79,4 @@ mvn jetty:run
 
   and point your browser to {{http://localhost:8080/ApacheDS/RootDse}}.
   
-  For more information see also the {{{http://cwiki.apache.org/confluence/display/DIRxSRVx11/Embedding+ApacheDS+as+a+Web+Application}wiki page}}.
\ No newline at end of file
+  For more information see also the {{{http://directory.apache.org/apacheds/1.5/43-embedding-apacheds-as-a-web-application.html}wiki page}}.