Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Update ProjectsSender.java #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 2 additions & 85 deletions src/main/java/org/whitesource/agent/ProjectsSender.java
Original file line number Diff line number Diff line change
@@ -1,87 +1,4 @@
/**
* Copyright (C) 2014 WhiteSource Ltd.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.whitesource.agent;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whitesource.agent.api.dispatch.CheckPolicyComplianceResult;
import org.whitesource.agent.api.dispatch.UpdateInventoryRequest;
import org.whitesource.agent.api.dispatch.UpdateInventoryResult;
import org.whitesource.agent.api.dispatch.UpdateType;
import org.whitesource.agent.api.model.AgentProjectInfo;
import org.whitesource.agent.client.WhitesourceService;
import org.whitesource.agent.client.WssServiceException;
import org.whitesource.agent.report.OfflineUpdateRequest;
import org.whitesource.agent.report.PolicyCheckReport;
import org.whitesource.agent.utils.Pair;
import org.whitesource.contracts.PluginInfo;
import org.whitesource.fs.ProjectsDetails;
import org.whitesource.fs.StatusCode;
import org.whitesource.fs.configuration.OfflineConfiguration;
import org.whitesource.fs.configuration.RequestConfiguration;
import org.whitesource.fs.configuration.SenderConfiguration;
import whitesource.analysis.server.FSAgentServer;
import whitesource.analysis.server.Server;
import whitesource.analysis.vulnerabilities.VulnerabilitiesAnalysis;
import whitesource.via.api.vulnerability.update.GlobalVulnerabilityAnalysisResult;

import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;

/**
* Class for sending projects for all WhiteSource command line agents.
*
* @author Itai Marko
* @author tom.shapira
* @author anna.rozin
*/
public class ProjectsSender {
public static final String PROJECT_URL_PREFIX = "Wss/WSS.html#!project;id=";

/* --- Static members --- */

private final Logger logger = LoggerFactory.getLogger(ProjectsSender.class);

private static final String NEW_LINE = System.lineSeparator();
private static final String DOT = ".";
private static final String JAVA_NETWORKING = "java.net";
private static final int MAX_NUMBER_OF_DEPENDENCIES = 1000000;
public static final String JAVA = "java";
public static final String JAVA_SCRIPT = "javascript";
public static final String BACK_SLASH = "\\";
public static final String FORWARD_SLASH = "/";
/* --- Members --- */

private final SenderConfiguration senderConfig;
private final OfflineConfiguration offlineConfig;
private final RequestConfiguration requestConfig;
private final PluginInfo pluginInfo;
protected StatusCode prepStepStatusCode = StatusCode.SUCCESS;

/* --- Constructors --- */

public ProjectsSender(SenderConfiguration senderConfig, OfflineConfiguration offlineConfig, RequestConfiguration requestConfig, PluginInfo pluginInfo) {
this.senderConfig = senderConfig;
this.offlineConfig = offlineConfig;
this.requestConfig = requestConfig;
this.pluginInfo = pluginInfo;
}


/* --- Public methods --- */

Expand Down Expand Up @@ -366,4 +283,4 @@ private String logResult(UpdateInventoryResult updateResult) {
}
return resultLogMsg.toString();
}
}
}