2323import java .util .UUID ;
2424import java .util .stream .Stream ;
2525
26- /**
27- * Deploys Progress Data Cloud (PDC) integration endpoints by reading JSON configuration files
28- * from the src/main/pdc-config/service/endpoints directory.
29- */
30- public class DeployPdcEndpointsCommand extends AbstractCommand {
26+ public class DeployMarkLogicEndpointsCommand extends AbstractCommand {
3127
3228 private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper ();
3329
34- public DeployPdcEndpointsCommand () {
30+ public DeployMarkLogicEndpointsCommand () {
3531 setExecuteSortOrder (SortOrderConstants .DEPLOY_PDC_MARKLOGIC_ENDPOINTS );
3632 }
3733
@@ -45,10 +41,10 @@ public void execute(CommandContext context) {
4541 final List <MarkLogicHttpEndpoint > endpoints = readEndpointDefinitionsFromFiles (pdcConfigPaths );
4642 if (!endpoints .isEmpty ()) {
4743 if (!StringUtils .hasText (context .getAppConfig ().getCloudApiKey ())) {
48- logger .warn ("Found configuration for {} PDC endpoint(s), but not deploying them because no cloud API key has been specified." , endpoints .size ());
44+ logger .warn ("Found configuration for {} MarkLogic endpoint(s), but not deploying them because no cloud API key has been specified." , endpoints .size ());
4945 } else {
5046 if (logger .isInfoEnabled ()) {
51- logger .info ("Deploying {} PDC endpoint(s)" , endpoints .size ());
47+ logger .info ("Deploying {} MarkLogic endpoint(s)" , endpoints .size ());
5248 }
5349 deployEndpoints (context , endpoints );
5450 }
@@ -60,24 +56,24 @@ private List<MarkLogicHttpEndpoint> readEndpointDefinitionsFromFiles(List<String
6056
6157 for (String pdcConfigPath : pdcConfigPaths ) {
6258 File serviceDir = new File (pdcConfigPath , "service" );
63- File endpointsDir = new File (serviceDir , "endpoints " );
59+ File endpointsDir = new File (serviceDir , "mlendpoints " );
6460 if (!endpointsDir .exists ()) {
6561 if (logger .isDebugEnabled ()) {
66- logger .debug ("PDC endpoints directory does not exist: {}" , endpointsDir .getAbsolutePath ());
62+ logger .debug ("MarkLogic endpoints directory does not exist: {}" , endpointsDir .getAbsolutePath ());
6763 }
6864 continue ;
6965 }
7066
7167 if (logger .isInfoEnabled ()) {
72- logger .info ("Reading PDC integration endpoints from: {}" , endpointsDir .getAbsolutePath ());
68+ logger .info ("Reading MarkLogic endpoints from: {}" , endpointsDir .getAbsolutePath ());
7369 }
7470
7571 try (Stream <Path > paths = Files .walk (endpointsDir .toPath ())) {
7672 paths .filter (Files ::isRegularFile )
7773 .filter (path -> path .toString ().endsWith (".json" ))
7874 .forEach (path -> endpoints .add (buildEndpointFromFile (path .toFile ())));
7975 } catch (IOException e ) {
80- throw new RuntimeException ("Failed to read PDC endpoint configuration files from: " +
76+ throw new RuntimeException ("Failed to read MarkLogic endpoint configuration files from: " +
8177 endpointsDir .getAbsolutePath (), e );
8278 }
8379 }
@@ -88,14 +84,14 @@ private List<MarkLogicHttpEndpoint> readEndpointDefinitionsFromFiles(List<String
8884 private MarkLogicHttpEndpoint buildEndpointFromFile (File endpointFile ) {
8985 try {
9086 MarkLogicHttpEndpoint endpoint = OBJECT_MAPPER .readValue (endpointFile , MarkLogicHttpEndpoint .class );
91- if (logger .isInfoEnabled ()) {
92- logger .info ("Built PDC endpoint: name={}, displayName={}, port={}, type={}, path={}" ,
87+ if (logger .isDebugEnabled ()) {
88+ logger .debug ("Built MarkLogic endpoint: name={}, displayName={}, port={}, type={}, path={}" ,
9389 endpoint .getName (), endpoint .getDisplayName (), endpoint .getPort (),
9490 endpoint .getType (), endpoint .getPath ());
9591 }
9692 return endpoint ;
9793 } catch (IOException e ) {
98- throw new RuntimeException ("Failed to parse PDC endpoint configuration file: " +
94+ throw new RuntimeException ("Failed to parse MarkLogic endpoint configuration file: " +
9995 endpointFile .getAbsolutePath (), e );
10096 }
10197 }
@@ -107,7 +103,7 @@ private void deployEndpoints(CommandContext context, List<MarkLogicHttpEndpoint>
107103 try {
108104 new ServiceApi (pdcClient .getApiClient ()).apiServiceMlendpointsIdHttpPut (markLogicServiceId , endpoints );
109105 } catch (ApiException e ) {
110- throw new RuntimeException ("Unable to create MarkLogic HTTP endpoints in PDC; cause: %s" .formatted (e .getMessage ()), e );
106+ throw new RuntimeException ("Unable to create MarkLogic endpoints in PDC; cause: %s" .formatted (e .getMessage ()), e );
111107 }
112108 }
113109 }
0 commit comments