-
-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1518: Add annotation/prog API support
- Loading branch information
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
.../cpr/src/main/java/org/atmosphere/annotation/BroadcasterCacheListenererviceProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2014 Jeanfrancois Arcand | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.atmosphere.annotation; | ||
|
||
import org.atmosphere.config.AtmosphereAnnotation; | ||
import org.atmosphere.config.service.BroadcasterCacheListenerService; | ||
import org.atmosphere.cpr.AtmosphereFramework; | ||
import org.atmosphere.cpr.BroadcasterCacheListener; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@AtmosphereAnnotation(BroadcasterCacheListenerService.class) | ||
public class BroadcasterCacheListenererviceProcessor implements Processor<BroadcasterCacheListener> { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(BroadcasterCacheListenererviceProcessor.class); | ||
|
||
@Override | ||
public void handle(AtmosphereFramework framework, Class<BroadcasterCacheListener> annotatedClass) { | ||
try { | ||
framework.addBroadcasterCacheListener(framework.newClassInstance(BroadcasterCacheListener.class, annotatedClass)); | ||
} catch (Exception e) { | ||
logger.warn("", e); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
modules/cpr/src/main/java/org/atmosphere/config/service/BroadcasterCacheListenerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2014 Jeanfrancois Arcand | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package org.atmosphere.config.service; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* An annotation for installing {@link org.atmosphere.cpr.BroadcasterListener} | ||
*/ | ||
@Target({ElementType.TYPE}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
public @interface BroadcasterCacheListenerService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters