[maven-release-plugin]  copy for tag karaf-2.1.0

git-svn-id: https://svn.apache.org/repos/asf/karaf/tags/karaf-2.1.0@999387 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 2bd9224..08d706e 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -19,6 +19,17 @@
                     Apache Karaf 2.1.0
                     ==================
 
+  Overview
+  --------
+
+   New to this release of Apache Karaf is a JAAS Database Login Module, a way to store
+ passwords in a secured way, a mechanism that allows a karaf application to distinguish 
+ between UserPrincipal and RolePrincipal without depending from the Karaf JAAS Module. 
+   The shell console has been enhanced to be available in a plain non-OSGi environment and
+ smart tab completion has been improved, along with various commands. 
+   We have also resolved a number of outstanding issues, and improved support on OS X and 
+ IBM Java based systems. For more detail please see the change log below.
+
   Changelog
   ---------
 
diff --git a/archetypes/command/pom.xml b/archetypes/command/pom.xml
index 042f2af..7bddecf 100644
--- a/archetypes/command/pom.xml
+++ b/archetypes/command/pom.xml
@@ -1,4 +1,20 @@
 <?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.
+-->
 <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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/archetypes/command/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/command/src/main/resources/META-INF/maven/archetype-metadata.xml
index 1222d33..f0b418c 100644
--- a/archetypes/command/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/archetypes/command/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -1,4 +1,20 @@
 <?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.
+-->
 <archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="org.apache.karaf.archetypes.command"
     xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
diff --git a/archetypes/command/src/main/resources/archetype-resources/pom.xml b/archetypes/command/src/main/resources/archetype-resources/pom.xml
index 7543b7d..494cc59 100644
--- a/archetypes/command/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/command/src/main/resources/archetype-resources/pom.xml
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------

+##  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.

+##---------------------------------------------------------------------------

 <?xml version="1.0" encoding="UTF-8"?>

 <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>

diff --git a/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java b/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java
index 2694702..6982495 100644
--- a/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java
+++ b/archetypes/command/src/main/resources/archetype-resources/src/main/java/__command__.java
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 #set( $symbol_pound = '#' )
 #set( $symbol_dollar = '$' )
 #set( $symbol_escape = '\' )
diff --git a/archetypes/command/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-log.xml b/archetypes/command/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-log.xml
index 0c6fabf..f7dd91f 100644
--- a/archetypes/command/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-log.xml
+++ b/archetypes/command/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/shell-log.xml
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 #set( $symbol_pound = '#' )
 #set( $symbol_dollar = '$' )
 #set( $symbol_escape = '\' )
diff --git a/archetypes/command/src/main/resources/archetype-resources/src/test/java/__command__Test.java b/archetypes/command/src/main/resources/archetype-resources/src/test/java/__command__Test.java
index a386dac..07844ac 100644
--- a/archetypes/command/src/main/resources/archetype-resources/src/test/java/__command__Test.java
+++ b/archetypes/command/src/main/resources/archetype-resources/src/test/java/__command__Test.java
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 #set( $symbol_pound = '#' )
 #set( $symbol_dollar = '$' )
 #set( $symbol_escape = '\' )
diff --git a/archetypes/command/src/test/resources/projects/basic/archetype.properties b/archetypes/command/src/test/resources/projects/basic/archetype.properties
index 694cc99..f3824a3 100644
--- a/archetypes/command/src/test/resources/projects/basic/archetype.properties
+++ b/archetypes/command/src/test/resources/projects/basic/archetype.properties
@@ -1,4 +1,19 @@
-#Mon Jul 19 10:12:55 EEST 2010
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 version=0.1-SNAPSHOT
 groupId=archetype.it
 artifactId=basic
diff --git a/archetypes/itests/pom.xml b/archetypes/itests/pom.xml
index 41f2dba..ac94b7c 100644
--- a/archetypes/itests/pom.xml
+++ b/archetypes/itests/pom.xml
@@ -1,4 +1,20 @@
 <?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.
+-->
 <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>
     <parent>
