public static ExtensibilityElement getBindingExtension(Binding binding) { Collection bindings = new ArrayList(); CollectionsX.filter(bindings, binding.getExtensibilityElements(), HTTPBinding.class); CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAPBinding.class); CollectionsX.filter(bindings, binding.getExtensibilityElements(), SOAP12Binding.class); if (bindings.size() == 0) { return null; } else if (bindings.size() > 1) { // exception if multiple bindings found throw new IllegalArgumentException("Multiple bindings: " + binding.getQName()); } else { // retrieve the single element return (ExtensibilityElement) bindings.iterator().next(); } }
public void run() { __log.debug("Starting process definition reaper thread."); long pollingTime = 10000; try { while (true) { Thread.sleep(pollingTime); if (!_mngmtLock.writeLock().tryLock(100L, TimeUnit.MILLISECONDS)) continue; try { __log.debug("Kicking reaper, OProcess instances: " + OProcess.instanceCount); // Copying the runnning process list to avoid synchronization // problems and a potential mess if a policy modifies the list List<BpelProcess> candidates = new ArrayList<BpelProcess>(_registeredProcesses); CollectionsX.remove_if( candidates, new MemberOfFunction<BpelProcess>() { public boolean isMember(BpelProcess o) { return !o.hintIsHydrated(); } }); // And the happy winners are... List<BpelProcess> ripped = _dehydrationPolicy.markForDehydration(candidates); // Bye bye for (BpelProcess process : ripped) { __log.debug("Dehydrating process " + process.getPID()); process.dehydrate(); } } finally { _mngmtLock.writeLock().unlock(); } } } catch (InterruptedException e) { __log.debug(e); } }
public void run() { __log.debug("Starting process definition reaper thread."); long pollingTime = 10000; try { while (true) { Thread.sleep(pollingTime); // Copying the runnning process list to avoid synchronizatMessageExchangeInterion // problems and a potential mess if a policy modifies the list List<ODEProcess> candidates = new ArrayList<ODEProcess>(_registeredProcesses.values()); CollectionsX.remove_if( candidates, new MemberOfFunction<ODEProcess>() { public boolean isMember(ODEProcess o) { return !o.hintIsHydrated(); } }); // And the happy winners are... List<ODEProcess> ripped = _dehydrationPolicy.markForDehydration(candidates); // Bye bye for (ODEProcess process : ripped) { __log.debug("Dehydrating process " + process.getPID()); process.dehydrate(); } } } catch (InterruptedException e) { __log.info(e); } }
@SuppressWarnings("unchecked") public List<BpelEvent> listEvents() { entering("ScopeDaoImpl.listEvents"); // CriteriaBuilder cb = new CriteriaBuilder(); Criteria crit = _sm.getSession().createCriteria(HBpelEvent.class); // if (efilter != null) // cb.buildCriteria(crit, efilter); crit.add(Restrictions.eq("scopeId", _scope.getId())); List<HBpelEvent> hevents = crit.list(); List<BpelEvent> ret = new ArrayList<BpelEvent>(hevents.size()); try { CollectionsX.transformEx( ret, hevents, new UnaryFunctionEx<HBpelEvent, BpelEvent>() { public BpelEvent apply(HBpelEvent x) throws Exception { return (BpelEvent) SerializableUtils.toObject(x.getData(), BpelEvent.class.getClassLoader()); } }); } catch (Exception ex) { throw new RuntimeException(ex); } return ret; }
public Collection<QName> getPropertyNames() { return CollectionsX.transform( new ArrayList<QName>(), _properties.keySet(), new UnaryFunction<String, QName>() { public QName apply(String x) { return QName.valueOf(x); } }); }
public List<Date> bpelEventTimelineQuery(InstanceFilter ifilter, BpelEventFilter efilter) { // TODO : Provide more correct implementation: ArrayList<Date> dates = new ArrayList<Date>(); CollectionsX.transform( dates, _events, new UnaryFunction<BpelEvent, Date>() { public Date apply(BpelEvent x) { return x.getTimestamp(); } }); return dates; }
@SuppressWarnings("unchecked") public Collection<XmlDataDAO> getVariables() { entering("ScopeDaoImpl.getVariables"); Query q = getSession().createFilter(_scope.getVariables(), "where this.scope=?"); q.setEntity(0, _scope); return CollectionsX.transform( new LinkedList<XmlDataDAO>(), (Collection<HXmlData>) q.list(), new UnaryFunction<HXmlData, XmlDataDAO>() { public XmlDataDAO apply(HXmlData x) { return new XmlDataDaoImpl(_sm, x); } }); }
@SuppressWarnings("unchecked") public Collection<ScopeDAO> getChildScopes() { entering("ScopeDaoImpl.getChildScopes"); Query q = getSession().createQuery("from " + HScope.class.getName() + " as x where x.parentScope=?"); q.setEntity(0, _scope); Collection<HScope> hscopes = q.list(); return CollectionsX.transform( new LinkedList<ScopeDAO>(), hscopes, new UnaryFunction<HScope, ScopeDAO>() { public ScopeDAO apply(HScope x) { return new ScopeDaoImpl(_sm, x); } }); }
public static <T> T getFirstExtensibilityElement(ElementExtensible parent, Class<T> cls) { Collection<T> ee = CollectionsX.filter(parent.getExtensibilityElements(), cls); return ee.isEmpty() ? null : ee.iterator().next(); }