region AbstractService Implementation
550464
@Override
    protected void doStart() {
        log.info("{}: Starting.", this.traceObjectId);

        Services.startAsync(this.durableLog, this.executor)
                .thenComposeAsync(v -> startWhenDurableLogOnline(), this.executor)
                .whenComplete((v, ex) -> {
                    if (ex == null) {
                        // We are started and ready to accept requests when DurableLog starts. All other (secondary) services
                        // are not required for accepting new operations and can still start in the background.
                        notifyStarted();
                    } else {
                        doStop(ex);
                    }
                });
    }
1086972
private void doFinish(String mavenHome, int mavenEclipseGoalType, String containerName, int mep, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType, String serviceName, IProgressMonitor monitor) throws CoreException {

		monitor.beginTask("Creating " + serviceName, 5);
		
		final PrintStream ps = new PrintStream(new OutputStream() {
			@Override
			public void write(int b) throws IOException {
//				page3.writeStatusText(b);
				System.err.print(Character.toString((char) b));
			}
		});

		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = root.findMember(new Path(containerName));
		if (!resource.exists() || !(resource instanceof IContainer)) {
			throwCoreException("Container \"" + containerName + "\" does not exist.");
		}
		
		IModel m = extractGroupIdAndArtifactIdFromPom(getPomAsInputStream(resource));
			
		// TODO: Get gid and aid from the pom.xml...
		String groupId = m.getGroupId();
		String artifactId = m.getArtifactId();
		String projectFolderName = resource.getLocation().toOSString();
		File projectFolder = new File(projectFolderName);
		String rootFolderName = projectFolder.toString();
		
//		IContainer container = (IContainer) resource;
//		final IFile file = container.getFile(new Path(serviceName));
//		try {
//			InputStream stream = openContentStream();
//			if (file.exists()) {
//				file.setContents(stream, true, true, monitor);
//			} else {
//				file.create(stream, true, monitor);
//			}
//			stream.close();
//		} catch (IOException e) {
//		}
		
		monitor.worked(1);
		monitor.setTaskName("Generating files...");

		// TODO: Get rid of these hardcoded integers, use the enum ordinal values!
		switch (mep) {
		case 0: // Req Resp
			
			new RequestResponseServiceV2Generator(ps, groupId, artifactId, serviceName, MuleVersionEnum.MAIN_MULE_VERSION, inboundTransport, outboundTransport, transformerType , rootFolderName).startGenerator();
			break;

		case 1: // One Way
			
			new OnewayServiceV2Generator(ps, groupId, artifactId, serviceName, MuleVersionEnum.MAIN_MULE_VERSION, inboundTransport, outboundTransport, transformerType, rootFolderName).startGenerator();
			break;

		case 2: // One Way Robust
			//new OnewayRobustServiceGenerator(ps, groupId, artifactId, serviceName, MuleVersionEnum.MAIN_MULE_VERSION, inboundTransport, outboundTransport, transformerType, rootFolderName).startGenerator();
			break;

//		case 2: // Pub Sub
//			

		default:
			break;
		}
		
//		monitor.setTaskName("Opening file for editing...");
//		getShell().getDisplay().asyncExec(new Runnable() {
//			public void run() {
//				IWorkbenchPage page =
//					PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
//				try {
//					IDE.openEditor(page, file, true);
//				} catch (PartInitException e) {
//				}
//			}
//		});

		monitor.worked(1);

		// TODO issue #345: DataMapper support - we need to run the maven goal "studio:studio" here
		// hardcoded for now
		//if (transformerType == TransformerEnum.EE_DATAMAPPER) {
			//System.err.println("issue #345: HARDCODED maven eclipse goal to studio:stduio for Mule-EE");
			//mavenEclipseGoalType = MavenEclipseGoalEnum.MULESTUDIO_MULESTUDIO.ordinal();
		//}
				
		String buildCommand = "mvn" + (SwtUtil.isWindows() ? ".bat" : "") + " " + MavenEclipseGoalEnum.get(mavenEclipseGoalType).getLabel();

		monitor.setTaskName("Execute command: " + buildCommand);
		try {
			System.err.println("Execute: " + buildCommand + " in folder: " + rootFolderName);
			SystemUtil.executeCommand(mavenHome, buildCommand, rootFolderName, System.out, System.err);
		} catch (IOException ioe) {
			throwCoreException("Failed to create a new component", ioe);
		}
		
		monitor.worked(1);
		monitor.setTaskName("Organize Imports...");
//		doOrganizeImports(resource);

		monitor.worked(1);
		monitor.setTaskName("Refresh workspace...");
		ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);

		monitor.worked(1);
	}
