Tries to detect the service id automatically from maven bundle plugin definition in same POM.
@return Service id or null
324851
private String getServiceIdFromMavenBundlePlugin() {
    Plugin bundlePlugin = project.getBuildPlugins().stream()
        .filter(plugin -> StringUtils.equals(plugin.getKey(), MAVEN_BUNDLE_PLUGIN_ID))
        .findFirst().orElse(null);
    if (bundlePlugin != null) {
      Xpp3Dom configuration = (Xpp3Dom)bundlePlugin.getConfiguration();
      if (configuration != null) {
        Xpp3Dom instructions = configuration.getChild("instructions");
        if (instructions != null) {
          Xpp3Dom applicationPath = instructions.getChild(ApplicationPath.HEADER_APPLICATON_PATH);
          if (applicationPath != null) {
            return applicationPath.getValue();
          }
        }
      }
    }
    return null;
  }
44439
public synchronized NetworkServiceDescriptorAgent getNetworkServiceDescriptorAgent() {
    if (this.networkServiceDescriptorAgent == null) {
      if (isService) {
        this.networkServiceDescriptorAgent =
            new NetworkServiceDescriptorAgent(
                this.serviceName,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version,
                this.serviceKey);
      } else {
        this.networkServiceDescriptorAgent =
            new NetworkServiceDescriptorAgent(
                this.username,
                this.password,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version);
      }
    }
    return this.networkServiceDescriptorAgent;
  }
341354
public String getId() {
        String value = null;
        if (_iSess != null) {
            value = _iSess.getId();
        }
        return value;
    }
777222
public String getMessageId() {
        Object messageId = getHeader(JmsMessageHeaders.MESSAGE_ID);

        if (messageId != null) {
            return messageId.toString();
        }

        return null;
    }
1165437
@Override
    public String getServiceHandlerName() {
        final StringBuilder sb = new StringBuilder();
        sb.append(this.service.getClass().getSimpleName()).append(".");
        sb.append(this.method.getName()).append("(");
        for (final Class<?> parameterType : this.method.getParameterTypes()) {
            sb.append(parameterType.getSimpleName()).append(", ");
        }
        sb.append(")");
        return sb.toString();
    }
408417
protected static I_CmsPublishServiceAsync getService() {

        if (SERVICE == null) {
            SERVICE = GWT.create(I_CmsPublishService.class);
            String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.publish.CmsPublishService.gwt");
            ((ServiceDefTarget)SERVICE).setServiceEntryPoint(serviceUrl);
        }
        return SERVICE;
    }
387819
protected function requireServiceEventType()
    {
        return $this->serviceName !== null && $this->serviceEventType !== null && $this->repoToken !== null;
    }
1338146
protected String getArtifactId(String artifactId) {
        return this.artifactId == null || this.artifactId.length() == 0
                ? artifactId
                : this.artifactId;
    }
26497
public static String getContextObjectId()
    {
        ServiceContext context = (ServiceContext) _localContext.get();

        if (context != null)
            return context._objectId;
        else
            return null;
    }
1327081
@SuppressWarnings("javadoc")
    public static <T> T getSingleService(Class<T> serviceInterface) throws IllegalStateException {
        // Cached single service values are derived from the values cached when checking
        // for multiple services
        T rval = null;
        Set<T> services = getServices(serviceInterface);
        
        if (services.size() > 1) {
            throw new IllegalStateException("Multiple implementations found of " + serviceInterface); //$NON-NLS-1$
        } else if (!services.isEmpty()) {
            rval = services.iterator().next();
        }
        return rval;
    }
562173
public I_CmsSitemapServiceAsync getService() {

        if (m_service == null) {
            m_service = GWT.create(I_CmsSitemapService.class);
            String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.sitemap.CmsVfsSitemapService.gwt");
            ((ServiceDefTarget)m_service).setServiceEntryPoint(serviceUrl);
        }
        return m_service;
    }
