You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2020/03/30 18:52:11 UTC
[sling-org-apache-sling-installer-factory-subsystems] branch master
updated: deprecate module
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-subsystems.git
The following commit(s) were added to refs/heads/master by this push:
new 189d84f deprecate module
189d84f is described below
commit 189d84f794c430450b5053255ddd7a70ff83d84d
Author: Konrad Windszus <ko...@netcentric.biz>
AuthorDate: Mon Mar 30 20:51:46 2020 +0200
deprecate module
(according to
https://lists.apache.org/thread.html/r29afb8efbdffd304f5ee7a4071f25085ffe4b1da025eb47be3ec3fc3%40%3Cdev.sling.apache.org%3E)
---
.asf.yaml | 7 +
CODE_OF_CONDUCT.md | 22 --
CONTRIBUTING.md | 24 --
Jenkinsfile | 20 --
LICENSE | 202 -------------
README.md | 6 +-
pom.xml | 86 ------
.../factories/subsystems/impl/Activator.java | 100 -------
.../subsystems/impl/InstallSubsystemTask.java | 64 ----
.../subsystems/impl/StartSubsystemTask.java | 57 ----
.../subsystems/impl/SubsystemInstaller.java | 331 ---------------------
.../subsystems/impl/UninstallSubsystemTask.java | 77 -----
.../subsystems/impl/UpdateSubsystemTask.java | 81 -----
13 files changed, 10 insertions(+), 1067 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
new file mode 100644
index 0000000..27d9d52
--- /dev/null
+++ b/.asf.yaml
@@ -0,0 +1,7 @@
+github:
+ description: "Apache Sling Subsystems Installer (deprecated)"
+ homepage: "https://sling.apache.org/"
+ labels:
+ - java
+ - sling
+ - deprecated
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 0fa18e5..0000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Apache Software Foundation Code of Conduct
-====
-
-Being an Apache project, Apache Sling adheres to the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index ac82a1a..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Contributing
-====
-
-Thanks for choosing to contribute!
-
-You will find all the necessary details about how you can do this at https://sling.apache.org/contributing.html.
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index f582519..0000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-slingOsgiBundleBuild()
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
diff --git a/README.md b/README.md
index 055ee97..5218c42 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[<img src="https://sling.apache.org/res/logos/sling.png"/>](https://sling.apache.org)
- [![Build Status](https://builds.apache.org/buildStatus/icon?job=Sling/sling-org-apache-sling-installer-factory-subsystems/master)](https://builds.apache.org/job/Sling/job/sling-org-apache-sling-installer-factory-subsystems/job/master) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.sling/org.apache.sling.installer.factory.subsystems/badge.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.sling%22%20a%3A%22org.apache.sling.installer.factory [...]
+# Apache Sling Subsystems Installer (deprecated)
-# Apache Sling Subsystems Installer
+This module is no longer maintained.
-This module is part of the [Apache Sling](https://sling.apache.org) project.
+For reference or potential bugfix releases use branch [maintenance](https://github.com/apache/sling-org-apache-sling-installer-factory-subsystems/tree/maintenance).
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 33a14ed..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.sling</groupId>
- <artifactId>sling</artifactId>
- <version>26</version>
- <relativePath/>
- </parent>
-
- <artifactId>org.apache.sling.installer.factory.subsystems</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>Apache Sling Subsystems Installer</name>
- <description>
- Provides support for subsystems to the Apache Sling OSGi installer
- </description>
-
- <scm>
- <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-subsystems.git</connection>
- <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-subsystems.git</developerConnection>
- <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-installer-factory-subsystems.git</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Activator>
- org.apache.sling.installer.factories.subsystems.impl.Activator
- </Bundle-Activator>
- <Private-Package>
- org.apache.sling.installer.factories.subsystems.impl.*
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>5.0.0</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.installer.api</artifactId>
- <version>1.0.0</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/Activator.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/Activator.java
deleted file mode 100644
index 8429b8d..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/Activator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.sling.installer.api.tasks.InstallTaskFactory;
-import org.apache.sling.installer.api.tasks.ResourceTransformer;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.subsystem.Subsystem;
-import org.osgi.service.subsystem.SubsystemConstants;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class Activator implements BundleActivator {
-
- /** The service tracker for the root subsystem */
- private ServiceTracker<Subsystem, Subsystem> rootSubsystemTracker;
-
- /** The service registration for the installer service. */
- private ServiceRegistration<?> serviceReg;
-
- /**
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(final BundleContext context) throws Exception {
- this.rootSubsystemTracker = new ServiceTracker<Subsystem, Subsystem>(context,
- context.createFilter("(&(" + Constants.OBJECTCLASS + "=" + Subsystem.class.getName() + ")" +
- "(" + SubsystemConstants.SUBSYSTEM_ID_PROPERTY + "=0))"),
-
- new ServiceTrackerCustomizer<Subsystem, Subsystem>() {
-
- public Subsystem addingService(final ServiceReference<Subsystem> reference) {
- final Subsystem service = context.getService(reference);
- if ( service != null ) {
- registerInstaller(context, service);
- }
- return service;
- }
-
- public void modifiedService(final ServiceReference<Subsystem> reference, final Subsystem service) {
- // nothing to do
- }
-
- public void removedService(final ServiceReference<Subsystem> reference, final Subsystem service) {
- unregisterInstaller();
- }
-
- });
- this.rootSubsystemTracker.open();
- }
-
- /**
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(final BundleContext context) throws Exception {
- if ( this.rootSubsystemTracker != null ) {
- this.rootSubsystemTracker.close();
- this.rootSubsystemTracker = null;
- }
- this.unregisterInstaller();
- }
-
- private void registerInstaller(final BundleContext context, final Subsystem rootSubsystem) {
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Installer Support for Subsystems");
- props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
- this.serviceReg = context.registerService(
- new String[] {ResourceTransformer.class.getName(), InstallTaskFactory.class.getName()},
- new SubsystemInstaller(rootSubsystem, context), props);
- }
-
- private void unregisterInstaller() {
- if ( serviceReg != null ) {
- serviceReg.unregister();
- serviceReg = null;
- }
- }
-}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java
deleted file mode 100644
index 0b1086f..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import java.io.IOException;
-
-import org.apache.sling.installer.api.tasks.ChangeStateTask;
-import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.ResourceState;
-import org.apache.sling.installer.api.tasks.TaskResource;
-import org.apache.sling.installer.api.tasks.TaskResourceGroup;
-import org.osgi.service.subsystem.Subsystem;
-
-/**
- * This is the subsystem install task.
- */
-public class InstallSubsystemTask extends InstallTask {
-
- private static final String INSTALL_ORDER = "53-";
-
- private final Subsystem rootSubsystem;
-
- public InstallSubsystemTask(final TaskResourceGroup grp, final Subsystem rootSubsystem) {
- super(grp);
- this.rootSubsystem = rootSubsystem;
- }
-
- @Override
- public void execute(final InstallationContext ctx) {
- final TaskResource tr = this.getResource();
- ctx.log("Installing new subsystem from {}", tr);
-
- try {
- final Subsystem sub = this.rootSubsystem.install(tr.getURL(), tr.getInputStream());
- ctx.addTaskToCurrentCycle(new StartSubsystemTask(this.getResourceGroup(), sub));
- ctx.log("Installed new subsystem {}", sub);
- } catch (final IOException e) {
- ctx.log("Unable to install subsystem {} : {}", tr, e);
- ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.IGNORED));
- }
- }
-
- @Override
- public String getSortKey() {
- return INSTALL_ORDER + getResource().getURL();
- }
-}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/StartSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/StartSubsystemTask.java
deleted file mode 100644
index a5eb224..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/StartSubsystemTask.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import org.apache.sling.installer.api.tasks.ChangeStateTask;
-import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.ResourceState;
-import org.apache.sling.installer.api.tasks.TaskResource;
-import org.apache.sling.installer.api.tasks.TaskResourceGroup;
-import org.osgi.service.subsystem.Subsystem;
-
-/**
- * This is the subsystem start task.
- */
-public class StartSubsystemTask extends InstallTask {
-
- private static final String INSTALL_ORDER = "55-";
-
- private final Subsystem subsystem;
-
- public StartSubsystemTask(final TaskResourceGroup grp, final Subsystem system) {
- super(grp);
- this.subsystem = system;
- }
-
- @Override
- public void execute(final InstallationContext ctx) {
- final TaskResource tr = this.getResource();
- ctx.log("Starting subsystem from {}", tr);
-
- this.subsystem.start();
- ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.INSTALLED));
- ctx.log("Started subsystem {}", this.subsystem);
- }
-
- @Override
- public String getSortKey() {
- return INSTALL_ORDER + getResource().getURL();
- }
-}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
deleted file mode 100644
index c58d7a3..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.sling.installer.api.InstallableResource;
-import org.apache.sling.installer.api.tasks.ChangeStateTask;
-import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.InstallTaskFactory;
-import org.apache.sling.installer.api.tasks.RegisteredResource;
-import org.apache.sling.installer.api.tasks.ResourceState;
-import org.apache.sling.installer.api.tasks.ResourceTransformer;
-import org.apache.sling.installer.api.tasks.TaskResource;
-import org.apache.sling.installer.api.tasks.TaskResourceGroup;
-import org.apache.sling.installer.api.tasks.TransformationResult;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.service.subsystem.Subsystem;
-import org.osgi.service.subsystem.Subsystem.State;
-import org.osgi.service.subsystem.SubsystemConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is an extension for the OSGi installer
- * It listens for files ending with ".esa" and a proper subsystem manifest.
- * Though subsystems does not require a complete manifest, the installer supports
- * only subsystems with the basic info (name and version).
- *
- * As subsystems currently do not support an update, an uninstall/install is done
- * instead - which will lose bundle private data, bound configurations etc.
- */
-public class SubsystemInstaller
- implements ResourceTransformer, InstallTaskFactory {
-
- private static final String TYPE_SUBSYSTEM = "esa";
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private final Subsystem rootSubsystem;
-
- private final BundleContext bundleContext;
-
- public SubsystemInstaller(final Subsystem root, final BundleContext bundleContext) {
- this.rootSubsystem = root;
- this.bundleContext = bundleContext;
- }
-
- /**
- * @see org.apache.sling.installer.api.tasks.ResourceTransformer#transform(org.apache.sling.installer.api.tasks.RegisteredResource)
- */
- public TransformationResult[] transform(final RegisteredResource resource) {
- if ( resource.getType().equals(InstallableResource.TYPE_FILE) ) {
- if ( resource.getURL().endsWith("." + TYPE_SUBSYSTEM) ) {
- logger.info("Found potential subsystem resource {}", resource);
- final SubsystemInfo headers = readSubsystemHeaders(resource);
- if ( headers != null ) {
- // check the version for validity
- boolean validVersion = true;
- try {
- new Version(headers.version);
- } catch (final IllegalArgumentException iae) {
- logger.info("Rejecting subsystem {} from {} due to invalid version information: {}.",
- new Object[] {headers.symbolicName, resource, headers.version});
- validVersion = false;
- }
- if ( validVersion ) {
- final Map<String, Object> attr = new HashMap<String, Object>();
- attr.put(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME, headers.symbolicName);
- attr.put(SubsystemConstants.SUBSYSTEM_VERSION, headers.version);
-
- final TransformationResult tr = new TransformationResult();
- tr.setId(headers.symbolicName);
- tr.setResourceType(TYPE_SUBSYSTEM);
- tr.setAttributes(attr);
- tr.setVersion(new Version(headers.version));
-
- return new TransformationResult[] {tr};
- }
-
- } else {
- logger.info("Subsystem resource does not have required headers.");
- }
- }
- }
- return null;
- }
-
- /**
- * Check that the required attributes are available.
- * This is just a sanity check
- */
- private SubsystemInfo checkResource(final TaskResourceGroup toActivate) {
- final TaskResource rsrc = toActivate.getActiveResource();
-
- SubsystemInfo result = null;
- final String symbolicName = (String) rsrc.getAttribute(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME);
- if ( symbolicName == null ) {
- logger.error("Subsystem resource is missing symbolic name {}", rsrc);
- } else {
- final String version = (String)rsrc.getAttribute(SubsystemConstants.SUBSYSTEM_VERSION);
- if ( version == null ) {
- logger.error("Subsystem resource is missing version {}", rsrc);
- } else {
- // check the version for validity
- boolean validVersion = true;
- try {
- new Version(version);
- } catch (final IllegalArgumentException iae) {
- logger.info("Rejecting subsystem {} from {} due to invalid version information: {}.",
- new Object[] {symbolicName, rsrc, version});
- validVersion = false;
- }
- if ( validVersion ) {
- result = new SubsystemInfo();
- result.symbolicName = symbolicName;
- result.version = version;
- }
- }
- }
- return result;
- }
-
- private ServiceReference<Subsystem> getSubsystemReference(final String symbolicName) {
- // search a subsystem with the symbolic name
- ServiceReference<Subsystem> ref = null;
- try {
- final Collection<ServiceReference<Subsystem>> refs = this.bundleContext.getServiceReferences(Subsystem.class, "(subsystem.symbolicName=" + symbolicName + ")");
- if ( refs.size() > 0 ) {
- ref = refs.iterator().next();
- }
- } catch (final InvalidSyntaxException e) {
- logger.error("Problem searching for subsystem with symbolic name " + symbolicName, e);
- }
- return ref;
- }
-
- /**
- * @see org.apache.sling.installer.api.tasks.InstallTaskFactory#createTask(org.apache.sling.installer.api.tasks.TaskResourceGroup)
- */
- public InstallTask createTask(final TaskResourceGroup toActivate) {
- final InstallTask result;
-
- final TaskResource rsrc = toActivate.getActiveResource();
- if ( rsrc.getType().equals(TYPE_SUBSYSTEM) ) {
-
- // check if the required info is available
- final SubsystemInfo info = checkResource(toActivate);
- if ( info == null ) {
- // ignore as info is missing
- result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
- } else {
- // search a subsystem with the symbolic name
- final ServiceReference<Subsystem> ref = this.getSubsystemReference(info.symbolicName);
-
- final Subsystem currentSubsystem = (ref != null ? this.bundleContext.getService(ref) : null);
- try {
- final Version newVersion = new Version(info.version);
- final Version oldVersion = (ref == null ? null : (Version)ref.getProperty("subsystem.version"));
-
- // Install
- if ( rsrc.getState() == ResourceState.INSTALL ) {
- if ( oldVersion != null ) {
-
- final int compare = oldVersion.compareTo(newVersion);
- if (compare < 0) {
- // installed version is lower -> update
- result = new UpdateSubsystemTask(toActivate, this.bundleContext, ref, this.rootSubsystem);
- } else if ( compare == 0 && isSnapshot(newVersion) ) {
- // same version but snapshot -> update
- result = new UpdateSubsystemTask(toActivate, this.bundleContext, ref, this.rootSubsystem);
- } else if ( compare == 0 && currentSubsystem != null && currentSubsystem.getState() != State.ACTIVE ) {
- // try to start the version
- result = new StartSubsystemTask(toActivate, currentSubsystem);
- } else {
- logger.info("{} is not installed, subsystem with same or higher version is already installed: {}", info, newVersion);
- result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
- }
- } else {
- result = new InstallSubsystemTask(toActivate, this.rootSubsystem);
- }
-
- // Uninstall
- } else if ( rsrc.getState() == ResourceState.UNINSTALL ) {
- if ( oldVersion == null ) {
- logger.error("Nothing to uninstall. {} is currently not installed.", info);
- result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
- } else {
-
- final int compare = oldVersion.compareTo(newVersion);
- if ( compare == 0 ) {
- result = new UninstallSubsystemTask(toActivate, this.bundleContext, ref);
- } else {
- logger.error("Nothing to uninstall. {} is currently not installed, different version is installed {}", info, oldVersion);
- result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
- }
- }
- } else {
- result = null;
- }
- } finally {
- if ( currentSubsystem != null ) {
- this.bundleContext.ungetService(ref);
- }
- }
- }
- } else {
- result = null;
- }
- return result;
- }
-
- /**
- * Read the manifest from supplied input stream, which is closed before return.
- */
- private static Manifest getManifest(final RegisteredResource rsrc, final Logger logger)
- throws IOException {
- final InputStream ins = rsrc.getInputStream();
-
- Manifest result = null;
-
- if ( ins != null ) {
- ZipInputStream jis = null;
- try {
- jis = new ZipInputStream(ins);
-
- ZipEntry entry;
-
- while ( (entry = jis.getNextEntry()) != null ) {
- if (entry.getName().equals("OSGI-INF/SUBSYSTEM.MF") ) {
- result = new Manifest(jis);
- }
- }
-
- } finally {
-
- // close the jar stream or the input stream, if the jar
- // stream is set, we don't need to close the input stream
- // since closing the jar stream closes the input stream
- if (jis != null) {
- try {
- jis.close();
- } catch (IOException ignore) {
- }
- } else {
- try {
- ins.close();
- } catch (IOException ignore) {
- }
- }
- }
- }
- return result;
- }
-
- final static public class SubsystemInfo {
- public String symbolicName;
- public String version;
- @Override
-
- public String toString() {
- return "Subsystem[symbolicName=" + symbolicName + ", version="
- + version + "]";
- }
-
- }
-
- /**
- * Read the subsystem info from the manifest (if available)
- */
- private SubsystemInfo readSubsystemHeaders(final RegisteredResource resource) {
- try {
- final Manifest m = SubsystemInstaller.getManifest(resource, logger);
- if (m != null) {
- final String sn = m.getMainAttributes().getValue(SubsystemConstants.SUBSYSTEM_SYMBOLICNAME);
- if (sn != null) {
- final String v = m.getMainAttributes().getValue(SubsystemConstants.SUBSYSTEM_VERSION);
- final int paramPos = sn.indexOf(';');
- final String symbolicName = (paramPos == -1 ? sn : sn.substring(0, paramPos));
- final SubsystemInfo headers = new SubsystemInfo();
- headers.symbolicName = symbolicName;
- headers.version = v;
-
- // if no version is specified, use default version
- if ( headers.version == null ) {
- headers.version = "0.0.0.0";
- }
- return headers;
- }
- }
- } catch (final IOException ignore) {
- // ignore
- }
- return null;
- }
-
- private static final String MAVEN_SNAPSHOT_MARKER = "SNAPSHOT";
-
- /**
- * Check if the version is a snapshot version
- */
- public static boolean isSnapshot(final Version v) {
- return v.toString().indexOf(MAVEN_SNAPSHOT_MARKER) >= 0;
- }
-}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UninstallSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UninstallSubsystemTask.java
deleted file mode 100644
index a499c61..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UninstallSubsystemTask.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import org.apache.sling.installer.api.tasks.ChangeStateTask;
-import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.ResourceState;
-import org.apache.sling.installer.api.tasks.TaskResource;
-import org.apache.sling.installer.api.tasks.TaskResourceGroup;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.subsystem.Subsystem;
-
-/**
- * Uninstall a subsystem
- */
-public class UninstallSubsystemTask extends InstallTask {
-
- private static final String INSTALL_ORDER = "52-";
-
- private final ServiceReference<Subsystem> subsystemReference;
-
- private final BundleContext bundleContext;
-
- public UninstallSubsystemTask(final TaskResourceGroup grp,
- final BundleContext bundleContext,
- final ServiceReference<Subsystem> ref) {
- super(grp);
- this.bundleContext = bundleContext;
- this.subsystemReference = ref;
- }
-
- @Override
- public void execute(final InstallationContext ctx) {
- final TaskResource tr = this.getResource();
- ctx.log("Uninstalling subsystem from {}", tr);
-
- Subsystem subsystem = null;
- try {
- subsystem = this.bundleContext.getService(this.subsystemReference);
- if ( subsystem != null ) {
- subsystem.uninstall();
- ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.UNINSTALLED));
- ctx.log("Uninstalled subsystem {}", subsystem);
- } else {
- ctx.log("Unable to uninstall subsystem {}.", tr);
- ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.IGNORED));
- }
- } finally {
- if ( subsystem != null ) {
- this.bundleContext.ungetService(this.subsystemReference);
- }
- }
- }
-
- @Override
- public String getSortKey() {
- return INSTALL_ORDER + getResource().getURL();
- }
-}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java
deleted file mode 100644
index 781fcee..0000000
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.installer.factories.subsystems.impl;
-
-import org.apache.sling.installer.api.tasks.ChangeStateTask;
-import org.apache.sling.installer.api.tasks.InstallTask;
-import org.apache.sling.installer.api.tasks.InstallationContext;
-import org.apache.sling.installer.api.tasks.ResourceState;
-import org.apache.sling.installer.api.tasks.TaskResource;
-import org.apache.sling.installer.api.tasks.TaskResourceGroup;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.subsystem.Subsystem;
-
-/**
- * Update subsystem by uninstalling and installing it.
- */
-public class UpdateSubsystemTask extends InstallTask {
-
- private static final String INSTALL_ORDER = "54-";
-
- private final Subsystem rootSubsystem;
-
- private final ServiceReference<Subsystem> subsystemReference;
-
- private final BundleContext bundleContext;
-
- public UpdateSubsystemTask(final TaskResourceGroup grp,
- final BundleContext bundleContext,
- final ServiceReference<Subsystem> ref,
- final Subsystem rootSubsystem) {
- super(grp);
- this.bundleContext = bundleContext;
- this.subsystemReference = ref;
- this.rootSubsystem = rootSubsystem;
- }
-
- @Override
- public void execute(final InstallationContext ctx) {
- final TaskResource tr = this.getResource();
- ctx.log("Updating subsystem from {}", tr);
-
- Subsystem subsystem = null;
- try {
- subsystem = this.bundleContext.getService(this.subsystemReference);
- if ( subsystem != null ) {
- subsystem.stop();
- subsystem.uninstall();
- ctx.addTaskToCurrentCycle(new InstallSubsystemTask(this.getResourceGroup(), this.rootSubsystem));
- } else {
- ctx.log("Unable to update subsystem {}.", tr);
- ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.IGNORED));
- }
- } finally {
- if ( subsystem != null ) {
- this.bundleContext.ungetService(this.subsystemReference);
- }
- }
- }
-
- @Override
- public String getSortKey() {
- return INSTALL_ORDER + getResource().getURL();
- }
-}