diff --git a/.gitignore b/.gitignore index 804d61f..3cb27ca 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,11 @@ /Semester 3/Assignments/TermProject1_CalebFontenot copy/target/ /Semester 3/Assignments/TermProject2_CalebFontenot/target/ /Semester 3/Exams-Quizzes/ProgrammingQuiz1_CalebFontenot/target/ +/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/target/ +/Semester 3/Assignments/LabFileUpload/target/ +/Semester 3/Assignments/LabFileUpload_Dbase/target/ +/Semester 3/Assignments/LabFileDownload/target/ +/Semester 3/Assignments/LabFileDownload_Dbases/target/ +/Semester 3/Exams-Quizzes/Problem2Final2800/target/ +/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/target/ +/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/target/ diff --git a/Semester 3/Assignments/.~lock.dbase.rtf# b/Semester 3/Assignments/.~lock.dbase.rtf# new file mode 100644 index 0000000..7b16c0a --- /dev/null +++ b/Semester 3/Assignments/.~lock.dbase.rtf# @@ -0,0 +1 @@ +Caleb Fontenot,caleb,caleb-gaming-laptop-archlinux,29.04.2024 10:04,file:///home/caleb/.config/libreoffice/4; \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileDownload.zip b/Semester 3/Assignments/LabFileDownload.zip new file mode 100644 index 0000000..da4aaa0 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload.zip differ diff --git a/Semester 3/Assignments/LabFileDownload/nb-configuration.xml b/Semester 3/Assignments/LabFileDownload/nb-configuration.xml new file mode 100644 index 0000000..ea4eb8b --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + Facelets + ide + + diff --git a/Semester 3/Assignments/LabFileDownload/pom.xml b/Semester 3/Assignments/LabFileDownload/pom.xml new file mode 100644 index 0000000..746a2d0 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + asdv + LabFileDownload + 1 + war + LabFileDownload-1 + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 12.0.0 + jakarta + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java b/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java new file mode 100644 index 0000000..78d0f2c --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package asdv.labfiledownload; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java b/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..7f4b933 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package asdv.labfiledownload.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Assignments/LabFileDownload/src/main/java/beans/DownloadBean.java b/Semester 3/Assignments/LabFileDownload/src/main/java/beans/DownloadBean.java new file mode 100644 index 0000000..798212d --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/java/beans/DownloadBean.java @@ -0,0 +1,81 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.util.SerializableSupplier; + +/** + * + * @author asdv5 + */ +@Named(value = "downloadBean") +@SessionScoped +public class DownloadBean implements Serializable +{ + private StreamedContent fileStreamContent; + + private void download() + { + String directory = "/media/DataEXT4/WebDev/pdf"; + try + { + Path path = Paths.get(directory + "/" + "book1.pdf"); + File file = new File(path.toAbsolutePath().toString()); + InputStream inputStream + = new FileInputStream(file.getAbsoluteFile()); + + + + this.fileStreamContent + = DefaultStreamedContent.builder() + .name("book1.pdf") + .contentType("application/pdf") + + .stream(new SerializableSupplier() + { + @Override + public InputStream get() + { + return inputStream; + } + }) + .build(); + + } + catch (IOException e) + { + + System.out.println(e); + + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Failed to download file.", + e.toString() + ) + ); + } + + } + + public StreamedContent getFileStreamContent() + { + download(); + return fileStreamContent; + } +} diff --git a/Semester 3/Assignments/LabFileDownload/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/LabFileDownload/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/index.xhtml b/Semester 3/Assignments/LabFileDownload/src/main/webapp/index.xhtml new file mode 100644 index 0000000..a734ed4 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload/src/main/webapp/index.xhtml @@ -0,0 +1,33 @@ + + + + + Download + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/ajax-loader.gif b/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/ajax-loader.gif new file mode 100644 index 0000000..20e04a2 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/ajax-loader.gif differ diff --git a/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/fileDownload.png b/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/fileDownload.png new file mode 100644 index 0000000..3908460 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload/src/main/webapp/resources/images/fileDownload.png differ diff --git a/Semester 3/Assignments/LabFileDownload_Dbases.zip b/Semester 3/Assignments/LabFileDownload_Dbases.zip new file mode 100644 index 0000000..eaa9628 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload_Dbases.zip differ diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/nb-configuration.xml b/Semester 3/Assignments/LabFileDownload_Dbases/nb-configuration.xml new file mode 100644 index 0000000..ea4eb8b --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + Facelets + ide + + diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/pom.xml b/Semester 3/Assignments/LabFileDownload_Dbases/pom.xml new file mode 100644 index 0000000..5fa6fbf --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + asdv + LabFileDownload_Dbases + 1 + war + LabFileDownload_Dbases + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 12.0.0 + jakarta + + + com.mysql + mysql-connector-j + 8.3.0 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java new file mode 100644 index 0000000..78d0f2c --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package asdv.labfiledownload; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..7f4b933 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/asdv/labfiledownload/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package asdv.labfiledownload.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/beans/DownloadBeanDBase.java b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/beans/DownloadBeanDBase.java new file mode 100644 index 0000000..9c2213d --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/java/beans/DownloadBeanDBase.java @@ -0,0 +1,146 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package beans; + +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import java.io.Serializable; +import java.io.InputStream; +import java.sql.Blob; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.util.SerializableSupplier; + +@Named(value = "downloadBeanDBase") +@SessionScoped +public class DownloadBeanDBase implements Serializable +{ + private StreamedContent fileStreamContent; + Connection connection; + + public DownloadBeanDBase() + { + } + + @PostConstruct + public void init() + { + try + { + connection = connection(); + } + catch (Exception e) + { + System.out.println(e); + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Failed to connect to the database.", + e.toString() + ) + ); + } + } + + @PreDestroy + public void destroy() + { + try + { + connection.close(); + } + catch (SQLException e) + { + System.out.println(e); + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_WARN, + "Failed to close the connection with the database.", + e.toString() + ) + ); + } + } + + public void download() + { + try + { + ResultSet results = getRsultSetFromDatabase(); + ResultSetMetaData meta = results.getMetaData(); + results.next();//position the cursor + Blob blob = results.getBlob("binary_data"); + InputStream inputStream = blob.getBinaryStream(); + this.fileStreamContent + = DefaultStreamedContent.builder() + .name("TEST 4.pdf") + .contentType("application/pdf") + .stream(new SerializableSupplier() + { + @Override + public InputStream get() + { + return inputStream; + } + }) + .build(); + } + catch (SQLException e) + { + System.out.println(e); + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Failed to download file.", + e.toString() + ) + ); + } + } + + public StreamedContent getFileStreamContent() + { + download(); + return fileStreamContent; + } + + private ResultSet getRsultSetFromDatabase() throws SQLException + { + PreparedStatement ps = null; + ResultSet rs = null; + String sqlStr = "SELECT * from binary_files where key_ai = 2 "; + ps = connection.prepareStatement(sqlStr); + rs = ps.executeQuery(); + return rs; + } + + private Connection connection() + throws SQLException, + ClassNotFoundException, InstantiationException, IllegalAccessException + { + String databaseName = "downloads"; + String userName = "java"; + String password = "java"; + String URL2 = "com.mysql.jdbc.Driver"; + Connection con = null; + Class.forName(URL2).newInstance(); + String ip = "localhost"; //internet connection + String url = "jdbc:mysql://" + ip + ":3306/" + databaseName; + url += "?allowPublicKeyRetrieval=true&useSSL=false"; + con = DriverManager.getConnection(url, userName, password); + con.setReadOnly(false); + return con; + } +} diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/index.xhtml b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/index.xhtml new file mode 100644 index 0000000..3c015c9 --- /dev/null +++ b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/index.xhtml @@ -0,0 +1,38 @@ + + + + + Download from database + + + + + + + + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/ajax-loader.gif b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/ajax-loader.gif new file mode 100644 index 0000000..20e04a2 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/ajax-loader.gif differ diff --git a/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/fileDownload.png b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/fileDownload.png new file mode 100644 index 0000000..3908460 Binary files /dev/null and b/Semester 3/Assignments/LabFileDownload_Dbases/src/main/webapp/resources/images/fileDownload.png differ diff --git a/Semester 3/Assignments/LabFileUpload.zip b/Semester 3/Assignments/LabFileUpload.zip new file mode 100644 index 0000000..9f636f7 Binary files /dev/null and b/Semester 3/Assignments/LabFileUpload.zip differ diff --git a/Semester 3/Assignments/LabFileUpload/nb-configuration.xml b/Semester 3/Assignments/LabFileUpload/nb-configuration.xml new file mode 100644 index 0000000..fc0cdd3 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/nb-configuration.xml @@ -0,0 +1,22 @@ + + + + + + 10-web + gfv700ee10 + Facelets + JDK_11 + ide + + diff --git a/Semester 3/Assignments/LabFileUpload/pom.xml b/Semester 3/Assignments/LabFileUpload/pom.xml new file mode 100644 index 0000000..f0d8210 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/pom.xml @@ -0,0 +1,83 @@ + + 4.0.0 + ripoll + LabFileUpload + 1.0 + war + LabFileUpload-1.0 + + + 11 + 11 + ${project.build.directory}/endorsed + UTF-8 + false + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 12.0.0 + jakarta + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + ${endorsed.dir} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + validate + + copy + + + ${endorsed.dir} + true + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + jar + + + + + + + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileUpload/src/main/java/beans/FieUploadBean.java b/Semester 3/Assignments/LabFileUpload/src/main/java/beans/FieUploadBean.java new file mode 100644 index 0000000..54482b7 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/java/beans/FieUploadBean.java @@ -0,0 +1,89 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.file.UploadedFile; + +/** + * + * @author lisset + */ +@Named(value = "fileUploadBean") +@SessionScoped +public class FieUploadBean implements Serializable { + + private UploadedFile file; + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public void handleFileUpload(FileUploadEvent event){ + System.out.println("handleFileUpload"); + file = event.getFile(); + + if (writeToAnyExistingDirectory(file)) + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Upload Successful", + file.getFileName() + " is uploaded.")); + } + else + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Failed to upload.", + file.getFileName() + " was not uploaded.")); + } + + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, new FacesMessage( + FacesMessage.SEVERITY_INFO, + "upload succesful", + file.getFileName() + " is uploaded")); + writeToAnyExistingDirectory(file); + } + + public boolean writeToAnyExistingDirectory(UploadedFile f) { + Path path = Paths.get("/media/DataEXT4/WebDev/"); + String s = ""; + if (Files.exists(path)) { + s = path.toString(); + } + try (InputStream input = f.getInputStream()) { + String fileName = f.getFileName(); + Files.copy(input, new File(s, fileName).toPath()); + } catch (FileAlreadyExistsException e) { + System.out.println(e); + return false; + } + catch (IOException e) { + System.out.println("------ failed to upload file" + e); + return false; + } + return true; + } +} diff --git a/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/JakartaRestConfiguration.java b/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/JakartaRestConfiguration.java new file mode 100644 index 0000000..678a711 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package ripoll.labfileupload; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/resources/JakartaEE10Resource.java b/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..7b1c4da --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/java/ripoll/labfileupload/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package ripoll.labfileupload.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Assignments/LabFileUpload/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/LabFileUpload/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Assignments/LabFileUpload/src/main/webapp/index.xhtml b/Semester 3/Assignments/LabFileUpload/src/main/webapp/index.xhtml new file mode 100644 index 0000000..e0704a5 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload/src/main/webapp/index.xhtml @@ -0,0 +1,26 @@ + + + + + File Uploads + + + + + + + + + + + + diff --git a/Semester 3/Assignments/LabFileUpload_Dbase.zip b/Semester 3/Assignments/LabFileUpload_Dbase.zip new file mode 100644 index 0000000..fedc8d0 Binary files /dev/null and b/Semester 3/Assignments/LabFileUpload_Dbase.zip differ diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/nb-configuration.xml b/Semester 3/Assignments/LabFileUpload_Dbase/nb-configuration.xml new file mode 100644 index 0000000..c678822 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + JSP + ide + + diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/pom.xml b/Semester 3/Assignments/LabFileUpload_Dbase/pom.xml new file mode 100644 index 0000000..dea60d5 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/pom.xml @@ -0,0 +1,53 @@ + + 4.0.0 + asdv + LabFileUpload_Dbase + 1 + war + LabFileUpload_Dbase + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 12.0.0 + jakarta + + + com.mysql + mysql-connector-j + 8.3.0 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/JakartaRestConfiguration.java b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/JakartaRestConfiguration.java new file mode 100644 index 0000000..476c53f --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package asdv.labfileupload; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/resources/JakartaEE10Resource.java b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..7518ae1 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/asdv/labfileupload/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package asdv.labfileupload.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/Database.java b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/Database.java new file mode 100644 index 0000000..8230bde --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/Database.java @@ -0,0 +1,122 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +/** + * + * @author ASDV1 + */ +public class Database +{ + + public static int saveFile( String directory, String fileName, String extension) + { + int count = -1; + File f = null; + Connection con = connection(); + if (con == null) + { + System.out.println("cannot connect to database"); + return -1; + } + try + { + PreparedStatement ps = null; + + String sqlStr = "INSERT INTO binary_files (file_name , file_extension, size_kb, binary_data )VALUES(?,?,?,?)"; + ps = con.prepareStatement(sqlStr); + + Path path = Paths.get(directory + "/" + fileName); + f = path.toFile(); + long fileLength = f.length(); + ps.setString(1, fileName); + ps.setString(2, extension); + ps.setLong(3, fileLength/1000); + + FileInputStream fis = new FileInputStream(f); + ps.setBinaryStream(4, fis, fileLength); + //execute + count = ps.executeUpdate(); + } + catch ( FileNotFoundException e ) + { + System.out.println("method Database:saveFile " + e); + + } + catch (SQLException e) + { + System.out.println("method Database:saveFile " + e); + } + finally + { + try + { + if ( f!= null ) + f.delete();//delete the uploaded file + con.close(); + } + catch (SQLException e) + { + System.out.println("connection did not close...method Database:saveFile " + e); + return -1; + } + } + + return count; + + } + + + private static Connection connection() //throws InstantiationException, IllegalAccessException + { + String databaseName = "downloads"; + String userName = "java"; + String password = "java"; + String URL2 = "com.mysql.jdbc.Driver"; + Connection con = null; + try + {// Load Sun's jdbc driver + Class.forName(URL2).newInstance(); + System.out.println("JDBC Driver loaded!"); + } + catch (Exception e) // driver not found + { + System.err.println("Unable to load database driver"); + System.err.println("Details : " + e); + return null; + } + String ip = "localhost"; //internet connection + String url = "jdbc:mysql://" + ip + ":3306/" + databaseName; + url += "?allowPublicKeyRetrieval=true&useSSL=false"; + try + { + con = DriverManager.getConnection(url, userName, password); + con.setReadOnly(false); + } + catch (Exception e) + { + System.err.println(e.toString()); + return null; + } + System.out.println("connection successfull"); + return con; + } + + public static void main(String[] args) + throws SQLException + { + connection(); + } +} diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/FileUploadBean.java b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/FileUploadBean.java new file mode 100644 index 0000000..5dc4da0 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/java/beans/FileUploadBean.java @@ -0,0 +1,197 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package beans; + +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.inject.Named; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.file.UploadedFile; + +/** + * + * @author asdv5 + */ +@Named(value = "fileUploadBean") +@SessionScoped +public class FileUploadBean implements Serializable +{ + private UploadedFile file; + + public void handleFileUpload(FileUploadEvent event) + { + System.out.println("handleFileUpload"); + UploadedFile file = event.getFile(); + if (uploadToDatabase(file)) + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, + "upload successful", + file.getFileName() + " is uploaded.")); + } + else + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_ERROR, + "Failed to upload.", + file.getFileName() + " was not uploaded.")); + } + } + + public static boolean fileExists(Path path, String fileName) + { + Path p = Paths.get(path.toString() + "/" + fileName); + System.out.println(p); + if (Files.exists(p)) + { + return true; + } + return false; + } + + /** + * Writes the file in Uploaded file into MAC existing directory + * /Users/asdv5/user1") + * + * @param f the file to be uploaded. + * @return the filename written, or null if nothing was written + */ + private String writeToAnyExistingDirectory(UploadedFile f) + { + InputStream input = null; + Path path = Paths.get("/media/DataEXT4/WebDev/"); + String s = ""; + String fileName = ""; + if (Files.exists(path)) + { + s = path.toString(); + } + try + { + input = f.getInputStream(); + fileName = f.getFileName(); + Files.copy(input, new File(s, fileName).toPath()); + System.out.println("---success saving file" + s + " " + fileName); + } + catch (FileAlreadyExistsException e) + { + int i = 1; + do + { + fileName = f.getFileName(); + int indexOfLastDot = fileName.lastIndexOf("."); + if (indexOfLastDot != -1) + { + String s1 = fileName.substring(0, indexOfLastDot); + s1 += "_" + i; + s1 += fileName.substring(indexOfLastDot); + fileName = s1; + ++i; + } + else + { + fileName += "_1"; + } + } + while (fileExists(path, fileName)); + try + { + input.close(); + input = f.getInputStream(); + Files.copy(input, new File(s, fileName).toPath()); + System.out.println("---success saving file" + s + " " + fileName); + } + catch (IOException ex) + { + System.out.println(ex); + return null; + } + return fileName; + } + catch (IOException e) + { + System.out.println("---failed to upload file " + e); + return null; + } + finally + { + try + { + input.close(); + } + catch (IOException e) + { + System.out.println(e); + return null; + } + } + return fileName; + } + + /** + * Uploads a file to a database. Firstly writes the file to the user's + * directory and then copies it to the database and deletes it from the + * user's directory. + * + * @param f Uploaded file that contains the file to be uploaded + * @return true if the file was uploaded, false otherwise. + */ + private boolean uploadToDatabase(UploadedFile f) + { + //users's directory + String uploadDirectory = "/media/DataEXT4/WebDev/"; + + //>if failed to write to user's directory, return false + if (writeToAnyExistingDirectory(f) == null) + { + return false; + } + //>separate file name from file extension if any + String fileName = f.getFileName(); + int indexOfDot = fileName.lastIndexOf("."); + String fileExtension = ""; + if (indexOfDot != -1) + { + fileExtension = fileName.substring(indexOfDot); + } + String fullPathNfileName = uploadDirectory + "/" + fileName; + + //> write to database + int count = Database.saveFile(uploadDirectory, fileName, fileExtension); + System.out.println(" ...the database server returned: " + Integer.toString(count)); + Path path = Paths.get(uploadDirectory + "/" + fileName); + + //>delete file from usr's directory + try + { + + Files.deleteIfExists(path); + } + catch (IOException e) + { + FacesContext fc = FacesContext.getCurrentInstance(); + fc.addMessage(null, + new FacesMessage( + FacesMessage.SEVERITY_WARN, + file.getFileName(), + "Failed to delete an intemmediate file but the file was uploaded to database. " + ) + ); + + } + return count >= 0 ? true : false; + } +} diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/index.xhtml b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/index.xhtml new file mode 100644 index 0000000..6d533a2 --- /dev/null +++ b/Semester 3/Assignments/LabFileUpload_Dbase/src/main/webapp/index.xhtml @@ -0,0 +1,32 @@ + + + + + Facelet Title + + + + + + + + + + + + + + + diff --git a/Semester 3/Assignments/Problem2Final2800.zip b/Semester 3/Assignments/Problem2Final2800.zip new file mode 100644 index 0000000..c4b1547 Binary files /dev/null and b/Semester 3/Assignments/Problem2Final2800.zip differ diff --git a/Semester 3/Assignments/TP2_CalebFontenot.zip b/Semester 3/Assignments/TP2_CalebFontenot.zip new file mode 100644 index 0000000..085e6bf Binary files /dev/null and b/Semester 3/Assignments/TP2_CalebFontenot.zip differ diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/nb-configuration.xml b/Semester 3/Assignments/Templates1_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..b98110a --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + ide + Facelets + + diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/pom.xml b/Semester 3/Assignments/Templates1_CalebFontenot/pom.xml new file mode 100644 index 0000000..544cacd --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + edu.slcc.asdv.caleb + Templates1_CalebFontenot + 1.0-SNAPSHOT + war + Templates1_CalebFontenot-1.0-SNAPSHOT + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/beans/templatesBean.java b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/beans/templatesBean.java new file mode 100644 index 0000000..b1be75e --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/beans/templatesBean.java @@ -0,0 +1,32 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ + +package beans; + +import jakarta.inject.Named; +import jakarta.faces.view.ViewScoped; +import java.io.Serializable; + +/** + * + * @author caleb + */ +@Named(value="templatesBean") +@ViewScoped +public class templatesBean implements Serializable{ + private String msg = ""; + + public String getMsg() { return msg; } + public void action(String arg){this.msg = arg;} + + public String createMenu(String menu) { + String s = ""; + for (String menuItems: menu) { + s += menuItems; + return "I created a menu and return " + s1; + } + } + +} diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/JakartaRestConfiguration.java b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/JakartaRestConfiguration.java new file mode 100644 index 0000000..90c1d42 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package edu.slcc.asdv.caleb.templates1_calebfontenot; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/resources/JakartaEE10Resource.java b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..f93d4d5 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/templates1_calebfontenot/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package edu.slcc.asdv.caleb.templates1_calebfontenot.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/newjsf.xhtml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/newjsf.xhtml new file mode 100644 index 0000000..5f8f982 --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/newjsf.xhtml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/problem4.xhtml b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/problem4.xhtml new file mode 100644 index 0000000..cae377e --- /dev/null +++ b/Semester 3/Assignments/Templates1_CalebFontenot/src/main/webapp/problem4.xhtml @@ -0,0 +1,18 @@ + + + + + Facelet Title + + + + + + + + + + + + diff --git a/Semester 3/Assignments/dbase.rtf b/Semester 3/Assignments/dbase.rtf new file mode 100644 index 0000000..567f431 --- /dev/null +++ b/Semester 3/Assignments/dbase.rtf @@ -0,0 +1,45 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2639 +\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\margl1440\margr1440\vieww11520\viewh8400\viewkind0 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 + +\f0\fs24 \cf0 -- phpMyAdmin SQL Dump\ +-- version 5.2.0\ +-- https://www.phpmyadmin.net/\ +--\ +-- Host: localhost:8889\ +-- Generation Time: Apr 29, 2024 at 02:43 PM\ +-- Server version: 5.7.39\ +-- PHP Version: 7.4.33\ +\ +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";\ +START TRANSACTION;\ +SET time_zone = "+00:00";\ +\ +\ +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\ +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\ +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\ +/*!40101 SET NAMES utf8mb4 */;\ +\ +--\ +-- Database: `downloads`\ +--\ +\ +-- --------------------------------------------------------\ +\ +--\ +-- Table structure for table `binary_files`\ +--\ +\ +CREATE TABLE `binary_files` (\ + `key_ai` int(11) NOT NULL,\ + `file_name` varchar(1000) NOT NULL,\ + `file_extension` varchar(100) NOT NULL,\ + `size_kb` bigint(20) NOT NULL,\ + `binary_data` longblob NOT NULL\ +) ENGINE=InnoDB DEFAULT CHARSET=utf8;\ +\ +} \ No newline at end of file diff --git a/Semester 3/Assignments/dbase.sql b/Semester 3/Assignments/dbase.sql new file mode 100644 index 0000000..2d7d02a --- /dev/null +++ b/Semester 3/Assignments/dbase.sql @@ -0,0 +1,37 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.0 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost:8889 +-- Generation Time: Apr 29, 2024 at 02:43 PM +-- Server version: 5.7.39 +-- PHP Version: 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `downloads` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `binary_files` +-- + +CREATE TABLE `binary_files` ( +    `key_ai` int(11) NOT NULL, +    `file_name` varchar(1000) NOT NULL, +    `file_extension` varchar(100) NOT NULL, +    `size_kb` bigint(20) NOT NULL, +    `binary_data` longblob NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/nb-configuration.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..4da1f6c --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + ide + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/pom.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/pom.xml new file mode 100644 index 0000000..a43beff --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + edu.slcc.asdv.caleb + FinalExamProblem2_CalebFontenot + 1.0-SNAPSHOT + war + FinalExamProblem2_CalebFontenot-1.0-SNAPSHOT + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonBean.java b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonBean.java new file mode 100644 index 0000000..d227447 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonBean.java @@ -0,0 +1,84 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import jakarta.json.JsonArray; +import jakarta.json.JsonNumber; +import jakarta.json.JsonObject; +import jakarta.json.JsonString; +import jakarta.json.JsonValue; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.LinkedHashMap; + +/** + * + * @author caleb + */ +@Named(value = "jsonBean") +@SessionScoped +public class JsonBean implements Serializable { + + /** + * Creates a new instance of JsonBean + */ + public JsonBean() + { + } + + public String compute() + { + String returnString = ""; + ArrayList> personArray = new ArrayList<>(); + personArray.add(JsonSupplier.createMapOfSupplier("s1", "Jeff", "21", "Sillicon Valley")); + personArray.add(JsonSupplier.createMapOfSupplier("s2", "Mary Poppins", "22", "London")); + JsonObject jo = JsonSupplier.createJsonObjectForSuppliers(personArray); + returnString += navigateTree(jo, null) + "\n"; + returnString += jo.toString(); + return returnString; + } + + public static String navigateTree(JsonValue tree, String returnString) + { + if (returnString == null) { + returnString = ""; + } + if (tree == null) { + return returnString; + } + + switch (tree.getValueType()) { + case OBJECT: + JsonObject object = (JsonObject) tree; + for (String name : object.keySet()) { + returnString += "Key " + name + ": \n"; + returnString = navigateTree(object.get(name), returnString); + } + break; + case ARRAY: + JsonArray array = (JsonArray) tree; + for (JsonValue val : array) { + returnString = navigateTree(val, returnString); + } + break; + case STRING: + JsonString st = (JsonString) tree; + returnString += "\tSTRING " + st.getString() + "\n"; + break; + case NUMBER: + JsonNumber num = (JsonNumber) tree; + returnString += "\tNUMBER " + num.toString() + "\n"; + break; + case TRUE: + case FALSE: + case NULL: + returnString += tree.getValueType().toString() + "\n"; + break; + } + return returnString; + } +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonSupplier.java b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonSupplier.java new file mode 100644 index 0000000..f235525 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/beans/JsonSupplier.java @@ -0,0 +1,153 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +/** + * + * @author caleb + */ +import java.io.StringReader; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import jakarta.json.Json; +import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; +import jakarta.json.JsonReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.util.Scanner; + +public class JsonSupplier +{ + + /** + * Creates a JsonObject by traversing the arrayList of LinkedHashMap + * + * @param suppliers ArrayList of LinkedHashMap. Each element of the + * arrayList is a row of suppliers table. The key of the LinkedHashMap is + * the attribute name and the value of the attribute Example ( One liked + * hash map is one row from the table) LinkedHashMap 1 : key: snumber, + * value: s1 key: sname, value: white key: status, value: 20 key: city, + * value London LinkedHashMap 2 : key: snumber, value: s2 key: sname, value: + * black key: status, value: 30 key: city, value Paris The value of the map + * @return JsonObject + */ + public static JsonObject createJsonObjectForSuppliers(ArrayList> suppliers) + { + JsonObjectBuilder jsonBuilder = Json.createObjectBuilder(); + int counter = 1; + for (LinkedHashMap supplier : suppliers) + { + // create an array of key-value pairs + JsonArrayBuilder arraySupplierBld = Json.createArrayBuilder(); + + // create each key-value pair as seperate object and add it to the array + Set> entrySet = supplier.entrySet(); + for (Map.Entry entry : entrySet) + { + arraySupplierBld.add( + Json.createObjectBuilder().add(entry.getKey(), + entry.getValue()).build()); + } + + // add supplier-array to object + String objectID = "+" + (counter++); + + jsonBuilder.add(objectID, arraySupplierBld); + } + + JsonObject allSuppliersJsonObject = jsonBuilder.build(); + return allSuppliersJsonObject; + } + + /** + * Creates a JsonObject by reading the String data in JSON format + * + * @param jsonData Json format data + * @return JsonObject + */ + public static JsonObject createJsonObjectFromString(String jsonData) + { + JsonReader jsonReader = Json.createReader(new StringReader(jsonData)); + JsonObject o = jsonReader.readObject(); + return o; + } + + /** + * Creates a LinkedHashMap of 4 ENTRYies.Keys name: snumber, sname, status + * and city. Values of map are the parameters. + * + * @param snumber value of map + * @param sname value of map + * @param status value of map + * @param city value of map + * @return + */ + public static LinkedHashMap createMapOfSupplier( + String snumber, + String sname, + String status, + String city + ) + + { + LinkedHashMap mapSupplier + = new LinkedHashMap(); + mapSupplier.put("snumber", snumber); + mapSupplier.put("sname", sname); + mapSupplier.put("status", status); + mapSupplier.put("city", city); + + return mapSupplier; + } + + public static String supplierJasonObject() + { + ArrayList< LinkedHashMap> suppliers = new ArrayList(); + for (int i = 1; i <= 2; ++i) + { + LinkedHashMap oneSupplierRowOfTable + = createMapOfSupplier( + "s1" + i, + "Johnson" + i, + Integer.toString(20 + i), + "london" + i); + suppliers.add(oneSupplierRowOfTable); + } + + JsonObject j = createJsonObjectForSuppliers(suppliers); + return j.toString(); + } + + public static void writeJsonToTextFile( JsonObject jo) + throws FileNotFoundException + { + String joString = jo.toString(); + PrintWriter output = new PrintWriter(new FileOutputStream("jo.json", true)); + output.print(joString); + output.close(); + } + public static JsonObject readTextFileIntoJson( String fileName) + throws FileNotFoundException + { + File file = new java.io.File(fileName); + Scanner input = new Scanner(file); + String joString = ""; + while (input.hasNext()) + { + joString += input.next(); + } + input.close(); + JsonObject jo = createJsonObjectFromString( joString); + return jo; + } + + +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/JakartaRestConfiguration.java b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/JakartaRestConfiguration.java new file mode 100644 index 0000000..6cb8d99 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package edu.slcc.asdv.caleb.finalexamproblem2_calebfontenot; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/resources/JakartaEE10Resource.java b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..64961f9 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem2_calebfontenot/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package edu.slcc.asdv.caleb.finalexamproblem2_calebfontenot.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/index.xhtml b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/index.xhtml new file mode 100644 index 0000000..834d42a --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem2_CalebFontenot/src/main/webapp/index.xhtml @@ -0,0 +1,16 @@ + + + + + Facelet Title + + + + + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/nb-configuration.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..b98110a --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + ide + Facelets + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/pom.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/pom.xml new file mode 100644 index 0000000..917891a --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + edu.slcc.asdv.caleb + FinalExamProblem3_CalebFontenot + 1.0-SNAPSHOT + war + FinalExamProblem3_CalebFontenot-1.0-SNAPSHOT + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 14.0.0-RC2 + jakarta + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/beans/slideMenuBean.java b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/beans/slideMenuBean.java new file mode 100644 index 0000000..5986fae --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/beans/slideMenuBean.java @@ -0,0 +1,50 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ + +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import java.io.Serializable; + +/** + * + * @author caleb + */ +@Named(value="slideMenuBean") +@SessionScoped +public class slideMenuBean implements Serializable{ + private boolean menuVisable; + public boolean isMenuVisable() { return menuVisable; } + public void toggleSlideMenu() { menuVisable = !menuVisable; } + private String out; + public String getOut() { return out; } + public void setOut(String out) { this.out = out; } + + public void handleMenuSelection(int selection) { + String selectedMenuItem; + switch (selection) { + case 0: + selectedMenuItem = "save"; + break; + case 1: + selectedMenuItem = "update"; + break; + case 2: + selectedMenuItem = "delete"; + break; + default: + selectedMenuItem = "unknown"; + break; + } + out = "You selected " + selectedMenuItem; + System.out.println(out); + } + + /** Creates a new instance of slideMenuBean */ + public slideMenuBean() { + } + +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/JakartaRestConfiguration.java b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/JakartaRestConfiguration.java new file mode 100644 index 0000000..f2b9189 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package edu.slcc.asdv.caleb.finalexamproblem3_calebfontenot; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/resources/JakartaEE10Resource.java b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..c883039 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/finalexamproblem3_calebfontenot/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package edu.slcc.asdv.caleb.finalexamproblem3_calebfontenot.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/index.xhtml b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/index.xhtml new file mode 100644 index 0000000..76c247f --- /dev/null +++ b/Semester 3/Exams-Quizzes/FinalExamProblem3_CalebFontenot/src/main/webapp/index.xhtml @@ -0,0 +1,25 @@ + + + + + Facelet Title + + + + + + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/nb-configuration.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/nb-configuration.xml new file mode 100644 index 0000000..ea4eb8b --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + Facelets + ide + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/pom.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/pom.xml new file mode 100644 index 0000000..4684100 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + asdv + Problem2Final2800 + 1 + war + Problem2Final2800-1 + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/JakartaRestConfiguration.java b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/JakartaRestConfiguration.java new file mode 100644 index 0000000..56939c8 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package asdv.problem2final2800; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/resources/JakartaEE10Resource.java b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..e04a006 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/asdv/problem2final2800/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package asdv.problem2final2800.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/beans/TemplatesBean.java b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/beans/TemplatesBean.java new file mode 100644 index 0000000..c2b360a --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/java/beans/TemplatesBean.java @@ -0,0 +1,32 @@ +package beans; +import java.io.Serializable; +import jakarta.inject.Named; +import jakarta.faces.view.ViewScoped; + +@Named(value = "templatesBean") +@ViewScoped +public class TemplatesBean implements Serializable +{ + + private String msgTopDefault = ""; + private String msgBottomDefault = ""; + private String msgLeftDefault = "Generate a number between 1 and 100!"; + private String msgCenterDefault = "No center content ... press the below button!"; + public String getMsgLeftDefault() { return msgLeftDefault; } + public void setMsgLeftDefault(String msgLeftDefault) { this.msgLeftDefault = msgLeftDefault; } + public String getMsgTopDefault(){return msgTopDefault;} + public void setMsgTopDefault(String msgTopDefault){this.msgTopDefault = msgTopDefault;} + public String getMsgBottomDefault(){return msgBottomDefault;} + public void setMsgBottomDefault(String msgBottomDefault){this.msgBottomDefault = msgBottomDefault;} + public String getMsgCenterDefault(){return msgCenterDefault;} + public void setMsgCenterDefault(String msgCenterDefault){this.msgCenterDefault = msgCenterDefault;} + public void leftAction() { + int randInt = (int) (Math.random() * 100 + 1); + this.msgLeftDefault = "" + randInt; + } + public void topAction(String msg){this.msgTopDefault = msg;} + public void bottomAction(String msg){this.msgBottomDefault = msg; + System.out.println( this.msgBottomDefault );} + + public void centerAction(){this.msgCenterDefault = "This is default content";} +} diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/resources/META-INF/persistence.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/web.xml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/index.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/index.xhtml new file mode 100644 index 0000000..ec9be7b --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/index.xhtml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/cssLayout.css b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/cssLayout.css new file mode 100644 index 0000000..c1bd39b --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/cssLayout.css @@ -0,0 +1,37 @@ +#top { + position: relative; + background-color: #cccccc; + padding: 5px; + margin: 0px 0px 10px 0px; + text-align:center; +} +#bottom { + position: relative; + background-color: #cccccc; + padding: 5px; + margin: 10px 0px 0px 0px; + text-align:center; +} +#left { + float: left; + background-color: #cccc11; + position: relative; + padding: 5px; + width: 150px; + text-align:center; +} +#right { + float: right; + position: relative; + background-color: #cccc11; + padding: 5px; + width: 150px; + text-align:center; +} +#content { + background-color: #00cc00; + padding: 5px; + margin: 0px 170px 0px 170px; + text-align:center; +} + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/default.css b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/default.css new file mode 100644 index 0000000..713572a --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/resources/css/default.css @@ -0,0 +1,10 @@ +body { + background-color: #ffffff; + font-size: 12px; + font-family: Verdana, "Verdana CE", Arial, + "Arial CE", "Lucida Grande CE", + lucida, "Helvetica CE", + sans-serif; + color: #000000; + margin: 10px; +} diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/bottomDefault.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/bottomDefault.xhtml new file mode 100644 index 0000000..7f187aa --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/bottomDefault.xhtml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/contentDefault.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/contentDefault.xhtml new file mode 100644 index 0000000..288f3d1 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/contentDefault.xhtml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/leftDefault.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/leftDefault.xhtml new file mode 100644 index 0000000..bc5e433 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/leftDefault.xhtml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/rightDefault.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/rightDefault.xhtml new file mode 100644 index 0000000..4854bb4 --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/rightDefault.xhtml @@ -0,0 +1,10 @@ + + + + + + This is default right side + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/topDefault.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/topDefault.xhtml new file mode 100644 index 0000000..ccce3da --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/default/topDefault.xhtml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/layout.xhtml b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/layout.xhtml new file mode 100644 index 0000000..93e591a --- /dev/null +++ b/Semester 3/Exams-Quizzes/Problem2Final2800/src/main/webapp/template/layout.xhtml @@ -0,0 +1,59 @@ + + + + + + + + My Template + + + +
+ + + + + + + +
+ +
+
+ + + +
+ + + +
+ + + + + + +
+ +
+
+ + + + + + + + +
+
+ diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/Printed HTMLs/page1.html b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/Printed HTMLs/page1.html new file mode 100644 index 0000000..9ffe6d6 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/Printed HTMLs/page1.html @@ -0,0 +1,59 @@ + + + +page1.xhtml + + + + +
/home/caleb/ASDV-WebDev/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page1.xhtml
+
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:h="jakarta.faces.html"
+      xmlns:p="http://primefaces.org/ui">
+    <h:head>
+        <title>Facelet Title</title>
+        <style>
+            body {
+                text-align: center
+            }
+        </style>
+    </h:head>
+    <h:body>
+        <h:form>
+            <h2 style="display: inline;">Miles to kilometers label 1: </h2>
+            <h:outputText id="output1" style="display: inline;" value="#{problem1Bean.output}"/>
+            <br/>
+            <h2 style="display: inline;">Miles to kilometers label 2: </h2>
+            <h:outputText id="output2" style="display: inline;" value="#{problem1Bean.output}"/>
+            <br/>
+
+            <p:inputText value="#{problem1Bean.input}" >
+                <p:ajax event="keyup" listener="#{problem1Bean.convert}" update="output2"/>
+            </p:inputText>  
+            mi<br/>
+            <p:commandButton value="Convert Miles to Killometers" action="#{problem1Bean.convert}" update="output1 output2"/>
+        </h:form>
+    </h:body>
+</html>
+
+
+ diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/nb-configuration.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/nb-configuration.xml new file mode 100644 index 0000000..b98110a --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/nb-configuration.xml @@ -0,0 +1,21 @@ + + + + + + 10-web + gfv700ee10 + ide + Facelets + + diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/pom.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/pom.xml new file mode 100644 index 0000000..c62170c --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + edu.slcc.asdv.caleb + ProgrammingExam1_CalebFontenot + 1.0-SNAPSHOT + war + ProgrammingExam1_CalebFontenot-1.0-SNAPSHOT + + + UTF-8 + 10.0.0 + + + + + jakarta.platform + jakarta.jakartaee-api + ${jakartaee} + provided + + + org.primefaces + primefaces + 13.0.5 + jakarta + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem1Bean.java b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem1Bean.java new file mode 100644 index 0000000..a122010 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem1Bean.java @@ -0,0 +1,50 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ + +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.SessionScoped; +import jakarta.faces.application.FacesMessage; +import jakarta.faces.context.FacesContext; +import jakarta.faces.event.AjaxBehaviorEvent; +import java.io.Serializable; +import org.primefaces.PrimeFaces; + +/** + * + * @author caleb + */ +@Named(value="problem1Bean") +@SessionScoped +public class Problem1Bean implements Serializable { + private boolean checkboxState = true; + private String input; + private String output = "test"; + + public String getOutput() { return output; } + public String getInput() { return input; } + public void setInput(String input) { this.input = input; } + public void setOutput(String output) {this.output = output;} + public boolean isCheckboxState() { return checkboxState; } + public void setCheckboxState(boolean checkboxState) { System.out.println("checkbox state updated: " + checkboxState); this.checkboxState = checkboxState; } + + public void convert() { + System.out.println("convert"); + double miles = Double.parseDouble(input); + output = String.valueOf(miles * 1.609344) + "km"; + String messageContent = "Result of " + miles + "mi to km is: " + output; + System.out.println(messageContent); + FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Converter:", messageContent); + FacesContext.getCurrentInstance().addMessage(null, message); + PrimeFaces.current().ajax().update("MyForm:messages"); + } + + + /** Creates a new instance of Problem1Bean */ + public Problem1Bean() { + } + +} diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem3Bean.java b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem3Bean.java new file mode 100644 index 0000000..af94378 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/beans/Problem3Bean.java @@ -0,0 +1,53 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java to edit this template + */ + +package beans; + +import jakarta.inject.Named; +import jakarta.enterprise.context.Dependent; +import jakarta.enterprise.context.SessionScoped; +import java.io.Serializable; + +/** + * + * @author caleb + */ +@Named(value="a") +@SessionScoped +public class Problem3Bean implements Serializable { + + private String value1; + private String value2; + + public String getValue2() + { + return value2; + } + + public void setValue2(String value2) + { + this.value2 = value2; + } + + + public String getValue1() + { + return value1; + } + + public void setValue1(String value1) + { + this.value1 = value1; + } + public void b (String a, String b) { + this.value1 = a; + this.value2 = b; + } + + /** Creates a new instance of Problem3Bean */ + public Problem3Bean() { + } + +} diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/JakartaRestConfiguration.java b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/JakartaRestConfiguration.java new file mode 100644 index 0000000..dc8e79d --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/JakartaRestConfiguration.java @@ -0,0 +1,13 @@ +package edu.slcc.asdv.caleb.programmingexam1_calebfontenot; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * Configures Jakarta RESTful Web Services for the application. + * @author Juneau + */ +@ApplicationPath("resources") +public class JakartaRestConfiguration extends Application { + +} diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/resources/JakartaEE10Resource.java b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/resources/JakartaEE10Resource.java new file mode 100644 index 0000000..f989551 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/programmingexam1_calebfontenot/resources/JakartaEE10Resource.java @@ -0,0 +1,20 @@ +package edu.slcc.asdv.caleb.programmingexam1_calebfontenot.resources; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.Response; + +/** + * + * @author + */ +@Path("jakartaee10") +public class JakartaEE10Resource { + + @GET + public Response ping(){ + return Response + .ok("ping Jakarta EE") + .build(); + } +} diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/resources/META-INF/persistence.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..7582bf1 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..9dfae34 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml new file mode 100644 index 0000000..673cc06 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/glassfish-web.xml @@ -0,0 +1,25 @@ + + + + + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/web.xml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..fcfcd54 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + jakarta.faces.PROJECT_STAGE + Development + + + Faces Servlet + jakarta.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/index.xhtml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/index.xhtml new file mode 100644 index 0000000..c8f7fc8 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/index.xhtml @@ -0,0 +1,13 @@ + + + + + Facelet Title + + +
+
+
+
+ diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page1.xhtml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page1.xhtml new file mode 100644 index 0000000..af22e9b --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page1.xhtml @@ -0,0 +1,31 @@ + + + + + Facelet Title + + + + + +

Miles to kilometers label 1:

+ +
+

Miles to kilometers label 2:

+ +
+ + + + + mi
+ +
+
+ diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page2.xhtml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page2.xhtml new file mode 100644 index 0000000..4a63aa9 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page2.xhtml @@ -0,0 +1,37 @@ + + + + + Facelet Title + + + + + + +

Miles to kilometers label 1:

+ +
+

Miles to kilometers label 2:

+ +
+ + + + mi
+
+ show converter + + + + +
+
+ diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page3.xhtml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page3.xhtml new file mode 100644 index 0000000..2ef71a4 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/page3.xhtml @@ -0,0 +1,17 @@ + + + + + Facelet Title + + + + + + + + + + diff --git a/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/template1.xhtml b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/template1.xhtml new file mode 100644 index 0000000..4375fc5 --- /dev/null +++ b/Semester 3/Exams-Quizzes/ProgrammingExam1_CalebFontenot/src/main/webapp/template1.xhtml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/Semester 3/ZIPs/FinalExamProblem1_CalebFontenot.zip b/Semester 3/ZIPs/FinalExamProblem1_CalebFontenot.zip new file mode 100644 index 0000000..84a2e9d Binary files /dev/null and b/Semester 3/ZIPs/FinalExamProblem1_CalebFontenot.zip differ diff --git a/Semester 3/ZIPs/FinalExamProblem2_CalebFontenot.zip b/Semester 3/ZIPs/FinalExamProblem2_CalebFontenot.zip new file mode 100644 index 0000000..db44c50 Binary files /dev/null and b/Semester 3/ZIPs/FinalExamProblem2_CalebFontenot.zip differ diff --git a/Semester 3/ZIPs/FinalExamProblem3_CalebFontenot.zip b/Semester 3/ZIPs/FinalExamProblem3_CalebFontenot.zip new file mode 100644 index 0000000..5ec41c4 Binary files /dev/null and b/Semester 3/ZIPs/FinalExamProblem3_CalebFontenot.zip differ