Skip to content

Commit

Permalink
concord-server: remove more @nAmed
Browse files Browse the repository at this point in the history
  • Loading branch information
ibodrov committed Nov 16, 2023
1 parent 44f1817 commit 43f3c52
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "ProcessHeartbeat")
public class ProcessHeartbeatResource implements Resource {
Expand All @@ -46,7 +42,6 @@ public ProcessHeartbeatResource(ProcessQueueDao queueDao) {
this.queueDao = queueDao;
}


@POST
@Path("{id}/ping")
@Operation(description = "Process heartbeat", operationId = "pingProcess")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "Process KV store")
public class ProcessKvResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
Expand All @@ -56,8 +54,6 @@
/**
* API to work with segmented process logs.
*/
@Named
@Singleton
@Path("/api/v2/process")
@Tag(name = "ProcessLogV2")
public class ProcessLogResourceV2 implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* 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
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* 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.
Expand All @@ -23,6 +23,11 @@
import com.google.inject.Binder;
import com.google.inject.Module;
import com.walmartlabs.concord.imports.ImportManager;
import com.walmartlabs.concord.server.process.checkpoint.ProcessCheckpointResource;
import com.walmartlabs.concord.server.process.checkpoint.ProcessCheckpointV2Resource;
import com.walmartlabs.concord.server.process.event.ProcessEventResource;
import com.walmartlabs.concord.server.process.form.FormResource;
import com.walmartlabs.concord.server.process.locks.ProcessLocksResource;
import com.walmartlabs.concord.server.process.locks.ProcessLocksWatchdog;
import com.walmartlabs.concord.server.process.pipelines.processors.ExclusiveGroupProcessor;
import com.walmartlabs.concord.server.process.pipelines.processors.policy.*;
Expand All @@ -40,6 +45,7 @@

import static com.google.inject.Scopes.SINGLETON;
import static com.google.inject.multibindings.Multibinder.newSetBinder;
import static com.walmartlabs.concord.server.Utils.bindJaxRsResource;
import static com.walmartlabs.concord.server.Utils.bindSingletonScheduledTask;

public class ProcessModule implements Module {
Expand Down Expand Up @@ -77,5 +83,16 @@ public void configure(Binder binder) {
newSetBinder(binder, PolicyApplier.class).addBinding().to(ProcessRuntimePolicyApplier.class);
newSetBinder(binder, PolicyApplier.class).addBinding().to(ProcessTimeoutPolicyApplier.class);
newSetBinder(binder, PolicyApplier.class).addBinding().to(WorkspacePolicyApplier.class);

bindJaxRsResource(binder, FormResource.class);
bindJaxRsResource(binder, ProcessCheckpointResource.class);
bindJaxRsResource(binder, ProcessCheckpointV2Resource.class);
bindJaxRsResource(binder, ProcessEventResource.class);
bindJaxRsResource(binder, ProcessHeartbeatResource.class);
bindJaxRsResource(binder, ProcessKvResource.class);
bindJaxRsResource(binder, ProcessLocksResource.class);
bindJaxRsResource(binder, ProcessLogResourceV2.class);
bindJaxRsResource(binder, ProcessResource.class);
bindJaxRsResource(binder, ProcessResourceV2.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,16 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import javax.ws.rs.core.Response.Status;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
Expand All @@ -98,8 +99,6 @@
import static com.walmartlabs.concord.server.process.state.ProcessStateManager.path;
import static com.walmartlabs.concord.server.process.state.ProcessStateManager.zipTo;

@Named
@Singleton
@javax.ws.rs.Path("/api/v1/process")
@Tag(name = "Process")
public class ProcessResource implements Resource {
Expand Down Expand Up @@ -260,7 +259,6 @@ public StartProcessResponse start(@PathParam("entryPoint") String entryPoint,

/**
* Starts a new process instance.
*
*/
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
Expand Down Expand Up @@ -478,9 +476,9 @@ public ProcessEntry waitForCompletion(@PathParam("id") UUID instanceId,

ProcessStatus s = r.status();
if (s == ProcessStatus.FINISHED ||
s == ProcessStatus.FAILED ||
s == ProcessStatus.CANCELLED ||
s == ProcessStatus.TIMED_OUT) {
s == ProcessStatus.FAILED ||
s == ProcessStatus.CANCELLED ||
s == ProcessStatus.TIMED_OUT) {
return r;
}

Expand Down Expand Up @@ -758,6 +756,7 @@ public Response getLog(@PathParam("id") UUID instanceId,

/**
* Appends a process' log.
*
* @deprecated in favor of the /api/v2/process/{id}/log* endpoints
*/
@POST
Expand Down Expand Up @@ -1033,7 +1032,7 @@ private void assertProcessAccess(ProcessEntry pe, String downloadEntity) {
}

throw new UnauthorizedException("The current user (" + principal.getUsername() + ") doesn't have " +
"the necessary permissions to the download " + downloadEntity + " : " + pe.instanceId());
"the necessary permissions to the download " + downloadEntity + " : " + pe.instanceId());
}

private void assertResourceAccess(ProcessEntry pe, String resource) {
Expand Down Expand Up @@ -1109,7 +1108,7 @@ private static Optional<Path> copyToTmp(InputStream in) {

private static RuntimeException syncIsForbidden() {
return new ConcordApplicationException("The 'sync' mode is no longer available. " +
"Please use sync=false and poll for the status updates.", Status.BAD_REQUEST);
"Please use sync=false and poll for the status updates.", Status.BAD_REQUEST);
}

private void assertAttachmentsPolicy(Path tmpDir, ProcessEntry entry) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,23 @@
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonatype.siesta.Resource;
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
import java.util.*;

import static com.walmartlabs.concord.server.Utils.unwrap;

@Named
@Singleton
@Path("/api/v2/process")
@Tag(name = "ProcessV2")
public class ProcessResourceV2 implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.walmartlabs.concord.common.IOUtils;
import com.walmartlabs.concord.common.TemporaryPath;
import com.walmartlabs.concord.server.MultipartUtils;
import com.walmartlabs.concord.server.org.secret.SecretResource;
import com.walmartlabs.concord.server.process.ProcessEntry;
import com.walmartlabs.concord.server.process.ProcessEntry.ProcessCheckpointEntry;
import com.walmartlabs.concord.server.process.ProcessManager;
Expand All @@ -45,8 +44,6 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
Expand All @@ -58,8 +55,6 @@
import java.util.List;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "Checkpoint")
public class ProcessCheckpointResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import javax.ws.rs.core.MediaType;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v2/process")
@Tag(name = "CheckpointV2")
public class ProcessCheckpointV2Resource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@

import static com.walmartlabs.concord.server.Utils.unwrap;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "Process Events")
public class ProcessEventResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

import static com.walmartlabs.concord.server.process.state.ProcessStateManager.path;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "Process Forms")
public class FormResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
import javax.ws.rs.core.Response;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/process")
@Tag(name = "Process Locks")
public class ProcessLocksResource implements Resource {
Expand Down

0 comments on commit 43f3c52

Please sign in to comment.