Skip to content

Commit a59a77f

Browse files
committed
Archetypes for spring
1 parent 3fdfa31 commit a59a77f

File tree

73 files changed

+1595
-730
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1595
-730
lines changed

astra-sdk-archetypes/pom.xml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
4-
<groupId>com.datastax.astra</groupId>
5-
<artifactId>astra-sdk-archetypes</artifactId>
6-
<version>0.5.1-SNAPSHOT</version>
7-
<packaging>pom</packaging>
8-
<name>+ astra-sdk-archetypes</name>
9-
10-
<modules>
11-
</modules>
12-
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.datastax.astra</groupId>
7+
<artifactId>astra-sdk-archetypes</artifactId>
8+
<packaging>pom</packaging>
9+
<name>+ astra-sdk-archetypes</name>
10+
11+
<parent>
12+
<groupId>com.datastax.astra</groupId>
13+
<artifactId>astra-sdk-parent</artifactId>
14+
<version>0.5.1-SNAPSHOT</version>
15+
</parent>
16+
17+
<modules>
18+
<module>spring-boot-2x-archetype</module>
19+
<module>spring-boot-3x-archetype</module>
20+
</modules>
21+
1322
</project>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.datastax.astra</groupId>
5+
<artifactId>spring-boot-2x-archetype</artifactId>
6+
<packaging>maven-archetype</packaging>
7+
<name>+ archetype::spring-boot-2x</name>
8+
9+
<parent>
10+
<groupId>com.datastax.astra</groupId>
11+
<artifactId>astra-sdk-archetypes</artifactId>
12+
<version>0.5.1-SNAPSHOT</version>
13+
</parent>
14+
15+
<build>
16+
<extensions>
17+
<extension>
18+
<groupId>org.apache.maven.archetype</groupId>
19+
<artifactId>archetype-packaging</artifactId>
20+
<version>3.2.1</version>
21+
</extension>
22+
</extensions>
23+
24+
<pluginManagement>
25+
<plugins>
26+
<plugin>
27+
<artifactId>maven-archetype-plugin</artifactId>
28+
<version>3.2.1</version>
29+
</plugin>
30+
</plugins>
31+
</pluginManagement>
32+
</build>
33+
34+
35+
</project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<archetype-descriptor xsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 http://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd" name="sample-spring-boot-2x"
3+
xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<fileSets>
6+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
7+
<directory>src/main/java</directory>
8+
<includes>
9+
<include>**/*.java</include>
10+
</includes>
11+
</fileSet>
12+
<fileSet encoding="UTF-8">
13+
<directory>src/main/resources</directory>
14+
<includes>
15+
<include>**/*.yml</include>
16+
</includes>
17+
</fileSet>
18+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
19+
<directory>src/test/java</directory>
20+
<includes>
21+
<include>**/*.java</include>
22+
</includes>
23+
</fileSet>
24+
</fileSets>
25+
</archetype-descriptor>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>${artifactId}</artifactId>
5+
<name>${artifactId}</name>
6+
<groupId>${groupId}</groupId>
7+
<version>${version}</version>
8+
9+
<parent>
10+
<groupId>org.springframework.boot</groupId>
11+
<artifactId>spring-boot-starter-parent</artifactId>
12+
<version>2.7.12</version>
13+
</parent>
14+
15+
<dependencies>
16+
17+
<!-- CRUD API for Cassandra -->
18+
<dependency>
19+
<groupId>org.springframework.boot</groupId>
20+
<artifactId>spring-boot-starter-web</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-data-cassandra</artifactId>
25+
</dependency>
26+
27+
<!-- Build Cassandra Session and access all Astra Apis -->
28+
<dependency>
29+
<groupId>com.datastax.astra</groupId>
30+
<artifactId>astra-spring-boot-starter</artifactId>
31+
<version>0.6</version>
32+
</dependency>
33+
34+
<!-- Test -->
35+
<dependency>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-starter-test</artifactId>
38+
<scope>test</scope>
39+
</dependency>
40+
41+
</dependencies>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.springframework.boot</groupId>
47+
<artifactId>spring-boot-maven-plugin</artifactId>
48+
</plugin>
49+
</plugins>
50+
</build>
51+
52+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
package ${package};
5+
6+
import org.springframework.stereotype.Controller;
7+
import org.springframework.web.bind.annotation.GetMapping;
8+
9+
import javax.servlet.http.HttpServletResponse;
10+
import java.io.IOException;
11+
12+
/**
13+
* Index Controller.
14+
*/
15+
@Controller
16+
public class IndexController {
17+
18+
/**
19+
* Redirect to APIS.
20+
*/
21+
@GetMapping("/")
22+
void index(HttpServletResponse response) throws IOException {
23+
response.sendRedirect("/todos/");
24+
}
25+
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
package ${package};
5+
6+
import org.springframework.boot.SpringApplication;
7+
import org.springframework.boot.autoconfigure.SpringBootApplication;
8+
9+
/**
10+
* Main class to start the Spring Boot application.
11+
*/
12+
@SpringBootApplication
13+
public class SampleSpringApplication {
14+
15+
/**
16+
* Main operation.
17+
*
18+
* @param args
19+
* command line arguments
20+
*/
21+
public static void main(String[] args) {
22+
SpringApplication.run(SampleSpringApplication.class, args);
23+
}
24+
25+
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
package ${package}.todos;
5+
6+
import java.util.UUID;
7+
8+
import org.springframework.data.cassandra.core.mapping.CassandraType;
9+
import org.springframework.data.cassandra.core.mapping.CassandraType.Name;
10+
import org.springframework.data.cassandra.core.mapping.PrimaryKey;
11+
import org.springframework.data.cassandra.core.mapping.Table;
12+
13+
@Table
14+
public class Todos {
15+
16+
@PrimaryKey
17+
@CassandraType(type = Name.UUID)
18+
private UUID uid = UUID.randomUUID();
19+
20+
private String title;
21+
22+
private boolean completed = false;
23+
24+
/**
25+
* Default constructor.
26+
*/
27+
public Todos() {}
28+
29+
/**
30+
* Simple Constructor.
31+
*/
32+
public Todos(String title) {
33+
this.title = title;
34+
}
35+
36+
/**
37+
* Simple Constructor.
38+
*/
39+
public Todos(String title, boolean completed) {
40+
this.title = title;
41+
this.completed = completed;
42+
}
43+
44+
/**
45+
* Getter accessor for attribute 'uid'.
46+
*
47+
* @return
48+
* current value of 'uid'
49+
*/
50+
public UUID getUid() {
51+
return uid;
52+
}
53+
54+
/**
55+
* Setter accessor for attribute 'uid'.
56+
* @param uid
57+
* new value for 'uid '
58+
*/
59+
public void setUid(UUID uid) {
60+
this.uid = uid;
61+
}
62+
63+
/**
64+
* Getter accessor for attribute 'title'.
65+
*
66+
* @return
67+
* current value of 'title'
68+
*/
69+
public String getTitle() {
70+
return title;
71+
}
72+
73+
/**
74+
* Setter accessor for attribute 'title'.
75+
* @param title
76+
* new value for 'title '
77+
*/
78+
public void setTitle(String title) {
79+
this.title = title;
80+
}
81+
82+
/**
83+
* Getter accessor for attribute 'completed'.
84+
*
85+
* @return
86+
* current value of 'completed'
87+
*/
88+
public boolean isCompleted() {
89+
return completed;
90+
}
91+
92+
/**
93+
* Setter accessor for attribute 'completed'.
94+
* @param completed
95+
* new value for 'completed '
96+
*/
97+
public void setCompleted(boolean completed) {
98+
this.completed = completed;
99+
}
100+
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
package ${package}.todos;
5+
6+
import org.springframework.data.cassandra.repository.CassandraRepository;
7+
import org.springframework.stereotype.Repository;
8+
9+
import java.util.UUID;
10+
11+
/**
12+
* Spring Data Repository.
13+
*/
14+
@Repository
15+
public interface TodosRepository extends CassandraRepository<Todos, UUID> {}

0 commit comments

Comments
 (0)