Commit a458818d authored by areej.mohammad's avatar areej.mohammad

Initial commit of the Java Task Manager project

parent a8654cd3
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/web-http-socket-server-task-manager-docker.iml" filepath="$PROJECT_DIR$/web-http-socket-server-task-manager-docker.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
FROM openjdk:8-jdk-alpine FROM eclipse-temurin:8-jdk-alpine
LABEL maintainer="Wagner Franchin" LABEL maintainer="Wagner Franchin"
ENV WEBPATH=/webserver/ ENV WEBPATH=/webserver/
......
package task;
public class TaskReverse implements Task {
private String input;
private String result;
private String executedTime;
@Override
public void setInput(String input) {
this.input = input;
}
@Override
public void execute() {
// منطق المهمة: عكس السلسلة النصية المدخلة
if (input == null || input.isEmpty()) {
this.result = "Error: Input is empty.";
} else {
this.result = new StringBuilder(input).reverse().toString();
}
}
@Override
public String getInput() {
return this.input;
}
@Override
public void setExecutedTime(String executedTime) {
this.executedTime = executedTime;
}
@Override
public String getResult() {
return this.result;
}
}
\ No newline at end of file
package task;
// ترث من TaskImpl بدلاً من تنفيذ Task
public class TaskSleep extends TaskImpl {
@Override
public void execute() {
long duration = 0;
try {
// محاولة قراءة المدخلات كزمن (Input reading logic)
duration = Long.parseLong(this.input);
} catch (NumberFormatException e) {
this.result = "Error: Invalid sleep duration provided.";
return;
}
try {
// منطق التأخير (Sleep logic)
Thread.sleep(duration);
this.result = "Slept successfully for " + duration + "ms.";
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
this.result = "Sleep task was interrupted.";
}
}
// لا حاجة لإعادة تعريف setInput, setExecutedTime, getResult, toString!
// جميعها موروثة من TaskImpl.
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment