Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import ecf4.latest.tyler.efm.wsdl.webservicesprofile_implementation_4_0.CourtRecordMDEService;
import ecf4.latest.tyler.efm.wsdl.webservicesprofile_implementation_4_0.FilingReviewMDEService;
import ecf4.latest.tyler.efm.wsdl.webservicesprofile_implementation_4_0.ServiceMDEService;
import edu.suffolk.litlab.efsp.ConfigurationLoader;
import edu.suffolk.litlab.efsp.Jurisdiction;
import jakarta.xml.ws.WebServiceFeature;
import java.net.URL;
import java.util.Optional;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -23,6 +26,21 @@ public class SoapClientChooser {
private static final String RECORD_SUFFIX = "-ECF-4.0-CourtRecordMDEService.wsdl";
private static final String SCHEDULE_SUFFIX = "-v5-CourtSchedulingMDE.wsdl";

private static Optional<Boolean> shouldLogRequests = Optional.empty();

public static boolean shouldLogRequests() {
if (shouldLogRequests.isEmpty()) {
shouldLogRequests = Optional.of(ConfigurationLoader.shouldLogRequests());
}
return shouldLogRequests.orElse(false);
}

public static WebServiceFeature getLoggingFeature() {
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
return loggingFeature;
}

private static URL getRes(TylerDomain domain, TylerVersion version, String suffix) {
String wsdlPath =
"wsdl/"
Expand All @@ -45,22 +63,45 @@ public static Optional<FilingReviewMDEService> getFilingReviewFactory(Jurisdicti
var domain = new TylerDomain(jurisdiction, TylerClients.getTylerEnv());
return version.map(
v -> {
boolean shouldLog = shouldLogRequests();
URL url = getRes(domain, v, REVIEW_SUFFIX);
return new FilingReviewMDEService(url);
if (shouldLog) {
return new FilingReviewMDEService(url, getLoggingFeature());
} else {
return new FilingReviewMDEService(url);
}
});
}

public static Optional<ServiceMDEService> getServiceFactory(Jurisdiction jurisdiction) {
var version = TylerClients.getVersion(jurisdiction);
var domain = new TylerDomain(jurisdiction, TylerClients.getTylerEnv());

return version.map(v -> new ServiceMDEService(getRes(domain, v, SERVICE_SUFFIX)));
return version.map(
v -> {
boolean shouldLog = shouldLogRequests();
URL url = getRes(domain, v, SERVICE_SUFFIX);
if (shouldLog) {
return new ServiceMDEService(url, getLoggingFeature());
} else {
return new ServiceMDEService(url);
}
});
}

public static Optional<CourtRecordMDEService> getCourtRecordFactory(Jurisdiction jurisdiction) {
var version = TylerClients.getVersion(jurisdiction);
var domain = new TylerDomain(jurisdiction, TylerClients.getTylerEnv());
return version.map(v -> new CourtRecordMDEService(getRes(domain, v, RECORD_SUFFIX)));
return version.map(
v -> {
boolean shouldLog = shouldLogRequests();
URL url = getRes(domain, v, RECORD_SUFFIX);
if (shouldLog) {
return new CourtRecordMDEService(url, getLoggingFeature());
} else {
return new CourtRecordMDEService(url);
}
});
}

public static Optional<CourtSchedulingMDE_Service> getCourtSchedulingFactory(
Expand All @@ -70,6 +111,15 @@ public static Optional<CourtSchedulingMDE_Service> getCourtSchedulingFactory(
}
var version = TylerClients.getVersion(jurisdiction);
var domain = new TylerDomain(jurisdiction, TylerClients.getTylerEnv());
return version.map(v -> new CourtSchedulingMDE_Service(getRes(domain, v, SCHEDULE_SUFFIX)));
return version.map(
v -> {
boolean shouldLog = shouldLogRequests();
URL url = getRes(domain, v, SCHEDULE_SUFFIX);
if (shouldLog) {
return new CourtSchedulingMDE_Service(url, getLoggingFeature());
} else {
return new CourtSchedulingMDE_Service(url);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
import ecf5.TylerCourtSchedulingMDEService;
import ecf5.TylerFilingAssemblyMDEService;
import ecf5.TylerFilingReviewMDEService;
import edu.suffolk.litlab.efsp.ConfigurationLoader;
import edu.suffolk.litlab.efsp.Jurisdiction;
import edu.suffolk.litlab.efsp.tyler.TylerClients;
import edu.suffolk.litlab.efsp.tyler.TylerDomain;
import edu.suffolk.litlab.efsp.tyler.TylerVersion;
import jakarta.xml.ws.BindingProvider;
import jakarta.xml.ws.WebServiceFeature;
import java.net.URL;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -34,15 +37,39 @@ public class SoapClientChooserV5 {
private static final String TYLER_FILING_ASSEM_WSDL = "-ECF5-TylerFilingAssemblyMDEService.wsdl";
private static final String TYLER_FILING_REVIEW_WSDL = "-ECF5-TylerFilingReviewMDEService.wsdl";

private static Optional<Boolean> shouldLogRequests = Optional.empty();

public static boolean shouldLogRequests() {
if (shouldLogRequests.isEmpty()) {
shouldLogRequests = Optional.of(ConfigurationLoader.shouldLogRequests());
}
return shouldLogRequests.orElse(false);
}

public static WebServiceFeature getLoggingFeature() {
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
return loggingFeature;
}

public static Optional<Function<Consumer<BindingProvider>, CourtPolicyClient>>
getCourtPolicyFactory(Jurisdiction jurisdiction) {
var version = TylerClients.getVersion(jurisdiction);
var domain = new TylerDomain(jurisdiction, TylerClients.getTylerEnv());
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, COURT_POLICY_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u -> (consume) -> new CourtPolicyClient(new CourtPolicyMDEService(u), v, consume));
u ->
(consume) -> {
if (shouldLog) {
return new CourtPolicyClient(
new CourtPolicyMDEService(u, getLoggingFeature()), v, consume);
} else {
return new CourtPolicyClient(new CourtPolicyMDEService(u), v, consume);
}
});
});
}

Expand All @@ -53,8 +80,17 @@ public class SoapClientChooserV5 {
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, COURT_RECORD_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u -> (consume) -> new CourtRecordClient(new CourtRecordMDEService(u), v, consume));
u ->
(consume) -> {
if (shouldLog) {
return new CourtRecordClient(
new CourtRecordMDEService(u, getLoggingFeature()), v, consume);
} else {
return new CourtRecordClient(new CourtRecordMDEService(u), v, consume);
}
});
});
}

Expand All @@ -65,10 +101,18 @@ public class SoapClientChooserV5 {
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, COURT_SCHED_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) ->
new CourtSchedulingClient(new CourtSchedulingMDEService(u), v, consume));
(consume) -> {
if (shouldLog) {
return new CourtSchedulingClient(
new CourtSchedulingMDEService(u, getLoggingFeature()), v, consume);
} else {
return new CourtSchedulingClient(
new CourtSchedulingMDEService(u), v, consume);
}
});
});
}

Expand All @@ -79,8 +123,17 @@ public class SoapClientChooserV5 {
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, FILING_REVIEW_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u -> (consume) -> new FilingReviewClient(new FilingReviewMDEService(u), v, consume));
u ->
(consume) -> {
if (shouldLog) {
return new FilingReviewClient(
new FilingReviewMDEService(u, getLoggingFeature()), v, consume);
} else {
return new FilingReviewClient(new FilingReviewMDEService(u), v, consume);
}
});
});
}

Expand All @@ -91,7 +144,17 @@ public static Optional<Function<Consumer<BindingProvider>, ServiceClient>> getSe
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, SERVICE_WSDL);
return url.map(u -> (consume) -> new ServiceClient(new ServiceMDEService(u), v, consume));
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) -> {
if (shouldLog) {
return new ServiceClient(
new ServiceMDEService(u, getLoggingFeature()), v, consume);
} else {
return new ServiceClient(new ServiceMDEService(u), v, consume);
}
});
});
}

Expand All @@ -102,10 +165,18 @@ public static Optional<Function<Consumer<BindingProvider>, ServiceClient>> getSe
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, TYLER_COURT_RECORD_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) ->
new TylerCourtRecordClient(new TylerCourtRecordMDEService(u), v, consume));
(consume) -> {
if (shouldLog) {
return new TylerCourtRecordClient(
new TylerCourtRecordMDEService(u, getLoggingFeature()), v, consume);
} else {
return new TylerCourtRecordClient(
new TylerCourtRecordMDEService(u), v, consume);
}
});
});
}

Expand All @@ -116,11 +187,18 @@ public static Optional<Function<Consumer<BindingProvider>, ServiceClient>> getSe
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, TYLER_COURT_SCHED_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) ->
new TylerCourtSchedulingClient(
new TylerCourtSchedulingMDEService(u), v, consume));
(consume) -> {
if (shouldLog) {
return new TylerCourtSchedulingClient(
new TylerCourtSchedulingMDEService(u, getLoggingFeature()), v, consume);
} else {
return new TylerCourtSchedulingClient(
new TylerCourtSchedulingMDEService(u), v, consume);
}
});
});
}

Expand All @@ -131,11 +209,18 @@ public static Optional<Function<Consumer<BindingProvider>, ServiceClient>> getSe
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, TYLER_FILING_ASSEM_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) ->
new TylerFilingAssemblyClient(
new TylerFilingAssemblyMDEService(u), v, consume));
(consume) -> {
if (shouldLog) {
return new TylerFilingAssemblyClient(
new TylerFilingAssemblyMDEService(u, getLoggingFeature()), v, consume);
} else {
return new TylerFilingAssemblyClient(
new TylerFilingAssemblyMDEService(u), v, consume);
}
});
});
}

