You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2009/04/28 15:34:53 UTC
svn commit: r769394 [4/4] - in /servicemix/smx4/kernel/branches/blueprint:
./ assembly/ assembly/src/main/descriptors/
assembly/src/main/filtered-resources/etc/ demos/smx4web/ gshell/
gshell/gshell-admin/ gshell/gshell-admin/src/main/filtered-resources...
Modified: servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/pom.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/pom.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/pom.xml Tue Apr 28 13:34:49 2009
@@ -60,10 +60,12 @@
<scope>provided</scope>
</dependency>
+ <!--
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-core</artifactId>
</dependency>
+ -->
</dependencies>
<build>
@@ -79,7 +81,6 @@
</Export-Package>
<Import-Package>
org.apache.servicemix.kernel.jaas.config,
- org.springframework.beans.factory.config,
*
</Import-Package>
<Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
Modified: servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/src/main/resources/META-INF/spring/servicemix-jaas-module.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/src/main/resources/META-INF/spring/servicemix-jaas-module.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/src/main/resources/META-INF/spring/servicemix-jaas-module.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/jaas/jaas-modules/src/main/resources/META-INF/spring/servicemix-jaas-module.xml Tue Apr 28 13:34:49 2009
@@ -17,17 +17,13 @@
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">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:jaas="http://servicemix.apache.org/xmlns/jaas/v1.0.0">
+
+ <type-converters>
+ <!-- Bean to allow the ${servicemix.home} property to be correctly resolved -->
+ <bean class="org.apache.geronimo.blueprint.beans.SystemPropertyPlaceholder"/>
+ </type-converters>
<!--
- The following beans define an alternate realm which uses the OSGi Configuration Admin service
@@ -48,13 +44,10 @@
</jaas:config>
-->
- <!-- Bean to allow the ${servicemix.home} property to be correctly resolved -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
-
<jaas:config id="servicemix">
<jaas:module className="org.apache.servicemix.kernel.jaas.modules.properties.PropertiesLoginModule" flags="required">
users = ${servicemix.base}/etc/users.properties
</jaas:module>
</jaas:config>
-</beans>
\ No newline at end of file
+</blueprint>
\ No newline at end of file
Modified: servicemix/smx4/kernel/branches/blueprint/management/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/management/pom.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/management/pom.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/management/pom.xml Tue Apr 28 13:34:49 2009
@@ -35,14 +35,6 @@
<dependencies>
<dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -74,7 +66,6 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>
javax.management,
- org.springframework.jmx.support,
*
</Import-Package>
<Export-Package>org.apache.servicemix.management*</Export-Package>
Added: servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/ConnectorServerFactoryBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/ConnectorServerFactoryBean.java?rev=769394&view=auto
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/ConnectorServerFactoryBean.java (added)
+++ servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/ConnectorServerFactoryBean.java Tue Apr 28 13:34:49 2009
@@ -0,0 +1,139 @@
+/*
+ * 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.servicemix.management;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+public class ConnectorServerFactoryBean {
+
+ private MBeanServer server;
+ private String serviceUrl;
+ private Map environment;
+ private ObjectName objectName;
+ private boolean threaded = false;
+ private boolean daemon = false;
+ private JMXConnectorServer connectorServer;
+
+ public MBeanServer getServer() {
+ return server;
+ }
+
+ public void setServer(MBeanServer server) {
+ this.server = server;
+ }
+
+ public String getServiceUrl() {
+ return serviceUrl;
+ }
+
+ public void setServiceUrl(String serviceUrl) {
+ this.serviceUrl = serviceUrl;
+ }
+
+ public Map getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(Map environment) {
+ this.environment = environment;
+ }
+
+ public ObjectName getObjectName() {
+ return objectName;
+ }
+
+ public void setObjectName(ObjectName objectName) {
+ this.objectName = objectName;
+ }
+
+ public boolean isThreaded() {
+ return threaded;
+ }
+
+ public void setThreaded(boolean threaded) {
+ this.threaded = threaded;
+ }
+
+ public boolean isDaemon() {
+ return daemon;
+ }
+
+ public void setDaemon(boolean daemon) {
+ this.daemon = daemon;
+ }
+
+ public void init() throws Exception {
+ if (this.server == null) {
+ throw new IllegalArgumentException("server must be set");
+ }
+ JMXServiceURL url = new JMXServiceURL(this.serviceUrl);
+ this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, this.environment, this.server);
+ if (this.objectName != null) {
+ this.server.registerMBean(this.connectorServer, this.objectName);
+ }
+ try {
+ if (this.threaded) {
+ // Start the connector server asynchronously (in a separate thread).
+ Thread connectorThread = new Thread() {
+ public void run() {
+ try {
+ connectorServer.start();
+ } catch (IOException ex) {
+ throw new RuntimeException("Could not start JMX connector server after delay", ex);
+ }
+ }
+ };
+ connectorThread.setName("JMX Connector Thread [" + this.serviceUrl + "]");
+ connectorThread.setDaemon(this.daemon);
+ connectorThread.start();
+ }
+ else {
+ this.connectorServer.start();
+ }
+ } catch (Exception ex) {
+ doUnregister(this.objectName);
+ throw ex;
+ }
+ }
+
+ public void destroy() throws Exception {
+ try {
+ this.connectorServer.stop();
+ } finally {
+ doUnregister(this.objectName);
+ }
+ }
+
+ protected void doUnregister(ObjectName objectName) {
+ try {
+ if (this.objectName != null && this.server.isRegistered(objectName)) {
+ this.server.unregisterMBean(objectName);
+ }
+ }
+ catch (JMException ex) {
+ // Ignore
+ }
+ }
+}
Added: servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/MBeanServerFactoryBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/MBeanServerFactoryBean.java?rev=769394&view=auto
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/MBeanServerFactoryBean.java (added)
+++ servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/MBeanServerFactoryBean.java Tue Apr 28 13:34:49 2009
@@ -0,0 +1,117 @@
+/*
+ * 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.servicemix.management;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+public class MBeanServerFactoryBean {
+
+ private boolean locateExistingServerIfPossible = false;
+ private String agentId;
+ private String defaultDomain;
+ private boolean registerWithFactory = true;
+ private MBeanServer server;
+ private boolean newlyRegistered = false;
+
+ public boolean isLocateExistingServerIfPossible() {
+ return locateExistingServerIfPossible;
+ }
+
+ public void setLocateExistingServerIfPossible(boolean locateExistingServerIfPossible) {
+ this.locateExistingServerIfPossible = locateExistingServerIfPossible;
+ }
+
+ public String getAgentId() {
+ return agentId;
+ }
+
+ public void setAgentId(String agentId) {
+ this.agentId = agentId;
+ }
+
+ public String getDefaultDomain() {
+ return defaultDomain;
+ }
+
+ public void setDefaultDomain(String defaultDomain) {
+ this.defaultDomain = defaultDomain;
+ }
+
+ public boolean isRegisterWithFactory() {
+ return registerWithFactory;
+ }
+
+ public void setRegisterWithFactory(boolean registerWithFactory) {
+ this.registerWithFactory = registerWithFactory;
+ }
+
+ public boolean isNewlyRegistered() {
+ return newlyRegistered;
+ }
+
+ public void setNewlyRegistered(boolean newlyRegistered) {
+ this.newlyRegistered = newlyRegistered;
+ }
+
+ public MBeanServer getServer() throws Exception {
+ if (this.server == null) {
+ init();
+ }
+ return server;
+ }
+
+ public void init() throws Exception {
+ if (this.locateExistingServerIfPossible || this.agentId != null) {
+ try {
+ List servers = MBeanServerFactory.findMBeanServer(agentId);
+ MBeanServer server = null;
+ if (servers != null && servers.size() > 0) {
+ this.server = (MBeanServer) servers.get(0);
+ }
+ if (server == null && agentId == null) {
+ this.server = ManagementFactory.getPlatformMBeanServer();
+ }
+ if (this.server == null) {
+ throw new Exception("Unable to locate MBeanServer");
+ }
+ } catch (Exception ex) {
+ if (this.agentId != null) {
+ throw ex;
+ }
+ }
+ }
+ if (this.server == null) {
+ if (this.registerWithFactory) {
+ this.server = MBeanServerFactory.createMBeanServer(this.defaultDomain);
+ } else {
+ this.server = MBeanServerFactory.newMBeanServer(this.defaultDomain);
+ }
+ this.newlyRegistered = this.registerWithFactory;
+ }
+ }
+
+ public void destroy() throws Exception {
+ if (this.newlyRegistered) {
+ MBeanServerFactory.releaseMBeanServer(this.server);
+ }
+ }
+
+}
Modified: servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/RmiRegistryFactoryBean.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/RmiRegistryFactoryBean.java?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/RmiRegistryFactoryBean.java (original)
+++ servicemix/smx4/kernel/branches/blueprint/management/src/main/java/org/apache/servicemix/management/RmiRegistryFactoryBean.java Tue Apr 28 13:34:49 2009
@@ -21,15 +21,11 @@
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-
/**
*
* @author gnodet
*/
-public class RmiRegistryFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
+public class RmiRegistryFactoryBean {
private int port = Registry.REGISTRY_PORT;
private Registry registry;
@@ -91,7 +87,7 @@
return true;
}
- public void afterPropertiesSet() throws RemoteException {
+ public void init() throws RemoteException {
if (registry == null && locate) {
try {
Registry reg = LocateRegistry.getRegistry(getPort());
Added: servicemix/smx4/kernel/branches/blueprint/management/src/main/resources/OSGI-INF/blueprint/servicemix-management.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/management/src/main/resources/OSGI-INF/blueprint/servicemix-management.xml?rev=769394&view=auto
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/management/src/main/resources/OSGI-INF/blueprint/servicemix-management.xml (added)
+++ servicemix/smx4/kernel/branches/blueprint/management/src/main/resources/OSGI-INF/blueprint/servicemix-management.xml Tue Apr 28 13:34:49 2009
@@ -0,0 +1,73 @@
+<?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">
+
+ <type-converters>
+ <!-- Property place holder -->
+ <cm:property-placeholder persistent-id="org.apache.servicemix.management">
+ <cm:default-properties>
+ <cm:property name="rmiRegistryPort" value="1099"/>
+ <cm:property name="jmxRealm" value="servicemix"/>
+ <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>
+ </type-converters>
+
+ <!-- MBeanServer bean -->
+ <bean id="mbeanServerFactory" class="org.apache.servicemix.management.MBeanServerFactoryBean" init-method="init" destroy-method="destroy">
+ <property name="locateExistingServerIfPossible" value="true"/>
+ </bean>
+ <bean id="mbeanServer" factory-component="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.servicemix.management.RmiRegistryFactoryBean" 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.servicemix.management.ConnectorServerFactoryBean" 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.servicemix.management.JaasAuthenticator">
+ <property name="realm" value="${jmxRealm}"/>
+ </bean>
+
+</blueprint>
+
Modified: servicemix/smx4/kernel/branches/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/pom.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/pom.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/pom.xml Tue Apr 28 13:34:49 2009
@@ -39,12 +39,16 @@
<module>filemonitor</module>
<module>gshell</module>
<module>spring</module>
+ <!--
<module>testing</module>
+ -->
<module>jaas</module>
<module>client</module>
<module>management</module>
<module>assembly</module>
+ <!--
<module>demos</module>
+ -->
</modules>
<scm>
@@ -84,6 +88,7 @@
<felix.bundlerepository.version>1.2.1</felix.bundlerepository.version>
<felix.prefs.version>1.0.2</felix.prefs.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_1</jaxp.ri.version>
@@ -197,7 +202,7 @@
</dependency>
<dependency>
<groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.spring</artifactId>
+ <artifactId>org.apache.servicemix.kernel.blueprint</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
@@ -251,6 +256,11 @@
<version>${pom.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.servicemix.kernel.gshell</groupId>
+ <artifactId>org.apache.servicemix.kernel.gshell.run</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.servicemix.kernel.jaas</groupId>
<artifactId>org.apache.servicemix.kernel.jaas.boot</artifactId>
<version>${pom.version}</version>
@@ -352,6 +362,12 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo</groupId>
+ <artifactId>blueprint-bundle</artifactId>
+ <version>${geronimo.blueprint.version}</version>
+ </dependency>
+ <!--
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
@@ -420,6 +436,7 @@
<artifactId>spring-osgi-annotation</artifactId>
<version>${spring.osgi.version}</version>
</dependency>
+ -->
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
Modified: servicemix/smx4/kernel/branches/blueprint/spring/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/pom.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/pom.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/pom.xml Tue Apr 28 13:34:49 2009
@@ -28,7 +28,7 @@
</parent>
<groupId>org.apache.servicemix.kernel</groupId>
- <artifactId>org.apache.servicemix.kernel.spring</artifactId>
+ <artifactId>org.apache.servicemix.kernel.blueprint</artifactId>
<packaging>bundle</packaging>
<version>1.2.0-blueprint-SNAPSHOT</version>
<name>Apache ServiceMix Kernel :: Spring Deployer</name>
@@ -41,10 +41,12 @@
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
+ <!--
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-core</artifactId>
</dependency>
+ -->
<dependency>
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.filemonitor</artifactId>
@@ -63,7 +65,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Private-Package>org.apache.servicemix.kernel.spring</Private-Package>
+ <Private-Package>org.apache.servicemix.kernel.blueprint</Private-Package>
<Spring-Context>*;publish-context:=false;create-asynchronously:=false</Spring-Context>
</instructions>
</configuration>
Copied: servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintDeploymentListener.java (from r768025, servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringDeploymentListener.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintDeploymentListener.java?p2=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintDeploymentListener.java&p1=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringDeploymentListener.java&r1=768025&r2=769394&rev=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringDeploymentListener.java (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintDeploymentListener.java Tue Apr 28 13:34:49 2009
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.servicemix.kernel.spring;
+package org.apache.servicemix.kernel.blueprint;
import java.io.File;
import java.io.FileOutputStream;
@@ -33,10 +33,10 @@
* A deployment listener that listens for spring xml applications
* and creates bundles for these.
*/
-public class SpringDeploymentListener implements DeploymentListener {
+public class BlueprintDeploymentListener implements DeploymentListener {
- private static final Log LOGGER = LogFactory.getLog(SpringDeploymentListener.class);
+ private static final Log LOGGER = LogFactory.getLog(BlueprintDeploymentListener.class);
private DocumentBuilderFactory dbf;
@@ -46,7 +46,7 @@
Document doc = parse(artifact);
String name = doc.getDocumentElement().getLocalName();
String uri = doc.getDocumentElement().getNamespaceURI();
- if ("beans".equals(name) && "http://www.springframework.org/schema/beans".equals(uri)) {
+ if ("beans".equals(name) && "http://www.osgi.org/xmlns/blueprint/v1.0.0".equals(uri)) {
return true;
}
}
@@ -60,11 +60,11 @@
try {
File destFile = new File(tmpDir, artifact.getName() + ".jar");
FileOutputStream os = new FileOutputStream(destFile);
- SpringTransformer.transform(artifact.toURL(), os);
+ BlueprintTransformer.transform(artifact.toURL(), os);
os.close();
return destFile;
} catch (Exception e) {
- LOGGER.error("Unable to build spring application bundle", e);
+ LOGGER.error("Unable to build blueprint application bundle", e);
return null;
}
}
Copied: servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintTransformer.java (from r768025, servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringTransformer.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintTransformer.java?p2=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintTransformer.java&p1=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringTransformer.java&r1=768025&r2=769394&rev=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringTransformer.java (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintTransformer.java Tue Apr 28 13:34:49 2009
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.servicemix.kernel.spring;
+package org.apache.servicemix.kernel.blueprint;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -51,7 +51,7 @@
import org.osgi.framework.Constants;
-public class SpringTransformer {
+public class BlueprintTransformer {
static Transformer transformer;
static DocumentBuilderFactory dbf;
@@ -74,7 +74,6 @@
m.getMainAttributes().putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
m.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, str[0]);
m.getMainAttributes().putValue(Constants.BUNDLE_VERSION, str[1]);
- m.getMainAttributes().putValue("Spring-Context", "*;publish-context:=false;create-asynchronously:=true");
String importPkgs = getImportPackages(analyze(new DOMSource(doc)));
if (importPkgs != null && importPkgs.length() > 0) {
m.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, importPkgs);
@@ -103,12 +102,12 @@
out.putNextEntry(e);
m.write(out);
out.closeEntry();
- e = new ZipEntry("META-INF/");
+ e = new ZipEntry("OSGI-INF/");
out.putNextEntry(e);
- e = new ZipEntry("META-INF/spring/");
+ e = new ZipEntry("OSGI-INF/blueprint/");
out.putNextEntry(e);
out.closeEntry();
- e = new ZipEntry("META-INF/spring/" + name);
+ e = new ZipEntry("META-INF/blueprint/" + name);
out.putNextEntry(e);
// Copy the new DOM
if (tf == null) {
@@ -185,7 +184,7 @@
if (tf == null) {
tf = TransformerFactory.newInstance();
}
- Source s = new StreamSource(SpringTransformer.class.getResourceAsStream("extract.xsl"));
+ Source s = new StreamSource(BlueprintTransformer.class.getResourceAsStream("extract.xsl"));
transformer = tf.newTransformer(s);
}
Copied: servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintURLHandler.java (from r768025, servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringURLHandler.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintURLHandler.java?p2=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintURLHandler.java&p1=servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringURLHandler.java&r1=768025&r2=769394&rev=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/spring/SpringURLHandler.java (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/main/java/org/apache/servicemix/kernel/blueprint/BlueprintURLHandler.java Tue Apr 28 13:34:49 2009
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.servicemix.kernel.spring;
+package org.apache.servicemix.kernel.blueprint;
import java.io.File;
import java.io.FileInputStream;
@@ -34,13 +34,13 @@
* A URL handler that will transform a JBI artifact to an OSGi bundle
* on the fly. Needs to be registered in the OSGi registry.
*/
-public class SpringURLHandler extends AbstractURLStreamHandlerService {
+public class BlueprintURLHandler extends AbstractURLStreamHandlerService {
- private static Log logger = LogFactory.getLog(SpringURLHandler.class);
+ private static Log logger = LogFactory.getLog(BlueprintURLHandler.class);
- private static String SYNTAX = "spring: spring-xml-uri";
+ private static String SYNTAX = "blueprint: blueprint-xml-uri";
- private URL springXmlURL;
+ private URL bueprintXmlURL;
/**
* Open the connection for the given URL.
@@ -54,14 +54,14 @@
if (url.getPath() == null || url.getPath().trim().length() == 0) {
throw new MalformedURLException ("Path can not be null or empty. Syntax: " + SYNTAX );
}
- springXmlURL = new URL(url.getPath());
+ bueprintXmlURL = new URL(url.getPath());
- logger.debug("Spring xml URL is: [" + springXmlURL + "]");
+ logger.debug("Blueprint xml URL is: [" + bueprintXmlURL + "]");
return new Connection(url);
}
- public URL getSpringXmlURL() {
- return springXmlURL;
+ public URL getBueprintXmlURL() {
+ return bueprintXmlURL;
}
public class Connection extends URLConnection {
@@ -79,7 +79,7 @@
try {
final File f = File.createTempFile("smx", "xml");
FileOutputStream os = new FileOutputStream(f);
- SpringTransformer.transform(springXmlURL, os);
+ BlueprintTransformer.transform(bueprintXmlURL, os);
os.close();
return new FileInputStream(f) {
public void close() throws IOException {
@@ -88,8 +88,8 @@
}
};
} catch (Exception e) {
- logger.error("Error opening spring xml url", e);
- throw (IOException) new IOException("Error opening spring xml url").initCause(e);
+ logger.error("Error opening blueprint xml url", e);
+ throw (IOException) new IOException("Error opening blueprint xml url").initCause(e);
}
}
}
Copied: servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml (from r768025, servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/META-INF/spring/spring-deployer.xml)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml?p2=servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml&p1=servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/META-INF/spring/spring-deployer.xml&r1=768025&r2=769394&rev=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/META-INF/spring/spring-deployer.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml Tue Apr 28 13:34:49 2009
@@ -17,34 +17,17 @@
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">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <bean id="springDeploymentListener" class="org.apache.servicemix.kernel.spring.SpringDeploymentListener">
+ <service interface="org.apache.servicemix.kernel.filemonitor.DeploymentListener">
+ <bean class="org.apache.servicemix.kernel.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.servicemix.kernel.blueprint.BlueprintURLHandler" />
+ </service>
- </bean>
-
- <osgi:service ref="springDeploymentListener">
- <osgi:interfaces>
- <value>org.apache.servicemix.kernel.filemonitor.DeploymentListener</value>
- </osgi:interfaces>
- </osgi:service>
-
- <bean id="springHandler" class="org.apache.servicemix.kernel.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>
\ No newline at end of file
+</blueprint>
\ No newline at end of file
Copied: servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/blueprint/extract.xsl (from r768025, servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/spring/extract.xsl)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/blueprint/extract.xsl?p2=servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/blueprint/extract.xsl&p1=servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/spring/extract.xsl&r1=768025&r2=769394&rev=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/spring/extract.xsl (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/main/resources/org/apache/servicemix/kernel/blueprint/extract.xsl Tue Apr 28 13:34:49 2009
@@ -19,18 +19,7 @@
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:jee="http://www.springframework.org/schema/jee"
- xmlns:jms="http://www.springframework.org/schema/jms"
- xmlns:lang="http://www.springframework.org/schema/lang"
- xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xmlns:tool="http://www.springframework.org/schema/tool"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:webflow-config="http://www.springframework.org/schema/webflow-config">
+ xmlns:osgi="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<xsl:output method="text" />
@@ -40,21 +29,10 @@
list of classes and print them -->
<xsl:for-each select="
- //beans:bean/@class
- | //beans:*/@value-type
- | //aop:*/@implement-interface
- | //aop:*/@default-impl
- | //context:load-time-weaver/@weaver-class
- | //jee:jndi-lookup/@expected-type
- | //jee:jndi-lookup/@proxy-interface
- | //jee:remote-slsb/@ejbType
- | //jee:*/@business-interface
- | //lang:*/@script-interfaces
+ //osgi:bean/@class
+ | //osgi:*/@value-type
+ | //osgi:*/@key-type
| //osgi:*/@interface
- | //util:list/@list-class
- | //util:set/@set-class
- | //util:map/@map-class
- | //webflow-config:*/@class
">
<xsl:value-of select="." />
<xsl:text>
@@ -63,15 +41,6 @@
<!-- This seems some magic to get extra imports? -->
- <xsl:for-each select="//beans:bean[@class='org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean'
- or @class='org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean']">
- <xsl:for-each select="beans:property[@name='interfaces']">
- <xsl:value-of select="@value" />
- <xsl:text>
- </xsl:text>
- </xsl:for-each>
- </xsl:for-each>
-
</xsl:template>
Modified: servicemix/smx4/kernel/branches/blueprint/spring/src/test/java/org/apache/servicemix/kernel/spring/SpringDeploymentListenerTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/test/java/org/apache/servicemix/kernel/spring/SpringDeploymentListenerTest.java?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/test/java/org/apache/servicemix/kernel/spring/SpringDeploymentListenerTest.java (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/test/java/org/apache/servicemix/kernel/spring/SpringDeploymentListenerTest.java Tue Apr 28 13:34:49 2009
@@ -29,13 +29,15 @@
import javax.xml.transform.dom.DOMSource;
import junit.framework.TestCase;
+import org.apache.servicemix.kernel.blueprint.BlueprintDeploymentListener;
+import org.apache.servicemix.kernel.blueprint.BlueprintTransformer;
public class SpringDeploymentListenerTest extends TestCase {
public void testPackagesExtraction() throws Exception {
- SpringDeploymentListener l = new SpringDeploymentListener();
- File f = new File(getClass().getClassLoader().getResource("META-INF/spring/spring-deployer.xml").toURI());
- Set<String> pkgs = SpringTransformer.analyze(new DOMSource(SpringTransformer.parse(f.toURL())));
+ BlueprintDeploymentListener l = new BlueprintDeploymentListener();
+ File f = new File(getClass().getClassLoader().getResource("OSGI-INF/blueprint/blueprint-deployer.xml").toURI());
+ Set<String> pkgs = BlueprintTransformer.analyze(new DOMSource(BlueprintTransformer.parse(f.toURL())));
assertNotNull(pkgs);
assertEquals(2, pkgs.size());
Iterator<String> it = pkgs.iterator();
@@ -47,7 +49,7 @@
File f = File.createTempFile("smx", ".jar");
try {
OutputStream os = new FileOutputStream(f);
- SpringTransformer.transform(getClass().getClassLoader().getResource("test.xml"), os);
+ BlueprintTransformer.transform(getClass().getClassLoader().getResource("test.xml"), os);
os.close();
InputStream is = new FileInputStream(f);
JarInputStream jar = new JarInputStream(is);
@@ -74,7 +76,7 @@
}
private void assertVersion(String s, String... expectedParts) {
- String[] parts = SpringTransformer.extractNameVersionType(s);
+ String[] parts = BlueprintTransformer.extractNameVersionType(s);
assertEquals(expectedParts.length, parts.length);
for (int i = 0; i < expectedParts.length; i++) {
assertEquals(expectedParts[i], parts[i]);
Modified: servicemix/smx4/kernel/branches/blueprint/spring/src/test/resources/test.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/branches/blueprint/spring/src/test/resources/test.xml?rev=769394&r1=769393&r2=769394&view=diff
==============================================================================
--- servicemix/smx4/kernel/branches/blueprint/spring/src/test/resources/test.xml (original)
+++ servicemix/smx4/kernel/branches/blueprint/spring/src/test/resources/test.xml Tue Apr 28 13:34:49 2009
@@ -34,7 +34,7 @@
Header=value
</manifest>
- <bean id="springDeploymentListener" class="org.apache.servicemix.kernel.spring.SpringDeploymentListener">
+ <bean id="springDeploymentListener" class="org.apache.servicemix.kernel.blueprint.BlueprintDeploymentListener">
</bean>
@@ -44,7 +44,7 @@
</osgi:interfaces>
</osgi:service>
- <bean id="springHandler" class="org.apache.servicemix.kernel.spring.SpringURLHandler" />
+ <bean id="springHandler" class="org.apache.servicemix.kernel.blueprint.BlueprintURLHandler" />
<osgi:service ref="springHandler" interface="org.osgi.service.url.URLStreamHandlerService">
<osgi:service-properties>