<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="Jetty Service Factory">
+ <implementation class="org.argeo.cms.servlet.internal.jetty.JettyServiceFactory"/>
+ <service>
+ <provide interface="org.osgi.service.cm.ManagedServiceFactory"/>
+ </service>
+ <property name="service.pid" type="String" value="org.argeo.equinox.jetty.config"/>
+</scr:component>
*
Service-Component:\
+OSGI-INF/jettyServiceFactory.xml,\
OSGI-INF/pkgServletContext.xml,\
OSGI-INF/pkgServlet.xml
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ OSGI-INF/jettyServiceFactory.xml
+source.. = src/
--- /dev/null
+package org.argeo.cms.servlet.internal.jetty;
+
+import java.util.Dictionary;
+
+import org.argeo.api.cms.CmsConstants;
+import org.argeo.api.cms.CmsLog;
+import org.eclipse.equinox.http.jetty.JettyConfigurator;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+public class JettyServiceFactory implements ManagedServiceFactory {
+ private final CmsLog log = CmsLog.getLog(JettyServiceFactory.class);
+
+ public void start() {
+
+ }
+
+ @Override
+ public String getName() {
+ return "Jetty Service Factory";
+ }
+
+ @Override
+ public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
+ // Explicitly configures Jetty so that the default server is not started by the
+ // activator of the Equinox Jetty bundle.
+
+// if (!webServerConfig.isEmpty()) {
+// webServerConfig.put("customizer.class", KernelConstants.CMS_JETTY_CUSTOMIZER_CLASS);
+//
+// // TODO centralise with Jetty extender
+// Object webSocketEnabled = webServerConfig.get(InternalHttpConstants.WEBSOCKET_ENABLED);
+// if (webSocketEnabled != null && webSocketEnabled.toString().equals("true")) {
+// bc.registerService(ServerEndpointConfig.Configurator.class, new CmsWebSocketConfigurator(), null);
+// webServerConfig.put(InternalHttpConstants.WEBSOCKET_ENABLED, "true");
+// }
+// }
+
+ int tryCount = 60;
+ try {
+ tryGettyJetty: while (tryCount > 0) {
+ try {
+ // FIXME deal with multiple ids
+ JettyConfigurator.startServer(CmsConstants.DEFAULT, properties);
+ // Explicitly starts Jetty OSGi HTTP bundle, so that it gets triggered if OSGi
+ // configuration is not cleaned
+ FrameworkUtil.getBundle(JettyConfigurator.class).start();
+ break tryGettyJetty;
+ } catch (IllegalStateException e) {
+ // Jetty may not be ready
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e1) {
+ // silent
+ }
+ tryCount--;
+ }
+ }
+ } catch (Exception e) {
+ log.error("Cannot start default Jetty server with config " + properties, e);
+ }
+
+ }
+
+ @Override
+ public void deleted(String pid) {
+ }
+
+ public void stop() {
+ try {
+ JettyConfigurator.stopServer(CmsConstants.DEFAULT);
+ } catch (Exception e) {
+ log.error("Cannot stop default Jetty server.", e);
+ }
+
+ }
+
+}
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" immediate="true" name="CMS Context">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="true" name="CMS Context">
<implementation class="org.argeo.cms.internal.runtime.CmsContextImpl"/>
<reference bind="setCmsDeployment" cardinality="1..1" interface="org.argeo.api.cms.CmsDeployment" name="CmsDeployment" policy="static"/>
<service>
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" immediate="false" name="CMS Deployment">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="false" name="CMS Deployment">
<reference bind="setDeployConfig" cardinality="1..1" interface="org.argeo.cms.internal.osgi.DeployConfig" name="DeployConfig" policy="static"/>
<implementation class="org.argeo.cms.internal.runtime.CmsDeploymentImpl"/>
<reference bind="setCmsState" cardinality="1..1" interface="org.argeo.api.cms.CmsState" name="CmsState" policy="static"/>
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" immediate="false" name="CMS State">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" immediate="false" name="CMS State">
<implementation class="org.argeo.cms.internal.runtime.CmsStateImpl"/>
<service>
<provide interface="org.argeo.api.cms.CmsState"/>
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" name="Deploy Config">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="Deploy Config">
<implementation class="org.argeo.cms.internal.osgi.DeployConfig"/>
<service>
<provide interface="org.argeo.cms.internal.osgi.DeployConfig"/>
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" name="Node User Admin">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="Node User Admin">
<implementation class="org.argeo.cms.internal.osgi.NodeUserAdmin"/>
<property name="service.pid" type="String" value="org.argeo.api.userAdmin"/>
<reference bind="setTransactionManager" cardinality="1..1" interface="org.argeo.osgi.transaction.WorkControl" name="WorkControl" policy="static"/>
import org.argeo.util.naming.AttributesDictionary;
import org.argeo.util.naming.LdifParser;
import org.argeo.util.naming.LdifWriter;
-import org.eclipse.equinox.http.jetty.JettyConfigurator;
-import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
}
// http server
-// Dictionary<String, Object> webServerConfig = InitUtils
-// .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID, NodeConstants.DEFAULT));
-// if (!webServerConfig.isEmpty()) {
-// // TODO check for other customizers
+ Dictionary<String, Object> webServerConfig = InitUtils
+ .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID, CmsConstants.DEFAULT));
+ if (!webServerConfig.isEmpty()) {
+ // TODO check for other customizers
// webServerConfig.put("customizer.class", "org.argeo.equinox.jetty.CmsJettyCustomizer");
-// putFactoryDeployConfig(KernelConstants.JETTY_FACTORY_PID, webServerConfig);
-// }
- LdapName defaultHttpServiceDn = serviceDn(KernelConstants.JETTY_FACTORY_PID, CmsConstants.DEFAULT);
- if (deployConfigs.containsKey(defaultHttpServiceDn)) {
- // remove old default configs since we have now to start Jetty servlet bridge
- // indirectly
- deployConfigs.remove(defaultHttpServiceDn);
+ putFactoryDeployConfig(KernelConstants.JETTY_FACTORY_PID, webServerConfig);
}
+// LdapName defaultHttpServiceDn = serviceDn(KernelConstants.JETTY_FACTORY_PID, CmsConstants.DEFAULT);
+// if (deployConfigs.containsKey(defaultHttpServiceDn)) {
+// // remove old default configs since we have now to start Jetty servlet bridge
+// // indirectly
+// deployConfigs.remove(defaultHttpServiceDn);
+// }
// SAVE
save();
//
- // Explicitly configures Jetty so that the default server is not started by the
- // activator of the Equinox Jetty bundle.
- Dictionary<String, Object> webServerConfig = InitUtils
- .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID, CmsConstants.DEFAULT));
-// if (!webServerConfig.isEmpty()) {
-// webServerConfig.put("customizer.class", KernelConstants.CMS_JETTY_CUSTOMIZER_CLASS);
-//
-// // TODO centralise with Jetty extender
-// Object webSocketEnabled = webServerConfig.get(InternalHttpConstants.WEBSOCKET_ENABLED);
-// if (webSocketEnabled != null && webSocketEnabled.toString().equals("true")) {
-// bc.registerService(ServerEndpointConfig.Configurator.class, new CmsWebSocketConfigurator(), null);
-// webServerConfig.put(InternalHttpConstants.WEBSOCKET_ENABLED, "true");
-// }
-// }
-
- int tryCount = 60;
- try {
- tryGettyJetty: while (tryCount > 0) {
- try {
- JettyConfigurator.startServer(KernelConstants.DEFAULT_JETTY_SERVER, webServerConfig);
- // Explicitly starts Jetty OSGi HTTP bundle, so that it gets triggered if OSGi
- // configuration is not cleaned
- FrameworkUtil.getBundle(JettyConfigurator.class).start();
- break tryGettyJetty;
- } catch (IllegalStateException e) {
- // Jetty may not be ready
- try {
- Thread.sleep(1000);
- } catch (Exception e1) {
- // silent
- }
- tryCount--;
- }
- }
- } catch (Exception e) {
- log.error("Cannot start default Jetty server with config " + webServerConfig, e);
- }
-
+// Dictionary<String, Object> webServerConfig = InitUtils
+// .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID, CmsConstants.DEFAULT));
}
- public void init() throws IOException {
+ public void start() throws IOException {
if (!isInitialized()) { // first init
isFirstInit = true;
firstInit();
// TODO check consistency if not clean
}
- public void destroy() {
+ public void stop() {
}
// }
}
- public void init() {
+ public void start() {
}
- public void destroy() {
+ public void stop() {
}
@Override
// initTrackers();
// }
- public void init() {
+ public void start() {
Object defaultLocaleValue = KernelUtils.getFrameworkProp(CmsConstants.I18N_DEFAULT_LOCALE);
defaultLocale = defaultLocaleValue != null ? new Locale(defaultLocaleValue.toString())
: new Locale(ENGLISH.getLanguage());
setInstance(this);
}
- public void destroy() {
+ public void stop() {
setInstance(null);
}
import org.argeo.api.cms.CmsLog;
import org.argeo.api.cms.CmsState;
import org.argeo.cms.internal.osgi.DeployConfig;
-import org.eclipse.equinox.http.jetty.JettyConfigurator;
import org.osgi.service.http.HttpService;
/** Implementation of a CMS deployment. */
// KernelUtils.asyncOpen(confAdminSt);
}
- public void init() {
+ public void start() {
httpExpected = deployConfig.getProps(KernelConstants.JETTY_FACTORY_PID, "default") != null;
if (deployConfig.hasDomain()) {
loadIpaJaasConfiguration();
}
}
- public void destroy() {
+ public void stop() {
// if (nodeHttp != null)
// nodeHttp.destroy();
- try {
- JettyConfigurator.stopServer(KernelConstants.DEFAULT_JETTY_SERVER);
- } catch (Exception e) {
- log.error("Cannot stop default Jetty server.", e);
- }
+// try {
+// JettyConfigurator.stopServer(KernelConstants.DEFAULT_JETTY_SERVER);
+// } catch (Exception e) {
+// log.error("Cannot stop default Jetty server.", e);
+// }
if (deployConfig != null) {
- new Thread(() -> deployConfig.save(), "Save Argeo Deploy Config").start();
+ deployConfig.save();
+ // new Thread(() -> deployConfig.save(), "Save Argeo Deploy Config").start();
}
}
// private final boolean cleanState;
private String hostname;
- public void init() {
+ public void start() {
// instance = this;
Runtime.getRuntime().addShutdownHook(new CmsShutdown());
// log.debug("Initialised default Bitronix transaction manager");
// }
- public void destroy() {
+ public void stop() {
if (log.isDebugEnabled())
log.debug("CMS stopping... (" + this.stateUuid + ")");
// new GogoShellKiller().start();
// String PATH_WORKBENCH = "/ui";
// String PATH_WORKBENCH_PUBLIC = PATH_WORKBENCH + "/public";
- String JETTY_FACTORY_PID = "org.eclipse.equinox.http.jetty.config";
+// String JETTY_FACTORY_PID = "org.eclipse.equinox.http.jetty.config";
+ String JETTY_FACTORY_PID = "org.argeo.equinox.jetty.config";
String WHITEBOARD_PATTERN_PROP = "osgi.http.whiteboard.servlet.pattern";
// default Jetty server configured via JettyConfigurator
String DEFAULT_JETTY_SERVER = "default";
org.argeo.cms
argeo.osgi.start.4.node=\
+org.argeo.cms.servlet,\
org.argeo.cms.jcr
argeo.osgi.start.5.node=\