Create a Java program that implements a simple REST API server with endpoints for adding, updating, deleting, and retrieving data from a PostgreSQL database.

To create a simple REST API server in Java, we can use the Spring Boot framework along with Spring Data JPA and PostgreSQL. Below is an example of how to implement this.

1. First, set up a new Spring Boot project using start.spring.io or your favorite IDE.

2. Add the following dependencies to your `build.gradle` file:

```groovy
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'org.postgresql:postgresql'
}
```

3. Configure the database connection in the `application.properties` file:

```properties
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=myuser
spring.datasource.password=mypassword

spring.jpa.hibernate.ddl-auto=update
```

4. Create an entity class for the data you want to store in the database. For example, let's create a `Person` entity:

```java
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Person {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String name;
    private int age;

    // Getters and setters
}
```

5. Create a repository interface that extends `JpaRepository`:

```java
import org.springframework.data.jpa.repository.JpaRepository;

public interface PersonRepository extends JpaRepository<Person, Long> {
}
```

6. Create a controller class to handle the REST API endpoints:

```java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Optional;

@RestController
@RequestMapping("/api/persons")
public class PersonController {

    @Autowired
    private PersonRepository personRepository;

    @GetMapping
    public List<Person> getAllPersons() {
        return personRepository.findAll();
    }

    @GetMapping("/{id}")
    public Optional<Person> getPersonById(@PathVariable Long id) {
        return personRepository.findById(id);
    }

    @PostMapping
    public Person addPerson(@RequestBody Person person) {
        return personRepository.save(person);
    }

    @PutMapping("/{id}")
    public Person updatePerson(@PathVariable Long id, @RequestBody Person updatedPerson) {
        return personRepository.findById(id).map(person -> {
            person.setName(updatedPerson.getName());
            person.setAge(updatedPerson.getAge());
            return personRepository.save(person);
        }).orElseThrow(() -> new RuntimeException("Person not found with id " + id));
    }

    @DeleteMapping("/{id}")
    public void deletePerson(@PathVariable Long id) {
        personRepository.deleteById(id);
    }
}
```

7. Run the application using `./gradlew bootRun` or by running the main class from your IDE.

Now you have a simple REST API server that supports adding, updating, deleting, and retrieving data from a PostgreSQL database. You can test the endpoints using tools like Postman or curl.