185867
private ResourceBundleDefinition buildCustomBundleDefinition(String bundleName, boolean isChildBundle) {

		// Id for the bundle
		String bundleId = props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_ID);
		if (null == bundleId && !isChildBundle)
			throw new IllegalArgumentException(
					"No id defined for the bundle with name:" + bundleName + ". Please specify one in configuration. ");

		// Whether it's a composite or not
		boolean isComposite = Boolean
				.parseBoolean(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_COMPOSITE_FLAG, "false"));

		// Create definition and set its id
		ResourceBundleDefinition bundle = new ResourceBundleDefinition();
		bundle.setBundleId(bundleId);
		bundle.setBundleName(bundleName);
		bundle.setBundlePrefix(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_BUNDLE_PREFIX));

		// Whether it's global or not
		boolean isGlobal = Boolean
				.parseBoolean(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_GLOBAL_FLAG, "false"));
		bundle.setGlobal(isGlobal);

		// Set order if its a global bundle
		if (isGlobal) {
			int order = Integer.parseInt(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_ORDER, "0"));
			bundle.setInclusionOrder(order);
		}

		// Override bundle postprocessor
		if (null != props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_POSTPROCESSOR))
			bundle.setBundlePostProcessorKeys(
					props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_POSTPROCESSOR));

		// Override unitary postprocessor
		if (null != props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_FILE_POSTPROCESSOR))
			bundle.setUnitaryPostProcessorKeys(
					props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_FILE_POSTPROCESSOR));

		// Use only with debug mode on
		boolean isDebugOnly = Boolean
				.parseBoolean(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_DEBUGONLY, "false"));
		bundle.setDebugOnly(isDebugOnly);

		// Use only with debug mode off
		boolean isDebugNever = Boolean
				.parseBoolean(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_DEBUGNEVER, "false"));
		bundle.setDebugNever(isDebugNever);

		// Set conditional comment for IE, in case one is specified
		if (null != props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_IE_CONDITIONAL_EXPRESSION))
			bundle.setIeConditionalExpression(
					props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_IE_CONDITIONAL_EXPRESSION));

		// Sets the alternate URL for production mode.
		if (null != props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_PRODUCTION_ALT_URL))
			bundle.setAlternateProductionURL(
					props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_PRODUCTION_ALT_URL));

		boolean hasDebugURL = false;
		// Sets the debug URL for debug mode.
		if (null != props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_DEBUG_URL)) {
			bundle.setDebugURL(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_DEBUG_URL));
			hasDebugURL = true;
			if (StringUtils.isEmpty(bundle.getAlternateProductionURL())) {
				throw new IllegalArgumentException("The bundle '" + bundleName
						+ "', which use a static external resource in debug mode, must use an external resource in Production mode.\n"
						+ "Please check your configuration. ");
			}
			if (isComposite) {
				throw new IllegalArgumentException("The bundle '" + bundleName
						+ "', which use a static external resource in debug mode, can't be part of a composite bundle.\n"
						+ "Please check your configuration. ");
			}
			if (StringUtils.isNotEmpty(props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_MAPPINGS))) {
				throw new IllegalArgumentException("The bundle '" + bundleName
						+ "', which use a static external resource in debug mode, can't have a bundle mapping.\n"
						+ "Please check your configuration. ");
			}
		}

		if (isComposite) {
			String childBundlesProperty = props.getCustomBundleProperty(bundleName,
					BUNDLE_FACTORY_CUSTOM_COMPOSITE_NAMES);
			if (null == childBundlesProperty)
				throw new IllegalArgumentException(
						"No child bundle names were defined for the composite bundle with name:" + bundleName
								+ ". Please specify at least one in configuration. ");

			bundle.setComposite(true);

			// add children
			List<ResourceBundleDefinition> children = new ArrayList<>();
			StringTokenizer tk = new StringTokenizer(childBundlesProperty, JawrConstant.COMMA_SEPARATOR);
			while (tk.hasMoreTokens()) {
				ResourceBundleDefinition childDef = buildCustomBundleDefinition(tk.nextToken().trim(), true);
				childDef.setBundleId(props.getCustomBundleProperty(childDef.getBundleName(), BUNDLE_FACTORY_CUSTOM_ID));
				if (StringUtils.isEmpty(childDef.getDebugURL())) {
					children.add(childDef);
				} else {
					throw new IllegalArgumentException("The external bundle '" + childDef.getBundleName()
							+ "' can't be a child of the composite bundle '" + bundleName
							+ "'. Please check your configuration. ");

				}
			}
			bundle.setChildren(children);
		} else {
			String mappingsProperty = props.getCustomBundleProperty(bundleName, BUNDLE_FACTORY_CUSTOM_MAPPINGS);
			if (!hasDebugURL) {
				if (null == mappingsProperty) {
					throw new IllegalArgumentException("No mappings were defined for the bundle with name:" + bundleName
							+ ". Please specify at least one in configuration. ");
				} else {
					// Add the mappings
					List<String> mappings = new ArrayList<>();

					StringTokenizer tk = new StringTokenizer(mappingsProperty, JawrConstant.COMMA_SEPARATOR);
					while (tk.hasMoreTokens()) {
						String mapping = tk.nextToken().trim();
						mappings.add(mapping);
					}
					bundle.setMappings(mappings);
				}
			}
		}

		// dependencies
		List<String> dependencies = props.getCustomBundlePropertyAsList(bundleName, BUNDLE_FACTORY_CUSTOM_DEPENDENCIES);
		bundle.setDependencies(dependencies);

		return bundle;
	}
1011775
public String getId() {
        String id = operation.getOperationId();

        if (id == null)
            id = getPath() + " " + getMethod().toString().toLowerCase();

        return id;
    }
7703
protected final String simpleServiceName() {
        final Class<?> serviceType = serviceType();
        final String fqcn = serviceType.getName();
        final int lastDot = fqcn.lastIndexOf('.');
        return lastDot < 0 ? fqcn : fqcn.substring(lastDot + 1);
    }
1354017
private static String getServiceIdIfNotProvided(ServiceMetadata metadata, String interfaceName) {
        if (INTERFACE_NAME_TO_SERVICE_ID.containsKey(interfaceName)) {
            return INTERFACE_NAME_TO_SERVICE_ID.get(interfaceName);
        }

        String serviceId = metadata.getServiceId();

        if (serviceId != null) {
            return serviceId;
        }

        return Utils.deriveServiceId(interfaceName);
    }
692678
public static <T> T getService(BundleContext bundleContext, Class<T> serviceClass) {
        T service = null;
        if (FrameworkState.isValid()) {
            ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass);

            if (ref != null) {
                service = bundleContext.getService(ref);
            }
        }
        return service;
    }
63849
public static Object waitForServiceStartup(BundleContext context, String interfaceClassName, String serviceClassName, String versionRange, Dictionary<String, String> filter, int secsToWait)
    {
        if (interfaceClassName == null)
            interfaceClassName = serviceClassName;
        ServiceReference ref = BaseClassFinderService.getClassServiceReference(context, interfaceClassName, versionRange, filter);
        if (ref != null)
        {   // Good, it's registered - make sure it's started, or just start it!
            if (ClassFinderActivator.waitForBundleStartup(context, ref.getBundle(), secsToWait))
                return ref.getBundle().getBundleContext().getService(ref);
            else
                return null;    // Never
        }
        
        Bundle bundle = BaseClassFinderService.findBundle(context, ClassFinderActivator.getPackageName(serviceClassName, false), versionRange);
        if (bundle == null)
            if (serviceClassName != null)
                if (!serviceClassName.equals(ClassFinder.class.getName())) // Never. This code is in this bundle.
        {
            ClassFinder classFinder = getClassFinder(context, secsToWait);        
            String packageName = ClassFinderActivator.getPackageName(serviceClassName, false);
            Object resource = classFinder.deployThisResource(packageName, versionRange, true);  // Get the bundle info from the repos
            bundle = (Bundle)classFinder.findBundle(resource, context, packageName, versionRange);
        }
        if (bundle == null)
            return null;    // Error, can't find bundle
        
        Thread thread = Thread.currentThread();
        ServiceRegisteredListener classFinderListener = null;
        try {
            context.addServiceListener(classFinderListener = new ServiceRegisteredListener(thread, bundleContext), "(" + Constants.OBJECTCLASS + "=" + interfaceClassName + ")");
        } catch (InvalidSyntaxException e) {
            e.printStackTrace();
        }
        if (!ClassFinderActivator.waitForBundleStartup(context, bundle, secsToWait))
            return null;
        // Double-check to make sure it didn't startup while I was doing all this.
        Object bundleService = getClassFinder(context, secsToWait).getClassBundleService(interfaceClassName, serviceClassName, versionRange, filter, 0);
        if (bundleService == null)
        { // Wait 15 seconds for the ClassService to come up while the activator starts this service
            synchronized (thread) {
                try {
                    thread.wait((secsToWait == -1) ? DEFAULT_SERVICE_WAIT_SECS * 1000 : secsToWait * 1000);    // Will notify me when it is up
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }
        }
        context.removeServiceListener(classFinderListener);
        
        ref = BaseClassFinderService.getClassServiceReference(context, interfaceClassName, versionRange, filter);
        if (ref == null)
        {
            ClassServiceUtility.log(context, LogService.LOG_WARNING, "The " + interfaceClassName + " service was never registered - make sure you start it!");
            return null;
        }
        return ref.getBundle().getBundleContext().getService(ref);
    }