Search in sources :

Example 26 with Artifacts

use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project carbon-business-process by wso2.

the class BPELUploader method uploadService.

public void uploadService(UploadedFileItem[] fileItems) throws AxisFault {
    // First lets filter for jar resources
    ConfigurationContext configurationContext = getConfigContext();
    String repo = configurationContext.getAxisConfiguration().getRepository().getPath();
    if (CarbonUtils.isURL(repo)) {
        throw new AxisFault("URL Repositories are not supported: " + repo);
    }
    // Writting the artifacts to the proper location
    String bpelDirectory = repo + File.separator + BPELConstants.BPEL_REPO_DIRECTORY;
    String bpelTemp = CarbonUtils.getCarbonHome() + BPELConstants.BPEL_PACKAGE_TEMP_DIRECTORY;
    File bpelTempDir = new File(bpelTemp);
    if (!bpelTempDir.exists() && !bpelTempDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + bpelTempDir.getAbsolutePath());
    }
    File bpelDir = new File(bpelDirectory);
    if (!bpelDir.exists() && !bpelDir.mkdirs()) {
        throw new AxisFault("Fail to create the directory: " + bpelDir.getAbsolutePath());
    }
    for (UploadedFileItem uploadedFile : fileItems) {
        String fileName = uploadedFile.getFileName();
        if (fileName == null || fileName.equals("")) {
            throw new AxisFault("Invalid file name. File name is not available");
        }
        if (uploadedFile.getFileType().equals(BPELConstants.BPEL_PACKAGE_EXTENSION)) {
            try {
                writeResource(uploadedFile.getDataHandler(), bpelTemp, fileName, bpelDir);
            } catch (IOException e) {
                throw new AxisFault("IOError: Writing resource failed.", e);
            }
        } else {
            throw new AxisFault("Invalid file type : " + uploadedFile.getFileType() + " ." + BPELConstants.BPEL_PACKAGE_EXTENSION + " file type is expected");
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) UploadedFileItem(org.wso2.carbon.bpel.deployer.services.types.UploadedFileItem) IOException(java.io.IOException) File(java.io.File)

Example 27 with Artifacts

use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.

the class GroupsApi method getTasksByNodeIds.

@GET
@Path("/{group-id}/tasks")
@Produces({ "application/json" })
@Operation(summary = "Get tasks by node ids", description = "", tags = { "tasks" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of tasks deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getTasksByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
    TasksDelegate tasksDelegate = new TasksDelegate();
    Artifacts tasksList = tasksDelegate.getArtifactsList(groupId, nodes);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(tasksList);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) CAppArtifacts(org.wso2.ei.dashboard.core.rest.model.CAppArtifacts) Artifacts(org.wso2.ei.dashboard.core.rest.model.Artifacts) TasksDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.TasksDelegate) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 28 with Artifacts

use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.

the class GroupsApi method getApisByNodeIds.

@GET
@Path("/{group-id}/apis")
@Produces({ "application/json" })
@Operation(summary = "Get APIs by node ids", description = "", tags = { "apis" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of APIs deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getApisByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
    ApisDelegate apisDelegate = new ApisDelegate();
    Artifacts apiList = apisDelegate.getArtifactsList(groupId, nodes);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(apiList);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) CAppArtifacts(org.wso2.ei.dashboard.core.rest.model.CAppArtifacts) Artifacts(org.wso2.ei.dashboard.core.rest.model.Artifacts) ApisDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.ApisDelegate) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 29 with Artifacts

use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.

the class HeartBeatDelegate method deleteAllNodeData.

private void deleteAllNodeData(String productName, HeartbeatObject heartbeat) {
    logger.info("Deleting all artifacts and server information in node : " + heartbeat.getNodeId() + " in group: " + heartbeat.getGroupId());
    ArtifactsManager artifactsManager = getArtifactManager(productName, heartbeat);
    artifactsManager.runDeleteAllExecutorService();
}
Also used : ArtifactsManager(org.wso2.ei.dashboard.core.rest.delegates.ArtifactsManager) MiArtifactsManager(org.wso2.ei.dashboard.micro.integrator.MiArtifactsManager)

Example 30 with Artifacts

use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.

the class GroupsApi method getProxyServicesByNodeIds.

@GET
@Path("/{group-id}/proxy-services")
@Produces({ "application/json" })
@Operation(summary = "Get proxy services by node ids", description = "", tags = { "proxyServices" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of proxy services deployed in provided nodes", content = @Content(schema = @Schema(implementation = Artifacts.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response getProxyServicesByNodeIds(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @NotNull @QueryParam("nodes") @Parameter(description = "ID/IDs of the nodes") List<String> nodes) {
    ProxyServiceDelegate proxyServiceDelegate = new ProxyServiceDelegate();
    Artifacts proxyList = proxyServiceDelegate.getArtifactsList(groupId, nodes);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(proxyList);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) CAppArtifacts(org.wso2.ei.dashboard.core.rest.model.CAppArtifacts) Artifacts(org.wso2.ei.dashboard.core.rest.model.Artifacts) ProxyServiceDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.ProxyServiceDelegate) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

File (java.io.File)23 IOException (java.io.IOException)18 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)18 ArrayList (java.util.ArrayList)17 CAppArtifacts (org.wso2.ei.dashboard.core.rest.model.CAppArtifacts)16 Operation (io.swagger.v3.oas.annotations.Operation)15 ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)15 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)15 Response (javax.ws.rs.core.Response)15 Artifact (org.wso2.carbon.application.deployer.config.Artifact)15 Artifacts (org.wso2.ei.dashboard.core.rest.model.Artifacts)15 DeploymentException (org.apache.axis2.deployment.DeploymentException)11 CappFile (org.wso2.carbon.application.deployer.config.CappFile)11 Deployer (org.apache.axis2.deployment.Deployer)10 ArtifactSynchronizerException (org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException)10 Organization (org.wso2.carbon.apimgt.persistence.dto.Organization)10 InputStream (java.io.InputStream)9 FileInputStream (java.io.FileInputStream)7 APIRuntimeArtifactDto (org.wso2.carbon.apimgt.impl.dto.APIRuntimeArtifactDto)7 APIPersistenceException (org.wso2.carbon.apimgt.persistence.exceptions.APIPersistenceException)7