Checks for deployment problems associated with a given {@link InjectionPoint}
505710
public void validateInjectionPointForDeploymentProblems(InjectionPoint ij, Bean<?> bean, BeanManagerImpl beanManager) {
        if (ij.isDelegate()) {
            return; // do not validate delegate injection points as these are special
        }
        Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getBeans(ij));
        if (!isInjectionPointSatisfied(ij, resolvedBeans, beanManager)) {
            throw ValidatorLogger.LOG.injectionPointHasUnsatisfiedDependencies(
                    ij,
                    Formats.formatAnnotations(ij.getQualifiers()),
                    Formats.formatInjectionPointType(ij.getType()),
                    Formats.formatAsStackTraceElement(ij),
                    InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ij, beanManager));
        }
        if (resolvedBeans.size() > 1) {
            throw ValidatorLogger.LOG.injectionPointHasAmbiguousDependencies(
                ij,
                Formats.formatAnnotations(ij.getQualifiers()),
                Formats.formatInjectionPointType(ij.getType()),
                Formats.formatAsStackTraceElement(ij),
                WeldCollections.toMultiRowString(resolvedBeans));
        }
        // Account for the case this is disabled decorator
        if (!resolvedBeans.isEmpty()) {
            Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
            if (beanManager.isNormalScope(resolvedBean.getScope())) {
                UnproxyableResolutionException ue = Proxies.getUnproxyableTypeException(ij.getType(), resolvedBean, beanManager.getServices(), false);
                if (ue != null) {
                    throw ValidatorLogger.LOG.injectionPointHasNonProxyableDependencies(ij, Formats.formatAsStackTraceElement(ij), ue);
                }
            }
            if (bean != null && Beans.isPassivatingScope(bean, beanManager)) {
                validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
            }
        }

        for (PlugableValidator validator : plugableValidators) {
            validator.validateInjectionPointForDeploymentProblems(ij, bean, beanManager);
        }

        if (resolvedInjectionPoints != null) {
            // Store result to identify unused beans
            resolvedInjectionPoints.put(resolvedBeans.iterator().next(), Boolean.TRUE);
        }
    }
1210544
@Override
    public <T> List<InjectionPoint> getJEEComponentInjectionPoints(Class<T> clazz) throws CDIException {
        InjectionTarget<T> injectionTarget = getJEEComponentInjectionTarget(clazz);
        List<InjectionPoint> injectionPoints = null;

        if (injectionTarget != null) {
            injectionPoints = new ArrayList<InjectionPoint>();
            Set<InjectionPoint> jeeClassInjectionPoints = injectionTarget.getInjectionPoints();
            if (jeeClassInjectionPoints != null && jeeClassInjectionPoints.size() > 0) {
                injectionPoints.addAll(jeeClassInjectionPoints);
            }

            String mainClassName = archive.getClientModuleMainClass();

            if (mainClassName != null) {
                if (clazz.getName().equals(mainClassName)) {
                    List<InjectionPoint> staticInjectionPoints = this.staticInjectionPoints.get(clazz);
                    if (staticInjectionPoints != null) {
                        injectionPoints.addAll(staticInjectionPoints);
                    }
                }
            }
        }

        return injectionPoints;
    }
583994
private static void injectImplicitly(Injector.Configuration config) {
		
		ImplicitInjectors.APPLICATION.inject(config);		
		ImplicitInjectors.RESOURCES.inject(config);
		ImplicitInjectors.SYSTEM_SERVICES.inject(config);
		ImplicitInjectors.ICKLE_SERVICES.inject(config);
		ImplicitInjectors.POJOS.inject(config);
	}
