<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<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">
+<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.argeo.commons</groupId>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-argeo</id>
+ <id>prepare-source</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory>
- <includeGroupIds>org.argeo.commons</includeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+<!-- <plugin> -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-dependency-plugin</artifactId> -->
+<!-- <executions> -->
+<!-- <execution> -->
+<!-- <id>copy-argeo</id> -->
+<!-- <phase>package</phase> -->
+<!-- <goals> -->
+<!-- <goal>copy-dependencies</goal> -->
+<!-- </goals> -->
+<!-- <configuration> -->
+<!-- <includeTypes>jar</includeTypes> -->
+<!-- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory> -->
+<!-- <includeGroupIds>org.argeo.commons</includeGroupIds> -->
+<!-- <excludeTransitive>true</excludeTransitive> -->
+<!-- <includeTypes>jar</includeTypes> -->
+<!-- <includeScope>runtime</includeScope> -->
+<!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+<!-- </executions> -->
+<!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-argeo</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source</location>
<includes>
<include>**/*.jar</include>
</includes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory>
- <username>root</username>
- <groupname>root</groupname>
- <directoryIncluded>false</directoryIncluded>
- <artifact />
- </mapping>
+<!-- <mapping> -->
+<!-- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory> -->
+<!-- <username>root</username> -->
+<!-- <groupname>root</groupname> -->
+<!-- <directoryIncluded>false</directoryIncluded> -->
+<!-- <artifact /> -->
+<!-- </mapping> -->
</mappings>
<requires>
<require>argeo-cms-client-tp</require>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-tp</id>
+ <id>prepare-source-tp</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory>
- <excludeGroupIds>org.argeo.commons</excludeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source-tp</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+<!-- <plugin> -->
+<!-- <groupId>org.apache.maven.plugins</groupId> -->
+<!-- <artifactId>maven-dependency-plugin</artifactId> -->
+<!-- <executions> -->
+<!-- <execution> -->
+<!-- <id>copy-tp</id> -->
+<!-- <phase>package</phase> -->
+<!-- <goals> -->
+<!-- <goal>copy-dependencies</goal> -->
+<!-- </goals> -->
+<!-- <configuration> -->
+<!-- <includeTypes>jar</includeTypes> -->
+<!-- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory> -->
+<!-- <excludeGroupIds>org.argeo.commons</excludeGroupIds> -->
+<!-- <excludeTransitive>true</excludeTransitive> -->
+<!-- <includeTypes>jar</includeTypes> -->
+<!-- <includeScope>runtime</includeScope> -->
+<!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+<!-- </configuration> -->
+<!-- </execution> -->
+<!-- </executions> -->
+<!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-tp</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source-tp</location>
<includes>
<include>**/*.jar</include>
</includes>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<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">
+<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.argeo.commons</groupId>
<groupId>org.argeo.commons</groupId>
<artifactId>org.argeo.dep.cms.node</artifactId>
<version>2.1.74-SNAPSHOT</version>
+ <type>pom</type>
</dependency>
<dependency>
<groupId>org.argeo.commons</groupId>
</dependencies>
<dependencyManagement>
</dependencyManagement>
- <profiles>
+ <profiles>
<profile>
<id>rpmbuild</id>
<build>
<plugins>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-argeo</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory> -->
+ <!-- <includeGroupIds>org.argeo.commons</includeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <excludeArtifactIds>org.argeo.dep.cms.node</excludeArtifactIds> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-argeo</id>
+ <id>prepare-source</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory>
- <includeGroupIds>org.argeo.commons</includeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <excludeArtifactIds>org.argeo.dep.cms.node</excludeArtifactIds>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-argeo</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source</location>
<includes>
<include>**/*.jar</include>
</includes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory>
- <username>root</username>
- <groupname>root</groupname>
- <directoryIncluded>false</directoryIncluded>
- <artifact />
- </mapping>
+ <!-- <mapping> -->
+ <!-- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory> -->
+ <!-- <username>root</username> -->
+ <!-- <groupname>root</groupname> -->
+ <!-- <directoryIncluded>false</directoryIncluded> -->
+ <!-- <artifact /> -->
+ <!-- </mapping> -->
</mappings>
<requires>
<require>argeo-cms-node</require>
<id>rpmbuild-tp</id>
<build>
<plugins>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-tp</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory> -->
+ <!-- <excludeGroupIds>org.argeo.commons</excludeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-tp</id>
+ <id>prepare-source-tp</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory>
- <excludeGroupIds>org.argeo.commons</excludeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source-tp</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-tp</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source-tp</location>
<includes>
<include>**/*.jar</include>
</includes>
</build>
</profile>
</profiles>
-
+
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<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">
+<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.argeo.commons</groupId>
<groupId>org.argeo.commons</groupId>
<artifactId>org.argeo.dep.cms.client</artifactId>
<version>2.1.74-SNAPSHOT</version>
+ <type>pom</type>
</dependency>
<!-- Argeo Commons -->
</dependency>
<!-- HTTP Server -->
- <dependency>
- <groupId>org.argeo.tp.equinox</groupId>
- <artifactId>org.eclipse.equinox.http.registry</artifactId>
- </dependency>
<dependency>
<groupId>org.argeo.tp.equinox</groupId>
<artifactId>org.eclipse.equinox.http.servlet</artifactId>
</dependency>
<!-- Jetty -->
-<!-- <dependency> -->
-<!-- <groupId>org.argeo.tp.jetty</groupId> -->
-<!-- <artifactId>org.eclipse.jetty.client</artifactId> -->
-<!-- </dependency> -->
+ <!-- <dependency> -->
+ <!-- <groupId>org.argeo.tp.jetty</groupId> -->
+ <!-- <artifactId>org.eclipse.jetty.client</artifactId> -->
+ <!-- </dependency> -->
<dependency>
<groupId>org.argeo.tp.jetty</groupId>
<artifactId>org.eclipse.jetty.continuation</artifactId>
<groupId>org.argeo.tp.jetty</groupId>
<artifactId>org.eclipse.jetty.io</artifactId>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.argeo.tp.jetty</groupId> -->
-<!-- <artifactId>org.eclipse.jetty.jmx</artifactId> -->
-<!-- </dependency> -->
+ <!-- <dependency> -->
+ <!-- <groupId>org.argeo.tp.jetty</groupId> -->
+ <!-- <artifactId>org.eclipse.jetty.jmx</artifactId> -->
+ <!-- </dependency> -->
<dependency>
<groupId>org.argeo.tp.jetty</groupId>
<artifactId>org.eclipse.jetty.security</artifactId>
<groupId>org.argeo.tp.jetty</groupId>
<artifactId>org.eclipse.jetty.servlet</artifactId>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.argeo.tp.jetty</groupId> -->
-<!-- <artifactId>org.eclipse.jetty.servlets</artifactId> -->
-<!-- </dependency> -->
+ <!-- <dependency> -->
+ <!-- <groupId>org.argeo.tp.jetty</groupId> -->
+ <!-- <artifactId>org.eclipse.jetty.servlets</artifactId> -->
+ <!-- </dependency> -->
<dependency>
<groupId>org.argeo.tp.jetty</groupId>
<artifactId>org.eclipse.jetty.util</artifactId>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-argeo</id>
+ <id>prepare-source</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory>
- <includeGroupIds>org.argeo.commons</includeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <excludeArtifactIds>org.argeo.dep.cms.client</excludeArtifactIds>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-argeo</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory> -->
+ <!-- <includeGroupIds>org.argeo.commons</includeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <excludeArtifactIds>org.argeo.dep.cms.client</excludeArtifactIds> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-argeo</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source</location>
<includes>
<include>**/*.jar</include>
</includes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory>
- <username>root</username>
- <groupname>root</groupname>
- <directoryIncluded>false</directoryIncluded>
- <artifact />
- </mapping>
+ <!-- <mapping> -->
+ <!-- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory> -->
+ <!-- <username>root</username> -->
+ <!-- <groupname>root</groupname> -->
+ <!-- <directoryIncluded>false</directoryIncluded> -->
+ <!-- <artifact /> -->
+ <!-- </mapping> -->
</mappings>
<requires>
<require>argeo-cms-client</require>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-tp</id>
+ <id>prepare-source-tp</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory>
- <excludeGroupIds>org.argeo.commons</excludeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source-tp</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-tp</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory> -->
+ <!-- <excludeGroupIds>org.argeo.commons</excludeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-tp</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source-tp</location>
<includes>
<include>**/*.jar</include>
</includes>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<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">
+<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.argeo.commons</groupId>
<groupId>org.argeo.commons</groupId>
<artifactId>org.argeo.dep.cms.node</artifactId>
<version>2.1.74-SNAPSHOT</version>
+ <type>pom</type>
</dependency>
<!-- Argeo Commons -->
<artifactId>org.springframework.web.servlet</artifactId>
</dependency>
+ <!-- Equinox HTTP registry is required by Eclipse 3 but causes problem
+ with Eclipse 4 -->
+ <dependency>
+ <groupId>org.argeo.tp.equinox</groupId>
+ <artifactId>org.eclipse.equinox.http.registry</artifactId>
+ </dependency>
+
<!-- Eclipse Core -->
<dependency>
<groupId>org.argeo.tp.rap.platform</groupId>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-argeo</id>
+ <id>prepare-source</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory>
- <includeGroupIds>org.argeo.commons</includeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <excludeArtifactIds>org.argeo.dep.cms.node</excludeArtifactIds>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-argeo</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-argeo</outputDirectory> -->
+ <!-- <includeGroupIds>org.argeo.commons</includeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <excludeArtifactIds>org.argeo.dep.cms.node</excludeArtifactIds> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-argeo</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source</location>
<includes>
<include>**/*.jar</include>
</includes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory>
- <username>root</username>
- <groupname>root</groupname>
- <directoryIncluded>false</directoryIncluded>
- <artifact />
- </mapping>
+ <!-- <mapping> -->
+ <!-- <directory>/usr/share/osgi/org/argeo/commons/${project.artifactId}/${project.version}</directory> -->
+ <!-- <username>root</username> -->
+ <!-- <groupname>root</groupname> -->
+ <!-- <directoryIncluded>false</directoryIncluded> -->
+ <!-- <artifact /> -->
+ <!-- </mapping> -->
</mappings>
<requires>
<require>argeo-cms-node</require>
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-tp</id>
+ <id>prepare-source-tp</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory>
- <excludeGroupIds>org.argeo.commons</excludeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source-tp</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-tp</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory> -->
+ <!-- <excludeGroupIds>org.argeo.commons</excludeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-tp</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source-tp</location>
<includes>
<include>**/*.jar</include>
</includes>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<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">
+<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.argeo.commons</groupId>
<groupId>org.argeo.commons</groupId>
<artifactId>org.argeo.dep.cms.platform</artifactId>
<version>2.1.74-SNAPSHOT</version>
+ <type>pom</type>
</dependency>
<!-- ALM Third Parties -->
<build>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>copy-tp</id>
+ <id>prepare-source-tp</id>
<phase>package</phase>
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory>
- <excludeGroupIds>org.argeo.commons</excludeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <excludeArtifactIds>org.argeo.dep.cms.platform</excludeArtifactIds>
- <includeTypes>jar</includeTypes>
- <includeScope>runtime</includeScope>
- <useRepositoryLayout>true</useRepositoryLayout>
+ <descriptorRefs>
+ <descriptorRef>a2-source-tp</descriptorRef>
+ </descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
+ <!-- <plugin> -->
+ <!-- <groupId>org.apache.maven.plugins</groupId> -->
+ <!-- <artifactId>maven-dependency-plugin</artifactId> -->
+ <!-- <executions> -->
+ <!-- <execution> -->
+ <!-- <id>copy-tp</id> -->
+ <!-- <phase>package</phase> -->
+ <!-- <goals> -->
+ <!-- <goal>copy-dependencies</goal> -->
+ <!-- </goals> -->
+ <!-- <configuration> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <outputDirectory>${project.build.directory}/lib-tp</outputDirectory> -->
+ <!-- <excludeGroupIds>org.argeo.commons</excludeGroupIds> -->
+ <!-- <excludeTransitive>true</excludeTransitive> -->
+ <!-- <excludeArtifactIds>org.argeo.dep.cms.platform</excludeArtifactIds> -->
+ <!-- <includeTypes>jar</includeTypes> -->
+ <!-- <includeScope>runtime</includeScope> -->
+ <!-- <useRepositoryLayout>true</useRepositoryLayout> -->
+ <!-- </configuration> -->
+ <!-- </execution> -->
+ <!-- </executions> -->
+ <!-- </plugin> -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<directoryIncluded>false</directoryIncluded>
<sources>
<source>
- <location>${project.build.directory}/lib-tp</location>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}-a2-source-tp</location>
<includes>
<include>**/*.jar</include>
</includes>
<?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">
+<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.argeo.commons</groupId>
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>assembly-descriptors</artifactId>
+ <version>2.1.74-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <attach>false</attach>
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencies>
--- /dev/null
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>dist</id>
+ <baseDirectory>argeo-node</baseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>base</directory>
+ <outputDirectory></outputDirectory>
+ <fileMode>0644</fileMode>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>offline.bat</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <unpack>false</unpack>
+ <outputFileNameMapping>${artifact.groupId}/${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
+ <outputDirectory>share/osgi</outputDirectory>
+ </dependencySet>
+ <dependencySet>
+ <useStrictFiltering>true</useStrictFiltering>
+ <unpack>true</unpack>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.argeo.commons:osgi-boot:zip:*:*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+APP=argeo
+
+JVM=java
+
+BIN_DIR=`dirname "$0"`
+BASE_DIR=$BIN_DIR/..
+
+# Directories and files
+CONF_DIR=$BASE_DIR/etc/$APP
+CONF_DIRS=$CONF_DIR/conf.d
+#BASE_POLICY_ALL=/usr/share/$APP/all.policy
+BASE_CONFIG_INI=$BASE_DIR/share/$APP/config.ini
+
+#EXEC_DIR=$BASE_DIR/var/lib/$APP
+EXEC_DIR=.
+DATA_DIR=$EXEC_DIR/data
+CONF_RW=$EXEC_DIR/state
+CONFIG_INI=$CONF_RW/config.ini
+
+OSGI_INSTALL_AREA=$BASE_DIR/share/osgi/boot
+OSGI_FRAMEWORK=$OSGI_INSTALL_AREA/org.eclipse.osgi.jar
+
+# Overwrite variables
+if [ -f $CONF_DIR/settings.sh ];then
+ . $CONF_DIR/settings.sh
+fi
+
+RETVAL=0
+
+start() {
+ mkdir -p $CONF_RW
+ mkdir -p $DATA_DIR
+
+ # Merge config files
+ printf "## Equinox configuration - Generated by /usr/sbin/nodectl ##\n\n" > $CONFIG_INI
+ cat $BASE_CONFIG_INI >> $CONFIG_INI
+ printf "\n##\n## $CONF_DIR/$APP.ini\n##\n\n" >> $CONFIG_INI
+ cat $CONF_DIR/$APP.ini >> $CONFIG_INI
+ for file in `ls -v $CONF_DIRS/*.ini`; do
+ printf "\n##\n## $file\n##\n\n" >> $CONFIG_INI
+ cat $file >> $CONFIG_INI
+ done;
+
+ cd $EXEC_DIR
+ $JVM \
+ -Dlog4j.configuration="file:$CONF_DIR/log4j.properties" \
+ $JAVA_OPTS -jar $OSGI_FRAMEWORK \
+ -configuration "$CONF_RW" \
+ -data "$DATA_DIR"
+}
+
+reload() {
+ echo Not yet implemented
+}
+
+stop() {
+ if [ -f $PID_FILE ];then
+ PID=`cat $PID_FILE`
+ kill -0 $PID &> /dev/null
+ PID_EXISTS=$?
+ if [ $PID_EXISTS -ne 0 ]; then
+ echo Dead $APP process with pid $PID, removing $PID_FILE
+ rm -f $PID_FILE
+ RETVAL=1
+ return $RETVAL
+ fi
+ else
+ echo $APP is not running
+ RETVAL=1
+ return $RETVAL
+ fi
+
+ # notifies application by removing the shutdown file
+# rm -f $SHUTDOWN_FILE
+ kill $PID
+
+ # wait 10 min for application to shutdown, then kill it
+ TIMEOUT=$((10*60))
+ BEGIN=$(date +%s)
+ while kill -0 $PID &> /dev/null
+ do
+ sleep 1
+ NOW=$(date +%s)
+ DURATION=$(($NOW-$BEGIN))
+ if [ $DURATION -gt $TIMEOUT ]; then
+ kill -9 $PID
+ echo Forcibly killed $APP with pid $PID
+ RETVAL=1
+ fi
+ done
+
+ # remove pid file
+ rm -f $PID_FILE
+ return $RETVAL
+}
+
+status() {
+ if [ -f $PID_FILE ];then
+ PID=`cat $PID_FILE`
+ else
+ echo $APP is not running
+ return $RETVAL
+ fi
+ kill -0 $PID &> /dev/null
+ PID_EXISTS=$?
+ if [ $PID_EXISTS -eq 0 ]; then
+ echo $APP is running with pid $PID ...
+ else
+ echo No $APP process with pid $PID, removing $PID_FILE
+ rm -f $PID_FILE
+ fi
+ return $RETVAL
+}
+
+# main
+case "$1" in
+ start)
+ start
+ ;;
+ reload)
+ reload
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status}"
+ exit 1
+esac
\ No newline at end of file
--- /dev/null
+## HTTP server
+org.osgi.service.http.port=8080
+
+## System management
+osgi.console=2323
--- /dev/null
+log4j.rootLogger=WARN, console
+
+log4j.logger.org.argeo=DEBUG
+
+## Appenders
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p %m%n
+
+log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.file.File=/var/log/node/node.csv
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ISO8601};"%m";%c;%p%n
+log4j.appender.file.bufferedIO=true
+log4j.appender.file.immediateFlush=false
--- /dev/null
+grant {
+ permission java.security.AllPermission;
+};
\ No newline at end of file
--- /dev/null
+var System = Java.type("java.lang.System");
+var OsgiBuilder = Java.type("org.argeo.osgi.boot.OsgiBuilder");
+
+var osgi = new OsgiBuilder();
+// default bundles
+osgi.start(2, "org.eclipse.equinox.http.servlet");
+osgi.start(2, "org.eclipse.equinox.http.jetty");
+osgi.start(2, "org.eclipse.equinox.metatype");
+osgi.start(2, "org.eclipse.equinox.cm");
+osgi.start(2, "org.eclipse.rap.rwt.osgi");
+osgi.start(3, "org.argeo.cms");
+osgi.start(4, "org.eclipse.gemini.blueprint.extender");
+osgi.start(4, "org.eclipse.equinox.http.registry");
+// specific properties
+osgi.conf("org.eclipse.rap.workbenchAutostart", "false");
+osgi.conf("org.eclipse.equinox.http.jetty.autostart", "false");
+osgi.conf("org.osgi.framework.bootdelegation", "com.sun.jndi.ldap,"
+ + "com.sun.jndi.ldap.sasl," + "com.sun.security.jgss,"
+ + "com.sun.jndi.dns," + "com.sun.nio.file," + "com.sun.nio.sctp");
+
+var homeUri = java.nio.file.Paths
+ .get(java.lang.System.getProperty("user.home")).toUri().toString();
+if (typeof app !== 'undefined') {
+ if (typeof appHome == 'undefined') {
+ var appHome = homeUri + "/.a2/var/lib/" + app;
+ }
+ if (typeof appConf == 'undefined') {
+ var appConf = homeUri + "/.a2/etc/" + app;
+ }
+ if (typeof policyFile == 'undefined') {
+ var policyFile = "node.policy";
+ }
+ osgi.conf("osgi.configuration.area", appHome + "/state");
+ osgi.conf("osgi.instance.area", appHome + "/data");
+ System.setProperty("java.security.manager", "");
+ System.setProperty("java.security.policy", appConf + "/" + policyFile);
+ System.setProperty("log4j.configuration", appConf + "/log4j.properties");
+}
+
+function openWorkbench() {
+ osgi.spring("org.argeo.cms.ui.workbench.rap");
+ var appUrl = "http://127.0.0.1:" + osgi.httpPort + "/ui/node";
+ $EXEC("chrome --app=" + appUrl);
+ // shutdown when the window is closed
+ osgi.shutdown();
+}
\ No newline at end of file
--- /dev/null
+# Only Argeo OSGi Boot is explicitly started
+osgi.bundles=org.argeo.osgi.boot@start
+
+# Required standard bundles to start
+argeo.osgi.start.2.node=\
+org.eclipse.equinox.http.servlet,\
+org.eclipse.equinox.http.jetty,\
+org.eclipse.equinox.metatype,\
+org.eclipse.equinox.cm,\
+org.eclipse.rap.rwt.osgi
+
+# Required CMS bundles to start
+argeo.osgi.start.3.node=\
+org.argeo.cms
+
+# Extension managers
+argeo.osgi.start.4.node=\
+org.argeo.cms.e4.rap
+
+# Packages provided by the OpenJDK JVM
+org.osgi.framework.bootdelegation=com.sun.jndi.ldap,\
+com.sun.jndi.ldap.sasl,\
+com.sun.security.jgss,\
+com.sun.jndi.dns,\
+com.sun.nio.file,\
+com.sun.nio.sctp
+
+# Security manager
+#java.security.manager=
+#java.security.policy=file:/usr/share/node/all.policy
+
+# Required properties
+eclipse.ignoreApp=true
+osgi.noShutdown=true
+org.eclipse.equinox.http.jetty.autostart=false
+#org.eclipse.rap.workbenchAutostart=false
-<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">
+<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.argeo.commons</groupId>
<packaging>pom</packaging>
<name>Argeo Node</name>
<profiles>
+ <profile>
+ <id>dist</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>org.argeo.dep.cms.e4.rap</artifactId>
+ <version>2.1.74-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>osgi-boot</artifactId>
+ <type>zip</type>
+ <version>2.1.74-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>argeo-node-${project.version}</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>assembly/cms-e4-rap.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assembly-base</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>rpmbuild</id>
<build>
## Provisioning
-argeo.osgi.bundles=\
-/etc/node/modules;in=*/*,\
-/usr/local/share/osgi;in=**/*.jar,\
-/usr/share/osgi;in=**/*.jar;ex=boot/*.jar
+#osgi.clean=true
+#argeo.osgi.bundles=\
+#/etc/node/modules;in=*/*,\
+#/usr/local/share/osgi;in=**/*.jar,\
+#/usr/share/osgi;in=**/*.jar;ex=boot/*.jar
## HTTP server
org.osgi.service.http.port=8080
org.eclipse.equinox.http.jetty,\
org.eclipse.equinox.metatype,\
org.eclipse.equinox.cm,\
+org.eclipse.equinox.ds,\
org.eclipse.rap.rwt.osgi
# Required CMS bundles to start
# Extension managers
argeo.osgi.start.4.node=\
org.eclipse.gemini.blueprint.extender,\
-org.eclipse.equinox.http.registry
+org.argeo.cms.e4.rap
# Packages provided by the OpenJDK JVM
org.osgi.framework.bootdelegation=com.sun.jndi.ldap,\
--- /dev/null
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>dist</id>
+ <baseDirectory></baseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>base/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0755</fileMode>
+ <includes>
+ <include>*</include>
+ </includes>
+ <excludes>
+ <exclude>offline.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <unpack>false</unpack>
+ <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
+ <outputDirectory>share/osgi/boot</outputDirectory>
+ <includes>
+ <include>org.argeo.tp.equinox:org.eclipse.osgi</include>
+ <include>org.argeo.commons:org.argeo.osgi.boot</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+export A2_HOME=$HOME/.a2
+if [ -d "$A2_HOME/share/osgi/boot" ]; then
+ PREFIX=$A2_HOME
+else
+ PREFIX=/usr
+fi
+
+EQUINOX=$PREFIX/share/osgi/boot/org.eclipse.osgi.jar
+OSGI_BOOT=$PREFIX/share/osgi/boot/org.argeo.osgi.boot.jar
+
+/usr/bin/jjs -cp "$EQUINOX:$OSGI_BOOT" $*
</dependency>
</dependencies>
<profiles>
+ <profile>
+ <id>dist</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <finalName>osgi-boot-${project.version}</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>assembly/osgi-boot.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assembly-base</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>rpmbuild</id>
<build>
--- /dev/null
+/MANIFEST.MF
--- /dev/null
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>a2-source-tp</id>
+ <baseDirectory></baseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <unpack>false</unpack>
+ <outputFileNameMapping>${artifact.groupId}/${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
+ <outputDirectory></outputDirectory>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.argeo.tp.*:*</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
--- /dev/null
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>a2-source</id>
+ <baseDirectory></baseDirectory>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <unpack>false</unpack>
+ <outputFileNameMapping>${artifact.groupId}/${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
+ <outputDirectory></outputDirectory>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <scope>runtime</scope>
+ <excludes>
+ <exclude>org.argeo.tp.*:*</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+</assembly>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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.argeo.commons</groupId>
+ <version>2.1.74-SNAPSHOT</version>
+ <artifactId>maven</artifactId>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>assembly-descriptors</artifactId>
+ <name>Assembly Descriptors</name>
+</project>
\ No newline at end of file
--- /dev/null
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.argeo.commons</groupId>
+ <artifactId>argeo-commons</artifactId>
+ <version>2.1.74-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>maven</artifactId>
+ <name>Maven Helpers and Templates</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>assembly-descriptors</module>
+ </modules>
+</project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<project name="maven-antrun-" default="main" >
+<target name="main">
+ <copy todir="/srv/rpmfactory/argeo-osgi-2/el7" failonerror="false" quiet="true">
+ <fileset includes="*/RPMS/**/*.rpm" dir="/home/mbaudier/dev/git/apache2/argeo-commons/maven/target/rpm"/>
+ <flattenmapper/>
+ </copy>
+</target>
+</project>
\ No newline at end of file
import org.osgi.framework.BundleContext;
/**
- * An OSGi configurator. See <a
- * href="http://wiki.eclipse.org/Configurator">http:
+ * An OSGi configurator. See
+ * <a href="http://wiki.eclipse.org/Configurator">http:
* //wiki.eclipse.org/Configurator</a>
*/
public class Activator implements BundleActivator {
+ private Long checkpoint = null;
public void start(final BundleContext bundleContext) throws Exception {
// admin thread
// bootstrap
OsgiBoot osgiBoot = new OsgiBoot(bundleContext);
- osgiBoot.bootstrap();
+ if (checkpoint == null) {
+ osgiBoot.bootstrap();
+ checkpoint = System.currentTimeMillis();
+ } else {
+ osgiBoot.update();
+ checkpoint = System.currentTimeMillis();
+ }
}
public void stop(BundleContext context) throws Exception {
import java.util.StringTokenizer;
import java.util.TreeMap;
+import org.argeo.osgi.boot.a2.ProvisioningManager;
import org.argeo.osgi.boot.internal.springutil.AntPathMatcher;
import org.argeo.osgi.boot.internal.springutil.PathMatcher;
import org.argeo.osgi.boot.internal.springutil.SystemPropertyUtils;
*/
public class OsgiBoot implements OsgiBootConstants {
public final static String PROP_ARGEO_OSGI_START = "argeo.osgi.start";
+ public final static String PROP_ARGEO_OSGI_SOURCES = "argeo.osgi.sources";
+
public final static String PROP_ARGEO_OSGI_BUNDLES = "argeo.osgi.bundles";
public final static String PROP_ARGEO_OSGI_BASE_URL = "argeo.osgi.baseUrl";
public final static String PROP_ARGEO_OSGI_LOCAL_CACHE = "argeo.osgi.localCache";
private final BundleContext bundleContext;
private final String localCache;
+ private final ProvisioningManager provisioningManager;
+
/*
* INITIALIZATION
*/
this.bundleContext = bundleContext;
String homeUri = Paths.get(System.getProperty("user.home")).toUri().toString();
localCache = getProperty(PROP_ARGEO_OSGI_LOCAL_CACHE, homeUri + ".m2/repository/");
+
+ provisioningManager = new ProvisioningManager(bundleContext);
+ String sources = getProperty(PROP_ARGEO_OSGI_SOURCES);
+ if (sources == null) {
+ provisioningManager.registerDefaultSource();
+ } else {
+ for (String source : sources.split(",")) {
+ provisioningManager.registerSource(source);
+ }
+ }
}
/*
.info("OSGi bootstrap starting" + (osgiInstancePath != null ? " (" + osgiInstancePath + ")" : ""));
installUrls(getBundlesUrls());
installUrls(getDistributionUrls());
+ provisioningManager.install(null);
startBundles();
long duration = System.currentTimeMillis() - begin;
OsgiBootUtils.info("OSGi bootstrap completed in " + Math.round(((double) duration) / 1000) + "s ("
System.out.println();
}
+ public void update() {
+ provisioningManager.update();
+ }
/*
* INSTALLATION
*/
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.argeo.osgi.boot.OsgiBootUtils;
+import org.osgi.framework.Version;
+
+class A2Branch implements Comparable<A2Branch> {
+ private final A2Component component;
+ private final String id;
+
+ final SortedMap<Version, A2Module> modules = Collections.synchronizedSortedMap(new TreeMap<>());
+
+ A2Branch(A2Component component, String id) {
+ this.component = component;
+ this.id = id;
+ component.branches.put(id, this);
+ }
+
+ A2Module getOrAddModule(Version version, Object locator) {
+ if (modules.containsKey(version)) {
+ A2Module res = modules.get(version);
+ if (OsgiBootUtils.isDebug() && !res.getLocator().equals(locator)) {
+ OsgiBootUtils.debug("Inconsistent locator " + locator + " (registered: " + res.getLocator() + ")");
+ }
+ return res;
+ } else
+ return new A2Module(this, version, locator);
+ }
+
+ A2Module last() {
+ return modules.get(modules.lastKey());
+ }
+
+ A2Module first() {
+ return modules.get(modules.firstKey());
+ }
+
+ A2Component getComponent() {
+ return component;
+ }
+
+ String getId() {
+ return id;
+ }
+
+ @Override
+ public int compareTo(A2Branch o) {
+ return id.compareTo(id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof A2Branch) {
+ A2Branch o = (A2Branch) obj;
+ return component.equals(o.component) && id.equals(o.id);
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getCoordinates();
+ }
+
+ public String getCoordinates() {
+ return component + ":" + id;
+ }
+
+ static String versionToBranchId(Version version) {
+ return version.getMajor() + "." + version.getMinor();
+ }
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.osgi.framework.Version;
+
+class A2Component implements Comparable<A2Component> {
+ private final A2Contribution contribution;
+ private final String id;
+
+ final SortedMap<String, A2Branch> branches = Collections.synchronizedSortedMap(new TreeMap<>());
+
+ public A2Component(A2Contribution contribution, String id) {
+ this.contribution = contribution;
+ this.id = id;
+ contribution.components.put(id, this);
+ }
+
+ A2Branch getOrAddBranch(String branchId) {
+ if (branches.containsKey(branchId))
+ return branches.get(branchId);
+ else
+ return new A2Branch(this, branchId);
+ }
+
+ A2Module getOrAddModule(Version version, Object locator) {
+ A2Branch branch = getOrAddBranch(A2Branch.versionToBranchId(version));
+ A2Module module = branch.getOrAddModule(version, locator);
+ return module;
+ }
+
+ A2Branch last() {
+ return branches.get(branches.lastKey());
+ }
+
+ A2Contribution getContribution() {
+ return contribution;
+ }
+
+ String getId() {
+ return id;
+ }
+
+ @Override
+ public int compareTo(A2Component o) {
+ return id.compareTo(o.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof A2Component) {
+ A2Component o = (A2Component) obj;
+ return contribution.equals(o.contribution) && id.equals(o.id);
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return contribution.getId() + ":" + id;
+ }
+
+ void asTree(String prefix, StringBuffer buf) {
+ if (prefix == null)
+ prefix = "";
+ A2Branch lastBranch = last();
+ SortedMap<String, A2Branch> displayMap = new TreeMap<>(Collections.reverseOrder());
+ displayMap.putAll(branches);
+ for (String branchId : displayMap.keySet()) {
+ A2Branch branch = displayMap.get(branchId);
+ if (!lastBranch.equals(branch)) {
+ buf.append('\n');
+ buf.append(prefix);
+ } else {
+ buf.append(" -");
+ }
+ buf.append(prefix);
+ buf.append(branchId);
+ A2Module first = branch.first();
+ A2Module last = branch.last();
+ buf.append(" (").append(last.getVersion());
+ if (!first.equals(last))
+ buf.append(" ... ").append(first.getVersion());
+ buf.append(')');
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+class A2Contribution implements Comparable<A2Contribution> {
+ final static String BOOT = "boot";
+ final static String RUNTIME = "runtime";
+
+ private final ProvisioningSource source;
+ private final String id;
+
+ final Map<String, A2Component> components = Collections.synchronizedSortedMap(new TreeMap<>());
+
+ public A2Contribution(ProvisioningSource context, String id) {
+ this.source = context;
+ this.id = id;
+ if (context != null)
+ context.contributions.put(id, this);
+ }
+
+ A2Component getOrAddComponent(String componentId) {
+ if (components.containsKey(componentId))
+ return components.get(componentId);
+ else
+ return new A2Component(this, componentId);
+ }
+
+ public ProvisioningSource getSource() {
+ return source;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public int compareTo(A2Contribution o) {
+ return id.compareTo(o.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof A2Contribution) {
+ A2Contribution o = (A2Contribution) obj;
+ return id.equals(o.id);
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+ void asTree(String prefix, StringBuffer buf) {
+ if (prefix == null)
+ prefix = "";
+ for (String componentId : components.keySet()) {
+ buf.append(prefix);
+ buf.append(componentId);
+ A2Component component = components.get(componentId);
+ component.asTree(prefix, buf);
+ buf.append('\n');
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import org.osgi.framework.Version;
+
+class A2Module implements Comparable<A2Module> {
+ private final A2Branch branch;
+ private final Version version;
+ private final Object locator;
+
+ public A2Module(A2Branch branch, Version version, Object locator) {
+ this.branch = branch;
+ this.version = version;
+ this.locator = locator;
+ branch.modules.put(version, this);
+ }
+
+ A2Branch getBranch() {
+ return branch;
+ }
+
+ Version getVersion() {
+ return version;
+ }
+
+ Object getLocator() {
+ return locator;
+ }
+
+ @Override
+ public int compareTo(A2Module o) {
+ return version.compareTo(o.version);
+ }
+
+ @Override
+ public int hashCode() {
+ return version.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof A2Module) {
+ A2Module o = (A2Module) obj;
+ return branch.equals(o.branch) && version.equals(o.version);
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getCoordinates();
+ }
+
+ public String getCoordinates() {
+ return branch.getComponent() + ":" + version;
+ }
+
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.argeo.osgi.boot.OsgiBootUtils;
+import org.osgi.framework.Version;
+
+public class FsA2Source extends ProvisioningSource {
+ private final Path base;
+
+ public FsA2Source(Path base) {
+ super();
+ this.base = base;
+ }
+
+ void load() throws IOException {
+ DirectoryStream<Path> contributionPaths = Files.newDirectoryStream(base);
+ SortedSet<A2Contribution> contributions = new TreeSet<>();
+ contributions: for (Path contributionPath : contributionPaths) {
+ if (Files.isDirectory(contributionPath)) {
+ String contributionId = contributionPath.getFileName().toString();
+ if (A2Contribution.BOOT.equals(contributionId))// skip boot
+ continue contributions;
+ A2Contribution contribution = new A2Contribution(this, contributionId);
+ contributions.add(contribution);
+ }
+ }
+
+ for (A2Contribution contribution : contributions) {
+ DirectoryStream<Path> modulePaths = Files.newDirectoryStream(base.resolve(contribution.getId()));
+ modules: for (Path modulePath : modulePaths) {
+ if (!Files.isDirectory(modulePath)) {
+ // OsgiBootUtils.debug("Registering " + modulePath);
+ String moduleFileName = modulePath.getFileName().toString();
+ int lastDot = moduleFileName.lastIndexOf('.');
+ String ext = moduleFileName.substring(lastDot + 1);
+ if (!"jar".equals(ext))
+ continue modules;
+ String moduleName = moduleFileName.substring(0, lastDot);
+ int firstDash = moduleName.indexOf('-');
+ String versionStr = moduleName.substring(firstDash + 1);
+ String componentName = moduleName.substring(0, firstDash);
+ // if(versionStr.endsWith("-SNAPSHOT")) {
+ // versionStr = readVersionFromModule(modulePath);
+ // }
+ Version version;
+ try {
+ version = new Version(versionStr);
+ } catch (Exception e) {
+ versionStr = readVersionFromModule(modulePath);
+ version = new Version(versionStr);
+ // OsgiBootUtils.debug("Ignore " + modulePath + " (" + e.getMessage() + ")");
+ // continue modules;
+ }
+ A2Component component = contribution.getOrAddComponent(componentName);
+ A2Module module = component.getOrAddModule(version, modulePath);
+ if (OsgiBootUtils.isDebug())
+ OsgiBootUtils.debug("Registered " + module);
+ }
+ }
+ }
+
+ }
+
+ public static void main(String[] args) {
+ try {
+ FsA2Source context = new FsA2Source(Paths.get(
+ "/home/mbaudier/dev/git/apache2/argeo-commons/dist/argeo-node/target/argeo-node-2.1.74-SNAPSHOT/argeo-node/share/osgi"));
+ context.load();
+ context.asTree();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import org.argeo.osgi.boot.OsgiBootUtils;
+import org.osgi.framework.Version;
+
+public class FsM2Source extends ProvisioningSource {
+ private final Path base;
+
+ public FsM2Source(Path base) {
+ super();
+ this.base = base;
+ }
+
+ void load() throws IOException {
+ Files.walkFileTree(base, new ArtifactFileVisitor());
+ }
+
+ class ArtifactFileVisitor extends SimpleFileVisitor<Path> {
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ // OsgiBootUtils.debug("Processing " + file);
+ if (file.toString().endsWith(".jar")) {
+ Version version;
+ try {
+ version = new Version(readVersionFromModule(file));
+ } catch (Exception e) {
+ // ignore non OSGi
+ return FileVisitResult.CONTINUE;
+ }
+ String moduleName = readSymbolicNameFromModule(file);
+ Path groupPath = file.getParent().getParent().getParent();
+ Path relGroupPath = base.relativize(groupPath);
+ String contributionName = relGroupPath.toString().replace(File.separatorChar, '.');
+ A2Contribution contribution = getOrAddContribution(contributionName);
+ A2Component component = contribution.getOrAddComponent(moduleName);
+ A2Module module = component.getOrAddModule(version, file);
+ if (OsgiBootUtils.isDebug())
+ OsgiBootUtils.debug("Registered " + module);
+ }
+ return super.visitFile(file, attrs);
+ }
+
+ }
+
+ public static void main(String[] args) {
+ try {
+ FsM2Source context = new FsM2Source(Paths.get("/home/mbaudier/.m2/repository"));
+ context.load();
+ context.asTree();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import org.argeo.osgi.boot.OsgiBootUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.Version;
+
+class OsgiContext extends ProvisioningSource {
+ private final BundleContext bc;
+
+ public OsgiContext(BundleContext bc) {
+ super();
+ this.bc = bc;
+ }
+
+ public OsgiContext() {
+ Bundle bundle = FrameworkUtil.getBundle(OsgiContext.class);
+ if (bundle == null)
+ throw new IllegalArgumentException(
+ "OSGi Boot bundle must be started or a bundle context must be specified");
+ this.bc = bundle.getBundleContext();
+ }
+
+ void load() {
+ A2Contribution runtimeContribution = new A2Contribution(this, A2Contribution.RUNTIME);
+ for (Bundle bundle : bc.getBundles()) {
+ // OsgiBootUtils.debug(bundle.getDataFile("/"));
+ String componentId = bundle.getSymbolicName();
+ Version version = bundle.getVersion();
+ A2Component component = runtimeContribution.getOrAddComponent(componentId);
+ A2Module module = component.getOrAddModule(version, bundle);
+ if (OsgiBootUtils.isDebug())
+ OsgiBootUtils.debug("Registered " + module + " (location id: " + bundle.getLocation() + ")");
+ }
+
+ }
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.argeo.osgi.boot.OsgiBootException;
+import org.argeo.osgi.boot.OsgiBootUtils;
+import org.eclipse.osgi.launch.EquinoxFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+import org.osgi.framework.wiring.FrameworkWiring;
+
+public class ProvisioningManager {
+ BundleContext bc;
+ OsgiContext osgiContext;
+ List<ProvisioningSource> sources = Collections.synchronizedList(new ArrayList<>());
+
+ public ProvisioningManager(BundleContext bc) {
+ this.bc = bc;
+ osgiContext = new OsgiContext(bc);
+ osgiContext.load();
+ }
+
+ void addSource(ProvisioningSource context) {
+ sources.add(context);
+ }
+
+ void installWholeSource(ProvisioningSource context) {
+ Set<Bundle> updatedBundles = new HashSet<>();
+ for (A2Contribution contribution : context.contributions.values()) {
+ for (A2Component component : contribution.components.values()) {
+ A2Module module = component.last().last();
+ Bundle bundle = installOrUpdate(module);
+ if (bundle != null)
+ updatedBundles.add(bundle);
+ }
+ }
+ FrameworkWiring frameworkWiring = bc.getBundle(0).adapt(FrameworkWiring.class);
+ frameworkWiring.refreshBundles(updatedBundles);
+ }
+
+ public void registerSource(String uri) {
+ try {
+ URI u = new URI(uri);
+ if ("a2".equals(u.getScheme())) {
+ if (u.getHost() == null || "".equals(u.getHost())) {
+ Path base = Paths.get(u.getPath());
+ FsA2Source source = new FsA2Source(base);
+ source.load();
+ addSource(source);
+ }
+ }
+ } catch (Exception e) {
+ throw new OsgiBootException("Cannot add source " + uri, e);
+ }
+ }
+
+ public boolean registerDefaultSource() {
+ String frameworkLocation = bc.getProperty("osgi.framework");
+ try {
+ URI frameworkLocationUri = new URI(frameworkLocation);
+ if ("file".equals(frameworkLocationUri.getScheme())) {
+ Path frameworkPath = Paths.get(frameworkLocationUri);
+ if (frameworkPath.getParent().getFileName().toString().equals(A2Contribution.BOOT)) {
+ Path base = frameworkPath.getParent().getParent();
+ URI baseUri = new URI("a2", null, null, 0, base.toString(), null, null);
+ registerSource(baseUri.toString());
+ OsgiBootUtils.info("Registered " + baseUri + " as default source");
+ return true;
+ }
+ }
+ } catch (Exception e) {
+ OsgiBootUtils.error("Cannot register default source based on framework location " + frameworkLocation, e);
+ }
+ return false;
+ }
+
+ public void install(String spec) {
+ if (spec == null) {
+ for (ProvisioningSource source : sources) {
+ installWholeSource(source);
+ }
+ }
+ }
+
+ /** @return the new/updated bundle, or null if nothign was done. */
+ Bundle installOrUpdate(A2Module module) {
+ try {
+ ProvisioningSource moduleSource = module.getBranch().getComponent().getContribution().getSource();
+ Version moduleVersion = module.getVersion();
+ A2Branch osgiBranch = osgiContext.findBranch(module.getBranch().getComponent().getId(), moduleVersion);
+ if (osgiBranch == null) {
+ Bundle bundle = bc.installBundle(module.getBranch().getCoordinates(),
+ moduleSource.newInputStream(module.getLocator()));
+ if (OsgiBootUtils.isDebug())
+ OsgiBootUtils.debug("Installed bundle " + bundle.getLocation() + " with version " + moduleVersion);
+ return bundle;
+ } else {
+ A2Module lastOsgiModule = osgiBranch.last();
+ int compare = moduleVersion.compareTo(lastOsgiModule.getVersion());
+ if (compare > 0) {// update
+ Bundle bundle = (Bundle) lastOsgiModule.getLocator();
+ bundle.update(moduleSource.newInputStream(module.getLocator()));
+ OsgiBootUtils.info("Updated bundle " + bundle.getLocation() + " to version " + moduleVersion);
+ return bundle;
+ }
+ }
+ } catch (Exception e) {
+ OsgiBootUtils.error("Could not install module " + module, e);
+ }
+ return null;
+ }
+
+ public Collection<Bundle> update() {
+ boolean fragmentsUpdated = false;
+ Set<Bundle> updatedBundles = new HashSet<>();
+ bundles: for (Bundle bundle : bc.getBundles()) {
+ for (ProvisioningSource source : sources) {
+ String componentId = bundle.getSymbolicName();
+ Version version = bundle.getVersion();
+ A2Branch branch = source.findBranch(componentId, version);
+ if (branch == null)
+ continue bundles;
+ A2Module module = branch.last();
+ Version moduleVersion = module.getVersion();
+ int compare = moduleVersion.compareTo(version);
+ if (compare > 0) {// update
+ try (InputStream in = source.newInputStream(module.getLocator())) {
+ bundle.update(in);
+ String fragmentHost = bundle.getHeaders().get(Constants.FRAGMENT_HOST);
+ if (fragmentHost != null)
+ fragmentsUpdated = true;
+ OsgiBootUtils.info("Updated bundle " + bundle.getLocation() + " to version " + moduleVersion);
+ updatedBundles.add(bundle);
+ } catch (Exception e) {
+ OsgiBootUtils.error("Cannot update with module " + module, e);
+ }
+ }
+ }
+ }
+ FrameworkWiring frameworkWiring = bc.getBundle(0).adapt(FrameworkWiring.class);
+ if (fragmentsUpdated)// refresh all
+ frameworkWiring.refreshBundles(null);
+ else
+ frameworkWiring.refreshBundles(updatedBundles);
+ return updatedBundles;
+ }
+
+ private static Framework launch() {
+ // start OSGi
+ FrameworkFactory frameworkFactory = new EquinoxFactory();
+ Map<String, String> configuration = new HashMap<>();
+ configuration.put("osgi.console", "2323");
+ Framework framework = frameworkFactory.newFramework(configuration);
+ try {
+ framework.start();
+ } catch (BundleException e) {
+ throw new OsgiBootException("Cannot start OSGi framework", e);
+ }
+ return framework;
+ }
+
+ public static void main(String[] args) {
+ Framework framework = launch();
+ try {
+ ProvisioningManager pm = new ProvisioningManager(framework.getBundleContext());
+ FsA2Source context = new FsA2Source(Paths.get(
+ "/home/mbaudier/dev/git/apache2/argeo-commons/dist/argeo-node/target/argeo-node-2.1.74-SNAPSHOT/argeo-node/share/osgi"));
+ context.load();
+ if (framework.getBundleContext().getBundles().length == 1) {// initial
+ pm.install(null);
+ } else {
+ pm.update();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ // framework.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
--- /dev/null
+package org.argeo.osgi.boot.a2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+import org.argeo.osgi.boot.OsgiBootException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+abstract class ProvisioningSource {
+ final Map<String, A2Contribution> contributions = Collections.synchronizedSortedMap(new TreeMap<>());
+
+ A2Contribution getOrAddContribution(String contributionId) {
+ if (contributions.containsKey(contributionId))
+ return contributions.get(contributionId);
+ else
+ return new A2Contribution(this, contributionId);
+ }
+
+ void asTree(String prefix, StringBuffer buf) {
+ if (prefix == null)
+ prefix = "";
+ for (String contributionId : contributions.keySet()) {
+ buf.append(prefix);
+ buf.append(contributionId);
+ buf.append('\n');
+ A2Contribution contribution = contributions.get(contributionId);
+ contribution.asTree(prefix + " ", buf);
+ }
+ }
+
+ void asTree() {
+ StringBuffer buf = new StringBuffer();
+ asTree("", buf);
+ System.out.println(buf);
+ }
+
+ A2Component findComponent(String componentId) {
+ SortedMap<A2Contribution, A2Component> res = new TreeMap<>();
+ for (A2Contribution contribution : contributions.values()) {
+ components: for (String componentIdKey : contribution.components.keySet()) {
+ if (componentId.equals(componentIdKey)) {
+ res.put(contribution, contribution.components.get(componentIdKey));
+ break components;
+ }
+ }
+ }
+ if (res.size() == 0)
+ return null;
+ // TODO explicit contribution priorities
+ return res.get(res.lastKey());
+
+ }
+
+ A2Branch findBranch(String componentId, Version version) {
+ A2Component component = findComponent(componentId);
+ if (component == null)
+ return null;
+ String branchId = version.getMajor() + "." + version.getMinor();
+ if (!component.branches.containsKey(branchId))
+ return null;
+ return component.branches.get(branchId);
+ }
+
+ protected String readVersionFromModule(Path modulePath) {
+ try (JarInputStream in = new JarInputStream(newInputStream(modulePath))) {
+ Manifest manifest = in.getManifest();
+ String versionStr = manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
+ return versionStr;
+ } catch (IOException e) {
+ throw new OsgiBootException("Cannot read manifest from " + modulePath, e);
+ }
+ }
+
+ protected String readSymbolicNameFromModule(Path modulePath) {
+ try (JarInputStream in = new JarInputStream(newInputStream(modulePath))) {
+ Manifest manifest = in.getManifest();
+ String symbolicName = manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
+ int semiColIndex = symbolicName.indexOf(';');
+ if (semiColIndex >= 0)
+ symbolicName = symbolicName.substring(0, semiColIndex);
+ return symbolicName;
+ } catch (IOException e) {
+ throw new OsgiBootException("Cannot read manifest from " + modulePath, e);
+ }
+ }
+
+ InputStream newInputStream(Object locator) throws IOException {
+ if (locator instanceof Path) {
+ return Files.newInputStream((Path) locator);
+ } else if (locator instanceof URL) {
+ return ((URL) locator).openStream();
+ } else {
+ throw new IllegalArgumentException("Unsupported module locator type " + locator.getClass());
+ }
+ }
+}
<?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">
+<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>
<groupId>org.argeo.commons</groupId>
<artifactId>argeo-commons</artifactId>
<module>org.argeo.ext.jackrabbit</module>
<module>org.argeo.ext.rap.ui.workbench</module>
<!-- Distribution -->
+ <module>maven</module>
<module>dep</module>
<module>demo</module>
<module>doc</module>
<!-- <copyTo>${argeo.rpm.stagingRepository}</copyTo> -->
<defaultDirMode>755</defaultDirMode>
<defaultFileMode>644</defaultFileMode>
+ <autoRequires>false</autoRequires>
</configuration>
</plugin>
<plugin>
</goals>
<configuration>
<target>
- <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
- <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+ <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+ failonerror="false">
+ <fileset dir="${project.build.directory}/rpm"
+ includes="*/RPMS/**/*.rpm" />
<flattenmapper />
</copy>
</target>
</goals>
<configuration>
<target>
- <copy todir="${argeo.rpm.stagingRepository}" quiet="true" failonerror="false">
- <fileset dir="${project.build.directory}/rpm" includes="*/RPMS/**/*.rpm" />
+ <copy todir="${argeo.rpm.stagingRepository}" quiet="true"
+ failonerror="false">
+ <fileset dir="${project.build.directory}/rpm"
+ includes="*/RPMS/**/*.rpm" />
<flattenmapper />
</copy>
</target>