All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class vnr.server.LocalServer

java.lang.Object
   |
   +----vnr.server.LocalServer

public class LocalServer
extends Object
implements Server, Runnable
Server interface/class for vnrj
A local server stores its info in a properties file.

This class should be broken up into three or more classes:

this class needs to be change to fill the netRexxClasses attribute of the project, rather than the classes and packages attributes

Author:
1997-10-29 dlg created
See Also:
StemProperties

Variable Index

 o BUILD_COMPILING
 o BUILD_ERRORS
 o BUILD_IN_QUEUE
 o BUILD_OK
 o BUILD_WARNINGS
 o buildList
buildList - a vector of builds in progress or complete
 o buildListeners
a vector to hold the listeners for builds
 o projectFile
The file that stores the local server's properties
 o projects
The properties object that gets initialised (loaded) from the file
 o requests
requests - vector of compilation requests.
 o userTable
userTable - a mapping of user names to User objects
 o worker
worker thread - does the builds in the background

Constructor Index

 o LocalServer()
Default constructor - load server's data from properties file

Method Index

 o addBuildListener(BuildListener)
add a listener to the vector of listeners
 o addClassToProject(String, String, String)
add a class to project, e.g.
 o addNewBuildRequest(BuildRequest)
adds a build request to the queue for the worker to process
 o addProjectToCategory(String, String, String)
Add a project to a category for a user.
 o addToBuildList(BuildEvent)
add to build list
 o buildClass(String, Project, NetRexxClass)
build a class & notify all registered buildListeners when done
 o close()
close the server - flush the data to the properties file
 o fireBuildEvent(BuildEvent)
call buildComplete on all listeners in the vector
 o getBuildEventForRequest(BuildRequest)
get build event for request
 o getBuildList()
 o getBuildList(int)
get an item from the build list
 o getEditingFont(String)
getEditingFont - return the default font for editing
 o getHelpPath(String)
get the help path for the user the help path is a list of directories, separated by the platform specific path separator
 o getLookAndFeel(String)
get the look and feel for the user
 o getNextBuildRequest()
gets the next build request from the queue - used by the worker
 o getTabSize(String)
getTabSize - return the number of spaces to expand a tab for
 o getTextForClass(Project, NetRexxClass)
 o getTextForClass(String, String, String, String)
 o getUser(String)
Get detailed info about a user
 o propertyChange(PropertyChangeEvent)
property changes come here.
 o removeBuildListener(BuildListener)
remove a listener from the vector of listeners
 o removeCategoryForUser(String, String)
Remove category from this users list

This involves the following:

 o removeClassFromProject(String, String, String)
remove a class from a project, e.g.
 o removeProjectFromCategory(String, String, String)
Remove a project from a category for a user For a local server, that means updating the following values:
  1. stem username.category.categoryName.projects with value of proj should be removed
  2. remove all entries starting with username.projects.projectName.
     o run()
    Called when the worker thread is created
     o setBuildList(int, BuildEvent)
    set an item in the buildList
     o setBuildList(Vector)
    set the entire build list to a new one
    The build list is a vector of buildEvents
     o setEditingFont(String, Font)
    set editing font
     o setProjectCodeBase(String, String, String)
    set the code base for a project
     o setTabSize(String, int)
    change the tab size
     o setTextForClass(Project, NetRexxClass)
    set the text for a class, one long string, including crs?
     o setTextForClass(String, String, String, String, String)
    set the text for a class, one long string, including crs?
     o updateBuildList(BuildEvent)
    update a build list item
     o validateUser(String, String)
    get number of users, loop through each.

Variables

 o projectFile
 protected String projectFile
The file that stores the local server's properties

 o projects
 protected StemProperties projects
The properties object that gets initialised (loaded) from the file

See Also:
StemProperties
 o buildListeners
 protected Vector buildListeners
a vector to hold the listeners for builds

 o worker
 protected Thread worker
worker thread - does the builds in the background

 o requests
 protected Vector requests
requests - vector of compilation requests. Processed by the worker

 o buildList
 protected Vector buildList
buildList - a vector of builds in progress or complete

 o userTable
 protected Hashtable userTable
userTable - a mapping of user names to User objects

 o BUILD_ERRORS
 public static final int BUILD_ERRORS
 o BUILD_WARNINGS
 public static final int BUILD_WARNINGS
 o BUILD_OK
 public static final int BUILD_OK
 o BUILD_IN_QUEUE
 public static final int BUILD_IN_QUEUE
 o BUILD_COMPILING
 public static final int BUILD_COMPILING

Constructors

 o LocalServer
 public LocalServer()
Default constructor - load server's data from properties file

Methods

 o propertyChange
 public void propertyChange(PropertyChangeEvent pce)
property changes come here. Currently the only property being listened to is a NetRexxClass's text

 o close
 public void close()
close the server - flush the data to the properties file

 o getUser
 public User getUser(String name)
Get detailed info about a user

Returns:
The User object representing the name passed in
See Also:
User
 o validateUser
 public boolean validateUser(String user,
                             String password)
get number of users, loop through each.
if we find the user, and the password matches, they're ok

Parameters:
user - The user name to validate
password - The password to check is ok
Returns:
true if the user exists in the properties, false otherwise
 o removeCategoryForUser
 public boolean removeCategoryForUser(String user,
                                      String category)
Remove category from this users list

This involves the following:

Parameters:
user - The user to remove the category from
category - The category to find and remove
Returns:
validity or success of remove
 o getTextForClass
 public String getTextForClass(Project prj,
                               NetRexxClass nrxClass)
Returns:
The text for the class - one long string, with carriage returns
 o getTextForClass
 public String getTextForClass(String user,
                               String project,
                               String name,
                               String $package)
Returns:
The text for the class - one long string, with carriage returns
 o setTextForClass
 public void setTextForClass(String user,
                             String project,
                             String name,
                             String $package,
                             String code)
set the text for a class, one long string, including crs?

 o setTextForClass
 public void setTextForClass(Project prj,
                             NetRexxClass nrxClass)
set the text for a class, one long string, including crs?

 o addProjectToCategory
 public Project addProjectToCategory(String user,
                                     String cat,
                                     String proj)
Add a project to a category for a user. For a local server, that means updating the following values:
  1. username.category.categoryName.projects should be incremented
  2. add an entry for username.category.categoryName.project.x = ProjectName where x is the new value from the previous step (i.e. after incrementing)

Returns:
a new Project if successful, null if not. The only case where it will be null at the moment is when the project name already exists...
 o removeProjectFromCategory
 public boolean removeProjectFromCategory(String user,
                                          String cat,
                                          String proj)
Remove a project from a category for a user For a local server, that means updating the following values:
  1. stem username.category.categoryName.projects with value of proj should be removed
  2. remove all entries starting with username.projects.projectName.

Parameters:
user - the user that owns the project
cat - the category that holds the project
proj - the project to be removed as a String
Returns:
true/false - a success indicator
See Also:
String, Project
 o addClassToProject
 public boolean addClassToProject(String user,
                                  String projectName,
                                  String className)
add a class to project, e.g. don't allow duplicates and dion.projects.Server.class.0=2 -- should be incremented to 3 dion.projects.Server.class.3.class=LocalServer.nrx -- added dion.projects.Server.class.3.package=vnr.server -- added

Returns:
the success of adding the class as a boolean
 o removeClassFromProject
 public boolean removeClassFromProject(String user,
                                       String projectName,
                                       String className)
remove a class from a project, e.g. dion.projects.Server.class.0=2 -- should be decremented to 1 dion.projects.Server.class.3.class=LocalServer.nrx -- removed dion.projects.Server.class.3.package=vnr.server -- removed

 o setProjectCodeBase
 public void setProjectCodeBase(String user,
                                String projectName,
                                String codeBase)
set the code base for a project

Parameters:
user - the user who is doing development
projectName - The project they are working on
codeBase - The text to change the codebase to
 o getTabSize
 public int getTabSize(String user)
getTabSize - return the number of spaces to expand a tab for

 o setTabSize
 public void setTabSize(String user,
                        int size)
change the tab size

 o getEditingFont
 public Font getEditingFont(String user)
getEditingFont - return the default font for editing

 o setEditingFont
 public void setEditingFont(String user,
                            Font f)
set editing font

 o getLookAndFeel
 public String getLookAndFeel(String user)
get the look and feel for the user

 o getHelpPath
 public String getHelpPath(String user)
get the help path for the user the help path is a list of directories, separated by the platform specific path separator

See Also:
getProperties
 o buildClass
 public void buildClass(String user,
                        Project proj,
                        NetRexxClass nrxClass)
build a class & notify all registered buildListeners when done

Parameters:
user - - the user who requested the build
projectName - - the project which it is being built for
nrxClass - - the NetRexxClass to be built
 o addBuildListener
 public void addBuildListener(BuildListener bl)
add a listener to the vector of listeners

Parameters:
bl - an object that implements the build listener interface
 o removeBuildListener
 public void removeBuildListener(BuildListener bl)
remove a listener from the vector of listeners

Parameters:
bl - a registered listener in the vector
 o fireBuildEvent
 public void fireBuildEvent(BuildEvent be)
call buildComplete on all listeners in the vector

 o run
 public void run()
Called when the worker thread is created

 o addNewBuildRequest
 public synchronized void addNewBuildRequest(BuildRequest req)
adds a build request to the queue for the worker to process

 o getNextBuildRequest
 public synchronized BuildRequest getNextBuildRequest() throws InterruptedException
gets the next build request from the queue - used by the worker

 o setBuildList
 public void setBuildList(Vector bList)
set the entire build list to a new one
The build list is a vector of buildEvents

 o getBuildList
 public Vector getBuildList()
Returns:
the buildList to the caller
 o setBuildList
 public void setBuildList(int index,
                          BuildEvent be)
set an item in the buildList

Parameters:
index - - an int index into the vector
be - - the build event to be placed into the list
 o getBuildList
 public BuildEvent getBuildList(int index)
get an item from the build list

 o updateBuildList
 public void updateBuildList(BuildEvent be)
update a build list item

 o addToBuildList
 public void addToBuildList(BuildEvent be)
add to build list

 o getBuildEventForRequest
 public BuildEvent getBuildEventForRequest(BuildRequest br)
get build event for request


All Packages  Class Hierarchy  This Package  Previous  Next  Index