1208126
private void processDynamicPrivileged(ComponentNameSpaceConfiguration compNSConfig) throws InjectionException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "processDynamic");

        List<Class<?>> injectionClasses = compNSConfig.getInjectionClasses();
        if (isProcessDynamicNeeded(injectionClasses)) {
            Map<String, InjectionBinding<?>> completedInjectionBindings = new HashMap<String, InjectionBinding<?>>();
            for (InjectionBinding<?> binding : ivProcessedInjectionBindings) {
                completedInjectionBindings.put(binding.getJndiName(), binding);
            }

            // Process injection metadata for the new injection classes.
            InjectionProcessorContextImpl context = ivInjectionEngine.createInjectionProcessorContext();
            context.ivCompletedInjectionBindings = completedInjectionBindings;
            compNSConfig.setInjectionProcessorContext(context);
            ivInjectionEngine.processInjectionMetaData(compNSConfig, injectionClasses);

            // Add new processed injection bindings.  If this is the first time
            // we've done dynamic processing, copy the ArrayList to a Set to
            // avoid duplicates.
            if (!ivAnyProcessDynamic) {
                ivAnyProcessDynamic = true;
                ivProcessedInjectionBindings = new LinkedHashSet<InjectionBinding<?>>(ivProcessedInjectionBindings);
            }
            ivProcessedInjectionBindings.addAll(context.ivProcessedInjectionBindings);

            // Add new declared injection targets.
            Map<Class<?>, List<InjectionTarget>> declaredTargets = ivInjectionEngine.getDeclaredInjectionTargets(context.ivProcessedInjectionBindings);
            ivDeclaredInjectionTargets.putAll(declaredTargets);

            //clear the cached list of injection targets for the dynamic classes
            for (Class<?> injectionClass : injectionClasses) {
                ivInjectionTargetMap.remove(injectionClass);
            }

            // Now that injection targets are obtained, complete the context.
            context.metadataProcessingComplete();

            // Now that metadata has processed successfully, add all the classes
            // to the list of processed classes.
            if (ivProcessedInjectionClasses.size() <= svInjClassMapCacheSize) {
                ivProcessedInjectionClasses.addAll(injectionClasses);
            }
        }

        if (isTraceOn && tc.isDebugEnabled())
            Tr.exit(tc, "processDynamic");
    }
1101747
public static void validateProvidedServiceInstance(
            ProvidedServiceInstance serviceInstance) throws ServiceException {
        
        if (serviceInstance == null) {
            throw new ServiceException(
                    ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
                    ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
                    "service instance");
        }
               
        validateServiceName(serviceInstance.getServiceName());
        validateURI(serviceInstance.getUri());
        validateAddress(serviceInstance.getAddress());
        
        if (serviceInstance.getMetadata()!=null) { //allow metadata as null
            validateMetadata(serviceInstance.getMetadata());
        }
    }
921129
@RequestMapping(value = GET_PENDING_DEPLOYMENTS_URL, method = RequestMethod.GET)
    public ResponseEntity<Collection<Deployment>> getPendingDeployments(@PathVariable(ENV_PATH_VAR_NAME) String env,
                                                                        @PathVariable(SITE_NAME_PATH_VAR_NAME) String siteName)
        throws DeployerException {
        Target target = targetService.getTarget(env, siteName);
        Collection<Deployment> deployments = target.getPendingDeployments();

        return new ResponseEntity<>(deployments,
                                    RestServiceUtils.setLocationHeader(new HttpHeaders(), BASE_URL +GET_PENDING_DEPLOYMENTS_URL,
                                                                       env, siteName),
                                    HttpStatus.OK);
    }
97390
public void handleUpdateDeployment(String jsonp,
            HttpServletRequest request,
            HttpServletResponse response, AuthenticationResult ar)
            throws IOException, ServletException {
        String deployment = request.getParameter("deployment");
        if (deployment == null || deployment.length() == 0) {
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to get deployment information."));
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            return;
        }
        try {
            DeploymentType newDeployment = m_mapper.readValue(deployment, DeploymentType.class);
            if (newDeployment == null) {
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to parse deployment information."));
                return;
            }

            DeploymentType currentDeployment = this.getDeployment();
            if (currentDeployment.getUsers() != null) {
                newDeployment.setUsers(currentDeployment.getUsers());
            }
            // reset the host count so that it wont fail the deployment checks
            newDeployment.getCluster().setHostcount(currentDeployment.getCluster().getHostcount());

            String dep = CatalogUtil.getDeployment(newDeployment);
            if (dep == null || dep.trim().length() <= 0) {
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to build deployment information."));
                return;
            }
            Object[] params = new Object[]{null, dep};
            SyncCallback cb = new SyncCallback();
            httpClientInterface.callProcedure(request.getRemoteHost(), ar, BatchTimeoutOverrideType.NO_TIMEOUT, cb, "@UpdateApplicationCatalog", params);
            cb.waitForResponse();
            ClientResponseImpl r = ClientResponseImpl.class.cast(cb.getResponse());
            if (r.getStatus() == ClientResponse.SUCCESS) {
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.SUCCESS, "Deployment Updated."));
            } else {
                response.getWriter().print(HTTPClientInterface.asJsonp(jsonp, r.toJSONString()));
            }
        } catch (JsonParseException e) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Unparsable JSON"));
        } catch (Exception ex) {
            m_log.error("Failed to update deployment from API", ex);
            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, Throwables.getStackTraceAsString(ex)));
        }
    }
