/** * @return modifiable map of parameters (never <code>null</code>) * @throws AssertionError * if {@link #parse(String)} was not called before */ public Map<String, String> getParameters() { Assertions.assertTrue(m_parsed, "Not parsed yet"); return m_parameters; } }
/** * @throws AssertionError * if {@link #parse(String)} was not called before */ public IResolveMethod getResolveMethod() { Assertions.assertTrue(m_parsed, "Not parsed yet"); return m_resolveMethod; }
protected void assertWritable() { Assertions.assertTrue(m_writable, "This JSON response was already sent to the UI and is no longer writable!"); }
/** * @throws AssertionError * if {@link #parse(String)} was not called before */ public String getDestinationName() { Assertions.assertTrue(m_parsed, "Not parsed yet"); return m_destinationName; }
public void initialize(String name, int poolSize, long connectionLifetime, long connectionBusyTimeout) { Assertions.assertTrue(m_initialized.compareAndSet(false, true), "already initialized"); m_name = name; m_poolSize = poolSize; m_connectionLifetime = connectionLifetime; m_connectionBusyTimeout = connectionBusyTimeout; startManagePool(); }
@Override public void deleteTemporaryQueue() throws JMSException { Assertions.assertTrue(m_closing, "deleteTemporaryQueue can only be called on a closing session provider."); if (m_temporaryQueue != null) { m_temporaryQueue.delete(); } }
protected void validate(final RequestType requestType, JSONObject request) { // Ensure request contains an UI session ID, except for the startup and the ping request if (!ObjectUtility.isOneOf(requestType, RequestType.STARTUP_REQUEST, RequestType.PING_REQUEST)) { Assertions.assertTrue(request.has(PROP_UI_SESSION_ID), "Missing property '{}' in request {}", PROP_UI_SESSION_ID, request); } // Only normal /json requests may send events. if (requestType != RequestType.REQUEST && request.has(PROP_EVENTS)) { request.remove(PROP_EVENTS); String requestAsString = request.toString(); if (requestAsString.length() > 10000) { // Truncate the message to prevent log inflation by malicious requests requestAsString = requestAsString.substring(0, 10000) + "..."; } LOG.info("Request contains unexpected attribute '{}': {}", PROP_EVENTS, requestAsString); } }
public void processEvents(final JsonRequest request, final JsonResponse response) { Assertions.assertTrue(ModelJobs.isModelThread(), "Event processing must be called from the model thread [currentThread={}, request={}, response={}]", Thread.currentThread().getName(), request, response); for (final JsonEvent event : request.getEvents()) { processEvent(event, response); } }
/** * @return never <code>null</code> * @throws AssertionException * if object was not initialized using {@link #init(String)} */ public String getUserAgent() { Assertions.assertTrue(m_userAgent.isSet()); return m_userAgent.get(); }
public JmsTransactionMember withSessionProvider(IJmsSessionProvider sessionProvider) throws JMSException { m_sessionProvider = sessionProvider; m_transactedSession = sessionProvider.getSession(); assertNotNull(m_transactedSession); assertTrue(m_transactedSession.getTransacted()); return this; }
public static void removeField(IFormField f, ICompositeField compositeField, List<IFormField> fields) { assertNotNull(fields); assertNotNull(f, "field must not be null"); boolean removed = fields.remove(f); assertTrue(removed, "field is not part of container '{}'.", compositeField); connectFields(f, null); if (f.isInitConfigDone()) { f.dispose(); } }
/** * Validates the given {@link RunContext} to be valid for model jobs. */ public void validateRunContext(final RunContext runContext) { Assertions.assertTrue(runContext instanceof ClientRunContext, "A model job requires a ClientRunContext"); Assertions.assertNotNull(((ClientRunContext) runContext).getSession(), "A model job requires a ClientSession in the ClientRunContext"); Assertions.assertEquals(1, ((ClientRunContext) runContext).getSession().getModelJobSemaphore().getPermits(), "A model job requires a semaphore with permit size 1 for mutual exclusion"); }
@Override public <REQUEST, REPLY> ISubscription reply(final IBiDestination<REQUEST, REPLY> destination, final IRequestListener<REQUEST, REPLY> listener, final SubscribeInput input) { assertTrue(m_requestReplyEnabled, "'request-reply' messaging is not enabled for this MOM"); assertNotNull(destination, "destination not specified"); assertNotNull(listener, "messageListener not specified"); assertNotNull(input, "input not specified"); try { ensureRequestCancellationSubscription(); return replyImpl(destination, listener, input); } catch (final JMSException e) { throw BEANS.get(DefaultRuntimeExceptionTranslator.class).translate(e); } }
public static void addField(IFormField f, ICompositeField compositeField, List<IFormField> fields) { assertNotNull(f); assertNotNull(compositeField); assertNotNull(fields); assertNull(f.getParentField(), "field is already contained in '{}'.", f.getParentField()); Assertions.assertTrue(f.getForm() == null || f.getForm() == compositeField.getForm(), "field is part of a different form, '{}' instead of '{}'", f.getForm(), compositeField.getForm()); fields.add(f); fields.sort(new OrderedComparator()); connectFields(f, compositeField); if (compositeField.isInitConfigDone()) { f.init(); FormUtility.rebuildFieldGrid(compositeField); } }
/** * Instructs the job manager that the current model job is willing to temporarily yield its current model job permit. * <p> * It is rarely appropriate to use this method. It may be useful for debugging or testing purposes. */ public static void yield() { Assertions.assertTrue(isModelThread(), "'Yield' must be invoked from model thread"); final IBlockingCondition idleCondition = Jobs.newBlockingCondition(true); schedule(NULL_RUNNABLE, newInput(ClientRunContexts.copyCurrent()) .withName("Technical job to yield model thread")) .whenDone(event -> idleCondition.setBlocking(false), ClientRunContexts.copyCurrent()); // Release the current model job permit and wait until all competing model jobs of this session completed their work. idleCondition.waitFor(); }
@Override public <REQUEST, REPLY> REPLY request(final IBiDestination<REQUEST, REPLY> destination, final REQUEST requestObject, final PublishInput input) { assertTrue(m_requestReplyEnabled, "'request-reply' messaging is not enabled for this MOM"); assertNotNull(destination, "destination not specified"); assertNotNull(input, "publishInput not specified");