Skip to content
Snippets Groups Projects
Commit d548f719 authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Javadoc comments; Refactoring; Added some tests

parent 72a60d28
No related branches found
No related tags found
No related merge requests found
Showing
with 191 additions and 50 deletions
...@@ -11,12 +11,7 @@ ...@@ -11,12 +11,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" path="src/test/java"/>
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
......
...@@ -220,10 +220,25 @@ public final class ClassAndMethodContainer { ...@@ -220,10 +220,25 @@ public final class ClassAndMethodContainer {
* This is the loadFromFile(File)-method of the class equivalence of {@link AnalysisController}. * This is the loadFromFile(File)-method of the class equivalence of {@link AnalysisController}.
*/ */
private final Method analysisControllerLoadFromFile; private final Method analysisControllerLoadFromFile;
/**
* This is the description()-method of the class equivalence of {@link Display}.
*/
private final Method displayDescriptionMethod; private final Method displayDescriptionMethod;
/**
* This is the dependencies()-method of the class equivalence of {@link Plugin}.
*/
private final Method pluginDependenciesMethod; private final Method pluginDependenciesMethod;
/**
* This is the dependencies()-method of the class equivalence of {@link Repository}.
*/
private final Method repositoryDependenciesMethod; private final Method repositoryDependenciesMethod;
/**
* This is the programmaticOnly()-method of the class equivalence of {@link Plugin}.
*/
private final Method pluginProgrammaticOnlyMethod; private final Method pluginProgrammaticOnlyMethod;
/**
* This is the programmaticOnly()-method of the class equivalence of {@link Repository}.
*/
private final Method repositoryProgrammaticOnlyMethod; private final Method repositoryProgrammaticOnlyMethod;
private final Method logImplWebguiLoggingClassGetEntriesMethod; private final Method logImplWebguiLoggingClassGetEntriesMethod;
...@@ -313,15 +328,19 @@ public final class ClassAndMethodContainer { ...@@ -313,15 +328,19 @@ public final class ClassAndMethodContainer {
// Now the constructors // Now the constructors
this.analysisControllerThreadConstructor = this.analysisControllerThreadClass.getConstructor(this.analysisControllerClass); this.analysisControllerThreadConstructor = this.analysisControllerThreadClass.getConstructor(this.analysisControllerClass);
} catch (final ClassNotFoundException ex) { } catch (final ClassNotFoundException ex) {
// Something went wrong. We can do nothing except throwing an exception
ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
} catch (final NoSuchMethodException ex) { } catch (final NoSuchMethodException ex) {
// Something went wrong. We can do nothing except throwing an exception
ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
} catch (final SecurityException ex) { } catch (final SecurityException ex) {
// Something went wrong. We can do nothing except throwing an exception
ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
} catch (final ClassCastException ex) { } catch (final ClassCastException ex) {
// Something went wrong. We can do nothing except throwing an exception
ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); ClassAndMethodContainer.LOG.error(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex); throw new ProjectLoadException(ClassAndMethodContainer.MSG_LOAD_EXCEPTION, ex);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.webgui.common; package kieker.webgui.domain;
import java.util.List; import java.util.List;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.webgui.common; package kieker.webgui.domain;
/** /**
* This is the interface for component containers of different types (plugins and repositories). It exists to have a common base for the implementing classes. * This is the interface for component containers of different types (plugins and repositories). It exists to have a common base for the implementing classes.
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.webgui.common; package kieker.webgui.domain;
import java.util.Map; import java.util.Map;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.webgui.common; package kieker.webgui.domain;
import java.util.Map; import java.util.Map;
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
***************************************************************************/ ***************************************************************************/
/** /**
* This package contains domain specific classes.
*
* @author Nils Christian Ehmke * @author Nils Christian Ehmke
*/ */
package kieker.webgui.domain; package kieker.webgui.domain;
\ No newline at end of file
...@@ -25,10 +25,10 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -25,10 +25,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIProject;
import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.ClassAndMethodContainer;
import kieker.webgui.common.ComponentListContainer;
import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.NewerProjectException;
import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectAlreadyExistingException;
import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.common.exception.ProjectNotExistingException;
import kieker.webgui.domain.ComponentListContainer;
import org.primefaces.model.UploadedFile; import org.primefaces.model.UploadedFile;
......
...@@ -27,7 +27,6 @@ import javax.sql.DataSource; ...@@ -27,7 +27,6 @@ import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import kieker.common.logging.Log; import kieker.common.logging.Log;
...@@ -64,7 +63,6 @@ public class DerbyUserDAOImpl implements IUserDAO { ...@@ -64,7 +63,6 @@ public class DerbyUserDAOImpl implements IUserDAO {
* @see kieker.webgui.persistence.IserDAO#addUser(user) * @see kieker.webgui.persistence.IserDAO#addUser(user)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void addUser(final User user) throws DataAccessException { public void addUser(final User user) throws DataAccessException {
final Connection connection = DataSourceUtils.getConnection(this.dataSource); final Connection connection = DataSourceUtils.getConnection(this.dataSource);
PreparedStatement userCmd = null; PreparedStatement userCmd = null;
...@@ -108,7 +106,6 @@ public class DerbyUserDAOImpl implements IUserDAO { ...@@ -108,7 +106,6 @@ public class DerbyUserDAOImpl implements IUserDAO {
* @see kieker.webgui.persistence.IserDAO#deleteUser(user) * @see kieker.webgui.persistence.IserDAO#deleteUser(user)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void deleteUser(final User user) throws DataAccessException { public void deleteUser(final User user) throws DataAccessException {
final Connection connection = DataSourceUtils.getConnection(this.dataSource); final Connection connection = DataSourceUtils.getConnection(this.dataSource);
PreparedStatement delCmd = null; PreparedStatement delCmd = null;
...@@ -145,7 +142,6 @@ public class DerbyUserDAOImpl implements IUserDAO { ...@@ -145,7 +142,6 @@ public class DerbyUserDAOImpl implements IUserDAO {
* @see kieker.webgui.persistence.IserDAO#editUser(user) * @see kieker.webgui.persistence.IserDAO#editUser(user)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void editUser(final User user) throws DataAccessException { public void editUser(final User user) throws DataAccessException {
final Connection connection = DataSourceUtils.getConnection(this.dataSource); final Connection connection = DataSourceUtils.getConnection(this.dataSource);
PreparedStatement updateCmd = null; PreparedStatement updateCmd = null;
...@@ -196,7 +192,6 @@ public class DerbyUserDAOImpl implements IUserDAO { ...@@ -196,7 +192,6 @@ public class DerbyUserDAOImpl implements IUserDAO {
* @see List<User> kieker.webgui.persistence.getUsers() * @see List<User> kieker.webgui.persistence.getUsers()
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public List<User> getUsers() throws DataAccessException { public List<User> getUsers() throws DataAccessException {
final Connection connection = DataSourceUtils.getConnection(this.dataSource); final Connection connection = DataSourceUtils.getConnection(this.dataSource);
final List<User> result = new ArrayList<User>(); final List<User> result = new ArrayList<User>();
......
...@@ -73,13 +73,13 @@ import kieker.analysis.repository.AbstractRepository; ...@@ -73,13 +73,13 @@ import kieker.analysis.repository.AbstractRepository;
import kieker.common.logging.Log; import kieker.common.logging.Log;
import kieker.common.logging.LogFactory; import kieker.common.logging.LogFactory;
import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.ClassAndMethodContainer;
import kieker.webgui.common.ComponentListContainer;
import kieker.webgui.common.PluginContainer;
import kieker.webgui.common.RepositoryContainer;
import kieker.webgui.common.exception.ComponentInitializationException; import kieker.webgui.common.exception.ComponentInitializationException;
import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.NewerProjectException;
import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectAlreadyExistingException;
import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.common.exception.ProjectNotExistingException;
import kieker.webgui.domain.ComponentListContainer;
import kieker.webgui.domain.PluginContainer;
import kieker.webgui.domain.RepositoryContainer;
import kieker.webgui.persistence.IProjectDAO; import kieker.webgui.persistence.IProjectDAO;
import kieker.webgui.persistence.impl.util.CloseableURLClassLoader; import kieker.webgui.persistence.impl.util.CloseableURLClassLoader;
import kieker.webgui.persistence.impl.util.PluginFinder; import kieker.webgui.persistence.impl.util.PluginFinder;
......
/***************************************************************************
* Copyright 2012 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
/**
* This package contains the actual implementations of the persistence interfaces.
*
* @author Nils Christian Ehmke
*/
package kieker.webgui.persistence.impl;
\ No newline at end of file
/***************************************************************************
* Copyright 2012 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
/**
* This package contains classes used by the persistence implementation.
*
* @author Nils Christian Ehmke
*/
package kieker.webgui.persistence.impl.util;
\ No newline at end of file
/***************************************************************************
* Copyright 2012 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
/**
* This package contains the interfaces to access the persistence.
*
* @author Nils Christian Ehmke
*/
package kieker.webgui.persistence;
\ No newline at end of file
/***************************************************************************
* Copyright 2012 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.webgui.service;
import org.springframework.security.access.prepost.PreAuthorize;
import kieker.webgui.common.exception.InvalidInputSizeException;
import kieker.webgui.common.exception.UninitializedGraphException;
/**
* An interface for a service providing a graph layouter.
*
* @author Nils Christian Ehmke
*/
public interface IGraphLayoutService {
/**
* This method takes two Strings, describing some basic graph information, and constructs a KGraph, which is then layouted by a Kieler algorithm.
*
* @param nodes
* A String containing node dimensions.
* @param edges
* A String containing connection information of edges.
* @return A String of space separated node positions.
*
* @throws UninitializedGraphException
* If the graph has not been initialized yet.
* @throws InvalidInputSizeException
* If the input size is somehow invalid.
*/
@PreAuthorize("isAuthenticated()")
public String layoutGraph(String nodes, String edges) throws UninitializedGraphException, InvalidInputSizeException;
}
...@@ -20,16 +20,18 @@ import java.io.IOException; ...@@ -20,16 +20,18 @@ import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import kieker.analysis.AnalysisController.STATE; import kieker.analysis.AnalysisController.STATE;
import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIProject;
import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.ClassAndMethodContainer;
import kieker.webgui.common.ComponentListContainer;
import kieker.webgui.common.exception.AnalysisInitializationException; import kieker.webgui.common.exception.AnalysisInitializationException;
import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.AnalysisStateException;
import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.DisplayNotFoundException;
import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.NewerProjectException;
import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectAlreadyExistingException;
import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.common.exception.ProjectNotExistingException;
import kieker.webgui.domain.ComponentListContainer;
import org.primefaces.model.UploadedFile; import org.primefaces.model.UploadedFile;
...@@ -55,6 +57,7 @@ public interface IProjectService { ...@@ -55,6 +57,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the creation of the project. * If something went wrong during the creation of the project.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void addProject(final String projectName, final String username) throws ProjectAlreadyExistingException, IOException; public void addProject(final String projectName, final String username) throws ProjectAlreadyExistingException, IOException;
/** /**
...@@ -72,6 +75,7 @@ public interface IProjectService { ...@@ -72,6 +75,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the creation of the target-project or during the loading of the source-project. * If something went wrong during the creation of the target-project or during the loading of the source-project.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void copyProject(final String originalProjectName, final String newProjectName) throws ProjectNotExistingException, ProjectAlreadyExistingException, public void copyProject(final String originalProjectName, final String newProjectName) throws ProjectNotExistingException, ProjectAlreadyExistingException,
IOException; IOException;
...@@ -86,6 +90,7 @@ public interface IProjectService { ...@@ -86,6 +90,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the opening of the project. * If something went wrong during the opening of the project.
*/ */
@PreAuthorize("isAuthenticated()")
public MIProject openProject(final String projectName) throws ProjectNotExistingException, IOException; public MIProject openProject(final String projectName) throws ProjectNotExistingException, IOException;
/** /**
...@@ -103,6 +108,7 @@ public interface IProjectService { ...@@ -103,6 +108,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the opening of the project. This can also mean that the given {@link ClassAndMethodContainer} is somehow invalid. * If something went wrong during the opening of the project. This can also mean that the given {@link ClassAndMethodContainer} is somehow invalid.
*/ */
@PreAuthorize("isAuthenticated()")
public Object openProject(final String projectName, final ClassAndMethodContainer classAndMethodContainer) throws ProjectNotExistingException, IOException; public Object openProject(final String projectName, final ClassAndMethodContainer classAndMethodContainer) throws ProjectNotExistingException, IOException;
/** /**
...@@ -125,6 +131,7 @@ public interface IProjectService { ...@@ -125,6 +131,7 @@ public interface IProjectService {
* @throws NewerProjectException * @throws NewerProjectException
* If the project on the file system is newer and the overwriteNewerProject-flag has not been set. * If the project on the file system is newer and the overwriteNewerProject-flag has not been set.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void saveProject(final String projectName, final MIProject project, final long timeStamp, final boolean overwriteNewerProject) throws public void saveProject(final String projectName, final MIProject project, final long timeStamp, final boolean overwriteNewerProject) throws
ProjectNotExistingException, IOException, NewerProjectException; ProjectNotExistingException, IOException, NewerProjectException;
...@@ -137,6 +144,7 @@ public interface IProjectService { ...@@ -137,6 +144,7 @@ public interface IProjectService {
* @throws ProjectNotExistingException * @throws ProjectNotExistingException
* If a project with the given name does not exist. * If a project with the given name does not exist.
*/ */
@PreAuthorize("isAuthenticated()")
public long getCurrTimeStamp(final String projectName) throws ProjectNotExistingException; public long getCurrTimeStamp(final String projectName) throws ProjectNotExistingException;
/** /**
...@@ -148,6 +156,7 @@ public interface IProjectService { ...@@ -148,6 +156,7 @@ public interface IProjectService {
* @throws ProjectNotExistingException * @throws ProjectNotExistingException
* If a project with the given name does not exist. * If a project with the given name does not exist.
*/ */
@PreAuthorize("isAuthenticated()")
public String getOwner(final String projectName) throws ProjectNotExistingException; public String getOwner(final String projectName) throws ProjectNotExistingException;
/** /**
...@@ -162,6 +171,7 @@ public interface IProjectService { ...@@ -162,6 +171,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the uploading. * If something went wrong during the uploading.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void uploadLibrary(final UploadedFile file, final String projectName) throws ProjectNotExistingException, IOException; public void uploadLibrary(final UploadedFile file, final String projectName) throws ProjectNotExistingException, IOException;
/** /**
...@@ -177,6 +187,7 @@ public interface IProjectService { ...@@ -177,6 +187,7 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the initialization of the class loader. * If something went wrong during the initialization of the class loader.
*/ */
@PreAuthorize("isAuthenticated()")
public ClassLoader getClassLoader(final String projectName, final Object requester) throws ProjectNotExistingException, IOException; public ClassLoader getClassLoader(final String projectName, final Object requester) throws ProjectNotExistingException, IOException;
/** /**
...@@ -188,6 +199,7 @@ public interface IProjectService { ...@@ -188,6 +199,7 @@ public interface IProjectService {
* @throws ProjectNotExistingException * @throws ProjectNotExistingException
* If a project with the given name does not exist. * If a project with the given name does not exist.
*/ */
@PreAuthorize("isAuthenticated()")
public List<String> listAllLibraries(final String projectName) throws ProjectNotExistingException; public List<String> listAllLibraries(final String projectName) throws ProjectNotExistingException;
/** /**
...@@ -197,6 +209,7 @@ public interface IProjectService { ...@@ -197,6 +209,7 @@ public interface IProjectService {
* The project whose components should be loaded. * The project whose components should be loaded.
* @return An object containing the available components as model instances. * @return An object containing the available components as model instances.
*/ */
@PreAuthorize("isAuthenticated()")
public abstract ComponentListContainer getAvailableComponents(String project); public abstract ComponentListContainer getAvailableComponents(String project);
/** /**
...@@ -204,6 +217,7 @@ public interface IProjectService { ...@@ -204,6 +217,7 @@ public interface IProjectService {
* *
* @return A list containing all available project names. * @return A list containing all available project names.
*/ */
@PreAuthorize("isAuthenticated()")
public Collection<String> listAllProjects(); public Collection<String> listAllProjects();
/** /**
...@@ -220,6 +234,7 @@ public interface IProjectService { ...@@ -220,6 +234,7 @@ public interface IProjectService {
* @throws AnalysisInitializationException * @throws AnalysisInitializationException
* If an error occurred during the initialization of the analysis. * If an error occurred during the initialization of the analysis.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, AnalysisStateException, public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, AnalysisStateException,
AnalysisInitializationException; AnalysisInitializationException;
...@@ -233,6 +248,7 @@ public interface IProjectService { ...@@ -233,6 +248,7 @@ public interface IProjectService {
* @throws AnalysisStateException * @throws AnalysisStateException
* If the analysis of the given project is in the wrong state to be cleaned. This means that it has not been terminated yet. * If the analysis of the given project is in the wrong state to be cleaned. This means that it has not been terminated yet.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException;
/** /**
...@@ -245,6 +261,7 @@ public interface IProjectService { ...@@ -245,6 +261,7 @@ public interface IProjectService {
* @throws AnalysisStateException * @throws AnalysisStateException
* If the analysis of the given project is in the wrong state to be started. This means that it has not been initialized yet. * If the analysis of the given project is in the wrong state to be started. This means that it has not been initialized yet.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void startAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; public void startAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException;
/** /**
...@@ -257,6 +274,7 @@ public interface IProjectService { ...@@ -257,6 +274,7 @@ public interface IProjectService {
* @throws AnalysisStateException * @throws AnalysisStateException
* If the analysis of the given project is in the wrong state to be stopped. This means that it has not been started yet or is no longer running. * If the analysis of the given project is in the wrong state to be stopped. This means that it has not been started yet or is no longer running.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public void stopAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; public void stopAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException;
/** /**
...@@ -275,6 +293,7 @@ public interface IProjectService { ...@@ -275,6 +293,7 @@ public interface IProjectService {
* @throws DisplayNotFoundException * @throws DisplayNotFoundException
* If a view or a display within the given view does not exist. * If a view or a display within the given view does not exist.
*/ */
@PreAuthorize("isAuthenticated()")
public Object getDisplay(final String projectName, final String viewName, final String displayName) throws ProjectNotExistingException, DisplayNotFoundException; public Object getDisplay(final String projectName, final String viewName, final String displayName) throws ProjectNotExistingException, DisplayNotFoundException;
/** /**
...@@ -284,6 +303,7 @@ public interface IProjectService { ...@@ -284,6 +303,7 @@ public interface IProjectService {
* The name of the project whose state have to be returned. * The name of the project whose state have to be returned.
* @return The state of the given project, if available. {@code null} otherwise. * @return The state of the given project, if available. {@code null} otherwise.
*/ */
@PreAuthorize("isAuthenticated()")
public STATE getCurrentState(final String projectName); public STATE getCurrentState(final String projectName);
/** /**
...@@ -295,6 +315,7 @@ public interface IProjectService { ...@@ -295,6 +315,7 @@ public interface IProjectService {
* @throws AnalysisStateException * @throws AnalysisStateException
* If the analysis is in an invalid state to deliver the entries. * If the analysis is in an invalid state to deliver the entries.
*/ */
@PreAuthorize("isAuthenticated()")
public Object[] getLogEntries(final String projectName) throws AnalysisStateException; public Object[] getLogEntries(final String projectName) throws AnalysisStateException;
/** /**
...@@ -308,5 +329,6 @@ public interface IProjectService { ...@@ -308,5 +329,6 @@ public interface IProjectService {
* @throws IOException * @throws IOException
* If something went wrong during the reloading of the components. * If something went wrong during the reloading of the components.
*/ */
@PreAuthorize("hasAnyRole('User', 'Administrator')")
public boolean deleteLibrary(String projectName, String libName) throws IOException; public boolean deleteLibrary(String projectName, String libName) throws IOException;
} }
...@@ -14,13 +14,16 @@ ...@@ -14,13 +14,16 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.webgui.common.layout; package kieker.webgui.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.stereotype.Service;
import kieker.webgui.common.exception.InvalidInputSizeException; import kieker.webgui.common.exception.InvalidInputSizeException;
import kieker.webgui.common.exception.UninitializedGraphException; import kieker.webgui.common.exception.UninitializedGraphException;
import kieker.webgui.service.IGraphLayoutService;
import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EList;
...@@ -47,12 +50,13 @@ import de.cau.cs.kieler.klay.layered.LayeredLayoutProvider; ...@@ -47,12 +50,13 @@ import de.cau.cs.kieler.klay.layered.LayeredLayoutProvider;
* *
* @author row, Nils Christian Ehmke * @author row, Nils Christian Ehmke
*/ */
public final class GraphFlowLayouter { @Service
public final class GraphLayoutServiceImpl implements IGraphLayoutService {
/** /**
* Private constructor as this is a utility class. * Default constructor. <b>Do not use this constructor. This bean is Spring managed.</b>
*/ */
private GraphFlowLayouter() { public GraphLayoutServiceImpl() {
// No code necessary // No code necessary
} }
...@@ -226,28 +230,18 @@ public final class GraphFlowLayouter { ...@@ -226,28 +230,18 @@ public final class GraphFlowLayouter {
final List<KEdge> edges = new ArrayList<KEdge>(edgeInfo.length / 4); final List<KEdge> edges = new ArrayList<KEdge>(edgeInfo.length / 4);
final LayoutInformation layoutInformation = new LayoutInformation(KimlUtil.createInitializedNode(), children, edges); final LayoutInformation layoutInformation = new LayoutInformation(KimlUtil.createInitializedNode(), children, edges);
GraphFlowLayouter.addNodes(positions, layoutInformation); GraphLayoutServiceImpl.addNodes(positions, layoutInformation);
GraphFlowLayouter.addEdges(edgeInfo, layoutInformation); GraphLayoutServiceImpl.addEdges(edgeInfo, layoutInformation);
return layoutInformation; return layoutInformation;
} }
/** /* (non-Javadoc)
* This method takes two Strings, describing some basic graph information, and constructs a KGraph, which is then layouted by a Kieler algorithm. * @see kieker.webgui.service.impl.IGraphLayoutService#layoutGraph(java.lang.String, java.lang.String)
*
* @param nodes
* A String containing node dimensions.
* @param edges
* A String containing connection information of edges.
* @return A String of space separated node positions.
*
* @throws UninitializedGraphException
* If the graph has not been initialized yet.
* @throws InvalidInputSizeException
* If the input size is somehow invalid.
*/ */
public static String layoutGraph(final String nodes, final String edges) throws UninitializedGraphException, InvalidInputSizeException { @Override
final LayoutInformation layoutInformation = GraphFlowLayouter.assembleLayoutInformation(nodes, edges); public String layoutGraph(final String nodes, final String edges) throws UninitializedGraphException, InvalidInputSizeException {
final LayoutInformation layoutInformation = GraphLayoutServiceImpl.assembleLayoutInformation(nodes, edges);
// Create a progress monitor // Create a progress monitor
final IKielerProgressMonitor progressMonitor = new BasicProgressMonitor(); final IKielerProgressMonitor progressMonitor = new BasicProgressMonitor();
...@@ -259,8 +253,8 @@ public final class GraphFlowLayouter { ...@@ -259,8 +253,8 @@ public final class GraphFlowLayouter {
layoutProvider.doLayout(layoutInformation.getGraph(), progressMonitor); layoutProvider.doLayout(layoutInformation.getGraph(), progressMonitor);
// convert layouted graph positions to String // convert layouted graph positions to String
final String layoutedGraph = GraphFlowLayouter.getPositions(layoutInformation); final String layoutedGraph = GraphLayoutServiceImpl.getPositions(layoutInformation);
final String bendPoints = GraphFlowLayouter.getBendPoints(layoutInformation); final String bendPoints = GraphLayoutServiceImpl.getBendPoints(layoutInformation);
return layoutedGraph + "#" + bendPoints; return layoutedGraph + "#" + bendPoints;
} }
......
...@@ -27,13 +27,13 @@ import org.springframework.stereotype.Service; ...@@ -27,13 +27,13 @@ import org.springframework.stereotype.Service;
import kieker.analysis.AnalysisController.STATE; import kieker.analysis.AnalysisController.STATE;
import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIProject;
import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.ClassAndMethodContainer;
import kieker.webgui.common.ComponentListContainer;
import kieker.webgui.common.exception.AnalysisInitializationException; import kieker.webgui.common.exception.AnalysisInitializationException;
import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.AnalysisStateException;
import kieker.webgui.common.exception.DisplayNotFoundException; import kieker.webgui.common.exception.DisplayNotFoundException;
import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.NewerProjectException;
import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectAlreadyExistingException;
import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.common.exception.ProjectNotExistingException;
import kieker.webgui.domain.ComponentListContainer;
import kieker.webgui.persistence.IProjectDAO; import kieker.webgui.persistence.IProjectDAO;
import kieker.webgui.service.IProjectService; import kieker.webgui.service.IProjectService;
import kieker.webgui.service.impl.util.ACManager; import kieker.webgui.service.impl.util.ACManager;
......
...@@ -18,7 +18,6 @@ package kieker.webgui.service.impl; ...@@ -18,7 +18,6 @@ package kieker.webgui.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import kieker.webgui.common.exception.DataAccessException; import kieker.webgui.common.exception.DataAccessException;
...@@ -50,7 +49,6 @@ public class UserServiceImpl implements IUserService { ...@@ -50,7 +49,6 @@ public class UserServiceImpl implements IUserService {
* @see kieker.webgui.service.IUserService#addUser(kieker.webgui.domain.User) * @see kieker.webgui.service.IUserService#addUser(kieker.webgui.domain.User)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void addUser(final User user) throws DataAccessException { public void addUser(final User user) throws DataAccessException {
this.userDAO.addUser(user); this.userDAO.addUser(user);
} }
...@@ -61,7 +59,6 @@ public class UserServiceImpl implements IUserService { ...@@ -61,7 +59,6 @@ public class UserServiceImpl implements IUserService {
* @see kieker.webgui.service.IUserService#getUsers() * @see kieker.webgui.service.IUserService#getUsers()
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public List<User> getUsers() throws DataAccessException { public List<User> getUsers() throws DataAccessException {
return this.userDAO.getUsers(); return this.userDAO.getUsers();
} }
...@@ -72,7 +69,6 @@ public class UserServiceImpl implements IUserService { ...@@ -72,7 +69,6 @@ public class UserServiceImpl implements IUserService {
* @see kieker.webgui.service.IUserService#deleteUser(kieker.webgui.domain.User) * @see kieker.webgui.service.IUserService#deleteUser(kieker.webgui.domain.User)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void deleteUser(final User user) throws DataAccessException { public void deleteUser(final User user) throws DataAccessException {
this.userDAO.deleteUser(user); this.userDAO.deleteUser(user);
} }
...@@ -83,7 +79,6 @@ public class UserServiceImpl implements IUserService { ...@@ -83,7 +79,6 @@ public class UserServiceImpl implements IUserService {
* @see kieker.webgui.service.IUserService#editUser(kieker.webgui.domain.User) * @see kieker.webgui.service.IUserService#editUser(kieker.webgui.domain.User)
*/ */
@Override @Override
@PreAuthorize("hasRole('Administrator')")
public void editUser(final User user) throws DataAccessException { public void editUser(final User user) throws DataAccessException {
this.userDAO.editUser(user); this.userDAO.editUser(user);
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
***************************************************************************/ ***************************************************************************/
/** /**
* This package contains the actual implementation of the services.
*
* @author Nils Christian Ehmke * @author Nils Christian Ehmke
*/ */
package kieker.webgui.service.impl; package kieker.webgui.service.impl;
\ No newline at end of file
...@@ -36,12 +36,15 @@ import kieker.webgui.common.exception.ProjectLoadException; ...@@ -36,12 +36,15 @@ import kieker.webgui.common.exception.ProjectLoadException;
* @author Nils Christian Ehmke * @author Nils Christian Ehmke
*/ */
public final class Analysis { public final class Analysis {
private static final Log LOG = LogFactory.getLog(Analysis.class); private static final Log LOG = LogFactory.getLog(Analysis.class);
private static final long MAX_THREAD_WAIT_TIME_MS = 1000; private static final long MAX_THREAD_WAIT_TIME_MS = 1000;
private final ClassAndMethodContainer classAndMethodContainer; private final ClassAndMethodContainer classAndMethodContainer;
private final UpdateDisplaysThread updateDisplaysThread;
private final Object analysisController; private final Object analysisController;
private final Object analysisControllerThread; private final Object analysisControllerThread;
private final UpdateDisplaysThread updateDisplaysThread;
/** /**
* Creates a new instance of this class using the given parameters. * Creates a new instance of this class using the given parameters.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment