01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.poifs.filesystem;
19:
20: /**
21: * This interface provides access to an object managed by a Filesystem
22: * instance. Entry objects are further divided into DocumentEntry and
23: * DirectoryEntry instances.
24: *
25: * @author Marc Johnson (mjohnson at apache dot org)
26: */
27:
28: public interface Entry {
29:
30: /**
31: * get the name of the Entry
32: *
33: * @return name
34: */
35:
36: public String getName();
37:
38: /**
39: * is this a DirectoryEntry?
40: *
41: * @return true if the Entry is a DirectoryEntry, else false
42: */
43:
44: public boolean isDirectoryEntry();
45:
46: /**
47: * is this a DocumentEntry?
48: *
49: * @return true if the Entry is a DocumentEntry, else false
50: */
51:
52: public boolean isDocumentEntry();
53:
54: /**
55: * get this Entry's parent (the DirectoryEntry that owns this
56: * Entry). All Entry objects, except the root Entry, has a parent.
57: *
58: * @return this Entry's parent; null iff this is the root Entry
59: */
60:
61: public DirectoryEntry getParent();
62:
63: /**
64: * Delete this Entry. This operation should succeed, but there are
65: * special circumstances when it will not:
66: *
67: * If this Entry is the root of the Entry tree, it cannot be
68: * deleted, as there is no way to create another one.
69: *
70: * If this Entry is a directory, it cannot be deleted unless it is
71: * empty.
72: *
73: * @return true if the Entry was successfully deleted, else false
74: */
75:
76: public boolean delete();
77:
78: /**
79: * Rename this Entry. This operation will fail if:
80: *
81: * There is a sibling Entry (i.e., an Entry whose parent is the
82: * same as this Entry's parent) with the same name.
83: *
84: * This Entry is the root of the Entry tree. Its name is dictated
85: * by the Filesystem and many not be changed.
86: *
87: * @param newName the new name for this Entry
88: *
89: * @return true if the operation succeeded, else false
90: */
91:
92: public boolean renameTo(final String newName);
93: } // end public interface Entry
|