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 2007/11/08 16:32:52 UTC
svn commit: r593202 [1/2] - in
/incubator/servicemix/branches/servicemix-4.0/jbi: ./ deployer/
deployer/src/ deployer/src/main/ deployer/src/main/java/
deployer/src/main/java/org/ deployer/src/main/java/org/apache/
deployer/src/main/java/org/apache/ser...
Author: gnodet
Date: Thu Nov 8 07:32:49 2007
New Revision: 593202
URL: http://svn.apache.org/viewvc?rev=593202&view=rev
Log:
SM-1091: Deployment bundle for JBI artifacts
Added:
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/pom.xml
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/SharedLibrary.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ClassPath.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connection.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connections.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumer.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumes.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Identification.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/InstallationDescriptorExtension.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provider.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provides.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Services.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryList.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Target.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/org/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/org/apache/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/org/apache/servicemix/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/org/apache/servicemix/jbi/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/test/resources/
Modified:
incubator/servicemix/branches/servicemix-4.0/jbi/deployer/ (props changed)
incubator/servicemix/branches/servicemix-4.0/jbi/pom.xml
Propchange: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 8 07:32:49 2007
@@ -0,0 +1,4 @@
+target
+*.iml
+*.ipr
+*.iws
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/pom.xml?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/pom.xml (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/pom.xml Thu Nov 8 07:32:49 2007
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.servicemix.jbi</groupId>
+ <artifactId>jbi</artifactId>
+ <version>4.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.servicemix.jbi</groupId>
+ <artifactId>org.apache.servicemix.jbi.deployer</artifactId>
+ <packaging>bundle</packaging>
+ <version>4.0-SNAPSHOT</version>
+ <name>ServiceMix JBI Deployer</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.servicemix.jbi</groupId>
+ <artifactId>org.apache.servicemix.jbi.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-classloader</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${felix.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Private-Package>org.apache.xbean*</Private-Package>
+ <Export-Package>${pom.artifactId}*</Export-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/SharedLibrary.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/SharedLibrary.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/SharedLibrary.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/SharedLibrary.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,20 @@
+package org.apache.servicemix.jbi.deployer;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Nov 8, 2007
+ * Time: 1:01:27 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface SharedLibrary {
+
+ String getName();
+
+ String getDescription();
+
+ String getVersion();
+
+ ClassLoader createClassLoader();
+
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ClassPath.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ClassPath.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ClassPath.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ClassPath.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,91 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class ClassPath {
+
+ private String[] pathElements = new String[] {};
+
+ public ClassPath() {
+ }
+
+ public ClassPath(String[] pathElements) {
+ this.pathElements = pathElements;
+ }
+
+ public String[] getPathElements() {
+ return pathElements;
+ }
+
+ public void setPathElements(String[] pathElements) {
+ this.pathElements = pathElements;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof ClassPath)) {
+ return false;
+ }
+ final ClassPath classPath = (ClassPath) o;
+ if (!Arrays.equals(pathElements, classPath.pathElements)) {
+ return false;
+ }
+ return true;
+ }
+
+ //SM-199: Hashcode method added
+ public int hashCode() {
+ if (pathElements == null) {
+ return 0;
+ }
+ int result = 1;
+ for (int i=0;i < pathElements.length;i++) {
+ result = 31 * result + (pathElements[i] == null ? 0 : pathElements[i].hashCode());
+ }
+ return result;
+ }
+
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer("ClassPath[");
+ for (int i = 0; i < pathElements.length; i++) {
+ String pathElement = pathElements[i];
+ if (i > 0) {
+ buffer.append(", ");
+ }
+ buffer.append(pathElement);
+ }
+ return buffer.toString();
+ }
+
+ public List<String> getPathList() {
+ return Arrays.asList(pathElements);
+ }
+
+ public void setPathList(List<String> list) {
+ pathElements = new String[list.size()];
+ list.toArray(pathElements);
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,163 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import org.apache.servicemix.jbi.deployer.descriptor.ClassPath;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Component {
+ private String type;
+ private String componentClassLoaderDelegation = "parent-first";
+ private String bootstrapClassLoaderDelegation = "parent-first";
+ private Identification identification;
+ private String componentClassName;
+ private String description;
+ private ClassPath componentClassPath;
+ private String bootstrapClassName;
+ private ClassPath bootstrapClassPath;
+ private SharedLibraryList[] sharedLibraries;
+ private InstallationDescriptorExtension descriptorExtension;
+
+ public boolean isServiceEngine() {
+ return type != null && type.equals("service-engine");
+ }
+
+ public boolean isBindingComponent() {
+ return type != null && type.equals("binding-component");
+ }
+
+ public boolean isComponentClassLoaderDelegationParentFirst() {
+ return isParentFirst(componentClassLoaderDelegation);
+ }
+
+ public boolean isComponentClassLoaderDelegationSelfFirst() {
+ return isSelfFirst(componentClassLoaderDelegation);
+ }
+
+ public boolean isBootstrapClassLoaderDelegationParentFirst() {
+ return isParentFirst(bootstrapClassLoaderDelegation);
+ }
+
+ public boolean isBootstrapClassLoaderDelegationSelfFirst() {
+ return isSelfFirst(bootstrapClassLoaderDelegation);
+ }
+
+
+ // Properties
+ //-------------------------------------------------------------------------
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getComponentClassLoaderDelegation() {
+ return componentClassLoaderDelegation;
+ }
+
+ public void setComponentClassLoaderDelegation(String componentClassLoaderDelegation) {
+ this.componentClassLoaderDelegation = componentClassLoaderDelegation;
+ }
+
+ public String getBootstrapClassLoaderDelegation() {
+ return bootstrapClassLoaderDelegation;
+ }
+
+ public void setBootstrapClassLoaderDelegation(String bootstrapClassLoaderDelegation) {
+ this.bootstrapClassLoaderDelegation = bootstrapClassLoaderDelegation;
+ }
+
+ public Identification getIdentification() {
+ return identification;
+ }
+
+ public void setIdentification(Identification identification) {
+ this.identification = identification;
+ }
+
+ public String getComponentClassName() {
+ return componentClassName;
+ }
+
+ public void setComponentClassName(String componentClassName) {
+ this.componentClassName = componentClassName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public ClassPath getComponentClassPath() {
+ return componentClassPath;
+ }
+
+ public void setComponentClassPath(ClassPath componentClassPath) {
+ this.componentClassPath = componentClassPath;
+ }
+
+ public String getBootstrapClassName() {
+ return bootstrapClassName;
+ }
+
+ public void setBootstrapClassName(String bootstrapClassName) {
+ this.bootstrapClassName = bootstrapClassName;
+ }
+
+ public ClassPath getBootstrapClassPath() {
+ return bootstrapClassPath;
+ }
+
+ public void setBootstrapClassPath(ClassPath bootstrapClassPath) {
+ this.bootstrapClassPath = bootstrapClassPath;
+ }
+
+ public SharedLibraryList[] getSharedLibraries() {
+ return sharedLibraries;
+ }
+
+ public void setSharedLibraries(SharedLibraryList[] sharedLibraries) {
+ this.sharedLibraries = sharedLibraries;
+ }
+
+ public InstallationDescriptorExtension getDescriptorExtension() {
+ return descriptorExtension;
+ }
+
+ public void setDescriptorExtension(InstallationDescriptorExtension descriptorExtension) {
+ this.descriptorExtension = descriptorExtension;
+ }
+
+ // Implementation methods
+ //-------------------------------------------------------------------------
+ protected boolean isParentFirst(String text) {
+ return text != null && text.equalsIgnoreCase("parent-first");
+ }
+
+ protected boolean isSelfFirst(String text) {
+ return text != null && text.equalsIgnoreCase("self-first");
+ }
+
+
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connection.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connection.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connection.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connection.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Connection {
+ private Consumer consumer;
+ private Provider provider;
+
+ public Consumer getConsumer() {
+ return consumer;
+ }
+
+ public void setConsumer(Consumer consumer) {
+ this.consumer = consumer;
+ }
+
+ public Provider getProvider() {
+ return provider;
+ }
+
+ public void setProvider(Provider provider) {
+ this.provider = provider;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connections.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connections.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connections.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Connections.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import org.apache.servicemix.jbi.deployer.descriptor.Connection;
+
+/**
+ * Inner class used to handle the grouping of connections
+ *
+ */
+public class Connections {
+ private Connection[] connections;
+
+ public Connection[] getConnections() {
+ return connections;
+ }
+
+ public void setConnections(Connection[] connections) {
+ this.connections = connections;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumer.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumer.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumer.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Specifies either an interface name or a service and endpoint name.
+ *
+ * @version $Revision: 426415 $
+ */
+public class Consumer {
+ private QName interfaceName;
+ private QName serviceName;
+ private String endpointName;
+
+ public QName getInterfaceName() {
+ return interfaceName;
+ }
+
+ public void setInterfaceName(QName interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public void setEndpointName(String endpointName) {
+ this.endpointName = endpointName;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumes.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumes.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumes.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Consumes.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Specifies either an interface name or a service and endpoint name.
+ *
+ * @version $Revision: 426415 $
+ */
+public class Consumes {
+ private QName interfaceName;
+ private QName serviceName;
+ private String endpointName;
+ private String linkType = "standard";
+
+ public QName getInterfaceName() {
+ return interfaceName;
+ }
+
+ public void setInterfaceName(QName interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public void setEndpointName(String endpointName) {
+ this.endpointName = endpointName;
+ }
+
+ public String getLinkType() {
+ return linkType;
+ }
+
+ public void setLinkType(String linkType) {
+ this.linkType = linkType;
+ }
+
+ public boolean isStandardLink() {
+ return linkType != null && linkType.equals("standard");
+ }
+
+ public boolean isSoftLink() {
+ return linkType != null && linkType.equals("soft");
+ }
+
+ public boolean isHardLink() {
+ return linkType != null && linkType.equals("hard");
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,162 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import org.apache.servicemix.jbi.deployer.descriptor.Component;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Descriptor {
+ private double version;
+ private Component component;
+ private SharedLibrary sharedLibrary;
+ private ServiceAssembly serviceAssembly;
+ private Services services;
+
+ public double getVersion() {
+ return version;
+ }
+
+ public void setVersion(double version) {
+ this.version = version;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ }
+
+ public SharedLibrary getSharedLibrary() {
+ return sharedLibrary;
+ }
+
+ public void setSharedLibrary(SharedLibrary sharedLibrary) {
+ this.sharedLibrary = sharedLibrary;
+ }
+
+ public ServiceAssembly getServiceAssembly() {
+ return serviceAssembly;
+ }
+
+ public void setServiceAssembly(ServiceAssembly serviceAssembly) {
+ this.serviceAssembly = serviceAssembly;
+ }
+
+ public Services getServices() {
+ return services;
+ }
+
+ public void setServices(Services services) {
+ this.services = services;
+ }
+}
+
+/*
+default namespace this = "http://java.sun.com/xml/ns/jbi"
+start =
+ element jbi {
+ attribute version { xsd:decimal },
+ ( component | shared-library | service-assembly | services)
+ }
+component =
+ element component {
+ attribute type { "service-engine" | "binding-component" },
+ attribute component-class-loader-delegation { "parent-first" | "self-first" }?,
+ attribute bootstrap-class-loader-delegation { "parent-first" | "self-first" }?,
+ identification,
+ element component-class-name { attribute description { text }?, text },
+ element component-class-path { class-path },
+ element bootstrap-class-name { text },
+ element bootstrap-class-path { class-path },
+ shared-library-list*,
+ element* -this:* { text }*
+ }
+shared-library =
+ element shared-library {
+ attribute class-loader-delegation { "parent-first" | "self-first" }?,
+ attribute version { text }?,
+ identification,
+ element shared-library-class-path { class-path }
+ }
+shared-library-list =
+ element shared-library {
+ attribute version { text }?,
+ text
+ }
+service-assembly =
+ element service-assembly {
+ identification,
+ service-unit*,
+ connections?,
+ element* -this:* { text }*
+ }
+service-unit =
+ element service-unit {
+ identification,
+ element target {
+ element artifacts-zip { text },
+ element component-name { xsd:NCName }
+ },
+ element* -this:* { text }*
+ }
+identification =
+ element identification {
+ element name { xsd:NCName },
+ element description { text },
+ element* -this:* { text }*
+ }
+class-path =
+ (element path-element { text })+
+services =
+ element services {
+ attribute binding-component { xsd:boolean },
+ provides*,
+ consumes*,
+ element* -this:* { text }*
+ }
+connections =
+ element connections {
+ element connection {
+ element consumer {
+ ( attribute interface-name { xsd:QName } |
+ (attribute service-name { xsd:QName }, attribute endpoint-name { text })
+ )
+ },
+ element provider {
+ attribute service-name { xsd:QName }, attribute endpoint-name { text }
+ }
+ }*,
+ element* -this:* { text }*
+ }
+provides =
+ element provides {
+ attribute interface-name { xsd:QName },
+ attribute service-name {xsd:QName }, attribute endpoint-name { text },
+ element* -this:* { text }*
+ }
+consumes =
+ element consumes {
+ attribute interface-name { xsd:QName },
+ ( attribute service-name {xsd:QName }, attribute endpoint-name { text },
+ attribute link-type { "standard" | "hard" | "soft" }? )?,
+ element* -this:* { text }*
+ }
+*/
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,581 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * @version $Revision: 359151 $
+ */
+public class DescriptorFactory {
+
+ /**
+ * JAXP attribute value indicating the XSD schema language.
+ */
+ private static final String XSD_SCHEMA_LANGUAGE = "http://www.w3.org/2001/XMLSchema";
+
+ public static final String DESCRIPTOR_FILE = "META-INF/jbi.xml";
+
+ /**
+ * Build a jbi descriptor from a file archive
+ *
+ * @param descriptorFile
+ * path to the jbi descriptor, or to the root directory
+ * @return the Descriptor object
+ */
+ public static Descriptor buildDescriptor(File descriptorFile) {
+ if (descriptorFile.isDirectory()) {
+ descriptorFile = new File(descriptorFile, DESCRIPTOR_FILE);
+ }
+ if (descriptorFile.isFile()) {
+ try {
+ return buildDescriptor(descriptorFile.toURL());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("There is a bug here...", e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Build a jbi descriptor from the specified URL
+ *
+ * @param url
+ * url to the jbi descriptor
+ * @return the Descriptor object
+ */
+ public static Descriptor buildDescriptor(final URL url) {
+ try {
+ // Read descriptor
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ copyInputStream(url.openStream(), baos);
+ // Validate descriptor
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XSD_SCHEMA_LANGUAGE);
+ Schema schema = schemaFactory.newSchema(DescriptorFactory.class.getResource("/jbi-descriptor.xsd"));
+ Validator validator = schema.newValidator();
+ validator.setErrorHandler(new ErrorHandler() {
+ public void warning(SAXParseException exception) throws SAXException {
+ //log.debug("Validation warning on " + url + ": " + exception);
+ }
+ public void error(SAXParseException exception) throws SAXException {
+ //log.info("Validation error on " + url + ": " + exception);
+ }
+ public void fatalError(SAXParseException exception) throws SAXException {
+ throw exception;
+ }
+ });
+ validator.validate(new StreamSource(new ByteArrayInputStream(baos.toByteArray())));
+ // Parse descriptor
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ Document doc = docBuilder.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element jbi = doc.getDocumentElement();
+ Descriptor desc = new Descriptor();
+ desc.setVersion(Double.parseDouble(getAttribute(jbi, "version")));
+ Element child = getFirstChildElement(jbi);
+ if ("component".equals(child.getLocalName())) {
+ Component component = new Component();
+ component.setType(child.getAttribute("type"));
+ component.setComponentClassLoaderDelegation(getAttribute(child, "component-class-loader-delegation"));
+ component.setBootstrapClassLoaderDelegation(getAttribute(child, "bootstrap-class-loader-delegation"));
+ List<SharedLibraryList> sls = new ArrayList<SharedLibraryList>();
+ DocumentFragment ext = null;
+ for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
+ if ("identification".equals(e.getLocalName())) {
+ component.setIdentification(readIdentification(e));
+ } else if ("component-class-name".equals(e.getLocalName())) {
+ component.setComponentClassName(getText(e));
+ component.setDescription(getAttribute(e, "description"));
+ } else if ("component-class-path".equals(e.getLocalName())) {
+ ClassPath componentClassPath = new ClassPath();
+ ArrayList<String> l = new ArrayList<String>();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("path-element".equals(e2.getLocalName())) {
+ l.add(getText(e2));
+ }
+ }
+ componentClassPath.setPathList(l);
+ component.setComponentClassPath(componentClassPath);
+ } else if ("bootstrap-class-name".equals(e.getLocalName())) {
+ component.setBootstrapClassName(getText(e));
+ } else if ("bootstrap-class-path".equals(e.getLocalName())) {
+ ClassPath bootstrapClassPath = new ClassPath();
+ ArrayList<String> l = new ArrayList<String>();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("path-element".equals(e2.getLocalName())) {
+ l.add(getText(e2));
+ }
+ }
+ bootstrapClassPath.setPathList(l);
+ component.setBootstrapClassPath(bootstrapClassPath);
+ } else if ("shared-library".equals(e.getLocalName())) {
+ SharedLibraryList sl = new SharedLibraryList();
+ sl.setName(getText(e));
+ sl.setVersion(getAttribute(e, "version"));
+ sls.add(sl);
+ } else {
+ if (ext == null) {
+ ext = doc.createDocumentFragment();
+ }
+ ext.appendChild(e);
+ }
+ }
+ component.setSharedLibraries(sls.toArray(new SharedLibraryList[sls.size()]));
+ if (ext != null) {
+ InstallationDescriptorExtension descriptorExtension = new InstallationDescriptorExtension();
+ descriptorExtension.setDescriptorExtension(ext);
+ component.setDescriptorExtension(descriptorExtension);
+ }
+ desc.setComponent(component);
+ } else if ("shared-library".equals(child.getLocalName())) {
+ SharedLibrary sharedLibrary = new SharedLibrary();
+ sharedLibrary.setClassLoaderDelegation(getAttribute(child, "class-loader-delegation"));
+ sharedLibrary.setVersion(getAttribute(child, "version"));
+ for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
+ if ("identification".equals(e.getLocalName())) {
+ sharedLibrary.setIdentification(readIdentification(e));
+ } else if ("shared-library-class-path".equals(e.getLocalName())) {
+ ClassPath sharedLibraryClassPath = new ClassPath();
+ ArrayList<String> l = new ArrayList<String>();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("path-element".equals(e2.getLocalName())) {
+ l.add(getText(e2));
+ }
+ }
+ sharedLibraryClassPath.setPathList(l);
+ sharedLibrary.setSharedLibraryClassPath(sharedLibraryClassPath);
+ }
+ }
+ desc.setSharedLibrary(sharedLibrary);
+ } else if ("service-assembly".equals(child.getLocalName())) {
+ ServiceAssembly serviceAssembly = new ServiceAssembly();
+ ArrayList<ServiceUnit> sus = new ArrayList<ServiceUnit>();
+ for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
+ if ("identification".equals(e.getLocalName())) {
+ serviceAssembly.setIdentification(readIdentification(e));
+ } else if ("service-unit".equals(e.getLocalName())) {
+ ServiceUnit su = new ServiceUnit();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("identification".equals(e2.getLocalName())) {
+ su.setIdentification(readIdentification(e2));
+ } else if ("target".equals(e2.getLocalName())) {
+ Target target = new Target();
+ for (Element e3 = getFirstChildElement(e2); e3 != null; e3 = getNextSiblingElement(e3)) {
+ if ("artifacts-zip".equals(e3.getLocalName())) {
+ target.setArtifactsZip(getText(e3));
+ } else if ("component-name".equals(e3.getLocalName())) {
+ target.setComponentName(getText(e3));
+ }
+ }
+ su.setTarget(target);
+ }
+ }
+ sus.add(su);
+ } else if ("connections".equals(e.getLocalName())) {
+ Connections connections = new Connections();
+ ArrayList<Connection> cns = new ArrayList<Connection>();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("connection".equals(e2.getLocalName())) {
+ Connection cn = new Connection();
+ for (Element e3 = getFirstChildElement(e2); e3 != null; e3 = getNextSiblingElement(e3)) {
+ if ("consumer".equals(e3.getLocalName())) {
+ Consumer consumer = new Consumer();
+ consumer.setInterfaceName(readAttributeQName(e3, "interface-name"));
+ consumer.setServiceName(readAttributeQName(e3, "service-name"));
+ consumer.setEndpointName(getAttribute(e3, "endpoint-name"));
+ cn.setConsumer(consumer);
+ } else if ("provider".equals(e3.getLocalName())) {
+ Provider provider = new Provider();
+ provider.setServiceName(readAttributeQName(e3, "service-name"));
+ provider.setEndpointName(getAttribute(e3, "endpoint-name"));
+ cn.setProvider(provider);
+ }
+ }
+ cns.add(cn);
+ }
+ }
+ connections.setConnections(cns.toArray(new Connection[cns.size()]));
+ serviceAssembly.setConnections(connections);
+ }
+ }
+ serviceAssembly.setServiceUnits(sus.toArray(new ServiceUnit[sus.size()]));
+ desc.setServiceAssembly(serviceAssembly);
+ } else if ("services".equals(child.getLocalName())) {
+ Services services = new Services();
+ services.setBindingComponent(Boolean.valueOf(getAttribute(child, "binding-component")).booleanValue());
+ ArrayList<Provides> provides = new ArrayList<Provides>();
+ ArrayList<Consumes> consumes = new ArrayList<Consumes>();
+ for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
+ if ("provides".equals(e.getLocalName())) {
+ Provides p = new Provides();
+ p.setInterfaceName(readAttributeQName(e, "interface-name"));
+ p.setServiceName(readAttributeQName(e, "service-name"));
+ p.setEndpointName(getAttribute(e, "endpoint-name"));
+ provides.add(p);
+ } else if ("consumes".equals(e.getLocalName())) {
+ Consumes c = new Consumes();
+ c.setInterfaceName(readAttributeQName(e, "interface-name"));
+ c.setServiceName(readAttributeQName(e, "service-name"));
+ c.setEndpointName(getAttribute(e, "endpoint-name"));
+ c.setLinkType(getAttribute(e, "link-type"));
+ consumes.add(c);
+ }
+ }
+ services.setProvides(provides.toArray(new Provides[provides.size()]));
+ services.setConsumes(consumes.toArray(new Consumes[consumes.size()]));
+ desc.setServices(services);
+ }
+ checkDescriptor(desc);
+ return desc;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static String getAttribute(Element e, String name) {
+ if (e.hasAttribute(name)) {
+ return e.getAttribute(name);
+ } else {
+ return null;
+ }
+ }
+
+ private static QName readAttributeQName(Element e, String name) {
+ String attr = getAttribute(e, name);
+ if (attr != null) {
+ return createQName(e, attr);
+ } else {
+ return null;
+ }
+ }
+
+ private static String getText(Element e) {
+ return getElementText(e).trim();
+ }
+
+ private static Identification readIdentification(Element e) {
+ Identification ident = new Identification();
+ for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
+ if ("name".equals(e2.getLocalName())) {
+ ident.setName(getElementText(e2));
+ } else if ("description".equals(e2.getLocalName())) {
+ ident.setDescription(getElementText(e2));
+ }
+ }
+ return ident;
+ }
+
+ /**
+ * Check validity of the JBI descriptor
+ *
+ * @param descriptor
+ * the descriptor to check
+ * @throws Exception
+ * if the descriptor is not valid
+ */
+ public static void checkDescriptor(Descriptor descriptor) {
+ List<String> violations = new ArrayList<String>();
+
+ if (descriptor.getVersion() != 1.0) {
+ violations.add("JBI descriptor version should be set to '1.0' but is " + descriptor.getVersion());
+ }
+
+ if (descriptor.getComponent() != null) {
+ checkComponent(violations, descriptor.getComponent());
+ } else if (descriptor.getServiceAssembly() != null) {
+ checkServiceAssembly(violations, descriptor.getServiceAssembly());
+ } else if (descriptor.getServices() != null) {
+ checkServiceUnit(violations, descriptor.getServices());
+ } else if (descriptor.getSharedLibrary() != null) {
+ checkSharedLibrary(violations, descriptor.getSharedLibrary());
+ } else {
+ violations.add("The jbi descriptor does not contain any informations");
+ }
+
+ if (violations.size() > 0) {
+ throw new RuntimeException("The JBI descriptor is not valid, please correct these violations "
+ + violations.toString());
+ }
+ }
+
+ /**
+ * Checks that the component is valid
+ *
+ * @param violations
+ * A list of violations that the check can add to
+ *
+ * @param component
+ * The component descriptor that is being checked
+ */
+ private static void checkComponent(List<String> violations, Component component) {
+ if (component.getIdentification() == null) {
+ violations.add("The component has not identification");
+ } else {
+ if (isBlank(component.getIdentification().getName())) {
+ violations.add("The component name is not set");
+ }
+ }
+ if (component.getBootstrapClassName() == null) {
+ violations.add("The component has not defined a boot-strap class name");
+ }
+ if (component.getBootstrapClassPath() == null || component.getBootstrapClassPath().getPathElements() == null) {
+ violations.add("The component has not defined any boot-strap class path elements");
+ }
+ }
+
+ /**
+ * Checks that the service assembly is valid
+ *
+ * @param violations
+ * A list of violations that the check can add to
+ *
+ * @param serviceAssembly
+ * The service assembly descriptor that is being checked
+ */
+ private static void checkServiceAssembly(List<String> violations, ServiceAssembly serviceAssembly) {
+ if (serviceAssembly.getIdentification() == null) {
+ violations.add("The service assembly has not identification");
+ } else {
+ if (isBlank(serviceAssembly.getIdentification().getName())) {
+ violations.add("The service assembly name is not set");
+ }
+ }
+ }
+
+ /**
+ * Checks that the service unit is valid
+ *
+ * @param violations
+ * A list of violations that the check can add to
+ *
+ * @param services
+ * The service unit descriptor that is being checked
+ */
+ private static void checkServiceUnit(List<String> violations, Services services) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Checks that the shared library is valid
+ *
+ * @param violations
+ * A list of violations that the check can add to
+ *
+ * @param sharedLibrary
+ * The shared library descriptor that is being checked
+ */
+ private static void checkSharedLibrary(List<String> violations, SharedLibrary sharedLibrary) {
+ if (sharedLibrary.getIdentification() == null) {
+ violations.add("The shared library has not identification");
+ } else {
+ if (isBlank(sharedLibrary.getIdentification().getName())) {
+ violations.add("The shared library name is not set");
+ }
+ }
+ }
+
+ /**
+ * Retrieves the jbi descriptor as a string
+ *
+ * @param descriptorFile
+ * path to the jbi descriptor, or to the root directory
+ * @return the contents of the jbi descriptor
+ */
+ public static String getDescriptorAsText(File descriptorFile) {
+ if (descriptorFile.isDirectory()) {
+ descriptorFile = new File(descriptorFile, DESCRIPTOR_FILE);
+ }
+ if (descriptorFile.isFile()) {
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ InputStream is = new FileInputStream(descriptorFile);
+ copyInputStream(is, os);
+ return os.toString();
+ } catch (Exception e) {
+ //log.debug("Error reading jbi descritor: " + descriptorFile, e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <p>Checks if a String is whitespace, empty ("") or null.</p>
+ *
+ * <pre>
+ * StringUtils.isBlank(null) = true
+ * StringUtils.isBlank("") = true
+ * StringUtils.isBlank(" ") = true
+ * StringUtils.isBlank("bob") = false
+ * StringUtils.isBlank(" bob ") = false
+ * </pre>
+ *
+ * @param str the String to check, may be null
+ * @return <code>true</code> if the String is null, empty or whitespace
+ *
+ * Copied from org.apache.commons.lang.StringUtils#isBlanck
+ */
+ private static boolean isBlank(String str) {
+ int strLen;
+ if (str == null || (strLen = str.length()) == 0) {
+ return true;
+ }
+ for (int i = 0; i < strLen; i++) {
+ if ((Character.isWhitespace(str.charAt(i)) == false)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Copy in stream to an out stream
+ *
+ * @param in
+ * @param out
+ * @throws IOException
+ */
+ public static void copyInputStream(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[4096];
+ int len;
+ while ((len = in.read(buffer)) >= 0) {
+ out.write(buffer, 0, len);
+ }
+ in.close();
+ out.close();
+ }
+
+ /**
+ * Creates a QName instance from the given namespace context for the given qualifiedName
+ *
+ * @param element the element to use as the namespace context
+ * @param qualifiedName the fully qualified name
+ * @return the QName which matches the qualifiedName
+ */
+ public static QName createQName(Element element, String qualifiedName) {
+ int index = qualifiedName.indexOf(':');
+ if (index >= 0) {
+ String prefix = qualifiedName.substring(0, index);
+ String localName = qualifiedName.substring(index + 1);
+ String uri = recursiveGetAttributeValue(element, "xmlns:" + prefix);
+ return new QName(uri, localName, prefix);
+ }
+ else {
+ String uri = recursiveGetAttributeValue(element, "xmlns");
+ if (uri != null) {
+ return new QName(uri, qualifiedName);
+ }
+ return new QName(qualifiedName);
+ }
+ }
+
+ /**
+ * Recursive method to find a given attribute value
+ */
+ public static String recursiveGetAttributeValue(Element element, String attributeName) {
+ String answer = null;
+ try {
+ answer = element.getAttribute(attributeName);
+ }
+ catch (Exception e) {
+ //if (log.isTraceEnabled()) {
+ // log.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
+ //}
+ }
+ if (answer == null || answer.length() == 0) {
+ Node parentNode = element.getParentNode();
+ if (parentNode instanceof Element) {
+ return recursiveGetAttributeValue((Element) parentNode, attributeName);
+ }
+ }
+ return answer;
+ }
+
+ /**
+ * Returns the text of the element
+ */
+ public static String getElementText(Element element) {
+ StringBuffer buffer = new StringBuffer();
+ NodeList nodeList = element.getChildNodes();
+ for (int i = 0, size = nodeList.getLength(); i < size; i++) {
+ Node node = nodeList.item(i);
+ if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.CDATA_SECTION_NODE) {
+ buffer.append(node.getNodeValue());
+ }
+ }
+ return buffer.toString();
+ }
+
+ /**
+ * Get the first child element
+ * @param parent
+ * @return
+ */
+ public static Element getFirstChildElement(Node parent) {
+ NodeList childs = parent.getChildNodes();
+ for (int i = 0; i < childs.getLength(); i++) {
+ Node child = childs.item(i);
+ if (child instanceof Element) {
+ return (Element) child;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the next sibling element
+ * @param el
+ * @return
+ */
+ public static Element getNextSiblingElement(Element el) {
+ for (Node n = el.getNextSibling(); n != null; n = n.getNextSibling()) {
+ if (n instanceof Element) {
+ return (Element) n;
+ }
+ }
+ return null;
+ }
+
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Identification.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Identification.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Identification.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Identification.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Identification {
+ private String name;
+ private String description;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/InstallationDescriptorExtension.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/InstallationDescriptorExtension.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/InstallationDescriptorExtension.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/InstallationDescriptorExtension.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import org.w3c.dom.DocumentFragment;
+
+/**
+ * A POJO used to hold the descriptor extension.
+ *
+ * @version $Revision: 426415 $
+ */
+public class InstallationDescriptorExtension {
+ DocumentFragment descriptorExtension;
+
+ public DocumentFragment getDescriptorExtension() {
+ return descriptorExtension;
+ }
+
+ public void setDescriptorExtension(DocumentFragment descriptorExtension) {
+ this.descriptorExtension = descriptorExtension;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provider.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provider.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provider.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provider.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Provider {
+ private QName serviceName;
+ private String endpointName;
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public void setEndpointName(String endpointName) {
+ this.endpointName = endpointName;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provides.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provides.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provides.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Provides.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,52 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Provides {
+ private QName serviceName;
+ private String endpointName;
+ private QName interfaceName;
+
+ public QName getInterfaceName() {
+ return interfaceName;
+ }
+
+ public void setInterfaceName(QName interfaceName) {
+ this.interfaceName = interfaceName;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public void setEndpointName(String endpointName) {
+ this.endpointName = endpointName;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class ServiceAssembly {
+
+ private Connections connections = new Connections();
+
+ private Identification identification;
+
+ private ServiceUnit[] serviceUnits;
+
+ private String state = "";
+
+ public Connections getConnections() {
+ return connections;
+ }
+
+ public Identification getIdentification() {
+ return identification;
+ }
+
+ public ServiceUnit[] getServiceUnits() {
+ return serviceUnits;
+ }
+
+ /**
+ * @return Returns the state.
+ */
+ public String getState() {
+ return state;
+ }
+
+ public void setConnections(Connections connections) {
+ this.connections = connections;
+ }
+
+ public void setIdentification(Identification identification) {
+ this.identification = identification;
+ }
+
+ public void setServiceUnits(ServiceUnit[] serviceUnits) {
+ this.serviceUnits = serviceUnits;
+ }
+
+ /**
+ * @param state
+ * The state to set.
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class ServiceUnit {
+ private Identification identification;
+ private Target target;
+
+ public Identification getIdentification() {
+ return identification;
+ }
+
+ public void setIdentification(Identification identification) {
+ this.identification = identification;
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Services.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Services.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Services.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Services.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Services {
+ private boolean bindingComponent;
+ private Provides[] provides;
+ private Consumes[] consumes;
+
+ public boolean isBindingComponent() {
+ return bindingComponent;
+ }
+
+ public void setBindingComponent(boolean bindingComponent) {
+ this.bindingComponent = bindingComponent;
+ }
+
+ public Provides[] getProvides() {
+ return provides;
+ }
+
+ public void setProvides(Provides[] provides) {
+ this.provides = provides;
+ }
+
+ public Consumes[] getConsumes() {
+ return consumes;
+ }
+
+ public void setConsumes(Consumes[] consumes) {
+ this.consumes = consumes;
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class SharedLibrary {
+ private String classLoaderDelegation = "parent-first";
+ private String version;
+ private Identification identification;
+ private ClassPath sharedLibraryClassPath;
+
+ public SharedLibrary() {
+ }
+
+ public String getClassLoaderDelegation() {
+ return classLoaderDelegation;
+ }
+
+ public void setClassLoaderDelegation(String classLoaderDelegation) {
+ this.classLoaderDelegation = classLoaderDelegation;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public Identification getIdentification() {
+ return identification;
+ }
+
+ public void setIdentification(Identification identification) {
+ this.identification = identification;
+ }
+
+ public ClassPath getSharedLibraryClassPath() {
+ return sharedLibraryClassPath;
+ }
+
+ public void setSharedLibraryClassPath(ClassPath sharedLibraryClassPath) {
+ this.sharedLibraryClassPath = sharedLibraryClassPath;
+ }
+
+ public boolean isParentFirstClassLoaderDelegation() {
+ return classLoaderDelegation != null && classLoaderDelegation.equalsIgnoreCase("parent-first");
+ }
+
+ public boolean isSelfFirstClassLoaderDelegation() {
+ return classLoaderDelegation != null && classLoaderDelegation.equalsIgnoreCase("self-first");
+ }
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryList.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryList.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryList.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryList.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,80 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class SharedLibraryList {
+ private String version;
+ private String name;
+
+ public SharedLibraryList() {
+ }
+
+ public SharedLibraryList(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof SharedLibraryList)) {
+ return false;
+ }
+
+ final SharedLibraryList sharedLibraryList = (SharedLibraryList) o;
+
+ if (name != null ? !name.equals(sharedLibraryList.name) : sharedLibraryList.name != null) {
+ return false;
+ }
+ if (version != null ? !version.equals(sharedLibraryList.version) : sharedLibraryList.version != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = (version != null ? version.hashCode() : 0);
+ result = 29 * result + (name != null ? name.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return "SharedLibraryList[version=" + version + "; name=" + name + "]";
+ }
+
+}
Added: incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Target.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Target.java?rev=593202&view=auto
==============================================================================
--- incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Target.java (added)
+++ incubator/servicemix/branches/servicemix-4.0/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Target.java Thu Nov 8 07:32:49 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.jbi.deployer.descriptor;
+
+/**
+ * @version $Revision: 426415 $
+ */
+public class Target {
+ private String artifactsZip;
+ private String componentName;
+
+ public String getArtifactsZip() {
+ return artifactsZip;
+ }
+
+ public void setArtifactsZip(String artifactsZip) {
+ this.artifactsZip = artifactsZip;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+}