Switch from spring-dm to blueprint
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@786262 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/assembly/pom.xml b/karaf/assembly/pom.xml
index 80575dc..cf73a2f 100644
--- a/karaf/assembly/pom.xml
+++ b/karaf/assembly/pom.xml
@@ -246,6 +246,10 @@
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ </dependency>
</dependencies>
<build>
<resources>
diff --git a/karaf/assembly/src/main/descriptors/unix-bin.xml b/karaf/assembly/src/main/descriptors/unix-bin.xml
index 17734f5..a81320f 100644
--- a/karaf/assembly/src/main/descriptors/unix-bin.xml
+++ b/karaf/assembly/src/main/descriptors/unix-bin.xml
@@ -147,6 +147,7 @@
<include>org.ops4j.pax.url:pax-url-wrap</include>
</includes>
</dependencySet>
+ <!--
<dependencySet>
<outputDirectory>/system</outputDirectory>
<unpack>false</unpack>
@@ -170,6 +171,7 @@
<include>org.springframework.osgi:spring-osgi-io</include>
</includes>
</dependencySet>
+ -->
<dependencySet>
<outputDirectory>/system</outputDirectory>
<unpack>false</unpack>
@@ -177,7 +179,9 @@
<outputFileNameMapping>org/apache/geronimo/specs/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>org.apache.geronimo.specs:geronimo-servlet_2.5_spec</include>
+ <!--
<include>org.apache.geronimo.specs:geronimo-annotation_1.0_spec</include>
+ -->
</includes>
</dependencySet>
<dependencySet>
@@ -186,8 +190,10 @@
<useProjectArtifact>false</useProjectArtifact>
<outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <!--
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.aopalliance</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.cglib</include>
+ -->
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jaxp-ri</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.oro</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-jexl</include>
@@ -298,6 +304,15 @@
<include>org.eclipse:osgi</include>
</includes>
</dependencySet>
+ <dependencySet>
+ <outputDirectory>/system</outputDirectory>
+ <unpack>false</unpack>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>org/apache/geronimo/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>org.apache.geronimo:blueprint-bundle</include>
+ </includes>
+ </dependencySet>
</dependencySets>
diff --git a/karaf/assembly/src/main/descriptors/windows-bin.xml b/karaf/assembly/src/main/descriptors/windows-bin.xml
index 8ae133c..d693fef 100644
--- a/karaf/assembly/src/main/descriptors/windows-bin.xml
+++ b/karaf/assembly/src/main/descriptors/windows-bin.xml
@@ -139,6 +139,7 @@
<include>org.ops4j.pax.url:pax-url-wrap</include>
</includes>
</dependencySet>
+ <!--
<dependencySet>
<outputDirectory>/system</outputDirectory>
<unpack>false</unpack>
@@ -162,6 +163,7 @@
<include>org.springframework.osgi:spring-osgi-io</include>
</includes>
</dependencySet>
+ -->
<dependencySet>
<outputDirectory>/system</outputDirectory>
<unpack>false</unpack>
@@ -169,7 +171,9 @@
<outputFileNameMapping>org/apache/geronimo/specs/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>org.apache.geronimo.specs:geronimo-servlet_2.5_spec</include>
+ <!--
<include>org.apache.geronimo.specs:geronimo-annotation_1.0_spec</include>
+ -->
</includes>
</dependencySet>
<dependencySet>
@@ -178,8 +182,10 @@
<useProjectArtifact>false</useProjectArtifact>
<outputFileNameMapping>org/apache/servicemix/bundles/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <!--
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.aopalliance</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.cglib</include>
+ -->
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.jaxp-ri</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.oro</include>
<include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.commons-jexl</include>
@@ -290,6 +296,15 @@
<include>org.eclipse:osgi</include>
</includes>
</dependencySet>
+ <dependencySet>
+ <outputDirectory>/system</outputDirectory>
+ <unpack>false</unpack>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputFileNameMapping>org/apache/geronimo/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>org.apache.geronimo:blueprint-bundle</include>
+ </includes>
+ </dependencySet>
</dependencySets>
diff --git a/karaf/assembly/src/main/filtered-resources/etc/startup.properties b/karaf/assembly/src/main/filtered-resources/etc/startup.properties
index cb99888..8ec7e57 100644
--- a/karaf/assembly/src/main/filtered-resources/etc/startup.properties
+++ b/karaf/assembly/src/main/filtered-resources/etc/startup.properties
@@ -32,29 +32,31 @@
org/apache/servicemix/bundles/org.apache.servicemix.bundles.jaxp-ri/${jaxp.ri.version}/org.apache.servicemix.bundles.jaxp-ri-${jaxp.ri.version}.jar=10
org/apache/felix/org.osgi.compendium/${felix.compendium.version}/org.osgi.compendium-${felix.compendium.version}.jar=10
org/apache/felix/org.apache.felix.configadmin/${felix.configadmin.version}/org.apache.felix.configadmin-${felix.configadmin.version}.jar=10
-org/apache/geronimo/specs/geronimo-annotation_1.0_spec/${geronimo.annotation.version}/geronimo-annotation_1.0_spec-${geronimo.annotation.version}.jar=10
+#org/apache/geronimo/specs/geronimo-annotation_1.0_spec/${geronimo.annotation.version}/geronimo-annotation_1.0_spec-${geronimo.annotation.version}.jar=10
org/apache/felix/org.apache.felix.prefs/${felix.prefs.version}/org.apache.felix.prefs-${felix.prefs.version}.jar=10
org/apache/felix/karaf/deployer/org.apache.felix.karaf.deployer.filemonitor/${pom.version}/org.apache.felix.karaf.deployer.filemonitor-${pom.version}.jar=15
#
# The rest of the services..
#
+org/apache/geronimo/blueprint-bundle/${geronimo.blueprint.version}/blueprint-bundle-${geronimo.blueprint.version}.jar=20
+
org/apache/felix/karaf/gshell/org.apache.felix.karaf.gshell.core/${pom.version}/org.apache.felix.karaf.gshell.core-${pom.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.jline/${jline.version}/org.apache.servicemix.bundles.jline-${jline.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance.version}/org.apache.servicemix.bundles.aopalliance-${aopalliance.version}.jar=30
-org/apache/servicemix/bundles/org.apache.servicemix.bundles.cglib/${cglib.version}/org.apache.servicemix.bundles.cglib-${cglib.version}.jar=30
+#org/apache/servicemix/bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance.version}/org.apache.servicemix.bundles.aopalliance-${aopalliance.version}.jar=30
+#org/apache/servicemix/bundles/org.apache.servicemix.bundles.cglib/${cglib.version}/org.apache.servicemix.bundles.cglib-${cglib.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.oro/${oro.version}/org.apache.servicemix.bundles.oro-${oro.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-codec/${commons.codec.version}/org.apache.servicemix.bundles.commons-codec-${commons.codec.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-httpclient/${commons.httpclient.version}/org.apache.servicemix.bundles.commons-httpclient-${commons.httpclient.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-jexl/${commons.jexl.version}/org.apache.servicemix.bundles.commons-jexl-${commons.jexl.version}.jar=30
org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-vfs/${commons.vfs.version}/org.apache.servicemix.bundles.commons-vfs-${commons.vfs.version}.jar=30
-org/springframework/spring-aop/${spring.version}/spring-aop-${spring.version}.jar=30
-org/springframework/spring-beans/${spring.version}/spring-beans-${spring.version}.jar=30
-org/springframework/spring-context/${spring.version}/spring-context-${spring.version}.jar=30
-org/springframework/spring-core/${spring.version}/spring-core-${spring.version}.jar=30
-org/springframework/osgi/spring-osgi-core/${spring.osgi.version}/spring-osgi-core-${spring.osgi.version}.jar=30
-org/springframework/osgi/spring-osgi-extender/${spring.osgi.version}/spring-osgi-extender-${spring.osgi.version}.jar=30
-org/springframework/osgi/spring-osgi-io/${spring.osgi.version}/spring-osgi-io-${spring.osgi.version}.jar=30
+#org/springframework/spring-aop/${spring.version}/spring-aop-${spring.version}.jar=30
+#org/springframework/spring-beans/${spring.version}/spring-beans-${spring.version}.jar=30
+#org/springframework/spring-context/${spring.version}/spring-context-${spring.version}.jar=30
+#org/springframework/spring-core/${spring.version}/spring-core-${spring.version}.jar=30
+#org/springframework/osgi/spring-osgi-core/${spring.osgi.version}/spring-osgi-core-${spring.osgi.version}.jar=30
+#org/springframework/osgi/spring-osgi-extender/${spring.osgi.version}/spring-osgi-extender-${spring.osgi.version}.jar=30
+#org/springframework/osgi/spring-osgi-io/${spring.osgi.version}/spring-osgi-io-${spring.osgi.version}.jar=30
org/apache/felix/karaf/deployer/org.apache.felix.karaf.deployer.spring/${pom.version}/org.apache.felix.karaf.deployer.spring-${pom.version}.jar=30
org/apache/felix/karaf/deployer/org.apache.felix.karaf.deployer.blueprint/${pom.version}/org.apache.felix.karaf.deployer.blueprint-${pom.version}.jar=30
org/apache/felix/karaf/deployer/org.apache.felix.karaf.deployer.features/${pom.version}/org.apache.felix.karaf.deployer.features-${pom.version}.jar=30
diff --git a/karaf/assembly/src/main/filtered-resources/features.xml b/karaf/assembly/src/main/filtered-resources/features.xml
index 2a62897..fbaccfe 100644
--- a/karaf/assembly/src/main/filtered-resources/features.xml
+++ b/karaf/assembly/src/main/filtered-resources/features.xml
@@ -17,6 +17,23 @@
limitations under the License.
-->
<features>
+ <feature name="spring" version="${spring.version}">
+ <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/${aopalliance.version}</bundle>
+ <bundle>mvn:org.springframework/spring-aop/${spring.version}</bundle>
+ <bundle>mvn:org.springframework/spring-beans/${spring.version}</bundle>
+ <bundle>mvn:org.springframework/spring-context/${spring.version}</bundle>
+ <bundle>mvn:org.springframework/spring-context-support/${spring.version}</bundle>
+ <bundle>mvn:org.springframework/spring-core/${spring.version}</bundle>
+ </feature>
+ <feature name="spring-dm" version="${spring.osgi.version}">
+ <feature version="${spring.version}">spring</feature>
+ <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/${cglib.version}</bundle>
+ <bundle>mvn:org.springframework.osgi/spring-osgi-core/${spring.osgi.version}</bundle>
+ <bundle>mvn:org.springframework.osgi/spring-osgi-annotation/${spring.osgi.version}</bundle>
+ <bundle>mvn:org.springframework.osgi/spring-osgi-io/${spring.osgi.version}</bundle>
+ <bundle>mvn:org.springframework.osgi/spring-osgi-extender/${spring.osgi.version}</bundle>
+ <bundle>mvn:org.apache.felix.karaf.deployer/org.apache.felix.karaf.deployer.spring/${version}</bundle>
+ </feature>
<feature name="wrapper" version="${version}">
<bundle>mvn:org.apache.felix.karaf.gshell/org.apache.felix.karaf.gshell.wrapper/${version}</bundle>
</feature>
diff --git a/karaf/deployer/blueprint/pom.xml b/karaf/deployer/blueprint/pom.xml
index 443b100..c0e398c 100644
--- a/karaf/deployer/blueprint/pom.xml
+++ b/karaf/deployer/blueprint/pom.xml
@@ -65,7 +65,6 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Private-Package>org.apache.felix.karaf.deployer.blueprint</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/deployer/blueprint/src/main/resources/META-INF/spring/blueprint-deployer.xml b/karaf/deployer/blueprint/src/main/resources/META-INF/spring/blueprint-deployer.xml
deleted file mode 100644
index 338547c..0000000
--- a/karaf/deployer/blueprint/src/main/resources/META-INF/spring/blueprint-deployer.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <bean id="blueprintDeploymentListener" class="org.apache.felix.karaf.deployer.blueprint.BlueprintDeploymentListener">
-
- </bean>
-
- <osgi:service ref="blueprintDeploymentListener">
- <osgi:interfaces>
- <value>org.apache.felix.karaf.deployer.filemonitor.DeploymentListener</value>
- </osgi:interfaces>
- </osgi:service>
-
- <bean id="blueprintHandler" class="org.apache.felix.karaf.deployer.blueprint.BlueprintURLHandler" />
-
- <osgi:service ref="blueprintHandler" interface="org.osgi.service.url.URLStreamHandlerService">
- <osgi:service-properties>
- <entry key="url.handler.protocol" value="blueprint"/>
- </osgi:service-properties>
- </osgi:service>
-
-</beans>
diff --git a/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml b/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
new file mode 100644
index 0000000..9ebce77
--- /dev/null
+++ b/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
@@ -0,0 +1,34 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <service interface="org.apache.felix.karaf.deployer.filemonitor.DeploymentListener">
+ <bean class="org.apache.felix.karaf.deployer.blueprint.BlueprintDeploymentListener"/>
+ </service>
+
+ <service interface="org.osgi.service.url.URLStreamHandlerService">
+ <service-properties>
+ <entry key="url.handler.protocol" value="blueprint"/>
+ </service-properties>
+ <bean class="org.apache.felix.karaf.deployer.blueprint.BlueprintURLHandler"/>
+ </service>
+
+</blueprint>
diff --git a/karaf/deployer/features/pom.xml b/karaf/deployer/features/pom.xml
index 51ac0bc..4c07b09 100644
--- a/karaf/deployer/features/pom.xml
+++ b/karaf/deployer/features/pom.xml
@@ -69,7 +69,6 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Private-Package>org.apache.felix.karaf.deployer.features</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/deployer/features/src/main/resources/META-INF/spring/features-deployer.xml b/karaf/deployer/features/src/main/resources/META-INF/spring/features-deployer.xml
deleted file mode 100644
index 925bf79..0000000
--- a/karaf/deployer/features/src/main/resources/META-INF/spring/features-deployer.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ctx="http://www.springframework.org/schema/context"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <osgi:reference id="featuresService" interface="org.apache.felix.karaf.gshell.features.FeaturesService" cardinality="1..1"/>
-
- <bean id="featureDeploymentListener" class="org.apache.felix.karaf.deployer.features.FeatureDeploymentListener"
- init-method="init" destroy-method="destroy">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="featuresService" ref="featuresService" />
- </bean>
-
- <osgi:service ref="featureDeploymentListener" interface="org.apache.felix.karaf.deployer.filemonitor.DeploymentListener" />
-
-</beans>
diff --git a/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml b/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
new file mode 100644
index 0000000..a20d905
--- /dev/null
+++ b/karaf/deployer/features/src/main/resources/OSGI-INF/blueprint/features-deployer.xml
@@ -0,0 +1,34 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <service interface="org.apache.felix.karaf.deployer.filemonitor.DeploymentListener"
+ ref="featureDeploymentListener"/>
+
+ <bean id="featureDeploymentListener" class="org.apache.felix.karaf.deployer.features.FeatureDeploymentListener"
+ init-method="init" destroy-method="destroy" initialization="lazy">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="featuresService">
+ <reference interface="org.apache.felix.karaf.gshell.features.FeaturesService"/>
+ </property>
+ </bean>
+
+</blueprint>
diff --git a/karaf/deployer/spring/pom.xml b/karaf/deployer/spring/pom.xml
index e2759f0..4bee27f 100644
--- a/karaf/deployer/spring/pom.xml
+++ b/karaf/deployer/spring/pom.xml
@@ -65,7 +65,6 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Private-Package>org.apache.felix.karaf.deployer.spring</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/deployer/spring/src/main/resources/META-INF/spring/spring-deployer.xml b/karaf/deployer/spring/src/main/resources/META-INF/spring/spring-deployer.xml
deleted file mode 100644
index 6ece1f2..0000000
--- a/karaf/deployer/spring/src/main/resources/META-INF/spring/spring-deployer.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <bean id="springDeploymentListener" class="org.apache.felix.karaf.deployer.spring.SpringDeploymentListener">
-
- </bean>
-
- <osgi:service ref="springDeploymentListener">
- <osgi:interfaces>
- <value>org.apache.felix.karaf.deployer.filemonitor.DeploymentListener</value>
- </osgi:interfaces>
- </osgi:service>
-
- <bean id="springHandler" class="org.apache.felix.karaf.deployer.spring.SpringURLHandler" />
-
- <osgi:service ref="springHandler" interface="org.osgi.service.url.URLStreamHandlerService">
- <osgi:service-properties>
- <entry key="url.handler.protocol" value="spring"/>
- </osgi:service-properties>
- </osgi:service>
-
-</beans>
diff --git a/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml b/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
new file mode 100644
index 0000000..cb0c57b
--- /dev/null
+++ b/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
@@ -0,0 +1,34 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <service interface="org.apache.felix.karaf.deployer.filemonitor.DeploymentListener">
+ <bean class="org.apache.felix.karaf.deployer.spring.SpringDeploymentListener"/>
+ </service>
+
+ <service interface="org.osgi.service.url.URLStreamHandlerService">
+ <service-properties>
+ <entry key="url.handler.protocol" value="spring"/>
+ </service-properties>
+ <bean class="org.apache.felix.karaf.deployer.spring.SpringURLHandler"/>
+ </service>
+
+</blueprint>
diff --git a/karaf/deployer/spring/src/test/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListenerTest.java b/karaf/deployer/spring/src/test/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListenerTest.java
index 7921282..d74e471 100644
--- a/karaf/deployer/spring/src/test/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListenerTest.java
+++ b/karaf/deployer/spring/src/test/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListenerTest.java
@@ -36,7 +36,7 @@
public void testPackagesExtraction() throws Exception {
SpringDeploymentListener l = new SpringDeploymentListener();
- File f = new File(getClass().getClassLoader().getResource("META-INF/spring/spring-deployer.xml").toURI());
+ File f = new File(getClass().getClassLoader().getResource("test.xml").toURI());
Set<String> pkgs = SpringTransformer.analyze(new DOMSource(SpringTransformer.parse(f.toURL())));
assertNotNull(pkgs);
assertEquals(2, pkgs.size());
diff --git a/karaf/gshell/gshell-admin/pom.xml b/karaf/gshell/gshell-admin/pom.xml
index a4cb533..48ab09d 100644
--- a/karaf/gshell/gshell-admin/pom.xml
+++ b/karaf/gshell/gshell-admin/pom.xml
@@ -168,7 +168,6 @@
*
</Import-Package>
<Private-Package>org.apache.felix.karaf.jpm.*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml b/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml
deleted file mode 100644
index 07c3ca7..0000000
--- a/karaf/gshell/gshell-admin/src/main/resources/META-INF/spring/gshell-admin.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="admin/create">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.CreateCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- </gshell:command>
- <gshell:command name="admin/connect">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ConnectCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- <gshell:completers>
- <ref bean="instanceCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="admin/list">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ListCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- </gshell:command>
- <gshell:command name="admin/start">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StartCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- <gshell:completers>
- <ref bean="instanceCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="admin/stop">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.StopCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- <gshell:completers>
- <ref bean="instanceCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="admin/destroy">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.DestroyCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- <gshell:completers>
- <ref bean="instanceCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="admin/change-port">
- <gshell:action class="org.apache.felix.karaf.gshell.admin.internal.commands.ChangePortCommand">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="adminService" ref="adminService" />
- </gshell:action>
- <gshell:completers>
- <ref bean="instanceCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- </gshell:command-bundle>
-
- <osgi:reference id="preferences" interface="org.osgi.service.prefs.PreferencesService" cardinality="0..1" />
-
- <bean id="adminService" class="org.apache.felix.karaf.gshell.admin.internal.AdminServiceImpl" init-method="init">
- <property name="preferences" ref="preferences" />
- </bean>
-
- <bean id="instanceCompleter" class="org.apache.felix.karaf.gshell.admin.internal.completers.InstanceCompleter">
- <property name="adminService" ref="adminService" />
- </bean>
-
-
-</beans>
diff --git a/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml b/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml
new file mode 100644
index 0000000..1e52c51
--- /dev/null
+++ b/karaf/gshell/gshell-admin/src/main/resources/OSGI-INF/blueprint/gshell-admin.xml
@@ -0,0 +1,98 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="admin/create">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.CreateCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ </command>
+ <command name="admin/connect">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.ConnectCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="admin/list">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.ListCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ </command>
+ <command name="admin/start">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.StartCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="admin/stop">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.StopCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="admin/destroy">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.DestroyCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="admin/change-port">
+ <action class="org.apache.felix.karaf.gshell.admin.internal.commands.ChangePortCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="adminService" ref="adminService" />
+ </action>
+ <completers>
+ <ref component-id="instanceCompleter" />
+ <null/>
+ </completers>
+ </command>
+ </command-bundle>
+
+ <reference id="preferences" interface="org.osgi.service.prefs.PreferencesService" availability="optional"/>
+
+ <bean id="adminService" class="org.apache.felix.karaf.gshell.admin.internal.AdminServiceImpl" init-method="init">
+ <property name="preferences" ref="preferences" />
+ </bean>
+
+ <bean id="instanceCompleter" class="org.apache.felix.karaf.gshell.admin.internal.completers.InstanceCompleter">
+ <property name="adminService" ref="adminService" />
+ </bean>
+
+
+</blueprint>
diff --git a/karaf/gshell/gshell-config/pom.xml b/karaf/gshell/gshell-config/pom.xml
index b240ba7..6bf1d97 100644
--- a/karaf/gshell/gshell-config/pom.xml
+++ b/karaf/gshell/gshell-config/pom.xml
@@ -83,7 +83,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-config/src/main/java/org/apache/felix/karaf/gshell/config/completers/ConfigurationCompleter.java b/karaf/gshell/gshell-config/src/main/java/org/apache/felix/karaf/gshell/config/completers/ConfigurationCompleter.java
index 4bd5efd..c840e89 100644
--- a/karaf/gshell/gshell-config/src/main/java/org/apache/felix/karaf/gshell/config/completers/ConfigurationCompleter.java
+++ b/karaf/gshell/gshell-config/src/main/java/org/apache/felix/karaf/gshell/config/completers/ConfigurationCompleter.java
@@ -23,8 +23,6 @@
import java.util.Collection;
import java.util.List;
-import javax.annotation.PostConstruct;
-
import jline.Completor;
import org.apache.geronimo.gshell.console.completer.StringsCompleter;
import org.osgi.service.cm.Configuration;
@@ -48,7 +46,6 @@
this.admin = admin;
}
- @PostConstruct
public void init() {
Configuration[] configs;
try {
diff --git a/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml b/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
deleted file mode 100644
index 8ad512e..0000000
--- a/karaf/gshell/gshell-config/src/main/resources/META-INF/spring/gshell-config.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="config/cancel">
- <gshell:action class="org.apache.felix.karaf.gshell.config.CancelCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="config/edit">
- <gshell:action class="org.apache.felix.karaf.gshell.config.EditCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="configCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="config/list">
- <gshell:action class="org.apache.felix.karaf.gshell.config.ListCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="config/propdel">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropDelCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="configPropertyCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="config/proplist">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropListCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="config/propset">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropSetCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="configPropertyCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="config/propappend">
- <gshell:action class="org.apache.felix.karaf.gshell.config.PropAppendCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="configPropertyCompleter" />
- <null/>
- </gshell:completers>
- </gshell:command>
- <gshell:command name="config/update">
- <gshell:action class="org.apache.felix.karaf.gshell.config.UpdateCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
- <bean id="configCompleter" class="org.apache.felix.karaf.gshell.config.completers.ConfigurationCompleter" init-method="init">
- <property name="admin" ref="configAdmin"/>
- </bean>
-
- <bean id="configPropertyCompleter" class="org.apache.felix.karaf.gshell.config.completers.ConfigurationPropertyCompleter" />
-
- <osgi:reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" />
-
- <osgi:service ref="configCompleter" interface="org.osgi.service.cm.ConfigurationListener" />
-
-</beans>
diff --git a/karaf/gshell/gshell-config/src/main/resources/OSGI-INF/blueprint/gshell-config.xml b/karaf/gshell/gshell-config/src/main/resources/OSGI-INF/blueprint/gshell-config.xml
new file mode 100644
index 0000000..f213c20
--- /dev/null
+++ b/karaf/gshell/gshell-config/src/main/resources/OSGI-INF/blueprint/gshell-config.xml
@@ -0,0 +1,82 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="config/cancel">
+ <action class="org.apache.felix.karaf.gshell.config.CancelCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="config/edit">
+ <action class="org.apache.felix.karaf.gshell.config.EditCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="configCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="config/list">
+ <action class="org.apache.felix.karaf.gshell.config.ListCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="config/propdel">
+ <action class="org.apache.felix.karaf.gshell.config.PropDelCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="configPropertyCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="config/proplist">
+ <action class="org.apache.felix.karaf.gshell.config.PropListCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="config/propset">
+ <action class="org.apache.felix.karaf.gshell.config.PropSetCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="configPropertyCompleter" />
+ <null/>
+ </completers>
+ </command>
+ <command name="config/update">
+ <action class="org.apache.felix.karaf.gshell.config.UpdateCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ </command-bundle>
+
+ <bean id="configCompleter" class="org.apache.felix.karaf.gshell.config.completers.ConfigurationCompleter" init-method="init">
+ <property name="admin" ref="configAdmin"/>
+ </bean>
+
+ <bean id="configPropertyCompleter" class="org.apache.felix.karaf.gshell.config.completers.ConfigurationPropertyCompleter" />
+
+ <reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" />
+
+ <service ref="configCompleter" interface="org.osgi.service.cm.ConfigurationListener" />
+
+</blueprint>
diff --git a/karaf/gshell/gshell-core/pom.xml b/karaf/gshell/gshell-core/pom.xml
index d06580b..8c4dd3b 100644
--- a/karaf/gshell/gshell-core/pom.xml
+++ b/karaf/gshell/gshell-core/pom.xml
@@ -99,14 +99,6 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
@@ -173,6 +165,10 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -206,12 +202,6 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<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*,
@@ -220,6 +210,7 @@
org.apache.felix.karaf.main.spi;resolution:=optional;version="1.0.0",
org.apache.sshd.server.keyprovider,
org.apache.sshd.server.jaas,
+ !org.springframework*,
*
</Import-Package>
<Export-Package>
@@ -229,7 +220,6 @@
<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>
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
index a40b0eb..3abab2d 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/ApplicationManagerImpl.java
@@ -25,12 +25,9 @@
import org.apache.geronimo.gshell.wisdom.application.ShellCreatedEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
+import org.osgi.service.blueprint.container.BlueprintContainer;
-public class ApplicationManagerImpl implements ApplicationManager, ApplicationContextAware {
+public class ApplicationManagerImpl implements ApplicationManager {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -38,11 +35,12 @@
private Application application;
- private ApplicationContext applicationContext;
+ private BlueprintContainer blueprintContainer;
- public ApplicationManagerImpl(EventPublisher eventPublisher, Application application) {
+ public ApplicationManagerImpl(EventPublisher eventPublisher, Application application, BlueprintContainer blueprintContainer) {
this.eventPublisher = eventPublisher;
this.application = application;
+ this.blueprintContainer = blueprintContainer;
}
public void init() throws Exception {
@@ -56,10 +54,6 @@
SystemOutputHijacker.uninstall();
}
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
public void configure(ApplicationConfiguration applicationConfiguration) throws Exception {
throw new UnsupportedOperationException();
}
@@ -69,7 +63,7 @@
}
public Shell create() throws Exception {
- final Shell shell = (Shell) applicationContext.getBean("shell");
+ final Shell shell = (Shell) blueprintContainer.getComponentInstance("shell");
log.debug("Created shell instance: {}", shell);
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerAwareProcessor.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerAwareProcessor.java
deleted file mode 100644
index fdd3783..0000000
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerAwareProcessor.java
+++ /dev/null
@@ -1,55 +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.felix.karaf.gshell.core;
-
-import org.apache.geronimo.gshell.spring.BeanContainer;
-import org.apache.geronimo.gshell.spring.BeanContainerAware;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-public class BeanContainerAwareProcessor implements InitializingBean, BeanPostProcessor, ApplicationContextAware {
-
- private ApplicationContext applicationContext;
- private BeanContainer container;
-
- public void setApplicationContext(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- public void afterPropertiesSet() throws Exception {
- this.container = new BeanContainerWrapper(applicationContext);
- }
-
- public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
- assert bean != null;
-
- if (bean instanceof BeanContainerAware) {
- ((BeanContainerAware)bean).setBeanContainer(container);
- }
-
- return bean;
- }
-
- public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
- return bean;
- }
-}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerWrapper.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerWrapper.java
index d5226ac..6b58107 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerWrapper.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/BeanContainerWrapper.java
@@ -24,19 +24,21 @@
import java.util.Map;
import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.apache.geronimo.gshell.wisdom.command.GroupCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
public class BeanContainerWrapper implements BeanContainer {
private final Logger log = LoggerFactory.getLogger(getClass());
- private ApplicationContext context;
+ private BlueprintContainer container;
- public BeanContainerWrapper(ApplicationContext context) {
- this.context = context;
+ public BeanContainerWrapper(BlueprintContainer container) {
+ this.container = container;
}
public BeanContainer getParent() {
@@ -44,7 +46,7 @@
}
public ClassLoader getClassLoader() {
- return context.getClassLoader();
+ return null;
}
public void loadBeans(String[] strings) throws Exception {
@@ -54,18 +56,10 @@
public <T> T getBean(Class<T> type) {
assert type != null;
- log.trace("Getting bean of type: {}", type);
-
- String[] names = context.getBeanNamesForType(type);
-
- if (names.length == 0) {
- throw new NoSuchBeanDefinitionException(type, "No bean defined for type: " + type);
+ if (GroupCommand.class.isAssignableFrom(type)) {
+ return type.cast(new GroupCommand());
}
- if (names.length > 1) {
- throw new NoSuchBeanDefinitionException(type, "No unique bean defined for type: " + type + ", found matches: " + Arrays.asList(names));
- }
-
- return getBean(names[0], type);
+ throw new UnsupportedOperationException();
}
public <T> T getBean(String name, Class<T> requiredType) {
@@ -74,29 +68,19 @@
log.trace("Getting bean named '{}' of type: {}", name, requiredType);
- return (T) context.getBean(name, requiredType);
+ return requiredType.cast(container.getComponentInstance(name));
}
public <T> Map<String, T> getBeans(Class<T> type) {
- assert type != null;
-
- log.trace("Getting beans of type: {}", type);
-
- return (Map<String,T>) context.getBeansOfType(type);
+ throw new UnsupportedOperationException();
}
public String[] getBeanNames() {
- log.trace("Getting bean names");
-
- return context.getBeanDefinitionNames();
+ throw new UnsupportedOperationException();
}
public String[] getBeanNames(Class type) {
- assert type != null;
-
- log.trace("Getting bean names of type: {}", type);
-
- return context.getBeanNamesForType(type);
+ throw new UnsupportedOperationException();
}
public BeanContainer createChild(Collection<URL> urls) {
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandResolverImpl.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandResolverImpl.java
new file mode 100644
index 0000000..23c3519
--- /dev/null
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/CommandResolverImpl.java
@@ -0,0 +1,353 @@
+/*
+ * 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.felix.karaf.gshell.core;
+
+import org.apache.commons.vfs.FileContent;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.command.CommandException;
+import org.apache.geronimo.gshell.command.Variables;
+import org.apache.geronimo.gshell.registry.CommandResolver;
+import org.apache.geronimo.gshell.registry.NoSuchCommandException;
+import org.apache.geronimo.gshell.spring.BeanContainer;
+import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.vfs.FileSystemAccess;
+import org.apache.geronimo.gshell.wisdom.command.AliasCommand;
+import org.apache.geronimo.gshell.wisdom.command.GroupCommand;
+import org.apache.geronimo.gshell.wisdom.registry.GroupDirectoryResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * {@link CommandResolver} component.
+ *
+ * @version $Rev: 741078 $ $Date: 2009-02-05 12:39:10 +0100 (Thu, 05 Feb 2009) $
+ */
+public class CommandResolverImpl
+ implements CommandResolver, BeanContainerAware
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private final FileSystemAccess fileSystemAccess;
+
+ private final GroupDirectoryResolver groupDirResolver;
+
+ private FileObject commandsRoot;
+
+ private FileObject aliasesRoot;
+
+ private BeanContainer container;
+
+ private String aliasCommandBeanId;
+ private String groupCommandBeanId;
+
+ public CommandResolverImpl(final FileSystemAccess fileSystemAccess, final GroupDirectoryResolver groupDirResolver) {
+ assert fileSystemAccess != null;
+ this.fileSystemAccess = fileSystemAccess;
+
+ assert groupDirResolver != null;
+ this.groupDirResolver = groupDirResolver;
+ }
+
+ public void setBeanContainer(final BeanContainer container) {
+ assert container != null;
+
+ this.container = container;
+ }
+
+ public void setAliasCommandBeanId(String aliasCommandBeanId) {
+ this.aliasCommandBeanId = aliasCommandBeanId;
+ }
+
+ public void setGroupCommandBeanId(String groupCommandBeanId) {
+ this.groupCommandBeanId = groupCommandBeanId;
+ }
+
+ //
+ // TODO: Consider adding an undefined command handler to allow for even more customization of
+ // execution when no defined command is found? So one can say directly execute a
+ // *.gsh script, which under the covers will translate into 'source *.gsh' (or really
+ // should be 'shell *.gsh' once we have a sub-shell command.
+ //
+
+ public Command resolveCommand(final String name, final Variables variables) throws CommandException {
+ assert name != null;
+ assert variables != null;
+
+ log.debug("Resolving command name: {}", name);
+
+ // Always try to resolve aliases before we resolve commands
+ Command command = resolveAliasCommand(name, variables);
+
+ if (command == null) {
+ try {
+ FileObject file = resolveCommandFile(name, variables);
+
+ if (file != null) {
+ command = createCommand(file);
+ }
+ }
+ catch (FileSystemException e) {
+ log.warn("Unable to resolve command for name: " + name, e);
+ }
+ }
+
+ if (command == null) {
+ throw new NoSuchCommandException(name);
+ }
+
+ log.debug("Resolved command: {}", command);
+
+ return command;
+ }
+
+ private FileObject getAliasesRoot() throws FileSystemException {
+ if (aliasesRoot == null) {
+ aliasesRoot = fileSystemAccess.createVirtualFileSystem(ALIASES_ROOT);
+ }
+
+ return aliasesRoot;
+ }
+
+ private AliasCommand resolveAliasCommand(final String name, final Variables variables) {
+ assert name != null;
+ assert variables != null;
+
+ log.trace("Resolving alias for name: {}", name);
+
+ AliasCommand command = null;
+
+ try {
+ FileObject root = getAliasesRoot();
+ FileObject file = root.resolveFile(name);
+
+ if (file != null && file.exists()) {
+ log.trace("Resolved file: {}", file);
+
+ command = createAliasCommand(file);
+ }
+ }
+ catch (FileSystemException e) {
+ log.debug("Failed to resolve alias command for name: " + name, e);
+ }
+
+ return command;
+ }
+
+ private FileObject getCommandsRoot() throws FileSystemException {
+ if (commandsRoot == null) {
+ commandsRoot = fileSystemAccess.createVirtualFileSystem(COMMANDS_ROOT);
+ }
+
+ return commandsRoot;
+ }
+
+ private FileObject resolveCommandFile(final String name, final Variables variables) throws FileSystemException {
+ assert name != null;
+ assert variables != null;
+
+ log.trace("Resolving command file: {}", name);
+
+ FileObject root = getCommandsRoot();
+
+ // Special handling for root & group
+ if (name.equals("/")) {
+ return root;
+ }
+ else if (name.equals(".")) {
+ return groupDirResolver.getGroupDirectory(variables);
+ }
+
+ Collection<String> searchPath = getSearchPath(variables);
+
+ log.trace("Search path: {}", searchPath);
+
+ FileObject groupDir = groupDirResolver.getGroupDirectory(variables);
+
+ log.trace("Group dir: {}", groupDir);
+
+ FileObject file = null;
+
+ for (String pathElement : searchPath) {
+ log.trace("Resolving file; name={}, pathElement={}", name, pathElement);
+
+ FileObject dir;
+
+ if (pathElement.equals("/")) {
+ dir = root;
+ }
+ else if (pathElement.startsWith("/")) {
+ dir = fileSystemAccess.resolveFile(root, pathElement.substring(1, pathElement.length()));
+ }
+ else {
+ dir = fileSystemAccess.resolveFile(groupDir, pathElement);
+ }
+
+ log.trace("Dir: {}", dir);
+
+ FileObject tmp = fileSystemAccess.resolveFile(dir, name);
+
+ log.trace("File: {}", tmp);
+
+ if (tmp.exists()) {
+ file = tmp;
+ break;
+ }
+ }
+
+ if (file != null) {
+ log.trace("Resolved file: {}", file);
+ }
+
+ return file;
+ }
+
+ private Collection<String> getSearchPath(final Variables vars) {
+ assert vars != null;
+
+ Object tmp = vars.get(PATH);
+
+ if (tmp instanceof String) {
+ return Arrays.asList(((String)tmp).split(PATH_SEPARATOR));
+ }
+ else if (tmp != null) {
+ log.error("Invalid type for variable '" + PATH + "'; expected String; found: " + tmp.getClass());
+ }
+
+ // Return the default search path (group then root)
+ return Arrays.asList(".", "/");
+ }
+
+ public Collection<Command> resolveCommands(String name, Variables variables) throws CommandException {
+ // name may be null
+ assert variables != null;
+
+ if (name == null) {
+ name = "";
+ }
+
+ log.debug("Resolving commands for name: {}", name);
+
+ List<Command> commands = new ArrayList<Command>();
+
+ try {
+ FileObject file = resolveCommandFile(name, variables);
+
+ log.trace("Resolved (for commands): {}", file);
+
+ if (file != null && file.exists()) {
+ if (file.getType().hasChildren()) {
+ for (FileObject child : file.getChildren()) {
+ Command command = createCommand(child);
+ commands.add(command);
+ }
+ }
+ else {
+ Command command = createCommand(file);
+ commands.add(command);
+ }
+ }
+ }
+ catch (FileSystemException e) {
+ log.warn("Failed to resolve commands for name: " + name, e);
+ }
+
+ log.debug("Resolved {} commands", commands.size());
+ if (log.isTraceEnabled()) {
+ for (Command command : commands) {
+ log.trace(" {}", command);
+ }
+ }
+
+ return commands;
+ }
+
+ private Command createCommand(FileObject file) throws FileSystemException, CommandException {
+ assert file != null;
+
+ // HACK: Must dereference to avoid problems with the DelegateFileObject impl
+ file = fileSystemAccess.dereference(file);
+
+ log.trace("Creating command for file: {} ({})", file, file.getClass());
+
+ Command command = null;
+
+ if (file.exists()) {
+ FileContent content = file.getContent();
+ command = (Command)content.getAttribute("COMMAND");
+
+ if (command == null) {
+ if (file.getType().hasChildren()) {
+ command = createGroupCommand(file);
+ content.setAttribute("COMMAND", command);
+ }
+
+ // TODO: Try to construct AliasCommand?
+ }
+ }
+
+ if (command == null) {
+ throw new CommandException("Unable to create command for file: " + file.getName());
+ }
+
+ return command;
+ }
+
+ private AliasCommand createAliasCommand(final FileObject file) throws FileSystemException {
+ assert file != null;
+
+ String name = file.getName().getBaseName();
+
+ log.trace("Creating command for alias: {}", name);
+
+ AliasCommand command = container.getBean(aliasCommandBeanId, AliasCommand.class);
+
+ String alias = (String) file.getContent().getAttribute("ALIAS");
+ if (alias == null) {
+ throw new IllegalStateException("Alias meta-file does not contain 'ALIAS' attribute: " + file);
+ }
+
+ command.setName(name);
+ command.setAlias(alias);
+
+ return command;
+ }
+
+ private GroupCommand createGroupCommand(final FileObject file) throws FileSystemException {
+ assert file != null;
+
+ log.trace("Creating command for group: {}", file);
+
+ GroupCommand command = container.getBean(groupCommandBeanId, GroupCommand.class);
+ String path = fileSystemAccess.dereference(commandsRoot).getName().getRelativeName(file.getName());
+ if (".".equals(path)) {
+ path = "/";
+ }
+ command.setPath(path);
+
+ return command;
+ }
+}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandRegistry.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandRegistry.java
index d0daff3..49ad0cb 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandRegistry.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/OsgiCommandRegistry.java
@@ -37,21 +37,21 @@
this.commandRegistry = commandRegistry;
}
- public synchronized void register(final Command command, Map<String, ?> properties) throws Exception {
+ public synchronized void register(final Command command, Map props) throws Exception {
commandRegistry.registerCommand(command);
}
- public synchronized void unregister(final Command command, Map<String, ?> properties) throws Exception {
+ public synchronized void unregister(final Command command, Map props) throws Exception {
commandRegistry.removeCommand(command);
}
- public synchronized void register(final Link link, Map<String, ?> properties) throws Exception {
+ public synchronized void register(final Link link, Map props) throws Exception {
LinkCommand cmd = new LinkCommand(commandRegistry, link.getTarget());
cmd.setLocation(new CommandLocationImpl(link.getName()));
commandRegistry.registerCommand(cmd);
}
- public synchronized void unregister(final Link link, Map<String, ?> properties) throws Exception {
+ public synchronized void unregister(final Link link, Map props) throws Exception {
commandRegistry.removeCommand(commandRegistry.getCommand(link.getName()));
}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
index 4f0240f..2ab3aca 100644
--- a/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/felix/karaf/gshell/core/config/NamespaceHandler.java
@@ -17,467 +17,269 @@
* under the License.
*/
package org.apache.felix.karaf.gshell.core.config;
-
+import java.net.URL;
import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.GenericBeanDefinition;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.parsing.BeanComponentDefinition;
-import org.springframework.util.StringUtils;
-import org.springframework.util.xml.DomUtils;
-import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
-import org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter;
-import org.apache.geronimo.gshell.wisdom.command.LinkImpl;
-import org.apache.geronimo.gshell.wisdom.command.AliasImpl;
-import org.apache.geronimo.gshell.wisdom.command.StatefulCommand;
+import org.apache.geronimo.blueprint.ParserContext;
+import org.apache.geronimo.blueprint.mutable.MutableBeanMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableCollectionMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableIdRefMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableServiceMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableValueMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableRefMetadata;
+import org.apache.geronimo.gshell.command.Alias;
import org.apache.geronimo.gshell.command.Command;
import org.apache.geronimo.gshell.command.Link;
-import org.apache.geronimo.gshell.command.Alias;
-import org.apache.felix.karaf.gshell.core.OsgiCommandRegistry;
-import org.apache.felix.karaf.gshell.core.BeanContainerAwareProcessor;
+import org.apache.geronimo.gshell.wisdom.command.AliasImpl;
+import org.apache.geronimo.gshell.wisdom.command.CommandMessageSource;
+import org.apache.geronimo.gshell.wisdom.command.LinkImpl;
+import org.apache.geronimo.gshell.wisdom.command.MessageSourceCommandDocumenter;
+import org.apache.geronimo.gshell.wisdom.command.StatefulCommand;
+import org.apache.geronimo.gshell.wisdom.command.StatelessCommand;
+import org.apache.geronimo.gshell.wisdom.command.ConfigurableCommandCompleter;
+import org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl;
+import org.apache.felix.karaf.gshell.core.BeanContainerWrapper;
+import org.osgi.service.blueprint.reflect.BeanArgument;
+import org.osgi.service.blueprint.reflect.BeanProperty;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.IdRefMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.osgi.service.blueprint.reflect.NullMetadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.container.BlueprintContainer;
-public class NamespaceHandler extends NamespaceHandlerSupport {
- public void init() {
- registerBeanDefinitionParser(CommandParser.COMMAND_BUNDLE, new CommandParser());
+public class NamespaceHandler implements org.apache.geronimo.blueprint.NamespaceHandler {
+
+ public static final String ID = "id";
+ public static final String DESCRIPTION = "description";
+ public static final String PLUGIN_TEMPLATE = "pluginTemplate";
+ public static final String ACTION = "action";
+ public static final String ACTION_ID = "actionId";
+ public static final String COMMAND_TEMPLATE_SUFFIX = "CommandTemplate";
+ public static final String COMMAND_BUNDLE = "command-bundle";
+ public static final String NAME = "name";
+ public static final String LOCATION = "location";
+ public static final String COMMANDS = "commands";
+ public static final String COMMAND = "command";
+ public static final String TYPE = "type";
+ public static final String DOCUMENTER = "documenter";
+ public static final String COMPLETER = "completer";
+ public static final String COMPLETERS = "completers";
+ public static final String BEAN = "bean";
+ public static final String REF = "ref";
+ public static final String NULL = "null";
+ public static final String MESSAGE_SOURCE = "message-source";
+ public static final String MESSAGES = "messages";
+ public static final String PROTOTYPE = "prototype";
+ public static final String ALIAS = "alias";
+ public static final String ALIASES = "aliases";
+ public static final String LINK = "link";
+ public static final String LINKS = "links";
+ public static final String TARGET = "target";
+
+ public static final String TYPE_STATEFUL = "stateful";
+ public static final String TYPE_STATELESS = "stateless";
+
+ private int nameCounter = 0;
+
+ public URL getSchemaLocation(String namespace) {
+ return getClass().getResource("/org/apache/felix/karaf/gshell/core/karaf-gshell.xsd");
}
- public static class CommandParser extends AbstractBeanDefinitionParser {
+ public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext context) {
+ throw new ComponentDefinitionException("Bad xml syntax: node decoration is not supported");
+ }
- public static final String ID = ID_ATTRIBUTE;
-
- public static final String DESCRIPTION = "description";
-
- public static final String PLUGIN_TEMPLATE = "pluginTemplate";
-
- public static final String ACTION = "action";
-
- public static final String ACTION_ID = "actionId";
-
- public static final String COMMAND_TEMPLATE_SUFFIX = "CommandTemplate";
-
- public static final String COMMAND_BUNDLE = "command-bundle";
-
- public static final String NAME = "name";
-
- public static final String LOCATION = "location";
-
- public static final String COMMANDS = "commands";
-
- public static final String COMMAND = "command";
-
- public static final String DOCUMENTER = "documenter";
-
- public static final String COMPLETER = "completer";
-
- public static final String COMPLETERS = "completers";
-
- public static final String BEAN = "bean";
-
- public static final String REF = "ref";
-
- public static final String NULL = "null";
-
- public static final String MESSAGE_SOURCE = "message-source";
-
- public static final String MESSAGES = "messages";
-
- public static final String PROTOTYPE = "prototype";
-
- public static final String ALIAS = "alias";
-
- public static final String ALIASES = "aliases";
-
- public static final String LINK = "link";
-
- public static final String LINKS = "links";
-
- public static final String TARGET = "target";
-
- @Override
- protected boolean shouldGenerateId() {
- return true;
- }
-
- @Override
- protected boolean shouldGenerateIdAsFallback() {
- return true;
- }
-
- protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext context) {
- assert element != null;
- assert context != null;
-
- new Builder(context).parseCommandBundle(element);
- // We need to return a valid bean
- BeanDefinitionBuilder dummy = BeanDefinitionBuilder.rootBeanDefinition(String.class);
- return dummy.getBeanDefinition();
- }
-
- /**
- * Helper to build plugin related bean definitions.
- */
- private class Builder
- {
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private ParserContext context;
-
- public Builder(final ParserContext context) {
- assert context != null;
-
- this.context = context;
- }
-
- private String resolveId(final Element element, final BeanDefinition def) throws BeanDefinitionStoreException {
- assert element != null;
- assert def != null;
-
- if (shouldGenerateId()) {
- return context.getReaderContext().generateBeanName(def);
+ public Metadata parse(Element element, ParserContext context) {
+ if (nodeNameEquals(element, COMMAND_BUNDLE)) {
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof Element) {
+ Element childElement = (Element) child;
+ parseChildElement(childElement, context);
}
-
- String id = element.getAttribute(ID_ATTRIBUTE);
-
- if (!StringUtils.hasText(id) && shouldGenerateIdAsFallback()) {
- id = context.getReaderContext().generateBeanName(def);
- }
-
- return id;
}
+ return null;
+ } else {
+ throw new IllegalStateException("Unexpected element " + element.getNodeName());
+ }
+ }
- @SuppressWarnings({"unchecked"})
- private List<Element> getChildElements(final Element element, final String name) {
- assert element != null;
- assert name != null;
+ private void parseChildElement(Element element, ParserContext context) {
+ if (nodeNameEquals(element, COMMAND)) {
+ parseCommand(element, context);
+ } else if (nodeNameEquals(element, LINK)) {
+ parseLink(element, context);
+ } else if (nodeNameEquals(element, ALIAS)) {
+ parseAlias(element, context);
+ }
+ }
- return DomUtils.getChildElementsByTagName(element, name);
- }
+ private void parseCommand(Element element, ParserContext context) {
+ MutableBeanMetadata command = context.createMetadata(MutableBeanMetadata.class);
+ String type = element.hasAttribute(TYPE) ? element.getAttribute(TYPE) : TYPE_STATEFUL;
+ boolean stateful;
+ if (TYPE_STATEFUL.equals(type)) {
+ command.setRuntimeClass(StatefulCommand.class);
+ stateful = true;
+ } else if (TYPE_STATELESS.equals(type)) {
+ command.setRuntimeClass(StatelessCommand.class);
+ stateful = false;
+ } else {
+ throw new ComponentDefinitionException("Bad xml syntax: unknown value '" + type + "' for attribute " + TYPE);
+ }
+ MutableBeanMetadata beanContainer = context.createMetadata(MutableBeanMetadata.class);
+ beanContainer.setRuntimeClass(BeanContainerWrapper.class);
+ beanContainer.addArgument(createRef(context, "blueprintContainer"), BlueprintContainer.class.getName(), 0);
+ command.addProperty("beanContainer", beanContainer);
+ MutableBeanMetadata documenter = context.createMetadata(MutableBeanMetadata.class);
+ documenter.setRuntimeClass(MessageSourceCommandDocumenter.class);
+ command.addProperty(DOCUMENTER, documenter);
+ MutableBeanMetadata messages = context.createMetadata(MutableBeanMetadata.class);
+ messages.setRuntimeClass(CommandMessageSource.class);
+ command.addProperty(MESSAGES, messages);
+ MutableBeanMetadata location = context.createMetadata(MutableBeanMetadata.class);
+ location.setRuntimeClass(CommandLocationImpl.class);
+ location.addArgument(createStringValue(context, element.getAttribute(NAME)), String.class.getName(), 0);
+ command.addProperty(LOCATION, location);
- @SuppressWarnings({"unchecked"})
- private List<Element> getChildElements(final Element element, final String[] names) {
- assert element != null;
- assert names != null;
-
- return DomUtils.getChildElementsByTagName(element, names);
- }
-
- @SuppressWarnings({"unchecked"})
- private Element getChildElement(final Element element, final String name) {
- assert element != null;
- assert name != null;
-
- List<Element> elements = DomUtils.getChildElementsByTagName(element, name);
- if (elements != null && !elements.isEmpty()) {
- return elements.get(0);
- }
- return null;
- }
-
- private BeanDefinitionParserDelegate createBeanDefinitionParserDelegate(final Element element) {
- assert element != null;
-
- BeanDefinitionParserDelegate parser = new BeanDefinitionParserDelegate(context.getReaderContext());
- parser.initDefaults(element.getOwnerDocument().getDocumentElement());
- return parser;
- }
-
- private BeanDefinitionHolder parseBeanDefinitionElement(final Element element) {
- assert element != null;
-
- BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(element);
- return parser.parseBeanDefinitionElement(element);
- }
-
- private void parseAndApplyDescription(final Element element, final BeanDefinition def) {
- assert element != null;
- assert def != null;
-
- Element desc = getChildElement(element, DESCRIPTION);
- if (desc != null) {
- if (def instanceof AbstractBeanDefinition) {
- ((AbstractBeanDefinition)def).setDescription(desc.getTextContent());
+ boolean hasAction = false;
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof Element) {
+ Element childElement = (Element) child;
+ if (nodeNameEquals(childElement, ACTION)) {
+ if (hasAction) {
+ throw new ComponentDefinitionException("Only one " + ACTION + " element can be set for a given command");
}
- }
- }
-
- private void parseAndApplyDescription(final Element element, final BeanDefinitionBuilder builder) {
- assert element != null;
- assert builder != null;
-
- parseAndApplyDescription(element, builder.getRawBeanDefinition());
- }
-
- private BeanDefinitionHolder register(final BeanDefinitionHolder holder) {
- assert holder != null;
-
- registerBeanDefinition(holder, context.getRegistry());
- return holder;
- }
-
- private BeanDefinitionHolder register(final BeanDefinition def, final String id) {
- assert def != null;
- assert id != null;
-
- BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
- return register(holder);
- }
-
- //
- // <gshell:command-bundle>
- //
-
- private void parseCommandBundle(final Element element) {
- assert element != null;
-
- log.trace("Parse command bundle; element; {}", element);
-
- if (!context.getRegistry().containsBeanDefinition("$beanContainerAwareProcessor")) {
- BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(BeanContainerAwareProcessor.class);
- context.getRegistry().registerBeanDefinition("$beanContainerAwareProcessor", builder.getBeanDefinition());
- }
-
- parseCommands(element);
- parseLinks(element);
- parseAliases(element);
- }
-
- //
- // <gshell:command>
- //
-
- private void parseCommands(final Element element) {
- assert element != null;
-
- log.trace("Parse commands; element; {}", element);
-
- List<Element> children = getChildElements(element, COMMAND);
- for (Element child : children) {
- parseCommand(child);
- }
- }
-
- private void parseCommand(final Element element) {
- assert element != null;
-
- log.trace("Parse command; element; {}", element);
-
- BeanDefinitionBuilder command = BeanDefinitionBuilder.genericBeanDefinition(StatefulCommand.class);
- parseAndApplyDescription(element, command);
-
- Element child;
-
- // Required children elements
-
- String name = element.getAttribute(NAME);
- BeanDefinition def = new GenericBeanDefinition();
- def.setBeanClassName(CommandLocationImpl.class.getName());
- def.getConstructorArgumentValues().addGenericArgumentValue(name);
- command.addPropertyValue(LOCATION, def);
-
- child = getChildElement(element, ACTION);
- BeanDefinitionHolder action = parseCommandAction(child);
- command.addPropertyValue(ACTION_ID, action.getBeanName());
-
- // Optional children elements
-
- child = getChildElement(element, DOCUMENTER);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(DOCUMENTER, holder.getBeanDefinition());
+ hasAction = true;
+ MutableBeanMetadata action = parseAction(context, command, childElement);
+ // TODO: parse other stuff or remove it from schema
+ if (stateful) {
+ action.setId(getName());
+ context.getComponentDefinitionRegistry().registerComponentDefinition(action);
+ command.addProperty(ACTION_ID, createIdRef(context, action.getId()));
+ } else {
+ command.addProperty(ACTION, action);
+ }
+ } else if (nodeNameEquals(childElement, COMPLETERS)) {
+ command.addProperty(COMPLETER, parseCompleters(context, command, childElement));
} else {
- BeanDefinition documenter = new GenericBeanDefinition();
- documenter.setBeanClassName("org.apache.geronimo.gshell.wisdom.command.MessageSourceCommandDocumenter");
- command.addPropertyValue(DOCUMENTER, documenter);
- }
-
- child = getChildElement(element, COMPLETER);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(COMPLETER, holder.getBeanDefinition());
- }
-
- child = getChildElement(element, COMPLETERS);
- if (child != null) {
- BeanDefinitionBuilder completer = parseCommandCompleters(child);
- command.addPropertyValue(COMPLETER, completer.getBeanDefinition());
- }
-
- child = getChildElement(element, MESSAGE_SOURCE);
- if (child != null) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- command.addPropertyValue(MESSAGES, holder.getBeanDefinition());
- } else {
- BeanDefinition msgSource = new GenericBeanDefinition();
- msgSource.setBeanClassName("org.apache.geronimo.gshell.wisdom.command.CommandMessageSource");
- command.addPropertyValue(MESSAGES, msgSource);
- }
-
- //String id = resolveId(element, command.getBeanDefinition());
- //BeanDefinitionHolder holder = register(command.getBeanDefinition(), id);
-
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
- bd.addPropertyReference("bundleContext", "bundleContext");
- bd.addPropertyValue("target", command.getBeanDefinition());
- bd.addPropertyValue("interfaces", new Class[] { Command.class });
- Map<String,String> props = new HashMap<String,String>();
- props.put(OsgiCommandRegistry.NAME, name);
- bd.addPropertyValue("serviceProperties", props);
- BeanDefinition defSvc = bd.getBeanDefinition();
- String id = context.getReaderContext().generateBeanName(defSvc);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
- registerBeanDefinition(holder, context.getRegistry());
- if (shouldFireEvents()) {
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- postProcessComponentDefinition(componentDefinition);
- context.registerComponent(componentDefinition);
- }
- }
-
- //
- // <gshell:completers>
- //
-
- private BeanDefinitionBuilder parseCommandCompleters(final Element element) {
- assert element != null;
-
- BeanDefinitionBuilder completer = BeanDefinitionBuilder.rootBeanDefinition(ConfigurableCommandCompleter.class);
-
- ManagedList completers = new ManagedList();
-
- List<Element> children = getChildElements(element, new String[] {BEAN, REF, NULL});
-
- for (Element child : children) {
- if (DomUtils.nodeNameEquals(child, BEAN)) {
- BeanDefinitionHolder holder = parseBeanDefinitionElement(child);
- // noinspection unchecked
- completers.add(holder.getBeanDefinition());
- }
- else if (DomUtils.nodeNameEquals(child, REF)) {
- BeanDefinitionParserDelegate parser = createBeanDefinitionParserDelegate(child);
- RuntimeBeanReference ref = (RuntimeBeanReference) parser.parsePropertySubElement(child, completer.getRawBeanDefinition());
- // noinspection unchecked
- completers.add(ref);
- }
- else if (DomUtils.nodeNameEquals(child, NULL)) {
- // noinspection unchecked
- completers.add(null);
- }
- }
-
- completer.addConstructorArgValue(completers);
-
- return completer;
- }
-
- //
- // <gshell:action>
- //
-
- private BeanDefinitionHolder parseCommandAction(final Element element) {
- assert element != null;
-
- log.trace("Parse command action; element; {}", element);
-
- // Construct the action
- BeanDefinition action = parseBeanDefinitionElement(element).getBeanDefinition();
-
- // All actions are configured as prototypes
- action.setScope(PROTOTYPE);
-
- // Generate id and register the bean
- String id = resolveId(element, action);
- return register(action, id);
- }
-
- //
- // <gshell:link>
- //
-
- private void parseLinks(final Element element) {
- assert element != null;
-
- log.trace("Parse links; element; {}", element);
-
- List<Element> children = getChildElements(element, LINK);
-
- for (Element child : children) {
- String name = child.getAttribute(NAME);
- String target = child.getAttribute(TARGET);
-
- BeanDefinitionBuilder link = BeanDefinitionBuilder.genericBeanDefinition(LinkImpl.class);
- link.addConstructorArgValue(name);
- link.addConstructorArgValue(target);
-
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
- bd.addPropertyReference("bundleContext", "bundleContext");
- bd.addPropertyValue("target", link.getBeanDefinition());
- bd.addPropertyValue("interfaces", new Class[] { Link.class });
- BeanDefinition defSvc = bd.getBeanDefinition();
- String id = context.getReaderContext().generateBeanName(defSvc);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
- registerBeanDefinition(holder, context.getRegistry());
- if (shouldFireEvents()) {
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- postProcessComponentDefinition(componentDefinition);
- context.registerComponent(componentDefinition);
- }
-
- }
- }
-
- //
- // <gshell:alias>
- //
-
- private void parseAliases(final Element element) {
- assert element != null;
-
- log.trace("Parse aliases; element; {}", element);
-
- List<Element> children = getChildElements(element, ALIAS);
-
- for (Element child : children) {
- String name = child.getAttribute(NAME);
- String aliasValue = child.getAttribute(ALIAS);
-
- BeanDefinitionBuilder alias = BeanDefinitionBuilder.genericBeanDefinition(AliasImpl.class);
- alias.addConstructorArgValue(name);
- alias.addConstructorArgValue(aliasValue);
-
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
- bd.addPropertyReference("bundleContext", "bundleContext");
- bd.addPropertyValue("target", alias.getBeanDefinition());
- bd.addPropertyValue("interfaces", new Class[] { Alias.class });
- BeanDefinition defSvc = bd.getBeanDefinition();
- String id = context.getReaderContext().generateBeanName(defSvc);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(defSvc, id);
- registerBeanDefinition(holder, context.getRegistry());
- if (shouldFireEvents()) {
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- postProcessComponentDefinition(componentDefinition);
- context.registerComponent(componentDefinition);
- }
-
+ throw new ComponentDefinitionException("Bad xml syntax: unknown element '" + childElement.getNodeName() + "'");
}
}
}
+
+ MutableServiceMetadata commandService = context.createMetadata(MutableServiceMetadata.class);
+ commandService.setId(getName());
+ commandService.addInterfaceName(Command.class.getName());
+ commandService.setServiceComponent(command);
+ context.getComponentDefinitionRegistry().registerComponentDefinition(commandService);
+ }
+
+ private MutableBeanMetadata parseAction(ParserContext context, ComponentMetadata enclosingComponent, Element element) {
+ MutableBeanMetadata action = context.createMetadata(MutableBeanMetadata.class);
+ action.setClassName(element.getAttribute("class"));
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof Element) {
+ Element childElement = (Element) child;
+ if (nodeNameEquals(childElement, "argument")) {
+ action.addArgument(context.parseElement(BeanArgument.class, enclosingComponent, childElement));
+ } else if (nodeNameEquals(childElement, "property")) {
+ action.addProperty(context.parseElement(BeanProperty.class, enclosingComponent, childElement));
+ }
+ }
+ }
+ return action;
+ }
+
+ private Metadata parseCompleters(ParserContext context, ComponentMetadata enclosingComponent, Element element) {
+ MutableBeanMetadata completer = context.createMetadata(MutableBeanMetadata.class);
+ completer.setRuntimeClass(ConfigurableCommandCompleter.class);
+ MutableCollectionMetadata collection = context.createMetadata(MutableCollectionMetadata.class);
+ collection.setCollectionClass(List.class);
+ NodeList children = element.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof Element) {
+ Metadata metadata;
+ if (nodeNameEquals(child, REF)) {
+ metadata = context.parseElement(RefMetadata.class, context.getEnclosingComponent(), (Element) child);
+ } else if (nodeNameEquals(child, NULL)) {
+ metadata = context.parseElement(NullMetadata.class, context.getEnclosingComponent(), (Element) child);
+ } else if (nodeNameEquals(child, BEAN)) {
+ metadata = context.parseElement(BeanMetadata.class, enclosingComponent, (Element) child);
+ } else {
+ throw new IllegalStateException("Unexpected element " + child.getNodeName());
+ }
+ collection.addValue(metadata);
+ }
+ }
+ completer.addArgument(collection, List.class.getName(), 0);
+ return completer;
+ }
+
+ private void parseLink(Element element, ParserContext context) {
+ MutableBeanMetadata link = context.createMetadata(MutableBeanMetadata.class);
+ link.setRuntimeClass(LinkImpl.class);
+ link.addArgument(createStringValue(context, element.getAttribute(NAME)), String.class.getName(), 0);
+ link.addArgument(createStringValue(context, element.getAttribute(TARGET)), String.class.getName(), 0);
+
+ MutableServiceMetadata linkService = context.createMetadata(MutableServiceMetadata.class);
+ linkService.setId(getName());
+ linkService.addInterfaceName(Link.class.getName());
+ linkService.setServiceComponent(link);
+ context.getComponentDefinitionRegistry().registerComponentDefinition(linkService);
+ }
+
+ private void parseAlias(Element element, ParserContext context) {
+ MutableBeanMetadata alias = context.createMetadata(MutableBeanMetadata.class);
+ alias.setRuntimeClass(AliasImpl.class);
+ alias.addArgument(createStringValue(context, element.getAttribute(NAME)), String.class.getName(), 0);
+ alias.addArgument(createStringValue(context, element.getAttribute(ALIAS)), String.class.getName(), 0);
+
+ MutableServiceMetadata aliasService = context.createMetadata(MutableServiceMetadata.class);
+ aliasService.setId(getName());
+ aliasService.addInterfaceName(Alias.class.getName());
+ aliasService.setServiceComponent(alias);
+ context.getComponentDefinitionRegistry().registerComponentDefinition(aliasService);
+ }
+
+ private ValueMetadata createStringValue(ParserContext context, String str) {
+ MutableValueMetadata value = context.createMetadata(MutableValueMetadata.class);
+ value.setStringValue(str);
+ return value;
+ }
+
+ private RefMetadata createRef(ParserContext context, String id) {
+ MutableRefMetadata idref = context.createMetadata(MutableRefMetadata.class);
+ idref.setComponentId(id);
+ return idref;
+ }
+
+ private IdRefMetadata createIdRef(ParserContext context, String id) {
+ MutableIdRefMetadata idref = context.createMetadata(MutableIdRefMetadata.class);
+ idref.setComponentId(id);
+ return idref;
+ }
+
+ public synchronized String getName() {
+ return "gshell-" + ++nameCounter;
+ }
+
+ private static boolean nodeNameEquals(Node node, String name) {
+ return (name.equals(node.getNodeName()) || name.equals(node.getLocalName()));
}
}
diff --git a/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/CacheStrategyConverter.java b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/CacheStrategyConverter.java
new file mode 100644
index 0000000..694209c
--- /dev/null
+++ b/karaf/gshell/gshell-core/src/main/java/org/apache/geronimo/gshell/vfs/config/CacheStrategyConverter.java
@@ -0,0 +1,49 @@
+/*
+ * 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.vfs.config;
+
+import org.osgi.service.blueprint.container.Converter;
+import org.apache.commons.vfs.CacheStrategy;
+
+public class CacheStrategyConverter implements Converter {
+
+ public boolean canConvert(Object o, Class aClass) {
+ return o instanceof String && aClass == CacheStrategy.class;
+ }
+
+ public Object convert(Object o, Class aClass) throws Exception {
+ if (canConvert(o, aClass)) {
+ String text = o.toString();
+ if (text.equalsIgnoreCase("MANUAL")) {
+ return CacheStrategy.MANUAL;
+ }
+ else if (text.equalsIgnoreCase("ON_RESOLVE")) {
+ return CacheStrategy.ON_RESOLVE;
+ }
+ else if (text.equalsIgnoreCase("ON_CALL")) {
+ return CacheStrategy.ON_CALL;
+ }
+ else {
+ throw new IllegalArgumentException("Unknown cache strategy: " + text);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.handlers b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index a495c4d..0000000
--- a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1,24 +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.
-##
-
-##
-## $Rev: 697807 $ $Date: 2008-09-22 20:12:04 +0700 (Mon, 22 Sep 2008) $
-##
-
-http\://servicemix.apache.org/schema/servicemix-gshell=org.apache.felix.karaf.gshell.core.config.NamespaceHandler
diff --git a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.schemas b/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.schemas
deleted file mode 100644
index e959892..0000000
--- a/karaf/gshell/gshell-core/src/main/resources/META-INF/spring.schemas
+++ /dev/null
@@ -1,24 +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.
-##
-
-##
-## $Rev: 697807 $ $Date: 2008-09-22 20:12:04 +0700 (Mon, 22 Sep 2008) $
-##
-
-http\://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd=org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
diff --git a/karaf/gshell/gshell-core/src/main/resources/OSGI-INF/blueprint/gshell-namespacehandler.xml b/karaf/gshell/gshell-core/src/main/resources/OSGI-INF/blueprint/gshell-namespacehandler.xml
new file mode 100644
index 0000000..453395d
--- /dev/null
+++ b/karaf/gshell/gshell-core/src/main/resources/OSGI-INF/blueprint/gshell-namespacehandler.xml
@@ -0,0 +1,29 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <service interface="org.apache.geronimo.blueprint.NamespaceHandler">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0"/>
+ </service-properties>
+ <bean class="org.apache.felix.karaf.gshell.core.config.NamespaceHandler"/>
+ </service>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd b/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/karaf-gshell.xsd
similarity index 77%
rename from karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
rename to karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/karaf-gshell.xsd
index 24fd718..a848db1 100644
--- a/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/servicemix-gshell.xsd
+++ b/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/karaf-gshell.xsd
@@ -20,14 +20,14 @@
<!-- $Rev: 699828 $ $Date: 2008-09-28 16:35:27 +0200 (Sun, 28 Sep 2008) $ -->
-<xsd:schema xmlns="http://servicemix.apache.org/schema/servicemix-gshell"
+<xsd:schema xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:beans="http://www.springframework.org/schema/beans"
- targetNamespace="http://servicemix.apache.org/schema/servicemix-gshell"
+ xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ targetNamespace="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
- <xsd:import namespace="http://www.springframework.org/schema/beans"/>
+ <xsd:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0"/>
<xsd:annotation>
<xsd:documentation>
@@ -43,7 +43,6 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
- <xsd:element ref="beans:description" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="command"/>
<xsd:element ref="alias"/>
@@ -61,7 +60,6 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
- <xsd:element ref="beans:description" minOccurs="0" maxOccurs="1"/>
<!--
NOTE: Not using an xsd:choice here, as I can't seem to figure out how to get it to properly
validate the min/max of the containted elements. W/o the xsd:choice the validation
@@ -86,9 +84,6 @@
Defines a link command.
</xsd:documentation>
</xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="beans:description" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="target" type="xsd:string" use="required"/>
</xsd:complexType>
@@ -102,14 +97,9 @@
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
- <xsd:element ref="beans:description" minOccurs="0"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element ref="beans:meta"/>
- <xsd:element ref="beans:constructor-arg"/>
- <xsd:element ref="beans:property"/>
- <xsd:element ref="beans:qualifier"/>
- <xsd:element ref="beans:lookup-method"/>
- <xsd:element ref="beans:replaced-method"/>
+ <xsd:element name="argument" type="bp:Targument"/>
+ <xsd:element name="property" type="bp:Tproperty"/>
<!--
NOTE: This seems to cause schema validation problems... not really sure why
<xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/>
@@ -126,35 +116,8 @@
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="class" type="xsd:string"/>
- <xsd:attribute name="parent" type="xsd:string"/>
- <xsd:attribute name="autowire" default="default">
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="default"/>
- <xsd:enumeration value="no"/>
- <xsd:enumeration value="byName"/>
- <xsd:enumeration value="byType"/>
- <xsd:enumeration value="constructor"/>
- <xsd:enumeration value="autodetect"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="dependency-check" default="default">
- <xsd:simpleType>
- <xsd:restriction base="xsd:NMTOKEN">
- <xsd:enumeration value="default"/>
- <xsd:enumeration value="none"/>
- <xsd:enumeration value="simple"/>
- <xsd:enumeration value="objects"/>
- <xsd:enumeration value="all"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
<xsd:attribute name="depends-on" type="xsd:string"/>
- <xsd:attribute name="autowire-candidate" default="default" type="beans:defaultable-boolean"/>
- <xsd:attribute name="primary" type="xsd:boolean"/>
<xsd:attribute name="init-method" type="xsd:string"/>
- <xsd:attribute name="destroy-method" type="xsd:string"/>
<xsd:attribute name="factory-method" type="xsd:string"/>
<xsd:attribute name="factory-bean" type="xsd:string"/>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
@@ -218,9 +181,9 @@
</xsd:annotation>
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:element ref="beans:bean"/>
- <xsd:element ref="beans:ref"/>
- <xsd:element ref="beans:null"/>
+ <xsd:element name="bean" type="bp:Tbean"/>
+ <xsd:element name="ref" type="bp:Tref"/>
+ <xsd:element name="null" type="bp:Tnull"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
@@ -246,9 +209,6 @@
Defines a command alias.
</xsd:documentation>
</xsd:annotation>
- <xsd:sequence>
- <xsd:element ref="beans:description" minOccurs="0" maxOccurs="1"/>
- </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="alias" type="xsd:string" use="required"/>
</xsd:complexType>
diff --git a/karaf/gshell/gshell-features/pom.xml b/karaf/gshell/gshell-features/pom.xml
index 4a4701e..6d2868e 100644
--- a/karaf/gshell/gshell-features/pom.xml
+++ b/karaf/gshell/gshell-features/pom.xml
@@ -92,15 +92,15 @@
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
+ javax.management,
+ javax.management.loading,
org.apache.geronimo.gshell.command,
org.apache.geronimo.gshell.wisdom.command,
org.apache.geronimo.gshell.wisdom.registry,
org.apache.felix.karaf.gshell.core,
- org.springframework.beans.factory.config,
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeatureImpl.java b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeatureImpl.java
index 7c98877..ba206f4 100644
--- a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeatureImpl.java
+++ b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeatureImpl.java
@@ -22,13 +22,10 @@
import java.util.Map;
import org.apache.felix.karaf.gshell.features.Feature;
-import org.springframework.jmx.export.annotation.ManagedAttribute;
-import org.springframework.jmx.export.annotation.ManagedResource;
/**
* A feature
*/
-@ManagedResource(description = "Managed Feature", currencyTimeLimit = 15)
public class FeatureImpl implements Feature {
private String id;
@@ -50,17 +47,14 @@
this.id = name + "-" + version;
}
- @ManagedAttribute(description = "Feature Unique ID")
public String getId() {
return id;
}
- @ManagedAttribute(description = "Feature Name")
public String getName() {
return name;
}
- @ManagedAttribute(description = "Feature Version")
public String getVersion() {
return version;
}
@@ -69,7 +63,6 @@
this.version = version;
}
- @ManagedAttribute(description = "List of Dependencies")
public List<Feature> getDependencies() {
return dependencies;
}
diff --git a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeaturesServiceImpl.java b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeaturesServiceImpl.java
index 41facc4..acdafe3 100644
--- a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeaturesServiceImpl.java
+++ b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/FeaturesServiceImpl.java
@@ -53,7 +53,6 @@
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
import org.osgi.service.prefs.PreferencesService;
-import org.springframework.osgi.context.BundleContextAware;
/**
* The Features service implementation.
@@ -62,7 +61,7 @@
* installing the needed bundles.
*
*/
-public class FeaturesServiceImpl implements FeaturesService, BundleContextAware {
+public class FeaturesServiceImpl implements FeaturesService {
private static final String ALIAS_KEY = "_alias_factory_pid";
diff --git a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/RepositoryImpl.java b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/RepositoryImpl.java
index 9d5ade4..515425d 100644
--- a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/RepositoryImpl.java
+++ b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/internal/RepositoryImpl.java
@@ -39,15 +39,11 @@
import org.apache.felix.karaf.gshell.features.Feature;
import org.apache.felix.karaf.gshell.features.Repository;
-import org.springframework.jmx.export.annotation.ManagedAttribute;
-import org.springframework.jmx.export.annotation.ManagedOperation;
-import org.springframework.jmx.export.annotation.ManagedResource;
import org.xml.sax.SAXException;
/**
* The repository implementation.
*/
-@ManagedResource
public class RepositoryImpl implements Repository {
private URI uri;
@@ -58,12 +54,10 @@
this.uri = uri;
}
- @ManagedAttribute
public URI getURI() {
return uri;
}
- @ManagedOperation
public URI[] getRepositories() throws Exception {
if (repositories == null) {
load();
@@ -71,7 +65,6 @@
return repositories.toArray(new URI[repositories.size()]);
}
- @ManagedOperation(description = "List of Features provided by this repository")
public Feature[] getFeatures() throws Exception {
if (features == null) {
load();
diff --git a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
index 2b0d00e..e8a0ec0 100644
--- a/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
+++ b/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
@@ -181,7 +181,7 @@
}
}
- public void registerMBeanServer(MBeanServer mbeanServer, Map props ) throws Exception {
+ public void registerMBeanServer(MBeanServer mbeanServer, Map props) throws Exception {
if (mbeanServer != null) {
this.mbeanServer = mbeanServer;
}
@@ -204,7 +204,10 @@
installedFeatures.put(feature.getId(), feature);
managementAgent.register(feature, namingStrategy.getObjectName(feature, true));
}
+ }
+ public void unregisterMBeanServer(MBeanServer mbeanServer, Map props) throws Exception {
+ // TODO
}
diff --git a/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml b/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
deleted file mode 100644
index 5121ed5..0000000
--- a/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ctx="http://www.springframework.org/schema/context"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location" value="file:${karaf.home}/etc/org.apache.felix.karaf.features.cfg"/>
- <property name="ignoreResourceNotFound" value="true"/>
- <property name="properties">
- <props>
- <prop key="featuresRepositories"></prop>
- <prop key="featuresBoot"></prop>
- </props>
- </property>
- </bean>
-
- <gshell:command-bundle>
- <gshell:command name="features/addUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.AddUrlCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="features/listUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListUrlCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="features/removeUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RemoveUrlCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="removeUrlCompleter" />
- </gshell:completers>
- </gshell:command>
- <gshell:command name="features/refreshUrl">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.RefreshUrlCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="features/install">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.InstallFeatureCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="installFeatureCompleter" />
- </gshell:completers>
- </gshell:command>
- <gshell:command name="features/uninstall">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.UninstallFeatureCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="uninstallFeatureCompleter" />
- </gshell:completers>
- </gshell:command>
- <gshell:command name="features/list">
- <gshell:action class="org.apache.felix.karaf.gshell.features.commands.ListFeaturesCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
- <bean id="featuresService" class="org.apache.felix.karaf.gshell.features.internal.FeaturesServiceImpl" init-method="start" destroy-method="stop">
- <property name="urls" value="${featuresRepositories}" />
- <property name="boot" value="${featuresBoot}" />
- <property name="configAdmin" ref="configAdmin" />
- <property name="preferences" ref="preferences" />
- <property name="featuresServiceRegistry" ref="featureServiceRegistry" />
- </bean>
-
- <osgi:reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" />
-
- <osgi:reference id="preferences" interface="org.osgi.service.prefs.PreferencesService" cardinality="0..1" />
-
- <osgi:service ref="featuresService" interface="org.apache.felix.karaf.gshell.features.FeaturesService" />
-
- <bean id="installFeatureCompleter" class="org.apache.felix.karaf.gshell.features.completers.AvailableFeatureCompleter">
- <property name="featuresRegistry" ref="featureServiceRegistry" />
- </bean>
-
- <bean id="uninstallFeatureCompleter" class="org.apache.felix.karaf.gshell.features.completers.InstalledFeatureCompleter">
- <property name="featuresRegistry" ref="featureServiceRegistry" />
- </bean>
-
- <bean id="removeUrlCompleter" class="org.apache.felix.karaf.gshell.features.completers.FeatureRepositoryCompleter">
- <property name="featuresRegistry" ref="featureServiceRegistry" />
- </bean>
-
- <!-- Management -->
-
- <bean id="namingStrategy" class="org.apache.felix.karaf.gshell.features.management.DefaultNamingStrategy">
- <property name="jmxDomainName" value="org.apache.felix.karaf" />
- </bean>
-
- <bean id="managementAgent" class="org.apache.felix.karaf.gshell.features.management.ManagementAgent" destroy-method="destroy">
- <property name="mbeanServer" ref="mbeanServer" />
- </bean>
-
- <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry" init-method="init">
- <property name="managementAgent" ref="managementAgent" />
- <property name="namingStrategy" ref="namingStrategy" />
- </bean>
-
- <osgi:reference id="mbeanServer"
- interface="javax.management.MBeanServer"
- cardinality="0..1" >
- <osgi:listener ref="featureServiceRegistry" bind-method="registerMBeanServer"/>
- </osgi:reference>
-
-
-</beans>
diff --git a/karaf/gshell/gshell-features/src/main/resources/OSGI-INF/blueprint/gshell-features.xml b/karaf/gshell/gshell-features/src/main/resources/OSGI-INF/blueprint/gshell-features.xml
new file mode 100644
index 0000000..018255d
--- /dev/null
+++ b/karaf/gshell/gshell-features/src/main/resources/OSGI-INF/blueprint/gshell-features.xml
@@ -0,0 +1,126 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+ <ext:property-placeholder placeholder-prefix="$(" placeholder-suffix=")"/>
+
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]" ignore-missing-locations="true">
+ <ext:default-properties>
+ <ext:property name="featuresRepositories" value=""/>
+ <ext:property name="featuresBoot" value=""/>
+ </ext:default-properties>
+ <ext:location>file:$(karaf.home)/etc/org.apache.felix.karaf.features.cfg</ext:location>
+ </ext:property-placeholder>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="features/addUrl">
+ <action class="org.apache.felix.karaf.gshell.features.commands.AddUrlCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="features/listUrl">
+ <action class="org.apache.felix.karaf.gshell.features.commands.ListUrlCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="features/removeUrl">
+ <action class="org.apache.felix.karaf.gshell.features.commands.RemoveUrlCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="removeUrlCompleter" />
+ </completers>
+ </command>
+ <command name="features/refreshUrl">
+ <action class="org.apache.felix.karaf.gshell.features.commands.RefreshUrlCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="features/install">
+ <action class="org.apache.felix.karaf.gshell.features.commands.InstallFeatureCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="installFeatureCompleter" />
+ </completers>
+ </command>
+ <command name="features/uninstall">
+ <action class="org.apache.felix.karaf.gshell.features.commands.UninstallFeatureCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ <completers>
+ <ref component-id="uninstallFeatureCompleter" />
+ </completers>
+ </command>
+ <command name="features/list">
+ <action class="org.apache.felix.karaf.gshell.features.commands.ListFeaturesCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ </command-bundle>
+
+ <bean id="featuresService" class="org.apache.felix.karaf.gshell.features.internal.FeaturesServiceImpl" init-method="start" destroy-method="stop">
+ <property name="urls" value="$[featuresRepositories]" />
+ <property name="boot" value="$[featuresBoot]" />
+ <property name="configAdmin" ref="configAdmin" />
+ <property name="preferences" ref="preferences" />
+ <property name="featuresServiceRegistry" ref="featureServiceRegistry" />
+ <property name="bundleContext" ref="blueprintBundleContext" />
+ </bean>
+
+ <reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" />
+
+ <reference id="preferences" interface="org.osgi.service.prefs.PreferencesService" availability="optional"/>
+
+ <service ref="featuresService" interface="org.apache.felix.karaf.gshell.features.FeaturesService" />
+
+ <bean id="installFeatureCompleter" class="org.apache.felix.karaf.gshell.features.completers.AvailableFeatureCompleter">
+ <property name="featuresRegistry" ref="featureServiceRegistry" />
+ </bean>
+
+ <bean id="uninstallFeatureCompleter" class="org.apache.felix.karaf.gshell.features.completers.InstalledFeatureCompleter">
+ <property name="featuresRegistry" ref="featureServiceRegistry" />
+ </bean>
+
+ <bean id="removeUrlCompleter" class="org.apache.felix.karaf.gshell.features.completers.FeatureRepositoryCompleter">
+ <property name="featuresRegistry" ref="featureServiceRegistry" />
+ </bean>
+
+ <!-- Management -->
+
+ <bean id="namingStrategy" class="org.apache.felix.karaf.gshell.features.management.DefaultNamingStrategy">
+ <property name="jmxDomainName" value="org.apache.felix.karaf" />
+ </bean>
+
+ <bean id="managementAgent" class="org.apache.felix.karaf.gshell.features.management.ManagementAgent" destroy-method="destroy">
+ <property name="mbeanServer" ref="mbeanServer" />
+ </bean>
+
+ <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry" init-method="init">
+ <property name="managementAgent" ref="managementAgent" />
+ <property name="namingStrategy" ref="namingStrategy" />
+ </bean>
+
+ <reference id="mbeanServer" interface="javax.management.MBeanServer" availability="optional">
+ <listener ref="featureServiceRegistry" bind-method="registerMBeanServer" unbind-method="unregisterMBeanServer"/>
+ </reference>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-log/pom.xml b/karaf/gshell/gshell-log/pom.xml
index 7434fdc..c5d7dc8 100644
--- a/karaf/gshell/gshell-log/pom.xml
+++ b/karaf/gshell/gshell-log/pom.xml
@@ -85,7 +85,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml b/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
deleted file mode 100644
index f425142..0000000
--- a/karaf/gshell/gshell-log/src/main/resources/META-INF/spring/gshell-log.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ctx="http://www.springframework.org/schema/context"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="log/display">
- <gshell:action class="org.apache.felix.karaf.gshell.log.DisplayLog">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="events" ref="events" />
- <property name="pattern" value="${pattern}" />
- </gshell:action>
- </gshell:command>
- <gshell:link name="log/d" target="log/display" />
- <gshell:command name="log/display-exception">
- <gshell:action class="org.apache.felix.karaf.gshell.log.DisplayException">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="events" ref="events" />
- </gshell:action>
- </gshell:command>
- <gshell:link name="log/de" target="log/display-exception" />
- <gshell:command name="log/get">
- <gshell:action class="org.apache.felix.karaf.gshell.log.GetLogLevel">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="log/set">
- <gshell:action class="org.apache.felix.karaf.gshell.log.SetLogLevel">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:alias name="ld" alias="log/d" />
- <gshell:alias name="lde" alias="log/de" />
- </gshell:command-bundle>
-
- <bean id="vmLogAppender" class="org.apache.felix.karaf.gshell.log.VmLogAppender">
- <property name="events" ref="events" />
- </bean>
-
- <bean id="events" class="org.apache.felix.karaf.gshell.log.LruList">
- <constructor-arg value="${size}" />
- </bean>
-
- <osgi:service ref="vmLogAppender" interface="org.ops4j.pax.logging.spi.PaxAppender">
- <osgi:service-properties>
- <entry>
- <key><util:constant static-field="org.ops4j.pax.logging.PaxLoggingService.APPENDER_NAME_PROPERTY"/></key>
- <value>VmLogAppender</value>
- </entry>
- </osgi:service-properties>
- </osgi:service>
-
- <osgix:cm-properties id="cmProps" persistent-id="org.apache.felix.karaf.log">
- <prop key="size">500</prop>
- <prop key="pattern">%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n</prop>
- </osgix:cm-properties>
-
- <ctx:property-placeholder properties-ref="cmProps" />
-
-</beans>
diff --git a/karaf/gshell/gshell-log/src/main/resources/OSGI-INF/blueprint/gshell-log.xml b/karaf/gshell/gshell-log/src/main/resources/OSGI-INF/blueprint/gshell-log.xml
new file mode 100644
index 0000000..e0d2744
--- /dev/null
+++ b/karaf/gshell/gshell-log/src/main/resources/OSGI-INF/blueprint/gshell-log.xml
@@ -0,0 +1,77 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <!-- TODO: use dynamic CM config -->
+
+ <cm:property-placeholder persistent-id="org.apache.felix.karaf.log">
+ <cm:default-properties>
+ <cm:property name="size" value="500"/>
+ <cm:property name="pattern" value="%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="log/display">
+ <action class="org.apache.felix.karaf.gshell.log.DisplayLog">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="events" ref="events"/>
+ <property name="pattern" value="${pattern}"/>
+ </action>
+ </command>
+ <link name="log/d" target="log/display"/>
+ <command name="log/display-exception">
+ <action class="org.apache.felix.karaf.gshell.log.DisplayException">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="events" ref="events"/>
+ </action>
+ </command>
+ <link name="log/de" target="log/display-exception"/>
+ <command name="log/get">
+ <action class="org.apache.felix.karaf.gshell.log.GetLogLevel">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="log/set">
+ <action class="org.apache.felix.karaf.gshell.log.SetLogLevel">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+
+ <alias name="ld" alias="log/d"/>
+ <alias name="lde" alias="log/de"/>
+ </command-bundle>
+
+ <bean id="vmLogAppender" class="org.apache.felix.karaf.gshell.log.VmLogAppender">
+ <property name="events" ref="events"/>
+ </bean>
+
+ <bean id="events" class="org.apache.felix.karaf.gshell.log.LruList">
+ <argument value="${size}"/>
+ </bean>
+
+ <service ref="vmLogAppender" interface="org.ops4j.pax.logging.spi.PaxAppender">
+ <service-properties>
+ <entry key="org.ops4j.pax.logging.appender.name" value="VmLogAppender"/>
+ </service-properties>
+ </service>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-obr/pom.xml b/karaf/gshell/gshell-obr/pom.xml
index f7e9e6b..152c5b8 100644
--- a/karaf/gshell/gshell-obr/pom.xml
+++ b/karaf/gshell/gshell-obr/pom.xml
@@ -79,7 +79,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-osgi/pom.xml b/karaf/gshell/gshell-osgi/pom.xml
index 8fe8173..87dbe2b 100644
--- a/karaf/gshell/gshell-osgi/pom.xml
+++ b/karaf/gshell/gshell-osgi/pom.xml
@@ -77,7 +77,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java
new file mode 100644
index 0000000..7cb1666
--- /dev/null
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java
@@ -0,0 +1,109 @@
+/*
+ * 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.felix.karaf.gshell.osgi;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+
+/**
+ *
+ * TODO: use event admin to receive WAIT topics notifications from blueprint extender
+ *
+ */
+public class BlueprintListener implements org.osgi.service.blueprint.container.BlueprintListener, BundleListener {
+
+ public static enum BlueprintState {
+ Unknown,
+ Creating,
+ Created,
+ Destroying,
+ Destroyed,
+ Failure,
+ GracePeriod,
+ Waiting
+ }
+
+ private static final Log LOG = LogFactory.getLog(BlueprintListener.class);
+
+ private final Map<Long, BlueprintState> states;
+ private BundleContext bundleContext;
+
+ public BlueprintListener() {
+ this.states = new ConcurrentHashMap<Long, BlueprintState>();
+ }
+
+ public BlueprintState getBlueprintState(Bundle bundle) {
+ BlueprintState state = states.get(bundle.getBundleId());
+ if (state == null || bundle.getState() != Bundle.ACTIVE) {
+ state = BlueprintState.Unknown;
+ }
+ return state;
+ }
+
+ public void blueprintEvent(BlueprintEvent blueprintEvent) {
+ BlueprintState state = getState(blueprintEvent);
+ LOG.debug("Blueprint app state changed to " + state + " for bundle " + blueprintEvent.getBundle().getBundleId());
+ states.put(blueprintEvent.getBundle().getBundleId(), state);
+ }
+
+ public void bundleChanged(BundleEvent event) {
+ if (event.getType() == BundleEvent.UNINSTALLED) {
+ states.remove(event.getBundle().getBundleId());
+ }
+ }
+
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+
+ public void init() throws Exception {
+ bundleContext.addBundleListener(this);
+ }
+
+ public void destroy() throws Exception {
+ bundleContext.removeBundleListener(this);
+ }
+
+ private BlueprintState getState(BlueprintEvent blueprintEvent) {
+ switch (blueprintEvent.getType()) {
+ case BlueprintEvent.CREATING:
+ return BlueprintState.Creating;
+ case BlueprintEvent.CREATED:
+ return BlueprintState.Created;
+ case BlueprintEvent.DESTROYING:
+ return BlueprintState.Destroying;
+ case BlueprintEvent.DESTROYED:
+ return BlueprintState.Destroyed;
+ case BlueprintEvent.FAILURE:
+ return BlueprintState.Failure;
+ case BlueprintEvent.GRACE_PERIOD:
+ return BlueprintState.GracePeriod;
+ case BlueprintEvent.WAITING:
+ return BlueprintState.Waiting;
+ default:
+ return BlueprintState.Unknown;
+ }
+ }
+}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
index 1360b7a..9722120 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
@@ -35,14 +35,14 @@
@Option(name = "-u", description = "Show update")
boolean showUpdate;
- private SpringApplicationListener springApplicationListener;
+ private BlueprintListener blueprintListener;
- public SpringApplicationListener getSpringApplicationListener() {
- return springApplicationListener;
+ public BlueprintListener getBlueprintListener() {
+ return blueprintListener;
}
- public void setSpringApplicationListener(SpringApplicationListener springApplicationListener) {
- this.springApplicationListener = springApplicationListener;
+ public void setBlueprintListener(BlueprintListener blueprintListener) {
+ this.blueprintListener = blueprintListener;
}
protected Object doExecute() throws Exception {
@@ -124,7 +124,7 @@
}
io.out.println("[" + id + "] ["
+ getStateString(bundles[i])
- + "] [" + getSpringStateString(bundles[i])
+ + "] [" + getBlueprintStateString(bundles[i])
+ "] [" + level + "] " + name);
if (admin != null) {
@@ -188,16 +188,25 @@
}
}
- public String getSpringStateString(Bundle bundle) {
- SpringApplicationListener.SpringState state = springApplicationListener.getSpringState(bundle);
- if (state == SpringApplicationListener.SpringState.Waiting) {
- return "Waiting";
- } else if (state == SpringApplicationListener.SpringState.Started) {
- return "Started";
- } else if (state == SpringApplicationListener.SpringState.Failed) {
- return "Failed ";
- } else {
- return " ";
+ public String getBlueprintStateString(Bundle bundle) {
+ BlueprintListener.BlueprintState state = blueprintListener.getBlueprintState(bundle);
+ switch (state) {
+ case Creating:
+ return "Creating ";
+ case Created:
+ return "Created ";
+ case Destroying:
+ return "Destroying ";
+ case Destroyed:
+ return "Destroyed ";
+ case Failure:
+ return "Failure ";
+ case GracePeriod:
+ return "GracePeriod";
+ case Waiting:
+ return "Waiting ";
+ default:
+ return " ";
}
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java
deleted file mode 100644
index e9bd409..0000000
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/SpringApplicationListener.java
+++ /dev/null
@@ -1,101 +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.felix.karaf.gshell.osgi;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.osgi.context.BundleContextAware;
-import org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent;
-import org.springframework.osgi.context.event.OsgiBundleApplicationContextListener;
-import org.springframework.osgi.context.event.OsgiBundleContextFailedEvent;
-import org.springframework.osgi.context.event.OsgiBundleContextRefreshedEvent;
-import org.springframework.osgi.extender.event.BootstrappingDependencyEvent;
-import org.springframework.osgi.service.importer.event.OsgiServiceDependencyEvent;
-import org.springframework.osgi.service.importer.event.OsgiServiceDependencyWaitStartingEvent;
-
-public class SpringApplicationListener implements OsgiBundleApplicationContextListener,
- BundleListener {
-
- public static enum SpringState {
- Unknown,
- Waiting,
- Started,
- Failed,
- }
-
- private static final Log LOG = LogFactory.getLog(SpringApplicationListener.class);
-
- private final Map<Long, SpringState> states;
- private BundleContext bundleContext;
-
- public SpringApplicationListener() {
- this.states = new ConcurrentHashMap<Long, SpringState>();
- }
-
- public SpringState getSpringState(Bundle bundle) {
- SpringState state = states.get(bundle.getBundleId());
- if (state == null || bundle.getState() != Bundle.ACTIVE) {
- state = SpringState.Unknown;
- }
- return state;
- }
-
- public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {
- SpringState state = null;
- if (event instanceof BootstrappingDependencyEvent) {
- OsgiServiceDependencyEvent de = ((BootstrappingDependencyEvent) event).getDependencyEvent();
- if (de instanceof OsgiServiceDependencyWaitStartingEvent) {
- state = SpringState.Waiting;
- }
- } else if (event instanceof OsgiBundleContextFailedEvent) {
- state = SpringState.Failed;
- } else if (event instanceof OsgiBundleContextRefreshedEvent) {
- state = SpringState.Started;
- }
- if (state != null) {
- LOG.debug("Spring app state changed to " + state + " for bundle " + event.getBundle().getBundleId());
- states.put(event.getBundle().getBundleId(), state);
- }
- }
-
- public void bundleChanged(BundleEvent event) {
- if (event.getType() == BundleEvent.UNINSTALLED) {
- states.remove(event.getBundle().getBundleId());
- }
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public void init() throws Exception {
- bundleContext.addBundleListener(this);
- }
-
- public void destroy() throws Exception {
- bundleContext.removeBundleListener(this);
- }
-}
diff --git a/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml b/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
deleted file mode 100644
index e035408..0000000
--- a/karaf/gshell/gshell-osgi/src/main/resources/META-INF/spring/gshell-osgi.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="osgi/bundle-level">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.BundleLevel">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/headers">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.Headers">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/install">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.InstallBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/list">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.ListBundles">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="springApplicationListener" ref="springApplicationListener" />
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/ls">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.ListServices">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/refresh">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/update">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/resolve">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/restart">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.RestartBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/shutdown">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.Shutdown">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/start">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/start-level">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StartLevel">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/stop">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.StopBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="osgi/uninstall">
- <gshell:action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
- <bean id="springApplicationListener" class="org.apache.felix.karaf.gshell.osgi.SpringApplicationListener" init-method="init" destroy-method="destroy">
- <property name="bundleContext" ref="bundleContext"/>
- </bean>
-
- <osgi:service ref="springApplicationListener" interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener" />
-
-</beans>
diff --git a/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml b/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
new file mode 100644
index 0000000..e2cc24e
--- /dev/null
+++ b/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
@@ -0,0 +1,100 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="osgi/bundle-level">
+ <action class="org.apache.felix.karaf.gshell.osgi.BundleLevel">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/headers">
+ <action class="org.apache.felix.karaf.gshell.osgi.Headers">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/install">
+ <action class="org.apache.felix.karaf.gshell.osgi.InstallBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/list">
+ <action class="org.apache.felix.karaf.gshell.osgi.ListBundles">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ <property name="blueprintListener" ref="blueprintListener"/>
+ </action>
+ </command>
+ <command name="osgi/ls">
+ <action class="org.apache.felix.karaf.gshell.osgi.ListServices">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/refresh">
+ <action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/update">
+ <action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/resolve">
+ <action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/restart">
+ <action class="org.apache.felix.karaf.gshell.osgi.RestartBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/shutdown">
+ <action class="org.apache.felix.karaf.gshell.osgi.Shutdown">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/start">
+ <action class="org.apache.felix.karaf.gshell.osgi.StartBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/start-level">
+ <action class="org.apache.felix.karaf.gshell.osgi.StartLevel">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/stop">
+ <action class="org.apache.felix.karaf.gshell.osgi.StopBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="osgi/uninstall">
+ <action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ </command-bundle>
+
+ <bean id="blueprintListener" class="org.apache.felix.karaf.gshell.osgi.BlueprintListener" />
+
+ <service ref="blueprintListener" interface="org.osgi.service.blueprint.container.BlueprintListener" />
+
+</blueprint>
\ No newline at end of file
diff --git a/karaf/gshell/gshell-packages/pom.xml b/karaf/gshell/gshell-packages/pom.xml
index 617769d..1a23182 100644
--- a/karaf/gshell/gshell-packages/pom.xml
+++ b/karaf/gshell/gshell-packages/pom.xml
@@ -78,7 +78,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml b/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
deleted file mode 100644
index c0e9cc1..0000000
--- a/karaf/gshell/gshell-packages/src/main/resources/META-INF/spring/gshell-packages.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="packages/exports">
- <gshell:action class="org.apache.felix.karaf.gshell.packages.ExportsCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- <gshell:command name="packages/imports">
- <gshell:action class="org.apache.felix.karaf.gshell.packages.ImportsCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
-</beans>
diff --git a/karaf/gshell/gshell-packages/src/main/resources/OSGI-INF/blueprint/gshell-packages.xml b/karaf/gshell/gshell-packages/src/main/resources/OSGI-INF/blueprint/gshell-packages.xml
new file mode 100644
index 0000000..b591606
--- /dev/null
+++ b/karaf/gshell/gshell-packages/src/main/resources/OSGI-INF/blueprint/gshell-packages.xml
@@ -0,0 +1,35 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="packages/exports">
+ <action class="org.apache.felix.karaf.gshell.packages.ExportsCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ <command name="packages/imports">
+ <action class="org.apache.felix.karaf.gshell.packages.ImportsCommand">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </action>
+ </command>
+ </command-bundle>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-run/pom.xml b/karaf/gshell/gshell-run/pom.xml
index 82f5ed0..27b06ca 100644
--- a/karaf/gshell/gshell-run/pom.xml
+++ b/karaf/gshell/gshell-run/pom.xml
@@ -68,7 +68,6 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.commons.vfs,
org.apache.commons.vfs.cache,
@@ -133,10 +132,9 @@
org.apache.sshd,
org.apache.sshd.server.keyprovider,
org.apache.sshd.server.jaas,
- org.springframework.beans.factory.config,
+ org.osgi.service.blueprint.container,
*
</Import-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-commands.xml b/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-commands.xml
deleted file mode 100644
index 4ed2f90..0000000
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-commands.xml
+++ /dev/null
@@ -1,285 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <gshell:command-bundle>
- <gshell:command name="about">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.AboutAction">
- <constructor-arg ref="application"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:command name="help">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.HelpAction">
- <constructor-arg ref="commandResolver"/>
- </gshell:action>
- <gshell:completers>
- <bean class="org.apache.geronimo.gshell.console.completer.AggregateCompleter">
- <constructor-arg>
- <list>
- <ref bean="aliasNameCompleter"/>
- <ref bean="commandNameCompleter"/>
- </list>
- </constructor-arg>
- </bean>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="exit">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.ExitAction"/>
- </gshell:command>
-
- <gshell:link name="quit" target="exit"/>
-
- <gshell:command name="echo">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.EchoAction"/>
- </gshell:command>
-
- <gshell:command name="clear">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.ClearAction"/>
- </gshell:command>
-
- <gshell:command name="source">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.SourceAction">
- <constructor-arg ref="commandLineExecutor"/>
- <constructor-arg ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="set">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.SetAction"/>
- </gshell:command>
-
- <gshell:command name="unset">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.UnsetAction"/>
- <gshell:completers>
- <ref bean="variableNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="alias">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.AliasAction">
- <constructor-arg ref="aliasRegistry"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:command name="unalias">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.UnaliasAction">
- <constructor-arg ref="aliasRegistry"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="aliasNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="history">
- <gshell:action class="org.apache.geronimo.gshell.commands.builtin.HistoryAction"/>
- </gshell:command>
-
- <gshell:command name="info">
- <gshell:action class="org.apache.felix.karaf.gshell.core.commands.InfoAction">
- <constructor-arg ref="branding" />
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="ssh">
- <gshell:action class="org.apache.geronimo.gshell.commands.ssh.SshAction"/>
- </gshell:command>
-
- <gshell:command name="sshd">
- <gshell:action class="org.apache.geronimo.gshell.commands.ssh.SshServerAction"/>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="exec">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.ExecuteAction"/>
- </gshell:command>
-
- <gshell:command name="java">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.JavaAction"/>
- </gshell:command>
-
- <gshell:command name="sleep">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.SleepAction"/>
- </gshell:command>
-
- <gshell:command name="date">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.DateAction"/>
- </gshell:command>
-
- <gshell:command name="edit">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.EditAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="find">
- <gshell:action class="org.apache.geronimo.gshell.commands.shell.FindAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="sort">
- <gshell:action class="org.apache.geronimo.gshell.commands.text.SortAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="hostname">
- <gshell:action class="org.apache.geronimo.gshell.commands.network.HostnameAction"/>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:link name="print" target="echo"/>
-
- <gshell:command name="printf">
- <gshell:action class="org.apache.geronimo.gshell.commands.text.PrintfAction"/>
- </gshell:command>
-
- <gshell:command name="cat">
- <gshell:action class="org.apache.geronimo.gshell.commands.text.CatAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="grep">
- <gshell:action class="org.apache.geronimo.gshell.commands.text.GrepAction"/>
- </gshell:command>
- </gshell:command-bundle>
-
- <gshell:command-bundle>
- <gshell:command name="cd">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.ChangeDirectoryAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="pwd">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.CurrentDirectoryAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- </gshell:command>
-
- <gshell:command name="ls">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.ListDirectoryAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:link name="dir" target="ls"/>
-
- <gshell:command name="cp">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.CopyAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:link name="copy" target="cp"/>
-
- <gshell:command name="rm">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.RemoveAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:link name="del" target="rm"/>
-
- <gshell:command name="fileinfo">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.FileInfoAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
-
- <gshell:command name="touch">
- <gshell:action class="org.apache.geronimo.gshell.commands.file.TouchAction">
- <property name="fileSystemAccess" ref="fileSystemAccess"/>
- </gshell:action>
- <gshell:completers>
- <ref bean="fileObjectNameCompleter"/>
- <null/>
- </gshell:completers>
- </gshell:command>
- </gshell:command-bundle>
-
-</beans>
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-local.xml b/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-local.xml
deleted file mode 100644
index ed09d8f..0000000
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-local.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <bean id="localShellWrapped" parent="shell" init-method="init" destroy-method="close"/>
-
- <bean id="localShell" class="org.apache.felix.karaf.gshell.core.ShellWrapper">
- <constructor-arg ref="localShellWrapped" />
- </bean>
-
- <bean id="localConsole" class="org.apache.felix.karaf.gshell.core.LocalConsole">
- <property name="bundleContext" ref="bundleContext"/>
- <property name="createLocalShell" value="${karaf.startLocalConsole}"/>
- <property name="shell" ref="localShell"/>
- </bean>
-
-</beans>
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-osgi.xml b/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-osgi.xml
deleted file mode 100644
index 588f5af..0000000
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-osgi.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ctx="http://www.springframework.org/schema/context"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <bean id="osgiCommandRegistry" class="org.apache.felix.karaf.gshell.core.OsgiCommandRegistry">
- <constructor-arg ref="commandRegistry" />
- </bean>
-
- <bean id="osgiAliasRegistry" class="org.apache.felix.karaf.gshell.core.OsgiAliasRegistry">
- <constructor-arg ref="aliasRegistry" />
- </bean>
-
- <osgi:list id="osgiCommands" interface="org.apache.geronimo.gshell.command.Command" cardinality="0..N">
- <osgi:listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister" />
- </osgi:list>
-
- <osgi:list id="osgiLinkCommands" interface="org.apache.geronimo.gshell.command.Link" cardinality="0..N">
- <osgi:listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister" />
- </osgi:list>
-
- <osgi:list id="osgiAliases" interface="org.apache.geronimo.gshell.command.Alias" cardinality="0..N">
- <osgi:listener ref="osgiAliasRegistry" bind-method="register" unbind-method="unregister" />
- </osgi:list>
-
- <osgi:service ref="localShell" interface="org.apache.geronimo.gshell.shell.Shell">
- </osgi:service>
-
- <osgi:service ref="commandLineExecutor" interface="org.apache.geronimo.gshell.commandline.CommandLineExecutor">
- </osgi:service>
-
- <osgix:cm-properties id="cmProps" persistent-id="org.apache.felix.karaf.shell">
- <prop key="sshPort">8101</prop>
- <prop key="sshRealm">servicemix</prop>
- <prop key="hostKey">${karaf.base}/etc/host.key</prop>
- </osgix:cm-properties>
-
- <ctx:property-placeholder properties-ref="cmProps" />
-
-</beans>
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-remote.xml b/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-remote.xml
deleted file mode 100644
index e41e3fa..0000000
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-remote.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:jaas="http://servicemix.apache.org/jaas"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/jaas
- http://servicemix.apache.org/schema/servicemix-jaas.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <bean name="sshClient" class="org.apache.sshd.SshClient" factory-method="setUpDefaultClient" init-method="start" destroy-method="stop">
- </bean>
-
- <bean name="sshServer" class="org.apache.sshd.SshServer" factory-method="setUpDefaultServer" scope="prototype">
- <property name="port" value="${sshPort}" />
- <property name="shellFactory">
- <bean class="org.apache.geronimo.gshell.commands.ssh.ShellFactoryImpl">
- <property name="application" ref="application" />
- <property name="completers">
- <list>
- <ref bean="commandsCompleter"/>
- <ref bean="aliasNameCompleter"/>
- </list>
- </property>
- <property name="executor" ref="commandLineExecutor" />
- <property name="prompter">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsolePrompterImpl">
- <constructor-arg ref="application"/>
- </bean>
- </property>
- <property name="errorHandler">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
- </property>
- <property name="history">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">
- <constructor-arg ref="application"/>
- </bean>
- </property>
- </bean>
- </property>
- <property name="commandFactory">
- <bean class="org.apache.felix.karaf.gshell.core.sshd.ShellCommandFactory">
- <property name="executor" ref="commandLineExecutor" />
- </bean>
- </property>
- <property name="keyPairProvider" ref="keyPairProvider" />
- <property name="passwordAuthenticator" ref="passwordAuthenticator" />
- </bean>
-
- <bean name="keyPairProvider" class="org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider">
- <property name="path" value="${hostKey}" />
- </bean>
- <bean name="passwordAuthenticator" class="org.apache.sshd.server.jaas.JaasPasswordAuthenticator">
- <property name="domain" value="${sshRealm}" />
- </bean>
-
- <bean id="sshServerFactory" class="org.apache.felix.karaf.gshell.core.sshd.SshServerFactory" init-method="start" destroy-method="stop">
- <constructor-arg ref="sshServer" />
- <property name="start" value="${karaf.startRemoteShell}" />
- </bean>
-
- <!--
- <jaas:config id="SshServer" rank="-1">
- <jaas:module className="org.apache.geronimo.gshell.remote.server.auth.BogusLoginModule" flags="required" />
- </jaas:config>
- -->
-
-</beans>
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell.xml b/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell.xml
deleted file mode 100644
index a56b742..0000000
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util" xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
-
- <bean id="io" class="org.apache.geronimo.gshell.io.IO">
- <property name="verbosity" value="DEBUG"/>
- </bean>
-
- <bean id="branding" class="org.apache.felix.karaf.gshell.core.DefaultBranding">
- <property name="prompt" value="@|bold %{gshell.username}|@%{application.id}:@|bold %{gshell.group}|> " />
- </bean>
-
- <bean id="application" class="org.apache.felix.karaf.gshell.core.ApplicationImpl" init-method="init">
- <property name="id" value="${karaf.name}"/>
- <property name="io" ref="io"/>
- <property name="model">
- <bean class="org.apache.geronimo.gshell.application.model.ApplicationModel">
- <property name="branding" ref="branding"/>
- </bean>
- </property>
- <property name="variables">
- <bean class="org.apache.geronimo.gshell.command.Variables"/>
- </property>
- </bean>
-
- <bean id="eventManager" class="org.apache.geronimo.gshell.event.EventManagerImpl"/>
-
- <bean id="applicationManager" class="org.apache.felix.karaf.gshell.core.ApplicationManagerImpl" init-method="init" destroy-method="destroy">
- <constructor-arg ref="eventManager" />
- <constructor-arg ref="application" />
- </bean>
-
- <bean id="commandLineParser" class="org.apache.geronimo.gshell.parser.CommandLineParser"/>
-
- <bean id="aliasRegistry" class="org.apache.geronimo.gshell.wisdom.registry.AliasRegistryImpl">
- <constructor-arg ref="eventManager"/>
- </bean>
-
- <bean id="aliasMetaMapper" class="org.apache.geronimo.gshell.wisdom.registry.AliasMetaMapper">
- <constructor-arg ref="eventManager"/>
- <constructor-arg ref="metaDataRegistry"/>
- <constructor-arg ref="aliasRegistry"/>
- </bean>
-
- <bean id="commandRegistry" class="org.apache.geronimo.gshell.wisdom.registry.CommandRegistryImpl">
- <constructor-arg ref="eventManager"/>
- </bean>
-
- <bean id="commandMetaMapper" class="org.apache.geronimo.gshell.wisdom.registry.CommandMetaMapper">
- <constructor-arg ref="eventManager"/>
- <constructor-arg ref="metaDataRegistry"/>
- <constructor-arg ref="commandRegistry"/>
- </bean>
-
- <bean id="groupDirResolver" class="org.apache.geronimo.gshell.wisdom.registry.GroupDirectoryResolver">
- <constructor-arg ref="fileSystemAccess"/>
- </bean>
-
- <bean id="commandResolver" class="org.apache.geronimo.gshell.wisdom.registry.CommandResolverImpl">
- <constructor-arg ref="fileSystemAccess"/>
- <constructor-arg ref="groupDirResolver"/>
- </bean>
-
- <bean class="org.apache.felix.karaf.gshell.core.WorkAroundAliasCommand" scope="prototype">
- <constructor-arg ref="commandLineExecutor"/>
- </bean>
-
- <bean class="org.apache.geronimo.gshell.wisdom.command.GroupCommand" scope="prototype"/>
-
- <bean id="commandLineBuilder" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineBuilderImpl">
- <constructor-arg ref="commandLineParser"/>
- </bean>
-
- <bean id="commandLineExecutor" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl">
- <constructor-arg ref="commandResolver"/>
- <constructor-arg ref="commandLineBuilder"/>
- </bean>
-
- <bean id="shell" class="org.apache.geronimo.gshell.wisdom.shell.ShellImpl" scope="prototype" init-method="init" destroy-method="close">
- <constructor-arg ref="application"/>
- <constructor-arg ref="commandLineExecutor"/>
-
- <property name="completers">
- <list>
- <ref bean="commandsCompleter"/>
- <ref bean="aliasNameCompleter"/>
- </list>
- </property>
- <property name="prompter">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsolePrompterImpl">
- <constructor-arg ref="application"/>
- </bean>
- </property>
- <property name="errorHandler">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
- </property>
- <property name="history">
- <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">
- <constructor-arg ref="application"/>
- </bean>
- </property>
- </bean>
-
- <bean id="commandNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.CommandNameCompleter"
- lazy-init="true">
- <constructor-arg ref="eventManager"/>
- <constructor-arg ref="commandRegistry"/>
- </bean>
-
- <bean id="aliasNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.AliasNameCompleter"
- lazy-init="true">
- <constructor-arg ref="eventManager"/>
- <constructor-arg ref="aliasRegistry"/>
- </bean>
-
- <bean id="commandsCompleter" class="org.apache.geronimo.gshell.wisdom.completer.CommandsCompleter" lazy-init="true">
- <constructor-arg ref="eventManager"/>
- <constructor-arg ref="commandRegistry"/>
- </bean>
-
- <bean id="variableNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.VariableNameCompleter" lazy-init="true">
- </bean>
-
-</beans>
diff --git a/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-commands.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-commands.xml
new file mode 100644
index 0000000..1acd1f9
--- /dev/null
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-commands.xml
@@ -0,0 +1,271 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="about">
+ <action class="org.apache.geronimo.gshell.commands.builtin.AboutAction">
+ <argument ref="application"/>
+ </action>
+ </command>
+
+ <command name="help">
+ <action class="org.apache.geronimo.gshell.commands.builtin.HelpAction">
+ <argument ref="commandResolver"/>
+ </action>
+ <completers>
+ <bean class="org.apache.geronimo.gshell.console.completer.AggregateCompleter">
+ <argument xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+ <list>
+ <ref component-id="aliasNameCompleter"/>
+ <ref component-id="commandNameCompleter"/>
+ </list>
+ </argument>
+ </bean>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="exit">
+ <action class="org.apache.geronimo.gshell.commands.builtin.ExitAction"/>
+ </command>
+
+ <link name="quit" target="exit"/>
+
+ <command name="echo">
+ <action class="org.apache.geronimo.gshell.commands.builtin.EchoAction"/>
+ </command>
+
+ <command name="clear">
+ <action class="org.apache.geronimo.gshell.commands.builtin.ClearAction"/>
+ </command>
+
+ <command name="source">
+ <action class="org.apache.geronimo.gshell.commands.builtin.SourceAction">
+ <argument ref="commandLineExecutor"/>
+ <argument ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="set">
+ <action class="org.apache.geronimo.gshell.commands.builtin.SetAction"/>
+ </command>
+
+ <command name="unset">
+ <action class="org.apache.geronimo.gshell.commands.builtin.UnsetAction"/>
+ <completers>
+ <ref component-id="variableNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="alias">
+ <action class="org.apache.geronimo.gshell.commands.builtin.AliasAction">
+ <argument ref="aliasRegistry"/>
+ </action>
+ </command>
+
+ <command name="unalias">
+ <action class="org.apache.geronimo.gshell.commands.builtin.UnaliasAction">
+ <argument ref="aliasRegistry"/>
+ </action>
+ <completers>
+ <ref component-id="aliasNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="history">
+ <action class="org.apache.geronimo.gshell.commands.builtin.HistoryAction"/>
+ </command>
+
+ <command name="info">
+ <action class="org.apache.felix.karaf.gshell.core.commands.InfoAction">
+ <argument ref="branding" />
+ </action>
+ </command>
+ </command-bundle>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="ssh">
+ <action class="org.apache.geronimo.gshell.commands.ssh.SshAction"/>
+ </command>
+
+ <command name="sshd">
+ <action class="org.apache.geronimo.gshell.commands.ssh.SshServerAction"/>
+ </command>
+ </command-bundle>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="exec">
+ <action class="org.apache.geronimo.gshell.commands.shell.ExecuteAction"/>
+ </command>
+
+ <command name="java">
+ <action class="org.apache.geronimo.gshell.commands.shell.JavaAction"/>
+ </command>
+
+ <command name="sleep">
+ <action class="org.apache.geronimo.gshell.commands.shell.SleepAction"/>
+ </command>
+
+ <command name="date">
+ <action class="org.apache.geronimo.gshell.commands.shell.DateAction"/>
+ </command>
+
+ <command name="edit">
+ <action class="org.apache.geronimo.gshell.commands.shell.EditAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="find">
+ <action class="org.apache.geronimo.gshell.commands.shell.FindAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="sort">
+ <action class="org.apache.geronimo.gshell.commands.text.SortAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ </command-bundle>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="hostname">
+ <action class="org.apache.geronimo.gshell.commands.network.HostnameAction"/>
+ </command>
+ </command-bundle>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <link name="print" target="echo"/>
+
+ <command name="printf">
+ <action class="org.apache.geronimo.gshell.commands.text.PrintfAction"/>
+ </command>
+
+ <command name="cat">
+ <action class="org.apache.geronimo.gshell.commands.text.CatAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="grep">
+ <action class="org.apache.geronimo.gshell.commands.text.GrepAction"/>
+ </command>
+ </command-bundle>
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="cd">
+ <action class="org.apache.geronimo.gshell.commands.file.ChangeDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="pwd">
+ <action class="org.apache.geronimo.gshell.commands.file.CurrentDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ </command>
+
+ <command name="ls">
+ <action class="org.apache.geronimo.gshell.commands.file.ListDirectoryAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <link name="dir" target="ls"/>
+
+ <command name="cp">
+ <action class="org.apache.geronimo.gshell.commands.file.CopyAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <link name="copy" target="cp"/>
+
+ <command name="rm">
+ <action class="org.apache.geronimo.gshell.commands.file.RemoveAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <link name="del" target="rm"/>
+
+ <command name="fileinfo">
+ <action class="org.apache.geronimo.gshell.commands.file.FileInfoAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+
+ <command name="touch">
+ <action class="org.apache.geronimo.gshell.commands.file.TouchAction">
+ <property name="fileSystemAccess" ref="fileSystemAccess"/>
+ </action>
+ <completers>
+ <ref component-id="fileObjectNameCompleter"/>
+ <null/>
+ </completers>
+ </command>
+ </command-bundle>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-local.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-local.xml
new file mode 100644
index 0000000..db5d9f0
--- /dev/null
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-local.xml
@@ -0,0 +1,32 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="localShell" class="org.apache.felix.karaf.gshell.core.ShellWrapper">
+ <argument ref="shell" />
+ </bean>
+
+ <bean id="localConsole" class="org.apache.felix.karaf.gshell.core.LocalConsole" init-method="init" destroy-method="destroy">
+ <property name="createLocalShell" value="$[karaf.startLocalConsole]"/>
+ <property name="shell" ref="localShell"/>
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </bean>
+
+</blueprint>
\ No newline at end of file
diff --git a/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
new file mode 100644
index 0000000..8d0676c
--- /dev/null
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
@@ -0,0 +1,56 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0"
+ default-availability="optional">
+
+ <cm:property-placeholder persistent-id="org.apache.felix.karaf.shell">
+ <cm:default-properties>
+ <cm:property name="sshPort" value="8101"/>
+ <cm:property name="sshRealm" value="karaf"/>
+ <cm:property name="hostKey" value="${karaf.base}/etc/host.key"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <bean id="osgiCommandRegistry" class="org.apache.felix.karaf.gshell.core.OsgiCommandRegistry">
+ <argument ref="commandRegistry"/>
+ </bean>
+
+ <bean id="osgiAliasRegistry" class="org.apache.felix.karaf.gshell.core.OsgiAliasRegistry">
+ <argument ref="aliasRegistry"/>
+ </bean>
+
+ <ref-list id="osgiCommands" interface="org.apache.geronimo.gshell.command.Command">
+ <listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister"/>
+ </ref-list>
+
+ <ref-list id="osgiLinkCommands" interface="org.apache.geronimo.gshell.command.Link">
+ <listener ref="osgiCommandRegistry" bind-method="register" unbind-method="unregister"/>
+ </ref-list>
+
+ <ref-list id="osgiAliases" interface="org.apache.geronimo.gshell.command.Alias">
+ <listener ref="osgiAliasRegistry" bind-method="register" unbind-method="unregister"/>
+ </ref-list>
+
+ <service ref="localShell" interface="org.apache.geronimo.gshell.shell.Shell"/>
+
+ <service ref="commandLineExecutor" interface="org.apache.geronimo.gshell.commandline.CommandLineExecutor"/>
+
+</blueprint>
diff --git a/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-remote.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-remote.xml
new file mode 100644
index 0000000..87c3100
--- /dev/null
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-remote.xml
@@ -0,0 +1,76 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
+
+ <bean id="sshClient" class="org.apache.sshd.SshClient" factory-method="setUpDefaultClient" init-method="start" destroy-method="stop">
+ </bean>
+
+ <bean id="sshServer" class="org.apache.sshd.SshServer" factory-method="setUpDefaultServer" scope="prototype">
+ <property name="port" value="${sshPort}" />
+ <property name="shellFactory">
+ <bean class="org.apache.geronimo.gshell.commands.ssh.ShellFactoryImpl">
+ <property name="application" ref="application" />
+ <property name="completers">
+ <list>
+ <ref component-id="commandsCompleter"/>
+ <ref component-id="aliasNameCompleter"/>
+ </list>
+ </property>
+ <property name="executor" ref="commandLineExecutor" />
+ <property name="prompter">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsolePrompterImpl">
+ <argument ref="application"/>
+ </bean>
+ </property>
+ <property name="errorHandler">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
+ </property>
+ <property name="history">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">
+ <argument ref="application"/>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ <property name="commandFactory">
+ <bean class="org.apache.felix.karaf.gshell.core.sshd.ShellCommandFactory">
+ <property name="executor" ref="commandLineExecutor" />
+ </bean>
+ </property>
+ <property name="keyPairProvider" ref="keyPairProvider" />
+ <property name="passwordAuthenticator" ref="passwordAuthenticator" />
+ </bean>
+
+ <bean id="keyPairProvider" class="org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider">
+ <property name="path" value="${hostKey}" />
+ </bean>
+ <bean id="passwordAuthenticator" class="org.apache.sshd.server.jaas.JaasPasswordAuthenticator">
+ <property name="domain" value="${sshRealm}" />
+ </bean>
+
+ <bean id="sshServerFactory" class="org.apache.felix.karaf.gshell.core.sshd.SshServerFactory" init-method="start" destroy-method="stop">
+ <argument ref="sshServer" />
+ <property name="start" value="$[karaf.startRemoteShell]" />
+ </bean>
+
+</blueprint>
\ No newline at end of file
diff --git a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-vfs.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-vfs.xml
similarity index 69%
rename from karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-vfs.xml
rename to karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-vfs.xml
index 018b7d0..354eab0 100644
--- a/karaf/gshell/gshell-run/src/main/resources/META-INF/spring/gshell-vfs.xml
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell-vfs.xml
@@ -17,45 +17,26 @@
limitations under the License.
-->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd"
- default-autowire="no"
- default-dependency-check="none"
- default-init-method="init"
- default-destroy-method="destroy">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <type-converters>
+ <bean class="org.apache.geronimo.gshell.vfs.config.CacheStrategyConverter"/>
+ </type-converters>
<bean id="fileSystemAccess" class="org.apache.geronimo.gshell.vfs.FileSystemAccessImpl">
- <constructor-arg ref="fileSystemManager"/>
+ <argument ref="fileSystemManager"/>
</bean>
<bean id="fileObjectNameCompleter" class="org.apache.geronimo.gshell.vfs.FileObjectNameCompleter">
- <constructor-arg ref="fileSystemAccess"/>
- </bean>
-
- <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
- <property name="customEditors">
- <map>
- <entry key="org.apache.commons.vfs.CacheStrategy">
- <bean class="org.apache.geronimo.gshell.vfs.config.CacheStrategyEditor"/>
- </entry>
- </map>
- </property>
+ <argument ref="fileSystemAccess"/>
</bean>
<!--
TODO: Set tempDir File arg in constructor to set the temporary location, may need 2 replicators?
-->
- <bean id="defaultFileReplicator" class="org.apache.commons.vfs.impl.DefaultFileReplicator"/>
+ <bean id="defaultFileReplicator" class="org.apache.commons.vfs.impl.DefaultFileReplicator" init-method="init"/>
- <bean id="fileSystemManagerFactory" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactory">
+ <bean id="fileSystemManagerFactory" class="org.apache.geronimo.gshell.vfs.config.FileSystemManagerFactory" init-method="init">
<property name="filesCache">
<bean class="org.apache.commons.vfs.cache.SoftRefFilesCache"/>
</property>
@@ -64,7 +45,7 @@
<property name="fileReplicator">
<bean class="org.apache.commons.vfs.impl.PrivilegedFileReplicator">
- <constructor-arg ref="defaultFileReplicator"/>
+ <argument ref="defaultFileReplicator"/>
</bean>
</property>
@@ -72,7 +53,7 @@
TODO: Try and root the temporary store under ${gshell.home}/tmp or something
-->
<property name="temporaryFileStore">
- <ref bean="defaultFileReplicator"/>
+ <ref component-id="defaultFileReplicator"/>
</property>
<property name="fileContentInfoFactory">
@@ -83,9 +64,10 @@
<bean class="org.apache.commons.vfs.provider.url.UrlFileProvider"/>
</property>
</bean>
- <bean id="fileSystemManager" factory-bean="fileSystemManagerFactory" factory-method="getFileSystemManager"/>
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <bean id="fileSystemManager" factory-ref="fileSystemManagerFactory" factory-method="getFileSystemManager"/>
+
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer" init-method="init">
<property name="fileSystemManager" ref="fileSystemManager"/>
<property name="scheme" value="tmp"/>
<property name="provider">
@@ -93,7 +75,7 @@
</property>
</bean>
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer" init-method="init">
<property name="fileSystemManager" ref="fileSystemManager"/>
<property name="scheme" value="ram"/>
<property name="provider">
@@ -101,7 +83,7 @@
</property>
</bean>
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer" init-method="init">
<property name="fileSystemManager" ref="fileSystemManager"/>
<property name="scheme" value="file"/>
<property name="provider">
@@ -109,7 +91,7 @@
</property>
</bean>
- <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <bean class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer" init-method="init">
<property name="fileSystemManager" ref="fileSystemManager"/>
<property name="scheme" value="mvn"/>
<property name="provider">
@@ -117,18 +99,18 @@
</property>
</bean>
- <bean id="metaDataRegistry" class="org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataRegistryImpl">
- <constructor-arg ref="eventManager" />
+ <bean id="metaDataRegistry" class="org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataRegistryImpl" init-method="init">
+ <argument ref="eventManager" />
</bean>
- <bean id="metaFileProviderConfigurer" class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer">
+ <bean id="metaFileProviderConfigurer" class="org.apache.geronimo.gshell.vfs.config.FileProviderConfigurer" init-method="init">
<property name="fileSystemManager" ref="fileSystemManager"/>
<property name="scheme" value="meta"/>
<property name="provider">
<bean class="org.apache.geronimo.gshell.vfs.provider.meta.MetaFileProvider">
- <constructor-arg ref="metaDataRegistry"/>
+ <argument ref="metaDataRegistry"/>
</bean>
</property>
</bean>
-</beans>
+</blueprint>
\ No newline at end of file
diff --git a/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell.xml b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell.xml
new file mode 100644
index 0000000..8c14f60
--- /dev/null
+++ b/karaf/gshell/gshell-run/src/main/resources/OSGI-INF/blueprint/gshell.xml
@@ -0,0 +1,156 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="io" class="org.apache.geronimo.gshell.io.IO">
+ <property name="verbosity" value="DEBUG"/>
+ </bean>
+
+ <bean id="branding" class="org.apache.felix.karaf.gshell.core.DefaultBranding">
+ <property name="prompt" value="@|bold %{gshell.username}|@%{application.id}:@|bold %{gshell.group}|> " />
+ </bean>
+
+ <bean id="application" class="org.apache.felix.karaf.gshell.core.ApplicationImpl" init-method="init">
+ <property name="id" value="$[karaf.name]"/>
+ <property name="io" ref="io"/>
+ <property name="model">
+ <bean class="org.apache.geronimo.gshell.application.model.ApplicationModel">
+ <property name="branding" ref="branding"/>
+ </bean>
+ </property>
+ <property name="variables">
+ <bean class="org.apache.geronimo.gshell.command.Variables"/>
+ </property>
+ </bean>
+
+ <bean id="beanContainer" class="org.apache.felix.karaf.gshell.core.BeanContainerWrapper">
+ <argument ref="blueprintContainer"/>
+ </bean>
+
+ <bean id="eventManager" class="org.apache.geronimo.gshell.event.EventManagerImpl"/>
+
+ <bean id="applicationManager" class="org.apache.felix.karaf.gshell.core.ApplicationManagerImpl" init-method="init" destroy-method="destroy">
+ <argument ref="eventManager" />
+ <argument ref="application" />
+ <argument ref="blueprintContainer"/>
+ </bean>
+
+ <bean id="commandLineParser" class="org.apache.geronimo.gshell.parser.CommandLineParser"/>
+
+ <bean id="aliasRegistry" class="org.apache.geronimo.gshell.wisdom.registry.AliasRegistryImpl">
+ <argument ref="eventManager"/>
+ </bean>
+
+ <bean id="aliasMetaMapper" class="org.apache.geronimo.gshell.wisdom.registry.AliasMetaMapper" init-method="init">
+ <argument ref="eventManager"/>
+ <argument ref="metaDataRegistry"/>
+ <argument ref="aliasRegistry"/>
+ </bean>
+
+ <bean id="commandRegistry" class="org.apache.geronimo.gshell.wisdom.registry.CommandRegistryImpl">
+ <argument ref="eventManager"/>
+ </bean>
+
+ <bean id="commandMetaMapper" class="org.apache.geronimo.gshell.wisdom.registry.CommandMetaMapper" init-method="init">
+ <argument ref="eventManager"/>
+ <argument ref="metaDataRegistry"/>
+ <argument ref="commandRegistry"/>
+ </bean>
+
+ <bean id="groupDirResolver" class="org.apache.geronimo.gshell.wisdom.registry.GroupDirectoryResolver">
+ <argument ref="fileSystemAccess"/>
+ </bean>
+
+ <bean id="commandResolver" class="org.apache.felix.karaf.gshell.core.CommandResolverImpl">
+ <argument ref="fileSystemAccess"/>
+ <argument ref="groupDirResolver"/>
+ <property name="beanContainer" ref="beanContainer"/>
+ <property name="aliasCommandBeanId">
+ <idref component-id="aliasCommandPrototype"/>
+ </property>
+ <property name="groupCommandBeanId">
+ <idref component-id="groupCommandPrototype"/>
+ </property>
+ </bean>
+
+ <bean id="aliasCommandPrototype" class="org.apache.felix.karaf.gshell.core.WorkAroundAliasCommand" scope="prototype">
+ <argument ref="commandLineExecutor"/>
+ <property name="beanContainer" ref="beanContainer"/>
+ </bean>
+
+ <bean id="groupCommandPrototype" class="org.apache.geronimo.gshell.wisdom.command.GroupCommand" scope="prototype">
+ <property name="beanContainer" ref="beanContainer"/>
+ </bean>
+
+ <bean id="commandLineBuilder" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineBuilderImpl">
+ <argument ref="commandLineParser"/>
+ </bean>
+
+ <bean id="commandLineExecutor" class="org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl">
+ <argument ref="commandResolver"/>
+ <argument ref="commandLineBuilder"/>
+ </bean>
+
+ <bean id="shell" class="org.apache.geronimo.gshell.wisdom.shell.ShellImpl" scope="prototype" init-method="init" destroy-method="close">
+ <argument ref="application"/>
+ <argument ref="commandLineExecutor"/>
+
+ <property name="completers">
+ <list>
+ <ref component-id="commandsCompleter"/>
+ <ref component-id="aliasNameCompleter"/>
+ </list>
+ </property>
+ <property name="prompter">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsolePrompterImpl">
+ <argument ref="application"/>
+ </bean>
+ </property>
+ <property name="errorHandler">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
+ </property>
+ <property name="history">
+ <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">
+ <argument ref="application"/>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="commandNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.CommandNameCompleter"
+ initialization="lazy" init-method="init">
+ <argument ref="eventManager"/>
+ <argument ref="commandRegistry"/>
+ </bean>
+
+ <bean id="aliasNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.AliasNameCompleter"
+ initialization="lazy" init-method="init">
+ <argument ref="eventManager"/>
+ <argument ref="aliasRegistry"/>
+ </bean>
+
+ <bean id="commandsCompleter" class="org.apache.geronimo.gshell.wisdom.completer.CommandsCompleter" initialization="lazy" init-method="init">
+ <argument ref="eventManager"/>
+ <argument ref="commandRegistry"/>
+ </bean>
+
+ <bean id="variableNameCompleter" class="org.apache.geronimo.gshell.wisdom.completer.VariableNameCompleter" initialization="lazy">
+ </bean>
+
+</blueprint>
\ No newline at end of file
diff --git a/karaf/gshell/gshell-wrapper/pom.xml b/karaf/gshell/gshell-wrapper/pom.xml
index 02b3456..3645ed5 100644
--- a/karaf/gshell/gshell-wrapper/pom.xml
+++ b/karaf/gshell/gshell-wrapper/pom.xml
@@ -106,7 +106,6 @@
*
</Import-Package>
<Private-Package>!*</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml b/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml
deleted file mode 100644
index 08c1ab1..0000000
--- a/karaf/gshell/gshell-wrapper/src/main/resources/META-INF/spring/gshell-wrapper.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:gshell="http://servicemix.apache.org/schema/servicemix-gshell"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/schema/servicemix-gshell
- http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
-
- <gshell:command-bundle>
- <gshell:command name="wrapper/install">
- <gshell:action class="org.apache.felix.karaf.gshell.wrapper.InstallCommand">
- <property name="bundleContext" ref="bundleContext"/>
- </gshell:action>
- </gshell:command>
- </gshell:command-bundle>
-
-</beans>
diff --git a/karaf/gshell/gshell-wrapper/src/main/resources/OSGI-INF/blueprint/gshell-wrapper.xml b/karaf/gshell/gshell-wrapper/src/main/resources/OSGI-INF/blueprint/gshell-wrapper.xml
new file mode 100644
index 0000000..fddc211
--- /dev/null
+++ b/karaf/gshell/gshell-wrapper/src/main/resources/OSGI-INF/blueprint/gshell-wrapper.xml
@@ -0,0 +1,30 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
+ <command name="wrapper/install">
+ <action class="org.apache.felix.karaf.gshell.wrapper.InstallCommand">
+ <property name="bundleContext" ref="bundleContext"/>
+ </action>
+ </command>
+ </command-bundle>
+
+</blueprint>
diff --git a/karaf/jaas/jaas-config/pom.xml b/karaf/jaas/jaas-config/pom.xml
index 9055ecf..df389ce 100644
--- a/karaf/jaas/jaas-config/pom.xml
+++ b/karaf/jaas/jaas-config/pom.xml
@@ -57,6 +57,10 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.junit</artifactId>
<scope>test</scope>
@@ -84,7 +88,6 @@
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>*</Import-Package>
<Private-Package>${artifactId}.impl</Private-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ConfigParser.java b/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ConfigParser.java
deleted file mode 100644
index 16b383a..0000000
--- a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ConfigParser.java
+++ /dev/null
@@ -1,104 +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.felix.karaf.jaas.config.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.w3c.dom.Element;
-
-import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
-import org.apache.felix.karaf.jaas.config.JaasRealm;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.parsing.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
-import org.springframework.util.xml.DomUtils;
-
-public class ConfigParser extends AbstractSingleBeanDefinitionParser {
-
- protected Class getBeanClass(Element element) {
- return Config.class;
- }
-
- protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- String name = element.getAttribute("name");
- if (name == null || name.length() == 0) {
- name = element.getAttribute("id");
- }
- builder.addPropertyReference("bundleContext", "bundleContext");
- builder.addPropertyValue("name", name);
- String rank = element.getAttribute("rank");
- if (rank != null && rank.length() > 0) {
- builder.addPropertyValue("rank", Integer.parseInt(rank));
- }
- List childElements = DomUtils.getChildElementsByTagName(element, "module");
- if (childElements != null && childElements.size() > 0) {
- ManagedList children = new ManagedList(childElements.size());
- for (int i = 0; i < childElements.size(); ++i) {
- Element childElement = (Element) childElements.get(i);
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(Module.class);
- bd.addPropertyValue("className", childElement.getAttribute("className"));
- if (childElement.getAttribute("flags") != null) {
- bd.addPropertyValue("flags", childElement.getAttribute("flags"));
- }
- String options = DomUtils.getTextValue(childElement);
- if (options != null && options.length() > 0) {
- Properties props = new Properties();
- try {
- props.load(new ByteArrayInputStream(options.getBytes()));
- } catch (IOException e) {
- throw new IllegalStateException("Can not load options for JAAS module "
- + childElement.getAttribute("className") + " in config " + name);
- }
- bd.addPropertyValue("options", props);
- }
- children.add(bd.getBeanDefinition());
- }
- builder.addPropertyValue("modules", children);
- }
- // Publish to OSGi
- String publish = element.getAttribute("publish");
- if (Boolean.valueOf(publish)) {
- // Publish Config
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
- bd.addPropertyReference("bundleContext", "bundleContext");
- bd.addPropertyValue("target", builder.getBeanDefinition());
- bd.addPropertyValue("interfaces", new Class[] { JaasRealm.class });
- Map<String,String> props = new HashMap<String,String>();
- props.put(ProxyLoginModule.PROPERTY_MODULE, name);
- bd.addPropertyValue("serviceProperties", props);
- BeanDefinition def = bd.getBeanDefinition();
- String id = parserContext.getReaderContext().generateBeanName(def);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
- registerBeanDefinition(holder, parserContext.getRegistry());
- if (shouldFireEvents()) {
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- postProcessComponentDefinition(componentDefinition);
- parserContext.registerComponent(componentDefinition);
- }
- }
- }
-}
diff --git a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/NamespaceHandler.java b/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/NamespaceHandler.java
index 6129a37..324bc26 100644
--- a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/NamespaceHandler.java
+++ b/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/NamespaceHandler.java
@@ -16,14 +16,143 @@
*/
package org.apache.felix.karaf.jaas.config.impl;
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+import java.net.URL;
-public class NamespaceHandler extends NamespaceHandlerSupport {
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Comment;
+import org.w3c.dom.EntityReference;
- public void init() {
- registerBeanDefinitionParser("config", new ConfigParser());
- registerBeanDefinitionParser("keystore", new ResourceKeystoreInstanceParser());
+import org.osgi.service.blueprint.container.ComponentDefinitionException;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.apache.felix.karaf.jaas.config.JaasRealm;
+import org.apache.felix.karaf.jaas.config.KeystoreInstance;
+import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
+import org.apache.geronimo.blueprint.mutable.MutableBeanMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableValueMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableRefMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableCollectionMetadata;
+import org.apache.geronimo.blueprint.mutable.MutableServiceMetadata;
+import org.apache.geronimo.blueprint.ParserContext;
+
+public class NamespaceHandler implements org.apache.geronimo.blueprint.NamespaceHandler {
+
+ public URL getSchemaLocation(String namespace) {
+ return getClass().getResource("/org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd");
}
+ public Metadata parse(Element element, ParserContext context) {
+ String name = element.getLocalName() != null ? element.getLocalName() : element.getNodeName();
+ if ("config".equals(name)) {
+ return parseConfig(element, context);
+ } else if ("keystore".equals(name)) {
+ return parseKeystore(element, context);
+ }
+ throw new ComponentDefinitionException("Bad xml syntax: unknown element '" + name + "'");
+ }
+ public ComponentMetadata decorate(Node node, ComponentMetadata component, ParserContext context) {
+ throw new ComponentDefinitionException("Bad xml syntax: node decoration is not supported");
+ }
+
+ public ComponentMetadata parseConfig(Element element, ParserContext context) {
+ MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class);
+ bean.setClassName(Config.class.getName());
+ String name = element.getAttribute("name");
+ bean.addProperty("bundleContext", createRef(context, "blueprintBundleContext"));
+ bean.addProperty("name", createValue(context, name));
+ String rank = element.getAttribute("rank");
+ if (rank != null && rank.length() > 0) {
+ bean.addProperty("rank", createValue(context, rank));
+ }
+ NodeList childElements = element.getElementsByTagName("module");
+ if (childElements != null && childElements.getLength() > 0) {
+ MutableCollectionMetadata children = context.createMetadata(MutableCollectionMetadata.class);
+ for (int i = 0; i < childElements.getLength(); ++i) {
+ Element childElement = (Element) childElements.item(i);
+ MutableBeanMetadata md = context.createMetadata(MutableBeanMetadata.class);
+ md.setClassName(Module.class.getName());
+ md.addProperty("className", createValue(context, childElement.getAttribute("className")));
+ if (childElement.getAttribute("flags") != null) {
+ md.addProperty("flags", createValue(context, childElement.getAttribute("flags")));
+ }
+ String options = getTextValue(childElement);
+ if (options != null && options.length() > 0) {
+ md.addProperty("options", createValue(context, options));
+ }
+ children.addValue(md);
+ }
+ bean.addProperty("modules", children);
+ }
+ // Publish Config
+ MutableServiceMetadata service = context.createMetadata(MutableServiceMetadata.class);
+ service.setId(name);
+ service.setServiceComponent(bean);
+ service.addInterfaceName(JaasRealm.class.getName());
+ service.addServiceProperty(createValue(context, ProxyLoginModule.PROPERTY_MODULE), createValue(context, name));
+ return service;
+ }
+
+ public ComponentMetadata parseKeystore(Element element, ParserContext context) {
+ MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class);
+ bean.setClassName(ResourceKeystoreInstance.class.getName());
+ // Parse name
+ String name = element.getAttribute("name");
+ bean.addProperty("name", createValue(context, name));
+ // Parse rank
+ String rank = element.getAttribute("rank");
+ if (rank != null && rank.length() > 0) {
+ bean.addProperty("rank", createValue(context, rank));
+ }
+ // Parse path
+ String path = element.getAttribute("path");
+ if (path != null && path.length() > 0) {
+ bean.addProperty("path", createValue(context, path));
+ }
+ // Parse keystorePassword
+ String keystorePassword = element.getAttribute("keystorePassword");
+ if (keystorePassword != null && keystorePassword.length() > 0) {
+ bean.addProperty("keystorePassword", createValue(context, keystorePassword));
+ }
+ // Parse keyPasswords
+ String keyPasswords = element.getAttribute("keyPasswords");
+ if (keyPasswords != null && keyPasswords.length() > 0) {
+ bean.addProperty("keyPasswords", createValue(context, keyPasswords));
+ }
+ // Publish Config
+ MutableServiceMetadata service = context.createMetadata(MutableServiceMetadata.class);
+ service.setId(name);
+ service.setServiceComponent(bean);
+ service.addInterfaceName(KeystoreInstance.class.getName());
+ return service;
+ }
+
+ private ValueMetadata createValue(ParserContext context, String value) {
+ MutableValueMetadata v = context.createMetadata(MutableValueMetadata.class);
+ v.setStringValue(value);
+ return v;
+ }
+
+ private RefMetadata createRef(ParserContext context, String value) {
+ MutableRefMetadata r = context.createMetadata(MutableRefMetadata.class);
+ r.setComponentId(value);
+ return r;
+ }
+
+ private static String getTextValue(Element element) {
+ StringBuffer value = new StringBuffer();
+ NodeList nl = element.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++) {
+ Node item = nl.item(i);
+ if ((item instanceof CharacterData && !(item instanceof Comment)) || item instanceof EntityReference) {
+ value.append(item.getNodeValue());
+ }
+ }
+ return value.toString();
+ }
}
diff --git a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ResourceKeystoreInstanceParser.java b/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ResourceKeystoreInstanceParser.java
deleted file mode 100644
index 50465df..0000000
--- a/karaf/jaas/jaas-config/src/main/java/org/apache/felix/karaf/jaas/config/impl/ResourceKeystoreInstanceParser.java
+++ /dev/null
@@ -1,90 +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.felix.karaf.jaas.config.impl;
-
-import org.w3c.dom.Element;
-
-import org.apache.felix.karaf.jaas.config.KeystoreInstance;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.parsing.BeanComponentDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean;
-
-/**
- * Spring parser for a keystore instance
- */
-public class ResourceKeystoreInstanceParser extends AbstractSingleBeanDefinitionParser {
-
- public static final String PUBLISH_ATTRIBUTE = "publish";
-
- protected Class getBeanClass(Element element) {
- return ResourceKeystoreInstance.class;
- }
-
- protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- // Parse name
- String name = element.getAttribute("name");
- if (name == null || name.length() == 0) {
- name = element.getAttribute("id");
- }
- if (name != null && name.length() > 0) {
- builder.addPropertyValue("name", name);
- }
- // Parse rank
- String rank = element.getAttribute("rank");
- if (rank != null && rank.length() > 0) {
- builder.addPropertyValue("rank", rank);
- }
- // Parse path
- String path = element.getAttribute("path");
- if (path != null && path.length() > 0) {
- builder.addPropertyValue("path", path);
- }
- // Parse keystorePassword
- String keystorePassword = element.getAttribute("keystorePassword");
- if (keystorePassword != null && keystorePassword.length() > 0) {
- builder.addPropertyValue("keystorePassword", keystorePassword);
- }
- // Parse keyPasswords
- String keyPasswords = element.getAttribute("keyPasswords");
- if (keyPasswords != null && keyPasswords.length() > 0) {
- builder.addPropertyValue("keyPasswords", keyPasswords);
- }
- // Parse publish
- String publish = element.getAttribute("publish");
- if (Boolean.valueOf(publish)) {
- // Publish Config
- BeanDefinitionBuilder bd = BeanDefinitionBuilder.genericBeanDefinition(OsgiServiceFactoryBean.class);
- bd.addPropertyReference("bundleContext", "bundleContext");
- bd.addPropertyValue("target", builder.getBeanDefinition());
- bd.addPropertyValue("interfaces", new Class[] { KeystoreInstance.class });
- BeanDefinition def = bd.getBeanDefinition();
- String id = parserContext.getReaderContext().generateBeanName(def);
- BeanDefinitionHolder holder = new BeanDefinitionHolder(def, id);
- registerBeanDefinition(holder, parserContext.getRegistry());
- if (shouldFireEvents()) {
- BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
- postProcessComponentDefinition(componentDefinition);
- parserContext.registerComponent(componentDefinition);
- }
- }
- }
-
-}
diff --git a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.handlers b/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index c8b49a7..0000000
--- a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1,20 +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.
-#
-################################################################################
-http\://servicemix.apache.org/jaas = org.apache.felix.karaf.jaas.config.impl.NamespaceHandler
-
diff --git a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.schemas b/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.schemas
deleted file mode 100644
index 352002b..0000000
--- a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring.schemas
+++ /dev/null
@@ -1,19 +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.
-#
-################################################################################
-http\://servicemix.apache.org/schema/servicemix-jaas.xsd = org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd
diff --git a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring/karaf-jaas.xml b/karaf/jaas/jaas-config/src/main/resources/META-INF/spring/karaf-jaas.xml
deleted file mode 100644
index 1655f9a..0000000
--- a/karaf/jaas/jaas-config/src/main/resources/META-INF/spring/karaf-jaas.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <bean id="config"
- class="org.apache.felix.karaf.jaas.config.impl.OsgiConfiguration"
- init-method="init"
- destroy-method="close"/>
-
- <osgi:list id="realms"
- interface="org.apache.felix.karaf.jaas.config.JaasRealm"
- cardinality="0..N">
- <osgi:listener ref="config" bind-method="register" unbind-method="unregister" />
- </osgi:list>
-
- <bean id="proxyLoginModuleInitializer"
- class="org.apache.felix.karaf.jaas.config.impl.ProxyLoginModuleInitializer"
- init-method="init">
- <property name="bundleContext" ref="bundleContext"/>
- </bean>
-
- <!-- Register the Straight-Through flow -->
- <bean id="keystoreManager" class="org.apache.felix.karaf.jaas.config.impl.OsgiKeystoreManager" />
- <osgi:service ref="keystoreManager">
- <osgi:interfaces>
- <value>org.apache.felix.karaf.jaas.config.KeystoreManager</value>
- </osgi:interfaces>
- </osgi:service>
-
- <osgi:list id="keystores"
- interface="org.apache.felix.karaf.jaas.config.KeystoreInstance"
- cardinality="0..N">
- <osgi:listener ref="keystoreManager" bind-method="register" unbind-method="unregister" />
- </osgi:list>
-
-</beans>
diff --git a/karaf/jaas/jaas-config/src/main/resources/OSGI-INF/blueprint/karaf-jaas.xml b/karaf/jaas/jaas-config/src/main/resources/OSGI-INF/blueprint/karaf-jaas.xml
new file mode 100644
index 0000000..80462ce
--- /dev/null
+++ b/karaf/jaas/jaas-config/src/main/resources/OSGI-INF/blueprint/karaf-jaas.xml
@@ -0,0 +1,54 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="config"
+ class="org.apache.felix.karaf.jaas.config.impl.OsgiConfiguration"
+ init-method="init"
+ destroy-method="close"/>
+
+ <ref-list id="realms"
+ interface="org.apache.felix.karaf.jaas.config.JaasRealm"
+ availability="optional">
+ <listener ref="config" bind-method="register" unbind-method="unregister" />
+ </ref-list>
+
+ <bean id="proxyLoginModuleInitializer" class="org.apache.felix.karaf.jaas.config.impl.ProxyLoginModuleInitializer" init-method="init">
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </bean>
+
+ <!-- Register the Straight-Through flow -->
+ <bean id="keystoreManager" class="org.apache.felix.karaf.jaas.config.impl.OsgiKeystoreManager" />
+ <service ref="keystoreManager" interface="org.apache.felix.karaf.jaas.config.KeystoreManager" />
+
+ <ref-list id="keystores"
+ interface="org.apache.felix.karaf.jaas.config.KeystoreInstance"
+ availability="optional">
+ <listener ref="keystoreManager" bind-method="register" unbind-method="unregister" />
+ </ref-list>
+
+ <service interface="org.apache.geronimo.blueprint.NamespaceHandler">
+ <service-properties>
+ <entry key="osgi.service.blueprint.namespace" value="http://felix.apache.org/karaf/xmlns/jaas/v1.0.0"/>
+ </service-properties>
+ <bean class="org.apache.felix.karaf.jaas.config.impl.NamespaceHandler"/>
+ </service>
+
+</blueprint>
diff --git a/karaf/jaas/jaas-config/src/main/resources/org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd b/karaf/jaas/jaas-config/src/main/resources/org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd
index 320e04d..0a9f8d4 100644
--- a/karaf/jaas/jaas-config/src/main/resources/org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd
+++ b/karaf/jaas/jaas-config/src/main/resources/org/apache/felix/karaf/jaas/config/servicemix-jaas.xsd
@@ -18,54 +18,44 @@
-->
<xs:schema elementFormDefault='qualified'
- targetNamespace='http://servicemix.apache.org/jaas'
+ targetNamespace='http://felix.apache.org/karaf/xmlns/jaas/v1.0.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:tns='http://servicemix.apache.org/jaas'>
+ xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:tns='http://felix.apache.org/karaf/xmlns/jaas/v1.0.0'>
- <xs:import namespace="http://www.springframework.org/schema/beans"/>
+ <xs:import namespace="http://www.osgi.org/xmlns/blueprint/v1.0.0"/>
<xs:element name="config">
<xs:complexType>
- <xs:complexContent>
- <xs:extension base="beans:identifiedType">
- <xs:sequence>
- <xs:element name="module" minOccurs="0" maxOccurs="unbounded">
- <xs:complexType mixed="true">
- <xs:attribute name="className" use="required" type="xs:string" />
- <xs:attribute name="flags" default="required">
- <xs:simpleType>
- <xs:restriction base="xs:NMTOKEN">
- <xs:enumeration value="required"/>
- <xs:enumeration value="requisite"/>
- <xs:enumeration value="sufficient"/>
- <xs:enumeration value="optional"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="name" use="optional" type="xs:string" />
- <xs:attribute name="rank" use="optional" default="0" type="xs:int" />
- <xs:attribute name="publish" use="optional" default="true" type="xs:boolean" />
- </xs:extension>
- </xs:complexContent>
+ <xs:sequence>
+ <xs:element name="module" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType mixed="true">
+ <xs:attribute name="className" use="required" type="xs:string" />
+ <xs:attribute name="flags" default="required">
+ <xs:simpleType>
+ <xs:restriction base="xs:NMTOKEN">
+ <xs:enumeration value="required"/>
+ <xs:enumeration value="requisite"/>
+ <xs:enumeration value="sufficient"/>
+ <xs:enumeration value="optional"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" use="required" type="xs:string" />
+ <xs:attribute name="rank" use="optional" default="0" type="xs:int" />
</xs:complexType>
</xs:element>
<xs:element name="keystore">
<xs:complexType>
- <xs:complexContent>
- <xs:extension base="beans:identifiedType">
- <xs:attribute name="name" use="optional" type="xs:string" />
- <xs:attribute name="rank" use="optional" default="0" type="xs:int" />
- <xs:attribute name="publish" use="optional" default="true" type="xs:boolean" />
- <xs:attribute name="path" use="required" type="xs:string" />
- <xs:attribute name="keystorePassword" use="optional" type="xs:string" />
- <xs:attribute name="keyPasswords" use="optional" type="xs:string" />
- </xs:extension>
- </xs:complexContent>
+ <xs:attribute name="name" use="required" type="xs:string" />
+ <xs:attribute name="rank" use="optional" default="0" type="xs:int" />
+ <xs:attribute name="path" use="required" type="xs:string" />
+ <xs:attribute name="keystorePassword" use="optional" type="xs:string" />
+ <xs:attribute name="keyPasswords" use="optional" type="xs:string" />
</xs:complexType>
</xs:element>
diff --git a/karaf/jaas/jaas-config/src/test/java/org/apache/felix/karaf/jaas/config/NamespaceHandlerTest.java b/karaf/jaas/jaas-config/src/test/java/org/apache/felix/karaf/jaas/config/NamespaceHandlerTest.java
deleted file mode 100644
index e0a1baf..0000000
--- a/karaf/jaas/jaas-config/src/test/java/org/apache/felix/karaf/jaas/config/NamespaceHandlerTest.java
+++ /dev/null
@@ -1,190 +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.felix.karaf.jaas.config;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.HashMap;
-
-import javax.security.auth.login.AppConfigurationEntry;
-
-import junit.framework.TestCase;
-import org.apache.felix.karaf.jaas.boot.ProxyLoginModule;
-import org.apache.felix.karaf.jaas.config.impl.Config;
-import org.easymock.EasyMock;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.AbstractBeanFactory;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.beans.factory.BeanDefinitionStoreException;
-import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.BeansException;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.osgi.context.support.BundleContextAwareProcessor;
-
-public class NamespaceHandlerTest extends TestCase {
-
- public void testConfig() throws Exception {
- final Dictionary headers = new Hashtable();
- headers.put(Constants.BUNDLE_VERSION, "1.0.0.SNAPSHOT");
-
- final BundleContext bundleContext = EasyMock.createMock(BundleContext.class);
- final Bundle bundle = EasyMock.createMock(Bundle.class);
- final ServiceRegistration reg = EasyMock.createMock(ServiceRegistration.class);
-
- expect(bundleContext.getBundle()).andReturn(bundle).anyTimes();
- expect(bundle.getSymbolicName()).andReturn("symbolic-name").anyTimes();
- expect(bundle.getBundleId()).andReturn(Long.valueOf(32)).anyTimes();
- expect(bundle.getHeaders()).andReturn(headers).anyTimes();
- expect(bundleContext.registerService(aryEq(new String[] { JaasRealm.class.getName() }),
- anyObject(), EasyMock.<Dictionary>anyObject())).andReturn(reg);
- expect(bundleContext.registerService(aryEq(new String[] { KeystoreInstance.class.getName() }),
- anyObject(), EasyMock.<Dictionary>anyObject())).andReturn(reg);
-
- replay(bundleContext, bundle);
-
- AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "classpath:config.xml" }, false) {
- protected DefaultListableBeanFactory createBeanFactory() {
- DefaultListableBeanFactory f = super.createBeanFactory();
- Map<String, Object> beans = new HashMap<String, Object>();
- beans.put("bundleContext", bundleContext);
- SimpleBeanFactory p = new SimpleBeanFactory(beans);
- f.setParentBeanFactory(p);
- return f;
- }
- };
- ctx.refresh();
-
- verify(bundleContext, bundle);
-
- // Test realm
- Object obj = ctx.getBean("realm");
- assertNotNull(obj);
- assertTrue(obj instanceof Config);
- Config cfg = (Config) obj;
- assertNotNull(cfg.getBundleContext());
- assertEquals("realm", cfg.getName());
- assertNotNull(cfg.getModules());
- assertEquals(1, cfg.getModules().length);
- assertNotNull(cfg.getModules()[0]);
- assertEquals("org.apache.felix.karaf.jaas.config.SimpleLoginModule", cfg.getModules()[0].getClassName());
- assertEquals("required", cfg.getModules()[0].getFlags());
- assertNotNull(cfg.getModules()[0].getOptions());
- assertEquals(1, cfg.getModules()[0].getOptions().size());
- assertEquals("value", cfg.getModules()[0].getOptions().get("key"));
- AppConfigurationEntry[] entries = cfg.getEntries();
- assertNotNull(entries);
- assertEquals(1, entries.length);
- assertNotNull(entries[0]);
- assertEquals(ProxyLoginModule.class.getName(), entries[0].getLoginModuleName());
- assertEquals(AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, entries[0].getControlFlag());
- Map<String,?> options = entries[0].getOptions();
- assertNotNull(options);
- assertEquals(3, options.size());
- assertEquals("value", options.get("key"));
- assertEquals("org.apache.felix.karaf.jaas.config.SimpleLoginModule", options.get(ProxyLoginModule.PROPERTY_MODULE));
- assertEquals("32", options.get(ProxyLoginModule.PROPERTY_BUNDLE));
-
- // Test keystore
- obj = ctx.getBean("keystore");
- assertNotNull(obj);
- assertTrue(obj instanceof KeystoreInstance);
- KeystoreInstance ks = (KeystoreInstance) obj;
- assertEquals("ks", ks.getName());
- assertEquals(1, ks.getRank());
- assertNotNull(ks.getPrivateKey("myalias"));
- }
-
- public static class SimpleBeanFactory implements BeanFactory {
-
- private final Map beans;
-
- public SimpleBeanFactory(Map beans) {
- this.beans = beans;
- }
- public boolean containsBean(String name) {
- return beans.containsKey(name);
- }
- public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
- Object bean = beans.get(name);
- if (bean == null) {
- throw new NoSuchBeanDefinitionException(name);
- }
- return new String[0];
- }
- public Object getBean(String name) throws BeansException {
- return getBean(name, (Class) null);
- }
- public Object getBean(String name, Class requiredType) throws BeansException {
- Object bean = beans.get(name);
- if (bean == null) {
- throw new NoSuchBeanDefinitionException(name);
- }
- if (requiredType != null && !requiredType.isInstance(bean)) {
- throw new BeanNotOfRequiredTypeException(name, requiredType, bean.getClass());
- }
- return bean;
- }
- public Object getBean(String name, Object[] args) throws BeansException {
- if (args != null) {
- throw new BeanDefinitionStoreException("Bean is not a prototype");
- }
- return getBean(name, (Class) null);
- }
- public Class getType(String name) throws NoSuchBeanDefinitionException {
- Object bean = beans.get(name);
- if (bean == null) {
- throw new NoSuchBeanDefinitionException(name);
- }
- return bean.getClass();
- }
- public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
- Object bean = beans.get(name);
- if (bean == null) {
- throw new NoSuchBeanDefinitionException(name);
- }
- return true;
- }
- public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
- if (!beans.containsKey(name)) {
- throw new NoSuchBeanDefinitionException(name);
- }
- if (targetType == null || Object.class.equals(targetType)) {
- return true;
- }
- return targetType.isAssignableFrom(beans.get(name).getClass());
- }
- public boolean isPrototype(String name) {
- return false;
- }
-
- }
-}
diff --git a/karaf/jaas/jaas-config/src/test/resources/config.xml b/karaf/jaas/jaas-config/src/test/resources/config.xml
deleted file mode 100644
index 9fe3042..0000000
--- a/karaf/jaas/jaas-config/src/test/resources/config.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:jaas="http://servicemix.apache.org/jaas"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/jaas
- http://servicemix.apache.org/schema/servicemix-jaas.xsd">
-
- <jaas:config id="realm">
- <jaas:module className="org.apache.felix.karaf.jaas.config.SimpleLoginModule" flags="required">
- key=value
- </jaas:module>
- </jaas:config>
-
- <jaas:keystore id="keystore"
- name="ks"
- rank="1"
- path="classpath:privatestore.jks"
- keystorePassword="keyStorePassword"
- keyPasswords="myalias=myAliasPassword" />
-
-</beans>
diff --git a/karaf/jaas/jaas-config/src/test/resources/privatestore.jks b/karaf/jaas/jaas-config/src/test/resources/privatestore.jks
deleted file mode 100644
index 80106c1..0000000
--- a/karaf/jaas/jaas-config/src/test/resources/privatestore.jks
+++ /dev/null
Binary files differ
diff --git a/karaf/jaas/jaas-modules/pom.xml b/karaf/jaas/jaas-modules/pom.xml
index 9c873c8..23eb38e 100644
--- a/karaf/jaas/jaas-modules/pom.xml
+++ b/karaf/jaas/jaas-modules/pom.xml
@@ -77,10 +77,9 @@
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
org.apache.felix.karaf.jaas.config,
- org.springframework.beans.factory.config,
+ org.apache.geronimo.blueprint.ext,
*
</Import-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/jaas/jaas-modules/src/main/resources/META-INF/spring/karaf-jaas-module.xml b/karaf/jaas/jaas-modules/src/main/resources/META-INF/spring/karaf-jaas-module.xml
deleted file mode 100644
index a989da8..0000000
--- a/karaf/jaas/jaas-modules/src/main/resources/META-INF/spring/karaf-jaas-module.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:jaas="http://servicemix.apache.org/jaas"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://servicemix.apache.org/jaas
- http://servicemix.apache.org/schema/servicemix-jaas.xsd">
-
- <!--
- - The following beans define an alternate realm which uses the OSGi Configuration Admin service
- - to obtain passwords. However, this realm is not really secure as there is no access restriction
- - on this service, which means any bundle could access all the passwords.
- -->
- <!--
- <bean id="configAdminHolder" class="org.apache.felix.karaf.jaas.modules.osgi.ConfigAdminHolder">
- <property name="service" ref="configAdmin" />
- </bean>
-
- <osgi:reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" />
-
- <jaas:config id="karaf">
- <jaas:module className="org.apache.felix.karaf.jaas.modules.osgi.OsgiConfigLoginModule" flags="required">
- pid = org.apache.servicemix.users
- </jaas:module>
- </jaas:config>
- -->
-
- <!-- Bean to allow the ${servicemix.home} property to be correctly resolved -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
-
- <jaas:config id="karaf">
- <jaas:module className="org.apache.felix.karaf.jaas.modules.properties.PropertiesLoginModule" flags="required">
- users = ${karaf.base}/etc/users.properties
- </jaas:module>
- </jaas:config>
-
-</beans>
diff --git a/karaf/jaas/jaas-modules/src/main/resources/OSGI-INF/blueprint/karaf-jaas-module.xml b/karaf/jaas/jaas-modules/src/main/resources/OSGI-INF/blueprint/karaf-jaas-module.xml
new file mode 100644
index 0000000..6c39da0
--- /dev/null
+++ b/karaf/jaas/jaas-modules/src/main/resources/OSGI-INF/blueprint/karaf-jaas-module.xml
@@ -0,0 +1,33 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:jaas="http://felix.apache.org/karaf/xmlns/jaas/v1.0.0"
+ xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+ <!-- Bean to allow the $[karaf.base] property to be correctly resolved -->
+ <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
+
+ <jaas:config name="karaf">
+ <jaas:module className="org.apache.felix.karaf.jaas.modules.properties.PropertiesLoginModule" flags="required">
+ users = $[karaf.base]/etc/users.properties
+ </jaas:module>
+ </jaas:config>
+
+</blueprint>
diff --git a/karaf/management/pom.xml b/karaf/management/pom.xml
index 7031912..586f34e 100644
--- a/karaf/management/pom.xml
+++ b/karaf/management/pom.xml
@@ -69,7 +69,6 @@
*
</Import-Package>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
- <Spring-Context>*;publish-context:=false;create-asynchronously:=true</Spring-Context>
<_versionpolicy>${bnd.version.policy}</_versionpolicy>
</instructions>
</configuration>
diff --git a/karaf/management/src/main/resources/META-INF/spring/karaf-management.xml b/karaf/management/src/main/resources/META-INF/spring/karaf-management.xml
deleted file mode 100644
index 5ccd002..0000000
--- a/karaf/management/src/main/resources/META-INF/spring/karaf-management.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?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.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ctx="http://www.springframework.org/schema/context"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd
- http://www.springframework.org/schema/osgi-compendium
- http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
-
- <!-- MBeanServer bean -->
- <bean id="mbeanServerFactory" class="org.apache.felix.karaf.management.MBeanServerFactory" init-method="init" destroy-method="destroy">
- <property name="locateExistingServerIfPossible" value="true"/>
- </bean>
- <bean id="mbeanServer" factory-bean="mbeanServerFactory" factory-method="getServer">
- </bean>
-
- <!-- Export the MBeanServer as an OSGi service -->
- <osgi:service ref="mbeanServer">
- <osgi:interfaces>
- <value>javax.management.MBeanServer</value>
- </osgi:interfaces>
- </osgi:service>
-
- <!-- Create a RMI registry -->
- <bean id="rmiRegistryFactory" class="org.apache.felix.karaf.management.RmiRegistryFactory" init-method="init" destroy-method="destroy">
- <property name="create" value="true" />
- <property name="locate" value="true" />
- <property name="port" value="${rmiRegistryPort}" />
- </bean>
- <bean id="rmiRegistry" factory-bean="rmiRegistryFactory" factory-method="getObject"/>
-
- <!-- Create a JMX connector ServiceFactory -->
- <bean id="jmxConnectorServiceFactory" class="org.apache.felix.karaf.management.ConnectorServerFactory" init-method="init" destroy-method="destroy">
- <property name="server" ref="mbeanServer" />
- <property name="serviceUrl" value="${serviceUrl}" />
- <property name="daemon" value="${daemon}" />
- <property name="threaded" value="${threaded}" />
- <property name="objectName">
- <bean class="javax.management.ObjectName" factory-method="getInstance">
- <constructor-arg value="${objectName}"/>
- </bean>
- </property>
- <property name="environment">
- <map>
- <entry key="jmx.remote.authenticator" value-ref="jaasAuthenticator" />
- </map>
- </property>
- </bean>
-
- <!-- JAAS authenticator -->
- <bean id="jaasAuthenticator" class="org.apache.felix.karaf.management.JaasAuthenticator">
- <property name="realm" value="${jmxRealm}" />
- </bean>
-
- <!-- Property place holder -->
- <osgix:cm-properties id="cmProps" persistent-id="org.apache.felix.karaf.management">
- <prop key="rmiRegistryPort">1099</prop>
- <prop key="jmxRealm">karaf</prop>
- <prop key="serviceUrl">service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi</prop>
- <prop key="daemon">true</prop>
- <prop key="threaded">true</prop>
- <prop key="objectName">connector:name=rmi</prop>
- </osgix:cm-properties>
-
- <ctx:property-placeholder properties-ref="cmProps" />
-
-</beans>
-
diff --git a/karaf/management/src/main/resources/OSGI-INF/blueprint/karaf-management.xml b/karaf/management/src/main/resources/OSGI-INF/blueprint/karaf-management.xml
new file mode 100644
index 0000000..afe538b
--- /dev/null
+++ b/karaf/management/src/main/resources/OSGI-INF/blueprint/karaf-management.xml
@@ -0,0 +1,71 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:cm="http://www.osgi.org/xmlns/blueprint-cm/v1.0.0">
+
+ <!-- Property place holder -->
+ <cm:property-placeholder persistent-id="org.apache.felix.karaf.management">
+ <cm:default-properties>
+ <cm:property name="rmiRegistryPort" value="1099"/>
+ <cm:property name="jmxRealm" value="karaf"/>
+ <cm:property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"/>
+ <cm:property name="daemon" value="true"/>
+ <cm:property name="threaded" value="true"/>
+ <cm:property name="objectName" value="connector:name=rmi"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <!-- MBeanServer bean -->
+ <bean id="mbeanServerFactory" class="org.apache.felix.karaf.management.MBeanServerFactory" init-method="init" destroy-method="destroy" depends-on="rmiRegistryFactory">
+ <property name="locateExistingServerIfPossible" value="true"/>
+ </bean>
+ <bean id="mbeanServer" factory-ref="mbeanServerFactory" factory-method="getServer"/>
+
+ <!-- Export the MBeanServer as an OSGi service -->
+ <service ref="mbeanServer" interface="javax.management.MBeanServer"/>
+
+ <!-- Create a RMI registry -->
+ <bean id="rmiRegistryFactory" class="org.apache.felix.karaf.management.RmiRegistryFactory" init-method="init" destroy-method="destroy">
+ <property name="create" value="true"/>
+ <property name="locate" value="true"/>
+ <property name="port" value="${rmiRegistryPort}"/>
+ </bean>
+
+ <!-- Create a JMX connector ServiceFactory -->
+ <bean id="connectorFactory" class="org.apache.felix.karaf.management.ConnectorServerFactory" init-method="init" destroy-method="destroy">
+ <property name="server" ref="mbeanServer"/>
+ <property name="serviceUrl" value="${serviceUrl}"/>
+ <property name="daemon" value="${daemon}"/>
+ <property name="threaded" value="${threaded}"/>
+ <property name="objectName" value="${objectName}"/>
+ <property name="environment">
+ <map>
+ <entry key="jmx.remote.authenticator" value-ref="jaasAuthenticator"/>
+ </map>
+ </property>
+ </bean>
+
+ <!-- JAAS authenticator -->
+ <bean id="jaasAuthenticator" class="org.apache.felix.karaf.management.JaasAuthenticator">
+ <property name="realm" value="${jmxRealm}"/>
+ </bean>
+
+</blueprint>
+
diff --git a/karaf/pom.xml b/karaf/pom.xml
index c872ffa..2b02198 100644
--- a/karaf/pom.xml
+++ b/karaf/pom.xml
@@ -89,6 +89,7 @@
<felix.webconsole.version>1.2.10</felix.webconsole.version>
<felix.metatype.version>1.0.2</felix.metatype.version>
<geronimo.annotation.version>1.1.1</geronimo.annotation.version>
+ <geronimo.blueprint.version>1.0.0-SNAPSHOT</geronimo.blueprint.version>
<geronimo.servlet.version>1.1.2</geronimo.servlet.version>
<gshell.version>1.0-alpha-2</gshell.version>
<jaxp.ri.version>1.4.2_2</jaxp.ri.version>
@@ -854,6 +855,11 @@
<artifactId>servlet-api</artifactId>
<version>${servlet.api.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ <version>${geronimo.blueprint.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>