diff --git a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs index a7532b330d56602e0292438bddc951fe243271d3..efbc0c39f3bf4884bd240d1cf222a1c547f31da7 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs @@ -57,8 +57,12 @@ formatter_profile=_Kieker - Profile formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=e org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;org.primefaces;org.eclipse; org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true diff --git a/Kieker.WebGUI/config/quality-config/cs-conf.xml b/Kieker.WebGUI/config/quality-config/cs-conf.xml index ab764d9105b0d05ffb12dd0405c5a5a11287770c..8fea6526b003e30180daa2cd59b8f437da4c97f3 100644 --- a/Kieker.WebGUI/config/quality-config/cs-conf.xml +++ b/Kieker.WebGUI/config/quality-config/cs-conf.xml @@ -630,7 +630,7 @@ <!-- See http://checkstyle.sf.net/config_import.html !--> <module name="ImportOrder"> <property name="option" value="under"/> - <property name="groups" value="java,javax,junit,org,com,kieker"/> + <property name="groups" value="java,javax,junit,org,com,kieker,org.primefaces,org.eclipse"/> <property name="ordered" value="true"/> <property name="separated" value="true"/> <property name="caseSensitive" value="true"/> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java index a4bb6c5b3fd8b6cee087c8fc181fb204d012ee63..f523af34dba2d9d0d794ed6adee0d6cbe9ffbf4f 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ProjectsBean.java @@ -33,7 +33,6 @@ import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import javax.faces.context.FacesContext; -import kieker.analysis.AnalysisController; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.webgui.common.ACManager; import kieker.webgui.common.FSManager; @@ -111,6 +110,15 @@ public final class ProjectsBean { } } + /** + * This method renames the given project. For other threads active on this project it looks like the project has been removed in the meantime. If something goes + * wrong, the user will be informed via the growl-component. + * + * @param projectName + * The old name of the project. + * @param newName + * The new name of the project. + */ public void renameProject(final String projectName, final String newName) { try { FSManager.getInstance().renameProject(projectName, newName); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java index babc86bb64126be3053ec2a44a8499a8c76f84a1..668ebf87fa121f83806f3011d062ea398c43709c 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringBean.java @@ -80,11 +80,11 @@ public class StringBean { * Modifies the given string so that it can be used as an ID. In other words: It removes all space characters. It is usually used to convert the 'address' of an * object into an unique ID. It is not guaranteed that the result will be a valid ID in other cases. * - * @param string + * @param str * The string to be modified. * @return The given string without space characters. */ - public String stringToID(final String string) { - return string.replace(" ", ""); + public String stringToID(final String str) { + return str.replace(" ", ""); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisCockpitProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisCockpitProjectBean.java index 03a616b06a9a1ad866bb3732994f9ea998a61fa7..6cdbd5f21b3b1899c5b6065cd19ff38bcb749890 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisCockpitProjectBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisCockpitProjectBean.java @@ -54,6 +54,9 @@ public class CurrentAnalysisCockpitProjectBean { * This is the name of the stored project. It can be used as an identifier within the FS-Manager */ private String projectName; + /** + * The model containing the information about the dashboard itself. + */ private DashboardModel model; /** @@ -72,10 +75,21 @@ public class CurrentAnalysisCockpitProjectBean { this.model.addColumn(column1); } + /** + * Delivers the model for the dashboard. + * + * @return The stored instance of {@link DashboardModel}. + */ public DashboardModel getModel() { return this.model; } + /** + * Sets the new model for the dashboard. + * + * @param model + * The new dashboard model to be stored in this bean. + */ public void setModel(final DashboardModel model) { this.model = model; } @@ -83,12 +97,12 @@ public class CurrentAnalysisCockpitProjectBean { /** * This method sets the project stored within this bean and returns the new page for the navigation. * - * @param projectName + * @param name * The name of the project. * @return The name of the page for the analysis cockpit. */ - public String setProject(final String projectName) { - this.projectName = projectName; + public String setProject(final String name) { + this.projectName = name; return CurrentAnalysisCockpitProjectBean.PAGE_ANALYSIS_COCKPIT; } @@ -113,6 +127,11 @@ public class CurrentAnalysisCockpitProjectBean { return CurrentAnalysisCockpitProjectBean.PAGE_PROJECT_OVERVIEW; } + /** + * Delivers a list containing all available views by name. + * + * @return All available views. + */ public List<String> getViews() { return FSManager.getInstance().getAllViews(this.projectName); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisControllerProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisControllerProjectBean.java index 6898301958d3704708df63935c57afcedea87131..6dffa03fd7c383a9a5c417a931354271f4309a0d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisControllerProjectBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisControllerProjectBean.java @@ -69,12 +69,12 @@ public class CurrentAnalysisControllerProjectBean { /** * This method sets the project stored within this bean and returns the new page for the navigation. * - * @param projectName + * @param name * The name of the project. * @return The name of the page for the analysis controller. */ - public String setProject(final String projectName) { - this.projectName = projectName; + public String setProject(final String name) { + this.projectName = name; return CurrentAnalysisControllerProjectBean.PAGE_ANALYSIS_CONTROLLER; } @@ -151,18 +151,38 @@ public class CurrentAnalysisControllerProjectBean { return ACManager.getInstance().getAnalysisControllerState(this.projectName) == AnalysisController.STATE.RUNNING; } + /** + * Checks whether the analysis is currently in the ready state. + * + * @return true if and only if the analysis is ready to be started. + */ public boolean isAnalysisReady() { return ACManager.getInstance().getAnalysisControllerState(this.projectName) == AnalysisController.STATE.READY; } + /** + * Checks whether the analysis is not available. + * + * @return true if and only if the analysis is <b>not</b> available. + */ public boolean isAnalysisNotAvailable() { return ACManager.getInstance().getAnalysisControllerState(this.projectName) == null; } + /** + * Checks whether the analysis is currently terminated. + * + * @return true if and only if the analysis has been terminated. + */ public boolean isAnalysisTerminated() { return ACManager.getInstance().getAnalysisControllerState(this.projectName) == AnalysisController.STATE.TERMINATED; } + /** + * Checks whether the analysis is currently in the failed state. + * + * @return true if and only if the analysis has failed. + */ public boolean isAnalysisFailed() { return ACManager.getInstance().getAnalysisControllerState(this.projectName) == AnalysisController.STATE.FAILED; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisViewWorkSpaceProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisViewWorkSpaceProjectBean.java index 0c00c4efb2ad4da2d3405a1a02c046f05ed26dae..b739d7b9be92a4d3a0d1d2f2f5ca62143b269515 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisViewWorkSpaceProjectBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisViewWorkSpaceProjectBean.java @@ -56,12 +56,12 @@ public class CurrentAnalysisViewWorkSpaceProjectBean { /** * This method sets the project stored within this bean and returns the new page for the navigation. * - * @param projectName + * @param name * The name of the project. * @return The name of the page for the analysis view work space. */ - public String setProject(final String projectName) { - this.projectName = projectName; + public String setProject(final String name) { + this.projectName = name; return CurrentAnalysisViewWorkSpaceProjectBean.PAGE_ANALYSIS_VIEW_WORK_SPACE; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java index 827a09661c9431edf9eb07f2cbb2387609a95a3c..694976cf8ea83782fb975332787217061005ee83 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentThemeBean.java @@ -28,8 +28,6 @@ import javax.faces.context.FacesContext; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; -import kieker.webgui.beans.application.ThemeSwitcherBean; - /** * This bean can be used for a single session of a user and stores the currently used theme (look and feel) for this user. Currently the default value being used is * the "glass-x"-theme, if none other value can be find within the diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java index a746fd281f4055684ed7dc53301a7865eaa75bd8..df40ff44169a9f771d5c77ae89cd4c8a8f0d2350 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java @@ -63,11 +63,12 @@ import kieker.webgui.common.PluginFinder; import kieker.webgui.common.exception.LibraryAlreadyExistingException; import kieker.webgui.common.exception.NewerProjectException; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.primefaces.event.FileUploadEvent; import org.primefaces.model.UploadedFile; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + /** * This bean contains the project of the current (session) user for the project work space. * @@ -119,14 +120,34 @@ public final class CurrentWorkSpaceProjectBean { * This list contains the available readers for the current project. */ private final List<Class<AbstractReaderPlugin>> availableReaders = Collections.synchronizedList(new ArrayList<Class<AbstractReaderPlugin>>()); - + /** + * This map contains the mapping between the plugins and the result of their toString-method. + */ private final ConcurrentHashMap<String, MIPlugin> pluginMap = new ConcurrentHashMap<String, MIPlugin>(); + /** + * This map contains the mapping between the ports and the result of their toString-method. + */ private final ConcurrentHashMap<String, MIPort> portMap = new ConcurrentHashMap<String, MIPort>(); + /** + * This map contains the mapping between the repositories and the result of their toString-method. + */ private final ConcurrentHashMap<String, MIRepository> repositoryMap = new ConcurrentHashMap<String, MIRepository>(); + /** + * This field contains the currently selected plugin. + */ private MIPlugin selectedPlugin; + /** + * The currently selected repository. + */ + private MIRepository selectedRepository; + /** + * This list contains the currently available connections between filters. + */ private final List<ConnectionFilterToFilter> filter2filterConnections = new ArrayList<ConnectionFilterToFilter>(); + /** + * This list contains the currently available connections between filters and repositories. + */ private final List<ConnectionFilterToRepository> filter2repositoryConnections = new ArrayList<ConnectionFilterToRepository>(); - private MIRepository selectedRepository; /** * Creates a new instance of this class. @@ -147,16 +168,16 @@ public final class CurrentWorkSpaceProjectBean { /** * This method sets the project stored within this bean and returns the new page for the navigation - depending on the given values. * - * @param project + * @param newProject * The project to be stored within this bean. - * @param projectName + * @param newName * The name of the project. * @return The name of the page for the project work space, if the project has been accepted, '' if it is null. */ - public String setProject(final MIProject project, final String projectName) { + public String setProject(final MIProject newProject, final String newName) { // Remember the given parameters - this.project = project; - this.projectName = projectName; + this.project = newProject; + this.projectName = newName; this.getConnectionsFromProject(); if (this.project != null) { @@ -182,13 +203,19 @@ public final class CurrentWorkSpaceProjectBean { return navigationPage; } + /** + * This method initializes the hash maps of the plugins, the ports and the repositories. The maps are cleaned beforehand. + */ private void intializeHashMaps() { + // Clear all maps this.pluginMap.clear(); this.portMap.clear(); this.repositoryMap.clear(); + // Initialize the plugin map... for (final MIPlugin plugin : this.project.getPlugins()) { this.pluginMap.put(plugin.toString(), plugin); + // ..and the port map for (final MIPort port : plugin.getOutputPorts()) { this.portMap.put(port.toString(), port); } @@ -198,6 +225,7 @@ public final class CurrentWorkSpaceProjectBean { } } } + // Now initialize the repository map for (final MIRepository repository : this.project.getRepositories()) { this.repositoryMap.put(repository.toString(), repository); } @@ -600,15 +628,36 @@ public final class CurrentWorkSpaceProjectBean { } } + /** + * This method delivers the currently selected plugin (or the currently selected repository). If nothing has been selected, null will be returned. + * + * @return The currently selected plugin or repository. + */ public EObject getSelectedPlugin() { - return (this.selectedPlugin != null) ? this.selectedPlugin : this.selectedRepository; + if (this.selectedPlugin != null) { + return this.selectedPlugin; + } else { + return this.selectedRepository; + } } + /** + * This method sets the currently selected plugin. The selected repository is set automatically to null. + * + * @param selectedPlugin + * The new selection. + */ public void setSelectedPlugin(final MIPlugin selectedPlugin) { this.selectedPlugin = selectedPlugin; this.selectedRepository = null; } + /** + * This method sets the currently selected repository. The selected plugin is set automatically to null. + * + * @param selectedRepository + * The new selection. + */ public void setSelectedRepository(final MIRepository selectedRepository) { this.selectedRepository = selectedRepository; this.selectedPlugin = null; @@ -689,10 +738,20 @@ public final class CurrentWorkSpaceProjectBean { return this.filter2filterConnections; } + /** + * Delivers the connections (between filters and repositories) within the current main project. + * + * @return A list containing all available connections. + */ public List<ConnectionFilterToRepository> getRepoConnections() { return this.filter2repositoryConnections; } + /** + * Delivers all available repositories. + * + * @return A list with all repositories within the model. + */ public EList<MIRepository> getRepositories() { return this.project.getRepositories(); } @@ -751,14 +810,35 @@ public final class CurrentWorkSpaceProjectBean { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg)); } + /** + * This method searches a plugin by name (the name should be delivered using the toString-method of the object). + * + * @param string + * The name of the plugin. + * @return The plugin with the given name if it exists, null otherwise. + */ public MIPlugin getPluginByName(final String string) { return this.pluginMap.get(string); } + /** + * This method searches a port by name (the name should be delivered using the toString-method of the object). + * + * @param string + * The name of the port. + * @return The port with the given name if it exists, null otherwise. + */ public MIPort getPortByName(final String string) { return this.portMap.get(string); } + /** + * This method searches a repository by name (the name should be delivered using the toString-method of the object). + * + * @param string + * The name of the repository. + * @return The plugin with the given name if it exists, null otherwise. + */ public MIRepository getRepositoryByName(final String string) { return this.repositoryMap.get(string); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentProjectOverviewBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentProjectOverviewBean.java index f05209e230b5873e209d8acb05fce7ef38c97c33..4a7be8dc5488381190955845365e5dfd6b14b022 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentProjectOverviewBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/view/CurrentProjectOverviewBean.java @@ -24,23 +24,42 @@ import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; /** + * This bean is used in the context of the project overview page. * * @author Nils Christian Ehmke + * @version 1.0 */ @ManagedBean @ViewScoped public class CurrentProjectOverviewBean { + /** + * The name of the "selected" project. + */ private String projectName; + /** + * Default constructor. + */ public CurrentProjectOverviewBean() { // No code necessary } + /** + * Delivers the currently "selected" project name. + * + * @return The name of the project. + */ public String getProjectName() { return this.projectName; } + /** + * Sets the currently "selected" project name. + * + * @param projectName + * The name of the project. + */ public void setProjectName(final String projectName) { this.projectName = projectName; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java index 73ffcaba7284262cac3f545c6561c5e6a99a2771..1052932a5d6601b3959bf6bb5557345bca95ded5 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ACManager.java @@ -39,20 +39,20 @@ import kieker.webgui.common.exception.ProjectStillRunningException; * @author Nils Christian Ehmke * @version 1.0 */ -public class ACManager { +public final class ACManager { /** * This is the maximal time the application will wait for an analysis thread to be terminated. */ private static final long MAX_THREAD_WAIT_TIME_MS = 1000; + /** + * This is the singleton instance of this class. + */ + private static final ACManager INSTANCE = new ACManager(); /** * This list contains the current analysis controllers and their corresponding threads. Not every project does have a controller, but every project can have * maximal one. */ private final ConcurrentHashMap<String, Pair<AnalysisController, Thread>> analysisController = new ConcurrentHashMap<String, Pair<AnalysisController, Thread>>(); - /** - * This is the singleton instance of this class. - */ - private static final ACManager INSTANCE = new ACManager(); /** * Creates a new instance of this class. @@ -168,6 +168,9 @@ public class ACManager { break; case RUNNING: throw new ProjectStillRunningException("The project with the name '" + project + "' is still running."); + default: + // No code necessary + break; } } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ConnectionFilterToRepository.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ConnectionFilterToRepository.java index 604a813f61e638942eecc23be6c5fb867f14e949..1b499a849459bcf631058acbb7753a4c94b6ddb2 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ConnectionFilterToRepository.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ConnectionFilterToRepository.java @@ -52,7 +52,7 @@ public class ConnectionFilterToRepository { * The source filter. * @param destination * The destination repository. - * @param repositoryPort + * @param outputPort * The repository port which will be used from the source. */ public ConnectionFilterToRepository(final MIPlugin source, final MIRepository destination, final MIRepositoryConnector outputPort) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java index 76d8cc66c199e711f1b9fc2b22425de4841b43c0..8855545faba5f77ab3b82f75edbc4c6cb1a99f07 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java @@ -87,14 +87,6 @@ public final class FSManager { * This is the buffer (in bytes) used to copy files. */ private static final int BUF_SIZE_BYTES = 1024; - /** - * This is the factory we will use to create the elements for the projects. - */ - private final MIAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - /** - * This map contains one lock-object for every project (by name). This works at every project name may exist only once. - */ - private final ConcurrentHashMap<String, Object> projectLocksMap = new ConcurrentHashMap<String, Object>(); /** * This is the log object used to log messages, warnings etc. */ @@ -103,6 +95,14 @@ public final class FSManager { * This is the singleton instance of this class. */ private static final FSManager INSTANCE = new FSManager(); + /** + * This is the factory we will use to create the elements for the projects. + */ + private final MIAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); + /** + * This map contains one lock-object for every project (by name). This works at every project name may exist only once. + */ + private final ConcurrentHashMap<String, Object> projectLocksMap = new ConcurrentHashMap<String, Object>(); /** * Creates a new instance of this class. @@ -205,7 +205,7 @@ public final class FSManager { // Load it atomically synchronized (lock) { - return AnalysisController.loadFromFile(kaxFile.getAbsoluteFile());// /kaxFile); + return AnalysisController.loadFromFile(kaxFile.getAbsoluteFile()); // /kaxFile); } } @@ -245,6 +245,18 @@ public final class FSManager { } } + /** + * This method renames a project. In other words: The whole project will be copied and the old one removed (but atomically in respect to both project names). + * + * @param projectName + * The name of the old project. + * @param newName + * The new name of the project. + * @throws IOException + * If something goes wrong during the rename-procedure. + * @throws ProjectAlreadyExistingException + * If a project with the given new name exists already. + */ public void renameProject(final String projectName, final String newName) throws IOException, ProjectAlreadyExistingException { if (projectName.equals(newName)) { throw new ProjectAlreadyExistingException("A project with the name '" + newName + "' exists already."); @@ -256,8 +268,15 @@ public final class FSManager { // We cannot risk just using two synchronized-blocks as such a thing could block the application. We therefore have to sort the locks by name in order to // make sure that two methods would use the same order to access (if project A has to be renamed to B and B has to be renamed to A, we would always // synchronize on A before synchronizing on B). - final Object lockFst = (projectName.compareTo(newName)) < 0 ? lockOld : lockNew; - final Object lockSnd = (projectName.compareTo(newName)) < 0 ? lockNew : lockOld; + final Object lockFst; + final Object lockSnd; + if (projectName.compareTo(newName) < 0) { + lockFst = lockOld; + lockSnd = lockNew; + } else { + lockFst = lockNew; + lockSnd = lockOld; + } // Access the projects atomically synchronized (lockFst) { @@ -274,10 +293,28 @@ public final class FSManager { } } + /** + * This method deletes the project with the given name. + * + * @param projectName + * The name of the project to be removed. + */ private void deleteProject(final String projectName) { // TODO Delete } + /** + * This method copies the given project and saves it under the given name. + * + * @param projectName + * The name of the project to be copied. + * @param newName + * The name of the new project. + * @throws ProjectAlreadyExistingException + * If a project with the given name exists already. + * @throws IOException + * If something goes wrong during the copy procedure. + */ private void copyProject(final String projectName, final String newName) throws ProjectAlreadyExistingException, IOException { if (projectName.equals(newName)) { throw new ProjectAlreadyExistingException("A project with the name '" + newName + "' exists already."); @@ -288,8 +325,15 @@ public final class FSManager { // We cannot risk just using two synchronized-blocks as such a thing could block the application. We therefore have to sort the locks by name in order to // make sure that two methods would use the same order to access. - final Object lockFst = (projectName.compareTo(newName)) < 0 ? lockOld : lockNew; - final Object lockSnd = (projectName.compareTo(newName)) < 0 ? lockNew : lockOld; + final Object lockFst; + final Object lockSnd; + if (projectName.compareTo(newName) < 0) { + lockFst = lockOld; + lockSnd = lockNew; + } else { + lockFst = lockNew; + lockSnd = lockOld; + } // Access the projects atomically synchronized (lockFst) { @@ -304,6 +348,13 @@ public final class FSManager { } } + /** + * Delivers a list with all available views of the given project. + * + * @param project + * The name of the project. + * @return A list with the names of the available views. + */ public List<String> getAllViews(final String project) { final List<String> result = new ArrayList<String>(); @@ -318,6 +369,13 @@ public final class FSManager { return result; } + /** + * Checks whether a project with the name exists on the file system. + * + * @param project + * The name of the project. + * @return true if and only if a directory with the name of the project exists in the root dir. + */ private boolean projectExists(final String project) { // Assemble the path to the given project final String fileName = FSManager.ROOT_DIRECTORY + File.separator + project; @@ -429,8 +487,10 @@ public final class FSManager { int count; // Transfer the file. - while ((count = in.read(buf)) != -1) { + count = in.read(buf); + while (count != -1) { out.write(buf, 0, count); + count = in.read(buf); } } finally { // Try to make sure that the streams will be closed. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotInstantiatedException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotInstantiatedException.java index 6f789155e629c440988e056293c32153bb4807f8..931a4a28bf5ffe31249e0dc06fb4d118ef6a921e 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotInstantiatedException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotInstantiatedException.java @@ -28,6 +28,9 @@ package kieker.webgui.common.exception; */ public class AnalysisNotInstantiatedException extends Exception { + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotRunningException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotRunningException.java index ff9a382394ad06d3c78369d11660ff897a1d68db..78c162ad913a03af2f93b25546bfbe1bdf3cdf38 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotRunningException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisNotRunningException.java @@ -27,7 +27,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class AnalysisNotRunningException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java index 0c9ba7a16ade183d584e904ee615b97c4c6545b8..64e2d7cbc0e8adf87bc8258f73bd99281e3b0d05 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java @@ -27,7 +27,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class LibraryAlreadyExistingException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java index 552be8bd87279bb20ef4c016c7d2d01eeea001a2..4b1280befe27e805ea77fd70416d083a27284d65 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/NewerProjectException.java @@ -28,7 +28,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class NewerProjectException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java index 785740ce2f5d18005874ad0926b2a38552df5d7d..02c2859649698ca42c9a8298725344c21ee83b0f 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java @@ -27,7 +27,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class ProjectAlreadyExistingException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyStartedException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyStartedException.java index 3a76cba6653d3d05625e36ac27bf7a961e73e1a0..24206556cb1034fda48f44d45c805065af337abb 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyStartedException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyStartedException.java @@ -27,7 +27,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class ProjectAlreadyStartedException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /** diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectStillRunningException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectStillRunningException.java index cbd66f2e08cf6b217a14aacea0733a691cd67c43..a29d9468a749f45151abb5e29c5494651ff539a7 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectStillRunningException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectStillRunningException.java @@ -27,7 +27,9 @@ package kieker.webgui.common.exception; * @version 1.0 */ public class ProjectStillRunningException extends Exception { - + /** + * The serial version UID. + */ private static final long serialVersionUID = 1L; /**