directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r998683 - in /directory/sandbox/studio-persistence-tooling: persistence-core/src/main/java/org/apache/directory/studio/persistence/core/ persistence-core/src/main/resources/ persistence-ui/src/main/java/org/apache/directory/studio/persisten...
Date Sun, 19 Sep 2010 15:36:05 GMT
Author: seelmann
Date: Sun Sep 19 15:36:04 2010
New Revision: 998683

URL: http://svn.apache.org/viewvc?rev=998683&view=rev
Log:
Applied patch from Kasun Lakpriya for DIRSTUDIO-693 (Persistence Tooling should create full
maven project)

Added:
    directory/sandbox/studio-persistence-tooling/persistence-core/src/main/resources/pom.vm
Modified:
    directory/sandbox/studio-persistence-tooling/persistence-core/src/main/java/org/apache/directory/studio/persistence/core/CodeGenerator.java
    directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java
    directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java

Modified: directory/sandbox/studio-persistence-tooling/persistence-core/src/main/java/org/apache/directory/studio/persistence/core/CodeGenerator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-core/src/main/java/org/apache/directory/studio/persistence/core/CodeGenerator.java?rev=998683&r1=998682&r2=998683&view=diff
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-core/src/main/java/org/apache/directory/studio/persistence/core/CodeGenerator.java
(original)
+++ directory/sandbox/studio-persistence-tooling/persistence-core/src/main/java/org/apache/directory/studio/persistence/core/CodeGenerator.java
Sun Sep 19 15:36:04 2010
@@ -78,7 +78,7 @@ public class CodeGenerator
             {
                 System.out.println( "CodeGenerator : Syntax error in template " + templateFile
);
             }
-            String path = generatorContext.getProjectFolderPath() + "/"
+            String path = generatorContext.getProjectFolderPath() + "/src/main/java/"
                 + generatorContext.getPackageName().replace( ".", "/" );
             new File( path ).mkdirs();
             File javaFile = new File( path + "/" + generatorContext.getClassName() + ".java"
);
@@ -129,7 +129,7 @@ public class CodeGenerator
             {
                 System.out.println( "CodeGenerator : Syntax error in template " + templateFile
);
             }
-            String path = generatorContext.getProjectFolderPath() + "/"
+            String path = generatorContext.getProjectFolderPath() + "/src/main/java/"
                 + generatorContext.getPackageName().replace( ".", "/" );
             new File( path + "/dao" ).mkdirs();
             File javaFile = new File( path + "/dao/" + generatorContext.getClassName() +
"Dao.java" );
@@ -146,6 +146,51 @@ public class CodeGenerator
 
 
     /**
+     * This generates the pom.xml for the generated source 
+     *
+     * @param generatorContext 
+     * 
+     * @param templateFile the Apache Velocity template to be used to generate 
+     *        pom.xml class
+     */
+    public void generatePom( CodeGeneratorContext generatorContext, String templateFile )
+    {
+        try
+        {
+            Properties properties = new Properties();
+            properties.load( getClass().getResourceAsStream( "/velocity.properties" ) );
+            Velocity.init( properties );
+            VelocityContext context = new VelocityContext();
+            context.put( "package", generatorContext.getPackageName() );
+            Template template = null;
+            try
+            {
+                template = Velocity.getTemplate( templateFile );
+            }
+            catch ( ResourceNotFoundException rnfe )
+            {
+                System.out.println( "CodeGenerator : error : cannot find template " + templateFile
);
+            }
+            catch ( ParseErrorException pee )
+            {
+                System.out.println( "CodeGenerator : Syntax error in template " + templateFile
);
+            }
+            String path = generatorContext.getProjectFolderPath() + "/";
+            new File( path ).mkdirs();
+            File pomFile = new File( path + "pom.xml" );
+            BufferedWriter writer = new BufferedWriter( new FileWriter( pomFile ) );
+            if ( template != null )
+                template.merge( context, writer );
+            writer.flush();
+        }
+        catch ( Exception e )
+        {
+            System.out.println( e );
+        }
+    }
+
+
+    /**
      * This generates the GenericLdapDao abstract class and all the Dao classes generated
      * are inherited from this one
      *
@@ -180,7 +225,7 @@ public class CodeGenerator
             {
                 System.out.println( "CodeGenerator : Syntax error in template " + templateFile
);
             }
-            String path = generatorContext.getProjectFolderPath() + "/"
+            String path = generatorContext.getProjectFolderPath() + "/src/main/java/"
                 + generatorContext.getPackageName().replace( ".", "/" );
             new File( path + "/dao" ).mkdirs();
             File javaFile = new File( path + "/dao/" + "GenericLdapDao.java" );

Added: directory/sandbox/studio-persistence-tooling/persistence-core/src/main/resources/pom.vm
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-core/src/main/resources/pom.vm?rev=998683&view=auto
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-core/src/main/resources/pom.vm
(added)
+++ directory/sandbox/studio-persistence-tooling/persistence-core/src/main/resources/pom.vm
Sun Sep 19 15:36:04 2010
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<!-- @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>$package</groupId>
+	<artifactId>example</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>Apache Directory Studio LDAP Persistence Tooling Example</name>
+	<description />
+
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>2.8</version>
+				<configuration>
+					<downloadSources>true</downloadSources>
+					<downloadJavadocs>true</downloadJavadocs>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.1</version>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+					<optimize>true</optimize>
+					<showDeprecations>true</showDeprecations>
+					<encoding>ISO-8859-1</encoding>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.directory.client.ldap</groupId>
+			<artifactId>ldap-client-api</artifactId>
+			<version>0.1</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.server</groupId>
+			<artifactId>apacheds-core-annotations</artifactId>
+			<version>1.5.6</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.server</groupId>
+			<artifactId>apacheds-core-api</artifactId>
+			<version>1.5.6</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.server</groupId>
+			<artifactId>apacheds-protocol-ldap</artifactId>
+			<version>1.5.6</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.server</groupId>
+			<artifactId>apacheds-server-annotations</artifactId>
+			<version>1.5.6</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.server</groupId>
+			<artifactId>apacheds-test-framework</artifactId>
+			<version>1.5.6</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>1.2.16</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>1.5.10</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.8.1</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

Modified: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java?rev=998683&r1=998682&r2=998683&view=diff
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java
(original)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizard.java
Sun Sep 19 15:36:04 2010
@@ -66,6 +66,7 @@ public class NewPersistenceCodeWizard ex
         codeGenerator.generateCode( codeGeneratorContext, "java_template.vm" );
         codeGenerator.generateGenericDaoCode( codeGeneratorContext, "genericLdapDao_template.vm"
);
         codeGenerator.generateDaoCode( codeGeneratorContext, "dao_template.vm" );
+        codeGenerator.generatePom( codeGeneratorContext, "pom.vm" );
         return true;
     }
 

Modified: directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java?rev=998683&r1=998682&r2=998683&view=diff
==============================================================================
--- directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java
(original)
+++ directory/sandbox/studio-persistence-tooling/persistence-ui/src/main/java/org/apache/directory/studio/persistence/view/wizards/NewPersistenceCodeWizardPage.java
Sun Sep 19 15:36:04 2010
@@ -195,7 +195,7 @@ public class NewPersistenceCodeWizardPag
         if ( selectedDirectory != null )
         {
             projectFolderText.setText( selectedDirectory );
-            codeGenContext.setProjectFolderPath( selectedDirectory + "/src/main/java" );
+            codeGenContext.setProjectFolderPath( selectedDirectory );
         }
     }
 



Mime
View raw message