Skip to content

Package: ResourceFileSystemNetBeansPlatform

ResourceFileSystemNetBeansPlatform

nameinstructionbranchcomplexitylinemethod
ResourceFileSystemNetBeansPlatform(FileSystem)
M: 0 C: 19
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
as(As.Type)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
as(Class)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
asMany(As.Type)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
asMany(Class)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createResourceFile(FileObject)
M: 0 C: 26
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
findFileByPath(String)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getRoot()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
maybeAs(As.Type)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
maybeAs(Class)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
7: * %%
8: * Copyright (C) 2011 - 2023 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.frontend.filesystem.impl;
28:
29: import javax.annotation.Nonnull;
30: import java.util.IdentityHashMap;
31: import org.openide.filesystems.FileObject;
32: import org.openide.filesystems.FileSystem;
33: import it.tidalwave.util.As;
34: import it.tidalwave.northernwind.core.model.ResourceFile;
35: import it.tidalwave.northernwind.core.model.ResourceFileSystem;
36: import lombok.RequiredArgsConstructor;
37: import lombok.experimental.Delegate;
38:
39: /***********************************************************************************************************************
40: *
41: * @author Fabrizio Giudici
42: *
43: **********************************************************************************************************************/
44: @RequiredArgsConstructor
45: public class ResourceFileSystemNetBeansPlatform implements ResourceFileSystem
46: {
47: private final IdentityHashMap<FileObject, ResourceFile> delegateLightWeightMap = new IdentityHashMap<>();
48:
49: @Nonnull
50: private final FileSystem fileSystem;
51:
52: @Delegate
53: private final As asSupport = As.forObject(this);
54:
55: @Override @Nonnull
56: public ResourceFile getRoot()
57: {
58: return createResourceFile(fileSystem.getRoot());
59: }
60:
61: @Override @Nonnull
62: public ResourceFile findFileByPath (@Nonnull final String path)
63: {
64: return createResourceFile(fileSystem.findResource(path));
65: }
66:
67: /* package */
68: synchronized ResourceFile createResourceFile (@Nonnull final FileObject fileObject)
69: {
70:• if (fileObject == null)
71: {
72: return null;
73: }
74:
75: var decorator = delegateLightWeightMap.get(fileObject);
76:
77:• if (decorator == null)
78: {
79: decorator = new ResourceFileNetBeansPlatform(this, fileObject);
80: delegateLightWeightMap.put(fileObject, decorator);
81: }
82:
83: return decorator;
84: }
85:
86: // TODO: equals and hashcode
87: }