Builds a GroundyTask based on call.

@param taskClass groundy value implementation class
@param context used to instantiate the value
@return An instance of a GroundyTask if a given call is valid null otherwise
338254
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) {
    if (CACHE.containsKey(taskClass)) {
      return CACHE.get(taskClass);
    }
    GroundyTask groundyTask = null;
    try {
      L.d(TAG, "Instantiating " + taskClass);
      Constructor ctc = taskClass.getConstructor();
      groundyTask = (GroundyTask) ctc.newInstance();
      if (groundyTask.canBeCached()) {
        CACHE.put(taskClass, groundyTask);
      } else if (CACHE.containsKey(taskClass)) {
        CACHE.remove(taskClass);
      }
      groundyTask.setContext(context);
      groundyTask.onCreate();
      return groundyTask;
    } catch (Exception e) {
      L.e(TAG, "Unable to create value for call " + taskClass, e);
    }
    return groundyTask;
  }
523540
@Override
	public TaskBase getTask(ProcessDefinition pd, long taskId) {
		for (TaskBase task: pd.getTasks()) {
			if (task.getTaskId() == taskId) {
				return task;
			}
		}
		return null;
	}
956602
function create(context) {
    return {
        CallExpression(node) {
            if (isRequireCall(node) && ancestor(isConditional, node)) {
                context.report(node, message);
            }
        }
    };
}
73647
@GET
  @Path("{taskName}")
  public Response enqueueTask(@PathParam("taskName") String taskName) {
    checkNotNull(taskName);
    taskQueue.enqueueTask(taskName, requestParamsProvider.get());
    return Response.ok().build();
  }
649747
public boolean isContextSupported(Class<? extends WorkContext> workContextClass)
   {
      if (workContextClass == null)
         return false;

      return supportedContexts.contains(workContextClass);
   }
197615
static public BagObject resource (Class context, String name) {
        return resource (context, name, () -> null);
    }
1362624
@Override
    protected List<Driver> createDrivers(TaskContext taskContext)
    {
        ImmutableList.Builder<OperatorFactory> driversBuilder = ImmutableList.builder();
        driversBuilder.add(ordersTableScan);
        List<Type> sourceTypes = ordersTableTypes;
        OptionalInt hashChannel = OptionalInt.empty();
        if (hashEnabled) {
            driversBuilder.add(createHashProjectOperator(1, new PlanNodeId("test"), sourceTypes));
            sourceTypes = ImmutableList.<Type>builder()
                    .addAll(sourceTypes)
                    .add(BIGINT)
                    .build();
            hashChannel = OptionalInt.of(sourceTypes.size() - 1);
        }

        // hash build
        JoinBridgeManager<PartitionedLookupSourceFactory> lookupSourceFactoryManager = JoinBridgeManager.lookupAllAtOnce(new PartitionedLookupSourceFactory(
                sourceTypes,
                ImmutableList.of(0, 1).stream()
                        .map(sourceTypes::get)
                        .collect(toImmutableList()),
                Ints.asList(0).stream()
                        .map(sourceTypes::get)
                        .collect(toImmutableList()),
                1,
                requireNonNull(ImmutableMap.of(), "layout is null"),
                false));
        HashBuilderOperatorFactory hashBuilder = new HashBuilderOperatorFactory(
                2,
                new PlanNodeId("test"),
                lookupSourceFactoryManager,
                ImmutableList.of(0, 1),
                Ints.asList(0),
                hashChannel,
                Optional.empty(),
                Optional.empty(),
                ImmutableList.of(),
                1_500_000,
                new PagesIndex.TestingFactory(false),
                false,
                SingleStreamSpillerFactory.unsupportedSingleStreamSpillerFactory());
        driversBuilder.add(hashBuilder);
        DriverFactory hashBuildDriverFactory = new DriverFactory(0, true, false, driversBuilder.build(), OptionalInt.empty(), UNGROUPED_EXECUTION);

        // join
        ImmutableList.Builder<OperatorFactory> joinDriversBuilder = ImmutableList.builder();
        joinDriversBuilder.add(lineItemTableScan);
        sourceTypes = lineItemTableTypes;
        hashChannel = OptionalInt.empty();
        if (hashEnabled) {
            joinDriversBuilder.add(createHashProjectOperator(1, new PlanNodeId("test"), sourceTypes));
            sourceTypes = ImmutableList.<Type>builder()
                    .addAll(sourceTypes)
                    .add(BIGINT)
                    .build();
            hashChannel = OptionalInt.of(sourceTypes.size() - 1);
        }

        OperatorFactory joinOperator = LOOKUP_JOIN_OPERATORS.innerJoin(
                2,
                new PlanNodeId("test"),
                lookupSourceFactoryManager,
                sourceTypes,
                Ints.asList(0),
                hashChannel,
                Optional.empty(),
                OptionalInt.empty(),
                unsupportedPartitioningSpillerFactory());
        joinDriversBuilder.add(joinOperator);
        joinDriversBuilder.add(new NullOutputOperatorFactory(3, new PlanNodeId("test")));
        DriverFactory joinDriverFactory = new DriverFactory(1, true, true, joinDriversBuilder.build(), OptionalInt.empty(), UNGROUPED_EXECUTION);

        Driver hashBuildDriver = hashBuildDriverFactory.createDriver(taskContext.addPipelineContext(0, true, false, false).addDriverContext());
        hashBuildDriverFactory.noMoreDrivers();
        Driver joinDriver = joinDriverFactory.createDriver(taskContext.addPipelineContext(1, true, true, false).addDriverContext());
        joinDriverFactory.noMoreDrivers();

        return ImmutableList.of(hashBuildDriver, joinDriver);
    }