104529
@Override
    public CompletableFuture<RootExecutionResultNode> execute(ExecutionContext context, FieldSubSelection fieldSubSelection) {
        return resolveSubSelection(context, fieldSubSelection)
                .thenApply(RootExecutionResultNode::new);
    }
747433
public static void init(Context contextValue, ExecutorService service) {
		context = contextValue;

		if (service == null) {
			executerService = Executors.newFixedThreadPool(THREAD_POOL_SIZE_DEFAULT);
		} else {
			executerService = service;
		}

	}
672700
function pluginServicesExec(args, context) {
		var result = document.createElement("div"); //$NON-NLS-0$
		var services = args.plugin.getServiceReferences();
		services.forEach(function(service) {
			var current = {values: []};
			var keys = service.getPropertyKeys();
			keys.forEach(function(key) {
				if (key === "service.names") { //$NON-NLS-0$
					current.name = service.getProperty(key).join();
				}
				if (key === "id") {
					current.id = service.getProperty(key);
				}
				current.values.push({name: key, value: service.getProperty(key)});
			});
			if (current.name) {
				current.elementId = "serviceElement" + serviceElementCounter++; //$NON-NLS-0$
				current.values.forEach(function(value) {
					value.elementId = "serviceElement" + serviceElementCounter++; //$NON-NLS-0$
				});
				var parent = document.createElement("div"); //$NON-NLS-0$
				result.appendChild(parent);
				var renderer = new ServicesRenderer();
				var tableTree = new mTreeTable.TableTree({
					model: new ServicesModel(current),
					showRoot: true,
					parent: parent,
					renderer: renderer
				});
				renderer.tableTree = tableTree;
			}
		});
		return result;
	}
54232
public void setGroupLocalService(
		com.liferay.portal.kernel.service.GroupLocalService groupLocalService) {
		this.groupLocalService = groupLocalService;
	}
1241518
protected void processServiceClass(ClassDoc service,
			Configuration configuration) {
		Tag[] serviceTagArray = service.tags(WRTagTaglet.NAME);
		for (int i = 0; i < serviceTagArray.length; i++) {
			Set<String> serviceTags = WRTagTaglet.getTagSet(serviceTagArray[i]
					.text());
			for (Iterator<String> iter = serviceTags.iterator(); iter.hasNext();) {
				String tag = iter.next();
				if (!this.taggedOpenAPIMethods.containsKey(tag)) {
					this.taggedOpenAPIMethods
							.put(tag, new HashSet<MethodDoc>());
				}
				// all method of this service should be processed later.
				for (int j = 0; j < service.methods().length; j++) {
					if (configuration.nodeprecated
							&& Util.isDeprecated(service.methods()[j])) {
						continue;
					}
					this.taggedOpenAPIMethods.get(tag)
							.add(service.methods()[j]);
				}
			}

			this.wrDoc.getWRTags().addAll(serviceTags);
		}
	}
503149
@Override
    protected void doExecute() throws Exception {
        if (skip) {
            return;
        }

        if (features == null) {
            // For liberty-assembly integration:
            // When using installUtility, if no features section was specified, 
            // then don't install features because it requires license acceptance
            noFeaturesSection = true;
            
            // initialize features section for all scenarios except for the above
            features = new Features();
        }

        checkServerHomeExists();
        installFeatures();
    }
