FELIX-1115: use version ranges + clean up a bit gshell-core
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@771352 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/gshell/gshell-admin/pom.xml b/karaf/gshell/gshell-admin/pom.xml
index 36faa9d..e9bef99 100644
--- a/karaf/gshell/gshell-admin/pom.xml
+++ b/karaf/gshell/gshell-admin/pom.xml
@@ -89,6 +89,7 @@
<include>**/*</include>
</includes>
</resource>
+ <!--
<resource>
<directory>${pom.basedir}/src/main/filtered-resources</directory>
<filtering>true</filtering>
@@ -96,6 +97,7 @@
<include>**/*</include>
</includes>
</resource>
+ -->
</resources>
<plugins>
<plugin>
@@ -103,7 +105,7 @@
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
- <id>copy-resources</id>
+ <id>copy-config-properties</id>
<!-- here the phase you need -->
<phase>compile</phase>
<goals>
@@ -111,15 +113,36 @@
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/org/apache/felix/karaf/gshell/admin/etc</outputDirectory>
- <resources>
+ <resources>
<resource>
<directory>../../${config.location}</directory>
<includes>
<include>config.properties</include>
</includes>
</resource>
- </resources>
- </configuration>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-filtered</id>
+ <!-- here the phase you need -->
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/filtered-resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.cfg</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -136,8 +159,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>org.apache.felix.karaf.gshell.admin.*;version=${project.version}
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -145,7 +167,8 @@
*
</Import-Package>
<Private-Package>org.apache.felix.karaf.jpm.*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-config/pom.xml b/karaf/gshell/gshell-config/pom.xml
index 74c0e3c..9867abb 100644
--- a/karaf/gshell/gshell-config/pom.xml
+++ b/karaf/gshell/gshell-config/pom.xml
@@ -74,9 +74,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.felix.karaf.gshell.config*;version=${project.version};-split-package:=merge-first
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -84,7 +82,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-core/pom.xml b/karaf/gshell/gshell-core/pom.xml
index 8747936..7b5d410 100644
--- a/karaf/gshell/gshell-core/pom.xml
+++ b/karaf/gshell/gshell-core/pom.xml
@@ -37,35 +37,6 @@
Provides the OSGi GShell integration
</description>
- <properties>
- <gshell.osgi.import>
- org.springframework.aop,
- org.springframework.aop.framework,
- org.springframework.beans.factory.annotation,
- org.springframework.context.annotation,
- org.springframework.osgi.service.importer,
- org.aopalliance.aop,
- org.apache.commons.vfs.provider.temp,
- org.apache.commons.vfs.provider.ram,
- jline*,
- org.apache.felix.karaf.jaas.config;resolution:=optional,
- org.apache.felix.karaf.version;resolution:=optional,
- org.apache.felix.karaf.main.spi;resolution:=optional;version="1.0.0",
- org.codehaus.plexus*;resolution:=optional,
- org.apache.sshd.server.keyprovider,
- org.apache.sshd.server.jaas,
- org.jsecurity*;resolution:=optional,
- *
- </gshell.osgi.import>
- <!-- TODO: remove plexus util package -->
- <gshell.osgi.export>
- org.apache.geronimo.gshell*;version="1.0.0.alpha-2-SNAPSHOT";-split-package:=merge-first,
- org.apache.felix.karaf.gshell.core*,
- org.codehaus.plexus.interpolation*;-split-package:=merge-first,
- org.codehaus.plexus.util;-split-package:=merge-first
- </gshell.osgi.export>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.felix.karaf</groupId>
@@ -111,10 +82,6 @@
</dependency>
<dependency>
<groupId>org.apache.geronimo.gshell.commands</groupId>
- <artifactId>gshell-ssh</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.gshell.commands</groupId>
<artifactId>gshell-text</artifactId>
</dependency>
<dependency>
@@ -136,10 +103,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
@@ -204,19 +167,6 @@
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.jline</artifactId>
</dependency>
-
- <!-- jsecurity is a dependency for the ssh commands -->
- <dependency>
- <groupId>org.jsecurity</groupId>
- <artifactId>jsecurity</artifactId>
- <version>0.9.0-RC2</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
<build>
@@ -249,9 +199,32 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Import-Package>${gshell.osgi.import}</Import-Package>
- <Export-Package>${gshell.osgi.export}</Export-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Import-Package>
+ org.springframework.aop,
+ org.springframework.aop.framework,
+ org.springframework.beans.factory.annotation,
+ org.springframework.context.annotation,
+ org.springframework.osgi.service.importer,
+ org.aopalliance.aop,
+ org.apache.commons.vfs.provider.temp,
+ org.apache.commons.vfs.provider.ram,
+ jline*,
+ org.apache.felix.karaf.jaas.config;resolution:=optional,
+ org.apache.felix.karaf.version;resolution:=optional,
+ org.apache.felix.karaf.main.spi;resolution:=optional;version="1.0.0",
+ org.apache.sshd.server.keyprovider,
+ org.apache.sshd.server.jaas,
+ *
+ </Import-Package>
+ <Export-Package>
+ org.apache.geronimo.gshell*;version="1.0.0.alpha-2";-split-package:=merge-first,
+ org.apache.felix.karaf.gshell.core*;version=${project.version};-split-package:=merge-first,
+ </Export-Package>
+ <Private-Package>
+ org.codehaus.plexus.interpolation*,
+ </Private-Package>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
<unpackBundle>true</unpackBundle>
</configuration>
@@ -285,7 +258,6 @@
<include>org.apache.geronimo.gshell.support:gshell-i18n</include>
<include>org.apache.geronimo.gshell.support:gshell-interpolation</include>
<include>org.apache.geronimo.gshell.support:gshell-io</include>
- <include>org.apache.geronimo.gshell.support:gshell-security</include>
<include>org.apache.geronimo.gshell.support:gshell-spring</include>
<include>org.apache.geronimo.gshell.support:gshell-terminal</include>
<include>org.apache.geronimo.gshell.support:gshell-vfs</include>
@@ -293,7 +265,6 @@
<include>org.apache.geronimo.gshell.support:gshell-yarn</include>
<include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-core</include>
<include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-bootstrap</include>
- <include>org.codehaus.plexus:plexus-utils</include>
<include>org.codehaus.plexus:plexus-interpolation</include>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
@@ -342,12 +313,6 @@
</excludes>
</filter>
<filter>
- <artifact>org.apache.geronimo.gshell.commands:gshell-ssh</artifact>
- <excludes>
- <exclude>org/apache/geronimo/gshell/**</exclude>
- </excludes>
- </filter>
- <filter>
<artifact>org.apache.geronimo.gshell.commands:gshell-text</artifact>
<excludes>
<exclude>org/apache/geronimo/gshell/**</exclude>
@@ -408,12 +373,6 @@
</excludes>
</filter>
<filter>
- <artifact>org.apache.geronimo.gshell.support:gshell-security</artifact>
- <excludes>
- <exclude>org/apache/geronimo/gshell/**</exclude>
- </excludes>
- </filter>
- <filter>
<artifact>org.apache.geronimo.gshell.support:gshell-spring</artifact>
<excludes>
<exclude>org/apache/geronimo/gshell/**</exclude>
@@ -456,12 +415,6 @@
</excludes>
</filter>
<filter>
- <artifact>org.codehaus.plexus:plexus-utils</artifact>
- <excludes>
- <exclude>org/codehaus/plexus/**</exclude>
- </excludes>
- </filter>
- <filter>
<artifact>org.codehaus.plexus:plexus-interpolation</artifact>
<excludes>
<exclude>org/codehaus/plexus/**</exclude>
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
index ba09d82..6f62660 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/commands/InfoAction.java
@@ -37,7 +37,6 @@
import org.apache.geronimo.gshell.command.CommandContext;
import org.apache.geronimo.gshell.io.IO;
import org.apache.felix.karaf.gshell.core.DefaultBranding;
-import org.codehaus.plexus.util.StringUtils;
public class InfoAction implements CommandAction {
@@ -171,7 +170,24 @@
}
void printValue(String name, int pad, String value) {
- io.out.println(" " + renderer.render(AnsiRenderer.encode(StringUtils.rightPad(name, pad), AnsiCode.BOLD)) + " " + value);
+ io.out.println(" " + renderer.render(AnsiRenderer.encode(rightPad(name, pad, " "), AnsiCode.BOLD)) + " " + value);
}
+ //==== Plexus StringUtils =====
+
+ public static String rightPad( String str, int size, String delim ) {
+ size = ( size - str.length() ) / delim.length();
+ if ( size > 0 ) {
+ str += repeat( delim, size );
+ }
+ return str;
+ }
+
+ public static String repeat( String str, int repeat ) {
+ StringBuffer buffer = new StringBuffer( repeat * str.length() );
+ for ( int i = 0; i < repeat; i++ ) {
+ buffer.append( str );
+ }
+ return buffer.toString();
+ }
}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
deleted file mode 100644
index d3bb6de..0000000
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.gshell.commands.ssh;
-
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.jsecurity.SecurityUtils;
-import org.jsecurity.authc.AuthenticationException;
-import org.jsecurity.authc.UsernamePasswordToken;
-import org.jsecurity.mgt.SecurityManager;
-import org.jsecurity.subject.Subject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <a href="http://jsecurity.org">JSecurity</a> {@link PasswordAuthenticator}.
- *
- * @version $Rev: 722797 $ $Date: 2008-12-03 08:18:16 +0100 (Wed, 03 Dec 2008) $
- */
-public class JSecurityPasswordAuthenticator
- implements PasswordAuthenticator
-{
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private final SecurityManager securityManager;
-
- public JSecurityPasswordAuthenticator(final SecurityManager securityManager) {
- // securityManager can be null
- this.securityManager = securityManager;
- }
-
- public JSecurityPasswordAuthenticator() {
- this(null);
- }
-
- public Object authenticate(final String username, final String password) {
- assert username != null;
- assert password != null;
-
- log.debug("Authenticating: {}/{}", username, password);
-
- Subject currentUser;
-
- if (securityManager != null) {
- currentUser = securityManager.getSubject();
- }
- else {
- currentUser = SecurityUtils.getSubject();
- }
-
- if (currentUser.isAuthenticated()) {
- log.debug("Logging out current user: {}", currentUser.getPrincipal());
- currentUser.logout();
- }
-
- try {
- UsernamePasswordToken token = new UsernamePasswordToken(username, password);
- currentUser.login(token);
- Object principal = currentUser.getPrincipal();
- log.info("User [{}] logged in successfully", principal);
- return principal;
- }
- catch (AuthenticationException e) {
- log.error("Authentication failed: " + e, e);
- return null;
- }
- }
-}
diff --git a/karaf/gshell/gshell-features/pom.xml b/karaf/gshell/gshell-features/pom.xml
index 0d7c34d..9f41944 100644
--- a/karaf/gshell/gshell-features/pom.xml
+++ b/karaf/gshell/gshell-features/pom.xml
@@ -90,8 +90,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>org.apache.felix.karaf.gshell.features*;version=${project.version}
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.felix.karaf.gshell.core,
@@ -100,7 +99,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-log/pom.xml b/karaf/gshell/gshell-log/pom.xml
index 6ed4fe1..54f765d 100644
--- a/karaf/gshell/gshell-log/pom.xml
+++ b/karaf/gshell/gshell-log/pom.xml
@@ -75,9 +75,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.felix.karaf.gshell.log*;version=${project.version};-split-package:=merge-first
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -86,7 +84,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-obr/pom.xml b/karaf/gshell/gshell-obr/pom.xml
index 497c0d6..6ade759 100644
--- a/karaf/gshell/gshell-obr/pom.xml
+++ b/karaf/gshell/gshell-obr/pom.xml
@@ -68,7 +68,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>org.apache.felix.karaf.gshell.obr*;version=${project.version}</Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -76,7 +76,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-osgi/pom.xml b/karaf/gshell/gshell-osgi/pom.xml
index f4d460e..b0af3a7 100644
--- a/karaf/gshell/gshell-osgi/pom.xml
+++ b/karaf/gshell/gshell-osgi/pom.xml
@@ -68,9 +68,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.felix.karaf.gshell.osgi*;version=${project.version};-split-package:=merge-first
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -78,7 +76,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-packages/pom.xml b/karaf/gshell/gshell-packages/pom.xml
index b8a90d6..8479242 100644
--- a/karaf/gshell/gshell-packages/pom.xml
+++ b/karaf/gshell/gshell-packages/pom.xml
@@ -69,9 +69,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.felix.karaf.gshell.packages*;version=${project.version};-split-package:=merge-first
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -79,7 +77,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>
diff --git a/karaf/gshell/gshell-wrapper/pom.xml b/karaf/gshell/gshell-wrapper/pom.xml
index 91d2d26..ef6cc5a 100644
--- a/karaf/gshell/gshell-wrapper/pom.xml
+++ b/karaf/gshell/gshell-wrapper/pom.xml
@@ -97,8 +97,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>org.apache.felix.karaf.gshell.wrapper.*;version=${project.version}
- </Export-Package>
+ <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
@@ -106,7 +105,8 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
+ <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
+ <_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
</plugin>