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:
- The actual Server functionality of loading settings and verify the user
- The Builder function of accepting and tracking build requests
- The BuildWorker whose job it is to actually compile the code
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
-
BUILD_COMPILING
-
-
BUILD_ERRORS
-
-
BUILD_IN_QUEUE
-
-
BUILD_OK
-
-
BUILD_WARNINGS
-
-
buildList
- buildList - a vector of builds in progress or complete
-
buildListeners
- a vector to hold the listeners for builds
-
projectFile
- The file that stores the local server's properties
-
projects
- The properties object that gets initialised (loaded) from the file
-
requests
- requests - vector of compilation requests.
-
userTable
- userTable - a mapping of user names to User objects
-
worker
- worker thread - does the builds in the background
-
LocalServer()
- Default constructor - load server's data from properties file
-
addBuildListener(BuildListener)
- add a listener to the vector of listeners
-
addClassToProject(String, String, String)
- add a class to project, e.g.
-
addNewBuildRequest(BuildRequest)
- adds a build request to the queue for the worker to process
-
addProjectToCategory(String, String, String)
- Add a project to a category for a user.
-
addToBuildList(BuildEvent)
- add to build list
-
buildClass(String, Project, NetRexxClass)
- build a class & notify all registered buildListeners when done
-
close()
- close the server - flush the data to the properties file
-
fireBuildEvent(BuildEvent)
- call buildComplete on all listeners in the vector
-
getBuildEventForRequest(BuildRequest)
- get build event for request
-
getBuildList()
-
-
getBuildList(int)
- get an item from the build list
-
getEditingFont(String)
- getEditingFont - return the default font for editing
-
getHelpPath(String)
- get the help path for the user
the help path is a list of directories, separated by the platform specific path separator
-
getLookAndFeel(String)
- get the look and feel for the user
-
getNextBuildRequest()
- gets the next build request from the queue - used by the worker
-
getTabSize(String)
- getTabSize - return the number of spaces to expand a tab for
-
getTextForClass(Project, NetRexxClass)
-
-
getTextForClass(String, String, String, String)
-
-
getUser(String)
- Get detailed info about a user
-
propertyChange(PropertyChangeEvent)
- property changes come here.
-
removeBuildListener(BuildListener)
- remove a listener from the vector of listeners
-
removeCategoryForUser(String, String)
- Remove category from this users list
This involves the following:
- looping through the categories until found
- When found, shuffling all higher categories down 1
- Removing the last category (it's now a dupe of last-1)
- Remove any associated entries from the properties
- Decrementing and storing the new number of categories
-
removeClassFromProject(String, String, String)
- remove a class from a project, e.g.
-
removeProjectFromCategory(String, String, String)
- Remove a project from a category for a user
For a local server, that means updating the following values:
- stem username.category.categoryName.projects with value of
proj should be removed
- remove all entries starting with username.projects.projectName.
-
run()
- Called when the worker thread is created
-
setBuildList(int, BuildEvent)
- set an item in the buildList
-
setBuildList(Vector)
- set the entire build list to a new one
The build list is a vector of buildEvents
-
setEditingFont(String, Font)
- set editing font
-
setProjectCodeBase(String, String, String)
- set the code base for a project
-
setTabSize(String, int)
- change the tab size
-
setTextForClass(Project, NetRexxClass)
- set the text for a class, one long string, including crs?
-
setTextForClass(String, String, String, String, String)
- set the text for a class, one long string, including crs?
-
updateBuildList(BuildEvent)
- update a build list item
-
validateUser(String, String)
- get number of users, loop through each.
projectFile
protected String projectFile
- The file that stores the local server's properties
projects
protected StemProperties projects
- The properties object that gets initialised (loaded) from the file
- See Also:
- StemProperties
buildListeners
protected Vector buildListeners
- a vector to hold the listeners for builds
worker
protected Thread worker
- worker thread - does the builds in the background
requests
protected Vector requests
- requests - vector of compilation requests. Processed by the worker
buildList
protected Vector buildList
- buildList - a vector of builds in progress or complete
userTable
protected Hashtable userTable
- userTable - a mapping of user names to User objects
BUILD_ERRORS
public static final int BUILD_ERRORS
BUILD_WARNINGS
public static final int BUILD_WARNINGS
BUILD_OK
public static final int BUILD_OK
BUILD_IN_QUEUE
public static final int BUILD_IN_QUEUE
BUILD_COMPILING
public static final int BUILD_COMPILING
LocalServer
public LocalServer()
- Default constructor - load server's data from properties file
propertyChange
public void propertyChange(PropertyChangeEvent pce)
- property changes come here. Currently the only property being listened to is a
NetRexxClass's text
close
public void close()
- close the server - flush the data to the properties file
getUser
public User getUser(String name)
- Get detailed info about a user
- Returns:
- The User object representing the name passed in
- See Also:
- User
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
removeCategoryForUser
public boolean removeCategoryForUser(String user,
String category)
- Remove category from this users list
This involves the following:
- looping through the categories until found
- When found, shuffling all higher categories down 1
- Removing the last category (it's now a dupe of last-1)
- Remove any associated entries from the properties
- Decrementing and storing the new number of categories
- Parameters:
- user - The user to remove the category from
- category - The category to find and remove
- Returns:
- validity or success of remove
getTextForClass
public String getTextForClass(Project prj,
NetRexxClass nrxClass)
- Returns:
- The text for the class - one long string, with carriage returns
getTextForClass
public String getTextForClass(String user,
String project,
String name,
String $package)
- Returns:
- The text for the class - one long string, with carriage returns
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?
setTextForClass
public void setTextForClass(Project prj,
NetRexxClass nrxClass)
- set the text for a class, one long string, including crs?
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:
- username.category.categoryName.projects should be incremented
- 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...
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:
- stem username.category.categoryName.projects with value of
proj should be removed
- 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
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
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
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
getTabSize
public int getTabSize(String user)
- getTabSize - return the number of spaces to expand a tab for
setTabSize
public void setTabSize(String user,
int size)
- change the tab size
getEditingFont
public Font getEditingFont(String user)
- getEditingFont - return the default font for editing
setEditingFont
public void setEditingFont(String user,
Font f)
- set editing font
getLookAndFeel
public String getLookAndFeel(String user)
- get the look and feel for the user
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
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
addBuildListener
public void addBuildListener(BuildListener bl)
- add a listener to the vector of listeners
- Parameters:
- bl - an object that implements the build listener interface
removeBuildListener
public void removeBuildListener(BuildListener bl)
- remove a listener from the vector of listeners
- Parameters:
- bl - a registered listener in the vector
fireBuildEvent
public void fireBuildEvent(BuildEvent be)
- call buildComplete on all listeners in the vector
run
public void run()
- Called when the worker thread is created
addNewBuildRequest
public synchronized void addNewBuildRequest(BuildRequest req)
- adds a build request to the queue for the worker to process
getNextBuildRequest
public synchronized BuildRequest getNextBuildRequest() throws InterruptedException
- gets the next build request from the queue - used by the worker
setBuildList
public void setBuildList(Vector bList)
- set the entire build list to a new one
The build list is a vector of buildEvents
getBuildList
public Vector getBuildList()
- Returns:
- the buildList to the caller
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
getBuildList
public BuildEvent getBuildList(int index)
- get an item from the build list
updateBuildList
public void updateBuildList(BuildEvent be)
- update a build list item
addToBuildList
public void addToBuildList(BuildEvent be)
- add to build list
getBuildEventForRequest
public BuildEvent getBuildEventForRequest(BuildRequest br)
- get build event for request
All Packages Class Hierarchy This Package Previous Next Index