use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getMessageStoresByNodeIds.
@GET
@Path("/{group-id}/message-stores")
@Produces({ "application/json" })
@Operation(summary = "Get message stores by node ids", description = "", tags = { "messageStores" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of message stores 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 getMessageStoresByNodeIds(@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) {
MessageStoresDelegate messageStoresDelegate = new MessageStoresDelegate();
Artifacts messageStoresList = messageStoresDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(messageStoresList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getEndpointsByNodeIds.
@GET
@Path("/{group-id}/endpoints")
@Produces({ "application/json" })
@Operation(summary = "Get endpoints by node ids", description = "", tags = { "endpoints" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of endpoints 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 getEndpointsByNodeIds(@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) {
EndpointsDelegate endpointsDelegate = new EndpointsDelegate();
Artifacts endpointList = endpointsDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(endpointList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getMessageProcessorsByNodeIds.
@GET
@Path("/{group-id}/message-processors")
@Produces({ "application/json" })
@Operation(summary = "Get message processors by node ids", description = "", tags = { "messageProcessors" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of message processorss 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 getMessageProcessorsByNodeIds(@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) {
MessageProcessorsDelegate messageProcessorsDelegate = new MessageProcessorsDelegate();
Artifacts messageProcessorList = messageProcessorsDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(messageProcessorList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project product-mi-tooling by wso2.
the class GroupsApi method getConnectorsByNodeIds.
@GET
@Path("/{group-id}/connectors")
@Produces({ "application/json" })
@Operation(summary = "Get connectors by node ids", description = "", tags = { "connectors" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "List of connectors 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 getConnectorsByNodeIds(@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) {
ConnectorsDelegate connectorsDelegate = new ConnectorsDelegate();
Artifacts connectorList = connectorsDelegate.getArtifactsList(groupId, nodes);
Response.ResponseBuilder responseBuilder = Response.ok().entity(connectorList);
HttpUtils.setHeaders(responseBuilder);
return responseBuilder.build();
}
use of org.wso2.ei.dashboard.core.rest.model.Artifacts in project carbon-mediation by wso2.
the class SynapseAppDeployer method undeployArtifactType.
/**
* Un deploy a given artifact type
* @param carbonApplication
* @param axisConfig
* @param artifacts
*/
private void undeployArtifactType(CarbonApplication carbonApplication, AxisConfiguration axisConfig, List<Artifact.Dependency> artifacts) {
for (Artifact.Dependency dep : artifacts) {
Artifact artifact = dep.getArtifact();
if (!validateArtifact(artifact)) {
continue;
}
Deployer deployer;
String artifactDir = null;
if (SynapseAppDeployerConstants.MEDIATOR_TYPE.endsWith(artifact.getType())) {
deployer = getClassMediatorDeployer(axisConfig);
} else if (SynapseAppDeployerConstants.SYNAPSE_LIBRARY_TYPE.equals(artifact.getType())) {
deployer = getSynapseLibraryDeployer(axisConfig);
} else {
String artifactDirName = getArtifactDirName(artifact);
if (artifactDirName == null) {
continue;
}
deployer = getDeployer(axisConfig, artifactDirName);
artifactDir = getArtifactDirPath(axisConfig, artifactDirName);
}
if (deployer != null && AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(artifact.getDeploymentStatus())) {
String fileName = artifact.getFiles().get(0).getName();
String artifactName = artifact.getName();
String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
File artifactInRepo = new File(artifactDir + File.separator + fileName);
try {
// version in its name in the synapse config (ex: MyAPI:v1 instead of MyAPI)
if (SynapseAppDeployerConstants.API_TYPE.equals(artifact.getType())) {
Properties properties = new Properties();
SynapseArtifactDeploymentStore deploymentStore = getSynapseConfiguration(axisConfig).getArtifactDeploymentStore();
if (deploymentStore != null) {
properties.put(SynapseConstants.CLASS_MEDIATOR_LOADERS, deploymentStore.getClassMediatorClassLoaders());
}
artifactName = extractApiNameFromArtifact(artifact, fileName, properties);
}
if (SynapseAppDeployerConstants.MEDIATOR_TYPE.endsWith(artifact.getType())) {
if (deployer instanceof AbstractSynapseArtifactDeployer) {
((AbstractSynapseArtifactDeployer) deployer).setCustomLog(carbonApplication.getAppName(), AppDeployerUtils.getTenantIdLogString(AppDeployerUtils.getTenantId()));
}
deployer.undeploy(artifactPath);
} else if (SynapseAppDeployerConstants.SYNAPSE_LIBRARY_TYPE.equals(artifact.getType())) {
String libQName = getArtifactName(artifactPath, axisConfig);
deleteImport(libQName, axisConfig);
deployer.undeploy(artifactPath);
} else if (SynapseAppDeployerConstants.SEQUENCE_TYPE.equals(artifact.getType()) && handleMainFaultSeqUndeployment(artifact, axisConfig)) {
} else if (artifactInRepo.exists()) {
log.info("Deleting artifact at " + artifactInRepo.getAbsolutePath());
if (!artifactInRepo.delete()) {
log.error("Unable to delete " + artifactInRepo.getAbsolutePath());
}
} else {
// use reflection to avoid having synapse as a dependency
Class[] paramString = new Class[1];
paramString[0] = String.class;
Method method = deployer.getClass().getDeclaredMethod("undeploySynapseArtifact", paramString);
method.invoke(deployer, artifactName);
}
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING);
File artifactFile = new File(artifactPath);
if (artifactFile.exists() && !artifactFile.delete()) {
log.warn("Couldn't delete App artifact file : " + artifactPath);
}
} catch (Exception e) {
artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
log.error("Error occured while trying to un deploy : " + artifactName);
}
}
}
}
Aggregations