614722
public static AppMethodInfo[] getAppMethodsCalled(String basePath, final String templateName,
            final String contextClass) {

        final HashMap<AppMethodInfo, AppMethodInfo> methodsCalledMap =
            new HashMap<AppMethodInfo, AppMethodInfo>();

        try {
            File templatePath = new File(new File(basePath),
                templateName.replace('.', '/') + ".class");
            if (!templatePath.exists() &&
                    templateName.startsWith(TEMPLATE_PACKAGE)) {
                templatePath = new File(new File(basePath),
                    templateName.substring(TEMPLATE_PACKAGE.length()).
                    replace('.','/') + ".class");
            }

            final MethodInfo executeMethod = getTemplateExecuteMethod(new FileInputStream(templatePath));

            CodeDisassembler cd = new CodeDisassembler(executeMethod);
            cd.disassemble(new CodeAssemblerPrinter(executeMethod
                .getMethodDescriptor().getParameterTypes(), true, null) {

                 public void invokeVirtual(String className, String methodName,
                         TypeDesc ret, TypeDesc[] params)  {
                     if ("print".equals(methodName) ||
                             "toString".equals(methodName) ||
                             "equals".equals(methodName) ||
                             (contextClass.indexOf(className) == -1 &&
                             className.indexOf("MergedClass") == -1))
                         return;

                     AppMethodInfo ami = new AppMethodInfo(methodName, params);
                     if (! methodsCalledMap.containsKey(ami))
                         methodsCalledMap.put(ami, ami);
                     else
                         methodsCalledMap.get(ami).incCallCount();
                 }

                 public void println(String s) { } // Do nothing
            });

            final MethodInfo substituteMethod = getTemplateSubstituteMethod(new FileInputStream(templatePath));

            if (substituteMethod == null)
                return methodsCalledMap.values().toArray(
                    new AppMethodInfo[methodsCalledMap.values().size()]);

            // check the substitute methods on this template
            cd = new CodeDisassembler(substituteMethod);
            cd.disassemble(new CodeAssemblerPrinter(substituteMethod
                .getMethodDescriptor().getParameterTypes(), true, null) {

                 public void invokeVirtual(String className, String methodName,
                         TypeDesc ret, TypeDesc[] params)  {
                     if ("print".equals(methodName) ||
                             "toString".equals(methodName) ||
                             "equals".equals(methodName) ||
                             (contextClass.indexOf(className) == -1 &&
                             className.indexOf("MergedClass") == -1))
                         return;

                     AppMethodInfo ami = new AppMethodInfo(methodName, params);
                     if (! methodsCalledMap.containsKey(ami))
                         methodsCalledMap.put(ami, ami);
                     else
                         methodsCalledMap.get(ami).incCallCount();
                 }

                 public void println(String s) { } // Do nothing
            });
        }
        catch (IOException ix) {
            return new AppMethodInfo[0];
        }

        return methodsCalledMap.values().toArray(
            new AppMethodInfo[methodsCalledMap.values().size()]);
    }
1010288
public Object start(IApplicationContext context) {
		Display display = PlatformUI.createDisplay();
		try {
/* FIXME: the static Sisu.lookup utility is currently being reworked...
			int returnCode = PlatformUI.createAndRunWorkbench(display, Sisu.lookup(WorkbenchAdvisor.class));
			if (returnCode == PlatformUI.RETURN_RESTART) {
				return IApplication.EXIT_RESTART;
			}
*/
			return IApplication.EXIT_OK;
		} finally {
			display.dispose();
		}
	}
1197539
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
        if (!isActive()) {
            throw new ContextNotActiveException();
        }
        if (creationalContext != null) {
            T instance = contextual.create(creationalContext);
            if (creationalContext instanceof WeldCreationalContext<?>) {
                addDependentInstance(instance, contextual, (WeldCreationalContext<T>) creationalContext);
            }
            return instance;
        } else {
            return null;
        }
    }
1102699
protected DriverContext buildContext(
      DriverConfigLoader configLoader,
      List<TypeCodec<?>> typeCodecs,
      NodeStateListener nodeStateListener,
      SchemaChangeListener schemaChangeListener,
      RequestTracker requestTracker,
      Map<String, String> localDatacenters,
      Map<String, Predicate<Node>> nodeFilters,
      ClassLoader classLoader) {
    return new DefaultDriverContext(
        configLoader,
        typeCodecs,
        nodeStateListener,
        schemaChangeListener,
        requestTracker,
        localDatacenters,
        nodeFilters,
        classLoader);
  }
373045
private void buildReport(Context context) {
        try {
            buildBaseReport();
            buildApplicationData(context);
            buildDeviceData(context);
            buildLog();
            report.put("application", app);
            report.put("device", device);
            report.put("log", logs);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
387694
public HttpSessionTokensSet getHttpSessionTokensSetForContext(Context context){
		//TODO: Proper implementation. Hack for now
		for (Entry<String, HttpSessionTokensSet> e : this.sessionTokens.entrySet()) {
			String siteName = e.getKey();
			siteName = "http://" + siteName;
			if (context.isInContext(siteName))
				return e.getValue();
		}
		return null;
	}
555205
def spawn(self, context=None):
        
        if context is None:
            context = self.default_context

        if isinstance(context, collections.Callable):
            context = context()

        if not isinstance(context, collections.Mapping):
            raise PatchboardError('Cannot determine a valid context')

        return Client(self, context, self.api, self.endpoint_classes)
959209
public synchronized void startup(AppContextWrapper context) {
		ContainerRegistryBuilder cb;
		try {
			cb = (ContainerRegistryBuilder) context.getAttribute(ContainerRegistryBuilder.APPLICATION_CONTEXT_ATTRIBUTE_NAME);
			if (cb == null) {
				Debug.logError("[JdonFramework] at first call prepare method");
				return;
			}
			if (cb.isKernelStartup())
				return;
			ContainerDirector cd = new ContainerDirector(cb);
			cd.startup();
		} catch (Exception ex) {
			Debug.logError(ex, module);
		}
	}
461770
def get_task_cls(cls, name):
        
        task_cls = cls._get_reg().get(name)
        if not task_cls:
            raise TaskClassNotFoundException(cls._missing_task_msg(name))

        if task_cls == cls.AMBIGUOUS_CLASS:
            raise TaskClassAmbigiousException('Task %r is ambiguous' % name)
        return task_cls
287827
public static void build(final RuleBuildContext context) {
        RuleDescr ruleDescr = context.getRuleDescr();

        final RuleConditionBuilder builder = (RuleConditionBuilder) context.getDialect().getBuilder( ruleDescr.getLhs().getClass() );
        if ( builder != null ) {
            Pattern prefixPattern = context.getPrefixPattern(); // this is established during pre-processing, if it's query
            final GroupElement ce = (GroupElement) builder.build( context,
                                                                  getLhsForRuleUnit( context.getRule(), ruleDescr.getLhs() ),
                                                                  prefixPattern );

            context.getRule().setLhs( ce );
        } else {
            throw new RuntimeException( "BUG: builder not found for descriptor class " + ruleDescr.getLhs().getClass() );
        }

        // build all the rule's attributes
        // must be after building LHS because some attributes require bindings from the LHS
        buildAttributes( context );

        // Build the consequence and generate it's invoker/s
        // generate the main rule from the previously generated s.
        if ( !(ruleDescr instanceof QueryDescr) ) {
            // do not build the consequence if we have a query

            ConsequenceBuilder consequenceBuilder = context.getDialect().getConsequenceBuilder();
            consequenceBuilder.build( context, RuleImpl.DEFAULT_CONSEQUENCE_NAME );
            
            for ( String name : ruleDescr.getNamedConsequences().keySet() ) {
                consequenceBuilder.build( context, name );
            }
        }
    }