View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   * 
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.connector.filesystem;
25  
26  import java.io.File;
27  import java.util.Collection;
28  import java.util.Map;
29  import java.util.Set;
30  import org.modeshape.graph.ExecutionContext;
31  import org.modeshape.graph.Location;
32  import org.modeshape.graph.connector.RepositorySourceException;
33  import org.modeshape.graph.property.Name;
34  import org.modeshape.graph.property.Property;
35  
36  /**
37   * A {@link CustomPropertiesFactory} implementation that ignores the "extra" or "custom" properties for 'nt:file', 'nt:folder',
38   * and 'nt:resource' nodes.
39   */
40  public class IgnoreProperties extends BasePropertiesFactory {
41  
42      private static final long serialVersionUID = 1L;
43  
44      /**
45       * Create an instance of this factory.
46       */
47      public IgnoreProperties() {
48      }
49  
50      /**
51       * {@inheritDoc}
52       * 
53       * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#getDirectoryProperties(org.modeshape.graph.ExecutionContext,
54       *      org.modeshape.graph.Location, java.io.File)
55       */
56      @Override
57      public Collection<Property> getDirectoryProperties( ExecutionContext context,
58                                                          Location location,
59                                                          File directory ) {
60          return NO_PROPERTIES_COLLECTION;
61      }
62  
63      /**
64       * {@inheritDoc}
65       * 
66       * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#getFileProperties(org.modeshape.graph.ExecutionContext,
67       *      org.modeshape.graph.Location, java.io.File)
68       */
69      @Override
70      public Collection<Property> getFileProperties( ExecutionContext context,
71                                                     Location location,
72                                                     File file ) {
73          return NO_PROPERTIES_COLLECTION;
74      }
75  
76      /**
77       * {@inheritDoc}
78       * 
79       * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#getResourceProperties(org.modeshape.graph.ExecutionContext,
80       *      org.modeshape.graph.Location, java.io.File, java.lang.String)
81       */
82      @Override
83      public Collection<Property> getResourceProperties( ExecutionContext context,
84                                                         Location location,
85                                                         File file,
86                                                         String mimeType ) {
87          return NO_PROPERTIES_COLLECTION;
88      }
89  
90      /**
91       * {@inheritDoc}
92       * 
93       * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#recordDirectoryProperties(org.modeshape.graph.ExecutionContext,
94       *      java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)
95       */
96      @Override
97      public Set<Name> recordDirectoryProperties( ExecutionContext context,
98                                                  String sourceName,
99                                                  Location location,
100                                                 File file,
101                                                 Map<Name, Property> properties ) throws RepositorySourceException {
102         return NO_NAMES;
103     }
104 
105     /**
106      * {@inheritDoc}
107      * 
108      * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#recordFileProperties(org.modeshape.graph.ExecutionContext,
109      *      java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)
110      */
111     @Override
112     public Set<Name> recordFileProperties( ExecutionContext context,
113                                            String sourceName,
114                                            Location location,
115                                            File file,
116                                            Map<Name, Property> properties ) throws RepositorySourceException {
117         return NO_NAMES;
118     }
119 
120     /**
121      * {@inheritDoc}
122      * 
123      * @see org.modeshape.connector.filesystem.CustomPropertiesFactory#recordResourceProperties(org.modeshape.graph.ExecutionContext,
124      *      java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)
125      */
126     @Override
127     public Set<Name> recordResourceProperties( ExecutionContext context,
128                                                String sourceName,
129                                                Location location,
130                                                File file,
131                                                Map<Name, Property> properties ) throws RepositorySourceException {
132         return NO_NAMES;
133     }
134 }