Examples of ExecutionContext


Examples of org.apache.karaf.cellar.core.command.ExecutionContext

        }

        producers.put(endpoint.getId(), requestProducer);
        consumers.put(endpoint.getId(), resultConsumer);

        ExecutionContext executionContext = new ClusteredExecutionContext(requestProducer,commandStore);

        RemoteServiceFactory remoteServiceFactory = new RemoteServiceFactory(endpoint, clusterManager, executionContext);
        ServiceRegistration registration = listenerInfo.getBundleContext().registerService(endpoint.getServiceClass(),
                remoteServiceFactory,
                new Hashtable<String, Object>(endpoint.getProperties()));
View Full Code Here

Examples of org.apache.log4j.joran.spi.ExecutionContext

  protected void doConfigure(final ParseAction action, final LoggerRepository repository) {
    // This line is needed here because there is logging from inside this method.
    this.repository = repository;
    selfInitialize(this.repository);
   
    ExecutionContext ec = joranInterpreter.getExecutionContext();
    List errorList = ec.getErrorList();

    SAXParser saxParser = null;
    try {
        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setValidating(false);
        spf.setNamespaceAware(true);
        saxParser = spf.newSAXParser();
    } catch (Exception pce) {
      final String errMsg = "Parser configuration error occured";
      getLogger(repository).error(errMsg, pce);
      ec.addError(new ErrorItem(errMsg, pce));
      return;
    }
   
    JoranDocument document = new JoranDocument(errorList, repository);
   
    try {
        action.parse(saxParser, document);
    } catch(IOException ie) {
      final String errMsg = "I/O error occured while parsing xml file";
      getLogger(repository).error(errMsg, ie);
      ec.addError(new ErrorItem(errMsg, ie));
    } catch (Exception ex) {
      final String errMsg = "Problem parsing XML document. See previously reported errors. Abandoning all further processing.";
      getLogger(repository).error(errMsg, ex);
      errorList.add(
        new ErrorItem(errMsg));
      return;
    }
   
    ec.pushObject(repository);
    String errMsg;
    try {
      attachListAppender(repository);
     
      document.replay(joranInterpreter);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.common.function.type4.ExecutionContext

    * {@inheritDoc}
    */
    public float[] eval(float[] input) throws IOException
    {
        //Setup the input values
        ExecutionContext context = new ExecutionContext(OPERATORS);
        for (int i = 0; i < input.length; i++)
        {
            PDRange domain = getDomainForInput(i);
            float value = clipToRange(input[i], domain.getMin(), domain.getMax());
            context.getStack().push(value);
        }

        //Execute the type 4 function.
        instructions.execute(context);

        //Extract the output values
        int numberOfOutputValues = getNumberOfOutputParameters();
        int numberOfActualOutputValues = context.getStack().size();
        if (numberOfActualOutputValues < numberOfOutputValues)
        {
            throw new IllegalStateException("The type 4 function returned "
                    + numberOfActualOutputValues
                    + " values but the Range entry indicates that "
                    + numberOfOutputValues + " values be returned.");
        }
        float[] outputValues = new float[numberOfOutputValues];
        for (int i = numberOfOutputValues - 1; i >= 0; i--)
        {
            PDRange range = getRangeForOutput(i);
            outputValues[i] = context.popReal();
            outputValues[i] = clipToRange(outputValues[i], range.getMin(), range.getMax());
        }

        //Return the resulting array
        return outputValues;
View Full Code Here

Examples of org.apache.xbean.recipe.ExecutionContext

    private Object getReference() {
        if (referenceName == null) {
            throw new ConstructionException("Reference name has not been set");
        }
        ExecutionContext context = ExecutionContext.getContext();
        if (!context.containsObject(referenceName)) {
            throw new NoSuchObjectException(referenceName);
        }
        return context.getObject(referenceName);
    }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.context.ExecutionContext

    return new CdiBusinessProcessEvent(execution.getCurrentActivityId(), execution.getCurrentTransitionId(), processDefinition, execution, type, ClockUtil.getCurrentTime());
  }

  protected BusinessProcessEvent createEvent(DelegateTask task) {
    ExecutionContext executionContext = Context.getExecutionContext();
    ProcessDefinitionEntity processDefinition = null;
    if (executionContext != null) {
      processDefinition = executionContext.getProcessDefinition();
    }

    // map type
    String eventName = task.getEventName();
    BusinessProcessEventType type = null;
View Full Code Here

Examples of org.datanucleus.ExecutionContext

     * Method to be called after the insert of the owner class element.
     * @param ownerOP ObjectProvider of the owner
     */
    public void postInsert(ObjectProvider ownerOP)
    {
        ExecutionContext ec = ownerOP.getExecutionContext();
        java.util.Map value = (java.util.Map) ownerOP.provideField(getAbsoluteFieldNumber());
        if (containerIsStoredInSingleColumn())
        {
            // Do nothing when serialised since we are handled in the main request
            if (value != null)
            {
                // Make sure the keys/values are ok for proceeding
                SCOUtils.validateObjectsForWriting(ec, value.keySet());
                SCOUtils.validateObjectsForWriting(ec, value.values());
            }
            return;
        }

        if (value == null)
        {
            // replace null map with an empty SCO wrapper
            replaceFieldWithWrapper(ownerOP, null, false, false);
            return;
        }

        if (!mmd.isCascadePersist())
        {
            // Field doesnt support cascade-persist so no reachability
            if (NucleusLogger.PERSISTENCE.isDebugEnabled())
            {
                NucleusLogger.PERSISTENCE.debug(LOCALISER.msg("007006", mmd.getFullFieldName()));
            }

            // Check for any persistable keys/values that arent persistent
            ApiAdapter api = ec.getApiAdapter();
            Set entries = value.entrySet();
            Iterator iter = entries.iterator();
            while (iter.hasNext())
            {
                Map.Entry entry = (Map.Entry)iter.next();
View Full Code Here

Examples of org.datanucleus.store.ExecutionContext

     * Method to return an iterator to the array.
     * @param ownerSM StateManager for the owner of the array
     */
    public Iterator iterator(ObjectProvider ownerSM)
    {
        ExecutionContext ec = ownerSM.getExecutionContext();
        if (iteratorStmtLocked == null)
        {
            synchronized (this) // Make sure this completes in case another thread needs the same info
            {
                // Generate the statement, and statement mapping/parameter information
                SQLStatement sqlStmt = getSQLStatementForIterator(ownerSM);
                iteratorStmtUnlocked = sqlStmt.getSelectStatement().toSQL();
                sqlStmt.addExtension("lock-for-update", true);
                iteratorStmtLocked = sqlStmt.getSelectStatement().toSQL();
            }
        }

        Transaction tx = ec.getTransaction();
        String stmt = (tx.lockReadObjects() ? iteratorStmtLocked : iteratorStmtUnlocked);
        try
        {
            ManagedConnection mconn = storeMgr.getConnection(ec);
            SQLController sqlControl = ((RDBMSStoreManager)storeMgr).getSQLController();
View Full Code Here

Examples of org.datanucleus.store.ExecutionContext

        String removeAllStmt = getRemoveAllStmt(elements, ecs);
        SQLController sqlControl = storeMgr.getSQLController();
        try
        {
            ExecutionContext ec = sm.getExecutionContext();
            ManagedConnection mconn = storeMgr.getConnection(ec);
            try
            {
                PreparedStatement ps = sqlControl.getStatementForUpdate(mconn, removeAllStmt, false);
                try
                {
                    int jdbcPosition = 1;
                    Iterator iter = elements.iterator();
                    while (iter.hasNext())
                    {
                        Object element = iter.next();
                        jdbcPosition = BackingStoreHelper.populateOwnerInStatement(sm, ec, ps, jdbcPosition, ecs);
                        jdbcPosition = BackingStoreHelper.populateElementInStatement(ec, ps, element, jdbcPosition, elementMapping);
                        if (relationDiscriminatorMapping != null)
                        {
                            jdbcPosition =
                                BackingStoreHelper.populateRelationDiscriminatorInStatement(ec, ps, jdbcPosition, ecs);
                        }
                    }

                    int[] number = sqlControl.executeStatementUpdate(mconn, removeAllStmt, ps, true);
                    if (number[0] > 0)
                    {
                        modified = true;
                    }
                }
                finally
                {
                    sqlControl.closeStatement(mconn, ps);
                }
            }
            finally
            {
                mconn.release();
            }
        }
        catch (SQLException e)
        {
            NucleusLogger.DATASTORE.error(e);
            throw new NucleusDataStoreException(localiser.msg("056012", removeAllStmt), e);
        }

        try
        {
            // Shift the remaining indices to remove the holes in ordering
            boolean batched = storeMgr.allowsBatching();

            ExecutionContext ec = sm.getExecutionContext();
            ManagedConnection mconn = storeMgr.getConnection(ec);
            try
            {
                for (int i = 0; i < currentListSize; i++)
                {
View Full Code Here

Examples of org.datanucleus.store.ExecutionContext

        JavaTypeMapping relationDiscriminatorMapping = ecs.getRelationDiscriminatorMapping();

        String setStmt = getSetStmt(ecs);
        try
        {
            ExecutionContext ec = sm.getExecutionContext();
            ManagedConnection mconn = ecs.getStoreManager().getConnection(ec);
            SQLController sqlControl = storeMgr.getSQLController();
            try
            {
                PreparedStatement ps = sqlControl.getStatementForUpdate(mconn, setStmt, false);
View Full Code Here

Examples of org.datanucleus.store.ExecutionContext

        }

        String addStmt = getAddStmt(ecs);
        try
        {
            ExecutionContext ec = sm.getExecutionContext();
            ManagedConnection mconn = ecs.getStoreManager().getConnection(ec);
            SQLController sqlControl = storeMgr.getSQLController();
            try
            {
                // Shift any existing elements so that we can insert the new element(s) at their position
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.