diff --git a/deployer/war/src/main/java/org/apache/karaf/deployer/war/WarDeploymentListener.java b/deployer/war/src/main/java/org/apache/karaf/deployer/war/WarDeploymentListener.java
index d84a028..536a69f 100644
--- a/deployer/war/src/main/java/org/apache/karaf/deployer/war/WarDeploymentListener.java
+++ b/deployer/war/src/main/java/org/apache/karaf/deployer/war/WarDeploymentListener.java
@@ -18,28 +18,13 @@
 package org.apache.karaf.deployer.war;
 
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.felix.fileinstall.ArtifactUrlTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
 
 /**
  * A deployment listener that listens for war deployements.
@@ -48,11 +33,6 @@
 
 	private static final String PATH_SEPERATOR = "/";
 
-	private static final Log LOGGER = LogFactory
-			.getLog(WarDeploymentListener.class);
-
-	private DocumentBuilderFactory dbf;
-
 	public boolean canHandle(File artifact) {
 		try {
 			JarFile jar = new JarFile(artifact);
@@ -80,79 +60,24 @@
 		String path = artifact.getPath();
 		String protocol = artifact.getProtocol();
 
+		int lastSlash = 0;
 		// match the last slash to retrieve the name of the archive
-		int lastSlash = path.lastIndexOf(PATH_SEPERATOR);
+		if ("jardir".equalsIgnoreCase(protocol)) {
+		    // just to make sure this works on all kinds of windows
+		    File fileInstance = new File(path);
+		    // with a jardir this is system specific
+		    lastSlash = fileInstance.getAbsolutePath().lastIndexOf(File.separator);
+		} else {
+		    // a standard file is not system specific, this is always a standardized URL path
+		    lastSlash = path.lastIndexOf(PATH_SEPERATOR);
+		}
 		// match the suffix so we get rid of it for displaying
-		int suffixPos = path.lastIndexOf(".war");
+		int suffixPos = path.length() - 4; // usually this should be a war but might also be a jar plus the colon makes 4 signs
 
-		// Fall back if there is no display-name set in the web.xml or if the
-		// web.xml can't be read.
+		// the display name for a web context is derived from the name of the archive
 		String displayName = path.substring(lastSlash + 1, suffixPos);
-		try {
-			// step through the jar to find the web.xml
-			JarInputStream jar = new JarInputStream(artifact.openStream());
-			JarEntry nextJarEntry = jar.getNextJarEntry();
-			boolean found = false;
-			while (nextJarEntry != null) {
-				if (nextJarEntry.getName().indexOf("web.xml") != -1
-						&& !nextJarEntry.isDirectory()) {
-					Document doc = parse(jar); // found the web.xml
-					NodeList nodeList = doc.getDocumentElement()
-							.getChildNodes(); // getElementsByTagName("display-name");
-					for (int i = 0; i < nodeList.getLength(); i++) {
-						Node item = nodeList.item(i);
-						String nodeName = item.getNodeName();
-						if ("display-name".equalsIgnoreCase(nodeName)) {
-							String nodeValue = item.getFirstChild()
-									.getNodeValue();
-							if (nodeValue != null) {
-								displayName = nodeValue;
-							}
-							found = true;
-							jar.close();
-							break;
-						}
-					}
-				}
-				if (found)
-					break;
-				else
-					nextJarEntry = jar.getNextJarEntry();
-			}
-			// alter the original URL artifact
-		} catch (Exception e) {
-			LOGGER.warn("Unable to create Webapp-Context from web.xml", e);
-		}
-		return new URL("war", null, protocol + ":" + path + "?Webapp-Context="
-				+ displayName);
-	}
-
-	private Document parse(InputStream inputStream)
-			throws ParserConfigurationException, SAXException, IOException {
-		if (dbf == null) {
-			dbf = DocumentBuilderFactory.newInstance();
-			dbf.setNamespaceAware(true);
-		}
-
-		DocumentBuilder db = dbf.newDocumentBuilder();
-		db.setErrorHandler(new ErrorHandler() {
-
-			public void warning(SAXParseException exception)
-					throws SAXException {
-				// ignore waring
-			}
-
-			public void fatalError(SAXParseException exception)
-					throws SAXException {
-				throw exception;
-			}
-
-			public void error(SAXParseException exception) throws SAXException {
-				throw exception;
-			}
-		});
-
-		return db.parse(inputStream);
+		
+		return new URL("war", null, protocol + ":" + path + "?Webapp-Context=" + displayName);
 	}
 
 }
diff --git a/jaas/jasypt/pom.xml b/jaas/jasypt/pom.xml
index de78aa4..5eadc61 100644
--- a/jaas/jasypt/pom.xml
+++ b/jaas/jasypt/pom.xml
@@ -87,4 +87,4 @@
         </plugins>
     </build>
 
-</project>
\ No newline at end of file
+</project>
diff --git a/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands b/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
index fb7bf30..7d6e2b9 100644
--- a/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
+++ b/shell/commands/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 org.apache.karaf.shell.commands.CatAction
 org.apache.karaf.shell.commands.ClearAction
 org.apache.karaf.shell.commands.EachAction
diff --git a/shell/console/src/main/resources/META-INF/services/org/apache/karaf/shell/commands b/shell/console/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
index 0616a95..3f110a7 100644
--- a/shell/console/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
+++ b/shell/console/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
@@ -1 +1,17 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 org.apache.karaf.shell.console.HelpAction
diff --git a/util/pom.xml b/util/pom.xml
index a469667..5c158de 100644
--- a/util/pom.xml
+++ b/util/pom.xml
@@ -42,4 +42,4 @@
         <appendedResourcesDirectory>${basedir}/../etc/appended-resources</appendedResourcesDirectory>
     </properties>
 
-</project>
\ No newline at end of file
+</project>
diff --git a/util/src/test/resources/test.properties b/util/src/test/resources/test.properties
index 616c260..2856e72 100644
--- a/util/src/test/resources/test.properties
+++ b/util/src/test/resources/test.properties
@@ -1,3 +1,19 @@
+##---------------------------------------------------------------------------
+##  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.
+##---------------------------------------------------------------------------
 #
 # test.properties
 # Used in the PropertiesTest