com.enderak.procol.server.model
Class ProColServerProject

java.lang.Object
  |
  +--java.util.Observable
        |
        +--com.enderak.procol.common.util.EnhancedObservable
              |
              +--com.enderak.procol.common.model.ProColProject
                    |
                    +--com.enderak.procol.server.model.ProColServerProject

public class ProColServerProject
extends ProColProject

The project model for the ProColServer

Author:
Justin Dieters

Field Summary
 java.util.Vector connectionList
          the list of connections that have this project open
 
Fields inherited from class com.enderak.procol.common.model.ProColProject
downloadingFiles, j, name, NUM_VERSIONS, projectDir, projectFilesDir, projectFilesRootNode, projectFilesURI, projectURI
 
Constructor Summary
ProColServerProject(java.net.URI projectRootIn, java.lang.String name, boolean loadFilesNow)
          Constructor for the ProColServerProject
 
Method Summary
 void addConnection(ServerConnection connectionIn)
          Adds a Connection to the project
 int addDownloadFile(byte[] infoIn, java.lang.String userNameIn)
          Adds a file to be downloaded to the download list
 int checkIn(java.net.URI fileURI, ProColUser user)
          Checks in a file
 void closeAllConnections()
          closes all connections associated with this project
 int deleteFile(java.net.URI fileURI)
          deletes a file from the disk
 java.util.Vector getAllowedUsers()
          Gets the users allowed access to this project
 java.net.URI getBugListURI()
          Gets the URI for the bug list
 java.net.URI getCalendarURI()
          Gets the URI for the calendar list
 ServerConnection getConnectionFor(java.lang.String user)
          Returns the connection for a certain user
 java.util.Vector getConnections()
          Returns the open connections associated with this project
 int getOptimalStringBufferSize(javax.swing.tree.DefaultMutableTreeNode rootNode)
          Quickly gets the optimal Stringbuffer size for a tree when sending file info
Due to using leafs instead of children of rootNode, this only really works right for a complete tree
Need to fix to work with subtree
 java.net.URI getPrivateMessagesURI()
          Gets the URI for the private messages directory
 java.lang.String getProjectDescription()
          Gets the description for this project
 java.net.URI getPublicMessagesURI()
          Gets the URI for the public messages list
 java.net.URI getTodoListURI()
          Gets the URI for the todo list
 java.util.Vector getUserList()
          Gets the userList attribute of the ProColServer class
 void loadFiles()
          Loads the files for this project
 int moveFile(java.net.URI sourceURI, java.net.URI destURI)
          moves a file on the disk
 int newFile(java.net.URI fileURI, boolean isDirectory)
          creates a new file or directory
 void removeConnection(ServerConnection connectionIn)
          Removes a Connection to the project
 void unloadFiles()
          unloads the files for this project
 int writeFile(java.lang.String filePath, byte[] dataIn, java.lang.String userName)
          writes a file to the disk, overrides write(byte[]) from com.enderak.procol.common.model.ProColProject to do backups, etc
 
Methods inherited from class com.enderak.procol.common.model.ProColProject
createFile, createFile, getFileInTree, getFileInTree, getName, getNodeForFile, getNodeForFile, getProjectFilesRootNode, getProjectFilesURI, getProjectURI, printTree, writeFile
 
Methods inherited from class com.enderak.procol.common.util.EnhancedObservable
forceNotify, forceNotify
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionList

public java.util.Vector connectionList
the list of connections that have this project open

Constructor Detail

ProColServerProject

public ProColServerProject(java.net.URI projectRootIn,
                           java.lang.String name,
                           boolean loadFilesNow)
Constructor for the ProColServerProject

Parameters:
projectRootIn - The root URI
loadFilesNow - true if files should be loaded now, or false if loading should be deferred
name - The name of this project
Method Detail

loadFiles

public final void loadFiles()
Loads the files for this project


checkIn

public int checkIn(java.net.URI fileURI,
                   ProColUser user)
Checks in a file

Parameters:
fileURI - The URI for the file to check in
user - The user checking in the file
Returns:
The result to send back to the client

addConnection

public void addConnection(ServerConnection connectionIn)
Adds a Connection to the project

Parameters:
connectionIn - The Connection to add

removeConnection

public void removeConnection(ServerConnection connectionIn)
Removes a Connection to the project

Parameters:
connectionIn - The Connection to remove

closeAllConnections

public void closeAllConnections()
closes all connections associated with this project


getUserList

public java.util.Vector getUserList()
Gets the userList attribute of the ProColServer class

Returns:
The userList value

getProjectDescription

public java.lang.String getProjectDescription()
Gets the description for this project

Returns:
The description from the project properties

getOptimalStringBufferSize

public int getOptimalStringBufferSize(javax.swing.tree.DefaultMutableTreeNode rootNode)
Quickly gets the optimal Stringbuffer size for a tree when sending file info
Due to using leafs instead of children of rootNode, this only really works right for a complete tree
Need to fix to work with subtree

Parameters:
rootNode - Description of the Parameter
Returns:
the size

getConnectionFor

public ServerConnection getConnectionFor(java.lang.String user)
Returns the connection for a certain user

Parameters:
user - The user name
Returns:
The ServerConnection associated with the user, or null of user not connected

getConnections

public java.util.Vector getConnections()
Returns the open connections associated with this project

Returns:
The Vector of connections

getAllowedUsers

public java.util.Vector getAllowedUsers()
Gets the users allowed access to this project

Returns:
Vector containing the user names

getPrivateMessagesURI

public java.net.URI getPrivateMessagesURI()
Gets the URI for the private messages directory

Returns:
the URI

getPublicMessagesURI

public java.net.URI getPublicMessagesURI()
Gets the URI for the public messages list

Returns:
the URI

getTodoListURI

public java.net.URI getTodoListURI()
Gets the URI for the todo list

Returns:
the URI

getBugListURI

public java.net.URI getBugListURI()
Gets the URI for the bug list

Returns:
the URI

getCalendarURI

public java.net.URI getCalendarURI()
Gets the URI for the calendar list

Returns:
the URI

addDownloadFile

public int addDownloadFile(byte[] infoIn,
                           java.lang.String userNameIn)
Adds a file to be downloaded to the download list

Parameters:
infoIn - file info from the client - version, changelog, etc
userNameIn - user uploading the file
Returns:
reply code to client

writeFile

public int writeFile(java.lang.String filePath,
                     byte[] dataIn,
                     java.lang.String userName)
writes a file to the disk, overrides write(byte[]) from com.enderak.procol.common.model.ProColProject to do backups, etc

Parameters:
dataIn - The file data
filePath - the file's path
userName - user uploading the file
Returns:
reply code to client

deleteFile

public int deleteFile(java.net.URI fileURI)
deletes a file from the disk

Parameters:
fileURI - the file to delete
Returns:
reply code to client

moveFile

public int moveFile(java.net.URI sourceURI,
                    java.net.URI destURI)
moves a file on the disk

Parameters:
sourceURI - the source file
destURI - the destination file
Returns:
reply code to client

newFile

public int newFile(java.net.URI fileURI,
                   boolean isDirectory)
creates a new file or directory

Parameters:
fileURI - The file to create
isDirectory - True if file to create is a directory, false if a file
Returns:
reply code to client

unloadFiles

public void unloadFiles()
unloads the files for this project