Load the {@link InitializrServiceMetadata} at the specified url.
@param serviceUrl to url of the initializer service
@return the metadata describing the service
@throws IOException if the service's metadata cannot be loaded
184165
public InitializrServiceMetadata loadMetadata(String serviceUrl) throws IOException {
		CloseableHttpResponse httpResponse = executeInitializrMetadataRetrieval(
				serviceUrl);
		validateResponse(httpResponse, serviceUrl);
		return parseJsonMetadata(httpResponse.getEntity());
	}
688680
private static WebServiceRefPartialInfo buildPartialInfoFromWebServiceClient(Class<?> serviceInterfaceClass) {

        WebServiceClient webServiceClient = serviceInterfaceClass.getAnnotation(WebServiceClient.class);
        if (webServiceClient == null) {
            return null;
        }
        String className = serviceInterfaceClass.getName();
        String wsdlLocation = webServiceClient.wsdlLocation();
        QName serviceQName = null;
        String localPart = webServiceClient.name();
        if (localPart != null) {
            serviceQName = new QName(webServiceClient.targetNamespace(), localPart);
        }

        String handlerChainDeclaringClassName = null;
        javax.jws.HandlerChain handlerChainAnnotation = serviceInterfaceClass.getAnnotation(javax.jws.HandlerChain.class);
        if (handlerChainAnnotation != null)
            handlerChainDeclaringClassName = serviceInterfaceClass.getName();
        WebServiceRefPartialInfo partialInfo = new WebServiceRefPartialInfo(className, wsdlLocation, serviceQName, null, handlerChainDeclaringClassName, handlerChainAnnotation);
        return partialInfo;
    }
884962
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) {
        metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT);

        // service reference section
        metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT,
                SERVICE_COUNTER_LABELS_BUFFER_LENGTH);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0);
        metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT,
                SERVICE_COUNTER_VALUES_BUFFER_LENGTH);
    }
55665
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201808.CdnConfigurationServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201808.CdnConfigurationServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201808.CdnConfigurationServiceSoapBindingStub(new java.net.URL(CdnConfigurationServiceInterfacePort_address), this);
                _stub.setPortName(getCdnConfigurationServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1124000
@Override
    public String loadDataFromNetwork() throws Exception {
        try {
            Ln.d("Call web service " + url);
            return IOUtils.toString(new InputStreamReader(new URL(url).openStream(), CharEncoding.UTF_8));
        } catch (final MalformedURLException e) {
            Ln.e(e, "Unable to create URL");
            throw e;
        } catch (final IOException e) {
            Ln.e(e, "Unable to download content");
            throw e;
        }
    }
661350
public HttpRequest buildGetRequest(GenericUrl url) throws IOException {
    return buildRequest(HttpMethods.GET, url, null);
  }
221653
public void setServiceEndPointUrl(String url) {
		ServiceDefTarget endpoint = (ServiceDefTarget) service;
		endpoint.setServiceEntryPoint(url);
	}
1211430
URI generateUrl(InitializrServiceMetadata metadata) {
		try {
			URIBuilder builder = new URIBuilder(this.serviceUrl);
			StringBuilder sb = new StringBuilder();
			if (builder.getPath() != null) {
				sb.append(builder.getPath());
			}

			ProjectType projectType = determineProjectType(metadata);
			this.type = projectType.getId();
			sb.append(projectType.getAction());
			builder.setPath(sb.toString());

			if (!this.dependencies.isEmpty()) {
				builder.setParameter("dependencies",
						StringUtils.collectionToCommaDelimitedString(this.dependencies));
			}

			if (this.groupId != null) {
				builder.setParameter("groupId", this.groupId);
			}
			String resolvedArtifactId = resolveArtifactId();
			if (resolvedArtifactId != null) {
				builder.setParameter("artifactId", resolvedArtifactId);
			}
			if (this.version != null) {
				builder.setParameter("version", this.version);
			}
			if (this.name != null) {
				builder.setParameter("name", this.name);
			}
			if (this.description != null) {
				builder.setParameter("description", this.description);
			}
			if (this.packageName != null) {
				builder.setParameter("packageName", this.packageName);
			}
			if (this.type != null) {
				builder.setParameter("type", projectType.getId());
			}
			if (this.packaging != null) {
				builder.setParameter("packaging", this.packaging);
			}
			if (this.javaVersion != null) {
				builder.setParameter("javaVersion", this.javaVersion);
			}
			if (this.language != null) {
				builder.setParameter("language", this.language);
			}
			if (this.bootVersion != null) {
				builder.setParameter("bootVersion", this.bootVersion);
			}

			return builder.build();
		}
		catch (URISyntaxException ex) {
			throw new ReportableException(
					"Invalid service URL (" + ex.getMessage() + ")");
		}
	}
484550
public URL getServiceURL() {
        return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes,
                this.serviceUUID, null, null);
    }