656157
private void init() throws RepositoryException, RepositoryConfigurationException
   {
      List<WorkspaceEntry> wsEntries = config.getWorkspaceEntries();

      NodeTypeDataManager typeManager = (NodeTypeDataManager)this.getComponentInstanceOfType(NodeTypeDataManager.class);
      NamespaceRegistryImpl namespaceRegistry =
         (NamespaceRegistryImpl)this.getComponentInstanceOfType(NamespaceRegistry.class);

      for (WorkspaceEntry ws : wsEntries)
      {
         initWorkspace(ws);
         WorkspaceContainer workspaceContainer = getWorkspaceContainer(ws.getName());
         SearchManager searchManager =
            (SearchManager)workspaceContainer.getComponentInstanceOfType(SearchManager.class);
         //         if (searchManager != null)
         //         {
         //            typeManager.addQueryHandler(searchManager.getHandler());
         //            namespaceRegistry.addQueryHandler(searchManager.getHandler());
         //         }
         //         else
         //         {
         //            log.warn("Search manager not configured for " + ws.getName());
         //         }
      }

      SystemSearchManagerHolder searchManager =
         (SystemSearchManagerHolder)this.getComponentInstanceOfType(SystemSearchManagerHolder.class);
      //      if (searchManager != null)
      //      {
      //         typeManager.addQueryHandler(searchManager.get().getHandler());
      //         namespaceRegistry.addQueryHandler(searchManager.get().getHandler());
      //      }
      //      else
      //      {
      //         log.warn("System search manager not configured ");
      //      }

   }
1349045
public void setRegions(java.util.Collection<Region> regions) {
        if (regions == null) {
            this.regions = null;
            return;
        }

        this.regions = new java.util.ArrayList<Region>(regions);
    }
771685
public void collectImports(final XtextResource state, final ITextRegion selectedRegion, final ImportsAcceptor acceptor) {
    ICompositeNode rootNode = state.getParseResult().getRootNode();
    final EObject selectedSemanticObj = this.findActualSemanticObjectFor(rootNode, selectedRegion);
    final Iterable<ILeafNode> contentsIterator = NodeModelUtils.findActualNodeFor(selectedSemanticObj).getLeafNodes();
    for (final ILeafNode node : contentsIterator) {
      {
        final ITextRegion nodeRegion = node.getTotalTextRegion();
        boolean _contains = selectedRegion.contains(nodeRegion);
        if (_contains) {
          final EObject semanticElement = node.getSemanticElement();
          if ((semanticElement != null)) {
            this.visit(semanticElement, NodeModelUtils.findActualNodeFor(semanticElement), acceptor);
          }
        }
        if ((node.isHidden() && this.grammarAccess.getML_COMMENTRule().equals(node.getGrammarElement()))) {
          this.addJavaDocReferences(node, selectedRegion, acceptor);
        }
      }
    }
  }
362393
@Override
  protected void configure() {

    // Bind and expose LogWriter (a bit hacky, but needed by MapReduce for now)
    bind(LogWriter.class).to(LocalLogWriter.class);
    expose(LogWriter.class);

    // Bind ServiceAnnouncer for procedure.
    bind(ServiceAnnouncer.class).to(DiscoveryServiceAnnouncer.class);

    // For Binding queue stuff
    bind(QueueReaderFactory.class).in(Scopes.SINGLETON);

    // Bind ProgramRunner
    MapBinder<ProgramRunnerFactory.Type, ProgramRunner> runnerFactoryBinder =
      MapBinder.newMapBinder(binder(), ProgramRunnerFactory.Type.class, ProgramRunner.class);
    runnerFactoryBinder.addBinding(ProgramRunnerFactory.Type.FLOW).to(FlowProgramRunner.class);
    runnerFactoryBinder.addBinding(ProgramRunnerFactory.Type.FLOWLET).to(FlowletProgramRunner.class);

    bind(ProgramRunnerFactory.class).to(InMemoryFlowProgramRunnerFactory.class).in(Scopes.SINGLETON);
    // Note: Expose for test cases. Need to refactor test cases.
    expose(ProgramRunnerFactory.class);

    // For binding DataSet transaction stuff
    install(new DataFabricFacadeModule());
  }
