directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r371169 - in /directory/trunks/apacheds/standalone/daemon: ./ src/ src/main/ src/main/assembly/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/server/ src/m...
Date Sun, 22 Jan 2006 02:01:43 GMT
Author: akarasulu
Date: Sat Jan 21 18:01:39 2006
New Revision: 371169

URL: http://svn.apache.org/viewcvs?rev=371169&view=rev
Log:
initial checking ... needs lots of work

Added:
    directory/trunks/apacheds/standalone/daemon/pom.xml   (with props)
    directory/trunks/apacheds/standalone/daemon/src/
    directory/trunks/apacheds/standalone/daemon/src/main/
    directory/trunks/apacheds/standalone/daemon/src/main/assembly/
    directory/trunks/apacheds/standalone/daemon/src/main/assembly/bootstrapper.xml
    directory/trunks/apacheds/standalone/daemon/src/main/java/   (with props)
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
  (with props)
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java
  (with props)
Modified:
    directory/trunks/apacheds/standalone/daemon/   (props changed)

Propchange: directory/trunks/apacheds/standalone/daemon/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 21 18:01:39 2006
@@ -0,0 +1,11 @@
+target
+.settings
+.classpath
+.modules
+.wtpmodules
+.project
+*.log
+*.iml
+*.ipr
+*.iws
+.deployables

Added: directory/trunks/apacheds/standalone/daemon/pom.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/pom.xml?rev=371169&view=auto
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/pom.xml (added)
+++ directory/trunks/apacheds/standalone/daemon/pom.xml Sat Jan 21 18:01:39 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory</groupId>
+    <artifactId>build</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <version>0.9.4-SNAPSHOT</version>
+  <artifactId>org.apache.directory.server.standalone.daemon</artifactId>
+  <groupId>org.apache.directory.server.standalone.daemon</groupId>
+  <name>standalone-daemon</name>
+  <packaging>jar</packaging>
+  <description>
+  </description>
+  <distributionManagement>
+    <site>
+      <id>apache.websites</id>
+      <url>scp://minotaur.apache.org/www/directory.apache.org/newsite/subprojects/apacheds/projects/apacheds-standalone/</url>
+    </site>
+  </distributionManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>nlog4j</artifactId>
+      <version>1.2.19</version>
+      <!-- scope>provided</scope -->
+    </dependency>  
+    <dependency>
+      <groupId>commons-daemon</groupId>
+      <artifactId>commons-daemon</artifactId>
+      <version>1.0.1</version>
+    </dependency>  
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.apache.ldap.server.ServerMain</mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.apache.directory.server.standalone.daemon.Bootstrapper</mainClass>
+            </manifest> 
+          </archive>
+          <descriptor>src/main/assembly/bootstrapper.xml</descriptor>
+          <classifier>app</classifier>
+          <appendAssemblyId>false</appendAssemblyId>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
+

Propchange: directory/trunks/apacheds/standalone/daemon/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/trunks/apacheds/standalone/daemon/src/main/assembly/bootstrapper.xml
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/assembly/bootstrapper.xml?rev=371169&view=auto
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/assembly/bootstrapper.xml (added)
+++ directory/trunks/apacheds/standalone/daemon/src/main/assembly/bootstrapper.xml Sat Jan
21 18:01:39 2006
@@ -0,0 +1,38 @@
+<assembly>
+  <id>apacheds-main</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>target/classes</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <scope>runtime</scope>
+      <excludes>
+        <exclude>aopalliance:aopalliance</exclude>
+        <exclude>jasperreports:jasperreports</exclude>
+        <exclude>freemarker:freemarker</exclude>
+        <exclude>asm:asm-util</exclude>
+        <exclude>asm:asm</exclude>
+        <exclude>com.jamonapi:jamon</exclude>
+        <exclude>xerces:xerces</exclude>
+        <exclude>commons-pool:commons-pool</exclude>
+        <exclude>com.sun:tools</exclude>
+        <exclude>xml-apis:xml-apis</exclude>
+        <exclude>aspectwerkz:aspectwerkz-core</exclude>
+        <exclude>velocity:velocity</exclude>
+        <exclude>org.springframework:spring-aop</exclude>
+        <exclude>qdox:qdox</exclude>
+        <exclude>commons-attributes:commons-attributes-compiler</exclude>
+        <exclude>cglib:cglib</exclude>
+      </excludes>
+    </dependencySet>
+  </dependencySets>
+</assembly>