662821
public ArrayList<Long> serviceName_http_route_GET(String serviceName, Long frontendId) throws IOException {
		String qPath = "/ipLoadbalancing/{serviceName}/http/route";
		StringBuilder sb = path(qPath, serviceName);
		query(sb, "frontendId", frontendId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t2);
	}
271433
public WebservicesMetaData loadFromVFSRoot(UnifiedVirtualFile root)
   {
      WebservicesMetaData webservices = null;

      UnifiedVirtualFile wsdd = root.findChildFailSafe("META-INF/webservices.xml");

      // Maybe a web application deployment?
      if (null == wsdd)
      {
         wsdd = root.findChildFailSafe("WEB-INF/webservices.xml");
      }

      // the descriptor is optional
      if (wsdd != null)
      {
         return load(wsdd.toURL());
      }

      return webservices;
   }
527518
protected void processMetadataInitialization(HttpServletRequest request) throws ServletException {

        // In case the hosted IdP metadata weren't initialized, let's do it now
        if (manager.getHostedIdpName() == null) {

            synchronized (IdpMetadataManager.class) {

                if (manager.getHostedIdpName() == null) {

                    try {

                        log.info(
                                "No default metadata configured, generating with default values, please pre-configure metadata for production use");

                        // Defaults
                        String alias = generator.getEntityAlias();
                        String baseURL = getDefaultBaseURL(request);

                        // Use default baseURL if not set
                        if (generator.getEntityBaseURL() == null) {
                            log.warn(
                                    "Generated default entity base URL {} based on values in the first server request. Please set property entityBaseURL on MetadataGenerator bean to fixate the value.",
                                    baseURL);
                            generator.setEntityBaseURL(baseURL);
                        } else {
                            baseURL = generator.getEntityBaseURL();
                        }

                        // Use default entityID if not set
                        if (generator.getEntityId() == null) {
                            generator.setEntityId(getDefaultEntityID(baseURL, alias));
                        }

                        // Ensure supported nameID formats in uaa are listed in the metadata
                        Collection<String> supportedNameID = Arrays.asList(NameIDType.EMAIL, NameIDType.PERSISTENT,
                                NameIDType.UNSPECIFIED);
                        generator.setNameID(supportedNameID);

                        EntityDescriptor descriptor = generator.generateMetadata();
                        ExtendedMetadata extendedMetadata = generator.generateExtendedMetadata();

                        log.info("Created default metadata for system with entityID: " + descriptor.getEntityID());
                        MetadataMemoryProvider memoryProvider = new MetadataMemoryProvider(descriptor);
                        memoryProvider.initialize();
                        MetadataProvider metadataProvider = new ExtendedMetadataDelegate(memoryProvider,
                                extendedMetadata);

                        manager.addMetadataProvider(metadataProvider);
                        manager.setHostedIdpName(descriptor.getEntityID());
                        manager.refreshMetadata();

                    } catch (MetadataProviderException e) {
                        log.error("Error generating system metadata", e);
                        throw new ServletException("Error generating system metadata", e);
                    }

                }

            }

        }

    }
