Skip to content

Commit

Permalink
fix(TCOMP-2564): component-starter image issues (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
undx authored Nov 7, 2023
1 parent 5ec5270 commit 02758cb
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ public class ApiDemoEndpoints {

private static final String PATH_CONFIGURATIONTYPE_MIGRATE = "/api/v1/configurationtype/migrate";

public static final String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin";

public static final String HEADER_ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods";

public static final String HEADER_ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";

public static final String VALUE_ACCESS_CONTROL_ALLOW_HEADERS = "Content-Type, api_key, Authorization";

public static final String VALUE_ACCESS_CONTROL_ALLOW_ORIGIN = "*";

public static final String VALUE_ACCESS_CONTROL_ALLOW_METHODS = "GET, POST, DELETE, PUT, PATCH, OPTIONS";

private final byte[] ENVIRONMENT;

private final Object ACTION_INDEX;
Expand Down Expand Up @@ -145,15 +157,27 @@ public Response environment(@PathParam("version") final String version) {
.add("time", ZonedDateTime.now().toString())
.add("version", version)
.build();
return Response.ok(env).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(env)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
@Path(RES_VERSION + PATH_ACTION_INDEX)
@Produces({ APPLICATION_JSON })
public Response actionIndex(@PathParam("version") final String version, @QueryParam("type") final String[] types,
@QueryParam("family") final String[] families, @QueryParam("language") final String lang) {
return Response.ok(ACTION_INDEX).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(ACTION_INDEX)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@POST
Expand All @@ -162,7 +186,13 @@ public Response actionIndex(@PathParam("version") final String version, @QueryPa
public Response actionExecute(@PathParam("version") final String version, @QueryParam("family") final String family,
@QueryParam("type") final String type, @QueryParam("action") final String action,
@QueryParam("lang") final String lang) {
return Response.ok(ACTION_EXECUTE).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(ACTION_EXECUTE)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
Expand All @@ -172,7 +202,13 @@ public Response componentIndex(@PathParam("version") final String version,
@QueryParam("language") @DefaultValue("en") final String language,
@QueryParam("includeIconContent") @DefaultValue("false") final boolean includeIconContent,
@QueryParam("q") final String query) {
return Response.ok(COMPONENT_INDEX).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(COMPONENT_INDEX)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
Expand All @@ -181,44 +217,80 @@ public Response componentIndex(@PathParam("version") final String version,
public Response componentDetails(@PathParam("version") final String version,
@QueryParam("language") @DefaultValue("en") final String language,
@QueryParam("identifiers") final String[] ids) {
return Response.ok(COMPONENT_DETAILS).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(COMPONENT_DETAILS)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
@Path(RES_VERSION + PATH_COMPONENT_DEPENDENCIES)
@Produces({ APPLICATION_JSON })
public Response componentDependencies(@PathParam("version") final String version,
@QueryParam("identifier") final String[] ids) {
return Response.ok(COMPONENT_DEPENDENCIES).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(COMPONENT_DEPENDENCIES)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
@Path(RES_VERSION + PATH_COMPONENT_DEPENDENCY + "/{id}")
@Produces({ APPLICATION_OCTET_STREAM })
public Response componentDependency(@PathParam("version") final String version, @PathParam("id") final String id) {
return Response.ok(COMPONENT_DEPENDENCIES).type(APPLICATION_OCTET_STREAM_TYPE).build();
return Response
.ok(COMPONENT_DEPENDENCIES)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_OCTET_STREAM_TYPE)
.build();
}

@GET
@Path(RES_VERSION + PATH_COMPONENT_ICON + "/{id}")
@Produces({ APPLICATION_OCTET_STREAM })
public Response componentIcon(@PathParam("version") final String version, @PathParam("id") final String id) {
return Response.ok(COMPONENT_ICON).type(APPLICATION_OCTET_STREAM_TYPE).build();
return Response
.ok(COMPONENT_ICON)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_OCTET_STREAM_TYPE)
.build();
}

@GET
@Path(RES_VERSION + PATH_COMPONENT_ICON_FAMILY + "/{id}")
@Produces({ APPLICATION_OCTET_STREAM })
public Response componentIconFamily(@PathParam("version") final String version, @PathParam("id") final String id) {
return Response.ok(COMPONENT_ICON_FAMILY).type(APPLICATION_OCTET_STREAM_TYPE).build();
return Response
.ok(COMPONENT_ICON_FAMILY)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_OCTET_STREAM_TYPE)
.build();
}

@POST
@Path(RES_VERSION + PATH_COMPONENT_MIGRATE + "/{id}/{configurationVersion}")
@Produces({ APPLICATION_JSON })
public Response componentMigrate(@PathParam("version") final String version, @PathParam("id") final String id,
@PathParam("configurationVersion") final int migrateVersion, final Map<String, String> config) {
return Response.ok(COMPONENT_MIGRATE).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(COMPONENT_MIGRATE)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
Expand All @@ -228,7 +300,13 @@ public Response configurationtypeIndex(@PathParam("version") final String versio
@QueryParam("language") @DefaultValue("en") final String language,
@QueryParam("lightPayload") @DefaultValue("true") final boolean lightPayload,
@QueryParam("q") final String query) {
return Response.ok(CONFIGURATIONTYPE_INDEX).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(CONFIGURATIONTYPE_INDEX)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@GET
Expand All @@ -237,7 +315,13 @@ public Response configurationtypeIndex(@PathParam("version") final String versio
public Response configurationtypeDetails(@PathParam("version") final String version,
@QueryParam("language") @DefaultValue("en") final String language,
@QueryParam("identifiers") final String[] ids) {
return Response.ok(CONFIGURATIONTYPE_DETAILS).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(CONFIGURATIONTYPE_DETAILS)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}

@POST
Expand All @@ -246,6 +330,12 @@ public Response configurationtypeDetails(@PathParam("version") final String vers
public Response configurationtypeMigrate(@PathParam("version") final String version,
@PathParam("id") final String id, @PathParam("configurationVersion") final int migrateVersion,
final Map<String, String> config) {
return Response.ok(CONFIGURATIONTYPE_MIGRATE).type(APPLICATION_JSON_TYPE).build();
return Response
.ok(CONFIGURATIONTYPE_MIGRATE)
.header(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, VALUE_ACCESS_CONTROL_ALLOW_ORIGIN)
.header(HEADER_ACCESS_CONTROL_ALLOW_METHODS, VALUE_ACCESS_CONTROL_ALLOW_METHODS)
.header(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, VALUE_ACCESS_CONTROL_ALLOW_HEADERS)
.type(APPLICATION_JSON_TYPE)
.build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void refresh() {
parser.parse(metadata, handler);
if (handler.release != null) {
final String release = handler.release.toString();
if (!release.equals(snapshot.getKit())) {
if (!release.equals(snapshot.getKit()) && !"10.57.0".equals(release)) {
synchronized (this) {
log.info("Updating current version from {} to {}", snapshot.getKit(), release);
doUpdate(() -> base
Expand Down
2 changes: 0 additions & 2 deletions images/component-starter-server-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
<MEECROWAVE_BASE>${docker.talend.dir.app}</MEECROWAVE_BASE>
<MEECROWAVE_PID>${docker.talend.dir.app}conf/server.pid</MEECROWAVE_PID>
<MEECROWAVE-PROPERTIES>${docker.talend.dir.app}conf/meecrowave.properties</MEECROWAVE-PROPERTIES>
<TALEND_JDK_SERIAL_FILTER>oracle.sql.**;!*</TALEND_JDK_SERIAL_FILTER>
<CLASSPATH>${docker.talend.dir.app}lib/*:${docker.talend.dir.app}custom/*:${docker.talend.dir.base}extensions/*:${docker.talend.dir.app}resources:${docker.talend.dir.app}classes</CLASSPATH>
<JDK_JAVA_OPTIONS>-Djdk.serialFilter=${TALEND_JDK_SERIAL_FILTER} -agentlib:jdwp=server=y,transport=dt_socket,suspend=y,address=*:5005 -Djava.security.egd=file:/dev/./urandom -Djava.io.tmpdir=${docker.talend.dir.app}temp -Dhttp=${docker.image.port} -Dmeecrowave.home=${docker.talend.dir.app} -Dmeecrowave.base=${docker.talend.dir.app} -Dmeecrowave-properties=${docker.talend.dir.app}conf/meecrowave.properties -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager -Dlog4j.configurationFile=${docker.talend.dir.app}conf/log4j2.xml --add-opens java.base/java.util=ALL-UNNAMED</JDK_JAVA_OPTIONS>
</environment>
<labels>
<com.talend.docker.cmd>docker run -d -p ${docker.image.port}:${docker.image.port} ${docker.image.to}</com.talend.docker.cmd>
Expand Down

0 comments on commit 02758cb

Please sign in to comment.