Propchange: directory/trunks/apacheds/standalone/daemon/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jan 21 18:01:39 2006
@@ -0,0 +1 @@
+META-INF

Added: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java?rev=371169&view=auto
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
(added)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
Sat Jan 21 18:01:39 2006
@@ -0,0 +1,353 @@
+/*
+ *   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.directory.server.standalone.daemon;
+
+
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class Bootstrapper
+{
+    private static final Logger log = LoggerFactory.getLogger( Bootstrapper.class );
+    private static final int CLASS_LOOKUP_FAILURE_EXITCODE = -1;
+    private static final int INSTANTIATION_FAILURE_EXITCODE = -2;
+    private static final int METHOD_LOOKUP_FAILURE_EXITCODE = -3;
+    private static final int INITIALIZATION_FAILURE_EXITCODE = -4;
+    private static final int START_FAILURE_EXITCODE = -5;
+    private static final int STOP_FAILURE_EXITCODE = -6;
+    private static final int BOOTSTRAP_PROPLOAD_FAILURE_EXITCODE = -7;
+    private static final String BOOTSTRAP_START_CLASS_PROP = "bootstrap.start.class";
+    private static final String BOOTSTRAP_STOP_CLASS_PROP = "bootstrap.stop.class";
+
+    private static Bootstrapper instance;
+    
+    private final Properties bootstrapProperties = new Properties();
+    private InstallationLayout install;
+    private ClassLoader appLoader;
+    private ClassLoader parentLoader;
+    private Object bootstrapped;
+
+    
+    public void setInstallationLayout( String installationBase )
+    {
+        install = new InstallationLayout( installationBase );
+        install.verifyInstallation();
+        try
+        {
+            bootstrapProperties.load( new FileInputStream( install.getBootstrapperConfigurationFile()
) );
+        }
+        catch ( Exception e )
+        {
+            log.error( "", e );
+            System.exit( BOOTSTRAP_PROPLOAD_FAILURE_EXITCODE );
+        }
+    }
+    
+    
+    public void setParentLoader( ClassLoader parentLoader )
+    {
+        this.parentLoader = parentLoader;
+        URL[] jars = install.getAllJars();
+        this.appLoader = new URLClassLoader( jars, parentLoader );
+    }
+
+
+    public void callInit( String className )
+    {
+        Class clazz = null;
+        Method op = null;
+        
+        try
+        {
+            clazz = appLoader.loadClass( className );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            log.error( "Could not find " + className, e );
+            System.exit( CLASS_LOOKUP_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            bootstrapped = clazz.newInstance();
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not instantiate " + className, e );
+            System.exit( INSTANTIATION_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            op = clazz.getMethod( "init", new Class[] { InstallationLayout.class } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find initialize(InstallationLayout) method for " + className,
e );
+            System.exit( METHOD_LOOKUP_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, new Object[] { this.install } );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + className + ".initialize(InstallationLayout)", e );
+            System.exit( INITIALIZATION_FAILURE_EXITCODE );
+        }
+    }
+
+    
+    public void callStart()
+    {
+        Class clazz = bootstrapped.getClass();
+        Method op = null;
+        
+        try
+        {
+            op = clazz.getMethod( "start", null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find start() method for " + clazz.getName(), e );
+            System.exit( METHOD_LOOKUP_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + clazz.getName() + ".initialize(InstallationLayout)",
e );
+            System.exit( START_FAILURE_EXITCODE );
+        }
+    }
+    
+
+    public void callStop( String className )
+    {
+        Class clazz = null;
+        Method op = null;
+        
+        try
+        {
+            clazz = appLoader.loadClass( className );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            log.error( "Could not find " + className, e );
+            System.exit( CLASS_LOOKUP_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            bootstrapped = clazz.newInstance();
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not instantiate " + className, e );
+            System.exit( INSTANTIATION_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            op = clazz.getMethod( "stop", null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Could not find initialize(InstallationLayout) method for " + className,
e );
+            System.exit( METHOD_LOOKUP_FAILURE_EXITCODE );
+        }
+        
+        try
+        {
+            op.invoke( bootstrapped, null );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Failed on " + className + ".stop(stop)", e );
+            System.exit( STOP_FAILURE_EXITCODE );
+        }
+    }
+
+    
+    // -----------------------------------------------------------------------
+    
+    
+    public void init( String[] args )
+    {
+        log.debug( "init(String[]) called" );
+
+        if ( install == null )
+        {
+            setInstallationLayout( args[0] );
+        }
+
+        if ( parentLoader == null )
+        {
+            log.info( "Trying to get handle on system classloader as the parent" );
+            setParentLoader( Thread.currentThread().getContextClassLoader() );
+            log.info( "systemLoader = " + parentLoader );
+        }
+        
+        callInit( bootstrapProperties.getProperty( BOOTSTRAP_START_CLASS_PROP, null ) );
+    }
+    
+    
+    public void stop() throws Exception
+    {
+        log.debug( "stop() called" );
+        callStop( bootstrapProperties.getProperty( BOOTSTRAP_STOP_CLASS_PROP, null )  );
+    }
+
+
+    public void destroy()
+    {
+        log.debug( "destroy() called" );
+    }
+
+
+    public void start()
+    {
+        log.debug( "start() called" );
+        Thread.currentThread().setContextClassLoader( parentLoader );
+        callStart();
+    }
+
+
+    public void start( String[] args )
+    {
+        log.debug( "start(String[]) called" );
+        Thread.currentThread().setContextClassLoader( this.parentLoader );
+        
+        if ( install == null && args.length > 0 )
+        {
+            setInstallationLayout( args[0] );
+            setParentLoader( Thread.currentThread().getContextClassLoader() );
+        }
+    }
+
+    
+    // ------------------------------------------------------------------------
+    // The main()
+    // ------------------------------------------------------------------------
+
+
+    public static void main( String[] args )
+    {
+        log.debug( "main(String[]) called" );
+        
+        // Noticed that some starts with jar2exe.exe pass in a null arguement list
+        if ( args == null )
+        {
+            System.err.println( "Arguements are null - how come?" );
+            log.error( "main() args were null shutting down!" );
+            printHelp();
+            System.exit( 1 );
+        }
+
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "main() recieved args:" );
+            for ( int ii = 0; ii < args.length; ii++ )
+            {
+                log.debug( "args[" + ii + "] = " + args[ii] );
+            }
+        }
+
+        if ( args.length > 1 )
+        {
+            if ( instance == null )
+            {
+                instance = new Bootstrapper();
+                instance.setInstallationLayout( args[0] );
+                instance.setParentLoader( Bootstrapper.class.getClassLoader() );
+            }
+        }
+        else
+        {
+            String msg = "Server exiting without required installation.home or command.name.";
+            System.err.println( msg );
+            log.error( msg );
+            printHelp();
+            System.exit( 1 );
+        }
+
+        String command = null;
+        if ( args.length > 0 )
+        {
+            command = args[args.length - 1];
+        }
+        else
+        {
+            String msg = "No command to start or stop was given?";
+            System.err.println( msg );
+            log.error( msg );
+            printHelp();
+            System.exit( 2 );
+        }
+
+        try
+        {
+            if ( command.equalsIgnoreCase( "start" ) )
+            {
+                log.debug( "calling init(String[]) from main(String[])" );
+                instance.init( args );
+
+                log.debug( "calling start(String[]) from main(String[])" );
+                instance.start( args );
+            }
+            else if ( command.equalsIgnoreCase( "stop" ) )
+            {
+                log.debug( "calling stop() from main(String[])" );
+                instance.stop();
+                instance.destroy();
+            }
+            else
+            {
+                log.error( "Unrecognized command " + command );
+                printHelp();
+                System.exit( 3 );
+            }
+        }
+        catch ( Throwable t )
+        {
+            t.printStackTrace();
+            System.exit( 4 );
+        }
+    }
+
+
+    private static void printHelp()
+    {
+        System.err.println("java -jar bootstrap.jar <app.home> <command.name>");
+    }
+}

Propchange: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java?rev=371169&view=auto
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java
(added)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java
Sat Jan 21 18:01:39 2006
@@ -0,0 +1,304 @@
+/*
+ *   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.directory.server.standalone.daemon;
+
+
+import java.io.File;
+import java.io.FileFilter;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Convenience class to encapsulate paths to various folders and files within
+ * an installation.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class InstallationLayout
+{
+    private final static Logger log = LoggerFactory.getLogger( InstallationLayout.class );
+    private final static FileFilter JAR_FILTER;
+    
+    static 
+    {
+        JAR_FILTER = new FileFilter() 
+        {
+            public boolean accept( File pathname )
+            {
+                return pathname.isFile() && pathname.getName().endsWith( ".jar" );
+            }
+        };
+    }
+    
+    private final File baseDirectory;
+    private transient File[] dirs;
+    private transient File[] files;
+    private transient URL[] allJars = null;
+    private transient URL[] dependentJars = null;
+    private transient URL[] extensionJars = null;
+
+    
+    public InstallationLayout( File baseDirectory )
+    {
+        this.baseDirectory = baseDirectory;
+    }
+    
+    
+    public InstallationLayout( String baseDirectoryPath )
+    {
+        this.baseDirectory = new File( baseDirectoryPath );
+    }
+    
+    
+    public File getBaseDirectory()
+    {
+        return baseDirectory;
+    }
+    
+    
+    public File getBinDirectory()
+    {
+        return new File( baseDirectory, "bin" );
+    }
+    
+    
+    public File getLibDirectory()
+    {
+        return new File( baseDirectory, "lib" );
+    }
+    
+    
+    public File getVarDirectory()
+    {
+        return new File( baseDirectory, "var" );
+    }
+    
+    
+    public File getLogDirectory()
+    {
+        return new File( getVarDirectory(), "log" );
+    }
+    
+    
+    public File getRunDirectory()
+    {
+        return new File( getVarDirectory(), "run" );
+    }
+    
+    
+    public File getPidFile()
+    {
+        return new File( getRunDirectory(), "server.pid" );
+    }
+    
+    
+    public File getBootstrapper()
+    {
+        return new File( getBinDirectory(), "bootstrapper.jar" );
+    }
+    
+    
+    public File getExtensionsDirectory()
+    {
+        return new File( getLibDirectory(), "ext" );
+    }
+    
+    
+    public File getPartitionsDirectory()
+    {
+        return new File( getVarDirectory(), "partitions" );
+    }
+    
+    
+    public File getConfigurationFile()
+    {
+        return new File( baseDirectory, "server.xml" );
+    }
+
+    
+    public File getBootstrapperConfigurationFile()
+    {
+        return new File( getBinDirectory(), "bootstrapper.properties" );
+    }
+
+    
+    public void init()
+    {
+        if ( dirs == null )
+        {
+            dirs = new File[] {
+                this.getBaseDirectory(),
+                this.getBinDirectory(),
+                this.getLibDirectory(),
+                this.getExtensionsDirectory(),
+                this.getVarDirectory(),
+                this.getLogDirectory(),
+                this.getPartitionsDirectory(),
+                this.getRunDirectory()
+            };
+        }
+        
+        if ( files == null )
+        {
+            // pid file 
+            files = new File[] {
+                this.getBootstrapper(),
+                this.getBootstrapperConfigurationFile()
+            };
+        }
+    }
+    
+    
+    public void verifyInstallation()
+    {
+        init();
+        
+        for ( int ii = 0; ii < dirs.length; ii++ )
+        {
+            if ( ! dirs[ii].exists() )
+            {
+                throw new IllegalStateException( dirs[ii] + " does not exist!" );
+            }
+            
+            if ( dirs[ii].isFile() )
+            {
+                throw new IllegalStateException( dirs[ii] + " is a file when it should be
a directory." );
+            }
+            
+            if ( ! dirs[ii].canWrite() )
+            {
+                throw new IllegalStateException( dirs[ii] + " is write protected from the
current user: " 
+                    + System.getProperty( "java.user" ) );
+            }
+        }
+        
+        for ( int ii = 0; ii < files.length; ii++ )
+        {
+            if ( ! files[ii].exists() )
+            {
+                throw new IllegalStateException( files[ii] + " does not exist!" );
+            }
+            
+            if ( files[ii].isDirectory() )
+            {
+                throw new IllegalStateException( files[ii] + " is a directory when it should
be a file." );
+            }
+            
+            if ( ! dirs[ii].canRead() )
+            {
+                throw new IllegalStateException( files[ii] + " is not readable by the current
user: " 
+                    + System.getProperty( "java.user" ) );
+            }
+        }
+    }
+    
+    
+    public void mkdirs()
+    {
+        init();
+        
+        for ( int ii = 0; ii < dirs.length; ii++ )
+        {
+            dirs[ii].mkdirs();
+        }
+    }
+    
+    
+    public URL[] getDependentJars()
+    {
+        if ( dependentJars == null )
+        {
+            File[] deps = getLibDirectory().listFiles( new FileFilter() {
+                public boolean accept( File pathname )
+                {
+                    return pathname.isFile() && pathname.getName().endsWith( ".jar"
);
+                }
+            });
+            
+            dependentJars = new URL[deps.length];
+            for ( int ii = 0; ii < deps.length; ii++ )
+            {
+                try
+                {
+                    dependentJars[ii] = deps[ii].toURL();
+                }
+                catch ( MalformedURLException e )
+                {
+                    log.error( "Failed to generate a URL for " + deps[ii] + 
+                    ".  It will not be added to the dependencies." );
+                }
+            }
+        }
+        
+        return dependentJars;
+    }
+
+
+    public URL[] getExtensionJars()
+    {
+        if ( extensionJars == null )
+        {
+            File[] extensions = getExtensionsDirectory().listFiles( JAR_FILTER );
+            
+            extensionJars = new URL[extensions.length];
+            for ( int ii = 0; ii < extensions.length; ii++ )
+            {
+                try
+                {
+                    extensionJars[ii] = extensions[ii].toURL();
+                }
+                catch ( MalformedURLException e )
+                {
+                    log.error( "Failed to generate a URL for " + extensions[ii] + 
+                        ".  It will not be added to the extensions." );
+                }
+            }
+        }
+        
+        return extensionJars;
+    }
+
+
+    public URL[] getAllJars()
+    {
+        if ( allJars == null )
+        {
+            int dependentLength = getDependentJars().length;
+            int extensionLength = getExtensionJars().length;
+            allJars = new URL[ dependentLength + extensionLength ];
+            
+            for ( int ii = 0; ii < allJars.length; ii++ )
+            {
+                if ( ii < dependentLength )
+                {
+                    allJars[ii] = dependentJars[ii];
+                }
+                else
+                {
+                    allJars[ii] = extensionJars[ii - dependentLength];
+                }
+            }
+        }
+        
+        return allJars;
+    }
+}

Propchange: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/InstallationLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message