Skip to content

Commit c1959eb

Browse files
committed
Removed @service annotation, and the need for it. Now @Inject can be used alone.
1 parent 1201dd7 commit c1959eb

35 files changed

+351
-477
lines changed

container-api/src/main/java/org/jboss/forge/container/services/Remote.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
import java.lang.annotation.RetentionPolicy;
1313
import java.lang.annotation.Target;
1414

15+
import javax.inject.Inject;
16+
1517
/**
16-
* Marker that indicates when a type should be exported to other containers. It may be imported via the corresponding
17-
* {@link Service} annotation.
18+
* Specifies that the target type should be exported to dependent containers, and that it may be imported via
19+
* {@link Inject} annotation.
1820
*
1921
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
2022
*/
2123
@Documented
2224
@Retention(RetentionPolicy.RUNTIME)
23-
@Target(ElementType.TYPE)
25+
@Target({ ElementType.TYPE })
2426
public @interface Remote
2527
{
26-
boolean service() default true;
2728
}

container-api/src/main/java/org/jboss/forge/container/services/Service.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

container-tests/src/main/java/org/example/consuming/ConsumingService.java renamed to container-tests/src/main/java/org/example/ConsumingService.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
package org.example.consuming;
1+
package org.example;
22

33
import javax.inject.Inject;
44

5-
import org.example.published.PublishedService;
65
import org.jboss.forge.container.services.Remote;
7-
import org.jboss.forge.container.services.Service;
86

97
@Remote
108
public class ConsumingService
119
{
1210
@Inject
13-
@Service
14-
private PublishedService service;
11+
private PublisherService service;
1512

1613
public String getMessage()
1714
{

container-tests/src/main/java/org/example/simple/SimpleService.java renamed to container-tests/src/main/java/org/example/LifecycleListenerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.example.simple;
1+
package org.example;
22

33
import java.io.IOException;
44

@@ -16,7 +16,7 @@
1616
*/
1717
@Remote
1818
@Singleton
19-
public class SimpleService
19+
public class LifecycleListenerService
2020
{
2121
private boolean startupObserved;
2222
private boolean postStartupObserved;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package org.example;
2+
3+
import java.io.IOException;
4+
5+
import javax.enterprise.event.Observes;
6+
import javax.inject.Singleton;
7+
8+
import org.jboss.forge.container.event.PostStartup;
9+
import org.jboss.forge.container.event.PreShutdown;
10+
import org.jboss.forge.container.event.Shutdown;
11+
import org.jboss.forge.container.event.Startup;
12+
13+
/**
14+
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
15+
*/
16+
@Singleton
17+
public class NonService
18+
{
19+
private boolean startupObserved;
20+
private boolean postStartupObserved;
21+
private boolean preShutdownObserved;
22+
private boolean shutdownObserved;
23+
24+
public void startup(@Observes Startup event) throws IOException
25+
{
26+
startupObserved = true;
27+
}
28+
29+
public void postStartup(@Observes PostStartup event) throws IOException
30+
{
31+
postStartupObserved = true;
32+
}
33+
34+
public void preShutdown(@Observes PreShutdown event)
35+
{
36+
preShutdownObserved = true;
37+
}
38+
39+
public void shutdown(@Observes Shutdown event) throws IOException
40+
{
41+
shutdownObserved = true;
42+
}
43+
44+
public boolean isStartupObserved()
45+
{
46+
return startupObserved;
47+
}
48+
49+
public boolean isPostStartupObserved()
50+
{
51+
return postStartupObserved;
52+
}
53+
54+
public boolean isPreShutdownObserved()
55+
{
56+
return preShutdownObserved;
57+
}
58+
59+
public boolean isShutdownObserved()
60+
{
61+
return shutdownObserved;
62+
}
63+
64+
}

container-tests/src/main/java/org/example/published/PublishedService.java renamed to container-tests/src/main/java/org/example/PublisherService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.example.published;
1+
package org.example;
22

33
import javax.inject.Singleton;
44

@@ -9,7 +9,7 @@
99
*/
1010
@Remote
1111
@Singleton
12-
public class PublishedService
12+
public class PublisherService
1313
{
1414
public String getMessage()
1515
{

container-tests/src/test/java/org/jboss/forge/container/LocalServicesImproperAccessTest.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

container-tests/src/test/java/org/jboss/forge/container/LocalServicesTest.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

container-tests/src/test/java/org/jboss/forge/container/RemoteService.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

container-tests/src/test/java/org/jboss/forge/container/RemoteServicesImproperInjectionTest.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)