844331
public SSLConfig[] loadPropertiesFile(final String propertiesURL, final boolean multiConfigURL) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "loadPropertiesFile", new Object[] { propertiesURL, Boolean.valueOf(multiConfigURL) });
        // sslConfigs is used when multiConfigURL=true;
        SSLConfig[] sslConfigs = null;

        if (propertiesURL == null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "loadPropertiesFile (null props file)");
            return null;
        }
        try {
            sslConfigs = AccessController.doPrivileged(
                                                       new PrivilegedExceptionAction<SSLConfig[]>() {
                                                           @Override
                                                           public SSLConfig[] run() throws Exception {

                                                               InputStream istream = null;
                                                               BufferedReader in = null;

                                                               try {
                                                                   URL url = new URL(propertiesURL);
                                                                   istream = url.openStream();

                                                                   if (!multiConfigURL) {
                                                                       load(istream);
                                                                   } else {
                                                                       String s = null;
                                                                       in = new BufferedReader(new InputStreamReader(istream));
                                                                       List<SSLConfig> sslConfigList = new ArrayList<SSLConfig>();
                                                                       SSLConfig currentSSLConfig = new SSLConfig();
                                                                       currentSSLConfig.clear(); // clear the default properties

                                                                       while ((s = in.readLine()) != null) {
                                                                           if (!(s.trim().startsWith("#") || s.trim().length() <= 0)) {
                                                                               if (s.trim().startsWith("com.ibm.ssl.alias")) {
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Saving SSL configuration...");
                                                                                   sslConfigList.add(currentSSLConfig);

                                                                                   // now start a new one.
                                                                                   currentSSLConfig = new SSLConfig();

                                                                                   int index = s.indexOf('=');
                                                                                   String name = s.substring(0, index);
                                                                                   String value = s.substring(index + 1);
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Parsing SSL configuration with alias: " + value);
                                                                                   currentSSLConfig.setProperty(name, value, true);
                                                                               } else if (s.trim().indexOf('=') != -1) {
                                                                                   int index = s.indexOf('=');
                                                                                   String name = s.substring(0, index);
                                                                                   String value = null;
                                                                                   if (name != null)
                                                                                       value = System.getProperty(name);
                                                                                   if (value == null)
                                                                                       value = s.substring(index + 1);
                                                                                   if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                                       Tr.debug(tc, "Parsing SSL property: " + name + " = " + value);
                                                                                   currentSSLConfig.setProperty(name, value, true);
                                                                               }
                                                                           }
                                                                       }

                                                                       if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                                                           Tr.debug(tc, "Saving SSL configuration...");
                                                                       sslConfigList.add(currentSSLConfig);
                                                                       return sslConfigList.toArray(new SSLConfig[sslConfigList.size()]);
                                                                   }
                                                               } finally {
                                                                   if (null != in) {
                                                                       in.close();
                                                                   }
                                                                   if (istream != null)
                                                                       istream.close();
                                                               }
                                                               return null;
                                                           }
                                                       });

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "loadPropertiesFile");
            return sslConfigs;
        } catch (PrivilegedActionException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "loadPropertiesFile exception; " + e.getException());
            FFDCFilter.processException(e.getException(), getClass().getName(), "loadPropertiesFile", this);
            // TODO shouldn't this be throwing the error?
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "loadPropertiesFile");
        return null;
    }
593799
public static String serialize(List<ServiceRequester> requesterList) throws IOException {
    String jsonList = objectMapper.writeValueAsString(requesterList);
    String base64Str = Base64.getEncoder().encodeToString(jsonList.getBytes("UTF-8"));
    return URLEncoder.encode(base64Str, "UTF-8");
  }
716451
public static ServiceEndpoint decodeMetadata(String metadata) {
    try {
      return objectMapper.readValue(metadata, ServiceEndpoint.class);
    } catch (IOException e) {
      LOGGER.error("Failed to read metadata: " + e);
      return null;
    }
  }
1199042
private static RemoteObjectSource openObjectSource(ServiceInfo serviceInfo) {
        try {
            return new RemoteObjectSource(serviceInfo);
        } catch (ServiceException e) {
            throw new IllegalStateException("Failed to initialize "
                    + "the ValidatorProcess: ", e);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to initialize "
                    + "the ValidatorProcess: ", e);
        }
    }
632802
public static String readUrlContent( String url )
	throws IOException, URISyntaxException {

		InputStream in = null;
		try {
			URI uri = UriUtils.urlToUri( url );
			in = uri.toURL().openStream();
			ByteArrayOutputStream os = new ByteArrayOutputStream();

			Utils.copyStreamSafely( in, os );
			return os.toString( "UTF-8" );

		} finally {
			closeQuietly( in );
		}
	}