This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch simple
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git


The following commit(s) were added to refs/heads/simple by this push:
     new cd0eb4a  Update to latest parent pom
cd0eb4a is described below

commit cd0eb4af1bce130ede4eab9faabba6c7e941865c
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Tue Oct 29 22:21:10 2024 -0700

    Update to latest parent pom
---
 .gitignore                                         |  18 +++
 pom.xml                                            | 125 ++++++++++--------
 .../sling/fsprovider/internal/FileMonitor.java     |  63 ++++-----
 .../sling/fsprovider/internal/FsResource.java      |  28 ++--
 .../fsprovider/internal/FsResourceProvider.java    | 145 +++++++++++----------
 5 files changed, 202 insertions(+), 177 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..38f5ca4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,18 @@
+/target
+.idea
+.classpath
+.metadata
+.project
+.settings
+.externalToolBuilders
+maven-eclipse.xml
+*.swp
+*.iml
+*.ipr
+*.iws
+*.bak
+.vlt
+.DS_Store
+jcr.log
+.vscode
+atlassian-ide-plugin.xml
diff --git a/pom.xml b/pom.xml
index cdfdc7d..f3d200b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -21,81 +21,100 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>
-        <artifactId>sling</artifactId>
-        <version>29</version>
+        <artifactId>sling-bundle-parent</artifactId>
+        <version>60</version>
         <relativePath />
     </parent>
 
-    <artifactId>org.apache.sling.fsresource</artifactId>
-    <packaging>bundle</packaging>
-    <version>1.2.2</version>
+    <artifactId>org.apache.sling.fsresource.simple</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
 
-    <name>Apache Sling Filesystem Resource Provider</name>
-    <description>
-        Provides a ResourceProvider implementation supporting filesystem
-        based resources.
-    </description>
+    <name>Apache Sling Simple Filesystem Resource Provider</name>
+    <description>Provides a simple ResourceProvider implementation supporting 
filesystem
+        based resources.</description>
 
     <scm>
-        
<connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.2</connection>
-        
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.fsresource-1.2.2</developerConnection>
-        
<url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.fsresource-1.2.2</url>
+        
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git</connection>
+        
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-fsresource.git</developerConnection>
+        <tag>HEAD</tag>
+        
<url>https://github.com/apache/sling-org-apache-sling-fsresource.git</url>
     </scm>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.sling</groupId>
-                <artifactId>maven-sling-plugin</artifactId>
-                <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>
-            </plugin>
-        </plugins>
-    </build>
+    <properties>
+        <sling.java.version>11</sling.java.version>
+    </properties>
+
     <dependencies>
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.api</artifactId>
-            <version>2.15.0</version>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.framework</artifactId>
+            <version>1.10.0</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.adapter</artifactId>
-            <version>2.0.4</version>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <version>1.5.1</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
+            <version>1.4.1</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>adapter-annotations</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.0.1</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>adapter-annotations</artifactId>
-            <version>1.0.0</version>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.15.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.36</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>sling-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-adapter-metadata</id>
+                        <goals>
+                            <goal>generate-adapter-metadata</goal>
+                        </goals>
+                        <phase>process-classes</phase>
+                        <configuration>
+                            <!-- relying on 
https://issues.apache.org/jira/browse/MNG-5001 until 
https://issues.apache.org/jira/browse/SLING-10022 -->
+                            
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-baseline-maven-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git 
a/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java 
b/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
index 5729b7c..db4f236 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java
@@ -77,8 +77,7 @@ public class FileMonitor extends TimerTask {
             while (!stopped) {
                 try {
                     timer.wait();
-                }
-                catch (InterruptedException e) {
+                } catch (InterruptedException e) {
                     interrupted = true;
                 }
             }
@@ -102,11 +101,11 @@ public class FileMonitor extends TimerTask {
                 return;
             }
         }
