code
stringlengths
73
34.1k
label
stringclasses
1 value
private static String convertPattern(ProxyRule bean) { String str = bean.getPattern().replaceAll("\\{.+?\\}", "([^/&?]*)"); // /foo/{bar}/{baz} => /foo/([^\/&?]*)/([^/&?]*).* return str.endsWith("$") ? str : str + ".*"; // Implicitly other stuff on end unless $ explicitly specified (see description) ...
java
public static final void validateSearchCriteria(SearchCriteriaBean criteria) throws InvalidSearchCriteriaException { if (criteria.getPaging() != null) { if (criteria.getPaging().getPage() < 1) { throw new InvalidSearchCriteriaException(Messages.i18n.format("SearchCriteriaUtil.Missing...
java
public static <T> void callIfExists(T object, String methodName) throws SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { try { Method method = object.getClass().getMethod(methodName); method.invoke(object); } catch (NoSu...
java
public static Class<?> loadClass(String classname) { Class<?> c = null; // First try a simple Class.forName() try { c = Class.forName(classname); } catch (ClassNotFoundException e) { } // Didn't work? Try using this class's classloader. if (c == null) { try { c = Re...
java
public static Method findSetter(Class<?> onClass, Class<?> targetClass) { Method[] methods = onClass.getMethods(); for (Method method : methods) { Class<?>[] ptypes = method.getParameterTypes(); if (method.getName().startsWith("set") && ptypes.length == 1 && ptypes[0] == targetCl...
java
private IJdbcClient createClient(IPolicyContext context, JDBCIdentitySource config) throws Throwable { IJdbcComponent jdbcComponent = context.getComponent(IJdbcComponent.class); if (config.getType() == JDBCType.datasource || config.getType() == null) { DataSource ds = lookupDatasource(confi...
java
@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(serviceIn...
java
@SuppressWarnings("unchecked") public static <T> Set<T> getServices(Class<T> serviceInterface) { synchronized(servicesCache) { if (servicesCache.containsKey(serviceInterface)) { return (Set<T>) servicesCache.get(serviceInterface); } Set<T> services = ...
java
protected static URL findConfigUrlInDirectory(File directory, String configName) { if (directory.isDirectory()) { File cfile = new File(directory, configName); if (cfile.isFile()) { try { return cfile.toURI().toURL(); } catch (Malformed...
java
private boolean canProcessRequest(TimeRestrictedAccessConfig config, String destination) { if (destination == null || destination.trim().length() == 0) { destination = "/"; //$NON-NLS-1$ } List<TimeRestrictedAccess> rulesEnabledForPath = getRulesMatchingPath(config, destination);...
java
protected String getRemoteAddr(ApiRequest request, IPListConfig config) { String httpHeader = config.getHttpHeader(); if (httpHeader != null && httpHeader.trim().length() > 0) { String value = (String) request.getHeaders().get(httpHeader); if (value != null) { ret...
java
protected boolean isMatch(IPListConfig config, String remoteAddr) { if (config.getIpList().contains(remoteAddr)) { return true; } try { String [] remoteAddrSplit = remoteAddr.split("\\."); //$NON-NLS-1$ for (String ip : config.getIpList()) { St...
java
private static File getPluginDir() { String dataDirPath = System.getProperty("catalina.home"); //$NON-NLS-1$ File dataDir = new File(dataDirPath, "data"); //$NON-NLS-1$ if (!dataDir.getParentFile().isDirectory()) { throw new RuntimeException("Failed to find Tomcat home at: " + dataDi...
java
private IAsyncResultHandler<IEngineResult> wrapResultHandler(final IAsyncResultHandler<IEngineResult> handler) { return (IAsyncResult<IEngineResult> result) -> { boolean doRecord = true; if (result.isError()) { recordErrorMetrics(result.getError()); } else { ...
java
protected void recordSuccessMetrics(ApiResponse response) { requestMetric.setResponseCode(response.getCode()); requestMetric.setResponseMessage(response.getMessage()); }
java
protected void recordFailureMetrics(PolicyFailure failure) { requestMetric.setResponseCode(failure.getResponseCode()); requestMetric.setFailure(true); requestMetric.setFailureCode(failure.getFailureCode()); requestMetric.setFailureReason(failure.getMessage()); }
java
protected void resolvePropertyReplacements(Api api) { if (api == null) { return; } String endpoint = api.getEndpoint(); endpoint = resolveProperties(endpoint); api.setEndpoint(endpoint); Map<String, String> properties = api.getEndpointProperties(); fo...
java
protected void resolvePropertyReplacements(ApiContract apiContract) { if (apiContract == null) { return; } Api api = apiContract.getApi(); if (api != null) { resolvePropertyReplacements(api); } resolvePropertyReplacements(apiContract.getPolicies())...
java
private void resolvePropertyReplacements(List<Policy> apiPolicies) { if (apiPolicies != null) { for (Policy policy : apiPolicies) { String config = policy.getPolicyJsonConfig(); config = resolveProperties(config); policy.setPolicyJsonConfig(config); ...
java
private String resolveProperties(String value) { if (value.contains("${")) { //$NON-NLS-1$ return PROPERTY_SUBSTITUTOR.replace(value); } else { return value; } }
java
protected void validateRequest(ApiRequest request) throws InvalidContractException { ApiContract contract = request.getContract(); boolean matches = true; if (!contract.getApi().getOrganizationId().equals(request.getApiOrgId())) { matches = false; } if (!contract.get...
java
private IAsyncResultHandler<IApiConnectionResponse> createApiConnectionResponseHandler() { return (IAsyncResult<IApiConnectionResponse> result) -> { if (result.isSuccess()) { requestMetric.setApiEnd(new Date()); // The result came back. NB: still need to put it throug...
java
protected void handleStream() { inboundStreamHandler.handle(new ISignalWriteStream() { boolean streamFinished = false; @Override public void write(IApimanBuffer buffer) { if (streamFinished) { throw new IllegalStateException("Attempted wri...
java
private Chain<ApiRequest> createRequestChain(IAsyncHandler<ApiRequest> requestHandler) { RequestChain chain = new RequestChain(policyImpls, context); chain.headHandler(requestHandler); chain.policyFailureHandler(failure -> { // Jump straight to the response leg. // It wil...
java
private Chain<ApiResponse> createResponseChain(IAsyncHandler<ApiResponse> responseHandler) { ResponseChain chain = new ResponseChain(policyImpls, context); chain.headHandler(responseHandler); chain.policyFailureHandler(result -> { if (apiConnectionResponse != null) { apiC...
java
private IAsyncHandler<PolicyFailure> createPolicyFailureHandler() { return policyFailure -> { // One of the policies has triggered a failure. At this point we should stop processing and // send the failure to the client for appropriate handling. EngineResultImpl engineResult ...
java
private IAsyncHandler<Throwable> createPolicyErrorHandler() { return error -> resultHandler.handle(AsyncResultImpl.<IEngineResult> create(error)); }
java
private static File getDataDir() { File rval = null; // First check to see if a data directory has been explicitly configured via system property String dataDir = System.getProperty("apiman.bootstrap.data_dir"); //$NON-NLS-1$ if (dataDir != null) { rval = new File(dataDir); ...
java
protected void configureBasicAuth(HttpRequest request) { try { String username = getConfig().getUsername(); String password = getConfig().getPassword(); String up = username + ":" + password; //$NON-NLS-1$ String base64 = new String(Base64.encodeBase64(up.getBytes...
java
public void addFilter(String name, String value, SearchCriteriaFilterOperator operator) { SearchCriteriaFilterBean filter = new SearchCriteriaFilterBean(); filter.setName(name); filter.setValue(value); filter.setOperator(operator); filters.add(filter); }
java
public static Map<String, String> getSubmap(Map<String, String> mapIn, String subkey) { if (mapIn == null || mapIn.isEmpty()) { return Collections.emptyMap(); } // Get map sub-element. return mapIn.entrySet().stream() .filter(entry -> entry.getKey().toLowerCas...
java
public static boolean valueChanged(Set<?> before, Set<?> after) { if ((before == null && after == null) || after == null) { return false; } if (before == null) { if (after.isEmpty()) { return false; } else { return true; ...
java
public static boolean valueChanged(Map<String, String> before, Map<String, String> after) { if ((before == null && after == null) || after == null) { return false; } if (before == null) { if (after.isEmpty()) { return false; } else { ...
java
public static AuditEntryBean organizationUpdated(OrganizationBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getId(), AuditEntityType.Organization, securityContex...
java
public static AuditEntryBean membershipGranted(String organizationId, MembershipData data, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(organizationId, AuditEntityType.Organization, securityContext); entry.setEntityId(null); entry.setEntityVersion(null); ...
java
public static AuditEntryBean apiCreated(ApiBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Api, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); ent...
java
public static AuditEntryBean apiUpdated(ApiBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Api, securityContext); ...
java
public static AuditEntryBean apiVersionUpdated(ApiVersionBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getApi().getOrganization().getId(), AuditEntityType.Api, ...
java
public static AuditEntryBean clientCreated(ClientBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Client, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); ...
java
public static AuditEntryBean clientUpdated(ClientBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Client, securityContex...
java
public static AuditEntryBean clientVersionUpdated(ClientVersionBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getClient().getOrganization().getId(), AuditEntityT...
java
public static AuditEntryBean contractCreatedToApi(ContractBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext); // Ensure the order of contract-created events are deterministic by adding 1 m...
java
public static AuditEntryBean policyAdded(PolicyBean bean, PolicyType type, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganizationId(), null, securityContext); entry.setWhat(AuditEntryType.AddPolicy); entry.setEntityId(bean.getEntityId()); ent...
java
private static String toJSON(Object data) { try { return mapper.writeValueAsString(data); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static AuditEntryBean planCreated(PlanBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Plan, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); ...
java
public static AuditEntryBean planUpdated(PlanBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Plan, securityContext); ...
java
public static AuditEntryBean planVersionCreated(PlanVersionBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getPlan().getOrganization().getId(), AuditEntityType.Plan, securityContext); entry.setEntityId(bean.getPlan().getId()); entry.setEntityVersio...
java
public static AuditEntryBean planVersionUpdated(PlanVersionBean bean, EntityUpdatedData data, ISecurityContext securityContext) { if (data.getChanges().isEmpty()) { return null; } AuditEntryBean entry = newEntry(bean.getPlan().getOrganization().getId(), AuditEntityType.Pl...
java
public static AuditEntryBean apiPublished(ApiVersionBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext); entry.setEntityId(bean.getApi().getId()); entry.setEntityVersion(bean.get...
java
public static AuditEntryBean clientRegistered(ClientVersionBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getClient().getOrganization().getId(), AuditEntityType.Client, securityContext); entry.setEntityId(bean.getClient().getId()); entry.setEntity...
java
public static AuditEntryBean policiesReordered(ApiVersionBean apiVersion, PolicyType policyType, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(apiVersion.getApi().getOrganization().getId(), AuditEntityType.Api, securityContext); entry.setEntityId(apiVersion.getApi().get...
java
public static AuditEntryBean policiesReordered(ClientVersionBean cvb, PolicyType policyType, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(cvb.getClient().getOrganization().getId(), AuditEntityType.Client, securityContext); entry.setEntityId(cvb.getClient().getId()); ...
java
public static AuditEntryBean policiesReordered(PlanVersionBean pvb, PolicyType policyType, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(pvb.getPlan().getOrganization().getId(), AuditEntityType.Plan, securityContext); entry.setEntityId(pvb.getPlan().getId()); en...
java
private static AuditEntryBean newEntry(String orgId, AuditEntityType type, ISecurityContext securityContext) { // Wait for 1 ms to guarantee that two audit entries are never created at the same moment in time (which would // result in non-deterministic sorting by the storage layer) try { Thread....
java
public static final ClientVersionAlreadyExistsException clientVersionAlreadyExistsException(String clientName, String version) { return new ClientVersionAlreadyExistsException(Messages.i18n.format("clientVersionAlreadyExists", clientName, version)); //$NON-NLS-1$ }
java
public static final ClientVersionNotFoundException clientVersionNotFoundException(String clientId, String version) { return new ClientVersionNotFoundException(Messages.i18n.format("clientVersionDoesNotExist", clientId, version)); //$NON-NLS-1$ }
java
public static final ApiVersionAlreadyExistsException apiVersionAlreadyExistsException(String apiName, String version) { return new ApiVersionAlreadyExistsException(Messages.i18n.format("ApiVersionAlreadyExists", apiName, version)); //$NON-NLS-1$ }
java
public static InvalidPlanStatusException invalidPlanStatusException(List<PlanVersionSummaryBean> lockedPlans) { return new InvalidPlanStatusException(Messages.i18n.format("InvalidPlanStatus") + " " + joinList(lockedPlans)); //$NON-NLS-1$ //$NON-NLS-2$ }
java
public static final PlanVersionAlreadyExistsException planVersionAlreadyExistsException(String planName, String version) { return new PlanVersionAlreadyExistsException(Messages.i18n.format("PlanVersionAlreadyExists", planName, version)); //$NON-NLS-1$ }
java
public static final PlanVersionNotFoundException planVersionNotFoundException(String planId, String version) { return new PlanVersionNotFoundException(Messages.i18n.format("PlanVersionDoesNotExist", planId, version)); //$NON-NLS-1$ }
java
public static final PluginResourceNotFoundException pluginResourceNotFoundException(String resourceName, PluginCoordinates coordinates) { return new PluginResourceNotFoundException(Messages.i18n.format( "PluginResourceNotFound", resourceName, coordinates.toString())); //$NON-NLS-1$ ...
java
protected SSLSessionStrategy getSslStrategy(RequiredAuthType authType) { try { if (authType == RequiredAuthType.MTLS) { if (mutualAuthSslStrategy == null) { mutualAuthSslStrategy = SSLSessionStrategyFactory.buildMutual(tlsOptions); } ...
java
public static final void main(String [] args) { if (args.length != 2) { printUsage(); return; } String cmd = args[0]; String input = args[1]; if ("encrypt".equals(cmd)) { //$NON-NLS-1$ System.out.println(AesEncrypter.encrypt(input).substring("$...
java
protected ITokenGenerator getTokenGenerator() throws ServletException { if (tokenGenerator == null) { String tokenGeneratorClassName = getConfig().getManagementApiAuthTokenGenerator(); if (tokenGeneratorClassName == null) throw new ServletException("No token generator cla...
java
public boolean scan(IApimanBuffer buffer) throws SoapEnvelopeNotFoundException { if (this.buffer == null) { this.buffer = buffer; } else { this.buffer.append(buffer); } boolean scanComplete = doScan(); // If our buffer is already "max size" but we haven't ...
java
private int findFrom(char c, int index) { int currentIdx = index; while (currentIdx < buffer.length()) { if (buffer.get(currentIdx) == c) { return currentIdx; } currentIdx++; } return -1; }
java
public int readFrom(InputStream stream) throws IOException { int bytesRead = stream.read(buffer); if (bytesRead < 0) { bytesInBuffer = 0; } else { bytesInBuffer = bytesRead; } return bytesRead; }
java
public void export() { logger.info("----------------------------"); //$NON-NLS-1$ logger.info(Messages.i18n.format("StorageExporter.StartingExport")); //$NON-NLS-1$ try { storage.beginTx(); try { exportMetadata(); exportUsers(); ...
java
public static void generatePolicyDescription(PolicyBean policy) throws Exception { PolicyDefinitionBean def = policy.getDefinition(); PolicyDefinitionTemplateBean templateBean = getTemplateBean(def); if (templateBean == null) { return; } String cacheKey = def.getId() ...
java
private static PolicyDefinitionTemplateBean getTemplateBean(PolicyDefinitionBean def) { Locale currentLocale = Messages.i18n.getLocale(); String lang = currentLocale.getLanguage(); String country = lang + "_" + currentLocale.getCountry(); //$NON-NLS-1$ PolicyDefinitionTemplateBean nullB...
java
public static File getUserM2Repository() { // if there is m2override system propery, use it. String m2Override = System.getProperty("apiman.gateway.m2-repository-path"); //$NON-NLS-1$ if (m2Override != null) { return new File(m2Override).getAbsoluteFile(); } String userH...
java
public static File getM2Path(File m2Dir, PluginCoordinates coordinates) { String artifactSubPath = getMavenPath(coordinates); return new File(m2Dir, artifactSubPath); }
java
public static String getMavenPath(PluginCoordinates coordinates) { StringBuilder artifactSubPath = new StringBuilder(); artifactSubPath.append(coordinates.getGroupId().replace('.', '/')); artifactSubPath.append('/'); artifactSubPath.append(coordinates.getArtifactId()); artifactSu...
java
@Override public IApimanLogger createLogger(Class <?> klazz) { delegatedLogger = LogManager.getLogger(klazz); this.klazz = klazz; return this; }
java
private static String buildCacheID(ApiRequest request) { StringBuilder req = new StringBuilder(); if (request.getContract() != null) { req.append(request.getApiKey()); } else { req.append(request.getApiOrgId()).append(KEY_SEPARATOR).append(request.getApiId()) ...
java
public void reset() { if (nonNull(client)) { synchronized (mutex) { if (nonNull(client)) { // double-guard client.shutdown(); client = null; } } } }
java
@Override public void handleDeployFailed(Vertx vertx, String mainVerticle, DeploymentOptions deploymentOptions, Throwable cause) { // Default behaviour is to close Vert.x if the deploy failed vertx.close(); }
java
private static void preMarshall(Object bean) { try { Method method = bean.getClass().getDeclaredMethod("encryptData"); if (method != null) { method.invoke(bean); } } catch (NoSuchMethodException | SecurityException | IllegalAccessException ...
java
protected String getApiKey(HttpServletRequest request, QueryMap queryParams) { String apiKey = request.getHeader("X-API-Key"); //$NON-NLS-1$ if (apiKey == null || apiKey.trim().length() == 0) { apiKey = queryParams.get("apikey"); //$NON-NLS-1$ } return apiKey; }
java
protected void writeResponse(HttpServletResponse response, ApiResponse sresponse) { response.setStatus(sresponse.getCode()); for (Entry<String, String> entry : sresponse.getHeaders()) { response.addHeader(entry.getKey(), entry.getValue()); } }
java
protected void writeFailure(final ApiRequest request, final HttpServletResponse resp, final PolicyFailure policyFailure) { getFailureWriter().write(request, policyFailure, new IApiClientResponse() { @Override public void write(StringBuffer buffer) { write(buffer.toString(...
java
protected void writeError(final ApiRequest request, final HttpServletResponse resp, final Throwable error) { getErrorWriter().write(request, error, new IApiClientResponse() { @Override public void write(StringBuffer buffer) { write(buffer.toString()); } ...
java
protected static final ApiRequestPathInfo parseApiRequestPath(HttpServletRequest request) { return ApimanPathUtils.parseApiRequestPath(request.getHeader(ApimanPathUtils.X_API_VERSION_HEADER), request.getHeader(ApimanPathUtils.ACCEPT_HEADER), request.getPathInfo()); }
java
protected static final QueryMap parseApiRequestQueryParams(String queryString) { QueryMap rval = new QueryMap(); if (queryString != null) { try { String[] pairSplit = queryString.split("&"); //$NON-NLS-1$ for (String paramPair : pairSplit) { ...
java
public void reset() { if (null != hazelcastInstance) { synchronized (mutex) { if (null == hazelcastInstance) { hazelcastInstance.shutdown(); hazelcastInstance = null; } } } if (!stores.isEmpty()) { ...
java
public static void validateName(String name) throws InvalidNameException { if (StringUtils.isEmpty(name)) { throw ExceptionFactory.invalidNameException(Messages.i18n.format("FieldValidator.EmptyNameError")); //$NON-NLS-1$ } }
java
public static void validateVersion(String name) throws InvalidNameException { if (StringUtils.isEmpty(name)) { throw ExceptionFactory.invalidVersionException(Messages.i18n.format("FieldValidator.EmptyVersionError")); //$NON-NLS-1$ } }
java
private void saveBuckets() { if (lastModifiedOn > lastSavedOn) { System.out.println("Persisting current rates to: " + savedRates); //$NON-NLS-1$ Properties props = new Properties(); for (Entry<String, RateLimiterBucket> entry : buckets.entrySet()) { String val...
java
private void loadBuckets() { Properties props = new Properties(); try (FileReader reader = new FileReader(savedRates)) { props.load(reader); } catch (IOException e) { throw new RuntimeException(e); } for (Entry<Object, Object> entry : props.entrySet()) { ...
java
private String formatDn(String dnPattern, String username, ApiRequest request) { Map<String, String> valuesMap = request.getHeaders().toMap(); valuesMap.put("username", username); //$NON-NLS-1$ StrSubstitutor sub = new StrSubstitutor(valuesMap); return sub.replace(dnPattern); }
java
public static Throwable rootCause(Throwable e) { Throwable cause = e; while (cause.getCause() != null) { cause = e.getCause(); } return cause; }
java
private void retireApi(ActionBean action) throws ActionException { if (!securityContext.hasPermission(PermissionType.apiAdmin, action.getOrganizationId())) throw ExceptionFactory.notAuthorizedException(); ApiVersionBean versionBean; try { versionBean = orgs.getApiVersion...
java
private List<Policy> aggregateContractPolicies(ContractSummaryBean contractBean) { try { List<Policy> policies = new ArrayList<>(); PolicyType [] types = new PolicyType[] { PolicyType.Client, PolicyType.Plan, PolicyType.Api }; for (PolicyType p...
java
private void lockPlan(ActionBean action) throws ActionException { if (!securityContext.hasPermission(PermissionType.planAdmin, action.getOrganizationId())) throw ExceptionFactory.notAuthorizedException(); PlanVersionBean versionBean; try { versionBean = orgs.getPlanVersi...
java
protected Plugin readPluginFile(PluginCoordinates coordinates, File pluginFile) throws Exception { try { PluginClassLoader pluginClassLoader = createPluginClassLoader(pluginFile); URL specFile = pluginClassLoader.getResource(PluginUtils.PLUGIN_SPEC_PATH); if (specFile == null...
java
protected void downloadArtifactTo(URL artifactUrl, File pluginFile, IAsyncResultHandler<File> handler) { InputStream istream = null; OutputStream ostream = null; try { URLConnection connection = artifactUrl.openConnection(); connection.connect(); if (connectio...
java
public static void init() { config = new WarEngineConfig(); // Surface the max-payload-buffer-size property as a system property, if it exists in the apiman.properties file if (System.getProperty(GatewayConfigProperties.MAX_PAYLOAD_BUFFER_SIZE) == null) { String propVal = config.getC...
java
private void validateClient(Client client) throws RegistrationException { Set<Contract> contracts = client.getContracts(); if (contracts.isEmpty()) { throw new NoContractFoundException(Messages.i18n.format("ESRegistry.NoContracts")); //$NON-NLS-1$ } for (Contract contract : c...
java
protected Api getApi(String id) throws IOException { Get get = new Get.Builder(getIndexName(), id).type("api").build(); //$NON-NLS-1$ JestResult result = getClient().execute(get); if (result.isSucceeded()) { Api api = result.getSourceAsObject(Api.class); return api; ...
java
protected Client getClient(String id) throws IOException { Get get = new Get.Builder(getIndexName(), id).type("client").build(); //$NON-NLS-1$ JestResult result = getClient().execute(get); if (result.isSucceeded()) { Client client = result.getSourceAsObject(Client.class); ...
java