Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/pom.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/pom.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/pom.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/pom.xml Mon Jul 30 11:45:52 2007 @@ -0,0 +1,89 @@ +<?xml version="1.0"?> +<project> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.servicemix</groupId> + <artifactId>osgi</artifactId> + <packaging>pom</packaging> + <name>ServiceMix</name> + <version>${servicemix.version}</version> + + <modules> + <module>bundles</module> + <module>services</module> + <module>installers</module> + </modules> + + <properties> + <felix.version>1.0.0</felix.version> + <spring.version>2.1-SNAPSHOT</spring.version> + <servicemix.version>4.0-SNAPSHOT</servicemix.version> + </properties> + + <repositories> + <repository> + <id>apache-snapshots</id> + <name>Apache Snapshots Repository</name> + <url>http://people.apache.org/repo/m2-snapshot-repository</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <id>apache-snapshots</id> + <name>Apache Snapshots repository</name> + <url>http://people.apache.org/repo/m2-snapshot-repository</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.1</version> + <configuration> + <archive> + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${felix.version}</version> + <executions> + <execution> + <phase>process-classes</phase> + <goals> + <goal>manifest</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project>
Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/pom.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/pom.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/pom.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/pom.xml Mon Jul 30 11:45:52 2007 @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.servicemix.osgi</groupId> + <artifactId>services</artifactId> + <version>4.0-SNAPSHOT</version> + </parent> + <groupId>org.apache.servicemix.osgi.services</groupId> + <artifactId>org.apache.servicemix.jmx</artifactId> + <version>4.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>ServiceMix OSGI Services: JMX</name> + <description> + JMX agent bundle. + </description> + <dependencies> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>1.1.0-SNAPSHOT</version> + <configuration> + <instructions> + <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> + <Export-Package> + ${pom.artifactId} + </Export-Package> + <DynamicImport-Package> + * + </DynamicImport-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/CertificateCallback.java URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/CertificateCallback.java?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/CertificateCallback.java (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/CertificateCallback.java Mon Jul 30 11:45:52 2007 @@ -0,0 +1,39 @@ +/* + * 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.jmx; + +import java.security.cert.X509Certificate; + +import javax.security.auth.callback.Callback; + +/** + * A callback to retrieve an X509Certificate. + * This class is mainly used from the related login module. + + */ +public class CertificateCallback implements Callback { + + private X509Certificate certificate; + + public X509Certificate getCertificate() { + return certificate; + } + + public void setCertificate(X509Certificate certificate) { + this.certificate = certificate; + } +} Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/JaasAuthenticator.java URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/JaasAuthenticator.java?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/JaasAuthenticator.java (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/java/org/apache/servicemix/jmx/JaasAuthenticator.java Mon Jul 30 11:45:52 2007 @@ -0,0 +1,100 @@ +/* + * 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.jmx; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.cert.X509Certificate; + +import javax.management.remote.JMXAuthenticator; +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.auth.login.LoginContext; +import javax.security.auth.login.LoginException; + +/** + * + * @author gnodet + */ +public class JaasAuthenticator implements JMXAuthenticator { + + private String domain = "servicemix-domain"; + + /** + * @return the JAAS domain to use for authentication + */ + public String getDomain() { + return domain; + } + + /** + * @param domain the JAAS domain to use for authentication + */ + public void setDomain(String domain) { + this.domain = domain; + } + + /* (non-Javadoc) + * @see javax.management.remote.JMXAuthenticator#authenticate(java.lang.Object) + */ + public Subject authenticate(Object credentials) throws SecurityException { + if (!(credentials instanceof String[])) { + throw new IllegalArgumentException("Expected String[2], got " + (credentials != null ? credentials.getClass().getName() : null)); + } + String[] params = (String[]) credentials; + if (params.length != 2) { + throw new IllegalArgumentException("Expected String[2] but length was " + params.length); + } + Subject subject = new Subject(); + try { + authenticate(subject, domain, params[0], params[1]); + } catch (LoginException e) { + throw new SecurityException("Authentication failed", e); + } catch (Exception e) { + throw new SecurityException("Error occured while authenticating", e); + } + return subject; + } + + protected void authenticate(Subject subject, + String domain, + final String user, + final Object credentials) throws GeneralSecurityException { + LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() { + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (Callback callback : callbacks) { + if (callback instanceof NameCallback) { + ((NameCallback) callback).setName(user); + } else if (callback instanceof PasswordCallback && credentials instanceof String) { + ((PasswordCallback) callback).setPassword(((String) credentials).toCharArray()); + } else if (callback instanceof CertificateCallback && credentials instanceof X509Certificate) { + ((CertificateCallback) callback).setCertificate((X509Certificate) credentials); + } else { + throw new UnsupportedCallbackException(callback); + } + } + } + }); + loginContext.login(); + loginContext.logout(); + } + +} Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/resources/META-INF/spring/servicemix-jmx.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/resources/META-INF/spring/servicemix-jmx.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/resources/META-INF/spring/servicemix-jmx.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/jmx/src/main/resources/META-INF/spring/servicemix-jmx.xml Mon Jul 30 11:45:52 2007 @@ -0,0 +1,61 @@ +<?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="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"> + <property name="locateExistingServerIfPossible" value="true"/> + </bean> + + <!-- + <bean id="jndiConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"> + <property name="objectName" value="connector:name=rmi"/> + <property name="serviceUrl" value="${jmx.url}"/> + <property name="threaded" value="true"/> + <property name="daemon" value="true"/> + <property name="environment" ref="jmxConnectorEnvironment"/> + </bean> + + <util:map id="jmxConnectorEnvironment"> + <entry key="jmx.remote.authenticator"> + <bean class="org.apache.servicemix.jmx.JaasAuthenticator"> + <property name="domain" value="${jmx.security.domain}"/> + </bean> + </entry> + </util:map> + --> + + <osgi:service ref="mbeanServer"> + <osgi:interfaces> + <value>javax.management.MBeanServer</value> + </osgi:interfaces> + </osgi:service> + +</beans> + Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/pom.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/pom.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/pom.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/pom.xml Mon Jul 30 11:45:52 2007 @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.servicemix.osgi</groupId> + <artifactId>services</artifactId> + <version>4.0-SNAPSHOT</version> + </parent> + <groupId>org.apache.servicemix.osgi.services</groupId> + <artifactId>org.apache.servicemix.nmr</artifactId> + <version>4.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>ServiceMix OSGI Services: NMR</name> + <description> + NMR bundle. + </description> + <dependencies> + <dependency> + <groupId>org.apache.servicemix</groupId> + <artifactId>servicemix-core</artifactId> + <version>3.2-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>1.1.0-SNAPSHOT</version> + <configuration> + <instructions> + <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> + <Export-Package> + ${pom.artifactId} + </Export-Package> + <DynamicImport-Package> + * + </DynamicImport-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/java/org/apache/servicemix/nmr/Container.java URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/java/org/apache/servicemix/nmr/Container.java?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/java/org/apache/servicemix/nmr/Container.java (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/java/org/apache/servicemix/nmr/Container.java Mon Jul 30 11:45:52 2007 @@ -0,0 +1,13 @@ +package org.apache.servicemix.nmr; + +import org.apache.servicemix.jbi.container.JBIContainer; + +/** + * Created by IntelliJ IDEA. + * User: gnodet + * Date: Jul 29, 2007 + * Time: 11:57:45 PM + * To change this template use File | Settings | File Templates. + */ +public class Container extends JBIContainer { +} Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/resources/META-INF/spring/servicemix-nmr.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/resources/META-INF/spring/servicemix-nmr.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/resources/META-INF/spring/servicemix-nmr.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/nmr/src/main/resources/META-INF/spring/servicemix-nmr.xml Mon Jul 30 11:45:52 2007 @@ -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. + +--> +<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="servicemix" + class="org.apache.servicemix.nmr.Container"> + <property name="MBeanServer" ref="MBeanServer" /> + <property name="broker" ref="broker" /> + <property name="listeners" ref="listeners" /> + </bean> + + <osgi:reference id="MBeanServer" + interface="javax.management.MBeanServer" + cardinality="0..1" /> + + <bean id="broker" + class="org.apache.servicemix.jbi.security.SecuredBroker"> + <property name="authorizationMap" ref="authorizationMap" /> + <property name="flows" ref="flows" /> + </bean> + + <bean id="authorizationMap" + class="org.apache.servicemix.jbi.security.acl.impl.DefaultAuthorizationMap"> + + </bean> + + <osgi:reference id="flows" + interface="org.apache.servicemix.jbi.nmr.flow.Flow" + cardinality="0..n" /> + + <bean id="stFlow" + class="org.apache.servicemix.jbi.nmr.flow.st.STFlow" /> + + <osgi:service ref="stFlow"> + <osgi:interfaces> + <value>org.apache.servicemix.jbi.nmr.flow.Flow</value> + </osgi:interfaces> + </osgi:service> + + <osgi:reference id="listeners" + interface="org.apache.servicemix.jbi.event.ServiceMixListener" + cardinality="0..n" /> + +</beans> \ No newline at end of file Added: incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/pom.xml URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/pom.xml?view=auto&rev=561089 ============================================================================== --- incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/pom.xml (added) +++ incubator/servicemix/branches/osgi/servicemix-osgi-spring/services/pom.xml Mon Jul 30 11:45:52 2007 @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<project> + + <parent> + <groupId>org.apache.servicemix</groupId> + <artifactId>osgi</artifactId> + <version>4.0-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <name>ServiceMix OSGI Services</name> + <groupId>org.apache.servicemix.osgi</groupId> + <artifactId>services</artifactId> + <packaging>pom</packaging> + <version>4.0-SNAPSHOT</version> + + <modules> + <module>jmx</module> + <module>nmr</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${felix.version}</version> + <extensions>true</extensions> + <executions> + <execution> + <goals> + <goal>bundle</goal> + </goals> + </execution> + </executions> + <configuration> + <instructions> + <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> + <Export-Package>*;version=${pkgVersion}</Export-Package> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + + <!-- + <dependencies> + <dependency> + <groupId>org.apache.servicemix</groupId> + <artifactId>servicemix-jbi</artifactId> + <version>3.1.1-incubating</version> + <exclusions> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-qname_1.1_spec</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-activation_1.0.2_spec</artifactId> + </exclusion> + </exclusions> + <dependencies> + <dependency> + <groupId>javax.activation</groupId> + <artifactId>activation</artifactId> + <version>1.1</version> + </dependency> + </dependencies> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <version>${felix.version}</version> + <extensions>true</extensions> + <executions> + <execution> + <goals> + <goal>bundleall</goal> + </goals> + </execution> + </executions> + <configuration> + <instructions> + <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> + <Export-Package>*;version=${pkgVersion}</Export-Package> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + --> + +</project>