-        synchronized ( this ) {
+        synchronized (this) {
             try {
                 // if we don't have an observation reporter, we just skip the 
check
                 final ObservationReporter reporter = 
this.provider.getObservationReporter();
-                if ( reporter != null ) {
+                if (reporter != null) {
                     this.check(this.root, reporter);
                 }
             } catch (Exception e) {
@@ -127,42 +126,36 @@ public class FileMonitor extends TimerTask {
     private void check(final Monitorable monitorable, final 
ObservationReporter reporter) {
         logger.debug("Checking {}", monitorable.file);
         // if the file is non existing, check if it has been readded
-        if ( monitorable.status instanceof NonExistingStatus ) {
-            if ( monitorable.file.exists() ) {
+        if (monitorable.status instanceof NonExistingStatus) {
+            if (monitorable.file.exists()) {
                 // new file and reset status
                 createStatus(monitorable);
-                sendEvents(monitorable,
-                           ChangeType.ADDED,
-                           reporter);
+                sendEvents(monitorable, ChangeType.ADDED, reporter);
             }
         } else {
             // check if the file has been removed
-            if ( !monitorable.file.exists() ) {
+            if (!monitorable.file.exists()) {
                 // removed file and update status
-                sendEvents(monitorable,
-                           ChangeType.REMOVED,
-                           reporter);
+                sendEvents(monitorable, ChangeType.REMOVED, reporter);
                 monitorable.status = NonExistingStatus.SINGLETON;
             } else {
                 // check for changes
-                final FileStatus fs = (FileStatus)monitorable.status;
+                final FileStatus fs = (FileStatus) monitorable.status;
                 boolean changed = false;
-                if ( fs.lastModified < monitorable.file.lastModified() ) {
+                if (fs.lastModified < monitorable.file.lastModified()) {
                     fs.lastModified = monitorable.file.lastModified();
                     // changed
-                    sendEvents(monitorable,
-                               ChangeType.CHANGED,
-                               reporter);
+                    sendEvents(monitorable, ChangeType.CHANGED, reporter);
                     changed = true;
                 }
-                if ( fs instanceof DirStatus ) {
+                if (fs instanceof DirStatus) {
                     // directory
-                    final DirStatus ds = (DirStatus)fs;
-                    for(int i=0; i<ds.children.length; i++) {
+                    final DirStatus ds = (DirStatus) fs;
+                    for (int i = 0; i < ds.children.length; i++) {
                         check(ds.children[i], reporter);
                     }
                     // if the dir changed we have to update
-                    if ( changed ) {
+                    if (changed) {
                         // and now update
                         final File[] files = monitorable.file.listFiles();
                         if (files != null) {
@@ -176,9 +169,8 @@ public class FileMonitor extends TimerTask {
                                     }
                                 }
                                 if (children[i] == null) {
-                                    children[i] = new Monitorable(
-                                        monitorable.path + '/'
-                                            + files[i].getName(), files[i]);
+                                    children[i] =
+                                            new Monitorable(monitorable.path + 
'/' + files[i].getName(), files[i]);
                                     children[i].status = 
NonExistingStatus.SINGLETON;
                                     check(children[i], reporter);
                                 }
@@ -196,13 +188,14 @@ public class FileMonitor extends TimerTask {
     /**
      * Send the event async via the event admin.
      */
-    private void sendEvents(final Monitorable monitorable, final ChangeType 
changeType, final ObservationReporter reporter) {
-        if ( logger.isDebugEnabled() ) {
+    private void sendEvents(
+            final Monitorable monitorable, final ChangeType changeType, final 
ObservationReporter reporter) {
+        if (logger.isDebugEnabled()) {
             logger.debug("Detected change for resource {} : {}", 
monitorable.path, changeType);
         }
 
-        for(final ObserverConfiguration config : 
reporter.getObserverConfigurations()) {
-            if ( config.matches(monitorable.path) ) {
+        for (final ObserverConfiguration config : 
reporter.getObserverConfigurations()) {
+            if (config.matches(monitorable.path)) {
                 final ResourceChange change = new ResourceChange(changeType, 
monitorable.path, false);
                 reporter.reportChanges(config, Collections.singleton(change), 
false);
             }
@@ -213,9 +206,9 @@ public class FileMonitor extends TimerTask {
      * Create a status object for the monitorable
      */
     private static void createStatus(final Monitorable monitorable) {
-        if ( !monitorable.file.exists() ) {
+        if (!monitorable.file.exists()) {
             monitorable.status = NonExistingStatus.SINGLETON;
-        } else if ( monitorable.file.isFile() ) {
+        } else if (monitorable.file.isFile()) {
             monitorable.status = new FileStatus(monitorable.file);
         } else {
             monitorable.status = new DirStatus(monitorable.file, 
monitorable.path);
@@ -225,7 +218,7 @@ public class FileMonitor extends TimerTask {
     /** The monitorable to hold the resource path, the file and the status. */
     private static final class Monitorable {
         public final String path;
-        public final File   file;
+        public final File file;
         public Object status;
 
         public Monitorable(final String path, final File file) {
@@ -237,6 +230,7 @@ public class FileMonitor extends TimerTask {
     /** Status for files. */
     private static class FileStatus {
         public long lastModified;
+
         public FileStatus(final File file) {
             this.lastModified = file.lastModified();
         }
@@ -252,8 +246,7 @@ public class FileMonitor extends TimerTask {
             if (files != null) {
                 this.children = new Monitorable[files.length];
                 for (int i = 0; i < files.length; i++) {
-                    this.children[i] = new Monitorable(path + '/'
-                        + files[i].getName(), files[i]);
+                    this.children[i] = new Monitorable(path + '/' + 
files[i].getName(), files[i]);
                     FileMonitor.createStatus(this.children[i]);
                 }
             } else {
@@ -266,4 +259,4 @@ public class FileMonitor extends TimerTask {
     private static final class NonExistingStatus {
         public static NonExistingStatus SINGLETON = new NonExistingStatus();
     }
-}
\ No newline at end of file
+}
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 502d0ca..0f380ad 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResource.java
@@ -43,10 +43,12 @@ 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)
-})
+@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 {
 
     /**
@@ -110,7 +112,7 @@ public class FsResource extends AbstractResource {
             metaData.setContentLength(file.length());
             metaData.setModificationTime(file.lastModified());
             metaData.setResolutionPath(resourcePath);
-            if ( this.file.isDirectory() ) {
+            if (this.file.isDirectory()) {
                 
metaData.put(FsResourceProvider.RESOURCE_METADATA_FILE_DIRECTORY, Boolean.TRUE);
             }
         }
@@ -139,9 +141,7 @@ public class FsResource extends AbstractResource {
      */
     public String getResourceType() {
         if (resourceType == null) {
-            resourceType = file.isFile()
-                    ? RESOURCE_TYPE_FILE
-                            : RESOURCE_TYPE_FOLDER;
+            resourceType = file.isFile() ? RESOURCE_TYPE_FILE : 
RESOURCE_TYPE_FOLDER;
         }
 
         return resourceType;
@@ -166,15 +166,12 @@ public class FsResource extends AbstractResource {
                 try {
                     return (AdapterType) new FileInputStream(file);
                 } catch (IOException ioe) {
-                    getLog().info(
-                            "adaptTo: Cannot open a stream on the file " + 
file,
-                            ioe);
+                    getLog().info("adaptTo: Cannot open a stream on the file " 
+ file, ioe);
                 }
 
             } else {
 
                 getLog().debug("adaptTo: File {} is not a readable file", 
file);
-
             }
 
         } else if (type == URL.class) {
@@ -182,9 +179,7 @@ public class FsResource extends AbstractResource {
             try {
                 return (AdapterType) file.toURI().toURL();
             } catch (MalformedURLException mue) {
-                getLog().info(
-                        "adaptTo: Cannot convert the file path " + file
-                        + " to an URL", mue);
+                getLog().info("adaptTo: Cannot convert the file path " + file 
+ " to an URL", mue);
             }
 
         } else if (type == ValueMap.class) {
@@ -192,7 +187,7 @@ public class FsResource extends AbstractResource {
             // this resource simulates nt:file/nt:folder behavior by returning 
it as resource type
             // we should simulate the corresponding JCR properties in a value 
map as well
             if (file.exists() && file.canRead()) {
-                Map<String,Object> props = new HashMap<String, Object>();
+                Map<String, Object> props = new HashMap<String, Object>();
                 props.put("jcr:primaryType", getResourceType());
                 props.put("jcr:createdBy", "system");
                 Calendar lastModifed = Calendar.getInstance();
@@ -200,7 +195,6 @@ public class FsResource extends AbstractResource {
                 props.put("jcr:created", lastModifed);
                 return (AdapterType) new ValueMapDecorator(props);
             }
-
         }
 
         return super.adaptTo(type);
diff --git 
a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java 
b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
index 4a32737..db0a2fe 100644
--- a/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
+++ b/src/main/java/org/apache/sling/fsprovider/internal/FsResourceProvider.java
@@ -53,53 +53,59 @@ import 
org.osgi.service.metatype.annotations.ObjectClassDefinition;
  * and the file system path from where files and folders are mapped into the
  * resource (provider.file).
  */
-@Component(name="org.apache.sling.fsprovider.internal.FsResourceProvider",
-           service=ResourceProvider.class,
-           configurationPolicy=ConfigurationPolicy.REQUIRE,
-           property={
-                   Constants.SERVICE_DESCRIPTION + "=Sling Filesystem Resource 
Provider",
-                   Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
-           })
-@Designate(ocd=FsResourceProvider.Config.class, factory=true)
+@Component(
+        name = "org.apache.sling.fsprovider.internal.FsResourceProvider",
+        service = ResourceProvider.class,
+        configurationPolicy = ConfigurationPolicy.REQUIRE,
+        property = {
+            Constants.SERVICE_DESCRIPTION + "=Sling Filesystem Resource 
Provider",
+            Constants.SERVICE_VENDOR + "=The Apache Software Foundation"
+        })
+@Designate(ocd = FsResourceProvider.Config.class, factory = true)
 public class FsResourceProvider extends ResourceProvider<Object> {
-    
+
     /**
      * Resource metadata property set by {@link FsResource} if the underlying 
file reference is a directory.
      */
     static final String RESOURCE_METADATA_FILE_DIRECTORY = 
":org.apache.sling.fsprovider.file.directory";
-    
-    @ObjectClassDefinition(name = "Apache Sling Filesystem Resource Provider",
-            description = "Configure an instance of the filesystem " +
-                          "resource provider in terms of provider root and 
filesystem location")
+
+    @ObjectClassDefinition(
+            name = "Apache Sling Filesystem Resource Provider",
+            description = "Configure an instance of the filesystem "
+                    + "resource provider in terms of provider root and 
filesystem location")
     public @interface Config {
         /**
          * The name of the configuration property providing file system path of
          * files and folders mapped into the resource tree (value is
          * "provider.file").
          */
-        @AttributeDefinition(name = "Filesystem Root",
-                description = "Filesystem directory mapped to the virtual " +
-                        "resource tree. This property must not be an empty 
string. If the path is " +
-                        "relative it is resolved against sling.home or the 
current working directory. " +
-                        "The path may be a file or folder. If the path does 
not address an existing " +
-                        "file or folder, an empty folder is created.")
+        @AttributeDefinition(
+                name = "Filesystem Root",
+                description = "Filesystem directory mapped to the virtual "
+                        + "resource tree. This property must not be an empty 
string. If the path is "
+                        + "relative it is resolved against sling.home or the 
current working directory. "
+                        + "The path may be a file or folder. If the path does 
not address an existing "
+                        + "file or folder, an empty folder is created.")
         String provider_file();
 
         /**
          * The name of the configuration property providing the check interval
          * for file changes (value is "provider.checkinterval").
          */
-        @AttributeDefinition(name = "Check Interval",
-                             description = "If the interval has a value higher 
than 100, the provider will " +
-             "check the file system for changes periodically. This interval 
defines the period in milliseconds " +
-             "(the default is 1000). If a change is detected, resource events 
are sent through the event admin.")
+        @AttributeDefinition(
+                name = "Check Interval",
+                description =
+                        "If the interval has a value higher than 100, the 
provider will "
+                                + "check the file system for changes 
periodically. This interval defines the period in milliseconds "
+                                + "(the default is 1000). If a change is 
detected, resource events are sent through the event admin.")
         long provider_checkinterval() default 1000;
 
-        @AttributeDefinition(name = "Provider Root",
-                description = "Location in the virtual resource tree where the 
" +
-                "filesystem resources are mapped in. This property must not be 
an empty string.")
+        @AttributeDefinition(
+                name = "Provider Root",
+                description = "Location in the virtual resource tree where the 
"
+                        + "filesystem resources are mapped in. This property 
must not be an empty string.")
         String provider_root();
-        
+
         /**
          * Internal Name hint for web console.
          */
@@ -127,26 +133,26 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
      * to access the file or folder. If no such file or folder exists, this
      * method returns <code>null</code>.
      */
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-       @Override
-    public Resource getResource(final ResolveContext<Object> ctx,
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Override
+    public Resource getResource(
+            final ResolveContext<Object> ctx,
             final String path,
             final ResourceContext resourceContext,
             final Resource parent) {
         Resource rsrc = getResource(ctx.getResourceResolver(), path, 
getFile(path));
         // make sure directory resources from parent resource provider have 
higher precedence than from this provider
         // this allows properties like sling:resourceSuperType to take effect
-        if ( rsrc == null || 
rsrc.getResourceMetadata().containsKey(RESOURCE_METADATA_FILE_DIRECTORY) ) {
-               // get resource from shadowed provider
-               final ResourceProvider rp = ctx.getParentResourceProvider();
-               if ( rp != null ) {
-                   Resource resourceFromParentResourceProvider = 
rp.getResource((ResolveContext)ctx.getParentResolveContext(), 
-                               path, 
-                               resourceContext, parent);
-                   if (resourceFromParentResourceProvider != null) {
-                       rsrc = resourceFromParentResourceProvider;
-                   }
-               }               
+        if (rsrc == null || 
rsrc.getResourceMetadata().containsKey(RESOURCE_METADATA_FILE_DIRECTORY)) {
+            // get resource from shadowed provider
+            final ResourceProvider rp = ctx.getParentResourceProvider();
+            if (rp != null) {
+                Resource resourceFromParentResourceProvider =
+                        rp.getResource((ResolveContext) 
ctx.getParentResolveContext(), path, resourceContext, parent);
+                if (resourceFromParentResourceProvider != null) {
+                    rsrc = resourceFromParentResourceProvider;
+                }
+            }
         }
         return rsrc;
     }
@@ -154,6 +160,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
     /**
      * Returns an iterator of resources.
      */
+    @SuppressWarnings("unchecked")
     @Override
     public Iterator<Resource> listChildren(final ResolveContext<Object> ctx, 
final Resource parent) {
         File parentFile = parent.adaptTo(File.class);
@@ -174,9 +181,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
                 if (providerRoot.startsWith(parentPath)) {
                     String relPath = 
providerRoot.substring(parentPath.length());
                     if (relPath.indexOf('/') < 0) {
-                        Resource res = getResource(
-                                parent.getResourceResolver(), providerRoot,
-                                providerFile);
+                        Resource res = 
getResource(parent.getResourceResolver(), providerRoot, providerFile);
                         if (res != null) {
                             return Collections.singletonList(res).iterator();
                         }
@@ -188,14 +193,15 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
             }
         }
 
-       // get children from from shadowed provider
-       final ResourceProvider rp = ctx.getParentResourceProvider();
-       final Iterator<Resource> parentChildrenIterator;
-       if ( rp != null ) {
-               parentChildrenIterator = 
rp.listChildren(ctx.getParentResolveContext(), parent);
-       } else {
-               parentChildrenIterator = null;
-       }
+        // get children from from shadowed provider
+        @SuppressWarnings("rawtypes")
+        final ResourceProvider rp = ctx.getParentResourceProvider();
+        final Iterator<Resource> parentChildrenIterator;
+        if (rp != null) {
+            parentChildrenIterator = 
rp.listChildren(ctx.getParentResolveContext(), parent);
+        } else {
+            parentChildrenIterator = null;
+        }
         final File[] children = parentFile.listFiles();
 
         final ResourceResolver resolver = ctx.getResourceResolver();
@@ -235,18 +241,18 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
                     String path = parentPath + "/" + file.getName();
                     Resource result = getResource(resolver, path, file);
                     if (result != null) {
-                       names.add(file.getName());
+                        names.add(file.getName());
                         return result;
                     }
                 }
-                if ( parentChildrenIterator != null ) {
-                       while ( parentChildrenIterator.hasNext() ) {
-                               final Resource result = 
parentChildrenIterator.next();
-                               if ( !names.contains(result.getName()) ) {
-                                       names.add(result.getName());
-                                       return result;
-                               }
-                       }
+                if (parentChildrenIterator != null) {
+                    while (parentChildrenIterator.hasNext()) {
+                        final Resource result = parentChildrenIterator.next();
+                        if (!names.contains(result.getName())) {
+                            names.add(result.getName());
+                            return result;
+                        }
+                    }
                 }
                 // nothing found any more
                 return null;
@@ -271,14 +277,14 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
         this.providerRootPrefix = providerRoot.concat("/");
         this.providerFile = getProviderFile(providerFileName, bundleContext);
         // start background monitor if check interval is higher than 100
-        if ( config.provider_checkinterval() > 100 ) {
+        if (config.provider_checkinterval() > 100) {
             this.monitor = new FileMonitor(this, 
config.provider_checkinterval());
         }
     }
 
     @Deactivate
     protected void deactivate() {
-        if ( this.monitor != null ) {
+        if (this.monitor != null) {
             this.monitor.stop();
             this.monitor = null;
         }
@@ -297,8 +303,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
 
     // ---------- internal
 
-    private File getProviderFile(String providerFileName,
-            BundleContext bundleContext) {
+    private File getProviderFile(String providerFileName, BundleContext 
bundleContext) {
 
         // the file object from the plain name
         File providerFile = new File(providerFileName);
@@ -317,8 +322,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
 
         // if the provider file does not exist, create an empty new folder
         if (!providerFile.exists() && !providerFile.mkdirs()) {
-            throw new IllegalArgumentException(
-                    "Cannot create provider file root " + providerFile);
+            throw new IllegalArgumentException("Cannot create provider file 
root " + providerFile);
         }
 
         return providerFile;
@@ -345,9 +349,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
         return null;
     }
 
-    private Resource getResource(final ResourceResolver resolver,
-            final String resourcePath, 
-            final File file) {
+    private Resource getResource(final ResourceResolver resolver, final String 
resourcePath, final File file) {
 
         if (file != null) {
 
@@ -356,7 +358,6 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
             if (file.exists()) {
                 return new FsResource(resolver, resourcePath, file);
             }
-
         }
 
         // not applicable or not an existing file path
@@ -365,7 +366,7 @@ public class FsResourceProvider extends 
ResourceProvider<Object> {
 
     public ObservationReporter getObservationReporter() {
         final ProviderContext ctx = this.getProviderContext();
-        if ( ctx != null ) {
+        if (ctx != null) {
             return ctx.getObservationReporter();
         }
         return null;

Reply via email to