You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/12/15 03:22:40 UTC
svn commit: r487431 - in /directory/branches/trunks/schema/apacheds:
bootstrap-partition/ bootstrap-partition/src/main/java/org/
bootstrap-partition/src/main/java/org/apache/
bootstrap-partition/src/main/java/org/apache/directory/
bootstrap-partition/s...
Author: akarasulu
Date: Thu Dec 14 18:22:39 2006
New Revision: 487431
URL: http://svn.apache.org/viewvc?view=rev&rev=487431
Log:
changes ...
o fixed issue with phase of bootstrap plugin which was no longer including db
files into the jar
o added preliminary jar extractor
o added test case for jar extractor
Added:
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractor.java
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractorTest.java
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/resources/
directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/resources/test.jar (with props)
Modified:
directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml
directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
Modified: directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml?view=diff&rev=487431&r1=487430&r2=487431
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-partition/pom.xml Thu Dec 14 18:22:39 2006
@@ -34,6 +34,22 @@
</dependencies>
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>jarFilePath</name>
+ <value>${basedir}/src/test/resources/test.jar</value>
+ </property>
+ <property>
+ <name>destDirPath</name>
+ <value>${basedir}/target/extracted</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-bootstrap-plugin</artifactId>
Added: directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractor.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractor.java?view=auto&rev=487431
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractor.java (added)
+++ directory/branches/trunks/schema/apacheds/bootstrap-partition/src/main/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractor.java Thu Dec 14 18:22:39 2006
@@ -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.directory.server.core.schema.bootstrap.partition;
+
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SchemaPartitionExtractor
+{
+ private static final String[] EMPTY = new String[0];
+
+
+ public static String[] extract( File jarFile, File destDir ) throws IOException
+ {
+ byte[] buf = new byte[512];
+ File schemaDir = new File( destDir, "schema" );
+ if ( ! schemaDir.exists() )
+ {
+ schemaDir.mkdirs();
+ }
+
+ List<String> files = new ArrayList<String>();
+ JarFile jar = new JarFile( jarFile );
+ Enumeration entries = jar.entries();
+ while ( entries.hasMoreElements() )
+ {
+ ZipEntry entry = ( ZipEntry ) entries.nextElement();
+ System.out.println( "entry name = " + entry.getName() );
+ if ( entry.getName().startsWith( "schema" ) )
+ {
+ if ( entry.isDirectory() )
+ {
+ continue;
+ }
+
+ File outFile = new File( destDir, entry.getName() );
+ FileOutputStream out = new FileOutputStream( outFile );
+ InputStream in = jar.getInputStream( entry );
+ while ( in.available() > 0 )
+ {
+ int readCount = in.read( buf );
+ out.write( buf, 0, readCount );
+ }
+ out.flush();
+ out.close();
+ in.close();
+ }
+ }
+
+ return files.toArray( EMPTY );
+ }
+}
Added: directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractorTest.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractorTest.java?view=auto&rev=487431
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractorTest.java (added)
+++ directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/java/org/apache/directory/server/core/schema/bootstrap/partition/SchemaPartitionExtractorTest.java Thu Dec 14 18:22:39 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.directory.server.core.schema.bootstrap.partition;
+
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SchemaPartitionExtractorTest extends TestCase
+{
+ public void testExtract() throws Exception
+ {
+ String jarFilePath = System.getProperty( "jarFilePath" );
+ String destDirPath = System.getProperty( "destDirPath" );
+ SchemaPartitionExtractor.extract( new File( jarFilePath ), new File( destDirPath ) );
+ }
+}
Added: directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/resources/test.jar
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/resources/test.jar?view=auto&rev=487431
==============================================================================
Binary file - no diff available.
Propchange: directory/branches/trunks/schema/apacheds/bootstrap-partition/src/test/resources/test.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?view=diff&rev=487431&r1=487430&r2=487431
==============================================================================
--- directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/branches/trunks/schema/apacheds/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Thu Dec 14 18:22:39 2006
@@ -69,7 +69,7 @@
*
* @goal load
* @description creates and pre-loads ApacheDS schema partition
- * @phase package
+ * @phase compile
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/