2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.osgi
;
18 import java
.lang
.management
.ManagementFactory
;
19 import java
.util
.ArrayList
;
20 import java
.util
.Dictionary
;
21 import java
.util
.Enumeration
;
22 import java
.util
.HashMap
;
23 import java
.util
.HashSet
;
24 import java
.util
.Iterator
;
25 import java
.util
.List
;
29 import javax
.management
.MBeanServer
;
30 import javax
.management
.ObjectName
;
31 import javax
.management
.StandardMBean
;
33 import org
.apache
.commons
.logging
.Log
;
34 import org
.apache
.commons
.logging
.LogFactory
;
35 import org
.argeo
.slc
.BasicNameVersion
;
36 import org
.argeo
.slc
.NameVersion
;
37 import org
.argeo
.slc
.SlcException
;
38 import org
.argeo
.slc
.core
.execution
.AbstractExecutionModulesManager
;
39 import org
.argeo
.slc
.core
.execution
.DefaultExecutionFlowDescriptorConverter
;
40 import org
.argeo
.slc
.deploy
.Module
;
41 import org
.argeo
.slc
.deploy
.ModuleDescriptor
;
42 import org
.argeo
.slc
.execution
.ExecutionContext
;
43 import org
.argeo
.slc
.execution
.ExecutionFlow
;
44 import org
.argeo
.slc
.execution
.ExecutionFlowDescriptor
;
45 import org
.argeo
.slc
.execution
.ExecutionFlowDescriptorConverter
;
46 import org
.argeo
.slc
.execution
.ExecutionModuleDescriptor
;
47 import org
.argeo
.slc
.execution
.ExecutionModulesListener
;
48 import org
.argeo
.slc
.execution
.RealizedFlow
;
49 import org
.osgi
.framework
.Bundle
;
50 import org
.osgi
.framework
.BundleEvent
;
51 import org
.osgi
.framework
.BundleException
;
52 import org
.osgi
.framework
.BundleListener
;
53 import org
.osgi
.framework
.Constants
;
54 import org
.osgi
.framework
.launch
.Framework
;
55 import org
.springframework
.context
.ApplicationContext
;
56 import org
.springframework
.osgi
.service
.importer
.OsgiServiceLifecycleListener
;
58 /** Execution modules manager implementation based on an OSGi runtime. */
59 public class OsgiExecutionModulesManager
extends
60 AbstractExecutionModulesManager
implements
61 OsgiServiceLifecycleListener
, BundleListener
{
63 private final static Log log
= LogFactory
64 .getLog(OsgiExecutionModulesManager
.class);
66 private BundlesManager bundlesManager
;
67 private Map
<OsgiBundle
, ExecutionContext
> executionContexts
= new HashMap
<OsgiBundle
, ExecutionContext
>();
68 private Map
<OsgiBundle
, ExecutionFlowDescriptorConverter
> executionFlowDescriptorConverters
= new HashMap
<OsgiBundle
, ExecutionFlowDescriptorConverter
>();
69 private Map
<OsgiBundle
, Set
<ExecutionFlow
>> executionFlows
= new HashMap
<OsgiBundle
, Set
<ExecutionFlow
>>();
70 private ExecutionFlowDescriptorConverter defaultDescriptorConverter
= new DefaultExecutionFlowDescriptorConverter();
72 private List
<ExecutionModulesListener
> executionModulesListeners
= new ArrayList
<ExecutionModulesListener
>();
74 private Boolean registerFlowsToJmx
= false;
76 public void init() throws Exception
{
77 bundlesManager
.getBundleContext().addBundleListener(this);
79 final String module
= System
.getProperty(UNIQUE_LAUNCH_MODULE_PROPERTY
);
80 final String flow
= System
.getProperty(UNIQUE_LAUNCH_FLOW_PROPERTY
);
82 // launch a flow and stops
83 new Thread("Unique Flow") {
86 executeFlowAndExit(module
, null, flow
);
92 public void destroy() {
93 bundlesManager
.getBundleContext().removeBundleListener(this);
96 /** Executes a single flow and <b>stops the JVM</b> */
97 protected void executeFlowAndExit(final String module
,
98 final String version
, final String flow
) {
99 if (log
.isDebugEnabled())
100 log
.debug("Launch unique flow " + flow
+ " from module " + module
);
102 OsgiBundle osgiBundle
= bundlesManager
.findFromPattern(module
);
103 if (osgiBundle
== null)
104 throw new SlcException("No OSGi bundle found for " + module
);
105 Bundle moduleBundle
= bundlesManager
.findRelatedBundle(osgiBundle
);
106 bundlesManager
.startSynchronous(moduleBundle
);
107 RealizedFlow lastLaunch
= findRealizedFlow(module
, flow
);
108 if (lastLaunch
== null)
109 throw new SlcException("Cannot find launch for " + module
+ " "
112 } catch (Exception e
) {
114 "Error in unique flow " + flow
+ " from module " + module
,
117 if (log
.isDebugEnabled())
118 log
.debug("Shutdown OSGi runtime...");
119 Framework framework
= (Framework
) bundlesManager
.getBundleContext()
122 // shutdown framework
124 // wait 1 min for shutdown
125 framework
.waitForStop(60 * 1000);
128 } catch (Exception e
) {
135 public synchronized ExecutionModuleDescriptor
getExecutionModuleDescriptor(
136 String moduleName
, String version
) {
137 ExecutionModuleDescriptor md
= new ExecutionModuleDescriptor();
138 OsgiBundle osgiBundle
= null;
139 BasicNameVersion nameVersion
= new BasicNameVersion(moduleName
, version
);
140 bundles
: for (Iterator
<OsgiBundle
> iterator
= executionContexts
141 .keySet().iterator(); iterator
.hasNext();) {
142 OsgiBundle ob
= iterator
.next();
143 if (nameVersion
.getVersion() != null) {
144 if (ob
.equals(nameVersion
)) {
149 if (ob
.getName().equals(nameVersion
.getName())) {
155 if (osgiBundle
== null)
156 throw new SlcException("No execution module registered for "
158 md
.setName(osgiBundle
.getName());
159 md
.setVersion(osgiBundle
.getVersion());
160 md
.setTitle(osgiBundle
.getTitle());
161 md
.setDescription(osgiBundle
.getDescription());
163 ExecutionFlowDescriptorConverter executionFlowDescriptorConverter
= getExecutionFlowDescriptorConverter(
164 moduleName
, version
);
165 if (executionFlowDescriptorConverter
== null)
166 throw new SlcException("No flow converter found.");
167 executionFlowDescriptorConverter
.addFlowsToDescriptor(md
,
168 listFlows(moduleName
, version
));
172 public synchronized List
<ExecutionModuleDescriptor
> listExecutionModules() {
173 List
<ExecutionModuleDescriptor
> descriptors
= new ArrayList
<ExecutionModuleDescriptor
>();
175 for (Iterator
<OsgiBundle
> iterator
= executionContexts
.keySet()
176 .iterator(); iterator
.hasNext();) {
177 OsgiBundle osgiBundle
= iterator
.next();
178 ExecutionModuleDescriptor md
= new ExecutionModuleDescriptor();
179 setMetadataFromBundle(md
,
180 bundlesManager
.findRelatedBundle(osgiBundle
));
186 protected synchronized Map
<String
, ExecutionFlow
> listFlows(
187 String moduleName
, String moduleVersion
) {
189 Map
<String
, ExecutionFlow
> flows
= new HashMap
<String
, ExecutionFlow
>();
190 OsgiBundle key
= bundlesManager
.findRelatedBundle(moduleName
,
192 if (!executionFlows
.containsKey(key
))
194 Set
<ExecutionFlow
> flowsT
= executionFlows
.get(key
);
195 for (ExecutionFlow flow
: flowsT
)
196 flows
.put(flow
.getName(), flow
);
200 protected ExecutionFlow
findExecutionFlow(String moduleName
,
201 String moduleVersion
, String flowName
) {
202 String filter
= moduleVersion
== null || moduleVersion
.equals("0.0.0") ?
"(&(Bundle-SymbolicName="
204 + ")(org.springframework.osgi.bean.name="
206 : "(&(Bundle-SymbolicName=" + moduleName
+ ")(Bundle-Version="
208 + ")(org.springframework.osgi.bean.name=" + flowName
210 return bundlesManager
.getSingleServiceStrict(ExecutionFlow
.class,
214 protected ExecutionContext
findExecutionContext(String moduleName
,
215 String moduleVersion
) {
216 String filter
= moduleFilter(moduleName
, moduleVersion
);
217 return bundlesManager
.getSingleServiceStrict(ExecutionContext
.class,
221 protected ExecutionFlowDescriptorConverter
findExecutionFlowDescriptorConverter(
222 String moduleName
, String moduleVersion
) {
223 String filter
= moduleFilter(moduleName
, moduleVersion
);
224 return bundlesManager
.getSingleService(
225 ExecutionFlowDescriptorConverter
.class, filter
, false);
228 /** Only based on symbolic name if version is null or "0.0.0" */
229 protected String
moduleFilter(String moduleName
, String moduleVersion
) {
230 return moduleVersion
== null || moduleVersion
.equals("0.0.0") ?
"(Bundle-SymbolicName="
232 : "(&(Bundle-SymbolicName=" + moduleName
+ ")(Bundle-Version="
233 + moduleVersion
+ "))";
238 * Builds a minimal realized flow, based on the provided information
239 * (typically from the command line).
242 * a bundle id, or a pattern contained in a bundle symbolic name
244 * the execution flow name
245 * @return a minimal realized flow, to be used in an execution
247 public RealizedFlow
findRealizedFlow(String module
, String executionName
) {
248 // First check whether we have a bundleId
249 Long bundleId
= null;
251 bundleId
= Long
.parseLong(module
);
252 } catch (NumberFormatException e
) {
256 // Look for bundle names containing pattern
257 OsgiBundle bundle
= null;
258 if (bundleId
!= null) {
259 bundle
= bundlesManager
.getBundle(bundleId
);
261 bundle
= bundlesManager
.findFromPattern(module
);
264 if (bundle
!= null) {
265 RealizedFlow launch
= new RealizedFlow();
266 launch
.setModuleName(bundle
.getName());
267 launch
.setModuleVersion(bundle
.getVersion());
268 ExecutionFlowDescriptor descriptor
= new ExecutionFlowDescriptor();
269 descriptor
.setName(executionName
);
270 launch
.setFlowDescriptor(descriptor
);
273 log
.warn("Could not find any execution module matching these requirements.");
278 public void upgrade(NameVersion nameVersion
) {
279 OsgiBundle osgiBundle
= new OsgiBundle(nameVersion
);
280 bundlesManager
.upgradeSynchronous(osgiBundle
);
283 protected synchronized ExecutionFlowDescriptorConverter
getExecutionFlowDescriptorConverter(
284 String moduleName
, String moduleVersion
) {
285 return findExecutionFlowDescriptorConverter(moduleName
, moduleVersion
);
286 // OsgiBundle osgiBundle = new OsgiBundle(moduleName, moduleVersion);
287 // return getExecutionFlowDescriptorConverter(osgiBundle);
290 protected synchronized ExecutionFlowDescriptorConverter
getExecutionFlowDescriptorConverter(
291 OsgiBundle osgiBundle
) {
292 if (executionFlowDescriptorConverters
.containsKey(osgiBundle
))
293 return executionFlowDescriptorConverters
.get(osgiBundle
);
295 return defaultDescriptorConverter
;
298 public ModuleDescriptor
getModuleDescriptor(String moduleName
,
300 return getExecutionModuleDescriptor(moduleName
, version
);
303 public List
<ModuleDescriptor
> listModules() {
304 Bundle
[] bundles
= bundlesManager
.getBundleContext().getBundles();
305 List
<ModuleDescriptor
> lst
= new ArrayList
<ModuleDescriptor
>();
306 for (Bundle bundle
: bundles
) {
307 ModuleDescriptor moduleDescriptor
= new ModuleDescriptor();
308 setMetadataFromBundle(moduleDescriptor
, bundle
);
309 lst
.add(moduleDescriptor
);
314 public void start(NameVersion nameVersion
) {
316 Bundle bundle
= bundlesManager
.findRelatedBundle(new OsgiBundle(
319 throw new SlcException("Could not find bundle for "
322 bundlesManager
.startSynchronous(bundle
);
323 if (isSpringInstrumented(bundle
)) {
324 // Wait for Spring application context to be ready
325 String filter
= "(Bundle-SymbolicName="
326 + bundle
.getSymbolicName() + ")";
328 bundlesManager
.getServiceRefSynchronous(
329 ApplicationContext
.class.getName(), filter
);
330 } catch (Exception e
) {
331 // stop if application context not found
336 } catch (Exception e
) {
337 throw new SlcException("Cannot start " + nameVersion
, e
);
341 /** Do it calmly in order to avoid NPE */
342 private Boolean
isSpringInstrumented(Bundle bundle
) {
343 Dictionary
<?
, ?
> headers
= bundle
.getHeaders();
344 if (headers
!= null && headers
.get("Spring-Context") != null)
346 Enumeration
<?
> springEntryPaths
= bundle
347 .getEntryPaths("/META-INF/spring");
348 if (springEntryPaths
!= null && springEntryPaths
.hasMoreElements())
353 public void stop(NameVersion nameVersion
) {
355 Bundle bundle
= bundlesManager
.findRelatedBundle(new OsgiBundle(
357 bundlesManager
.stopSynchronous(bundle
);
358 } catch (BundleException e
) {
359 throw new SlcException("Cannot stop " + nameVersion
, e
);
363 protected void setMetadataFromBundle(ModuleDescriptor md
, Bundle bundle
) {
366 if (md
.getName() == null || md
.getVersion() == null)
367 throw new SlcException("Name and version not available.");
369 Bundle
[] bundles
= bundlesManager
.getBundleContext().getBundles();
370 for (Bundle b
: bundles
) {
371 if (b
.getSymbolicName().equals(md
.getName())
372 && md
.getVersion().equals(
373 getHeaderSafe(b
, Constants
.BUNDLE_VERSION
))) {
382 throw new SlcException("Cannot find bundle.");
384 md
.setName(bdl
.getSymbolicName());
385 md
.setVersion(getHeaderSafe(bdl
, Constants
.BUNDLE_VERSION
));
386 md
.setTitle(getHeaderSafe(bdl
, Constants
.BUNDLE_NAME
));
387 md
.setDescription(getHeaderSafe(bdl
, Constants
.BUNDLE_DESCRIPTION
));
389 // copy manifets header to meta data
390 Dictionary
<?
, ?
> headers
= bundle
.getHeaders();
391 Enumeration
<?
> keys
= headers
.keys();
392 while (keys
.hasMoreElements()) {
393 Object key
= keys
.nextElement();
394 Object value
= headers
.get(key
);
396 md
.getMetadata().put(key
.toString(), value
.toString());
400 if (bundle
.getState() == Bundle
.ACTIVE
401 || bundle
.getState() == Bundle
.STARTING
)
404 md
.setStarted(false);
407 private String
getHeaderSafe(Bundle bundle
, Object key
) {
408 Object obj
= bundle
.getHeaders().get(key
);
412 return obj
.toString();
419 /** Registers an execution context. */
420 public synchronized void register(ExecutionContext executionContext
,
421 Map
<String
, String
> properties
) {
422 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
423 Bundle bundle
= bundlesManager
.findRelatedBundle(osgiBundle
);
424 osgiBundle
.setTitle(getHeaderSafe(bundle
, Constants
.BUNDLE_NAME
));
425 osgiBundle
.setDescription(getHeaderSafe(bundle
,
426 Constants
.BUNDLE_DESCRIPTION
));
427 executionContexts
.put(osgiBundle
, executionContext
);
428 if (log
.isTraceEnabled())
429 log
.trace("Registered execution context from " + osgiBundle
);
431 ModuleDescriptor md
= osgiBundle
.getModuleDescriptor();
433 for (ExecutionModulesListener listener
: executionModulesListeners
)
434 listener
.executionModuleAdded(md
);
437 /** Unregisters an execution context. */
438 public synchronized void unregister(ExecutionContext executionContext
,
439 Map
<String
, String
> properties
) {
440 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
441 if (executionContexts
.containsKey(osgiBundle
)) {
442 executionContexts
.remove(osgiBundle
);
443 if (log
.isTraceEnabled())
444 log
.trace("Removed execution context from " + osgiBundle
);
446 ModuleDescriptor md
= osgiBundle
.getModuleDescriptor();
447 md
.setStarted(false);
448 for (ExecutionModulesListener listener
: executionModulesListeners
)
449 listener
.executionModuleRemoved(md
);
453 /** Registers an execution flow. */
454 public synchronized void register(ExecutionFlow executionFlow
,
455 Map
<String
, String
> properties
) {
456 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
457 if (!executionFlows
.containsKey(osgiBundle
)) {
458 executionFlows
.put(osgiBundle
, new HashSet
<ExecutionFlow
>());
460 executionFlows
.get(osgiBundle
).add(executionFlow
);
461 if (log
.isTraceEnabled())
462 log
.trace("Registered " + executionFlow
+ " from " + osgiBundle
);
465 if (registerFlowsToJmx
)
466 registerMBean(osgiBundle
, executionFlow
);
467 ExecutionFlowDescriptorConverter efdc
= getExecutionFlowDescriptorConverter(osgiBundle
);
468 for (ExecutionModulesListener listener
: executionModulesListeners
)
469 listener
.executionFlowAdded(osgiBundle
.getModuleDescriptor(),
470 efdc
.getExecutionFlowDescriptor(executionFlow
));
473 /** Unregisters an execution flow. */
474 public synchronized void unregister(ExecutionFlow executionFlow
,
475 Map
<String
, String
> properties
) {
476 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
477 if (executionFlows
.containsKey(osgiBundle
)) {
478 Set
<ExecutionFlow
> flows
= executionFlows
.get(osgiBundle
);
479 flows
.remove(executionFlow
);
480 if (log
.isTraceEnabled())
481 log
.trace("Removed " + executionFlow
+ " from " + osgiBundle
);
482 if (flows
.size() == 0) {
483 executionFlows
.remove(osgiBundle
);
484 if (log
.isTraceEnabled())
485 log
.trace("Removed flows set from " + osgiBundle
);
489 if (registerFlowsToJmx
)
490 unregisterMBean(osgiBundle
, executionFlow
);
491 ExecutionFlowDescriptorConverter efdc
= getExecutionFlowDescriptorConverter(osgiBundle
);
492 for (ExecutionModulesListener listener
: executionModulesListeners
)
493 listener
.executionFlowRemoved(osgiBundle
.getModuleDescriptor(),
494 efdc
.getExecutionFlowDescriptor(executionFlow
));
498 /** Registers an execution module listener. */
499 public synchronized void register(
500 ExecutionModulesListener executionModulesListener
,
501 Map
<String
, String
> properties
) {
502 // sync with current state
503 for (OsgiBundle osgiBundle
: executionContexts
.keySet()) {
504 executionModulesListener
.executionModuleAdded(osgiBundle
505 .getModuleDescriptor());
507 for (OsgiBundle osgiBundle
: executionFlows
.keySet()) {
508 ExecutionFlowDescriptorConverter efdc
= getExecutionFlowDescriptorConverter(osgiBundle
);
509 for (ExecutionFlow executionFlow
: executionFlows
.get(osgiBundle
))
510 executionModulesListener
.executionFlowAdded(
511 osgiBundle
.getModuleDescriptor(),
512 efdc
.getExecutionFlowDescriptor(executionFlow
));
514 executionModulesListeners
.add(executionModulesListener
);
517 /** Unregisters an execution module listener. */
518 public synchronized void unregister(
519 ExecutionModulesListener executionModulesListener
,
520 Map
<String
, String
> properties
) {
521 executionModulesListeners
.remove(executionModulesListener
);
525 * INTERFACE IMPLEMENTATIONS
528 public void bundleChanged(BundleEvent evt
) {
529 Bundle bundle
= evt
.getBundle();
530 if (bundle
.getHeaders().get(
531 ExecutionModuleDescriptor
.SLC_EXECUTION_MODULE
) != null) {
532 OsgiBundle osgiBundle
= new OsgiBundle(bundle
);
533 if (evt
.getType() == BundleEvent
.INSTALLED
)
534 for (ExecutionModulesListener listener
: executionModulesListeners
)
535 listener
.executionModuleAdded(osgiBundle
536 .getModuleDescriptor());
537 else if (evt
.getType() == BundleEvent
.UNINSTALLED
)
538 for (ExecutionModulesListener listener
: executionModulesListeners
)
539 listener
.executionModuleRemoved(osgiBundle
540 .getModuleDescriptor());
545 @SuppressWarnings({ "rawtypes" })
546 public synchronized void bind(Object service
, Map properties
)
548 if (service
instanceof ExecutionFlowDescriptorConverter
) {
549 ExecutionFlowDescriptorConverter executionFlowDescriptorConverter
= (ExecutionFlowDescriptorConverter
) service
;
550 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
551 executionFlowDescriptorConverters
.put(osgiBundle
,
552 executionFlowDescriptorConverter
);
553 if (log
.isTraceEnabled())
554 log
.debug("Registered execution flow descriptor converter from "
561 @SuppressWarnings("rawtypes")
562 public synchronized void unbind(Object service
, Map properties
)
564 if (service
instanceof ExecutionFlowDescriptorConverter
) {
565 OsgiBundle osgiBundle
= asOsgiBundle(properties
);
566 if (executionFlowDescriptorConverters
.containsKey(osgiBundle
)) {
567 executionFlowDescriptorConverters
.remove(osgiBundle
);
568 if (log
.isTraceEnabled())
569 log
.debug("Removed execution flow descriptor converter from "
580 protected MBeanServer
getMBeanServer() {
581 return ManagementFactory
.getPlatformMBeanServer();
584 public void registerMBean(Module module
, ExecutionFlow executionFlow
) {
586 StandardMBean mbean
= new StandardMBean(executionFlow
,
587 ExecutionFlow
.class);
588 getMBeanServer().registerMBean(mbean
,
589 flowMBeanName(module
, executionFlow
));
590 } catch (Exception e
) {
591 String msg
= "Cannot register execution flow " + executionFlow
593 throw new SlcException(msg
, e
);
597 public void unregisterMBean(Module module
, ExecutionFlow executionFlow
) {
599 getMBeanServer().unregisterMBean(
600 flowMBeanName(module
, executionFlow
));
601 } catch (Exception e
) {
602 String msg
= "Cannot unregister execution flow " + executionFlow
604 throw new SlcException(msg
, e
);
608 @SuppressWarnings("deprecation")
609 protected ObjectName
flowMBeanName(Module module
,
610 ExecutionFlow executionFlow
) {
611 String executionModulesPrefix
= "SLCExecutionModules";
612 String path
= executionFlow
.getPath();
613 String name
= executionFlow
.getName();
614 if (path
== null && name
.indexOf('/') >= 0) {
615 path
= name
.substring(0, name
.lastIndexOf('/'));
616 name
= name
.substring(name
.lastIndexOf('/'));
619 StringBuffer buf
= new StringBuffer(executionModulesPrefix
+ ":"
620 + "module=" + module
.getName() + " [" + module
.getVersion()
623 if (path
!= null && !path
.equals("")) {
625 for (String token
: path
.split("/")) {
626 if (!token
.equals("")) {
627 buf
.append("path").append(depth
).append('=');
628 // in order to have directories first
630 buf
.append(token
).append(',');
635 buf
.append("name=").append(name
);
637 return new ObjectName(buf
.toString());
638 } catch (Exception e
) {
639 throw new SlcException("Cannot generate object name based on "
647 @SuppressWarnings("rawtypes")
648 private OsgiBundle
asOsgiBundle(Map properties
) {
649 String bundleSymbolicName
= checkAndGet(Constants
.BUNDLE_SYMBOLICNAME
,
651 String bundleVersion
= checkAndGet(Constants
.BUNDLE_VERSION
, properties
);
652 return new OsgiBundle(bundleSymbolicName
, bundleVersion
);
655 @SuppressWarnings("rawtypes")
656 private String
checkAndGet(Object key
, Map properties
) {
657 if (!properties
.containsKey(key
) || properties
.get(key
) == null)
658 throw new SlcException(key
+ " not set in " + properties
);
660 return properties
.get(key
).toString();
663 public void setBundlesManager(BundlesManager bundlesManager
) {
664 this.bundlesManager
= bundlesManager
;
667 public void setDefaultDescriptorConverter(
668 ExecutionFlowDescriptorConverter defaultDescriptorConverter
) {
669 this.defaultDescriptorConverter
= defaultDescriptorConverter
;
672 public void setRegisterFlowsToJmx(Boolean registerFlowsToJmx
) {
673 this.registerFlowsToJmx
= registerFlowsToJmx
;