Expand All @@ -146,10 +231,18 @@ public static Optional<Function<Consumer<BindingProvider>, ServiceClient>> getSe
return version.flatMap(
v -> {
var url = createLocalWsdlUrl(domain, v, TYLER_FILING_REVIEW_WSDL);
boolean shouldLog = shouldLogRequests();
return url.map(
u ->
(consume) ->
new TylerFilingReviewClient(new TylerFilingReviewMDEService(u), v, consume));
(consume) -> {
if (shouldLog) {
return new TylerFilingReviewClient(
new TylerFilingReviewMDEService(u, getLoggingFeature()), v, consume);
} else {
return new TylerFilingReviewClient(
new TylerFilingReviewMDEService(u), v, consume);
}
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,23 @@ protected EfspServer(
sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(new ArrayList<Class<?>>(services.keySet()));

LoggingFeature loggingFeature = new LoggingFeature();
// TODO(brycew): control this from a cofig
loggingFeature.addSensitiveElementNames(
Set.of("api_key", "password", "Password", "TYLER-TOKEN-ILLINOIS", "TYLER-ID-ILLINOIS"));
loggingFeature.addSensitiveProtocolHeaderNames(
Set.of(
"TYLER-TOKEN-ILLINOIS",
"TYLER-TOKEN-MASSACHUSETTS",
"TYLER-TOKEN-VERMONT",
"TYLER-ID-ILLINOIS",
"X-API-KEY",
"x-api-key",
"X-Api-Key"));
loggingFeature.setPrettyLogging(true);
sf.setFeatures(List.of(loggingFeature));
if (ConfigurationLoader.shouldLogRequests()) {
LoggingFeature loggingFeature = new LoggingFeature();
// TODO(brycew): control this from a cofig
loggingFeature.addSensitiveElementNames(
Set.of("api_key", "password", "Password", "TYLER-TOKEN-ILLINOIS", "TYLER-ID-ILLINOIS"));
loggingFeature.addSensitiveProtocolHeaderNames(
Set.of(
"TYLER-TOKEN-ILLINOIS",
"TYLER-TOKEN-MASSACHUSETTS",
"TYLER-TOKEN-VERMONT",
"TYLER-ID-ILLINOIS",
"X-API-KEY",
"x-api-key",
"X-Api-Key"));
loggingFeature.setPrettyLogging(true);
sf.setFeatures(List.of(loggingFeature));
}

for (Map.Entry<Class<?>, SingletonResourceProvider> prov : services.entrySet()) {
sf.setResourceProvider(prov.getKey(), prov.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private boolean downloadCourtTables(
String baseUrl)
throws JAXBException, IOException, SQLException {
MDC.put(MDCWrappers.SESSION_ID, location);
log.info("Doing updates for: {}, tables: {}", location, tables);
log.info("Doing updates for: {},\ttables: {}", location, tables);
Instant downloadStart = Instant.now();
// TODO(brycew-later): check that the effective date is later than today
// JAXBElement<?> obj = ccl.getEffectiveDate().getDateRepresentation();
Expand Down Expand Up @@ -327,7 +327,7 @@ private boolean downloadCourtTables(
var downloadInc = Duration.between(downloadStart, Instant.now());
downloadDuration = downloadDuration.plus(downloadInc);
log.info(
"Location: {}: Downloads took: {} (total: {})", location, downloadInc, downloadDuration);
"Location: {}:\tDownloads took: {} (total: {})", location, downloadInc, downloadDuration);

Instant updateStart = Instant.now();
for (DownloadedCodes down : downloaded.values()) {
Expand All @@ -344,7 +344,7 @@ private boolean downloadCourtTables(
updateDuration = updateDuration.plus(updateInc);

cd.commit();
log.info("Location: {}: updates took: {} (total: {})", location, updateInc, updateDuration);
log.info("Location: {}:\tupdates took: {} (total: {})", location, updateInc, updateDuration);
MDC.remove(MDCWrappers.REQUEST_ID);
MDC.remove(MDCWrappers.SESSION_ID);
return true;
Expand Down Expand Up @@ -419,7 +419,7 @@ public boolean updateAll(String baseUrl, FilingReviewMDEPort filingPort, CodeDat
final String courtLocation = courtAndTables.getKey();
List<String> tables = courtAndTables.getValue();
log.debug(
"In {}, removing entries for court {} for tables: {}",
"In {},\nremoving entries for court {} for tables: {}",
cd.getJurisdiction(),
courtLocation,
tables);
Expand Down
Loading