Skip to content

Commit

Permalink
concord-server: remove more @nAmed (#839)
Browse files Browse the repository at this point in the history
Co-authored-by: Yury Brigadirenko <[email protected]>
  • Loading branch information
ibodrov and brig authored Dec 26, 2023
1 parent 8b8f152 commit c302761
Show file tree
Hide file tree
Showing 85 changed files with 389 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
import com.walmartlabs.concord.server.console.ConsoleModule;
import com.walmartlabs.concord.server.events.EventModule;
import com.walmartlabs.concord.server.metrics.MetricModule;
import com.walmartlabs.concord.server.org.secret.SecretModule;
import com.walmartlabs.concord.server.org.triggers.TriggersModule;
import com.walmartlabs.concord.server.org.OrganizationModule;
import com.walmartlabs.concord.server.policy.PolicyModule;
import com.walmartlabs.concord.server.process.ProcessModule;
import com.walmartlabs.concord.server.repository.RepositoryModule;
Expand Down Expand Up @@ -81,20 +80,20 @@ public void configure(Binder binder) {

binder.bind(DependencyManagerConfiguration.class).toProvider(DependencyManagerConfigurationProvider.class);

binder.install(new ApiServerModule());

binder.install(new AgentModule());
binder.install(new ApiKeyModule());
binder.install(new ApiServerModule());
binder.install(new AuditLogModule());
binder.install(new ConsoleModule());
binder.install(new EventModule());
binder.install(new OrganizationModule());
binder.install(new PolicyModule());
binder.install(new ProcessModule());
binder.install(new RepositoryModule());
binder.install(new RoleModule());
binder.install(new SecretModule());
binder.install(new SecurityModule());
binder.install(new TemplateModule());
binder.install(new TriggersModule());

bindJaxRsResource(binder, ServerResource.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import com.walmartlabs.concord.server.sdk.ScheduledTask;
import org.eclipse.jetty.servlet.ServletHolder;
import org.sonatype.siesta.Component;
import org.sonatype.siesta.ExceptionMapperSupport;
import org.sonatype.siesta.Resource;

import javax.servlet.Filter;
import javax.ws.rs.ext.ExceptionMapper;
import java.util.List;

import static com.google.inject.Scopes.SINGLETON;
Expand Down Expand Up @@ -95,6 +97,12 @@ public static void bindSingletonScheduledTask(Binder binder, Class<? extends Sch
newSetBinder(binder, ScheduledTask.class).addBinding().to(klass);
}

public static void bindExceptionMapper(Binder binder, Class<? extends ExceptionMapperSupport<?>> klass) {
binder.bind(klass).in(SINGLETON);
newSetBinder(binder, Component.class).addBinding().to(klass);
newSetBinder(binder, ExceptionMapper.class).addBinding().to(klass);
}

private Utils() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.jooq.*;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
import java.util.Map;
import java.util.UUID;
Expand All @@ -42,7 +41,6 @@
import static com.walmartlabs.concord.server.jooq.tables.Users.USERS;
import static org.jooq.impl.DSL.*;

@Named
public class OrganizationDao extends AbstractDao {

private final ConcordObjectMapper objectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.Map;
import java.util.UUID;

@Named
public class OrganizationManager {

// as defined in com/walmartlabs/concord/server/db/0.48.0.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.walmartlabs.concord.server.org;

/*-
* *****
* Concord
* -----
* Copyright (C) 2017 - 2023 Walmart Inc.
* -----
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
* =====
*/

import com.google.inject.Binder;
import com.google.inject.Module;
import com.walmartlabs.concord.server.org.inventory.InventoryModule;
import com.walmartlabs.concord.server.org.jsonstore.JsonStoreModule;
import com.walmartlabs.concord.server.org.policy.PolicyModule;
import com.walmartlabs.concord.server.org.project.ProjectModule;
import com.walmartlabs.concord.server.org.secret.SecretModule;
import com.walmartlabs.concord.server.org.team.TeamModule;
import com.walmartlabs.concord.server.org.triggers.TriggersModule;

import static com.google.inject.Scopes.SINGLETON;
import static com.walmartlabs.concord.server.Utils.bindJaxRsResource;

public class OrganizationModule implements Module {

@Override
public void configure(Binder binder) {
binder.bind(OrganizationDao.class).in(SINGLETON);
binder.bind(OrganizationManager.class).in(SINGLETON);

bindJaxRsResource(binder, OrganizationResource.class);
bindJaxRsResource(binder, ProjectProcessResource.class);

binder.install(new InventoryModule());
binder.install(new JsonStoreModule());
binder.install(new PolicyModule());
binder.install(new ProjectModule());
binder.install(new SecretModule());
binder.install(new TeamModule());
binder.install(new TriggersModule());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@
import org.sonatype.siesta.Resource;

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;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.UUID;

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

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
Expand All @@ -64,8 +62,6 @@
import static com.walmartlabs.concord.server.process.state.ProcessStateManager.path;
import static javax.ws.rs.core.Response.Status;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "Project Processes")
public class ProjectProcessResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.jooq.*;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -39,7 +38,6 @@
import static com.walmartlabs.concord.server.jooq.Tables.JSON_STORE_DATA;
import static org.jooq.impl.DSL.*;

@Named
@Deprecated
public class InventoryDataDao extends AbstractDao {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@
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 java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventory Data")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.walmartlabs.concord.server.org.inventory;

/*-
* *****
* Concord
* -----
* Copyright (C) 2017 - 2023 Walmart Inc.
* -----
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
* =====
*/

import com.google.inject.Binder;
import com.google.inject.Module;

import static com.google.inject.Scopes.SINGLETON;
import static com.walmartlabs.concord.server.Utils.bindJaxRsResource;

@Deprecated
public class InventoryModule implements Module {

@Override
public void configure(Binder binder) {
binder.bind(InventoryDataDao.class).in(SINGLETON);

bindJaxRsResource(binder, InventoryResource.class);
bindJaxRsResource(binder, InventoryDataResource.class);
bindJaxRsResource(binder, InventoryQueryResource.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.sonatype.siesta.Resource;

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 @@ -41,8 +39,6 @@
import java.util.UUID;
import java.util.stream.Collectors;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventory Queries")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@
import org.sonatype.siesta.Validate;

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;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventories")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
import org.apache.shiro.authz.UnauthorizedException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.core.Response;
import java.util.UUID;

@Named
public class JsonStoreAccessManager {

private final UserManager userManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.jooq.*;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand All @@ -49,7 +48,6 @@
import static com.walmartlabs.concord.server.jooq.tables.VUserTeams.V_USER_TEAMS;
import static org.jooq.impl.DSL.*;

@Named
public class JsonStoreDao extends AbstractDao {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.jooq.*;

import javax.inject.Inject;
import javax.inject.Named;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
Expand All @@ -36,7 +35,6 @@
import static org.jooq.impl.DSL.coalesce;
import static org.jooq.impl.DSL.sum;

@Named
public class JsonStoreDataDao extends AbstractDao {

private final ConcordObjectMapper objectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

@Named
@Singleton
public class JsonStoreDataManager {

private static final String DEFAULT_POLICY_MESSAGE = "Maximum data size in the JSON store exceeded: current {0}, limit {1}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,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.List;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "JsonStoreData")
public class JsonStoreDataResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;

@Named
public class JsonStoreManager {

private static final String DEFAULT_POLICY_MESSAGE = "Maximum number of JSON stores exceeded: current {0}, limit {1}";
Expand Down
Loading

0 comments on commit c302761

Please sign in to comment.