324146
private Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty>
      injectConfigProperties(Object o,
                             Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties,
                             Map<String, String> overrides,
                             ClassLoader classLoader)
      throws Throwable
   {
      Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = null;
      if (configProperties != null && !configProperties.isEmpty())
      {
         Injection injector = new Injection();

         dcps = new ArrayList<org.ironjacamar.core.api.deploymentrepository.ConfigProperty>(configProperties.size());
         for (org.ironjacamar.common.api.metadata.spec.ConfigProperty cp : configProperties)
         {
            String name = cp.getConfigPropertyName().getValue();
            Class<?> type = Class.forName(cp.getConfigPropertyType().getValue(), true, classLoader);
            boolean readOnly = cp.getConfigPropertySupportsDynamicUpdates() != null ?
               cp.getConfigPropertySupportsDynamicUpdates().booleanValue() : true;
            boolean confidential = cp.getConfigPropertyConfidential() != null ?
               cp.getConfigPropertyConfidential().booleanValue() : false;
            boolean declared = true;

            Object value = cp.isValueSet() ? cp.getConfigPropertyValue().getValue() : null;
            if (overrides != null)
            {
               if (overrides.containsKey(cp.getConfigPropertyName().getValue()))
               {
                  value = overrides.get(cp.getConfigPropertyName().getValue());
               }
               else
               {
                  String alternative = cp.getConfigPropertyName().getValue().substring(0, 1).toUpperCase();
                  if (cp.getConfigPropertyName().getValue().length() > 1)
                     alternative += cp.getConfigPropertyName().getValue().substring(1);

                  if (overrides.containsKey(alternative))
                  {
                     value = overrides.get(alternative);
                  }
                  else
                  {
                     log.tracef("%s: Override for %s not found", o.getClass().getName(),
                                cp.getConfigPropertyName().getValue());
                  }
               }
            }

            if (value != null)
            {
               try
               {
                  injector.inject(o,
                                  cp.getConfigPropertyName().getValue(),
                                  value,
                                  cp.getConfigPropertyType().getValue());
               }
               catch (Throwable t)
               {
                  type = convertType(type);
                     
                  if (type != null)
                  {
                     injector.inject(o,
                                     cp.getConfigPropertyName().getValue(),
                                     value,
                                     type.getName());
                  }
                  else
                  {
                     throw new DeployException(bundle.unableToInject(o.getClass().getName(),
                           cp.getConfigPropertyName().getValue(),
                           value.toString()), t);
                  }
               }
            }

            dcps.add(new ConfigPropertyImpl(o, name, type,
                                            value, readOnly, confidential,
                                            declared));
         }
      }
      return dcps;
   }
540674
private <T> Provider<T> lookupProvider(InjectionPoint<T> ip)
  {
    Key<T> key = ip.key();

    BindingInject<T> bean = findBean(key);

    if (bean != null) {
      return bean.provider(ip);
    }

    BindingAmp<T> provider = findBinding(key);

    if (provider != null) {
      return provider.provider(ip);
    }

    provider = findObjectBinding(key);

    if (provider != null) {
      return provider.provider(ip);
    }


    return null;
  }
410502
@Remote
   @Produces
   public <K, V> RemoteCache<K, V> getRemoteCache(InjectionPoint injectionPoint) {
      final Set<Annotation> qualifiers = injectionPoint.getQualifiers();
      final RemoteCacheManager cacheManager = getRemoteCacheManager(qualifiers.toArray(new Annotation[0]));
      final Remote remote = getRemoteAnnotation(injectionPoint.getAnnotated());

      if (remote != null && !remote.value().isEmpty()) {
         return cacheManager.getCache(remote.value());
      }
      return cacheManager.getCache();
   }
