├── CliClient
├── dump.jfr
├── src
│ └── main
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── client
│ │ ├── web
│ │ ├── HttpResult.java
│ │ ├── HttpPayloadParseLine.java
│ │ ├── PerformOneRequest.java
│ │ ├── NetworkRequestRunnable.java
│ │ ├── OParseLine.java
│ │ ├── HttpPayload.java
│ │ ├── LoggingConfig.java
│ │ ├── PerformRequests.java
│ │ └── Utils.java
│ │ ├── event
│ │ └── RequestEvent.java
│ │ ├── BenchmarkRunner.java
│ │ ├── cli
│ │ ├── LocalRequestRunnable.java
│ │ └── CreateJspFromRequestRunnable.java
│ │ └── arguments
│ │ └── CliArguments.java
└── nbactions.xml
├── Client
├── nbproject
│ └── project.properties
├── src
│ ├── main
│ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ ├── client
│ │ │ ├── impl
│ │ │ │ ├── PayloadProcessor.java
│ │ │ │ ├── TextGenerator.java
│ │ │ │ ├── NetFlowData.java
│ │ │ │ ├── ParseLine.java
│ │ │ │ ├── ImageGenerator.java
│ │ │ │ ├── Helper.java
│ │ │ │ ├── PayloadHelper.java
│ │ │ │ └── PayloadScheduler.java
│ │ │ └── Result.java
│ │ │ ├── service
│ │ │ ├── Service.java
│ │ │ └── ServiceLookupOverride.java
│ │ │ └── payload
│ │ │ ├── Text.java
│ │ │ └── Image.java
│ └── test
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── client
│ │ └── impl
│ │ ├── ParseLineTest.java
│ │ └── HelperTest.java
└── pom.xml
├── .gitignore
├── JettyServer
├── src
│ ├── release
│ │ ├── prepare.sh
│ │ ├── dumpster.properties
│ │ ├── Dockerfile
│ │ ├── logging.properties
│ │ └── entrypoint.sh
│ └── main
│ │ ├── webapp
│ │ └── web
│ │ │ └── default.jsp
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── jetty
│ │ ├── TestServlet.java
│ │ └── EmbeddedJspStarter.java
└── nb-configuration.xml
├── dumpster.properties
├── OutsideDumpster
├── META-INF
│ └── services
│ │ └── javax.annotation.processing.Processor
├── docs
│ └── jconsole-bug.png
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── META-INF
│ │ │ │ └── services
│ │ │ │ └── javax.annotation.processing.Processor
│ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ └── outside
│ │ │ ├── SettingsMBean.java
│ │ │ ├── BugBehaviourMXBean.java
│ │ │ ├── Buggy.java
│ │ │ ├── Settings.java
│ │ │ └── BuggyClassesProcessor.java
│ └── test
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── outside
│ │ ├── BuggyClassTest.java
│ │ ├── BuggyClassDefaultFalseTest.java
│ │ ├── BugBehaviourTest.java
│ │ └── BuggyTestHelper.java
├── readme.md
└── pom.xml
├── DatabaseServer
├── src
│ ├── release
│ │ ├── Dockerfile
│ │ ├── prepare.sh
│ │ └── entrypoint.sh
│ └── main
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── database
│ │ ├── Server.java
│ │ └── DatabaseGeneratorArguments.java
└── derby-pool-tracing.log
├── BusinessLogic
├── BusinessLogic-8
│ ├── src
│ │ ├── main
│ │ │ └── java
│ │ │ │ ├── inside
│ │ │ │ └── dumpster
│ │ │ │ │ ├── monitoring
│ │ │ │ │ ├── TransactionId.java
│ │ │ │ │ ├── event
│ │ │ │ │ │ ├── Setting.java
│ │ │ │ │ │ ├── DataUpload.java
│ │ │ │ │ │ ├── UnhandledServiceCall.java
│ │ │ │ │ │ ├── DataProcessing.java
│ │ │ │ │ │ ├── ServiceCall.java
│ │ │ │ │ │ └── ServiceInvocation.java
│ │ │ │ │ ├── BusinessApplication.java
│ │ │ │ │ ├── TransactionEvent.java
│ │ │ │ │ └── Event.java
│ │ │ │ │ ├── bidding
│ │ │ │ │ ├── BiddingResult.java
│ │ │ │ │ ├── bid
│ │ │ │ │ │ ├── Bidder.java
│ │ │ │ │ │ ├── BidResult.java
│ │ │ │ │ │ └── BidProcessor.java
│ │ │ │ │ └── BiddingPayload.java
│ │ │ │ │ ├── credits
│ │ │ │ │ ├── CreditsResult.java
│ │ │ │ │ ├── CreditsPayload.java
│ │ │ │ │ └── CreditsService.java
│ │ │ │ │ ├── jackrabbit
│ │ │ │ │ ├── JackRabbitPayload.java
│ │ │ │ │ └── JackRabbitResult.java
│ │ │ │ │ ├── util
│ │ │ │ │ ├── ThreadHelper.java
│ │ │ │ │ └── ThreadHelperImpl.java
│ │ │ │ │ ├── bl
│ │ │ │ │ ├── auth
│ │ │ │ │ │ ├── MustAcceptCookiesError.java
│ │ │ │ │ │ ├── UnauthorizedException.java
│ │ │ │ │ │ ├── NotAuthorizedError.java
│ │ │ │ │ │ ├── Authenticator.java
│ │ │ │ │ │ ├── User.java
│ │ │ │ │ │ ├── CachedUser.java
│ │ │ │ │ │ └── UserCache.java
│ │ │ │ │ ├── ServiceLookupInterface.java
│ │ │ │ │ ├── BusinessLogicException.java
│ │ │ │ │ ├── BusinessLogicService.java
│ │ │ │ │ ├── DefaultBusinessLogicService.java
│ │ │ │ │ ├── SMerviceLookupOverride.java
│ │ │ │ │ └── BusinessLogicServiceWrapper.java
│ │ │ │ │ ├── energy
│ │ │ │ │ ├── EnergyPayload.java
│ │ │ │ │ ├── EnergyResult.java
│ │ │ │ │ ├── EnergyService.java
│ │ │ │ │ └── EnergyDepositV2.java
│ │ │ │ │ └── eldorado
│ │ │ │ │ ├── ElDoradoPayload.java
│ │ │ │ │ └── ElDoradoService.java
│ │ │ │ └── mupp.java
│ │ └── test
│ │ │ ├── resources
│ │ │ └── logging.properties
│ │ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ └── eldorado
│ │ │ └── ElDoradoServiceTest.java
│ └── nb-configuration.xml
├── BusinessLogic-11
│ ├── src
│ │ ├── main
│ │ │ └── java
│ │ │ │ └── inside
│ │ │ │ └── dumpster
│ │ │ │ ├── uploadimage
│ │ │ │ ├── UploadImageResult.java
│ │ │ │ └── UploadImagePayload.java
│ │ │ │ ├── uploadtext
│ │ │ │ ├── UploadTextResult.java
│ │ │ │ ├── UploadTextPayload.java
│ │ │ │ └── UploadTextService.java
│ │ │ │ ├── monitoring
│ │ │ │ ├── BusinessApplication.java
│ │ │ │ ├── TransactionId.java
│ │ │ │ ├── TransactionEvent.java
│ │ │ │ ├── event
│ │ │ │ │ ├── UnhandledServiceCall.java
│ │ │ │ │ ├── ServiceCall.java
│ │ │ │ │ ├── DataUpload.java
│ │ │ │ │ ├── DataProcessingDetail.java
│ │ │ │ │ ├── DataProcessing.java
│ │ │ │ │ └── ServiceInvocation.java
│ │ │ │ └── Event.java
│ │ │ │ └── enhanceimage
│ │ │ │ ├── EnhanceImagePayload.java
│ │ │ │ └── EnhanceImageResult.java
│ │ └── test
│ │ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ ├── monitoring
│ │ │ └── BusinessApplicationTest.java
│ │ │ ├── outside
│ │ │ └── BuggyClassesListTest.java
│ │ │ └── enhanceimage
│ │ │ └── EnhanceImageServiceTest.java
│ └── pom.xml
├── BusinessLogic-Base
│ └── readme.md
├── BusinessLogic-21
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ └── util
│ │ │ └── ThreadHelperImpl.java
│ └── pom.xml
├── readme.md
└── pom.xml
├── MicronautServer
├── src
│ └── main
│ │ ├── resources
│ │ ├── application.yml
│ │ └── logback.xml
│ │ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── micronaut
│ │ ├── Application.java
│ │ └── MicronautService.java
└── micronaut-cli.yml
├── Monitoring
├── Monitoring-Base
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ └── monitoring
│ │ │ ├── Monitoring.java
│ │ │ ├── MonitoringEvent.java
│ │ │ └── MonitoringFactory.java
│ ├── pom.xml
│ └── nb-configuration.xml
├── MonitoringJFR2
│ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── inside
│ │ │ └── dumpster
│ │ │ └── monitoring
│ │ │ ├── MonitoringImpl.java
│ │ │ └── StringEvent.java
│ └── pom.xml
└── pom.xml
├── Backend
└── src
│ ├── main
│ └── java
│ │ └── inside
│ │ └── dumpster
│ │ └── backend
│ │ ├── repository
│ │ ├── data
│ │ │ ├── Data.java
│ │ │ ├── Id.java
│ │ │ ├── LImage.java
│ │ │ ├── AbstractData.java
│ │ │ ├── DataUtils.java
│ │ │ └── Text.java
│ │ ├── Storage.java
│ │ ├── Repository.java
│ │ ├── StoredData.java
│ │ ├── TextRepository.java
│ │ └── ImageRepository.java
│ │ ├── BackendException.java
│ │ ├── auth
│ │ ├── Security.java
│ │ ├── UserInfo.java
│ │ └── UserRepository.java
│ │ ├── utils
│ │ └── Utils.java
│ │ ├── database
│ │ ├── Database.java
│ │ └── DummyDatabaseImpl.java
│ │ └── Backend.java
│ └── test
│ └── java
│ └── inside
│ └── dumpster
│ └── outside
│ └── BuggyClassesListTest.java
├── BackendAPI
├── src
│ └── main
│ │ ├── java
│ │ └── inside
│ │ │ └── dumpster
│ │ │ └── backend
│ │ │ ├── api
│ │ │ └── CreditVault.java
│ │ │ └── database
│ │ │ └── DatabaseQueryEvent.java
│ │ └── java17
│ │ └── inside
│ │ └── dumpster
│ │ └── backend
│ │ └── database
│ │ └── DatabaseQueryEvent.java
└── nb-configuration.xml
├── DumpsterDiving
└── pom.xml
├── runstandaloneclient.sh
├── logging.properties
├── runjettyserver.sh
├── .github
└── workflows
│ └── maven.yml
├── runmicronaut.sh
└── runclient.sh
/CliClient/dump.jfr:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Client/nbproject/project.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /*/target/
2 | /*/*/target/
3 | /release
4 | derby.log
--------------------------------------------------------------------------------
/JettyServer/src/release/prepare.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This script prepares the jetty server
3 |
4 | mkdir logs
5 |
--------------------------------------------------------------------------------
/dumpster.properties:
--------------------------------------------------------------------------------
1 | database_connection_url=jdbc:derby://localhost:1527/dumpster
2 | #service_lookup=.*:Bidding
3 |
--------------------------------------------------------------------------------
/OutsideDumpster/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | inside.dumpster.outside.BuggyClassesProcessor
2 |
--------------------------------------------------------------------------------
/OutsideDumpster/docs/jconsole-bug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaokim/inside-java-dumpster/HEAD/OutsideDumpster/docs/jconsole-bug.png
--------------------------------------------------------------------------------
/OutsideDumpster/src/main/resources/META-INF/services/javax.annotation.processing.Processor:
--------------------------------------------------------------------------------
1 | inside.dumpster.outside.BuggyClassesProcessor
2 |
--------------------------------------------------------------------------------
/JettyServer/src/release/dumpster.properties:
--------------------------------------------------------------------------------
1 | database_connection_url=jdbc:derby://dumpsterpod-dumpsterdb:1527/dumpster
2 | service_lookup=.*:Bidding
3 |
--------------------------------------------------------------------------------
/DatabaseServer/src/release/Dockerfile:
--------------------------------------------------------------------------------
1 | # Database dockerfile
2 | FROM jdk:21
3 |
4 | WORKDIR /app/dumpster
5 | COPY dumpster ./
6 |
7 | WORKDIR /app
8 | COPY DatabaseServer.jar ./
9 | COPY entrypoint.sh ./
10 |
11 | ENTRYPOINT ["/bin/sh"]
12 | CMD ["entrypoint.sh"]
13 |
--------------------------------------------------------------------------------
/JettyServer/src/release/Dockerfile:
--------------------------------------------------------------------------------
1 | # Jetty dockerfile
2 | FROM jdk:17
3 |
4 | WORKDIR /app
5 |
6 | COPY JettyServer.jar ./
7 | COPY entrypoint.sh ./
8 | COPY dumpster.properties ./
9 | COPY logging.properties ./
10 |
11 | ENTRYPOINT ["/bin/sh"]
12 | CMD ["entrypoint.sh"]
13 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/TransactionId.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 |
7 | /**
8 | *
9 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
10 | */
11 | public @interface TransactionId {
12 | }
13 |
--------------------------------------------------------------------------------
/MicronautServer/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | micronaut:
2 | application:
3 | name: MicronautServer
4 | server:
5 | port: 8081
6 | max-request-size: '100MB'
7 | multipart:
8 | max-file-size: '100MB'
9 | netty:
10 | default:
11 | allocator:
12 | max-order: 3
13 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bidding/BiddingResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bidding;
5 |
6 | import inside.dumpster.client.Result;
7 |
8 | /**
9 | *
10 | * @author jsnor
11 | */
12 | public class BiddingResult extends Result {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/MicronautServer/micronaut-cli.yml:
--------------------------------------------------------------------------------
1 | applicationType: default
2 | defaultPackage: inside.dumpster
3 | testFramework: junit
4 | sourceLanguage: java
5 | buildTool: maven
6 | features: [annotation-api, app-name, graalvm, http-client, jackson-databind, java, java-application, junit, logback, maven, netty-server, readme, shade, yaml]
7 |
--------------------------------------------------------------------------------
/Monitoring/Monitoring-Base/src/main/java/inside/dumpster/monitoring/Monitoring.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface Monitoring {
11 | public MonitoringEvent createEvent();
12 | }
13 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/Setting.java:
--------------------------------------------------------------------------------
1 | /*
2 | */
3 | package inside.dumpster.monitoring.event;
4 |
5 | import inside.dumpster.monitoring.Event;
6 |
7 |
8 | /**
9 | *
10 | * @author jsnor
11 | */
12 | public class Setting extends Event {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/HttpResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 |
6 | import inside.dumpster.client.Result;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class HttpResult extends Result {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/credits/CreditsResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.credits;
5 |
6 | import inside.dumpster.client.Result;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class CreditsResult extends Result {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/OutsideDumpster/src/main/java/inside/dumpster/outside/SettingsMBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | import javax.management.DynamicMBean;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public interface SettingsMBean extends DynamicMBean {
13 | }
14 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/credits/CreditsPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.credits;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class CreditsPayload extends Payload {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/Data.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface Data {
11 | public void setBuffer(byte[] buffer);
12 |
13 | public byte[] getBuffer();
14 | }
15 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/uploadimage/UploadImageResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.uploadimage;
5 |
6 | import inside.dumpster.client.Result;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class UploadImageResult extends Result {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/uploadtext/UploadTextResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.uploadtext;
5 |
6 | import inside.dumpster.client.Result;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class UploadTextResult extends Result {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/DatabaseServer/src/release/prepare.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # This script prepares the database, i.e. creates the tables and fills it with
3 | # data. Its supposed to be run once, generate database import files which can
4 | # be included in the Dockerfile.
5 |
6 | java -cp DatabaseServer.jar inside.dumpster.database.DatabaseGenerator -connectionstring "jdbc:derby:dumpster;create=true"
7 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/jackrabbit/JackRabbitPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.jackrabbit;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class JackRabbitPayload extends Payload {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/Monitoring/Monitoring-Base/src/main/java/inside/dumpster/monitoring/MonitoringEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface MonitoringEvent {
11 | void set(String name, String value);
12 | void doBegin();
13 | void doEnd();
14 | void doCommit();
15 | }
16 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/DataUpload.java:
--------------------------------------------------------------------------------
1 | package inside.dumpster.monitoring.event;
2 |
3 | import inside.dumpster.monitoring.TransactionEvent;
4 |
5 | public class DataUpload extends TransactionEvent {
6 | public String datatype;
7 |
8 | public String srcDevice;
9 |
10 | public String id;
11 |
12 | public long size;
13 | }
14 |
--------------------------------------------------------------------------------
/BackendAPI/src/main/java/inside/dumpster/backend/api/CreditVault.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.api;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.client.Result;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public interface CreditVault {
14 | public Result doDeposit(Payload payload);
15 | }
16 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/client/impl/PayloadProcessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.impl;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | * @param
12 | */
13 | public interface PayloadProcessor
{
14 | public void processPayload(P payload);
15 | }
16 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/UnhandledServiceCall.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import inside.dumpster.monitoring.Event;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 |
13 | public class UnhandledServiceCall extends Event {
14 | public String destination;
15 | }
16 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/mupp.java:
--------------------------------------------------------------------------------
1 |
2 | import inside.dumpster.bl.BusinessLogicException;
3 |
4 | /*
5 | *
6 | */
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class mupp {
13 | public static void main(String[] args) throws BusinessLogicException {
14 | System.out.println("mnupp");
15 | throw new BusinessLogicException();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/Storage.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository;
5 |
6 | import inside.dumpster.backend.repository.data.Id;
7 | import java.io.File;
8 | import java.io.FileOutputStream;
9 | import java.io.OutputStream;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | public class Storage {
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/util/ThreadHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.util;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface ThreadHelper {
11 |
12 | public static Thread createThread(Runnable runnable, String key) {
13 | return new ThreadHelperImpl(() -> key).newThread(runnable);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/BusinessApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface BusinessApplication {
11 | public static final String PREFIX = "inside.dumpster";
12 | public static final String TOP_CATEGORY = "Business Application";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/BusinessApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public interface BusinessApplication {
11 | public static final String PREFIX = "inside.dumpster";
12 | public static final String TOP_CATEGORY = "Business Application";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/DataProcessing.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import inside.dumpster.monitoring.TransactionEvent;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class DataProcessing extends TransactionEvent {
13 | public String datatype;
14 |
15 | public String processType;
16 | }
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/Id.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class Id {
11 | private final String id;
12 | public Id(String id) {
13 | this.id = id;
14 | }
15 |
16 | @Override
17 | public String toString() {
18 | return id;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/DatabaseServer/derby-pool-tracing.log:
--------------------------------------------------------------------------------
1 | [derby] BEGIN TRACE_CONNECTS
2 | [derby] Attempting connection to localhost:1527/dumpster
3 | [derby] Using properties: { traceFile=derby-pool-tracing.log, databaseName=dumpster, maxStatements=0, serverName=localhost, traceLevel=100, retrieveMessageText=true, ssl=off, portNumber=1527, dataSourceName=jdbc:derby:../release/db/dumpster, securityMechanism=4, loginTimeout=0, traceFileAppend=false, user=APP }
4 | [derby] END TRACE_CONNECTS
5 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/TransactionId.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | import jdk.jfr.Label;
7 | import jdk.jfr.MetadataDefinition;
8 | import jdk.jfr.Relational;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | @MetadataDefinition
15 | @Label("Transaction Id")
16 | @Relational()
17 | public @interface TransactionId {
18 | }
19 |
--------------------------------------------------------------------------------
/OutsideDumpster/src/main/java/inside/dumpster/outside/BugBehaviourMXBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | import javax.management.DynamicMBean;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public interface BugBehaviourMXBean {
13 | public String setBuggy(String clazz, Boolean buggy);
14 | public Boolean isBuggy(String clazz);
15 | public String[] getBuggyClasses();
16 | }
17 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/ServiceCall.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import inside.dumpster.monitoring.Event;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class ServiceCall extends Event {
13 |
14 | public ServiceCall() {
15 | }
16 |
17 | public String destination;
18 |
19 | public Class serviceClass;
20 | }
21 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/auth/MustAcceptCookiesError.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl.auth;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class MustAcceptCookiesError extends Error {
11 | private final User user;
12 | MustAcceptCookiesError(User user) {
13 | this.user = user;
14 | }
15 |
16 | public User getUser() {
17 | return user;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/HttpPayloadParseLine.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 |
6 | import inside.dumpster.client.impl.ParseLine;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | @Deprecated
13 | public class HttpPayloadParseLine extends ParseLine {
14 |
15 | @Override
16 | public HttpPayload createPayload() {
17 | return new HttpPayload();
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/service/Service.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package inside.dumpster.service;
6 |
7 | import inside.dumpster.client.Payload;
8 | import inside.dumpster.client.Result;
9 |
10 | /**
11 | *
12 | * @author jsnor
13 | */
14 | public interface Service {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/ServiceLookupInterface.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.client.Result;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public interface ServiceLookupInterface {
14 | BusinessLogicService extends Payload, ? extends Result> lookupServiceWrapper(Payload.Destination destination) throws BusinessLogicException;
15 | }
16 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/enhanceimage/EnhanceImagePayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.enhanceimage;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class EnhanceImagePayload extends Payload {
13 | public int getImageSize() {
14 | return this.getDstBytes();
15 | }
16 |
17 | public void setImageSize(int i) {
18 | this.setDstBytes(i);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/TransactionEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public abstract class TransactionEvent extends Event {
13 | public String transactionId;
14 |
15 |
16 | public void registerPayloadData(Payload payload) {
17 | this.transactionId = payload.getTransactionId();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/BackendException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class BackendException extends Exception {
11 |
12 | public BackendException(Throwable ex) {
13 | super(ex);
14 | }
15 | public BackendException(String mess, Throwable ex) {
16 | super(mess, ex);
17 | }
18 | public BackendException(String mess) {
19 | super(mess);
20 | }
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/LImage.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | import java.awt.image.RenderedImage;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class LImage extends AbstractData {
13 | protected RenderedImage img;
14 | public LImage(RenderedImage img) {
15 | this.img = img;
16 | }
17 |
18 |
19 | public RenderedImage getRenderedImage() {
20 | return img;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/AbstractData.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class AbstractData implements Data {
11 | protected byte[] buffer;
12 |
13 | @Override
14 | public void setBuffer(byte[] buffer) {
15 | this.buffer = buffer;
16 | }
17 |
18 | @Override
19 | public byte[] getBuffer() {
20 | return buffer;
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/test/java/inside/dumpster/monitoring/BusinessApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | import org.junit.jupiter.api.Test;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class BusinessApplicationTest {
13 |
14 | public BusinessApplicationTest() {
15 | }
16 |
17 | @Test
18 | public void testSomeMethod() {
19 |
20 | }
21 |
22 | public static void main(String[] args) {
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/test/resources/logging.properties:
--------------------------------------------------------------------------------
1 | handlers=java.util.logging.ConsoleHandler
2 | #java.util.logging.FileHandler.pattern=logs/jetty-inside-dumpster.log
3 | #java.util.logging.FileHandler.limit=50000
4 | #java.util.logging.FileHandler.count=1
5 | #java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
6 |
7 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
8 | java.util.logging.ConsoleHandler.level=FINE
9 |
10 | java.util.logging.SimpleFormatter.format=%1$tc %2$s %4$s: %5$s%6$s%n
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/Repository.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository;
5 |
6 | import inside.dumpster.backend.repository.data.Data;
7 | import inside.dumpster.backend.repository.data.Id;
8 | import java.io.IOException;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | * @param
14 | */
15 | public interface Repository {
16 | public StoredData storeData(D im) throws IOException;
17 |
18 | public void removeData(Id id);
19 | }
20 |
--------------------------------------------------------------------------------
/BackendAPI/src/main/java/inside/dumpster/backend/database/DatabaseQueryEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.database;
5 |
6 | //import com.oracle.jrockit.jfr.EventDefinition;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 |
13 | /*@EventDefinition(
14 | description = "A very fine Test Event",
15 | name = "Test Event",
16 | path = "test/test",
17 | stacktrace = true,
18 | thread = true)*/
19 | public class DatabaseQueryEvent {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Monitoring/MonitoringJFR2/src/main/java/inside/dumpster/monitoring/MonitoringImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class MonitoringImpl implements Monitoring {
11 | static StringEvent event = new StringEvent();
12 | @Override
13 | public MonitoringEvent createEvent() {
14 | // StringEvent event = new StringEvent();
15 |
16 | event.begin();
17 | return event;
18 | }
19 |
20 | public MonitoringImpl() {
21 | }
22 |
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/BusinessLogicException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class BusinessLogicException extends Exception {
11 |
12 | public BusinessLogicException() {
13 | super();
14 | }
15 | public BusinessLogicException(String message, Exception e) {
16 | super(message, e);
17 | }
18 | public BusinessLogicException(Exception e) {
19 | super(e);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bidding/bid/Bidder.java:
--------------------------------------------------------------------------------
1 | /*
2 | */
3 | package inside.dumpster.bidding.bid;
4 |
5 | /**
6 | *
7 | * @author jsnor
8 | */
9 | public class Bidder {
10 | public final int id;
11 | public final String transactionId;
12 |
13 |
14 | public Bidder(String transactionId, int id) {
15 | this.id = id;
16 | this.transactionId = transactionId;
17 | }
18 |
19 | @Override
20 | public String toString() {
21 | return String.format("%s:%d", transactionId, id);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/TransactionEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | import inside.dumpster.client.Payload;
7 | import jdk.jfr.Label;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public abstract class TransactionEvent extends Event {
14 | @TransactionId
15 | @Label("Transaction Id")
16 | public String transactionId;
17 |
18 |
19 | public void registerPayloadData(Payload payload) {
20 | this.transactionId = payload.getTransactionId();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/BackendAPI/src/main/java17/inside/dumpster/backend/database/DatabaseQueryEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.databas;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Event;
8 | import jdk.jfr.Label;
9 | import jdk.jfr.Name;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | @Name("inside.dumpster.backend.Database")
16 | @Label("Database Query")
17 | @Category({"Backend", "Database", "Query"})
18 | public class DatabaseQueryEvent extends Event {
19 | @Name("Query")
20 | @Label("Query to execute")
21 | public String query;
22 | }
23 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/payload/Text.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
4 | */
5 | package inside.dumpster.payload;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | *
14 | * @author jsnor
15 | */
16 | @Retention(RetentionPolicy.RUNTIME)
17 | @Target(ElementType.TYPE)
18 | public @interface Text { }
19 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/client/Result.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class Result {
11 | private String result;
12 | private String service;
13 | public void setResult(String result) {
14 | this.result = result;
15 | }
16 |
17 | public String getResult() {
18 | return result;
19 | }
20 |
21 | public void setService(String service) {
22 | this.service = service;
23 | }
24 |
25 | public String getService() {
26 | return service;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/payload/Image.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
4 | */
5 | package inside.dumpster.payload;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | *
14 | * @author jsnor
15 | */
16 | @Retention(RetentionPolicy.RUNTIME)
17 | @Target(ElementType.TYPE)
18 | public @interface Image { }
19 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bidding/bid/BidResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package inside.dumpster.bidding.bid;
6 |
7 | /**
8 | *
9 | * @author jsnor
10 | */
11 | public class BidResult {
12 | private final long result;
13 |
14 | public BidResult(long result) {
15 | this.result = result;
16 | }
17 |
18 | public long getResult() {
19 | return result;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/StoredData.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository;
5 |
6 | import inside.dumpster.backend.repository.data.Id;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class StoredData {
13 | private final long length;
14 | private final Id id;
15 |
16 | StoredData(long length, Id id) {
17 | this.length = length;
18 | this.id = id;
19 | }
20 |
21 |
22 | public long getLength() {
23 | return length;
24 | }
25 |
26 | public Id getId() {
27 | return id;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/event/RequestEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.event;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Event;
8 | import jdk.jfr.Name;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | @Name("inside.dumpster.client.Request")
15 | @Category({"Inside", "Dumpster", "Client"})
16 | public class RequestEvent extends Event {
17 | public String uri;
18 | public String result;
19 | public String destination;
20 | public int status;
21 | public enum Type {
22 | Network,Local
23 | }
24 | public String type;
25 | }
26 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/event/UnhandledServiceCall.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Event;
8 | import jdk.jfr.Label;
9 | import jdk.jfr.Name;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | @Name("inside.dumpster.UnhandledServiceCall")
16 | @Label("Unhandled Service Call")
17 | @Category({"Business Application", "Services"})
18 | public class UnhandledServiceCall extends Event {
19 | @Label("Unhandled Service Destination")
20 | public String destination;
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/MicronautServer/src/main/java/inside/dumpster/micronaut/Application.java:
--------------------------------------------------------------------------------
1 | package inside.dumpster.micronaut;
2 |
3 | import inside.dumpster.outside.Bug;
4 | import io.micronaut.core.util.CollectionUtils;
5 | import io.micronaut.runtime.Micronaut;
6 | import java.util.Map;
7 |
8 | public class Application {
9 |
10 | public static void main(String[] args) {
11 | Bug.registerMXBean();
12 | Map defaults = CollectionUtils.mapOf(
13 | "micronaut.server.multipart.max-file-size", "100MB",
14 | "micronaut.server.max-request-size", "100MB"
15 | );
16 | Micronaut.build(args).properties(defaults).run(Application.class, args);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/OutsideDumpster/src/main/java/inside/dumpster/outside/Buggy.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | import java.lang.annotation.ElementType;
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 | import java.lang.annotation.Target;
10 |
11 | /**
12 | * Marks a buggy method.
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Target(ElementType.TYPE)
17 | public @interface Buggy {
18 | /** Reason why this code is buggy. */
19 | public String because();
20 | /** Is the Buggy code enabled by default? */
21 | public boolean enabled() default true;
22 | }
23 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/uploadimage/UploadImagePayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.uploadimage;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class UploadImagePayload extends Payload {
13 | /**
14 | * What kind of processing to perform.
15 | */
16 | public enum Processing {
17 | Convert,None
18 | }
19 | public Processing getProcessing() {
20 | switch(this.getDstPort()) {
21 | case "443":
22 | return Processing.Convert;
23 | default:
24 | return Processing.None;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/event/ServiceCall.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Event;
8 | import jdk.jfr.Label;
9 | import jdk.jfr.Name;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | @Name("inside.dumpster.ServiceCall")
16 | @Label("Service Call")
17 | @Category({"Business Application", "Services"})
18 | public class ServiceCall extends Event {
19 |
20 | @Label("Service Destination")
21 | public String destination;
22 |
23 | @Name("service")
24 | @Label("Service Implementation Class")
25 | public Class serviceClass;
26 | }
27 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/auth/UnauthorizedException.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl.auth;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class UnauthorizedException extends Exception {
11 |
12 | /**
13 | * Creates a new instance of UnauthorizedUserException without
14 | * detail message.
15 | */
16 | public UnauthorizedException() {
17 | }
18 |
19 | /**
20 | * Constructs an instance of UnauthorizedUserException with the
21 | * specified detail message.
22 | *
23 | * @param msg the detail message.
24 | */
25 | public UnauthorizedException(String msg) {
26 | super(msg);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/auth/NotAuthorizedError.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl.auth;
5 |
6 | /**
7 | * Thrown if no user is logged in.
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public class NotAuthorizedError extends Error {
11 |
12 | /**
13 | * Creates a new instance of UnauthorizedUserError without detail
14 | * message.
15 | */
16 | public NotAuthorizedError() {
17 | }
18 |
19 | /**
20 | * Constructs an instance of UnauthorizedUserError with the
21 | * specified detail message.
22 | *
23 | * @param msg the detail message.
24 | */
25 | public NotAuthorizedError(String msg) {
26 | super(msg);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Monitoring/MonitoringJFR2/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | inside.dumpster
6 | Monitoring
7 | 1.0
8 |
9 | MonitoringJFR2
10 | jar
11 |
12 |
13 | ${project.groupId}
14 | Monitoring
15 | ${project.version}
16 |
17 |
18 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bidding/BiddingPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bidding;
5 |
6 | import inside.dumpster.bidding.bid.Bidder;
7 | import inside.dumpster.client.Payload;
8 | import inside.dumpster.client.impl.Helper;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | *
14 | * @author jsnor
15 | */
16 | public class BiddingPayload extends Payload {
17 | public List getBidders() {
18 | final int numOfBidders = Helper.fixedHash(this.getSrcBytes(), 10, 30);
19 | List bidders = new ArrayList(numOfBidders);
20 | for (int i = 1 ; i <= numOfBidders; i++) {
21 | bidders.add(new Bidder(this.getTransactionId(), i));
22 | }
23 | return bidders;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MicronautServer/src/main/java/inside/dumpster/micronaut/MicronautService.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.micronaut;
5 |
6 | import inside.dumpster.bl.BusinessLogicException;
7 | import inside.dumpster.bl.BusinessLogicFactory;
8 | import inside.dumpster.bl.BusinessLogicServiceWrapper;
9 | import inside.dumpster.client.Payload;
10 | import jakarta.inject.Singleton;
11 |
12 | /**
13 | *
14 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
15 | */
16 | @Singleton
17 | public class MicronautService {
18 | private final BusinessLogicFactory factory = new BusinessLogicFactory();
19 | public BusinessLogicServiceWrapper getService(String destination) throws BusinessLogicException {
20 | return factory.lookupService(Payload.Destination.fromString(destination));
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/DumpsterDiving/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | inside.dumpster
6 | InsideDumpster
7 | 1.0
8 |
9 | DumpsterDiving
10 | 1.0
11 | jar
12 |
13 | inside.dumpster.dumpsterdiving.CPULoadMonitor
14 | 17
15 | 17
16 |
17 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 | //import com.oracle.jrockit.jfr.*;
6 | //import com.oracle.jrockit.jfr.EventToken;
7 | //import com.oracle.jrockit.jfr.InvalidEventDefinitionException;
8 | //import com.oracle.jrockit.jfr.InvalidValueException;
9 | //import com.oracle.jrockit.jfr.Producer;
10 | //import com.oracle.jrockit.jfr.InstantEvent;
11 | //import com.oracle.jrockit.jfr.ValueDefinition;
12 | //import com.oracle.jrockit.jfr.management.FlightRecordingMBean;
13 |
14 | /**
15 | *
16 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
17 | */
18 | //@EventDefinition(path = "com/jsnordst/durationevent/in", name = "My Event", description = "An event triggered by doStuff.", stacktrace = true, thread = true)
19 | public class Event extends jdk.jfr.Event {
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/energy/EnergyPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.energy;
5 |
6 | import inside.dumpster.client.Payload;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class EnergyPayload extends Payload {
13 | public Long getIterations() {
14 | return this.getDuration() != null ? Long.parseLong(this.getDuration()) : 0;
15 | }
16 |
17 | public int getIngoingWattage() {
18 | return this.getSrcBytes();
19 | }
20 |
21 | public void setIngoingWattage(int watts) {
22 | this.setSrcBytes(watts);
23 | }
24 |
25 | public int getRequestedWattage() {
26 | return Integer.parseInt(this.getSrcPackets());
27 | }
28 |
29 | public void setRequestedWattage(int watts) {
30 | this.setSrcPackets(String.valueOf(watts));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Backend/src/test/java/inside/dumpster/outside/BuggyClassesListTest.java:
--------------------------------------------------------------------------------
1 | package inside.dumpster.outside;
2 |
3 | /*
4 | *
5 | */
6 |
7 | import inside.dumpster.backend.repository.TextRepository;
8 | import static java.util.Arrays.binarySearch;
9 | import static org.junit.jupiter.api.Assertions.assertTrue;
10 | import org.junit.jupiter.api.Test;
11 |
12 | /**
13 | *
14 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
15 | */
16 | public class BuggyClassesListTest {
17 | @Test
18 | public void testListTest() {
19 | Bug.registerMXBean();
20 | BugBehaviour bb = new BugBehaviour();
21 | // assertFalse(bb.isBuggy(BuggyClassDefaultFalseTest.class.getName()));
22 | // assertTrue(bb.isBuggy(BuggyClassTest.class.getName()));
23 | String[] cls = bb.getBuggyClasses();
24 | assertTrue(binarySearch(cls, TextRepository.class.getName()) >= 0);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/BusinessLogicService.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.client.Result;
8 | import inside.dumpster.service.Service;
9 |
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | * @param type of payload
15 | * @param type of result
16 | */
17 | public abstract class BusinessLogicService implements Service {
18 | final Class
payloadClass;
19 | public BusinessLogicService(Class
payloadClass, Class resultClass) {
20 | this.payloadClass = payloadClass;
21 | }
22 | // public BusinessLogicService() {
23 | // this.payloadClass = null;
24 | // }
25 |
26 | public abstract R invoke(P payload) throws BusinessLogicException;
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/auth/Security.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.auth;
5 |
6 | import java.security.KeyStore;
7 | import javax.net.ssl.SSLContext;
8 | import javax.net.ssl.TrustManagerFactory;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | public class Security {
15 | private void setupSecurity() {
16 | // KeyStore keyStore = = KeyStore.getInstance(KeyStore.getDefaultType());
17 | // keyStore.load(trustStore, trustStorePassword);
18 | // trustStore.close();
19 | // TrustManagerFactory tmf =
20 | // TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
21 | // tmf.init(keyStore);
22 | // SSLContext ctx = SSLContext.getInstance("TLS");
23 | // ctx.init(null, tmf.getTrustManagers(), null);
24 | // sslFactory = ctx.getSocketFactory();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/event/DataUpload.java:
--------------------------------------------------------------------------------
1 | package inside.dumpster.monitoring.event;
2 |
3 | import inside.dumpster.monitoring.TransactionEvent;
4 | import jdk.jfr.Category;
5 | import jdk.jfr.DataAmount;
6 | import jdk.jfr.Label;
7 | import jdk.jfr.Name;
8 |
9 | @Name("inside.dumpster.UploadData")
10 | @Label("Data Upload")
11 | @Category({"Business Application", "Data", "Upload"})
12 | public class DataUpload extends TransactionEvent {
13 | @Label("Type of Data")
14 | public String datatype;
15 |
16 | @Name("source")
17 | @Label("Source Device of Origin")
18 | public String srcDevice;
19 |
20 | @Label("Id of Uploaded Data")
21 | public String id;
22 |
23 | @Name("size")
24 | @Label("Size of uploaded data")
25 | @DataAmount
26 | public long size;
27 |
28 |
29 | @Label("Uploaded data")
30 | public String data;
31 | }
32 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-Base/readme.md:
--------------------------------------------------------------------------------
1 | ## The BusinessLogic Parent project
2 |
3 | This project is merely a POM project that combines the classes from the JDK specific projects in [BusinessLogic](../).
4 |
5 | ```mermaid
6 | flowchart LR
7 | BL8[BusinessLogic-8] -->|compiles| JDK8(JDK 8 classes)
8 | BL11[BusinessLogic-11] -->|compiles| JDK11(JDK 11 classes)
9 | JDK8 --> BLB[BusinessLogic-Base]
10 | JDK11 --> BLB[BusinessLogic-Base]
11 | BLB[BusinessLogic-Base] -->|combines| BLBJ{{BusinessLogic.jar}}
12 | ```
13 |
14 | The pom takes the compiled classes from each project, and creates a [Multi-Release JAR](https://openjdk.org/jeps/238). This will create the artifact "BusinessLogic-X.Y.jar" which contains classes for each supported JDK. If running on JDK 8, only classes created in [BusinessLogic-8](../BusinessLogic-8) will be executed, and if running on JDK 11, or above, the same way for [BusinessLogic-11](../BusinessLogic-11).
15 |
16 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/auth/UserInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.auth;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public class UserInfo {
14 | private String name;
15 | private String subscriberNumber;
16 | private final Map userInfo = new HashMap<>();
17 |
18 |
19 | public Map getUserInfo() {
20 | return userInfo;
21 | }
22 |
23 |
24 |
25 | void setSubscriberNumber(String subscriberNumber) {
26 | this.subscriberNumber = subscriberNumber;
27 | }
28 |
29 | public String getSubscriberNumber() {
30 | return subscriberNumber;
31 | }
32 | void setName(String fullName) {
33 | this.name = fullName;
34 | }
35 |
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/runstandaloneclient.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | JAVA_VER=$(java -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')
4 | if [[ "$JAVA_VER" -eq 18 ]]
5 | then
6 | echo Java ver: $JAVA_VER, Java 8
7 | JDKARGS+=" -XX:+UnlockCommercialFeatures -XX:FlightRecorderOptions=loglevel=trace"
8 | else
9 | echo Java ver: $JAVA_VER
10 | JDKARGS+=" --enable-preview -Xlog:jfr=info"
11 | fi
12 |
13 | JFRDUMPFILE="dumpster_diagnosis_$(date +"%Y_%m_%d_%I_%M_%p").jfr"
14 | JMXARGS="-Dcom.sun.management.jmxremote.port=12346 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1"
15 | echo Using java args: $JDKARGS
16 |
17 | java $JDKARGS -Djava.util.logging.config.file=logging.properties $JMXARGS -XX:StartFlightRecording=filename=$JFRDUMPFILE,dumponexit=true -cp CliClient/target/CliClient-1.0-jar-with-dependencies.jar inside.dumpster.client.Cli $@
18 |
19 |
20 | echo JFR file dumped to: $JFRDUMPFILE
21 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/PerformOneRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 |
6 | import inside.dumpster.client.impl.NetFlowData;
7 | import inside.dumpster.client.impl.ParseLine;
8 | import java.io.IOException;
9 | import java.util.stream.Stream;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | public class PerformOneRequest {
16 |
17 | public static void main(String[] args) throws Exception {
18 | NetFlowData data = new NetFlowData<>(new HttpPayloadParseLine());
19 |
20 | PostRequest pr = new PostRequest("http://localhost:8081/");
21 |
22 | data.getStream().filter((t) -> {
23 | System.out.println("Press enter for new req.");
24 | try {
25 | System.in.read();
26 | } catch (IOException ex) {
27 | }
28 | return true;
29 | }
30 | ).forEach(pr::doRequest);
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/test/java/inside/dumpster/outside/BuggyClassesListTest.java:
--------------------------------------------------------------------------------
1 | package inside.dumpster.outside;
2 |
3 | /*
4 | *
5 | */
6 |
7 | import inside.dumpster.backend.repository.TextRepository;
8 | import inside.dumpster.uploadtext.UploadTextService;
9 | import static java.util.Arrays.binarySearch;
10 | import static org.junit.jupiter.api.Assertions.assertTrue;
11 | import org.junit.jupiter.api.Test;
12 |
13 | /**
14 | *
15 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
16 | */
17 | public class BuggyClassesListTest {
18 | @Test
19 | public void testListTest() {
20 | Bug.registerMXBean();
21 | BugBehaviour bb = new BugBehaviour();
22 | // assertFalse(bb.isBuggy(BuggyClassDefaultFalseTest.class.getName()));
23 | // assertTrue(bb.isBuggy(BuggyClassTest.class.getName()));
24 | String[] cls = bb.getBuggyClasses();
25 | // assertTrue(binarySearch(cls, TextRepository.class.getName()) >= 0);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/utils/Utils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.utils;
5 |
6 | import inside.dumpster.backend.BackendException;
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 | public class Utils {
16 |
17 | public static ByteArrayOutputStream inputStreamToOutputStream(InputStream bis) throws BackendException {
18 | try {
19 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();
20 | int nRead;
21 | byte[] data = new byte[4];
22 | while ((nRead = bis.read(data, 0, data.length)) != -1) {
23 | buffer.write(data, 0, nRead);
24 | }
25 | buffer.flush();
26 | return buffer;
27 | } catch (IOException ex) {
28 | throw new BackendException("Error reading byte data", ex);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/bl/DefaultBusinessLogicService.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.bl;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.client.Result;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public class DefaultBusinessLogicService extends BusinessLogicService {
14 |
15 | public DefaultBusinessLogicService() {
16 | super(Payload.class, Result.class);
17 | }
18 |
19 |
20 | @Override
21 | public Result invoke(Payload payload) throws BusinessLogicException {
22 | Result result = new Result();
23 | result.setResult("nok");
24 | return result;
25 | }
26 |
27 | // public Class getPayloadClass() {
28 | // return Payload.class;
29 | // }
30 | //
31 | // public Class getResultClass() {
32 | // return Result.class;
33 | // }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/MicronautServer/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
7 |
8 | %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n
9 |
10 |
11 |
12 | E:/var/log-${byDay}.txt
13 | true
14 |
15 | %-4relative [%thread] %-5level %logger{35} - %msg%n
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/DataUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | * @param
13 | */
14 | public class DataUtils {
15 | ThreadLocal threadLocalValue = new ThreadLocal<>();
16 |
17 | private final D data;
18 | public DataUtils(D data) {
19 | this.data = data;
20 | }
21 |
22 | public D convertToData(InputStream inputStream) {
23 | try {
24 | threadLocalValue.set(new byte[inputStream.available()]);
25 | byte[] buffer = threadLocalValue.get();
26 | inputStream.read(buffer);
27 |
28 | data.setBuffer(buffer);
29 | return data;
30 | } catch (IOException ex) {
31 | ex.printStackTrace();
32 | return data;
33 | }
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/repository/data/Text.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.repository.data;
5 |
6 | import java.io.ByteArrayInputStream;
7 | import java.io.InputStream;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public class Text extends AbstractData {
14 | private final InputStream inputStream;
15 | private StringBuilder builder;
16 | public Text(StringBuilder builder) {
17 | this.inputStream = new ByteArrayInputStream(builder.toString().getBytes());
18 | this.builder = builder;
19 | }
20 |
21 | public StringBuilder getBuilder() {
22 | return builder;
23 | }
24 | public Text(InputStream inputStream) {
25 | this.inputStream = inputStream;
26 | }
27 |
28 | public InputStream getInputStream() {
29 | return inputStream;
30 | }
31 |
32 | public boolean hasInputStream() {
33 | return inputStream != null;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Monitoring/Monitoring-Base/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | inside.dumpster
6 | Monitoring
7 | 1.0
8 |
9 | MonitoringBase
10 | jar
11 |
12 |
13 | ${project.groupId}
14 | Monitoring
15 | ${project.version}
16 |
17 |
18 |
19 | 1.8
20 | 1.8
21 |
22 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/NetworkRequestRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 |
6 | import inside.dumpster.client.Payload;
7 | import java.util.logging.Level;
8 | import java.util.logging.Logger;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | public class NetworkRequestRunnable implements Runnable {
15 |
16 | final Payload req;
17 | final String baseURI;
18 | public NetworkRequestRunnable(Payload req, String baseURI) {
19 | this.req = req;
20 | this.baseURI = baseURI;
21 | }
22 |
23 | @Override
24 | public void run() {
25 | try {
26 | HttpResult result = new PostRequest(baseURI).doRequest(req);
27 | } catch (Exception ex) {
28 | Logger.getLogger(PerformRequests.class.getName()).log(Level.SEVERE, "Req failed: "+req, ex);
29 | }
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "Starting at: " + req.getTime();
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-21/src/main/java/inside/dumpster/util/ThreadHelperImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.util;
5 |
6 | import java.util.concurrent.ThreadFactory;
7 | import java.util.concurrent.atomic.AtomicInteger;
8 | import java.util.function.Supplier;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | class ThreadHelperImpl implements ThreadFactory {
15 | private final Supplier keysupplier;
16 | private final AtomicInteger counter;
17 | public ThreadHelperImpl() {
18 | counter = new AtomicInteger();
19 | this.keysupplier = () -> "Thread #" + counter.incrementAndGet();
20 | }
21 |
22 | public ThreadHelperImpl(Supplier keysupplier) {
23 | counter = null;
24 | this.keysupplier = keysupplier;
25 | }
26 |
27 | @Override
28 | public Thread newThread(Runnable runnable) {
29 | return Thread.ofPlatform().name(keysupplier.get()).unstarted(runnable);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/auth/UserRepository.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.auth;
5 |
6 | import com.github.javafaker.Faker;
7 |
8 | /**
9 | *
10 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
11 | */
12 | public class UserRepository {
13 | public UserInfo getUserInfo(String userId) {
14 | Faker faker = new Faker();
15 | UserInfo userInfo = new UserInfo();
16 | userInfo.setName(faker.name().fullName());
17 | userInfo.setSubscriberNumber(faker.phoneNumber().subscriberNumber());
18 | for(int i = 0; i < 1000 ; i++) {
19 | userInfo.getUserInfo().put("contact_name_"+i, faker.name().fullName());
20 | userInfo.getUserInfo().put("contact_number_"+i, faker.phoneNumber().phoneNumber());
21 | userInfo.getUserInfo().put("contact_city_"+i, faker.address().cityName());
22 | userInfo.getUserInfo().put("contact_bnr"+i, faker.address().buildingNumber());
23 |
24 | }
25 | return userInfo;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/util/ThreadHelperImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.util;
5 |
6 | import java.util.concurrent.ThreadFactory;
7 | import java.util.concurrent.atomic.AtomicInteger;
8 | import java.util.function.Supplier;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | class ThreadHelperImpl implements ThreadFactory {
15 | private final Supplier keysupplier;
16 | private final AtomicInteger counter;
17 | public ThreadHelperImpl() {
18 | counter = new AtomicInteger();
19 | this.keysupplier = () -> "Thread #" + counter.incrementAndGet();
20 | }
21 |
22 | public ThreadHelperImpl(Supplier keysupplier) {
23 | counter = null;
24 | this.keysupplier = keysupplier;
25 | }
26 |
27 | @Override
28 | public Thread newThread(Runnable r) {
29 | Thread t = new Thread(r);
30 | t.setName(keysupplier.get());
31 | return t;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 | //import com.oracle.jrockit.jfr.*;
6 | //import com.oracle.jrockit.jfr.EventToken;
7 | //import com.oracle.jrockit.jfr.InvalidEventDefinitionException;
8 | //import com.oracle.jrockit.jfr.InvalidValueException;
9 | //import com.oracle.jrockit.jfr.Producer;
10 | //import com.oracle.jrockit.jfr.InstantEvent;
11 | //import com.oracle.jrockit.jfr.ValueDefinition;
12 | //import com.oracle.jrockit.jfr.management.FlightRecordingMBean;
13 |
14 | /**
15 | *
16 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
17 | */
18 | //@EventDefinition(path = "com/jsnordst/durationevent/in", name = "My Event", description = "An event triggered by doStuff.", stacktrace = true, thread = true)
19 | public class Event {
20 | public void begin() {
21 | System.out.println("Event: "+this.getClass().getName());
22 | }
23 | public void end() {}
24 | public void commit() {}
25 | }
26 |
--------------------------------------------------------------------------------
/Monitoring/MonitoringJFR2/src/main/java/inside/dumpster/monitoring/StringEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Event;
8 | import jdk.jfr.Name;
9 | import jdk.jfr.StackTrace;
10 |
11 |
12 | /**
13 | *
14 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
15 | */
16 | @Category({"inside", "dumpster"})
17 | @Name("constantString")
18 | @StackTrace(true)
19 | public class StringEvent extends Event implements MonitoringEvent {
20 |
21 | public String name;
22 |
23 | public String data;
24 |
25 |
26 |
27 | @Override
28 | public void doCommit() {
29 | commit();
30 | }
31 |
32 | @Override
33 | public void set(String name, String value) {
34 | if(name.equals("name")) {
35 | this.name = value;
36 | } else {
37 | this.data = value;
38 | }
39 | }
40 |
41 | @Override
42 | public void doBegin() {
43 | this.begin();
44 | }
45 |
46 | @Override
47 | public void doEnd() {
48 | this.end();
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/OParseLine.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 | import java.util.function.Function;
6 |
7 | /**
8 | *
9 | * @author JSNORDST
10 | */
11 | public class OParseLine implements Function {
12 | public HttpPayload parseLine(String line) {
13 | String[] request = line.split(",");
14 | int cnt = 0;
15 | HttpPayload networkRequest = new HttpPayload(
16 | request[cnt++],
17 | request[cnt++],
18 | request[cnt++],
19 | request[cnt++],
20 | request[cnt++],
21 | request[cnt++],
22 | request[cnt++],
23 | request[cnt++],
24 | request[cnt++],
25 | request[cnt++],
26 | // request[cnt++],
27 | request[cnt++]
28 | );
29 | return networkRequest;
30 | }
31 |
32 | @Override
33 | public HttpPayload apply(String line) {
34 | return parseLine(line);
35 | }
36 |
37 |
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/JettyServer/src/release/logging.properties:
--------------------------------------------------------------------------------
1 | #handlers=smol.java.LogHandler, org.slf4j.bridge.SLF4JBridgeHandler, java.util.logging.ConsoleHandler, java.util.logging.FileHandler
2 | handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler, org.slf4j.bridge.SLF4JBridgeHandler
3 | java.util.logging.manager=java.util.logging.LogManager
4 | #java.util.logging.manager=org.apache.juli.ClassLoaderLogManager
5 |
6 | # java.util.logging.ConsoleHandler,
7 | # java.util.logging.ConsoleHandler, org.slf4j.bridge.SLF4JBridgeHandler
8 | java.util.logging.FileHandler.pattern=logs/jetty-inside-dumpster.log
9 | java.util.logging.FileHandler.limit=500000
10 | java.util.logging.FileHandler.count=1
11 | java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
12 | java.util.logging.FileHandler.level=FATAL
13 |
14 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
15 | java.util.logging.ConsoleHandler.level=FATAL
16 |
17 | java.util.logging.SimpleFormatter.format=%1$tc %2$s %4$s: %5$s%6$s%n
18 |
19 | #jdk.event.security.level = FINE
20 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/web/HttpPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.web;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.client.impl.PayloadHelper;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | @Deprecated
14 | public class HttpPayload extends Payload {
15 |
16 | public String baseURI;
17 |
18 | public void setBaseURI(String baseURI) {
19 | this.baseURI = baseURI;
20 | }
21 | public HttpPayload() {
22 | }
23 | public HttpPayload(String time, String duration, String srcDevice, String dstDevice, String protocol, String srcPort, String dstPort, String srcPackets, String dstPackets, String srcBytes, String dstBytes) {
24 | super(time, duration, srcDevice, dstDevice, protocol, srcPort, dstPort, srcPackets, dstPackets, srcBytes, dstBytes);
25 | }
26 |
27 |
28 | @Override
29 | public String toString() {
30 | return PayloadHelper.getURI(this).toASCIIString();
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/JettyServer/nb-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 | JDK_1.8
17 |
18 |
19 |
--------------------------------------------------------------------------------
/BackendAPI/nb-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 | JDK_1.8
17 |
18 |
19 |
--------------------------------------------------------------------------------
/logging.properties:
--------------------------------------------------------------------------------
1 | #handlers=smol.java.LogHandler, org.slf4j.bridge.SLF4JBridgeHandler, java.util.logging.ConsoleHandler, java.util.logging.FileHandler
2 | handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler, org.slf4j.bridge.SLF4JBridgeHandler
3 | java.util.logging.manager=java.util.logging.LogManager
4 | #java.util.logging.manager=org.apache.juli.ClassLoaderLogManager
5 |
6 | # java.util.logging.ConsoleHandler,
7 | # java.util.logging.ConsoleHandler, org.slf4j.bridge.SLF4JBridgeHandler
8 | java.util.logging.FileHandler.pattern=logs/jetty-inside-dumpster.log
9 | java.util.logging.FileHandler.limit=500000
10 | java.util.logging.FileHandler.count=1
11 | java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
12 | java.util.logging.FileHandler.level=ALL
13 |
14 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
15 | java.util.logging.ConsoleHandler.level=FINEST
16 | java.util.logging.ConsoleHandler.format=%1$tc %2$s %4$s: %5$s%6$s%n
17 |
18 | java.util.logging.SimpleFormatter.format=%1$tc %2$s %4$s: %5$s%6$s%n
19 |
20 | #jdk.event.security.level = FINE
21 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/nb-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 | JDK_1.8
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Monitoring/Monitoring-Base/nb-configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 | JDK_1.8
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Backend/src/main/java/inside/dumpster/backend/database/Database.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.backend.database;
5 |
6 | import inside.dumpster.backend.BackendException;
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.InputStream;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | public interface Database {
15 | public InputStream getPayloadData(DatabaseImpl.DataType dataType, String payload) throws BackendException;
16 |
17 | public InputStream getImageData(String dstPort) throws BackendException;
18 |
19 | public InputStream getTextData(String srcPort) throws BackendException;
20 |
21 | public void insertImageData(String dstPort, InputStream iStream) throws BackendException;
22 |
23 | public void insertImageData(String dstPort, InputStream iStream, boolean overwrite) throws BackendException;
24 |
25 | public void insertTextData(String srcPort, InputStream iStream) throws BackendException;
26 |
27 | public void insertTextData(String srcPort, InputStream iStream, boolean overwrite) throws BackendException;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/runjettyserver.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | JAVA_VER=$(java -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')
5 |
6 | if [[ "$JAVA_VER" -eq 18 ]]
7 | then
8 | echo Java ver: $JAVA_VER, Java 8
9 | JDKARGS=-XX:+UnlockCommercialFeatures
10 | else
11 | echo Java ver: $JAVA_VER
12 | JDKARGS=--enable-preview
13 | fi
14 |
15 |
16 |
17 |
18 | #java $JDKARGS -XX:StartFlightRecording=filename=D:/jsnordst/Bugs/InsideDumpster/dump.jfr,dumponexit=true -XX:+PrintConcurrentLocks -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.util.logging.config.file=logging.properties -jar JettyServer/target/JettyServer-1.0-jar-with-dependencies.jar
19 |
20 | java $JDKARGS -XX:StartFlightRecording=filename=D:/jsnordst/Bugs/InsideDumpster/dump.jfr,dumponexit=true -XX:+PrintConcurrentLocks -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.util.logging.config.file=logging.properties -jar JettyServer/target/JettyServer-1.0.jar
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/eldorado/ElDoradoPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2022 JSNORDST.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package inside.dumpster.eldorado;
17 |
18 | import inside.dumpster.client.Payload;
19 |
20 | /**
21 |
22 | *
23 | * @author JSNORDST
24 | */
25 | public class ElDoradoPayload extends Payload {
26 |
27 | public int getGold() {
28 | return this.getDstBytes();
29 | }
30 |
31 | public void setGold(int gold) {
32 | this.setDstBytes(gold);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/jackrabbit/JackRabbitResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.jackrabbit;
5 |
6 | import inside.dumpster.client.Result;
7 | import java.nio.ByteBuffer;
8 |
9 | /**
10 | *
11 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
12 | */
13 | public class JackRabbitResult extends Result {
14 | private final String name;
15 | private ByteBuffer jackRabbitBuffer;
16 |
17 | public JackRabbitResult(String name) {
18 | this.name = name;
19 | }
20 |
21 | public void setImageBuffer(ByteBuffer jackRabbitBuffer) {
22 | this.jackRabbitBuffer = jackRabbitBuffer;
23 | }
24 |
25 | public ByteBuffer getImageBuffer() {
26 | return jackRabbitBuffer;
27 | }
28 |
29 | /**
30 | * @return the name
31 | */
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | @Override
37 | protected void finalize() throws Throwable {
38 | if(jackRabbitBuffer != null) {
39 | jackRabbitBuffer.clear(); // Surely, this will free it. (No, it won't)
40 | }
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/JettyServer/src/release/entrypoint.sh:
--------------------------------------------------------------------------------
1 | JAVA_VER=$(java -version 2>&1 | sed -n ';s/.* version "\(.*\)\.\(.*\)\..*".*/\1\2/p;')
2 |
3 | if [[ "$JAVA_VER" -eq 18 ]]
4 | then
5 | echo Java ver: $JAVA_VER, Java 8
6 | JDKARGS=-XX:+UnlockCommercialFeatures
7 | else
8 | echo Java ver: $JAVA_VER
9 | JDKARGS=--enable-preview
10 | fi
11 |
12 | JDKARGS="$JDKARGS -XX:+PrintConcurrentLocks"
13 |
14 | JMXARGS="-Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1"
15 |
16 | JFRARGS=" -XX:StartFlightRecording=filename=logs/dump.jfr,dumponexit=true"
17 |
18 | LOGARGS="-Djava.util.logging.config.file=logging.properties"
19 |
20 | #java $JDKARGS -XX:StartFlightRecording=filename=logs/dump.jfr,dumponexit=true -XX:+PrintConcurrentLocks -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.util.logging.config.file=logging.properties -jar JettyServer/target/JettyServer-1.0-jar-with-dependencies.jar
21 |
22 | java $JDKARGS $JFRARGS $JMXARGS $LOGARGS -jar JettyServer.jar
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/uploadtext/UploadTextPayload.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.uploadtext;
5 |
6 | import inside.dumpster.backend.Backend;
7 | import inside.dumpster.backend.BackendException;
8 | import inside.dumpster.backend.database.Database;
9 | import inside.dumpster.client.Payload;
10 | import java.io.InputStream;
11 | import java.util.logging.Level;
12 | import java.util.logging.Logger;
13 |
14 | /**
15 | *
16 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
17 | */
18 | public class UploadTextPayload extends Payload {
19 |
20 | @Override
21 | public InputStream getInputStream() {
22 | if (super.getInputStream() == null) {
23 | Database db = Backend.getInstance().getDatabase();
24 | InputStream stream;
25 | try {
26 | stream = db.getTextData(getSrcPort());
27 | } catch (BackendException ex) {
28 | Logger.getLogger(UploadTextPayload.class.getName()).log(Level.SEVERE, null, ex);
29 | return null;
30 | }
31 | return stream;
32 | } else {
33 | return super.getInputStream();
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/event/DataProcessingDetail.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import jdk.jfr.Category;
7 | import jdk.jfr.Description;
8 | import jdk.jfr.Enabled;
9 | import jdk.jfr.Event;
10 | import jdk.jfr.Label;
11 | import jdk.jfr.Name;
12 | import jdk.jfr.Threshold;
13 |
14 | /**
15 | * Event that tracks the detailed data processing. This event should only be
16 | * enabled when running certain tests, and detailed profiling. Never enable in
17 | * a production environment.
18 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
19 | */
20 | @Name("inside.dumpster.ProcessDataDetail")
21 | @Label("Detailed Data Processing")
22 | @Category({"Business Application", "Data", "Processing", "Profiling"})
23 | @Description("Detailed statistics over data processing events. Don't enable this event in production!")
24 | @Threshold("50 ms")
25 | @Enabled(false)
26 | public class DataProcessingDetail extends Event {
27 | public int byteIndex;
28 | public int inValue;
29 | public byte outValue;
30 | public String reason;
31 | public int x;
32 | public int y;
33 | }
34 |
--------------------------------------------------------------------------------
/Client/src/main/java/inside/dumpster/client/impl/TextGenerator.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client.impl;
5 |
6 | import com.github.javafaker.Faker;
7 | import java.io.ByteArrayInputStream;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.util.Random;
11 |
12 | /**
13 | *
14 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
15 | */
16 | public class TextGenerator {
17 | private long seed = 0;
18 |
19 | public TextGenerator() {
20 | }
21 | public TextGenerator(long seed) {
22 | this.seed = seed;
23 | }
24 | public InputStream generateText() throws IOException {
25 | Faker faker = new Faker(new Random(seed));
26 | StringBuilder builder = new StringBuilder();
27 | String fact;
28 | while(builder.length() < sentences) {
29 | fact = faker.chuckNorris().fact();
30 | builder.append(fact);
31 | builder.append(" \n");
32 | }
33 | InputStream is = new ByteArrayInputStream(builder.toString().getBytes());
34 | return is;
35 | }
36 |
37 | long sentences;
38 | public void setSentences(long sentences) {
39 | this.sentences = sentences;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/OutsideDumpster/src/test/java/inside/dumpster/outside/BuggyClassTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | import static inside.dumpster.outside.Bug.isBuggy;
7 | import org.junit.jupiter.api.Test;
8 | import static org.junit.jupiter.api.Assertions.*;
9 | import org.junit.jupiter.api.BeforeAll;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 |
16 | @Buggy(because="the add can add too much")
17 | public class BuggyClassTest {
18 | @BeforeAll
19 | public static void beforeTest() {
20 | Bug.registerMXBean();
21 | }
22 |
23 | public int add(int a, int b) {
24 | if(isBuggy(this)) {
25 | return a + b + 3;
26 | } else {
27 | return a + b;
28 | }
29 | }
30 |
31 | public BuggyClassTest() {
32 | }
33 |
34 | @Test
35 | public void testSomeMethod() throws Exception {
36 | BuggyClassTest example = new BuggyClassTest();
37 |
38 | assertEquals(12, example.add(4, 5));
39 |
40 | BuggyTestHelper.addBuggyClass("inside.dumpster.outside.BuggyClassTest", Boolean.TRUE);
41 |
42 | assertNotEquals(9, example.add(4, 5));
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-11/src/main/java/inside/dumpster/monitoring/event/DataProcessing.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import inside.dumpster.client.Payload;
7 | import inside.dumpster.monitoring.TransactionId;
8 | import jdk.jfr.Category;
9 | import jdk.jfr.Description;
10 | import jdk.jfr.Event;
11 | import jdk.jfr.Label;
12 | import jdk.jfr.Name;
13 |
14 | /**
15 | *
16 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
17 | */
18 | @Name("inside.dumpster.ProcessData")
19 | @Label("Data Processing")
20 | @Category({"Business Application", "Data", "Processing"})
21 | @Description("Statistics over data processing events")
22 | public class DataProcessing extends Event {
23 | @TransactionId
24 | @Label("Transaction Id")
25 | public String transactionId;
26 |
27 |
28 | public void registerPayloadData(Payload payload) {
29 | this.transactionId = payload.getTransactionId();
30 | }
31 | @Label("Type of Data")
32 | @Description("What kind of data is processed. For instance if it's an Image, Video or Text")
33 | public String datatype;
34 |
35 | @Label("Type of Processing")
36 | @Description("What kind of processing is performed on the data.")
37 | public String processType;
38 | }
--------------------------------------------------------------------------------
/OutsideDumpster/src/test/java/inside/dumpster/outside/BuggyClassDefaultFalseTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | import static inside.dumpster.outside.Bug.isBuggy;
7 | import org.junit.jupiter.api.Test;
8 | import static org.junit.jupiter.api.Assertions.*;
9 | import org.junit.jupiter.api.BeforeAll;
10 |
11 | /**
12 | *
13 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
14 | */
15 |
16 | @Buggy(because="the minus can remove too much", enabled = false)
17 | public class BuggyClassDefaultFalseTest {
18 | @BeforeAll
19 | public static void beforeTest() {
20 | Bug.registerMXBean();
21 | }
22 | public int minus(int a, int b) {
23 | if(isBuggy(this)) {
24 | return a - b - 3;
25 | } else {
26 | return a - b;
27 | }
28 | }
29 |
30 | public BuggyClassDefaultFalseTest() {
31 | }
32 |
33 | @Test
34 | public void testSomeMethod() throws Exception {
35 | BuggyClassDefaultFalseTest example = new BuggyClassDefaultFalseTest();
36 |
37 | assertEquals(3, example.minus(9, 6));
38 |
39 | BuggyTestHelper.addBuggyClass("inside.dumpster.outside.BuggyClassDefaultFalseTest", Boolean.TRUE);
40 |
41 | assertNotEquals(3, example.minus(9, 6));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3 |
4 | # This workflow uses actions that are not certified by GitHub.
5 | # They are provided by a third-party and are governed by
6 | # separate terms of service, privacy policy, and support
7 | # documentation.
8 |
9 | name: Java CI with Maven
10 |
11 | on:
12 | push:
13 | branches: [ "main" ]
14 | pull_request:
15 | branches: [ "main" ]
16 |
17 | jobs:
18 | build:
19 |
20 | runs-on: ubuntu-latest
21 |
22 | steps:
23 | - uses: actions/checkout@v4
24 | - name: Set up JDK 21
25 | uses: actions/setup-java@v4
26 | with:
27 | java-version: '21'
28 | distribution: 'temurin'
29 | cache: maven
30 | - name: Build with Maven
31 | run: mvn -B package --file pom.xml
32 |
33 | # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
34 | #- name: Update dependency graph
35 | # uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
36 |
--------------------------------------------------------------------------------
/BusinessLogic/BusinessLogic-8/src/main/java/inside/dumpster/monitoring/event/ServiceInvocation.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.monitoring.event;
5 |
6 | import inside.dumpster.bl.BusinessLogicService;
7 | import inside.dumpster.client.Payload;
8 | import inside.dumpster.monitoring.TransactionEvent;
9 |
10 | /**
11 | *
12 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
13 | */
14 | public class ServiceInvocation extends TransactionEvent {
15 | public String protocol;
16 | public String dstPort;
17 | public String dstPackets;
18 | public int dstBytes;
19 | public String srcPackets;
20 | public String data;
21 | public int srcBytes;
22 | public Class extends BusinessLogicService> serviceClass;
23 |
24 | /**
25 | * Extract info from payload and set on this event.
26 | * @param payload
27 | */
28 | @Override
29 | public void registerPayloadData(Payload payload) {
30 | super.registerPayloadData(payload);
31 | this.protocol = payload.getProtocol();
32 | this.dstPort = payload.getDstPort();
33 | this.dstPackets = payload.getDstPackets();
34 | this.dstBytes = payload.getDstBytes();
35 | this.srcPackets = payload.getSrcPackets();
36 | this.srcBytes = payload.getSrcBytes();
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/CliClient/src/main/java/inside/dumpster/client/BenchmarkRunner.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.client;
5 |
6 | import inside.dumpster.client.arguments.CliArguments;
7 | import java.util.concurrent.TimeUnit;
8 | import org.openjdk.jmh.annotations.Benchmark;
9 | import org.openjdk.jmh.annotations.BenchmarkMode;
10 | import org.openjdk.jmh.annotations.Mode;
11 | import org.openjdk.jmh.annotations.Scope;
12 | import org.openjdk.jmh.annotations.State;
13 | import org.openjdk.jmh.annotations.Timeout;
14 |
15 | /**
16 | *
17 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
18 | */
19 | @State(Scope.Benchmark)
20 | public class BenchmarkRunner {
21 | // @Param({ "10", "60" })
22 | // public String duration;
23 |
24 | public static void main(String[] args) throws Exception {
25 | org.openjdk.jmh.Main.main(args);
26 | }
27 |
28 | @Benchmark
29 | // @Fork(value = 1, warmups = 2)
30 | @Timeout(time = 60, timeUnit = TimeUnit.SECONDS)
31 | @BenchmarkMode(Mode.AverageTime)
32 | public void init() throws Exception {
33 | Cli cli = new Cli();
34 | CliArguments args = new CliArguments(new String[]
35 | {CliArguments.Instance.Limit.param, "100"}
36 | );
37 | cli.start(args);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/OutsideDumpster/src/main/java/inside/dumpster/outside/Settings.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | */
4 | package inside.dumpster.outside;
5 |
6 | /**
7 | *
8 | * @author Joakim Nordstrom joakim.nordstrom@oracle.com
9 | */
10 | public enum Settings {
11 | DATABASE_CONNECTION_URL(
12 | "database_connection_url",
13 | "URL for database connection. Example: \"jdbc:derby://localhost:1527/dumpster\""
14 | ),
15 | SERVICE_LOOKUP(
16 | "service_lookup",
17 | "Service lookup mapping. Example: \"foo.*:FooLogic;bar:BarLogic\", will resolve any destination starting with foo \"foo\" to inside.dumpster.FooLogic.FooLogicService."
18 | );
19 | static SettingsImpl impl;
20 | final String key;
21 | final String description;
22 | Settings(String key, String description) {
23 | this.key = key;
24 | this.description = description;
25 | }
26 |
27 | public String getKey() {
28 | return key;
29 | }
30 |
31 | public String get() {
32 | return SettingsImpl.get().getProperty(key);
33 | }
34 | public void set(String value) {
35 | SettingsImpl.get().setProperty(key, value);
36 | }
37 |
38 | /**
39 | * Check if value is non-null, and non-empty
40 | * @return
41 | */
42 | public boolean isSet() {
43 | return get() != null && !get().isEmpty();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/JettyServer/src/main/webapp/web/default.jsp:
--------------------------------------------------------------------------------
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | <%=payload.getDestination()%>
11 |
12 |
13 |
14 | User: <%=user.getId()%> <%=user.isCookieAccepted()%>
15 | Database: <%=inside.dumpster.backend.Backend.getInstance().getDatabase()%>
16 |
17 | Dest: <%=payload.getDstDevice()%>
18 | Src: <%=payload.getSrcDevice()%>
19 | Result:
20 | <%=result.getResult()%>
21 | <%=(!"yes".equals(acceptCookies)) ? ("You must accept cookies to enter this site") : ""%>
22 | <%=(exception != null && !exception.getClass().toString().equals("class java.lang.Throwable")) ? ("Exception occured:" + exception.getClass().toString() + ", " + exception.getMessage()) : ""%>
23 |
24 |
25 |