geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r492255 - in /geronimo/devtools/eclipse-plugin/trunk: ./ maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/ plugins/ plugins/org.apache.geronimo.runtime.common/META-INF/ plugins/org.apache.geroni...
Date Wed, 03 Jan 2007 19:03:34 GMT
Author: sppatel
Date: Wed Jan  3 11:03:34 2007
New Revision: 492255

URL: http://svn.apache.org/viewvc?view=rev&rev=492255
Log:
 r4215@dyn9027152175 (orig r491960):  sppatel | 2007-01-02 17:52:19 -0500
 remove duplicate copyright
 r4216@dyn9027152175 (orig r492190):  sppatel | 2007-01-03 10:56:49 -0500
 add mojo to validate bundle manifest entries
 r4217@dyn9027152175 (orig r492230):  sppatel | 2007-01-03 12:35:59 -0500
 fix bundle versions based on failed validation

Added:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/   (props changed)
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml

Propchange: geronimo/devtools/eclipse-plugin/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Wed Jan  3 11:03:34 2007
@@ -1,2 +1,2 @@
-13f79535-47bb-0310-9956-ffa450edef68:/geronimo/devtools/eclipse-plugin/branches/1.2.1:491876
+13f79535-47bb-0310-9956-ffa450edef68:/geronimo/devtools/eclipse-plugin/branches/1.2.1:492230
 47d51c14-9805-4038-8224-40f2b3020a56:/local/G1526-eclipse:3238

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java?view=auto&rev=492255
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
Wed Jan  3 11:03:34 2007
@@ -0,0 +1,94 @@
+/*
+ * 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.geronimo.eclipse.devtools;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.osgi.framework.Constants;
+
+/**
+ *@goal validatemanifest
+ */
+public class BundleManifestMojo extends AbstractMojo {
+
+	/**
+	 * @parameter expression="${project}"
+	 * @required
+	 */
+	private MavenProject project;
+
+	/**
+	 * @parameter expression="${project.basedir}/META-INF/MANIFEST.MF"
+	 * @required
+	 */
+	private File manifestFile;
+	
+	/**
+	 * @parameter
+	 */
+	private File classpathEntriesDir;
+	
+	/**
+	 * @parameter
+	 */
+	private boolean includeRootClasspathEntry = false;
+	
+	private Attributes attributes = null;
+
+	/* (non-Javadoc)
+	 * @see org.apache.maven.plugin.Mojo#execute()
+	 */
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		try {
+			FileInputStream fis = new FileInputStream(manifestFile);
+			Manifest manifest = new Manifest(fis);
+			attributes = manifest.getMainAttributes();
+			
+			validate(Constants.BUNDLE_SYMBOLICNAME, project.getName() + ";singleton:=true");
+			//validate(Constants.BUNDLE_NAME, project.getName());
+			validate(Constants.BUNDLE_VERSION, project.getVersion());
+			
+			if(classpathEntriesDir != null && classpathEntriesDir.exists()) {
+				File entries[] = classpathEntriesDir.listFiles();
+				if(entries.length > 0) {
+					if(includeRootClasspathEntry) {
+						
+					}
+				}
+			}
+			
+		} catch (Exception e) {
+			throw new MojoExecutionException(e.getMessage(), e);
+		}
+	}
+	
+	private void validate(String attribute, String correctValue) throws MojoFailureException
{
+		String currentValue = attributes.getValue(attribute).replaceAll(" ", "");
+		correctValue = attributes.getValue(attribute).replaceAll(" ", "");
+		if(!correctValue.equals(currentValue)) {
+			throw new MojoFailureException("Attribute value for " + attribute + " in bundle manifest
is incorrect. [Found: " + currentValue + "] [Expected: " + correctValue + "]");
+		}
+	}
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-geronimodevtools-plugin/src/main/java/org/apache/geronimo/eclipse/devtools/BundleManifestMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF?view=diff&rev=492255&r1=492254&r2=492255
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.runtime.common/META-INF/MANIFEST.MF
Wed Jan  3 11:03:34 2007
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Geronimo Common Runtime Plug-in
 Bundle-SymbolicName: org.apache.geronimo.runtime.common;singleton:=true
-Bundle-Version: 1.0.0
+Bundle-Version: 1.1.0
 Bundle-ClassPath: 
  lib/geronimo-j2ee-deployment_1.1_spec-1.0.jar,
  lib/commons-logging-1.0.4.jar,

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF?view=diff&rev=492255&r1=492254&r2=492255
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
Wed Jan  3 11:03:34 2007
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Geronimo Server Tools Core Plug-in
 Bundle-SymbolicName: org.apache.geronimo.st.core;singleton:=true
-Bundle-Version: 1.0.0
+Bundle-Version: 1.1.0
 Bundle-Activator: org.apache.geronimo.st.core.Activator
 Bundle-Vendor: Apache
 Bundle-Localization: plugin

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml?view=diff&rev=492255&r1=492254&r2=492255
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/pom.xml Wed Jan  3 11:03:34 2007
@@ -17,23 +17,6 @@
   ~ limitations under the License.
   -->
 
-<!--
-  ~ 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.
-  -->
-
 <!-- $Rev$ $Date$ -->
 
 <project>
@@ -79,6 +62,7 @@
                                 <goal>qualifier</goal>
                                 <goal>manifestbundles</goal>
                                 <goal>install</goal>
+                                <goal>validatemanifest</goal>
                             </goals>
                         </execution>
                     </executions>



Mime
View raw message