Using static/greedy policy for components simplifying the code Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/f7f76e15 Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/f7f76e15 Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/f7f76e15
Branch: refs/heads/master Commit: f7f76e15dbfe30a022b13e18c90823d7051b542f Parents: 062e0df Author: Reto Gmür <[email protected]> Authored: Wed Aug 26 19:08:09 2015 +0200 Committer: Reto Gmür <[email protected]> Committed: Wed Aug 26 19:08:09 2015 +0200 ---------------------------------------------------------------------- jaxrs.whiteboard.jersey/pom.xml | 2 +- .../commons/web/base/jersey/JerseyEndpoint.java | 37 +++++--------------- platform/logging/core/pom.xml | 12 +++---- provisioning/launchers/content-launcher/pom.xml | 2 +- .../linked-data-launcher/nb-configuration.xml | 1 + .../launchers/linked-data-launcher/pom.xml | 2 +- 6 files changed, 18 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/jaxrs.whiteboard.jersey/pom.xml ---------------------------------------------------------------------- diff --git a/jaxrs.whiteboard.jersey/pom.xml b/jaxrs.whiteboard.jersey/pom.xml index eb2e9ea..52a61d8 100644 --- a/jaxrs.whiteboard.jersey/pom.xml +++ b/jaxrs.whiteboard.jersey/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.clerezza</groupId> <artifactId>clerezza</artifactId> - <version>0.5</version> + <version>7</version> <relativePath>../parent</relativePath> </parent> <groupId>org.apache.clerezza</groupId> http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/jaxrs.whiteboard.jersey/src/main/java/org/apache/stanbol/commons/web/base/jersey/JerseyEndpoint.java ---------------------------------------------------------------------- diff --git a/jaxrs.whiteboard.jersey/src/main/java/org/apache/stanbol/commons/web/base/jersey/JerseyEndpoint.java b/jaxrs.whiteboard.jersey/src/main/java/org/apache/stanbol/commons/web/base/jersey/JerseyEndpoint.java index e35bff0..e98ab04 100644 --- a/jaxrs.whiteboard.jersey/src/main/java/org/apache/stanbol/commons/web/base/jersey/JerseyEndpoint.java +++ b/jaxrs.whiteboard.jersey/src/main/java/org/apache/stanbol/commons/web/base/jersey/JerseyEndpoint.java @@ -34,6 +34,7 @@ import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.ReferenceCardinality; import org.apache.felix.scr.annotations.ReferencePolicy; +import org.apache.felix.scr.annotations.ReferencePolicyOption; import org.osgi.framework.BundleContext; import org.osgi.service.cm.ConfigurationException; import org.osgi.service.component.ComponentContext; @@ -48,17 +49,17 @@ import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; /** - * Jersey-based RESTful endpoint for the Stanbol Enhancer engines and store. - * <p> - * This OSGi component serves as a bridge between the OSGi context and the Servlet context available to JAX-RS - * resources. + * Jersey-based JAXRS whiteboard implementation. + * + * This exposes JAX-RS resources available as services exposing Object with the property javax.ws.rs=true */ @Component(immediate = true, metatype = true) @References({ @Reference(name="component", referenceInterface=Object.class, target="(javax.ws.rs=true)", cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE, - policy=ReferencePolicy.DYNAMIC)}) + policy=ReferencePolicy.STATIC, + policyOption=ReferencePolicyOption.GREEDY)}) public class JerseyEndpoint { private final Logger log = LoggerFactory.getLogger(getClass()); @@ -91,31 +92,12 @@ public class JerseyEndpoint { } @Activate - protected void activate(ComponentContext ctx) throws IOException, + protected void activate(ComponentContext componentContext) throws IOException, ServletException, NamespaceException, ConfigurationException { - componentContext = ctx; - initJersey(); - - } - - /** Initialize the Jersey subsystem */ - private synchronized void initJersey() throws NamespaceException, ServletException { - if (componentContext == null) { - //we have not yet been activated - return; - } - //end of STANBOL-1073 work around - if (componentContext == null) { - log.debug(" ... can not init Jersey Endpoint - Component not yet activated!"); - //throw new IllegalStateException("Null ComponentContext, not activated?"); - return; - } - - shutdownJersey(); - log.info("(Re)initializing the Stanbol Jersey subsystem"); + log.info("Activating Jersey subsystem"); // register all the JAX-RS resources into a a JAX-RS application and bind it to a configurable URL // prefix @@ -150,20 +132,17 @@ public class JerseyEndpoint { protected void deactivate(ComponentContext ctx) { shutdownJersey(); servletContext = null; - componentContext = null; } protected void bindComponent(Object component) throws IOException, ServletException, NamespaceException { components.add(component); - initJersey(); } protected void unbindComponent(Object component) throws IOException, ServletException, NamespaceException { components.remove(component); - initJersey(); } } http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/platform/logging/core/pom.xml ---------------------------------------------------------------------- diff --git a/platform/logging/core/pom.xml b/platform/logging/core/pom.xml index bf3dcca..8296a7c 100644 --- a/platform/logging/core/pom.xml +++ b/platform/logging/core/pom.xml @@ -57,32 +57,32 @@ <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>rdf.core</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>platform</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>platform.globalmenu.api</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>platform.graphprovider.content</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>platform.typerendering.core</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> <artifactId>platform.typerendering.scalaserverpages</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.clerezza</groupId> http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/provisioning/launchers/content-launcher/pom.xml ---------------------------------------------------------------------- diff --git a/provisioning/launchers/content-launcher/pom.xml b/provisioning/launchers/content-launcher/pom.xml index 3590b9e..5698622 100644 --- a/provisioning/launchers/content-launcher/pom.xml +++ b/provisioning/launchers/content-launcher/pom.xml @@ -250,7 +250,7 @@ <dependency> <groupId>org.apache.clerezza.provisioning</groupId> <artifactId>jaxrs</artifactId> - <version>0.1</version> + <version>1.0.1-SNAPSHOT</version> <type>partialbundlelist</type> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/provisioning/launchers/linked-data-launcher/nb-configuration.xml ---------------------------------------------------------------------- diff --git a/provisioning/launchers/linked-data-launcher/nb-configuration.xml b/provisioning/launchers/linked-data-launcher/nb-configuration.xml index ec4540c..ca588fa 100644 --- a/provisioning/launchers/linked-data-launcher/nb-configuration.xml +++ b/provisioning/launchers/linked-data-launcher/nb-configuration.xml @@ -14,5 +14,6 @@ That way multiple projects can share the same settings (useful for formatting ru Any value defined here will override the pom.xml file value but is only applicable to the current project. --> <netbeans.compile.on.save>none</netbeans.compile.on.save> + <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> </properties> </project-shared-configuration> http://git-wip-us.apache.org/repos/asf/clerezza/blob/f7f76e15/provisioning/launchers/linked-data-launcher/pom.xml ---------------------------------------------------------------------- diff --git a/provisioning/launchers/linked-data-launcher/pom.xml b/provisioning/launchers/linked-data-launcher/pom.xml index bd7a0dc..c54e92e 100644 --- a/provisioning/launchers/linked-data-launcher/pom.xml +++ b/provisioning/launchers/linked-data-launcher/pom.xml @@ -250,7 +250,7 @@ <dependency> <groupId>org.apache.clerezza.provisioning</groupId> <artifactId>jaxrs</artifactId> - <version>0.1</version> + <version>1.0.1-SNAPSHOT</version> <type>partialbundlelist</type> </dependency> <dependency>
