1   /*
2    * $Id: Named.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.ftp.server;
12  
13  import java.io.IOException;
14  import java.io.InputStream;
15  import java.io.OutputStream;
16  
17  import org.apache.commons.logging.Log;
18  import org.apache.commons.logging.LogFactory;
19  import org.apache.ftpserver.ftplet.FileObject;
20  
21  public abstract class Named implements FileObject 
22  {
23  
24      protected final Log logger = LogFactory.getLog(getClass());
25      private String name;
26      private ServerState state;
27  
28      public Named(String name, ServerState state)
29      {
30          this.name = name;
31          this.state = state;
32          if (logger.isDebugEnabled())
33          {
34              logger.debug("created: " + name);
35          }
36      }
37  
38      public String getFullName()
39      {
40          return name;
41      }
42  
43      public String getShortName()
44      {
45          return name;
46      }
47  
48      public boolean isHidden()
49      {
50          return false;
51      }
52  
53      public boolean isDirectory()
54      {
55          return true;
56      }
57  
58      public boolean doesExist()
59      {
60          return true;
61      }
62  
63      public boolean hasReadPermission()
64      {
65          return true;
66      }
67  
68      public boolean hasWritePermission()
69      {
70          return true;
71      }
72  
73      public boolean hasDeletePermission()
74      {
75          return false;
76      }
77  
78      public String getOwnerName()
79      {
80          return null;
81      }
82  
83      public String getGroupName()
84      {
85          return null;
86      }
87  
88      public int getLinkCount()
89      {
90          return 0;
91      }
92  
93      public long getLastModified()
94      {
95          return 0;
96      }
97  
98      public long getSize()
99      {
100         return 0;
101     }
102 
103     public boolean mkdir()
104     {
105         return false;
106     }
107 
108     public boolean delete()
109     {
110         return false;
111     }
112 
113     public boolean move(FileObject destination)
114     {
115         return false;
116     }
117 
118     protected ServerState getState()
119     {
120         return state;
121     }
122 
123     public OutputStream createOutputStream(long offset) throws IOException
124     {
125         return null;
126     }
127 
128     public InputStream createInputStream(long offset) throws IOException
129     {
130         return null;
131     }
132 
133 }