You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:36:11 UTC
[sling-org-apache-sling-fsresource] 08/22: SLING-2312 - adding
adapter annotations for fsresource bundle
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.fsresource-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git
commit 0aba830472a199260c9d02080b52a7b23fcccebc
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Dec 2 02:56:26 2011 +0000
SLING-2312 - adding adapter annotations for fsresource bundle
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/fsresource@1209340 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 20 ++++++++++++++++++++
.../apache/sling/fsprovider/internal/FsResource.java | 6 ++++++
2 files changed, 26 insertions(+)
diff --git a/pom.xml b/pom.xml
index 4087624..1b2ad51 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,20 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>maven-sling-plugin</artifactId>
+ <version>2.0.7-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-adapter-metadata</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>generate-adapter-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -104,5 +118,11 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>adapter-annotations</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java b/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
index 6b1bfee..8ddb7cc 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
@@ -25,6 +25,8 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import org.apache.sling.adapter.annotations.Adaptable;
+import org.apache.sling.adapter.annotations.Adapter;
import org.apache.sling.api.resource.AbstractResource;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceMetadata;
@@ -36,6 +38,10 @@ import org.slf4j.LoggerFactory;
* The <code>FsResource</code> represents a file system file or folder as
* a Sling Resource.
*/
+@Adaptable(adaptableClass=Resource.class, adapters={
+ @Adapter({File.class, URL.class}),
+ @Adapter(condition="If the resource is an FsResource and is a readable file.", value=InputStream.class)
+})
public class FsResource extends AbstractResource implements Resource {
/**
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.