You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2020/09/21 20:58:34 UTC
[sling-org-apache-sling-app-cms] 02/06: Adding a setting for the
type of instance
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 5b522b6b13560bb960eb97057c2b47323b300e77
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Sep 21 16:05:24 2020 -0400
Adding a setting for the type of instance
---
.../apache/sling/cms/publication/INSTANCE_TYPE.java | 19 +++++--------------
.../cms/publication/PublicationManagerFactory.java | 7 +++++++
.../sling/cms/core/publication/PublicationConfig.java | 10 +++++++---
.../publication/PublicationManagerFactoryImpl.java | 9 +++++++++
4 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/builder/src/test/java/org/apache/sling/launchpad/package-info.java b/api/src/main/java/org/apache/sling/cms/publication/INSTANCE_TYPE.java
similarity index 54%
rename from builder/src/test/java/org/apache/sling/launchpad/package-info.java
rename to api/src/main/java/org/apache/sling/cms/publication/INSTANCE_TYPE.java
index f70e5e8..15886c4 100644
--- a/builder/src/test/java/org/apache/sling/launchpad/package-info.java
+++ b/api/src/main/java/org/apache/sling/cms/publication/INSTANCE_TYPE.java
@@ -14,17 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * <h1>Smoke tests for the Sling Launchpad</h1>
- *
- * <p>This package contains a minimal set of tests for the Sling launchpad. The
- * tests validate that the launchpad is correctly assembled and that there are
- * no obvious mistakes such as bundles that can't be wired. More extensive
- * tests must be placed in specific test projects.</p>
- *
- * <p>The launchpad tests don't depend on other Sling bundles,to prevent circular
- * dependencies. As such, there is some duplication of code ( at least intent, if
- * not implementation ) with some of the testing projects. This is another
- * argument for keeping the tests minimal.</p>
- */
-package org.apache.sling.launchpad;
\ No newline at end of file
+package org.apache.sling.cms.publication;
+
+public enum INSTANCE_TYPE {
+ STANDALONE, AUTHOR, RENDERER
+}
diff --git a/api/src/main/java/org/apache/sling/cms/publication/PublicationManagerFactory.java b/api/src/main/java/org/apache/sling/cms/publication/PublicationManagerFactory.java
index 1168058..521d46a 100644
--- a/api/src/main/java/org/apache/sling/cms/publication/PublicationManagerFactory.java
+++ b/api/src/main/java/org/apache/sling/cms/publication/PublicationManagerFactory.java
@@ -23,6 +23,13 @@ package org.apache.sling.cms.publication;
public interface PublicationManagerFactory {
/**
+ * Get the type of this particular instance
+ *
+ * @return the instance type
+ */
+ INSTANCE_TYPE getInstanceType();
+
+ /**
* Returns the publication mode for this instance.
*
* @return the publication mode fro the instance
diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationConfig.java b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationConfig.java
index 855f18c..0884a64 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationConfig.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationConfig.java
@@ -16,6 +16,7 @@
*/
package org.apache.sling.cms.core.publication;
+import org.apache.sling.cms.publication.INSTANCE_TYPE;
import org.apache.sling.cms.publication.PUBLICATION_MODE;
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
@@ -23,9 +24,12 @@ import org.osgi.service.metatype.annotations.ObjectClassDefinition;
@ObjectClassDefinition(name = "%publication.config.name", description = "%publication.config.description", localization = "OSGI-INF/l10n/bundle")
public @interface PublicationConfig {
- @AttributeDefinition(name = "%publication.param.mode.name", description = "%publication.param.mode.description")
- PUBLICATION_MODE publicationMode() default PUBLICATION_MODE.STANDALONE;
-
@AttributeDefinition(name = "%publication.param.agents.name", description = "%publication.param.agents.description")
String[] agents() default {};
+
+ @AttributeDefinition(name = "%publication.param.type.name", description = "%publication.param.type.description")
+ INSTANCE_TYPE instanceType() default INSTANCE_TYPE.STANDALONE;
+
+ @AttributeDefinition(name = "%publication.param.mode.name", description = "%publication.param.mode.description")
+ PUBLICATION_MODE publicationMode() default PUBLICATION_MODE.STANDALONE;
}
diff --git a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
index 50e4268..034a3da 100644
--- a/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/publication/PublicationManagerFactoryImpl.java
@@ -17,6 +17,7 @@
package org.apache.sling.cms.core.publication;
import org.apache.sling.api.adapter.AdapterFactory;
+import org.apache.sling.cms.publication.INSTANCE_TYPE;
import org.apache.sling.cms.publication.PUBLICATION_MODE;
import org.apache.sling.cms.publication.PublicationManager;
import org.apache.sling.cms.publication.PublicationManagerFactory;
@@ -43,17 +44,25 @@ public class PublicationManagerFactoryImpl implements PublicationManagerFactory,
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
private Distributor distributor;
+ private INSTANCE_TYPE instanceType;
+
private PUBLICATION_MODE publicationMode;
private String[] agents;
@Activate
public void activate(PublicationConfig config) {
+ this.instanceType = config.instanceType();
this.publicationMode = config.publicationMode();
this.agents = config.agents();
}
@Override
+ public INSTANCE_TYPE getInstanceType() {
+ return this.instanceType;
+ }
+
+ @Override
public PUBLICATION_MODE getPublicationMode() {
return this.publicationMode;
}