update projects.
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
|
||||
@@ -19,7 +19,7 @@ group = 'edu.addressbook'
|
||||
version = '1.0'
|
||||
|
||||
application {
|
||||
mainClass = 'edu.addressbook.App'
|
||||
mainClass = 'edu.addressbook.api.App'
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -34,23 +34,20 @@ javafx {
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation("org.slf4j:slf4j-api:2.0.17")
|
||||
implementation("ch.qos.logback:logback-classic:1.5.26")
|
||||
implementation("org.aspectj:aspectjrt:1.9.25")
|
||||
implementation("org.slf4j:slf4j-api:2.0.17")
|
||||
implementation("ch.qos.logback:logback-classic:1.5.26")
|
||||
implementation("org.aspectj:aspectjrt:1.9.25")
|
||||
|
||||
implementation 'org.openjfx:javafx-base:25.0.1'
|
||||
implementation 'org.openjfx:javafx-fxml:25.0.1'
|
||||
implementation 'org.openjfx:javafx-controls:25.0.1'
|
||||
implementation 'org.openjfx:javafx-graphics:25.0.1'
|
||||
implementation 'org.openjfx:javafx-web:25.0.1'
|
||||
implementation 'org.xerial:sqlite-jdbc:3.51.2.0'
|
||||
|
||||
implementation 'jakarta.activation:jakarta.activation-api:2.1.4'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Automatic-Module-Name': group,
|
||||
'Main-Class': application.mainClass,
|
||||
'Class-Path': 'edu.addressbook org.aspectj.runtime'
|
||||
'Class-Path': 'edu.addressbook org.aspectj.runtime .'
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
@@ -59,10 +56,10 @@ jar {
|
||||
tasks.named('jar') {
|
||||
manifest {
|
||||
attributes(
|
||||
'Automatic-Module-Name':'edu.addressbook',
|
||||
'Implementation-Title': 'edu.addressbook',
|
||||
'Automatic-Module-Name':group,
|
||||
'Implementation-Title': group,
|
||||
'Implementation-Version': 1.0,
|
||||
'Main-Class': 'edu.addressbook.App',
|
||||
'Class-Path': 'edu.addressbook org.aspectj.runtime' )
|
||||
'Main-Class': application.mainClass,
|
||||
'Class-Path': 'edu.addressbook org.aspectj.runtime .' )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package edu.addressbook;
|
||||
|
||||
public final class App {
|
||||
public final static void main(final String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package edu.addressbook.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.sqlite.SQLiteDataSource;
|
||||
|
||||
import edu.addressbook.model.Contact;
|
||||
|
||||
public final class App {
|
||||
|
||||
public final static ListIterator<Contact> FindAll() {
|
||||
try {
|
||||
File rootDir = new File(String.format("%s", DataRepositoryConfig.getPath()));
|
||||
Files.createDirectories(rootDir.toPath());
|
||||
|
||||
SQLiteDataSource dataSource = new SQLiteDataSource();
|
||||
dataSource.setUrl(String.format("jdbc:sqlite:%ssample.db", DataRepositoryConfig.getPath()));
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public final static void main(final String[] args) {
|
||||
FindAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package edu.addressbook.api;
|
||||
|
||||
public class DataRepositoryConfig {
|
||||
public final static String getPath() {
|
||||
String home = System.getenv("HOME") != null ? System.getenv("HOME")
|
||||
: System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH");
|
||||
return home.replace('\\', '/') + "/workspace/addressbook/db/";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package edu.addressbook.api;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.sun.net.httpserver.HttpContext;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
|
||||
public final class HttpMessageService {
|
||||
|
||||
private class RequestHandler implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange httpExchange) {
|
||||
InputStream inStream = httpExchange.getRequestBody();
|
||||
Scanner scanner = new Scanner(inStream);
|
||||
String data = scanner.nextLine();
|
||||
System.out.println(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void runServer() {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
HttpServer server = null;
|
||||
try {
|
||||
server = HttpServer.create(new InetSocketAddress(10080), 0);
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
HttpContext context = server.createContext("/addressbook");
|
||||
context.setHandler(new RequestHandler());
|
||||
server.setExecutor(null);
|
||||
server.start();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
reservationsystem
|
||||
*/
|
||||
package edu.addressbook.model;
|
||||
|
||||
public final class Address{
|
||||
@@ -11,10 +7,6 @@ public final class Address{
|
||||
String state;
|
||||
String zip;
|
||||
|
||||
/** not used
|
||||
*
|
||||
*/
|
||||
|
||||
public Address() {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package edu.addressbook.model;
|
||||
|
||||
public class Company {
|
||||
String legal_name;
|
||||
String getLegalName(){
|
||||
return legal_name;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,6 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
reservationsystem
|
||||
*/
|
||||
package edu.addressbook.model;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ListIterator;
|
||||
|
||||
/**
|
||||
* Concrete account data class for account json storage record.
|
||||
@@ -29,14 +19,11 @@ public class Contact {
|
||||
public Contact(
|
||||
String phone_number,
|
||||
Address mailing_address,
|
||||
EmailAddress email_address) {
|
||||
EmailAddress email_address) throws IllegalArgumentException {
|
||||
this.phone_number = phone_number;
|
||||
this.mailing_address = mailing_address;
|
||||
this.email_address = email_address;
|
||||
}
|
||||
|
||||
public Contact(Address mailing_address, EmailAddress email_address)
|
||||
throws IllegalArgumentException {
|
||||
if (phone_number == null) {
|
||||
throw new IllegalArgumentException(String.format("%s %s", "Account: requires phone number",
|
||||
mailing_address.toString()));
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/**
|
||||
* license: GPLv3
|
||||
reservationsystem
|
||||
*/
|
||||
package edu.addressbook.model;
|
||||
|
||||
public class EmailAddress{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package edu.addressbook.model;
|
||||
|
||||
public class Person {
|
||||
String first_name;
|
||||
String last_name;
|
||||
String getFirstName(){
|
||||
return first_name;
|
||||
}
|
||||
String getLastName(){
|
||||
return first_name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package edu.addressbook.model;
|
||||
|
||||
public class PhoneNumber {
|
||||
String phone_number;
|
||||
|
||||
public PhoneNumber(String phone_number) {
|
||||
this.phone_number = phone_number;
|
||||
}
|
||||
|
||||
public String getphone_number() {
|
||||
return phone_number;
|
||||
}
|
||||
|
||||
public void setphone_number(String phone_number) {
|
||||
this.phone_number = phone_number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((phone_number == null) ? 0 : phone_number.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PhoneNumber other = (PhoneNumber) obj;
|
||||
if (phone_number == null) {
|
||||
if (other.phone_number != null)
|
||||
return false;
|
||||
} else if (!phone_number.equals(other.getphone_number()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{ \"PhoneNumber\":{");
|
||||
sb.append("\"phone\": \"" + phone_number + "\"");
|
||||
sb.append("}}");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
module edu.addressbook {
|
||||
exports edu.addressbook;
|
||||
}
|
||||
Reference in New Issue
Block a user