1262133
@Override
    public MapService createMapService() {
        NodeEngine nodeEngine = getNodeEngine();
        MapServiceContext mapServiceContext = getMapServiceContext();
        ManagedService managedService = createManagedService();
        CountingMigrationAwareService migrationAwareService = createMigrationAwareService();
        TransactionalService transactionalService = createTransactionalService();
        RemoteService remoteService = createRemoteService();
        EventPublishingService eventPublishingService = createEventPublishingService();
        PostJoinAwareService postJoinAwareService = createPostJoinAwareService();
        SplitBrainHandlerService splitBrainHandlerService = createSplitBrainHandlerService();
        ReplicationSupportingService replicationSupportingService = createReplicationSupportingService();
        StatisticsAwareService statisticsAwareService = createStatisticsAwareService();
        PartitionAwareService partitionAwareService = createPartitionAwareService();
        MapQuorumAwareService quorumAwareService = createQuorumAwareService();
        ClientAwareService clientAwareService = createClientAwareService();

        checkNotNull(nodeEngine, "nodeEngine should not be null");
        checkNotNull(mapServiceContext, "mapServiceContext should not be null");
        checkNotNull(managedService, "managedService should not be null");
        checkNotNull(migrationAwareService, "migrationAwareService should not be null");
        checkNotNull(transactionalService, "transactionalService should not be null");
        checkNotNull(remoteService, "remoteService should not be null");
        checkNotNull(eventPublishingService, "eventPublishingService should not be null");
        checkNotNull(postJoinAwareService, "postJoinAwareService should not be null");
        checkNotNull(splitBrainHandlerService, "splitBrainHandlerService should not be null");
        checkNotNull(replicationSupportingService, "replicationSupportingService should not be null");
        checkNotNull(statisticsAwareService, "statisticsAwareService should not be null");
        checkNotNull(partitionAwareService, "partitionAwareService should not be null");
        checkNotNull(quorumAwareService, "quorumAwareService should not be null");
        checkNotNull(clientAwareService, "clientAwareService should not be null");

        MapService mapService = new MapService();
        mapService.managedService = managedService;
        mapService.migrationAwareService = migrationAwareService;
        mapService.transactionalService = transactionalService;
        mapService.remoteService = remoteService;
        mapService.eventPublishingService = eventPublishingService;
        mapService.postJoinAwareService = postJoinAwareService;
        mapService.splitBrainHandlerService = splitBrainHandlerService;
        mapService.replicationSupportingService = replicationSupportingService;
        mapService.statisticsAwareService = statisticsAwareService;
        mapService.mapServiceContext = mapServiceContext;
        mapService.partitionAwareService = partitionAwareService;
        mapService.quorumAwareService = quorumAwareService;
        mapService.clientAwareService = clientAwareService;
        mapServiceContext.setService(mapService);
        return mapService;
    }
1329594
private void init(ExecutorService executorService, Configuration configuration) {
        cfg.getRequestContext().put(EXECUTOR_SERVICE_PROPERTY, executorService);
        cfg.getRequestContext().putAll(configuration.getProperties());

        List<Interceptor<? extends Message>>inboundChain = cfg.getInInterceptors();
        inboundChain.add(new MPAsyncInvocationInterceptorPostAsyncImpl());
        inboundChain.add(new MPAsyncInvocationInterceptorRemoveContextImpl());
    }
1035833
public void init(Configuration configuration)
			throws Exception
	{
		LOGGER.debug("Initializing AbstractBundleInterceptor");

		localizationBundleFactory = configuration.getLocalizationBundleFactory();

		findResourceBundleFactory(configuration);
	}
281243
protected void notifyServiceSummaryUpdate(ServiceSummary serviceSummary) throws ActivityException {
        WorkflowServices wfs = ServiceLocator.getWorkflowServices();
        try {
            wfs.notify("service-summary-update-" + getMasterRequestId(), null, 2);
        } catch (ServiceException e) {
            throw new ActivityException("Cannot publish Service Summary update event", e);
        }
    }
1316112
public void setResourceRegion(java.util.Collection<StringFilter> resourceRegion) {
        if (resourceRegion == null) {
            this.resourceRegion = null;
            return;
        }

        this.resourceRegion = new java.util.ArrayList<StringFilter>(resourceRegion);
    }