827916
private void validateRestServiceConfiguration() {
        boolean isRestEnabled = voldemortConfig.isRestServiceEnabled();
        boolean isRestPortDefined = (identityNode.getRestPort() != -1) ? true : false;
        if(isRestEnabled != isRestPortDefined) {
            if(isRestEnabled) {
                String errorMessage = "Rest Service is enabled without defining \"rest-port\" in cluster.xml .  "
                                      + this.identityNode.getStateString();
                logger.error(errorMessage);
                throw new VoldemortApplicationException(errorMessage);
            } else {
                logger.warn("\"rest-port\" is defined in cluster.xml but Rest service is not enabled.");
            }
        }
    }
674216
@Produces
	@Logging
	public Logger createLogger(InjectionPoint injectionPoint) {
		// the annotation should not be null as it is a qualifier for this producer
		Logging annotation = injectionPoint.getAnnotated().getAnnotation(Logging.class);
		
		// get the logger name
		String name = annotation.name();
		
		// if the name is empty resolve to the class name 
		// that contains the injection point
		if(name == null || name.isEmpty()) {
			return this.createClassLogger(injectionPoint);
		}
		
		// get resolver
		Resolver resolverAnnotation = annotation.resolver();
		ResolverWrapper wrapper = new ResolverAnnotationWrapper(resolverAnnotation);
		PropertyResolver resolver = this.resolverFactory.createPropertyResolver(wrapper);
		Map<Object,Object> bootstrapMap = this.resolverFactory.getBootstrapProperties(wrapper);
		Map<Object,Object> defaultMap = this.resolverFactory.getDefaultProperties(wrapper);
		
		// resolve name
		String resolvedName = resolver.resolveProperties(name, bootstrapMap, defaultMap);
				
		// otherwise use the name to create the logger
		return Logger.getLogger(resolvedName);
	}
896121
private void doUndeployModule(final Message<JsonObject> message) {
    final String deploymentID = message.body().getString("id");
    if (deploymentID == null) {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No deployment ID specified."));
    } else {
      removeDeployment(deploymentID, new Handler<AsyncResult<Void>>() {
        @Override
        public void handle(AsyncResult<Void> result) {
          platform.undeployModule(deploymentID, new Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Void> result) {
              if (result.failed()) {
                message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
              } else {
                message.reply(new JsonObject().putString("status", "ok"));
              }
            }
          });
        }
      });
    }
  }
1068224
public void checkInvalidParameters() {
    	for(String key: map.keySet()) {
    		boolean wasRequested = requestedKeys != null && requestedKeys.contains(key);
    		if(!wasRequested) throw new IllegalArgumentException("Unknown parameter " + key);
    		
    	}
    }
656366
@Produces
	@Configuration
	public List<ISource> getProperties(InjectionPoint injectionPoint) {
		// get configuration instance
		ConfigurationWrapper wrapper = this.getConfigurationWrapper(injectionPoint);
		
		// get input streams
		List<ISource> sources = this.locate(wrapper);
		
		return sources;
	}
265180
public static void main(final String[] args) throws InjectionException, IOException {

    final Configuration partialConfiguration = getEnvironmentConfiguration();
    final Injector injector = Tang.Factory.getTang().newInjector(partialConfiguration);
    final AzureBatchRuntimeConfigurationProvider runtimeConfigurationProvider =
        injector.getInstance(AzureBatchRuntimeConfigurationProvider.class);
    final Configuration driverConfiguration = getDriverConfiguration();

    try (final REEF reef = Tang.Factory.getTang().newInjector(
        runtimeConfigurationProvider.getAzureBatchRuntimeConfiguration()).getInstance(REEF.class)) {
      reef.submit(driverConfiguration);
    }
    LOG.log(Level.INFO, "Job Submitted");
  }
332968
void reportFailedCheckpoint(long failureTimestamp, @Nullable Throwable cause) {
		FailedCheckpointStats failed = new FailedCheckpointStats(
			checkpointId,
			triggerTimestamp,
			props,
			numberOfSubtasks,
			new HashMap<>(taskStats),
			currentNumAcknowledgedSubtasks,
			currentStateSize,
			currentAlignmentBuffered,
			failureTimestamp,
			latestAcknowledgedSubtask,
			cause);

		trackerCallback.reportFailedCheckpoint(failed);
	}