diff --git a/Kieker.WebGUI/.classpath b/Kieker.WebGUI/.classpath index e61646eedbbc3a5d427d3f68234ca6b94bb5102c..595a5bf4f25946f35d122d0c250b79c689cc4693 100644 --- a/Kieker.WebGUI/.classpath +++ b/Kieker.WebGUI/.classpath @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" output="target/classes" path="src/main/java"/> - <classpathentry kind="src" path="src/test/java"/> <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.m2e.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="output" path="target/classes"/> diff --git a/Kieker.WebGUI/.project b/Kieker.WebGUI/.project index b6096236646af9d6a1f1234624fca2b253e99cb3..5fe3174c1c0f333632957158a646bb9b74f40aaa 100644 --- a/Kieker.WebGUI/.project +++ b/Kieker.WebGUI/.project @@ -17,7 +17,7 @@ </buildCommand> </buildSpec> <natures> - <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> diff --git a/Kieker.WebGUI/.settings/edu.umd.cs.findbugs.core.prefs b/Kieker.WebGUI/.settings/edu.umd.cs.findbugs.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..0073ac05b71a46fadf46461b4ec9362c6da59725 --- /dev/null +++ b/Kieker.WebGUI/.settings/edu.umd.cs.findbugs.core.prefs @@ -0,0 +1,131 @@ +#FindBugs User Preferences +#Fri May 18 17:56:48 CEST 2012 +cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud +detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true +detectorAtomicityProblem=AtomicityProblem|true +detectorBadAppletConstructor=BadAppletConstructor|false +detectorBadResultSetAccess=BadResultSetAccess|true +detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true +detectorBadUseOfReturnValue=BadUseOfReturnValue|true +detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true +detectorBooleanReturnNull=BooleanReturnNull|true +detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false +detectorCheckExpectedWarnings=CheckExpectedWarnings|false +detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true +detectorCheckTypeQualifiers=CheckTypeQualifiers|true +detectorCloneIdiom=CloneIdiom|true +detectorComparatorIdiom=ComparatorIdiom|true +detectorConfusedInheritance=ConfusedInheritance|true +detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true +detectorCrossSiteScripting=CrossSiteScripting|true +detectorDefaultEncodingDetector=DefaultEncodingDetector|true +detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true +detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true +detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true +detectorDontUseEnum=DontUseEnum|true +detectorDroppedException=DroppedException|true +detectorDumbMethodInvocations=DumbMethodInvocations|true +detectorDumbMethods=DumbMethods|true +detectorDuplicateBranches=DuplicateBranches|true +detectorEmptyZipFileEntry=EmptyZipFileEntry|true +detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true +detectorExplicitSerialization=ExplicitSerialization|true +detectorFinalizerNullsFields=FinalizerNullsFields|true +detectorFindBadCast2=FindBadCast2|true +detectorFindBadForLoop=FindBadForLoop|true +detectorFindCircularDependencies=FindCircularDependencies|false +detectorFindDeadLocalStores=FindDeadLocalStores|true +detectorFindDoubleCheck=FindDoubleCheck|true +detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true +detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true +detectorFindFinalizeInvocations=FindFinalizeInvocations|true +detectorFindFloatEquality=FindFloatEquality|true +detectorFindHEmismatch=FindHEmismatch|true +detectorFindInconsistentSync2=FindInconsistentSync2|true +detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true +detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true +detectorFindMaskedFields=FindMaskedFields|true +detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true +detectorFindNakedNotify=FindNakedNotify|true +detectorFindNonShortCircuit=FindNonShortCircuit|true +detectorFindNullDeref=FindNullDeref|true +detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true +detectorFindOpenStream=FindOpenStream|true +detectorFindPuzzlers=FindPuzzlers|true +detectorFindRefComparison=FindRefComparison|true +detectorFindReturnRef=FindReturnRef|true +detectorFindRunInvocations=FindRunInvocations|true +detectorFindSelfComparison=FindSelfComparison|true +detectorFindSelfComparison2=FindSelfComparison2|true +detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true +detectorFindSpinLoop=FindSpinLoop|true +detectorFindSqlInjection=FindSqlInjection|true +detectorFindTwoLockWait=FindTwoLockWait|true +detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true +detectorFindUnconditionalWait=FindUnconditionalWait|true +detectorFindUninitializedGet=FindUninitializedGet|true +detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true +detectorFindUnreleasedLock=FindUnreleasedLock|true +detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true +detectorFindUnsyncGet=FindUnsyncGet|true +detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true +detectorFindUselessControlFlow=FindUselessControlFlow|true +detectorFormatStringChecker=FormatStringChecker|true +detectorHugeSharedStringConstants=HugeSharedStringConstants|true +detectorIDivResultCastToDouble=IDivResultCastToDouble|true +detectorIncompatMask=IncompatMask|true +detectorInconsistentAnnotations=InconsistentAnnotations|true +detectorInefficientMemberAccess=InefficientMemberAccess|false +detectorInefficientToArray=InefficientToArray|true +detectorInfiniteLoop=InfiniteLoop|true +detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true +detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true +detectorInitializationChain=InitializationChain|true +detectorInstantiateStaticClass=InstantiateStaticClass|true +detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true +detectorInvalidJUnitTest=InvalidJUnitTest|true +detectorIteratorIdioms=IteratorIdioms|true +detectorLazyInit=LazyInit|true +detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true +detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true +detectorMethodReturnCheck=MethodReturnCheck|true +detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true +detectorMutableLock=MutableLock|true +detectorMutableStaticFields=MutableStaticFields|true +detectorNaming=Naming|true +detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true +detectorNumberConstructor=NumberConstructor|true +detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true +detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true +detectorPublicSemaphores=PublicSemaphores|false +detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true +detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true +detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true +detectorRedundantInterfaces=RedundantInterfaces|true +detectorRepeatedConditionals=RepeatedConditionals|true +detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true +detectorSerializableIdiom=SerializableIdiom|true +detectorStartInConstructor=StartInConstructor|true +detectorStaticCalendarDetector=StaticCalendarDetector|true +detectorStringConcatenation=StringConcatenation|true +detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true +detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true +detectorSwitchFallthrough=SwitchFallthrough|true +detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true +detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true +detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true +detectorURLProblems=URLProblems|true +detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true +detectorUnnecessaryMath=UnnecessaryMath|true +detectorUnreadFields=UnreadFields|true +detectorUselessSubclassMethod=UselessSubclassMethod|false +detectorVarArgsProblems=VarArgsProblems|true +detectorVolatileUsage=VolatileUsage|true +detectorWaitInLoop=WaitInLoop|true +detectorWrongMapIterator=WrongMapIterator|true +detectorXMLFactoryBypass=XMLFactoryBypass|true +detector_threshold=2 +effort=default +filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,MT_CORRECTNESS,PERFORMANCE,STYLE|false|15 +filter_settings_neg=MALICIOUS_CODE,NOISE,I18N,SECURITY,EXPERIMENTAL| +run_at_full_build=false diff --git a/Kieker.WebGUI/.settings/org.eclipse.core.resources.prefs b/Kieker.WebGUI/.settings/org.eclipse.core.resources.prefs index f8e2785f2a2ac234a93facdf66a8d970bdf372ff..e9441bb123ec3e1ab029c7eac896bc45681d9a71 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.core.resources.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.core.resources.prefs @@ -1,4 +1,3 @@ -#Fri Feb 03 16:06:50 CET 2012 eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding/<project>=UTF-8 diff --git a/Kieker.WebGUI/.settings/org.eclipse.jdt.core.prefs b/Kieker.WebGUI/.settings/org.eclipse.jdt.core.prefs index 0cc6f704f5a72e17999361312d57974e8273c490..1217752323225e12414fa2158831026f60470d85 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.jdt.core.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.jdt.core.prefs @@ -1,14 +1,16 @@ -#Fri Feb 03 21:01:28 CET 2012 eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false diff --git a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs index 36d8a56b3d3550ea0c8a421c4e94da5ed7027f6e..a7532b330d56602e0292438bddc951fe243271d3 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Fri Feb 03 21:03:00 CET 2012 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true @@ -56,6 +55,10 @@ eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true 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.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true @@ -66,10 +69,10 @@ sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_parentheses_in_expressions=true sp_cleanup.always_use_this_for_non_static_field_access=true sp_cleanup.always_use_this_for_non_static_method_access=true -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=true sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false @@ -79,7 +82,7 @@ sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.never_use_parentheses_in_expressions=false sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=true @@ -88,22 +91,22 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=true sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_local_variables=true sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_members=true sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false +sp_cleanup.sort_members_all=true +sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_parentheses_in_expressions=true sp_cleanup.use_this_for_non_static_field_access=true sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false sp_cleanup.use_this_for_non_static_method_access=true diff --git a/Kieker.WebGUI/.settings/org.eclipse.m2e.core.prefs b/Kieker.WebGUI/.settings/org.eclipse.m2e.core.prefs index c13b7b31f06433383e940d2ea0cecf82b33f7830..f897a7f1cb2389f85fe6381425d29f0a9866fb65 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.m2e.core.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.m2e.core.prefs @@ -1,4 +1,3 @@ -#Sat Jan 21 18:45:30 CET 2012 activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true diff --git a/Kieker.WebGUI/README b/Kieker.WebGUI/README deleted file mode 100644 index 986af16cd1407c4cd0e81e0b070e8c3fba753b0e..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/README +++ /dev/null @@ -1,7 +0,0 @@ -The project "Kieker.WebGUI" can be started via Maven (3). Just use the command - -mvn jetty:run - -to pack the war-file, deploy it on jetty and start jetty. The web tool is then available at - -http://localhost:8080/Kieker.WebGUI/main \ No newline at end of file diff --git a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar index 1226fc8a09fb8bb0570d5a8abf6d61b9fa8cd500..e1c53890f254d4bbc0f6c83f5811bbba6960533e 100644 Binary files a/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar and b/Kieker.WebGUI/lib/kieker-1.6-SNAPSHOT_emf.jar differ diff --git a/Kieker.WebGUI/nb-configuration.xml b/Kieker.WebGUI/nb-configuration.xml index fb9db666b7d5e9b9bd258117869227c3c34cff93..3486bc9d74f184e12a04205c09d8b864a0a310cd 100644 --- a/Kieker.WebGUI/nb-configuration.xml +++ b/Kieker.WebGUI/nb-configuration.xml @@ -13,8 +13,6 @@ You can copy and paste the single properties, into the pom.xml file and the IDE That way multiple projects can share the same settings (useful for formatting rules for example). Any value defined here will override the pom.xml file value but is only applicable to the current project. --> - <netbeans.checkstyle.format>true</netbeans.checkstyle.format> - <netbeans.hint.jdkPlatform>JDK_1.6</netbeans.hint.jdkPlatform> - <org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language> + <netbeans.compile.on.save>all</netbeans.compile.on.save> </properties> </project-shared-configuration> diff --git a/Kieker.WebGUI/nbactions.xml b/Kieker.WebGUI/nbactions.xml index 14cb2ebfff786f58162788fb9ad56421b116f530..83c07bc949ef02efe2913b7d905adcdc0d8d8eca 100644 --- a/Kieker.WebGUI/nbactions.xml +++ b/Kieker.WebGUI/nbactions.xml @@ -5,7 +5,6 @@ <goals> <goal>jetty:run</goal> - </goals> </action> </actions> diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 88232b4778b2f332b97c4c91371399c2415bc4de..67a39b48f6241695799d1c4f12d41a6131c594f9 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -15,6 +15,15 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <kieker.jar>kieker-1.6-SNAPSHOT_emf.jar</kieker.jar> </properties> + + <repositories> + <repository> + <id>prime-repo</id> + <name>PrimeFaces Maven Repository</name> + <url>http://repository.primefaces.org</url> + <layout>default</layout> + </repository> + </repositories> <dependencies> <dependency> @@ -201,7 +210,7 @@ <dependency> <groupId>kieker</groupId> <artifactId>kieker</artifactId> - <version>1.5-SNAPSHOT</version> + <version>1.6-SNAPSHOT</version> <scope>system</scope> <systemPath>${project.basedir}/lib/${kieker.jar}</systemPath> </dependency> @@ -217,15 +226,6 @@ </dependency> </dependencies> - <repositories> - <repository> - <id>prime-repo</id> - <name>PrimeFaces Maven Repository</name> - <url>http://repository.primefaces.org</url> - <layout>default</layout> - </repository> - </repositories> - <build> <plugins> <plugin> @@ -372,7 +372,5 @@ </plugin> </plugins> </build> - - </project> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/DependenciesBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/DependenciesBean.java deleted file mode 100644 index 65e9f66d86497f1b9310bba4160fe2a9e52a3a89..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/DependenciesBean.java +++ /dev/null @@ -1,122 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.application; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import javax.faces.bean.ApplicationScoped; -import javax.faces.bean.ManagedBean; - -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; -import kieker.webgui.common.FileManager; -import kieker.webgui.common.PluginClassLoader; - -import org.primefaces.model.UploadedFile; - -/** - * This bean manages all dependencies (libraries) within the application. The bean can be used to add and remove dependencies as well as to get all available - * dependencies. This bean doesn't modify other beans directly. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@ApplicationScoped -public class DependenciesBean { - - /** - * The logger within this class. - */ - private static final Log LOG = LogFactory.getLog(DependenciesBean.class); - /** - * The list containing the depenencies. - */ - private final List<MIDependency> dependencies; - - /** - * Creates a new instance of this class. - */ - public DependenciesBean() { - this.dependencies = FileManager.getInstance().loadAllDependencies(); - } - - /** - * Delivers the currently available dependencies as a list. The list must <b>not</b> be modified. - * - * @return All available dependencies. - */ - public List<MIDependency> getDependencies() { - return this.dependencies; - } - - /** - * Tries to upload a given file as a new dependency. If the dependency does already exist, it will be overwritten. If the dependencies has been uploaded - * successfully, the plugin class loader will get the lib as well. - * - * @param file - * The file to be uploaded. - */ - public void uploadDependency(final UploadedFile file) { - synchronized (this) { - final MIDependency dependency = FileManager.getInstance().uploadDependency(file); - if (dependency != null) { - // Is is possible that we already have a dependency with the same name and have to remove it first. - for (final MIDependency dep : this.dependencies) { - if (dep.getFilePath().equals(dependency.getFilePath())) { - this.dependencies.remove(dep); - break; - } - } - try { - PluginClassLoader.getInstance().addURL(new URL("file", "localhost", FileManager.getInstance().getFullPath(dependency))); - this.dependencies.add(dependency); - } catch (final MalformedURLException ex) { - DependenciesBean.LOG.error("Could not add the dependency to the ClassLoader.", ex); - } - } - } - } - - /** - * Tries to delete a given dependency. Once this has been done, the class loader cannot use the dependency any longer. - * - * @param dependency - * The dependency to be removed. - */ - public void deleteDependency(final MIDependency dependency) { - synchronized (this) { - final boolean result = FileManager.getInstance().deleteDependency(dependency); - if (result) { - this.dependencies.remove(dependency); - try { - PluginClassLoader.getInstance().removeURL(new URL("file", "localhost", dependency.getFilePath())); - this.dependencies.remove(dependency); - } catch (final MalformedURLException ex) { - DependenciesBean.LOG.error("Could not remove the dependency from the ClassLoader.", ex); - } - } - } - } -} 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 5968a7f3b81696861c2ff58a367d30d605a86c99..c880814135aa51abdbc95143e98b76d36a347376 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 @@ -2,7 +2,7 @@ * Copyright 2012 by * + Christian-Albrechts-University of Kiel * + Department of Computer Science - * + Software Engineering Group + * + Software Engineering Group * and others. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,279 +17,160 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ + package kieker.webgui.beans.application; -import java.lang.reflect.Method; +import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; import java.util.List; -import java.util.Observable; +import java.util.concurrent.ConcurrentHashMap; +import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; +import javax.faces.application.FacesMessage.Severity; import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import javax.faces.context.FacesContext; -import kieker.analysis.display.HtmlText; -import kieker.analysis.display.Image; -import kieker.analysis.display.PlainText; -import kieker.analysis.display.annotation.Display; -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.analysis.model.analysisMetaModel.MIPlugin; +import kieker.analysis.AnalysisController; import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; -import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.annotation.Plugin; -import kieker.analysis.repository.AbstractRepository; -import kieker.webgui.common.FileManager; - -import org.primefaces.context.RequestContext; -import org.primefaces.model.DefaultTreeNode; -import org.primefaces.model.TreeNode; +import kieker.webgui.common.FSManager; +import kieker.webgui.common.exception.ProjectAlreadyExistingException; /** - * This bean can be used to handle all available projects within the program. It is like a blackboard for all other components when it comes to the actual projects - * <b>stored</b> on the file system. The properties of the projects, like the adding of dependencies the an actual existing project, can be done otherwise, but the - * storage is done via this bean. Other beans (like for the currently selected main project) are not modified directly by this bean. If the user removes the main - * project, the bean for the main project has to handle this. + * This bean contains all project and - for example - their corresponding instances of {@link AnalysisController}. It should be used to create new projects and + * similar things. The synchronization for the projects is done in the {@link FSManager} though. * * @author Nils Christian Ehmke * @version 1.0 */ @ManagedBean @ApplicationScoped -public class ProjectsBean extends Observable { +public final class ProjectsBean { /** - * A list containing all available projects. + * This is the list containing all projects. */ - private final List<MIProject> projects; + private final List<String> projects = Collections.synchronizedList(new ArrayList<String>()); /** - * The factory used to create new projects. + * This list contains the current analysis controllers. Not every project does have a controller, but every project can have maximal one. */ - private final MAnalysisMetaModelFactory factory; + private final ConcurrentHashMap<String, AnalysisController> analysisController = new ConcurrentHashMap<String, AnalysisController>(); /** * Creates a new instance of this class. */ public ProjectsBean() { - // Load all projects from the file system. - this.projects = FileManager.getInstance().loadAllProjects(); - this.factory = new MAnalysisMetaModelFactory(); + // No code necessary + } + + @SuppressWarnings("unused") + @PostConstruct + private void init() { + // Load a list with all available projects on the FS + this.projects.addAll(FSManager.getInstance().getAllProjects()); } /** - * Uses the given name to create a new project. If a project with the - * same name does already exist, nothing happens, but a message will inform the user. + * Adds a new project to this application if possible. It informs the current user (via the growl-component of PrimeFaces) whether the creation was successful or + * not. * - * @param projectName - * The name of the new project. + * @param project + * The name of the project to be added. */ - public final void addProject(final String projectName) { - // Create a new project. - final MIProject project = this.factory.createProject(); - project.setName(projectName); - - // The check for an existing project and the potential storage within our list has to be done atomically. - synchronized (this) { - // Try to save the project. If this fails, the project exists already. - if (FileManager.getInstance().saveNewProject(project)) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", "New Project: " + projectName)); - this.projects.add(project); - RequestContext.getCurrentInstance().addPartialUpdateTarget("projectsForm"); - } else { - // Inform the user about the fail. - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "", "A project with this name exists already.")); - } + public void addProject(final String project) { + try { + // Try and use the FS-Manager to create the project atomically. + FSManager.getInstance().addProject(project); + // If there were no exception, everything went well. We can add the project to our list. + this.projects.add(project); + // Inform the user + ProjectsBean.showMessage(FacesMessage.SEVERITY_INFO, "Project created."); + } catch (final IOException ex) { + ProjectsBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while creating the project."); + } catch (final ProjectAlreadyExistingException ex) { + ProjectsBean.showMessage(FacesMessage.SEVERITY_WARN, "A project with the same name exists already."); } } /** - * Delivers the currently available projects as a tree root. + * This method can be used to open an existing project. This means that the current state of the project on the file system is loaded into an instance of {@link} + * MIProject}. This instance can be modified at will and for example later saved by the {@link FSManager}. * - * @return The root of the currently available projects. + * @param project + * The name of the project to be saved. + * @return Either the model instance if the loading was successful, null otherwise. In the latter case, the user will be informed via the growl-component. */ - public final TreeNode getProjectsRoot() { - synchronized (this) { - final TreeNode root = new DefaultTreeNode("Root", null); - - for (final MIProject project : this.projects) { - final TreeNode projectNode = new DefaultTreeNode("project", project, root); - final TreeNode dependenciesNode = new DefaultTreeNode("dependencies", "Dependencies", projectNode); - final TreeNode usedPluginsNode = new DefaultTreeNode("usedPlugins", "Used Plugins", projectNode); - - // Append the used plugins and dependencies. - for (final MIPlugin plugin : project.getPlugins()) { - new DefaultTreeNode("usedPlugin", plugin.getName(), usedPluginsNode); - } - - for (final MIDependency dependency : project.getDependencies()) { - new DefaultTreeNode("dependencies", dependency.getFilePath(), dependenciesNode); - } - } - - return root; + public MIProject openProject(final String project) { + try { + return FSManager.getInstance().openProject(project); + } catch (final IOException ex) { + ProjectsBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while loading the project."); + return null; } } /** - * This method saved a given project on the file system. The project - * should already exist. + * This method can be used to get the current time stamp of a given project as a human readable date. If the project doesn't exist or the time stamp would be + * invalid, the date of 0 is returned. * * @param project - * The project to be saved. + * The project whose time stamp should be collected. + * @return The hum readable time stamp of the project. */ - public void saveProject(final MIProject project) { - synchronized (this) { - FileManager.getInstance().saveProject(project); - } + public String getCurrTimeStamp(final String project) { + // Get the current time stamp of the project... + final long timeStamp = FSManager.getInstance().getCurrTimeStamp(project); + // ...and make sure the user can read it. + final String dStr = new Date(timeStamp).toString(); + return dStr; + } /** - * Deletes a given project from the file system. + * This method delivers all available projects as a list of string. * - * @param project - * The project to be removed. + * @return All currently available projects. */ - public void deleteProject(final MIProject project) { - synchronized (this) { - final boolean result = FileManager.getInstance().deleteProject(project); - if (result) { - this.projects.remove(project); - // Notify the observers - this.setChanged(); - this.notifyObservers(new MsgProjectRemoved(project)); - } - } + public List<String> getProjects() { + return this.projects; } /** - * Reloads a given project from the file system. In other words: The - * state of the project is restored from the file system. + * This method delivers the corresponding analysis controller of the given project. * * @param project - * The project to be reloaded. + * The project whose analysis controller should be delivered. + * @return The corresponding instance of {@link AnalysisController} if it exists, null otherwise. */ - public void resetProject(final MIProject project) { - synchronized (this) { - final MIProject result = FileManager.getInstance().reloadProject(project); - if (result != null) { - this.projects.remove(project); - this.projects.add(result); - } - } + public AnalysisController getAnalysisController(final String project) { + return this.analysisController.get(project); } /** - * This method can be used to get the description of an {@link AbstractPlugin}- or an {@link AbstractRepository}-class. The description is read via the - * annotation. + * This method can be used to deliver the state of the analysis controller of the given project as a human readable string. * - * @param clazz - * The class whose description should be extracted. - * @return The description for the class or a substitute if none is available. + * @param project + * The project whose state should be delivered. + * @return The current state of the corresponding {@link AnalysisController} if it exists, 'N/A' otherwise. */ - public String getDescription(final Class<?> clazz) { - final Plugin annotation = clazz.getAnnotation(Plugin.class); - if (annotation == null || annotation.description().isEmpty()) { - return "No description available"; - } else { - return annotation.description(); - } - } - - public List<Widget> getWidgets(final Class<?> clazz) { - // TODO Cache - final List<Widget> widgets = new ArrayList<ProjectsBean.Widget>(); - if (clazz != null) { - // Run through all methods and check them - final Method[] methods = clazz.getMethods(); - for (final Method method : methods) { - // If the method does have the right annotation, we use it. - final Display displayAnnot = method.getAnnotation(Display.class); - if (displayAnnot != null) { - // Get the correct type of the method - final Class<?> returnType = method.getReturnType(); - final Widget.WidgetType type; - // TODO This should be done better. - if (returnType.isAssignableFrom(PlainText.class) && PlainText.class.isAssignableFrom(returnType)) { - type = Widget.WidgetType.PlainText; - } else { - if (returnType.isAssignableFrom(HtmlText.class) && HtmlText.class.isAssignableFrom(returnType)) { - type = Widget.WidgetType.HtmlText; - } else { - if (returnType.isAssignableFrom(Image.class) && Image.class.isAssignableFrom(returnType)) { - type = Widget.WidgetType.Image; - } else { - // Unknown type! - continue; - } - } - } - - final Widget widget = new Widget(method, type, displayAnnot.name()); - widgets.add(widget); - } - } - } - return widgets; - } - - public static class Widget { - private final Method widgetMethod; - private final WidgetType type; - private final String name; - - public static enum WidgetType { - PlainText, HtmlText, Image - } - - public Widget(final Method widgetMethod, final WidgetType type, final String name) { - this.widgetMethod = widgetMethod; - this.type = type; - this.name = name; - } - - public Method getWidgetMethod() { - return this.widgetMethod; - } + public String getAnalysisControllerState(final String project) { + final AnalysisController controller = this.analysisController.get(project); - public WidgetType getType() { - return this.type; - } - - public String getName() { - return this.name; - } + return (controller == null) ? "N/A" : controller.getState().toString(); } /** - * This helper class is a wrapper for a project and can be send to the observers as a message that a project just has been removed. It contains - * the removed project. + * This method shows the current user a message by using the growl-component of PrimeFaces. * - * @author Nils Christian Ehmke + * @param severity + * The severity of the message. + * @param msg + * The message itself. */ - public static class MsgProjectRemoved { - /** - * The stored project. - */ - private final MIProject project; - - /** - * Creates a new instance of this class using the given parameters. - * - * @param project - * The project to be stored within this class. - */ - public MsgProjectRemoved(final MIProject project) { - this.project = project; - } - - /** - * Delivers the stored project within this class. - * - * @return The instance of {@link MIProject}. - */ - public MIProject getProject() { - return this.project; - } + private static void showMessage(final Severity severity, final String msg) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg)); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ThemeSwitcherBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ThemeSwitcherBean.java index 92891b7d6e8730876b0263ef95a87f5d756fa1dc..e4144671becd8b11fe8b5228d150288917ab4522 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ThemeSwitcherBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/ThemeSwitcherBean.java @@ -2,7 +2,7 @@ * Copyright 2012 by * + Christian-Albrechts-University of Kiel * + Department of Computer Science - * + Software Engineering Group + * + Software Engineering Group * and others. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,18 +36,18 @@ import javax.faces.bean.ManagedBean; */ @ManagedBean @ApplicationScoped -public class ThemeSwitcherBean { +public final class ThemeSwitcherBean { /** * A map containing all available themes. */ - private final Map<String, String> themes; + private final Map<String, String> themes = new TreeMap<String, String>(); /** * Creates a new instance of this class. */ public ThemeSwitcherBean() { - this.themes = new TreeMap<String, String>(); + // No code necessary } /** @@ -55,7 +55,7 @@ public class ThemeSwitcherBean { * * @return A map containing the user readable names of the themes as a key and the actual theme-names as the corresponding value. */ - public final Map<String, String> getThemes() { + public Map<String, String> getThemes() { return this.themes; } @@ -63,7 +63,7 @@ public class ThemeSwitcherBean { * Initializes the bean. If one wants to add new themes to the program, this is the right place. */ @PostConstruct - public final void init() { + public void init() { this.themes.put("Aristo", "aristo"); this.themes.put("Black-Tie", "black-tie"); this.themes.put("Blitzer", "blitzer"); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/package-info.java deleted file mode 100644 index 4f8458542a82969f0bd39038bc00bc6119cc8655..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/application/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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 all beans with application scope. - */ -package kieker.webgui.beans.application; - diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/SelectedDependenciesBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/SelectedDependenciesBean.java deleted file mode 100644 index 8bb1d32ddd575e6f3a2acb7d0bce5074bda90c6c..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/SelectedDependenciesBean.java +++ /dev/null @@ -1,125 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.request; - -import java.util.ArrayList; -import java.util.List; - -import javax.faces.application.FacesMessage; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.RequestScoped; -import javax.faces.context.FacesContext; - -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.webgui.beans.application.DependenciesBean; -import kieker.webgui.beans.session.SelectedProjectBean; - -/** - * This bean contains the currently chosen dependencies. This has to be request scoped, because the bean fetches the currently selected project when created. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@RequestScoped -public class SelectedDependenciesBean { - - /** - * This list contains the currently selected dependencies. - */ - private List<MIDependency> dependencies; - /** - * This field contains the corresponding project, which will be modified by this bean. - */ - private final MIProject project; - - /** - * Creates a new instance of this class. - */ - public SelectedDependenciesBean() { - this.dependencies = new ArrayList<MIDependency>(); - - /* Try to get the currently selected project. */ - final FacesContext context = FacesContext.getCurrentInstance(); - - final SelectedProjectBean selProjBean = context.getApplication().evaluateExpressionGet(context, "#{selectedProjectBean}", - SelectedProjectBean.class); - final DependenciesBean depBean = context.getApplication().evaluateExpressionGet(context, "#{dependenciesBean}", - DependenciesBean.class); - - if (selProjBean != null) { - this.project = selProjBean.getSelectedProject(); - } else { - this.project = null; - } - - /* - * The adding of the already existing dependencies within the project is troublesome. As the names cannot be compared, we have to do this manually and - * use our "own" dependencies which we have to compare with the dependencies in the project. - */ - if (selProjBean != null && depBean != null) { - final List<MIDependency> availableDependencies = depBean.getDependencies(); - - for (final MIDependency dependency : this.project.getDependencies()) { - for (final MIDependency actDependency : availableDependencies) { - if (actDependency.getFilePath().equals(dependency.getFilePath())) { - this.dependencies.add(actDependency); - continue; - } - } - } - } - } - - /** - * Delivers the currently selected dependencies. - * - * @return The selected dependencies. - */ - public List<MIDependency> getDependencies() { - return this.dependencies; - } - - /** - * Sets the currently selected dependencies to a new value. - * - * @param dependencies - * The newly selected dependencies. - */ - public void setDependencies(final List<MIDependency> dependencies) { - this.dependencies = dependencies; - } - - /** - * This method should be called as an action. It clears the project's dependencies and adds all currently selected dependencies to this project. - */ - public void submit() { - if (this.project != null) { - this.project.getDependencies().clear(); - this.project.getDependencies().addAll(this.dependencies); - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", "Dependencies saved.")); - } else { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", "No project selected.")); - } - } - -} 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 0fd11aa52c838af374c33af0f4872b76a8443ffa..babc86bb64126be3053ec2a44a8499a8c76f84a1 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 @@ -65,7 +65,8 @@ public class StringBean { } /** - * This method verifies whether the given object is an instance of {@link java.lang.String} or not. + * This method verifies whether the given object is an instance of {@link java.lang.String} or not. This is necessary due to the fact that the + * 'instanceof'-command has not yet been implemented in JSF. * * @param object * The object to be verified. @@ -74,4 +75,16 @@ public class StringBean { public boolean checkString(final Object object) { return object instanceof String; } + + /** + * 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 + * The string to be modified. + * @return The given string without space characters. + */ + public String stringToID(final String string) { + return string.replace(" ", ""); + } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/package-info.java deleted file mode 100644 index e4a52d8dd4e5f43a35d91fd4ed385b12b5583217..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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 all beans with request scope. - */ -package kieker.webgui.beans.request; - diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/AnalysisControllerBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/AnalysisControllerBean.java deleted file mode 100644 index 1996b79128a98ec4d8bf9b061fd2cd153e3df6c2..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/AnalysisControllerBean.java +++ /dev/null @@ -1,158 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import java.util.HashMap; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -import kieker.analysis.AnalysisController; -import kieker.analysis.exception.AnalysisConfigurationException; -import kieker.analysis.model.analysisMetaModel.MIPlugin; -import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.analysis.model.analysisMetaModel.MIRepository; -import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.repository.AbstractRepository; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; -import kieker.common.logging.LogImplWebguiLogging; -import kieker.webgui.common.PluginClassLoader; - -/** - * This bean contains an instance of {@link AnalysisController} and supplies methods to control the instance. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@SessionScoped -public class AnalysisControllerBean { - /** - * The logger within this class. - */ - private static final Log LOG = LogFactory.getLog(AnalysisControllerBean.class); - /** - * The controller instance stored within this bean. - */ - private AnalysisController controller; - private Map<MIPlugin, AbstractPlugin> pluginMap; - private Map<MIRepository, AbstractRepository> repositoryMap; - - /** - * Creates a new instance of this class. - */ - public AnalysisControllerBean() { - // No code necessary. - } - - public Map<MIPlugin, AbstractPlugin> getPluginMap() { - return this.pluginMap; - } - - public Map<MIRepository, AbstractRepository> getRepositoryMap() { - return this.repositoryMap; - } - - /** - * Delivers the controller stored within this bean. - * - * @return The current controller in this bean. - */ - public AnalysisController getController() { - return this.controller; - } - - /** - * Sets the controller stored within this bean to a new value. - * - * @param controller - * The new controller. - */ - public void setController(final AnalysisController controller) { - this.controller = controller; - } - - /** - * This method tries to instantiate a new controller using the given project. If the project is null, nothing happens. - * - * @param mProject - * The project used to create a new analysis controller. - */ - public void instantiate(final MIProject mProject) { - if (mProject != null) { - try { - // Try to create the controller. - final AnalysisController.AnalysisControllerWithMapping controllerAndMapping = AnalysisController.createAnalysisController(mProject, - PluginClassLoader.getInstance()); - // Extract everything that is necessary. - this.controller = controllerAndMapping.getController(); - this.pluginMap = controllerAndMapping.getPluginMap(); - this.repositoryMap = controllerAndMapping.getRepositoryMap(); - } catch (final NullPointerException ex) { - AnalysisControllerBean.LOG.error("Could not create analysis controller.", ex); - } catch (final AnalysisConfigurationException ex) { - AnalysisControllerBean.LOG.error("Could not create analysis controller.", ex); - } - } - } - - /** - * Starts asynchronously the analysis controller within this bean. - */ - public void start() { - final Thread thread = new Thread() { - @Override - public void run() { - try { - AnalysisControllerBean.this.controller.run(); - } catch (final IllegalStateException ex) { - AnalysisControllerBean.LOG.error("Could not start the analysis controller.", ex); - } catch (final AnalysisConfigurationException ex) { - AnalysisControllerBean.LOG.error("Could not start the analysis controller.", ex); - } - } - }; - thread.start(); - } - - /** - * Stops asynchronously the analysis controller within this bean. - */ - public void stop() { - final Thread thread = new Thread() { - @Override - public void run() { - AnalysisControllerBean.this.controller.terminate(); - } - }; - thread.start(); - } - - /** - * This method delivers all log entries of the class {@link AnalysisController}. - * - * @return All log entries of the analysis controller. - */ - public String[] getLogEntries() { - return LogImplWebguiLogging.getEntries(AnalysisController.class.getName()); - } -} 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 new file mode 100644 index 0000000000000000000000000000000000000000..1b5db7db7700fb661e496c3133d07032d80c8a7f --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisCockpitProjectBean.java @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.beans.session; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * This bean contains the project of the current (session) user for the analysis cockpit. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +@ManagedBean +@SessionScoped +public class CurrentAnalysisCockpitProjectBean { + + /** + * This is the page used for the redirecting during setting the current project of the user. + */ + private static final String PAGE_ANALYSIS_COCKPIT = "AnalysisCockpit.xhtml"; + /** + * This is the page used for the redirecting during closing the cockpit. + */ + private static final String PAGE_PROJECT_OVERVIEW = "ProjectOverview.xhtml"; + /** + * This is the name of the stored project. It can be used as an identifier within the FS-Manager + */ + private String projectName; + + /** + * Creates a new instance of this class. + */ + public CurrentAnalysisCockpitProjectBean() { + // No code necessary + } + + /** + * This method sets the project stored within this bean and returns the new page for the navigation. + * + * @param projectName + * The name of the project. + * @return The name of the page for the analysis cockpit. + */ + public String setProject(final String projectName) { + this.projectName = projectName; + + return CurrentAnalysisCockpitProjectBean.PAGE_ANALYSIS_COCKPIT; + } + + /** + * This method delivers the project name stored in this bean. + * + * @return The project name for this user. + */ + public String getProjectName() { + return this.projectName; + } + + /** + * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. + * + * @return The name of the page of the project overview. + */ + public String clearProject() { + this.projectName = null; + + return CurrentAnalysisCockpitProjectBean.PAGE_PROJECT_OVERVIEW; + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..f0cd345d4a8ed16c4628d399e218284d3ae3bf69 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisControllerProjectBean.java @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.beans.session; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * This bean contains the project of the current (session) user for the analysis controller page. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +@ManagedBean +@SessionScoped +public class CurrentAnalysisControllerProjectBean { + + /** + * This is the page used for the redirecting during setting the current project of the user. + */ + private static final String PAGE_ANALYSIS_CONTROLLER = "AnalysisController.xhtml"; + /** + * This is the page used for the redirecting during closing the controller. + */ + private static final String PAGE_PROJECT_OVERVIEW = "ProjectOverview.xhtml"; + /** + * This is the name of the stored project. It can be used as an identifier within the FS-Manager + */ + private String projectName; + + /** + * Creates a new instance of this class. + */ + public CurrentAnalysisControllerProjectBean() { + // No code necessary + } + + /** + * This method sets the project stored within this bean and returns the new page for the navigation. + * + * @param projectName + * The name of the project. + * @return The name of the page for the analysis controller. + */ + public String setProject(final String projectName) { + this.projectName = projectName; + + return CurrentAnalysisControllerProjectBean.PAGE_ANALYSIS_CONTROLLER; + } + + /** + * This method delivers the project name stored in this bean. + * + * @return The project name for this user. + */ + public String getProjectName() { + return this.projectName; + } + + /** + * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. + * + * @return The name of the page of the project overview. + */ + public String clearProject() { + this.projectName = null; + + return CurrentAnalysisControllerProjectBean.PAGE_PROJECT_OVERVIEW; + } +} 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 new file mode 100644 index 0000000000000000000000000000000000000000..c1c3d27e548c78a2f1ba9aaf5a029b9a391d58fd --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentAnalysisViewWorkSpaceProjectBean.java @@ -0,0 +1,88 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.beans.session; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * This bean contains the project of the current (session) user for the analysis view work space. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +@ManagedBean +@SessionScoped +public class CurrentAnalysisViewWorkSpaceProjectBean { + + /** + * This is the page used for the redirecting during setting the current project of the user. + */ + private static final String PAGE_ANALYSIS_VIEW_WORK_SPACE = "AnalysisViewWorkSpace.xhtml"; + /** + * This is the page used for the redirecting during closing the work space. + */ + private static final String PAGE_PROJECT_OVERVIEW = "ProjectOverview.xhtml"; + /** + * This is the name of the stored project. It can be used as an identifier within the FS-Manager + */ + private String projectName; + + /** + * Creates a new instance of this class. + */ + public CurrentAnalysisViewWorkSpaceProjectBean() { + // No code necessary + } + + /** + * This method sets the project stored within this bean and returns the new page for the navigation. + * + * @param projectName + * 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; + + return CurrentAnalysisViewWorkSpaceProjectBean.PAGE_ANALYSIS_VIEW_WORK_SPACE; + } + + /** + * This method delivers the project name stored in this bean. + * + * @return The project name for this user. + */ + public String getProjectName() { + return this.projectName; + } + + /** + * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. + * + * @return The name of the page of the project overview. + */ + public String clearProject() { + this.projectName = null; + + return CurrentAnalysisViewWorkSpaceProjectBean.PAGE_PROJECT_OVERVIEW; + } +} 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 58a90a81b1b8fa43d7f4777118efe729dd9b9f36..23881d9ee48e4ba32aeb9f418d21e876f231aaac 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 @@ -2,7 +2,7 @@ * Copyright 2012 by * + Christian-Albrechts-University of Kiel * + Department of Computer Science - * + Software Engineering Group + * + Software Engineering Group * and others. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,7 +32,8 @@ 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 parameters of the faces context. + * the "glass-x"-theme, if none other value can be find within the + * parameters of the faces context or in the cookies of the user. * * @author Nils Christian Ehmke * @@ -41,20 +42,20 @@ import kieker.webgui.beans.application.ThemeSwitcherBean; */ @ManagedBean @SessionScoped -public class CurrentThemeBean { +public final class CurrentThemeBean { /** * The default theme used for all users. */ private static final String DEFAULT_THEME = "glass-x"; - /** - * The key to identify the theme in the properties. - */ - private static final String KEY_THEME = "theme"; /** * The key to identify the theme in the cookie. */ private static final String KEY_COOKIE_THEME = "theme"; + /** + * The key to identify the theme in the properties. + */ + private static final String KEY_THEME = "theme"; /** * The current theme. */ @@ -100,9 +101,12 @@ public class CurrentThemeBean { public final void setTheme(final String theme) { this.theme = theme; - // Set the cookie theme. - final Cookie cookie = new Cookie("theme", theme); + // Set the theme cookie. + final Cookie cookie = new Cookie(CurrentThemeBean.KEY_COOKIE_THEME, theme); + // Try to save it for a year (maximum age) + cookie.setMaxAge(60 * 60 * 24 * 365); + // Deliver the cookie final HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addCookie(cookie); } 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 new file mode 100644 index 0000000000000000000000000000000000000000..1582a283188a80df540a79dae3678dd9592c2708 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/CurrentWorkSpaceProjectBean.java @@ -0,0 +1,352 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.beans.session; + +import java.io.IOException; +import java.lang.reflect.Modifier; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.faces.application.FacesMessage; +import javax.faces.application.FacesMessage.Severity; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIDependency; +import kieker.analysis.model.analysisMetaModel.MIProject; +import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; +import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.plugin.annotation.Plugin; +import kieker.analysis.plugin.filter.AbstractFilterPlugin; +import kieker.analysis.plugin.reader.AbstractReaderPlugin; +import kieker.analysis.repository.AbstractRepository; +import kieker.analysis.repository.annotation.Repository; +import kieker.webgui.common.FSManager; +import kieker.webgui.common.Pair; +import kieker.webgui.common.PluginFinder; +import kieker.webgui.common.exception.LibraryAlreadyExistingException; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +/** + * This bean contains the project of the current (session) user for the project work space. + * + * @author Nils Christian Ehmke + * @version 1.0 + */ +@ManagedBean +@SessionScoped +public final class CurrentWorkSpaceProjectBean { + + /** + * This is the page used for the redirecting during setting the current project of the user. + */ + private static final String PAGE_PROJECT_WORK_SPACE = "ProjectWorkSpace.xhtml"; + /** + * This is the page used for the redirecting during closing the work space. + */ + private static final String PAGE_PROJECT_OVERVIEW = "ProjectOverview.xhtml"; + /** + * This is the factory which will be used to create new components for the project. + */ + private final MIAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); + /** + * This is the actual model instance. It is the in-memory-model of the current (session) user. + */ + private MIProject project; + /** + * This is the corresponding class loader to the project. It contains always the libraries within the lib-folder of the project. + */ + private ClassLoader classLoader; + /** + * This is the name of the stored project. It can be used as an identifier within the FS-Manager + */ + private String projectName; + /** + * This is the time stamp of the moment, the project was loaded or last saved. It can be used to check whether the project has been modified in the meanwhile. + */ + private long timeStamp; + /** + * This list contains the available repositories for the current project. + */ + private final List<Class<AbstractRepository>> availableRepositories = Collections.synchronizedList(new ArrayList<Class<AbstractRepository>>()); + /** + * This list contains the available filters for the current project. + */ + private final List<Class<AbstractFilterPlugin>> availableFilters = Collections.synchronizedList(new ArrayList<Class<AbstractFilterPlugin>>()); + /** + * This list contains the available readers for the current project. + */ + private final List<Class<AbstractReaderPlugin>> availableReaders = Collections.synchronizedList(new ArrayList<Class<AbstractReaderPlugin>>()); + + /** + * Creates a new instance of this class. + */ + public CurrentWorkSpaceProjectBean() { + // No code necessary + } + + /** + * This method delivers the project stored in this bean. + * + * @return The project for this user. + */ + public MIProject getProject() { + return this.project; + } + + /** + * This method sets the project stored within this bean and returns the new page for the navigation - depending on the given values. + * + * @param project + * The project to be stored within this bean. + * @param projectName + * 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) { + // Remember the given parameters + this.project = project; + this.projectName = projectName; + // Remember the current time! This is important for the later comparison of the time stamps. + this.resetTimeStamp(); + // Update the class loader + this.reloadClassLoader(); + // Add the libraries within the lib-folder to the current model + this.addLibrariesToModel(); + // Load the available readers, filters and repositories + this.loadToolPalette(); + + // Now deliver the correct navigation page + return (this.project != null) ? CurrentWorkSpaceProjectBean.PAGE_PROJECT_WORK_SPACE : ""; + } + + /** + * This method loads the list of available readers, filters and repositories, using the current libraries within the model. + */ + private void loadToolPalette() { + // Clean our tool palette + this.availableFilters.clear(); + this.availableReaders.clear(); + this.availableRepositories.clear(); + + // Make sure there is a project. + if (this.project != null) { + // Run through all libraries + for (final MIDependency lib : this.project.getDependencies()) { + this.addToToolPalette(lib); + } + } + } + + /** + * This method adds all available readers, filters and repositories within the given library to the lists of this bean. + * + * @param lib + * The library used to load the plugins and repositories. + */ + private void addToToolPalette(final MIDependency lib) { + try { + final List<Class<AbstractRepository>> repositories = PluginFinder.getAllRepositoriesWithinJar(FSManager.getInstance().getURL(lib, this.projectName), + this.classLoader); + final List<Class<AbstractPlugin>> plugins = PluginFinder.getAllPluginsWithinJar(FSManager.getInstance().getURL(lib, this.projectName), + this.classLoader); + // Now run through the available classes and add all non-abstract classes to our lists + for (final Class<AbstractRepository> repository : repositories) { + if (!Modifier.isAbstract(repository.getModifiers())) { + this.availableRepositories.add(repository); + } + } + for (final Class<? extends AbstractPlugin> plugin : plugins) { + if (!Modifier.isAbstract(plugin.getModifiers())) { + if (AbstractFilterPlugin.class.isAssignableFrom(plugin)) { + this.availableFilters.add((Class<AbstractFilterPlugin>) plugin); + } else { + if (AbstractReaderPlugin.class.isAssignableFrom(plugin)) { + this.availableReaders.add((Class<AbstractReaderPlugin>) plugin); + } + } + } + } + } catch (final MalformedURLException ex) { + ex.printStackTrace(); + } + } + + /** + * This method takes all libraries from the lib-folder and adds them to the in-memory-model. + */ + private void addLibrariesToModel() { + final List<MIDependency> libs = FSManager.getInstance().getModelLibraries(this.projectName); + this.project.getDependencies().addAll(libs); + } + + /** + * This method reloads the class loader. In other words: The class loader will always be able to load classes from the jar-files within the lib-folder of the + * project. + */ + private void reloadClassLoader() { + this.classLoader = FSManager.getInstance().getClassLoader(this.projectName); + } + + /** + * This method sets the time stamp to the current system time. + */ + public void resetTimeStamp() { + this.timeStamp = System.currentTimeMillis(); + } + + /** + * This method delivers the project name stored in this bean. + * + * @return The project name for this user. + */ + public String getProjectName() { + return this.projectName; + } + + /** + * This method delivers the current time stamp. + * + * @return The time stamp for this user. + */ + public long getTimeStamp() { + return this.timeStamp; + } + + /** + * This method clears the bean. In other words: The stored project is set to null and it will return the page of the project overview for navigation purposes. + * + * @return The name of the page of the project overview. + */ + public String clearProject() { + this.project = null; + this.projectName = null; + this.timeStamp = 0; + + return CurrentWorkSpaceProjectBean.PAGE_PROJECT_OVERVIEW; + } + + /** + * This method can be used to get the description of an {@link AbstractPlugin}- or an {@link AbstractRepository}-class. The description is read via the + * annotation. + * + * @param clazz + * The class whose description should be extracted. + * @return The description for the class or a substitute if none is available. This is in either case human readable. + */ + public String getDescription(final Class<?> clazz) { + // Get the two potential annotations + final Plugin annotationPlugin = clazz.getAnnotation(Plugin.class); + final Repository annotationRepository = clazz.getAnnotation(Repository.class); + + // Now check which one of them is available + if ((annotationPlugin == null) || annotationPlugin.description().isEmpty()) { + if ((annotationRepository == null) || annotationRepository.description().isEmpty()) { + // None. Deliver a human readable substitute. + return "No description available"; + } else { + return annotationRepository.description(); + } + } else { + return annotationPlugin.description(); + } + } + + /** + * This method is the handler for the file upload. It tries to upload the given file and informs the user via the growl-component. + * + * @param event + * The upload event. + */ + public void handleFileUpload(final FileUploadEvent event) { + // Get the file from the event + final UploadedFile file = event.getFile(); + + try { + // Use the file system manager to upload the new file + final MIDependency lib = FSManager.getInstance().uploadLibrary(file, this.projectName); + CurrentWorkSpaceProjectBean.showMessage(FacesMessage.SEVERITY_INFO, "Libary uploaded."); + // As it seem to have worked, we can add the library to our model. + this.project.getDependencies().add(lib); + // Update our class loader + this.reloadClassLoader(); + } catch (final LibraryAlreadyExistingException ex) { + CurrentWorkSpaceProjectBean.showMessage(FacesMessage.SEVERITY_WARN, "A library with the same name exists already."); + } catch (final IOException ex) { + CurrentWorkSpaceProjectBean.showMessage(FacesMessage.SEVERITY_ERROR, "An error occured while uploading the library."); + } + } + + /** + * This method delivers the available libraries of this project as a pair of strings. The first element is the name of the library, the second one te size in + * MiBytes as human readable string. + * + * @return The available libraries. + */ + public List<Pair<String, String>> getLibraries() { + return FSManager.getInstance().getLibraries(this.projectName); + } + + /** + * This method delivers the available reader-plugins for the current main project. The delivered plugins are never abstract. + * + * @return A list with all readers. + */ + public final List<Class<AbstractReaderPlugin>> getAvailableReaders() { + return this.availableReaders; + } + + /** + * This method delivers the available filter-plugins for the current main project. The delivered plugins are never abstract. + * + * @return A list with all filter. + */ + public final List<Class<AbstractFilterPlugin>> getAvailableFilters() { + return this.availableFilters; + } + + /** + * This method delivers the available repositories for the current main project. The delivered repositories are never abstract. + * + * @return A list with all repositories. + */ + public final List<Class<AbstractRepository>> getAvailableRepositories() { + return this.availableRepositories; + } + + /** + * This method shows the current user a message by using the growl-component of PrimeFaces. + * + * @param severity + * The severity of the message. + * @param msg + * The message itself. + */ + private static void showMessage(final Severity severity, final String msg) { + FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, "", msg)); + } +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DashboardBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DashboardBean.java deleted file mode 100644 index 57c57af1c38f908f4bf110ffe2027423a84af6cd..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DashboardBean.java +++ /dev/null @@ -1,161 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import javax.annotation.PostConstruct; -import javax.faces.application.Application; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.component.html.HtmlOutputText; -import javax.faces.context.FacesContext; - -import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.beans.application.ProjectsBean.Widget; - -import org.primefaces.component.dashboard.Dashboard; -import org.primefaces.component.panel.Panel; -import org.primefaces.event.DashboardReorderEvent; -import org.primefaces.model.DashboardModel; -import org.primefaces.model.DefaultDashboardColumn; -import org.primefaces.model.DefaultDashboardModel; - -/** - * This bean can be used to handle an instance of {@link Dashboard} including a list of {@code Widget}. It makes sure that new widget-instances can be added - * dynamically. - * - * @author Nils Christian Ehmke - */ -@SessionScoped -@ManagedBean -public class DashboardBean implements Serializable { - - /** - * This is the prefix used to the widgets within the component. - */ - private static final String WIDGET_ID_PREFIX = "widget_"; - - /** - * This is the dashboard to be controlled by this instance. - */ - private Dashboard dashboard; - /** - * This is the model used to fill the dasboard. - */ - private DashboardModel dashboardModel; - /** - * This is the list containing all widgets. - */ - private final List<Widget> widgets = new ArrayList<ProjectsBean.Widget>(); - - /** - * Creates a new instance of this class. - */ - public DashboardBean() { - // No code necessary. - } - - @PostConstruct - public void init() { - final FacesContext fc = FacesContext.getCurrentInstance(); - final Application application = fc.getApplication(); - - // Add three columns for the model - this.dashboardModel = new DefaultDashboardModel(); - this.dashboardModel.addColumn(new DefaultDashboardColumn()); - this.dashboardModel.addColumn(new DefaultDashboardColumn()); - this.dashboardModel.addColumn(new DefaultDashboardColumn()); - - this.dashboard = (Dashboard) application.createComponent(fc, "org.primefaces.component.Dashboard", "org.primefaces.component.DashboardRenderer"); - this.dashboard.setId("dashboard"); - this.dashboard.setModel(this.dashboardModel); - - this.addChildren(); - } - - /** - * This method can be used to update the UI children of the dashboard. - */ - private void addChildren() { - synchronized (this) { - // Clear the list with the children to avoid double IDs. - this.dashboard.getChildren().clear(); - - final FacesContext fc = FacesContext.getCurrentInstance(); - final Application application = fc.getApplication(); - - // Run through all widgets and add a panel for each of them. - for (int i = 0; i < this.widgets.size(); i++) { - final Panel panel = (Panel) application.createComponent(fc, "org.primefaces.component.Panel", "org.primefaces.component.PanelRenderer"); - panel.setId(DashboardBean.WIDGET_ID_PREFIX + i); - panel.setHeader(this.widgets.get(i).getName()); - panel.setClosable(true); - panel.setToggleable(true); - - this.dashboard.getChildren().add(panel); - - final HtmlOutputText text = new HtmlOutputText(); - text.setId("t" + DashboardBean.WIDGET_ID_PREFIX + i); - text.setValue(this.widgets.get(i).getType()); - panel.getChildren().add(text); - } - } - } - - /** - * Delivers the currently stored dashboard. - * - * @return The dashboard. - */ - public Dashboard getDashboard() { - this.addChildren(); - return this.dashboard; - } - - public void setDashboard(final Dashboard dashboard) { - this.dashboard = dashboard; - } - - /** - * Adds a new widget to the list. - * - * @param widget - * The widget to be add to the bean. - */ - public void addWidget(final Widget widget) { - // Add the widget and add it to the model as well. - synchronized (this) { - this.widgets.add(widget); - this.dashboardModel.getColumn(new Random().nextInt(3)).addWidget(DashboardBean.WIDGET_ID_PREFIX + (this.widgets.size() - 1)); - } - - // Update the UI - this.addChildren(); - } - - public void handleReorder(final DashboardReorderEvent event) { - // Nothing to do yet - this.addChildren(); - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DependencyUploadBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DependencyUploadBean.java deleted file mode 100644 index dd3714d7c7f764674a386904904ea6eeb6b9cdfd..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/DependencyUploadBean.java +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -import kieker.webgui.beans.application.DependenciesBean; - -import org.primefaces.model.UploadedFile; - -/** - * This bean is a session bean and can be used to store and upload a new dependency. It accesses the application instance of <code>DependenciesBean</code> directly. - * - * @see DependenciesBean - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@SessionScoped -public class DependencyUploadBean { - - /** - * The file stored within this bean. - */ - private UploadedFile file; - - /** - * Creates a new instance of this class. - */ - public DependencyUploadBean() { - // No code necessary. - } - - /** - * Delivers the instance stored within this bean. - * - * @return The currently stored value within this bean. - */ - public UploadedFile getFile() { - return this.file; - } - - /** - * Sets the new value of the bean. - * - * @param file - * The file instance to be stored within this bean. - */ - public void setFile(final UploadedFile file) { - this.file = file; - } - - /** - * Tries to upload the currently stored value within this bean. - */ - public void upload() { - if (this.file != null) { - final FacesContext context = FacesContext.getCurrentInstance(); - final DependenciesBean bean = context.getApplication().evaluateExpressionGet(context, "#{dependenciesBean}", - DependenciesBean.class); - if (bean != null) { - bean.uploadDependency(this.file); - } - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java deleted file mode 100644 index 7342da3369b965381d18c929404895dd18bda46c..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedMainProjectBean.java +++ /dev/null @@ -1,531 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Observable; -import java.util.Observer; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.faces.application.FacesMessage; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.analysis.model.analysisMetaModel.MIFilter; -import kieker.analysis.model.analysisMetaModel.MIInputPort; -import kieker.analysis.model.analysisMetaModel.MIOutputPort; -import kieker.analysis.model.analysisMetaModel.MIPlugin; -import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.analysis.model.analysisMetaModel.MIProperty; -import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; -import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.filter.AbstractFilterPlugin; -import kieker.analysis.plugin.reader.AbstractReaderPlugin; -import kieker.analysis.repository.AbstractRepository; -import kieker.common.configuration.Configuration; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; -import kieker.webgui.beans.application.ProjectsBean; -import kieker.webgui.common.Connection; -import kieker.webgui.common.FileManager; -import kieker.webgui.common.PluginClassLoader; -import kieker.webgui.common.PluginFinder; - -import org.eclipse.emf.common.util.EList; -import org.primefaces.context.RequestContext; - -/** - * This session bean stores the currently selected main project of the user and provides different methods to access and manipulate the properties of this project. - * It is possible that this bean accesses other beans directly. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@SessionScoped -public class SelectedMainProjectBean extends Observable implements Observer { - /** - * The logger within this class. - */ - private static final Log LOG = LogFactory.getLog(SelectedMainProjectBean.class); - /** - * The error message used if a plugin could not be instantiated for various reasons. - */ - private static final String ERR_MSG_LOAD_PLUGIN = "Could not instantiate plugin."; - /** - * The error message used if dependency could not loaded due to an invalid URL. - */ - private static final String ERR_MSG_INVALID_URL = "Invalid URL for dependency."; - /** - * This constant is used as the host for the dependencies. - */ - private static final String URL_LOCALHOST = "localhost"; - /** - * This constant is used as a protocol for the dependencies. - */ - private static final String URL_PROTOCOL_FILE = "file"; - - /** - * This collection contains all targets within the current view which will be updated when the selection of the main project changes. - */ - private static final Collection<String> UPDATE_TARGETS = Collections.unmodifiableCollection(Arrays.asList(new String[] { "projectsForm", "toolpalette", - "centerForm", })); - - /** - * The main project of the current user. - */ - private MIProject mainProject; - /** - * This list contains the connections (between the filters) within the current main project. - */ - private List<Connection> connections; - - private final ProjectsBean observableBean; - - /** - * Creates a new instance of this class. - */ - public SelectedMainProjectBean() { - // Make sure that the collection for the connection is not empty. This will make the iteration over the collection - this.connections = new ArrayList<Connection>(); - - // Try to get the projects bean. - final FacesContext context = FacesContext.getCurrentInstance(); - this.observableBean = context.getApplication().evaluateExpressionGet(context, "#{projectsBean}", ProjectsBean.class); - } - - /** - * Delivers the main project of the current user. It can be null. - * - * @return The user's main project. - */ - public final MIProject getMainProject() { - return this.mainProject; - } - - /** - * Sets the main project of the current user. - * - * @param mainProject - * The new main project of the current user. - */ - public final void setMainProject(final MIProject mainProject) { - // Overtake the main project and its connection. - this.mainProject = mainProject; - this.connections = this.getConnectionsFromProject(); - - // In the case we haven't set the main project to null, we inform the user about the change. - if (this.mainProject != null) { - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", "New main project: " + mainProject.getName())); - } - - // Inform the observers - this.setChanged(); - this.notifyObservers(new MsgMainProjectSelection(mainProject)); - - // Update the corresponding components - final RequestContext requestContext = RequestContext.getCurrentInstance(); - requestContext.addPartialUpdateTargets(SelectedMainProjectBean.UPDATE_TARGETS); - } - - /** - * This method delivers the available reader-plugins for the current main project. The delivered plugins are never abstract. - * - * @return A list with all readers. - */ - public final List<Class<AbstractReaderPlugin>> getAvailableReaders() { - final List<Class<AbstractReaderPlugin>> list = new ArrayList<Class<AbstractReaderPlugin>>(); - - // Make sure there is a main project. - if (this.mainProject != null) { - // Run through all libraries - for (final MIDependency lib : this.mainProject.getDependencies()) { - // Make sure the plugin class loader knows about the lib - try { - PluginClassLoader.getInstance().addURL( - new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - // Now try to find the plugins within the library and extract the readers. - try { - final List<Class<AbstractPlugin>> plugins = PluginFinder.getAllPluginsWithinJar(new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, - SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - for (final Class<?> plugin : plugins) { - if (!Modifier.isAbstract(plugin.getModifiers()) && AbstractReaderPlugin.class.isAssignableFrom(plugin)) { - list.add((Class<AbstractReaderPlugin>) plugin); - } - } - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - } - } - - return list; - } - - /** - * This method delivers the available filter-plugins for the current main project. The delivered plugins are never abstract. - * - * @return A list with all filter. - */ - public final List<Class<AbstractFilterPlugin>> getAvailableFilters() { - final List<Class<AbstractFilterPlugin>> list = new ArrayList<Class<AbstractFilterPlugin>>(); - - if (this.mainProject != null) { - for (final MIDependency lib : this.mainProject.getDependencies()) { - try { - PluginClassLoader.getInstance().addURL( - new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - try { - final List<Class<AbstractPlugin>> plugins = PluginFinder.getAllPluginsWithinJar(new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, - SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - for (final Class<?> plugin : plugins) { - if (!Modifier.isAbstract(plugin.getModifiers()) && AbstractFilterPlugin.class.isAssignableFrom(plugin)) { - list.add((Class<AbstractFilterPlugin>) plugin); - } - } - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - } - } - - return list; - - } - - /** - * This method delivers the available repositories for the current main project. The delivered repositories are never abstract. - * - * @return A list with all repositories. - */ - public final List<Class<AbstractRepository>> getAvailableRepositories() { - final List<Class<AbstractRepository>> list = new ArrayList<Class<AbstractRepository>>(); - - if (this.mainProject != null) { - for (final MIDependency lib : this.mainProject.getDependencies()) { - try { - PluginClassLoader.getInstance().addURL( - new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - try { - final List<Class<AbstractRepository>> repositories = PluginFinder.getAllRepositoriesWithinJar(new URL(SelectedMainProjectBean.URL_PROTOCOL_FILE, - SelectedMainProjectBean.URL_LOCALHOST, FileManager.getInstance().getFullPath(lib))); - for (final Class<AbstractRepository> repository : repositories) { - if (!Modifier.isAbstract(repository.getModifiers())) { - list.add(repository); - } - } - } catch (final MalformedURLException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_INVALID_URL, ex); - } - } - } - - return list; - - } - - /** - * This method uses the actual plugin to create the model configuration instances and add them to the model plugin instance. - * - * @param plugin - * The plugin whose configuration will be used. - * @param mPlugin - * The model plugin which will be modified. - */ - private static void addConfiguration(final AbstractPlugin plugin, final MIPlugin mPlugin) { - // Get the current configuration and use it to initialize the model plugin. - final Configuration configuration = plugin.getCurrentConfiguration(); - final MAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - - // Run through all entries. - final Iterator<Map.Entry<Object, Object>> iterator = configuration.entrySet().iterator(); - while (iterator.hasNext()) { - final Map.Entry<Object, Object> entry = iterator.next(); - // Create a property object for the current entry. - final MIProperty property = factory.createProperty(); - property.setName(entry.getKey().toString()); - property.setValue(entry.getValue().toString()); - - mPlugin.getProperties().add(property); - } - } - - /** - * This method uses the actual plugin to create the model port instances and add them to the model plugin instance. - * - * @param plugin - * The plugin whose ports will be used. - * @param mPlugin - * The model plugin which will be modified. - */ - private static void addPorts(final AbstractPlugin plugin, final MIPlugin mPlugin) { - // Get the port and use them to initialize the model plugin. - final String[] inputPortNames = plugin.getAllInputPortNames(); - final String[] outputPortNames = plugin.getAllOutputPortNames(); - - final MAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - - if (mPlugin instanceof MIFilter) { - for (final String inputPortName : inputPortNames) { - final MIInputPort mInputPort = factory.createInputPort(); - mInputPort.setName(inputPortName); - mInputPort.setParent((MIFilter) mPlugin); - } - } - - for (final String outputPortName : outputPortNames) { - final MIOutputPort mOutputPort = factory.createOutputPort(); - mOutputPort.setName(outputPortName); - mOutputPort.setParent(mPlugin); - } - } - - /** - * This method can be used to add a model plugin instance to the current main project using the given class. - * - * @param pluginClass - * The class which will be instantiated. - */ - public final void addPlugin(final Class<AbstractPlugin> pluginClass) { - final MAnalysisMetaModelFactory factory = new MAnalysisMetaModelFactory(); - - try { - final AbstractPlugin plugin = pluginClass.getConstructor(Configuration.class).newInstance(new Configuration()); - MIPlugin mPlugin; - - if (AbstractReaderPlugin.class.isAssignableFrom(pluginClass)) { - mPlugin = factory.createReader(); - } else { - mPlugin = factory.createFilter(); - } - - mPlugin.setClassname(pluginClass.getCanonicalName()); - mPlugin.setName(pluginClass.getSimpleName()); - SelectedMainProjectBean.addConfiguration(plugin, mPlugin); - SelectedMainProjectBean.addPorts(plugin, mPlugin); - - this.mainProject.getPlugins().add(mPlugin); - - } catch (final InstantiationException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } catch (final NoSuchMethodException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } catch (final SecurityException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } catch (final IllegalAccessException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } catch (final IllegalArgumentException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } catch (final InvocationTargetException ex) { - SelectedMainProjectBean.LOG.warn(SelectedMainProjectBean.ERR_MSG_LOAD_PLUGIN, ex); - } - - } - - /** - * This method removes a given model plugin instance from the current main project. If this is the currently selected plugin from the user, it will be deselected - * as well. This means that this method accesses the <code>SelectedPluginBean</code> directly. - * - * @param plugin - * The project to be removed. - */ - public final void removePlugin(final MIPlugin plugin) { - // TODO Replace with an observer - this.mainProject.getPlugins().remove(plugin); - - // Get the currently selected plugin bean. - final SelectedPluginBean selectedPluginBean = (SelectedPluginBean) FacesContext.getCurrentInstance().getExternalContext() - .getSessionMap().get("selectedPluginBean"); - if (selectedPluginBean != null && selectedPluginBean.getPlugin() == plugin) { - selectedPluginBean.setPlugin((MIPlugin) null); - } - } - - /** - * This method extracts the connections between the filters from the current main project. - * - * @return A list with all connections available. - */ - private List<Connection> getConnectionsFromProject() { - final List<Connection> result = new ArrayList<Connection>(); - - if (this.mainProject != null) { - final EList<MIPlugin> mPlugins = this.mainProject.getPlugins(); - for (final MIPlugin mPlugin : mPlugins) { - final EList<MIOutputPort> mOutputPorts = mPlugin.getOutputPorts(); - for (final MIOutputPort mOutputPort : mOutputPorts) { - final EList<MIInputPort> mInputPorts = mOutputPort.getSubscribers(); - for (final MIInputPort mInputPort : mInputPorts) { - result.add(new Connection(mPlugin, mInputPort.getParent(), mInputPort, mOutputPort)); - } - } - } - } - - return result; - } - - /** - * Delivers the connections (between the filters) within the current main project. - * - * @return A list containing all available connections. - */ - public List<Connection> getConnections() { - return this.connections; - } - - /** - * Delivers the valid connections (between the filters) within the current main project. - * - * @return A list containing all available and valid connections. - */ - public List<Connection> getValidConnections() { - final List<Connection> validConnections = new ArrayList<Connection>(); - final List<Connection> availableConnections = this.getConnections(); - - for (final Connection connection : availableConnections) { - if (connection.isValid()) { - validConnections.add(connection); - } - } - - return validConnections; - } - - /** - * This method adds an empty connection to the current main project. - */ - public void addConnection() { - this.connections.add(new Connection(null, null, null, null)); - } - - /** - * This method "submits" the current connections to the main project (In other words: The connections will be stored within the main project). - */ - public void submitConnections() { - for (final Connection connection : this.connections) { - if (connection.isValid()) { - connection.getOutputPort().getSubscribers().add(connection.getInputPort()); - } - } - } - - /** - * This method returns all available filters of the current main project. In other words: It returns the same as mainProject.getPlugin() but only those which are - * really instances of {@link MIFilter}. - * - * @return A list with all filters of the main project. - */ - public List<MIFilter> getFilters() { - final List<MIFilter> result = new ArrayList<MIFilter>(); - final List<MIPlugin> plugins = this.mainProject.getPlugins(); - - for (final MIPlugin plugin : plugins) { - if (plugin instanceof MIFilter) { - result.add((MIFilter) plugin); - } - } - - return result; - } - - /** - * This method is used to initialize the object after creation. - */ - @PostConstruct - @SuppressWarnings("FinalPrivateMethod") - private final void postConstruct() { - // Register this instance as an observer - this.observableBean.addObserver(this); - } - - /** - * This method is used to finalize the object before destruction. - */ - @PreDestroy - @SuppressWarnings("FinalPrivateMethod") - private final void preDestroy() { - // Unregister this instance as an observer - this.observableBean.deleteObserver(this); - } - - @Override - public void update(final Observable o, final Object arg) { - // If the current main project has just been removed, we have to set the current main project to null. - if (arg instanceof ProjectsBean.MsgProjectRemoved && ((ProjectsBean.MsgProjectRemoved) arg).getProject() == this.mainProject) { - this.setMainProject(null); - } - } - - /** - * This helper class is a wrapper for a project and can be send to the observers as a message that the main project selection just has been changed. It contains - * the newly selected main project. - * - * @author Nils Christian Ehmke - */ - public static final class MsgMainProjectSelection { - /** - * The stored project. - */ - private final MIProject project; - - /** - * Creates a new instance of this class using the given parameters. - * - * @param project - * The project to be stored within this class. - */ - public MsgMainProjectSelection(final MIProject project) { - this.project = project; - } - - /** - * Delivers the stored project within this class. - * - * @return The instance of {@link MIProject}. - */ - public MIProject getProject() { - return this.project; - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedPluginBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedPluginBean.java deleted file mode 100644 index 75a92f88064b1140fe309e9a7a9cccc7cbf84fe8..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedPluginBean.java +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import java.util.ArrayList; -import java.util.List; -import java.util.Observable; -import java.util.Observer; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -import kieker.analysis.model.analysisMetaModel.MIPlugin; - -import org.primefaces.context.RequestContext; - -/** - * This bean can be used to save the currently selected plugin of the user. This bean registers to the user's instance of {@link SelectedMainProjectBean} as an - * observer. If the main project changes, the content of this bean changes as well. This bean also updates the properties form if the selection of the plugin - * changes. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@SessionScoped -public final class SelectedPluginBean implements Observer { - - /** - * This is the name of the target element to be updated when the plugin selection changes. - */ - private static final String UPDATE_TARGET = "propertiesForm"; - - /** - * This is the main project bean where this instance registers as an observer. - */ - private final SelectedMainProjectBean observableBean; - - /** - * The plugin which is stored by this container. - */ - private MIPlugin plugin; - - /** - * Creates a new instance of this class. - */ - public SelectedPluginBean() { - // Try to get the main project bean. - final FacesContext context = FacesContext.getCurrentInstance(); - this.observableBean = context.getApplication().evaluateExpressionGet(context, "#{selectedMainProjectBean}", SelectedMainProjectBean.class); - } - - /** - * This method is used to initialize the object after creation. - */ - @PostConstruct - @SuppressWarnings("FinalPrivateMethod") - private final void postConstruct() { - // Register this instance as an observer - this.observableBean.addObserver(this); - } - - /** - * This method is used to finalize the object before destruction. - */ - @PreDestroy - @SuppressWarnings("FinalPrivateMethod") - private final void preDestroy() { - // Unregister this instance as an observer - this.observableBean.deleteObserver(this); - } - - /** - * Delivers the stored plugin. - * - * @return The plugin within this container. - */ - public MIPlugin getPlugin() { - return this.plugin; - } - - /** - * Sets the plugin stored by this bean and updates (if possible) the corresponding element in the current context. - * - * @param plugin - * The new bean to be stored within this bean. - */ - public void setPlugin(final MIPlugin plugin) { - this.plugin = plugin; - - // Update the corresponding components - final RequestContext requestContext = RequestContext.getCurrentInstance(); - requestContext.addPartialUpdateTarget(SelectedPluginBean.UPDATE_TARGET); - } - - /** - * This method delivers a list containing all properties of the current plugin, but adds the name as a string to it. - * - * @return A list with all properties plus the name (as a string). If no plugin is selected, this method returns an empty list, never null. - */ - public List<Object> getAdvancedProperties() { - final List<Object> resultList = new ArrayList<Object>(); - - if (this.plugin != null) { - resultList.add(this.plugin.getName()); - resultList.addAll(this.plugin.getProperties()); - } - - return resultList; - } - - @Override - public void update(final Observable o, final Object arg) { - // If the main project has been newly selected, we have to set the current plugin to null - if (arg instanceof SelectedMainProjectBean.MsgMainProjectSelection) { - this.setPlugin(null); - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedProjectBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedProjectBean.java deleted file mode 100644 index 537a3e1878da4a2014a8ebc0109aec76862289b5..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/SelectedProjectBean.java +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.beans.session; - -import java.util.Observable; -import java.util.Observer; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.webgui.beans.application.ProjectsBean; - -import org.primefaces.event.NodeSelectEvent; -import org.primefaces.model.TreeNode; - -/** - * This bean can be used to store the currently selected project and the current main project for the user within a session. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@ManagedBean -@SessionScoped -public class SelectedProjectBean implements Observer { - - /** - * The currently selected node of the current user. - */ - private TreeNode selectedNode; - /** - * The selected project of the current user. - */ - private MIProject selectedProject; - - private final ProjectsBean observableBean; - - /** - * Creates a new instance of this class. - */ - public SelectedProjectBean() { - // Try to get the projects bean. - final FacesContext context = FacesContext.getCurrentInstance(); - this.observableBean = context.getApplication().evaluateExpressionGet(context, "#{projectsBean}", ProjectsBean.class); - } - - /** - * Delivers the project currently selected by the user. It can be null. - * - * @return The user's currently selected project. - */ - public final MIProject getSelectedProject() { - return this.selectedProject; - } - - /** - * Sets the currently selected project within the bean. - * - * @param selectedProject - * The selected project. - */ - public final void setSelectedProject(final MIProject selectedProject) { - this.selectedProject = selectedProject; - } - - /** - * Delivers the currently selected node. - * - * @return The selected node. - */ - public final TreeNode getSelectedNode() { - return this.selectedNode; - } - - /** - * This event should be triggered once a new node is selected to make sure that the newly selected node is stored within this bean. - * - * @param event - * The event that a node has been selected by the user. - */ - public final void onNodeSelect(final NodeSelectEvent event) { - this.setSelectedNode(event.getTreeNode()); - } - - /** - * Sets the currently selected node to a new value. - * - * @param selectedNode - * The selected node. - */ - public final void setSelectedNode(final TreeNode selectedNode) { - this.selectedNode = selectedNode; - if (selectedNode != null && selectedNode.getData() instanceof MIProject) { - this.setSelectedProject((MIProject) selectedNode.getData()); - } else { - this.setSelectedProject(null); - } - } - - /** - * This method is used to initialize the object after creation. - */ - @PostConstruct - @SuppressWarnings("FinalPrivateMethod") - private final void postConstruct() { - // Register this instance as an observer - this.observableBean.addObserver(this); - } - - /** - * This method is used to finalize the object before destruction. - */ - @PreDestroy - @SuppressWarnings("FinalPrivateMethod") - private final void preDestroy() { - // Unregister this instance as an observer - this.observableBean.deleteObserver(this); - } - - @Override - public void update(final Observable o, final Object arg) { - // If the current main project has just been removed, we have to set the current main project to null. - if (arg instanceof ProjectsBean.MsgProjectRemoved && ((ProjectsBean.MsgProjectRemoved) arg).getProject() == this.selectedProject) { - this.setSelectedProject(null); - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java similarity index 53% rename from Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/package-info.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java index 41ada39c7a4ad5ab87a55c72aba17fa2bd4a83d3..91895aad7399b8f80c7f9a6ec3ebb3833f0485dd 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/package-info.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/beans/session/UserBean.java @@ -2,7 +2,7 @@ * Copyright 2012 by * + Christian-Albrechts-University of Kiel * + Department of Computer Science - * + Software Engineering Group + * + Software Engineering Group * and others. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,8 +18,40 @@ * limitations under the License. ***************************************************************************/ +package kieker.webgui.beans.session; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + /** - * This package contains all beans with session scope. + * This bean will later contain the informations about the user of this session (like user name and authorization). For the moment every user will be a guest user. + * + * @author Nils Christian Ehmke + * @version 1.0 */ -package kieker.webgui.beans.session; +@ManagedBean +@SessionScoped +public final class UserBean { + + /** + * This field contains the name of the user. + */ + private final String userName; + + /** + * Creates a new instance of this class. The user name is set to "Guest". + */ + public UserBean() { + this.userName = "Guest"; + } + + /** + * Returns the name of the user of the current session. + * + * @return The user name. + */ + public String getUserName() { + return this.userName; + } +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java deleted file mode 100644 index 70a9ce1874b85b374784405a18ad22ba5c61cd3e..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Connection.java +++ /dev/null @@ -1,168 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.common; - -import kieker.analysis.model.analysisMetaModel.MIInputPort; -import kieker.analysis.model.analysisMetaModel.MIOutputPort; -import kieker.analysis.model.analysisMetaModel.MIPlugin; - -/** - * This class is a helper class containing a connection between two filters. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -public class Connection { - - /** - * The source filter. - */ - private MIPlugin source; - /** - * The destination filter. - */ - private MIPlugin destination; - /** - * The input port which will be used from the destination. - */ - private MIInputPort inputPort; - /** - * The output port which will be used from the source. - */ - private MIOutputPort outputPort; - - /** - * Creates a new instance of this class using the given parameters. - * - * @param source - * The source filter. - * @param destination - * The destination filter. - * @param inputPort - * The input port which will be used from the destination. - * @param outputPort - * The output port which will be used from the source. - */ - public Connection(final MIPlugin source, final MIPlugin destination, final MIInputPort inputPort, final MIOutputPort outputPort) { - this.source = source; - this.destination = destination; - this.inputPort = inputPort; - this.outputPort = outputPort; - } - - /** - * Delivers the current destination. - * - * @return The destination filter. - */ - public MIPlugin getDestination() { - return this.destination; - } - - /** - * Sets the new destination. - * - * @param destination - * The new destination filter. - */ - public void setDestination(final MIPlugin destination) { - this.destination = destination; - // Make sure that the output port is always valid - if necessary even null. - if (this.destination == null) { - this.outputPort = null; - } - } - - /** - * Delivers the current input port. - * - * @return The input port which will be used from the destination. - */ - public MIInputPort getInputPort() { - return this.inputPort; - } - - /** - * Sets the input port to a new value. - * - * @param inputPort - * The new input port which will be used from the destination. - */ - public void setInputPort(final MIInputPort inputPort) { - this.inputPort = inputPort; - } - - /** - * Delivers the current output port. - * - * @return The output port which will be used from the source. - */ - public MIOutputPort getOutputPort() { - return this.outputPort; - } - - /** - * Sets the new output port. - * - * @param outputPort - * The new output port which will be used from the source. - */ - public void setOutputPort(final MIOutputPort outputPort) { - this.outputPort = outputPort; - } - - /** - * Delivers the source filter. - * - * @return The source filter. - */ - public MIPlugin getSource() { - return this.source; - } - - /** - * Sets the source filter to a new value. - * - * @param source - * The new source filter. - */ - public void setSource(final MIPlugin source) { - this.source = source; - // Make sure that the input port is always valid - if necessary even null. - if (this.source == null) { - this.inputPort = null; - } - } - - /** - * Checks whether the current configuration is valid. The configuration is valid if and only if: All four components are not null, the ports exist and are - * compatible. - * - * @return true if and only if all four components are not null, the ports exist and are compatible. - */ - public boolean isValid() { - if (this.source == null || this.destination == null || this.inputPort == null || this.outputPort == null) { - return false; - } - // TODO: This is currently not necessarily valid - return true; - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java new file mode 100644 index 0000000000000000000000000000000000000000..47c3f517a5b93026c7eaa89be586b196fe067a2e --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FSManager.java @@ -0,0 +1,437 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.common; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.math.RoundingMode; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +import kieker.analysis.AnalysisController; +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIDependency; +import kieker.analysis.model.analysisMetaModel.MIProject; +import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; +import kieker.common.logging.Log; +import kieker.common.logging.LogFactory; +import kieker.webgui.common.exception.LibraryAlreadyExistingException; +import kieker.webgui.common.exception.ProjectAlreadyExistingException; + +import org.primefaces.model.UploadedFile; + +/** + * This is a singleton class for the access to the file system. It makes sure that the necessary directories for the execution of the application exist. <b>Do + * not</b> remove directories created from this manager during runtime! Directories are created during first access to the class.<br> + * This class uses also a fine grained synchronization to handle the access to the projects. + * + * @author Nils Christian Ehmke + */ +public final class FSManager { + + /** + * This is the singleton instance of this class. + */ + private static final FSManager INSTANCE = new FSManager(); + /** + * This is the extension of the KAX-files. + */ + private static final String KAX_EXTENSION = "kax"; + /** + * This is the extension of the library-files. + */ + private static final String LIB_EXTENSION = "jar"; + /** + * This is the name of the directory for the libraries. + */ + private static final String LIB_DIRECTORY = "lib"; + /** + * This is the name of the root-directory. + */ + private static final String ROOT_DIRECTORY = "data"; + /** + * This is the name of the directory for the views. + */ + private static final String VIEW_DIRECTORY = "view"; + /** + * 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. + */ + private static final Log LOG = LogFactory.getLog(FSManager.class); + + /** + * Creates a new instance of this class. + */ + private FSManager() { + // Check for our root-directory and create it if necessary + final File rootDir = new File(FSManager.ROOT_DIRECTORY); + if (!rootDir.exists()) { + final boolean result = rootDir.mkdir(); + if (!result) { + FSManager.LOG.error("Could not create root directory."); + } + } + } + + /** + * Delivers the singleton instance of this class. + * + * @return The only instance of {@link FSManager}. + */ + public static FSManager getInstance() { + return FSManager.INSTANCE; + } + + /** + * This method adds a new project to the application. If the method fails due to an {@link IOException}, it will make sure that the project-directories will be + * removed as if the method would never have been called. + * + * @param project + * The project to be added. + * @throws IOException + * If a write-error occurred during the creation. + * @throws ProjectAlreadyExistingException + * If a project with the same name exists already. + */ + public void addProject(final String project) throws IOException, ProjectAlreadyExistingException { + // Get the lock for the new project + final Object lock = this.getLock(project); + + // Assemble the paths to the directory and to the files for the given project + final File projectDir = new File(FSManager.ROOT_DIRECTORY + File.separator + project); + final File projectFile = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + project + "." + FSManager.KAX_EXTENSION); + final File libDir = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + FSManager.LIB_DIRECTORY); + final File viewDir = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + FSManager.VIEW_DIRECTORY); + + // We need an "empty" project in order to save it. + + final MIProject emptyProject = this.factory.createProject(); + + // Create the directories and the empty file atomically + synchronized (lock) { + // Make sure that the project doesn't exist already + if (projectDir.exists()) { + throw new ProjectAlreadyExistingException("The project with the name '" + project + "' exists already."); + } + + // Create the directories + projectDir.mkdir(); + libDir.mkdir(); + viewDir.mkdir(); + + // Now the empty project file + try { + AnalysisController.saveToFile(projectFile, emptyProject); + } catch (final IOException ex) { + // Something went wrong. Remove the directories and files! + viewDir.delete(); + libDir.delete(); + // Keep in mind that the potential remains of the file have to deleted before the directory. + projectFile.delete(); + projectDir.delete(); + + // Rethrow the exception in order to inform the caller of this method + throw ex; + } + } + } + + /** + * This method opens a project atomically, using the current version on the FS. + * + * @param project + * The project to be loaded. + * @return An instance of {@link MIProject} containing all informations from the project. + * @throws IOException + * If something went wrong during opening the file. + */ + public MIProject openProject(final String project) throws IOException { + // Get the lock for the given project + final Object lock = this.getLock(project); + + // Assemble the path to the KAX-file + final File kaxFile = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + project + "." + FSManager.KAX_EXTENSION); + + // Load it atomically + synchronized (lock) { + return AnalysisController.loadFromFile(kaxFile); + } + } + + /** + * Returns a list containing all available projects on the FS as a string. + * + * @return A list of string containing all available project. + */ + public Collection<? extends String> getAllProjects() { + final List<String> result = new ArrayList<String>(); + + // Get all directories within our root-dir + final File files[] = new File(FSManager.ROOT_DIRECTORY).listFiles(); + for (final File file : files) { + if (file.isDirectory()) { + result.add(file.getName()); + } + } + + return result; + } + + /** + * This method returns the current time stamp of the given project. The time stamp is the last modification time of the KAX-file. + * + * @param project + * The project whose time stamp should be delivered. + * @return The time stamp of the last modification. + */ + public long getCurrTimeStamp(final String project) { + // Assemble the path to the kax-file of the given project + final String fileName = FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + project + "." + FSManager.KAX_EXTENSION; + + // Try to find this file + final File file = new File(fileName); + + // Get the time stamp atomically + final Object lock = this.getLock(project); + + final long ts; + synchronized (lock) { + ts = file.lastModified(); + } + + // Return the time stamp + return ts; + } + + /** + * This method can be used to get the lock for a given project. If the lock doesn't exist already, a new one will be created. + * + * @param project + * The project whose lock should be delivered. + * @return A lock object for the project. + */ + private Object getLock(final String project) { + final Object newLock = new Object(); + final Object existLock = this.projectLocksMap.putIfAbsent(project, newLock); + + return (existLock != null) ? existLock : newLock; + } + + /** + * This method can be used to upload a new library. + * + * @param srcFile + * The file to be used as a new library. + * @param project + * The name of the project for the new lib. + * @return An instance of {@link MIDependency} if everything went well. + * @throws LibraryAlreadyExistingException + * If a library with the same name for the project exists already. + * @throws IOException + * If something went wrong during writing the file. + */ + public MIDependency uploadLibrary(final UploadedFile srcFile, final String project) throws LibraryAlreadyExistingException, IOException { + // Get the lock for this project + final Object lock = this.getLock(project); + + // Prepare the files + final File libDir = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + FSManager.LIB_DIRECTORY); + final File dstFile = new File(libDir, srcFile.getFileName()); + + // Now copy the file - if it doesn't already exist + synchronized (lock) { + if (dstFile.exists()) { + throw new LibraryAlreadyExistingException("The library with the name '" + srcFile.getFileName() + "' exists already."); + } + + BufferedInputStream in = null; + BufferedOutputStream out = null; + + try { + // Get the streams. + in = new BufferedInputStream(srcFile.getInputstream()); + out = new BufferedOutputStream(new FileOutputStream(dstFile)); + final byte[] buf = new byte[FSManager.BUF_SIZE_BYTES]; + int count; + + // Transfer the file. + while ((count = in.read(buf)) != -1) { + out.write(buf, 0, count); + } + } finally { + // Try to make sure that the streams will be closed. + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } + } + + final MIDependency dependency = this.factory.createDependency(); + dependency.setFilePath(dstFile.getName()); + return dependency; + } + + /** + * This method delivers all available libraries for the given project as a pair of strings. The first element is the name of the library, the second one the size + * of the lib in MiBytes and as a human readable string. + * + * @param projectName + * The name of the project. + * @return The libraries of the given project. + */ + public List<Pair<String, String>> getLibraries(final String projectName) { + final List<Pair<String, String>> result = new ArrayList<Pair<String, String>>(); + // Get the lock for the project + final Object lock = this.getLock(projectName); + + synchronized (lock) { + // Run through the libs and put them into our list. + final File libDir = new File(FSManager.ROOT_DIRECTORY + File.separator + projectName + File.separator + FSManager.LIB_DIRECTORY); + final File files[] = libDir.listFiles(); + if (files != null) { + for (final File file : files) { + if (file.getName().endsWith("." + FSManager.LIB_EXTENSION)) { + final float len = file.length() / 1024.0f / 1024.0f; + final NumberFormat numberFormat = new DecimalFormat("0.00"); + numberFormat.setRoundingMode(RoundingMode.DOWN); + final String lenStr = numberFormat.format(len); + result.add(new Pair<String, String>(file.getName(), lenStr)); + } + } + } + } + + return result; + } + + /** + * This method can be used to deliver the class loader for the given project. The class loader is able to load from all libraries within the given project. + * + * @param projectName + * The name of the project. + * @return An instance of {@link URLClassLoader} with all available libraries. + */ + public ClassLoader getClassLoader(final String projectName) { + // Get the lock for the project + final Object lock = this.getLock(projectName); + final List<URL> libs = new ArrayList<URL>(); + + // Collect all libraries of the project + synchronized (lock) { + // Run through the libs and put them into our list. + final File libDir = new File(FSManager.ROOT_DIRECTORY + File.separator + projectName + File.separator + FSManager.LIB_DIRECTORY); + final File files[] = libDir.listFiles(); + if (files != null) { + for (final File file : files) { + if (file.getName().endsWith("." + FSManager.LIB_EXTENSION)) { + try { + libs.add(file.toURL()); + } catch (final MalformedURLException ex) { + ex.printStackTrace(); + } + } + } + } + + // Now assemble the URL class loader + return AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { + @Override + public URLClassLoader run() { + return new URLClassLoader(libs.toArray(new URL[libs.size()]), AnalysisController.class.getClassLoader()); + } + }); + } + } + + /** + * This method can be used to deliver the fully qualified URL of a given dependency for a given project. + * + * @param lib + * The library whose URL should be delivered. + * @param project + * The corresponding project of the library. + * @return The URL to the given library if everything went well. + * @throws MalformedURLException + * If the URL is for some reason invalid. + */ + public URL getURL(final MIDependency lib, final String project) throws MalformedURLException { + final File file = new File(FSManager.ROOT_DIRECTORY + File.separator + project + File.separator + FSManager.LIB_DIRECTORY + File.separator + + lib.getFilePath()); + return file.toURL(); + } + + /** + * This method delivers all available libraries of the given project as a list of {@link MIDependency}. + * + * @param projectName + * The name of the project whose libraries should be delivered. + * @return A list with all available libraries. + */ + public List<MIDependency> getModelLibraries(final String projectName) { + // Get the lock for the project + final Object lock = this.getLock(projectName); + final List<MIDependency> libs = new ArrayList<MIDependency>(); + + // Collect all libraries of the project + synchronized (lock) { + // Run through the libs and put them into our list. + final File libDir = new File(FSManager.ROOT_DIRECTORY + File.separator + projectName + File.separator + FSManager.LIB_DIRECTORY); + final File files[] = libDir.listFiles(); + if (files != null) { + for (final File file : files) { + if (file.getName().endsWith("." + FSManager.LIB_EXTENSION)) { + final MIDependency dep = this.factory.createDependency(); + dep.setFilePath(file.getName()); + libs.add(dep); + } + } + } + return libs; + } + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FileManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/FileManager.java deleted file mode 100644 index eec6d153b25aba4c3a4271f00e938269dc5dcc5f..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/FileManager.java +++ /dev/null @@ -1,376 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.common; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; - -import kieker.analysis.AnalysisController; -import kieker.analysis.exception.AnalysisConfigurationException; -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.analysis.model.analysisMetaModel.MIProject; -import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; - -import org.primefaces.model.UploadedFile; - -/** - * This is a singleton class for the access to the file system. It makes sure that the necessary directories for the execution of the application exist. <b>Do - * not</b> remove directories created from this manager during runtime! Directories are created during first access to the class.<br> - * Currently nearly all methods are synchronized. A fine grained synchronization should be implemented in the future. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -public final class FileManager { - - /** - * The logger within this class. - */ - private static final Log LOG = LogFactory.getLog(FileManager.class); - /** - * The root dir which contains all other directories. - */ - private static final String ROOT_DIR = "data"; - /** - * The directory which contains the projects. - */ - private static final String PROJECT_DIR = FileManager.ROOT_DIR + File.separator + "projects"; - /** - * The directory which contains the libraries. - */ - private static final String LIB_DIR = FileManager.ROOT_DIR + File.separator + "libraries"; - /** - * The extension of the kieker analysis files. - */ - private static final String EXTENSION = ".kax"; - /** - * The extension of jar-files. - */ - private static final String JAR_EXTENSION = ".jar"; - /** - * The buffer size in bytes uses to upload dependencies. - */ - private static final int BUF_SIZE = 1024; - /** - * The singleton instance of this class. - */ - private static final FileManager INSTANCE = new FileManager(); - /** - * The factory used to create new objects of the meta model. - */ - private final MAnalysisMetaModelFactory factory; - - /** - * Creates a new instance of this class. - */ - private FileManager() { - this.checkAndCreateDirectories(); - this.factory = new MAnalysisMetaModelFactory(); - } - - /** - * Checks whether all directories are available and creates them if necessary. - */ - private void checkAndCreateDirectories() { - synchronized (this) { - // Make sure that the directories exist and create them if necessary. - final File dirProj = new File(FileManager.PROJECT_DIR); - final File dirLib = new File(FileManager.LIB_DIR); - boolean couldCreated = true; - - if (!dirProj.exists()) { - couldCreated &= dirProj.mkdirs(); - } - if (!dirLib.exists()) { - couldCreated &= dirLib.mkdirs(); - } - - if (!couldCreated) { - FileManager.LOG.error("Could not create the necessary directories for the application"); - } - } - } - - /** - * This method saves a given project using the name of the project as the project-directory. The project-directory must already exist. - * - * @param project - * The project to be stored. - * @return true iff the project-directory does already exist and the storage was successful. - */ - public final boolean saveProject(final MIProject project) { - synchronized (this) { - final String projectName = project.getName(); - - final File dirProject = new File(FileManager.PROJECT_DIR + File.separator + projectName); - - // Make sure that the directory for the project exists. - if (dirProject.exists()) { - /* - * Try to save the project. - */ - final File fileProject = new File(dirProject, projectName + FileManager.EXTENSION); - try { - final AnalysisController controller = new AnalysisController(project, PluginClassLoader.getInstance()); - try { - controller.saveToFile(fileProject); - FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", "Project saved: " + project.getName())); - return true; - } catch (final IOException ex) { - FileManager.LOG.error("Could not save project '" + projectName + "'.", ex); - } catch (final AnalysisConfigurationException ex) { - FileManager.LOG.error("Could not save project '" + projectName + "'.", ex); - } - } catch (final AnalysisConfigurationException ex) { - FileManager.LOG.error("Could not save project '" + projectName + "'.", ex); - } catch (final NullPointerException ex) { - FileManager.LOG.error("Could not save project '" + projectName + "'.", ex); - } - } - return false; - } - } - - /** - * This method saves a given project using the name of the project as the project-directory. The project-directory must not already exist. - * - * @param project - * The project to be stored. - * @return true iff the project-directory does not already exist and the storage was successful. - */ - public final boolean saveNewProject(final MIProject project) { - synchronized (this) { - final String projectName = project.getName(); - final File dirProject = new File(FileManager.PROJECT_DIR + File.separator + projectName); - - // Make sure that the project does not already exist and create the project directory. - if (dirProject.exists() || !dirProject.mkdir()) { - return false; - } else { - // The directory should exist now. Store the project. - return this.saveProject(project); - } - } - } - - /** - * This method can be used to load all currently saved projects. - * - * @return A list containing the loaded projects. If something went wrong, an empty list will be returned, never null. - */ - public final List<MIProject> loadAllProjects() { - final List<MIProject> resultList = new ArrayList<MIProject>(); - synchronized (this) { - // Try to get all directories within the project directory. - final File[] directories = new File(FileManager.PROJECT_DIR).listFiles(); - if (directories != null) { - for (final File directory : directories) { - if (directory.isDirectory()) { - // If there is a project file within the directory, we know the name of it. - final File projectFile = new File(directory, directory.getName() + FileManager.EXTENSION); - if (projectFile.exists()) { - // Try to load the project. - MIProject project; - try { - project = AnalysisController.loadFromFile(projectFile); - resultList.add(project); - } catch (final IOException ex) { - FileManager.LOG.error("Could not load project.", ex); - } - } - } - } - } - } - return resultList; - } - - /** - * This method uploads a given file as a new dependency. The file is stored within the lib-directory of this application. If a file with the same name does - * already exist, it will be replaces. - * - * @param file - * The file to be uploaded. - * @return The new dependency iff the uploading was successful, null otherwise. - */ - public final MIDependency uploadDependency(final UploadedFile file) { - synchronized (this) { - final File depFile = new File(FileManager.LIB_DIR, file.getFileName()); - - BufferedInputStream in = null; - BufferedOutputStream out = null; - try { - // Get the streams. - in = new BufferedInputStream(file.getInputstream()); - out = new BufferedOutputStream(new FileOutputStream(depFile)); - final byte[] buf = new byte[FileManager.BUF_SIZE]; - int count; - - // Transfer the file. - while ((count = in.read(buf)) != -1) { - out.write(buf, 0, count); - } - - } catch (final IOException ex) { - FileManager.LOG.error("Could not transfer file '" + file.getFileName() + "'"); - return null; - } finally { - // Try to make sure that the streams will be closed. - try { - if (in != null) { - in.close(); - } - } catch (final IOException ex) { - FileManager.LOG.warn("Error while uploading dependency '" + file.getFileName() + "'."); - } - try { - if (out != null) { - out.close(); - } - } catch (final IOException ex) { - FileManager.LOG.warn("Error while uploading dependency '" + file.getFileName() + "'."); - } - } - final MIDependency dependency = this.factory.createDependency(); - dependency.setFilePath(depFile.getName()); - return dependency; - } - } - - /** - * Delivers the only instance of this class. - * - * @return The singleton instance of this class. - */ - public static final synchronized FileManager getInstance() { - return FileManager.INSTANCE; - } - - /** - * This method tries to load all available dependencies from the file system. - * - * @return A list containing all available dependencies. If there are no files, an empty list will be returned. - */ - public final List<MIDependency> loadAllDependencies() { - final List<MIDependency> resultList = new ArrayList<MIDependency>(); - synchronized (this) { - // Try to get all files within the library directory. - final File[] files = new File(FileManager.LIB_DIR).listFiles(); - if (files != null) { - for (final File file : files) { - if (file.isFile() && file.getName().endsWith(FileManager.JAR_EXTENSION)) { - final MIDependency dependency = this.factory.createDependency(); - dependency.setFilePath(file.getName()); - resultList.add(dependency); - } - } - } - } - return resultList; - } - - /** - * Tries to delete a given dependency. - * - * @param dependency - * The dependency to be removed. - * @return true iff the dependency exists and the removal was successful. - */ - public final boolean deleteDependency(final MIDependency dependency) { - synchronized (this) { - final File file = new File(FileManager.LIB_DIR, dependency.getFilePath()); - if (file.isFile()) { - return file.delete(); - } - return false; - } - } - - /** - * This method tries to delete a project, by removing the directory of the project and its contents. If something went wrong, the integrity of the folder - * structure is not guaranteed. - * - * @param project - * The project to be removed. - * @return true iff the project has been removed successfully. - */ - public final boolean deleteProject(final MIProject project) { - final String projectName = project.getName(); - - final File dirProject = new File(FileManager.PROJECT_DIR + File.separator + projectName); - synchronized (this) { - if (dirProject.isDirectory()) { - final File[] files = dirProject.listFiles(); - for (final File file : files) { - if (!file.delete()) { - return false; - } - } - return dirProject.delete(); - } - return false; - } - } - - /** - * This method reloads the given project from the file system. - * - * @param project - * The project to be reloaded. - * @return The reloaded project. - */ - public MIProject reloadProject(final MIProject project) { - final String projectName = project.getName(); - - final File projectFile = new File(FileManager.PROJECT_DIR + File.separator + projectName + File.separator + projectName + FileManager.EXTENSION); - synchronized (this) { - if (projectFile.isFile()) { - try { - return AnalysisController.loadFromFile(projectFile); - } catch (final IOException ex) { - FileManager.LOG.error("Could not load project.", ex); - } - } - } - return null; - } - - /** - * This method can be used to deliver the correct and full path to a given library. This is necessary as only the name of the dependencies is stored within the - * model dependency. It is not guaranteed that the given path points to an existing file though. - * - * @param dependency - * The dependency which will be used to assemble the path. - * @return An absolute path to the given dependency. - */ - public String getFullPath(final MIDependency dependency) { - return new File(FileManager.LIB_DIR, dependency.getFilePath()).getAbsolutePath(); - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/LRUCache.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/LRUCache.java deleted file mode 100644 index 0100d475af5f432477d803d742272ed07fac1e68..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/LRUCache.java +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.common; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map.Entry; - -/** - * This is a thread-safe cache, which can be used to cache objects under a specific key. This class is a LRU cache. - * - * @author Nils Christian Ehmke - * - * @param <Key> - * The type for the keys. - * @param <Value> - * The type for the values. - */ -public class LRUCache<Key, Value> { - - /** - * This is the map which is used to store the entries. - */ - private final HashMap<Key, Value> hashMap; - private final int maxSize; - - /** - * Creates a new instance of this class using the given size as maximal cache size. - * - * @param size - * The maximal cache size. - */ - public LRUCache(final int size) { - this.maxSize = size; - this.hashMap = new FixedLinkedHashMap(); - } - - /** - * This method adds a given value within the cache, using the given key. If a value with the same key does already exist, it will be replaced. If the entry would - * excess the maximal cache size, the oldest entry will be removed. - * - * @param key - * The key used to store the value. - * @param value - * The value to be stored. - */ - public void add(final Key key, final Value value) { - synchronized (this.hashMap) { - this.hashMap.put(key, value); - } - } - - /** - * This method delivers the value to the key or null, if the value doesn't exist. - * - * @param key - * The key to the value. - * @return The corresponding value. - */ - public Value get(final Key key) { - synchronized (this.hashMap) { - return this.hashMap.get(key); - } - } - - /** - * A modified version of {@link LinkedHashMap} which has a fixed size. Each time the {@code put} or {@code putAll} method exceeds the size of the - * {@link LRUCache}, the oldest entry is being removed. - * - * @author Nils Christian Ehmke - */ - private class FixedLinkedHashMap extends LinkedHashMap<Key, Value> { - - /** - * The serial version uid. - */ - private static final long serialVersionUID = 1L; - - /** - * Creates a new instance of this class, using the LRUCache's maximal size as the size of the map. - */ - public FixedLinkedHashMap() { - super(LRUCache.this.maxSize); - } - - @Override - protected boolean removeEldestEntry(final Entry<Key, Value> eldest) { - return this.size() > LRUCache.this.maxSize; - } - - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java new file mode 100644 index 0000000000000000000000000000000000000000..23aebdd22e0a6ff93bf33e5dca518bfd99455dbd --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/Pair.java @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright 2012 by + * + Christian-Albrechts-University of Kiel + * + Department of Computer Science + * + Software Engineering Group + * and others. + * + * 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.common; + +/** + * This is a simple helper class which can store two values. + * + * @author Nils Christian Ehmke + * @version 1.0 + * + * @param <FST> + * The type of the first element. + * @param <SND> + * The type of the second element. + */ +public class Pair<FST, SND> { + + /** + * This is the first element. + */ + private FST fst; + /** + * This is the second element. + */ + private SND snd; + + /** + * Creates a new instance of this class with null values stored for the elements. + */ + public Pair() { + // No code necessary + } + + /** + * Creates a new instance of this class using the given values. + * + * @param fst + * The first element to be stored in this object. + * @param snd + * The second element to be stored in this object. + */ + public Pair(final FST fst, final SND snd) { + this.fst = fst; + this.snd = snd; + } + + /** + * Delivers the first element. + * + * @return The first element. + */ + public FST getFst() { + return this.fst; + } + + /** + * Sets the first element to a new value. + * + * @param fst + * The new first element. + */ + public void setFst(final FST fst) { + this.fst = fst; + } + + /** + * Delivers the second element. + * + * @return The second element. + */ + public SND getSnd() { + return this.snd; + } + + /** + * Sets the second element to a new value. + * + * @param snd + * The new second element. + */ + public void setSnd(final SND snd) { + this.snd = snd; + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginClassLoader.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginClassLoader.java deleted file mode 100644 index 1a3dd57a7ff4687941b461b40363767d73e5df16..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginClassLoader.java +++ /dev/null @@ -1,143 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.common; - -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.List; - -import kieker.analysis.AnalysisController; -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; - -/** - * This singleton class is responsible for the dynamic loading of classes. Unlike a normal <code>URLClassLoader</code> it is possible to dynamically add and remove - * urls from the class loader. This instance should always be used if plugin objects have to be created. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -public final class PluginClassLoader extends ClassLoader { - - /** - * The logger within this class. - */ - private static final Log LOG = LogFactory.getLog(PluginClassLoader.class); - /** - * The singleton instance of this class. - */ - private static PluginClassLoader instance; - - private final List<URL> urlList = new ArrayList<URL>(); - - private URLClassLoader classLoader = null; - - /** - * The default constructor of this class. During the creation all available libraries will be added to the class loader. - */ - private PluginClassLoader() { - this.classLoader = new URLClassLoader(new URL[] {}, AnalysisController.class.getClassLoader()); - // Make sure that all libs are loaded. - final List<MIDependency> libs = FileManager.getInstance().loadAllDependencies(); - for (final MIDependency lib : libs) { - try { - this.addURL(new URL("file", "localhost", FileManager.getInstance().getFullPath(lib))); - } catch (final MalformedURLException ex) { - PluginClassLoader.LOG.warn("Could not load library.", ex); - } - } - } - - /** - * This method can be used to add an url to the class loader. - * - * @param url - * The URL of the dependency to be added. - */ - public void addURL(final URL url) { - this.urlList.add(url); - - this.classLoader = (URLClassLoader) AccessController.doPrivileged(new PrivilegedAction<Object>() { - @Override - public Object run() { - return new URLClassLoader(PluginClassLoader.this.urlList.toArray(new URL[PluginClassLoader.this.urlList.size()]), AnalysisController.class - .getClassLoader()); - } - }); - } - - /** - * This method can be used to remove an url from the class loader. - * - * @param url - * The URL of the dependency to be added. - */ - public void removeURL(final URL url) { - this.urlList.remove(url); - - this.classLoader = (URLClassLoader) AccessController.doPrivileged(new PrivilegedAction<Object>() { - @Override - public Object run() { - return new URLClassLoader(PluginClassLoader.this.urlList.toArray(new URL[PluginClassLoader.this.urlList.size()]), AnalysisController.class - .getClassLoader()); - } - }); - } - - /** - * Delivers the only instance of this class. - * - * @return The singleton instance of this class. - */ - public static final PluginClassLoader getInstance() { - // Create the singleton instance if necessary and use a doPrivileged-block. - synchronized (PluginClassLoader.class) { - if (PluginClassLoader.instance == null) { - PluginClassLoader.instance = (PluginClassLoader) AccessController.doPrivileged(new PrivilegedAction<Object>() { - @Override - public Object run() { - return new PluginClassLoader(); - } - }); - } - } - return PluginClassLoader.instance; - } - - /** - * This method tries to load the class with the given name using the currently loaded dependencies. - * - * @param name - * The name of the class to be loaded. - * @return The class. - * @throws ClassNotFoundException - * If a class with the given name could not be found. - */ - @Override - public Class<?> loadClass(final String name) throws ClassNotFoundException { - return this.classLoader.loadClass(name); - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java index c0f67511db60f66b4f4697b6b1388b4ddca081c5..6e04c94f00105117503b55d14893d985cdd1eb94 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/PluginFinder.java @@ -31,24 +31,16 @@ import java.util.jar.JarFile; import kieker.analysis.plugin.AbstractPlugin; import kieker.analysis.plugin.annotation.Plugin; import kieker.analysis.repository.AbstractRepository; +import kieker.analysis.repository.annotation.Repository; /** - * This tool class can be used to find all plugins and repositories within a given jar file - assuming that the <code>PluginClassLoader</code> knows these jars. + * This tool class can be used to find all plugins and repositories within a given jar file - assuming that the given class loader knows these jars. * * @author Nils Christian Ehmke * @version 1.0 - * TODO Cache and observer update! */ public final class PluginFinder { - private static final LRUCache<URL, List<Class<AbstractPlugin>>> PLUGIN_CACHE; - private static final LRUCache<URL, List<Class<AbstractRepository>>> REPOSITORY_CACHE; - - static { - PLUGIN_CACHE = new LRUCache<URL, List<Class<AbstractPlugin>>>(15); - REPOSITORY_CACHE = new LRUCache<URL, List<Class<AbstractRepository>>>(15); - } - /** * Creates a new instance of this class. */ @@ -61,42 +53,24 @@ public final class PluginFinder { * * @param url * The url for the jar. + * @param classLoader + * The class loader used to load the classes. * @return A list containing all available repository-classes or null, if an exception occurred. */ - public static List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url) { - // TODO: Merge this with the other method - final List<Class<AbstractRepository>> repositoryClasses = PluginFinder.REPOSITORY_CACHE.get(url); - if (repositoryClasses != null) { - return repositoryClasses; - } - try { - // Open the jar file and run through all entries within this file. - final JarFile jarFile = new JarFile(new File(url.getPath())); - final List<Class<AbstractRepository>> result = new ArrayList<Class<AbstractRepository>>(); - final Enumeration<JarEntry> jarEntries = jarFile.entries(); - while (jarEntries.hasMoreElements()) { - final JarEntry jarEntry = jarEntries.nextElement(); - try { - String name = jarEntry.toString(); - name = name.replace('/', '.'); - name = name.replace(".class", ""); - // Try to find a class with the same name. - final Class<?> c = PluginClassLoader.getInstance().loadClass(name); + public static List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url, final ClassLoader classLoader) { + final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); + List<Class<AbstractRepository>> result = null; - if (AbstractRepository.class.isAssignableFrom(c)) { - result.add((Class<AbstractRepository>) c); - } - } catch (final Throwable ex) { // NOCS (IllegalCatchCheck) - // Ignore error. + if (clazzes != null) { + result = new ArrayList<Class<AbstractRepository>>(); + for (final Class<?> clazz : clazzes) { + if (clazz.isAnnotationPresent(Repository.class) && AbstractRepository.class.isAssignableFrom(clazz)) { + result.add((Class<AbstractRepository>) clazz); } } - jarFile.close(); - PluginFinder.REPOSITORY_CACHE.add(url, result); - return result; - } catch (final IOException ex) { - ex.printStackTrace(); } - return null; + + return result; } /** @@ -105,36 +79,57 @@ public final class PluginFinder { * * @param url * The url for the jar. + * @param classLoader + * The class loader used to load the classes. * @return A list containing all available plugin-classes or null, if an exception occurred. */ - public static List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url) { - final List<Class<AbstractPlugin>> pluginClasses = PluginFinder.PLUGIN_CACHE.get(url); - if (pluginClasses != null) { - return pluginClasses; + public static List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url, final ClassLoader classLoader) { + final List<Class<?>> clazzes = PluginFinder.getAllClassesWithinJar(url, classLoader); + List<Class<AbstractPlugin>> result = null; + + if (clazzes != null) { + result = new ArrayList<Class<AbstractPlugin>>(); + for (final Class<?> clazz : clazzes) { + if (clazz.isAnnotationPresent(Plugin.class) && AbstractPlugin.class.isAssignableFrom(clazz)) { + result.add((Class<AbstractPlugin>) clazz); + } + } } + + return result; + } + + /** + * This method delivers all classes which are available in the given jar. + * + * @param url + * The url for the jar. + * @param classLoader + * The class loader used to load the classes. + * @return A list containing all available classes or null, if an exception occurred. + */ + private static List<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) { try { // Open the jar file and run through all entries within this file. final JarFile jarFile = new JarFile(new File(url.getPath())); - final List<Class<AbstractPlugin>> result = new ArrayList<Class<AbstractPlugin>>(); + final List<Class<?>> result = new ArrayList<Class<?>>(); final Enumeration<JarEntry> jarEntries = jarFile.entries(); while (jarEntries.hasMoreElements()) { final JarEntry jarEntry = jarEntries.nextElement(); try { + // Assemble the correct name String name = jarEntry.toString(); name = name.replace('/', '.'); name = name.replace(".class", ""); - // Try to find a class with the same name. - final Class<?> c = PluginClassLoader.getInstance().loadClass(name); - // If it is a class and has the annotation - put it into our list. - if (c.isAnnotationPresent(Plugin.class) && AbstractPlugin.class.isAssignableFrom(c)) { - result.add((Class<AbstractPlugin>) c); - } + // Try to find a class with the same name and put it into our list + final Class<?> c = classLoader.loadClass(name); + result.add(c); } catch (final Throwable ex) { // NOCS (IllegalCatchCheck) // Ignore error. } } + // Don't forget to close the jar file again. jarFile.close(); - PluginFinder.PLUGIN_CACHE.add(url, result); return result; } catch (final IOException ex) { ex.printStackTrace(); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java similarity index 60% rename from Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java index 78b84789b47914f03b3a25ed365bbfee54e6d063..0c9ba7a16ade183d584e904ee615b97c4c6545b8 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/beans/request/StringToIDBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/LibraryAlreadyExistingException.java @@ -18,36 +18,32 @@ * limitations under the License. ***************************************************************************/ -package kieker.webgui.beans.request; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.RequestScoped; +package kieker.webgui.common.exception; /** - * This is a simple helper bean which can be used to rewrite a given string as an ID. + * This exception shows that a library with the same name exists already. * * @author Nils Christian Ehmke * @version 1.0 */ -@ManagedBean -@RequestScoped -public class StringToIDBean { +public class LibraryAlreadyExistingException extends Exception { + + private static final long serialVersionUID = 1L; /** * Creates a new instance of this class. */ - public StringToIDBean() { - // No code necessary. + public LibraryAlreadyExistingException() { + // No code necessary } /** - * Modified the given string so that it can be used as an ID. In other words: It removes all space characters. + * Creates a new instance of this class using the given parameters. * - * @param string - * The string to be modified. - * @return The given string without space characters. + * @param msg + * The message used for the exception. */ - public String stringToID(final String string) { - return string.replace(" ", "").replace("$", "").replace("@", ""); + public LibraryAlreadyExistingException(final String msg) { + super(msg); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java similarity index 63% rename from Kieker.WebGUI/src/main/java/kieker/webgui/converter/package-info.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java index cde21594c33024542cac6dd3672e562d16252c14..09fe5242437bf93f3e9a36644c25153684d257d4 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/package-info.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/ProjectAlreadyExistingException.java @@ -18,8 +18,26 @@ * limitations under the License. ***************************************************************************/ -/** - * This package contains all converters used within the project. - */ -package kieker.webgui.converter; +package kieker.webgui.common.exception; +public class ProjectAlreadyExistingException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance of this class. + */ + public ProjectAlreadyExistingException() { + // No code necessary + } + + /** + * Creates a new instance of this class using the given parameters. + * + * @param msg + * The message used for the exception. + */ + public ProjectAlreadyExistingException(final String msg) { + super(msg); + } +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/package-info.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/package-info.java deleted file mode 100644 index a28a880af41b060826f3b25ce8e3aa3ee44f164c..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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 all classes with general and common purpose. - */ -package kieker.webgui.common; - diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/ClassToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/ClassToStringConverter.java deleted file mode 100644 index 64b5acb01cd792cff12db6844bf342b3a9f39195..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/ClassToStringConverter.java +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.util.HashMap; -import java.util.Map; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -/** - * This converter can be used to convert a class to a string and vice versa. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = ClassToStringConverter.NAME) -public class ClassToStringConverter implements Converter { - - /** - * The name of this class used by the xhtml-files. - */ - public static final String NAME = "kieker.webgui.converter.ClassToStringConverter"; - - /** - * This field stores the mapping between the classes as string and the actual classes. - */ - private final Map<String, Class<?>> mapping; - - /** - * Creates a new instance of this class. - */ - public ClassToStringConverter() { - this.mapping = new HashMap<String, Class<?>>(); - } - - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return this.mapping.get(string); - } - - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - final String result = ((Class<?>) o).getName(); - this.mapping.put(result, (Class<?>) o); - return result; - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToCountPluginsConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToCountPluginsConverter.java deleted file mode 100644 index b7ced166e3c9b29ca7219f7e6d933a0fd239ccab..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToCountPluginsConverter.java +++ /dev/null @@ -1,122 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.net.MalformedURLException; -import java.net.URL; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.webgui.common.FileManager; -import kieker.webgui.common.LRUCache; -import kieker.webgui.common.PluginFinder; - -/** - * This converter can be used to convert an instance of <i>MIDependency</i> to the number of plugins within the dependency, but of course <b>not</b> vice versa. The - * number is cached to avoid that the converter holds the file permanently. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIDependencyToCountPluginsConverter.NAME) -public class MIDependencyToCountPluginsConverter implements Converter { - - /** - * The name of this class used by the xhtml-files. - */ - public static final String NAME = "kieker.webgui.converter.MIDependencyToCountPluginsConverter"; - - /** - * The maximal number of dependencies stored within the cache. - */ - private static final int MAX_CACHE_SIZE = 20; - - /** - * This map is the cache and contains the number of plugins within the - * dependencies. - */ - private final LRUCache<MIDependency, String> cache; - - /** - * Creates a new instance of this class. - */ - public MIDependencyToCountPluginsConverter() { - this.cache = new LRUCache<MIDependency, String>(MIDependencyToCountPluginsConverter.MAX_CACHE_SIZE); - } - - /** - * Delivers always null. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param string - * The string to be converted. - * @return Always null. - */ - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return null; - } - - /** - * Converts the given dependency to a human readable string - * containing the number of plugins within the jar. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param o - * The object to be converted. - * @return The number of plugins within the jar. If this is - * not possible, an empty string will be returned. - */ - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - if (!(o instanceof MIDependency)) { - return ""; - } else { - final MIDependency dependency = (MIDependency) o; - // Try to find the string within the cache. - String result = this.cache.get(dependency); - if (result == null) { - // We have to create the string first - try { - result = Integer.toString(PluginFinder.getAllPluginsWithinJar(new URL("file", "localhost", FileManager.getInstance().getFullPath(dependency))) - .size()); - // Remember it for the next time - this.cache.add(dependency, result); - } catch (final MalformedURLException e) { - result = ""; - } - } - - return result; - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToSizeConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToSizeConverter.java deleted file mode 100644 index 2d353264ff90125f0c1273c4203e8cc600fa9ead..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToSizeConverter.java +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.io.File; -import java.text.DecimalFormat; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIDependency; -import kieker.webgui.common.FileManager; - -/** - * This converter can be used to convert an instance of <i>MIDependency</i> to - * the size (in MiBByte) of the dependency, but of course <b>not</b> vice versa. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIDependencyToSizeConverter.NAME) -public class MIDependencyToSizeConverter implements Converter { - /** - * The name of this class used by the xhtml-files. - */ - public static final String NAME = "kieker.webgui.converter.MIDependencyToSizeConverter"; - /** - * The factor used to convert the size into MiBytes. - */ - private static final double FACTOR = 1.0 / 1024 / 1024; // NOCS (MagicNumberCheck) - - /** - * Creates a new instance of this class. - */ - public MIDependencyToSizeConverter() { - /* No code necessary. */ - } - - /** - * Delivers always null. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param string - * The string to be converted. - * @return Always null. - */ - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return null; - } - - /** - * Delivers a string-representation of the size of the given dependency. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param o - * The object to be converted. - * @return The size of the given object if it is a dependency and not null, an empty string otherwise. - */ - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - if (!(o instanceof MIDependency)) { - return ""; - } else { - final long size = new File(FileManager.getInstance().getFullPath((MIDependency) o)).length(); - return new DecimalFormat("#.##").format(size * MIDependencyToSizeConverter.FACTOR).concat(" [MiByte]"); - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToStringConverter.java deleted file mode 100644 index 004e0185f5d99121c480a5105ea75be3be78c8e0..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIDependencyToStringConverter.java +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.io.File; -import java.util.concurrent.ConcurrentHashMap; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIDependency; - -/** - * This converter can be used to convert an instance of <i>MIDependency</i> to a human readable string and also vice versa. This implies that the names of the - * libraries (as those are shown as human readable strings) have to be unique. Otherwise the string cannot be mapped to the corresponding object. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIDependencyToStringConverter.NAME) -public class MIDependencyToStringConverter implements Converter { - - /** - * This is the name of the converter. - */ - public static final String NAME = "kieker.webgui.converter.MIDependencyToStringConverter"; - /** - * This map is being used to store the already shown dependencies. - */ - private static final ConcurrentHashMap<String, MIDependency> MAP = new ConcurrentHashMap<String, MIDependency>(); - - /** - * Creates a new instance of this class. - */ - public MIDependencyToStringConverter() { - /* - * No code necessary. - */ - } - - /** - * This method delivers always null and should not be used. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is associated. - * @param string - * The string to be converted. - * @return null; - */ - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return MIDependencyToStringConverter.MAP.get(string); - } - - /** - * This method converts the given object (on condition that it is an instance of the class <code>MIDependency</code>) to a human readable string. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is associated. - * @param o - * The object to be converted. - * @return A human readable represantation of the given object or null, of the object is from the wrong class. - */ - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - // Make sure that the given object is well-defined. - if (!(o instanceof MIDependency)) { - return ""; - } else { - final String result = new File(((MIDependency) o).getFilePath()).getName(); - MIDependencyToStringConverter.MAP.put(result, (MIDependency) o); - return result; - } - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPluginToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPluginToStringConverter.java deleted file mode 100644 index 9a3d538df9a7ed432d99ccc5117e23e32ffbf7a8..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPluginToStringConverter.java +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.util.concurrent.ConcurrentHashMap; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIPlugin; - -/** - * This converter can be used to convert a given plugin model instance to a string and vice versa (It uses the object'S toString-method). - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIPluginToStringConverter.NAME) -public class MIPluginToStringConverter implements Converter { - /** - * This is the name of this converter. - */ - public static final String NAME = "kieker.webgui.converter.MIPluginToStringConverter"; - /** - * This field stores the mapping. - */ - private static ConcurrentHashMap<String, MIPlugin> map = new ConcurrentHashMap<String, MIPlugin>(); - - /** - * Creates a new instance of this class. - */ - public MIPluginToStringConverter() { - /* No code necessary. */ - } - - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return MIPluginToStringConverter.map.get(string); - } - - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - final String result = o.toString(); - MIPluginToStringConverter.map.put(result, (MIPlugin) o); - return result; - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java deleted file mode 100644 index f35f82e9331f715c455e4888659921d0ee5d2567..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIPortToStringConverter.java +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import java.util.concurrent.ConcurrentHashMap; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIPort; - -/** - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIPortToStringConverter.NAME) -public class MIPortToStringConverter implements Converter { - /** - * This is the name of this converter. - */ - public static final String NAME = "kieker.webgui.converter.MIPortToStringConverter"; - /** - * This field stores the mapping. - */ - private static ConcurrentHashMap<String, MIPort> map = new ConcurrentHashMap<String, MIPort>(); - - /** - * Creates a new instance of this class. - */ - public MIPortToStringConverter() { - /* No code necessary. */ - } - - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return MIPortToStringConverter.map.get(string); - } - - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - final String result = o.toString(); - MIPortToStringConverter.map.put(result, (MIPort) o); - return result; - } -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIProjectToStringConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIProjectToStringConverter.java deleted file mode 100644 index 8b98d93c5ac7d0f86b966ba4e4cb9414583e32f7..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/converter/MIProjectToStringConverter.java +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.converter; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.FacesConverter; - -import kieker.analysis.model.analysisMetaModel.MIProject; - -/** - * This converter can be used to convert an instance of <i>MIProject</i> to a human readable string, but <b>not</b> vice versa. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -@FacesConverter(value = MIProjectToStringConverter.NAME) -public class MIProjectToStringConverter implements Converter { - - /** - * This is the name of this converter. - */ - public static final String NAME = "kieker.webgui.converter.MIProjectToStringConverter"; - - /** - * Creates a new instance of this class. - */ - public MIProjectToStringConverter() { - /* No code necessary. */ - } - - /** - * This method delivers always null and should not be used. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param string - * The string to be converted. - * @return null - */ - @Override - public Object getAsObject(final FacesContext fc, final UIComponent uic, final String string) { - return null; - } - - /** - * This method delivers the name of the given object, if the object is not - * null and the object is an instance of the class <code>MIProject</code>. - * - * @param fc - * The FacesContext for the request being processed. - * @param uic - * The component with which this model object value is - * associated. - * @param o - * The object to be converted. - * @return A human readable representation of the given object if possible, - * null otherwise. - */ - @Override - public String getAsString(final FacesContext fc, final UIComponent uic, final Object o) { - // Make sure that the given object is well-defined. - if (!(o instanceof MIProject)) { - return ""; - } else { - return ((MIProject) o).getName(); - } - } -} diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisCockpit.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisCockpit.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..8acf4b47fa9cd2a747d14cac50ed575210fdb70a --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/AnalysisCockpit.xhtml @@ -0,0 +1,64 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <h:head> + <title>Kieker.WebGUI</title> + <link rel="stylesheet" type="text/css" href="../css/Common.css" /> + <link rel="stylesheet" type="text/css" href="../css/AnalysisCockpit.css" /> + </h:head> + + <h:body> + + <!-- This is the layout for the whole page. --> + <p:layout id="layout" fullPage="true"> + + <p:layoutUnit position="north" collapsible="false" header="Kieker.WebGUI"> + <h:form> + <p:menubar> + <p:submenu label="File"> + <p:menuitem value="Close Cockpit" action="#{currentAnalysisCockpitProjectBean.clearProject()}" ajax="false"/> + <p:separator/> + <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true"/> + </p:submenu> + + <p:submenu label="Help"> + <p:menuitem value="User Guide" ajax="true"/> + <p:separator/> + <p:menuitem value="About..." onclick="aboutDialog.show()" ajax="true"/> + </p:submenu> + + <p:menuitem styleClass="logOutButton" disabled="true" value="#{userBean.userName} [Log Out]" ajax="true"/> + </p:menubar> + + </h:form> + </p:layoutUnit> + + + <p:layoutUnit position="center" id="centerLayout"> + </p:layoutUnit> + + <p:layoutUnit position="west" size="300" header="Views" resizable="true" collapsible="true"> + <h:form id="viewsForm"> + <p:accordionPanel multiple="true" activeIndex=""> + + </p:accordionPanel> + </h:form> + </p:layoutUnit> + </p:layout> + + <p:growl id="messages" life="1500" showDetail="true" autoUpdate="false" sticky="false"/> + + <!-- Include the dialog for the configuration. --> + <ui:include src="dialogs/settingsDialog.xhtml" /> + + <!-- Include the about-dialog. --> + <ui:include src="dialogs/aboutDialog.xhtml" /> + + </h:body> +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisController.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisController.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..204287fa82a7cd574978dc5cdcd2ac94605d5c31 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/AnalysisController.xhtml @@ -0,0 +1,79 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <h:head> + <title>Kieker.WebGUI</title> + <link rel="stylesheet" type="text/css" href="../css/Common.css" /> + <link rel="stylesheet" type="text/css" href="../css/AnalysisController.css" /> + </h:head> + + <h:body> + + <!-- This is the layout for the whole page. --> + <p:layout id="layout" fullPage="true"> + + <p:layoutUnit position="north" collapsible="false" header="Kieker.WebGUI"> + <h:form> + <p:menubar> + <p:submenu label="File"> + <p:menuitem value="Close Controller" action="#{currentAnalysisControllerProjectBean.clearProject()}" ajax="false"/> + <p:separator/> + <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true"/> + </p:submenu> + + <p:submenu label="Help"> + <p:menuitem value="User Guide" ajax="true"/> + <p:separator/> + <p:menuitem value="About..." onclick="aboutDialog.show()" ajax="true"/> + </p:submenu> + + <p:menuitem styleClass="logOutButton" disabled="true" value="#{userBean.userName} [Log Out]" ajax="true"/> + </p:menubar> + + </h:form> + </p:layoutUnit> + + + <p:layoutUnit position="center" id="centerLayout"> + </p:layoutUnit> + + <p:layoutUnit position="south" header="Control" resizable="true" collapsible="true"> + <h:form> + <p:commandButton value="Instantiate Analysis Controller" disabled="#{empty currentAnalysisControllerProjectBean.projectName}"/> + <p:commandButton value="Start Analysis" disabled="true"/> + <p:commandButton value="Stop Analysis" disabled="true"/> + <hr/> + <div align="center"> + <h:graphicImage id="iconLEDRed1" url="../img/Icon_LED_Red.png" height="50px"/> + <p:spacer height="0" width="15px"/> + <h:graphicImage id="iconLEDYellow" url="../img/Icon_LED_Gray.png" height="50px"/> + <p:spacer height="0" width="15px"/> + <h:graphicImage id="iconLEDGreen" url="../img/Icon_LED_Gray.png" height="50px"/> + <p:spacer height="0" width="15px"/> + <h:graphicImage id="iconLEDRed2" url="../img/Icon_LED_Gray.png" height="50px"/> + + <p:tooltip for="iconLEDRed1" value="Indicates that the AnalysisController has not been instantiated yet."/> + <p:tooltip for="iconLEDYellow" value="Indicates that the AnalysisController has been instantiated, but not yet started."/> + <p:tooltip for="iconLEDGreen" value="Indicates that the AnalysisController has been started and is running."/> + <p:tooltip for="iconLEDRed2" value="Indicates that the AnalysisController has been terminated."/> + </div> + </h:form> + </p:layoutUnit> + </p:layout> + + <p:growl id="messages" life="1500" showDetail="true" autoUpdate="false" sticky="false"/> + + <!-- Include the dialog for the configuration. --> + <ui:include src="dialogs/settingsDialog.xhtml" /> + + <!-- Include the about-dialog. --> + <ui:include src="dialogs/aboutDialog.xhtml" /> + + </h:body> +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/AnalysisViewWorkSpace.xhtml b/Kieker.WebGUI/src/main/webapp/AnalysisViewWorkSpace.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..771cadacd558cc3d73a19c9fe6c75e5e39706949 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/AnalysisViewWorkSpace.xhtml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <h:head> + <title>Kieker.WebGUI</title> + <link rel="stylesheet" type="text/css" href="../css/AnalysisViewWorkSpace.css" /> + </h:head> + + <h:body> + + </h:body> +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/META-INF/context.xml b/Kieker.WebGUI/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 94faf7116137de9cbcda00555af09060dd3dc74d..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Context antiJARLocking="true" path="/Kieker.WebGUI"/> diff --git a/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..8706ab5eb0194a1775d786704987e797b08536a1 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/ProjectOverview.xhtml @@ -0,0 +1,96 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <h:head> + <title>Kieker.WebGUI</title> + <link rel="stylesheet" type="text/css" href="../css/Common.css" /> + <link rel="stylesheet" type="text/css" href="../css/ProjectOverview.css" /> + </h:head> + + <h:body> + + <p:layout fullPage="true"> + <p:layoutUnit position="north" header="Kieker.WebGUI"> + <h:form id="menubarForm"> + <p:menubar> + <p:submenu label="File"> + <p:menuitem value="New Project" onclick="newProjectDialog.show()" ajax="true"/> + <p:menuitem value="Import Project" ajax="true"/> + <p:separator/> + <p:menuitem value="Refresh Projects List" update=":projectsListForm" ajax="true"/> + <p:separator/> + <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true"/> + </p:submenu> + + <p:submenu label="Help"> + <p:menuitem value="User Guide" ajax="true"/> + <p:separator/> + <p:menuitem value="About..." onclick="aboutDialog.show()" ajax="true"/> + </p:submenu> + + <p:menuitem styleClass="logOutButton" disabled="true" value="#{userBean.userName} [Log Out]" ajax="true"/> + </p:menubar> + </h:form> + </p:layoutUnit> + + <p:layoutUnit position="center"> + <h:form id="projectsListForm"> + <p:dataTable rows="15" paginator="true" var="project" value="#{projectsBean.projects}" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"> + <p:column headerText="Project Name" id="modelHeader" sortBy="#{project}"> + <h:outputText value="#{project}" /> + </p:column> + + <p:column headerText="Owner"> + <h:outputText value="N/A" /> + </p:column> + + <p:column headerText="Last Modification" sortBy="#{projectsBean.getCurrTimeStamp(project)}"> + <h:outputText value="#{projectsBean.getCurrTimeStamp(project)}" /> + </p:column> + + <p:column headerText="Analysis" style="text-align: center"> + <h:outputText value="#{projectsBean.getAnalysisControllerState(project)}"/> + </p:column> + + <p:column headerText="Options" style="text-align: center; width: 280px"> + <p:commandButton id="openButton" ajax="false" action="#{currentWorkSpaceProjectBean.setProject(projectsBean.openProject(project), project)}" icon="ui-icon-folder-open"/> + <p:commandButton id="copyButton" icon="ui-icon-copy"/> + <p:commandButton id="renameButton" icon="ui-icon-pencil"/> + <p:commandButton id="deleteButton" icon="ui-icon-trash"/> + <p:spacer height="0" width="10"/> + <p:commandButton id="controlAnalysis" ajax="false" action="#{currentAnalysisControllerProjectBean.setProject(project)}" icon="ui-icon-wrench"/> + <p:commandButton id="editAnalysisViews" icon="ui-icon-pencil"/> + <p:commandButton id="showAnalysis" ajax="false" action="#{currentAnalysisCockpitProjectBean.setProject(project)}" icon="ui-icon-search"/> + + <p:tooltip for="deleteButton" value="Delete Project"/> + <p:tooltip for="openButton" value="Open Project"/> + <p:tooltip for="renameButton" value="Rename Project"/> + <p:tooltip for="copyButton" value="Copy Project"/> + <p:tooltip for="controlAnalysis" value="Open Analysis Control"/> + <p:tooltip for="editAnalysisViews" value="Edit Analysis Views"/> + <p:tooltip for="showAnalysis" value="View Running Analysis"/> + </p:column> + </p:dataTable> + </h:form> + </p:layoutUnit> + + </p:layout> + + <p:growl id="messages" life="1500" showDetail="true" autoUpdate="false" sticky="false"/> + + <!-- Include the dialogs for the project managment. --> + <ui:include src="dialogs/projectDialogs.xhtml" /> + + <!-- Include the dialog for the configuration. --> + <ui:include src="dialogs/settingsDialog.xhtml" /> + + <!-- Include the about-dialog. --> + <ui:include src="dialogs/aboutDialog.xhtml" /> + </h:body> +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/ProjectWorkSpace.xhtml b/Kieker.WebGUI/src/main/webapp/ProjectWorkSpace.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..8840130f1b086f6db96e4fdaa5aa7a0a80e825b1 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/ProjectWorkSpace.xhtml @@ -0,0 +1,100 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <h:head> + <title>Kieker.WebGUI</title> + <link rel="stylesheet" type="text/css" href="../css/Common.css" /> + <link rel="stylesheet" type="text/css" href="../css/ProjectWorkSpace.css" /> + <script type="text/javascript" src="../js/js-graph-it.js"/> + <link rel="stylesheet" type="text/css" href="../css/js-graph-it.css"/> + </h:head> + + <h:body> + <p:layout id="layout" fullPage="true"> + + <p:layoutUnit position="north" collapsible="false" header="Kieker.WebGUI"> + <h:form> + <p:menubar> + <p:submenu label="File"> + <p:menuitem value="Save Project" ajax="true" disabled="#{empty currentWorkSpaceProjectBean.project}"/> + <p:menuitem value="Reset Project" ajax="true" disabled="#{empty currentWorkSpaceProjectBean.project}"/> + <p:separator/> + <p:menuitem value="Manage Libraries" onclick="manageLibrariesDialog.show()" ajax="true" disabled="#{empty currentWorkSpaceProjectBean.project}"/> + <p:separator/> + <p:menuitem value="Close Project" action="#{currentWorkSpaceProjectBean.clearProject()}" ajax="false"/> + <p:separator/> + <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true"/> + </p:submenu> + + <p:submenu label="Help"> + <p:menuitem value="User Guide" ajax="true"/> + <p:separator/> + <p:menuitem value="About..." onclick="aboutDialog.show()" ajax="true"/> + </p:submenu> + + <p:menuitem styleClass="logOutButton" disabled="true" value="#{userBean.userName} [Log Out]" ajax="true"/> + </p:menubar> + + </h:form> + </p:layoutUnit> + + + <p:layoutUnit position="center" id="centerLayout"> + <h:form id="centerForm" style="height: 100%"> + + </h:form> + </p:layoutUnit> + + <p:layoutUnit position="south" size="150" header="Properties" resizable="true" collapsible="true"> + <h:form id="propertiesForm"> + + </h:form> + </p:layoutUnit> + + <p:layoutUnit position="east" size="300" header="Tool Palette" + resizable="true" collapsible="true"> + <h:form id="toolpalette"> + <p:accordionPanel multiple="true" activeIndex=""> + <p:tab title="Reader"> + <ui:repeat value="#{currentWorkSpaceProjectBean.availableReaders}" var="reader"> + <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(reader)}" update=":centerForm" /><br/> + <p:tooltip style="font-size: 15px" for="readerLink" value="#{currentWorkSpaceProjectBean.getDescription(reader)}"/> + </ui:repeat> + </p:tab> + <p:tab title="Filter"> + <ui:repeat value="#{currentWorkSpaceProjectBean.availableFilters}" var="filter"> + <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{currentWorkSpaceProjectBean.addPlugin(filter)}" update=":centerForm"/><br/> + <p:tooltip style="font-size: 15px" for="filterLink" value="#{currentWorkSpaceProjectBean.getDescription(filter)}"/> + </ui:repeat> + </p:tab> + <p:tab title="Repositories"> + <ui:repeat value="#{currentWorkSpaceProjectBean.availableRepositories}" var="repository"> + <p:commandLink value="#{repository.simpleName}" update=":centerForm"/><br/> + </ui:repeat> + </p:tab> + </p:accordionPanel> + </h:form> + </p:layoutUnit> + <!-- ******************************************************************************** --> + </p:layout> + + <p:growl id="messages" life="1500" showDetail="true" autoUpdate="false" sticky="false"/> + + <!-- Include the dialog for the configuration. --> + <ui:include src="dialogs/settingsDialog.xhtml" /> + + <!-- Include the about-dialog. --> + <ui:include src="dialogs/aboutDialog.xhtml" /> + + <!-- Include the dialog to handle the connections. --> + <ui:include src="dialogs/connectionDialog.xhtml" /> + + <ui:include src="dialogs/manageLibrariesDialog.xhtml" /> + </h:body> +</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/beans.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/beans.xml deleted file mode 100644 index 4ca8195bea5fa0604088aebf56ac3b1940c078b6..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> -</beans> diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/pretty-config.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/pretty-config.xml index 5d32888c9260b3866224eeace23bdcba3f171b3a..4862796d5c6dc05ec65447799767101b6d7fa318 100644 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/pretty-config.xml +++ b/Kieker.WebGUI/src/main/webapp/WEB-INF/pretty-config.xml @@ -1,27 +1,37 @@ <pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.2 - http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.2.xsd"> + xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.2 + http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.2.xsd"> <url-mapping id="home"> - <pattern value="/Kieker.WebGUI/main" /> - <view-id value="/faces/main.xhtml" /> - </url-mapping> + <pattern value="/Kieker.WebGUI/" /> + <view-id value="/faces/ProjectOverview.xhtml" /> + </url-mapping> + + <url-mapping id="projectOverview"> + <pattern value="/Kieker.WebGUI/projectOverview" /> + <view-id value="/faces/ProjectOverview.xhtml" /> + </url-mapping> + + <url-mapping id="projectWorkSpace"> + <pattern value="/Kieker.WebGUI/projectWorkSpace" /> + <view-id value="/faces/ProjectWorkSpace.xhtml" /> + </url-mapping> - <url-mapping id="projectDependencies"> - <pattern value="/Kieker.WebGUI/projectDependencies" /> - <view-id value="/faces/projectDependencies.xhtml" /> + <url-mapping id="analysisViewWorkSpace"> + <pattern value="/Kieker.WebGUI/analysisViewWorkSpace" /> + <view-id value="/faces/AnalysisViewWorkSpace.xhtml" /> </url-mapping> - <url-mapping id="manageDependencies"> - <pattern value="/Kieker.WebGUI/manageDependencies" /> - <view-id value="/faces/manageDependencies.xhtml" /> + <url-mapping id="analysisController"> + <pattern value="/Kieker.WebGUI/analysisController" /> + <view-id value="/faces/AnalysisController.xhtml" /> </url-mapping> - <url-mapping id="handleAnalysis"> - <pattern value="/Kieker.WebGUI/handleAnalysis" /> - <view-id value="/faces/handleAnalysis.xhtml" /> + <url-mapping id="analysisCockpit"> + <pattern value="/Kieker.WebGUI/analysisCockpit" /> + <view-id value="/faces/AnalysisCockpit.xhtml" /> </url-mapping> </pretty-config> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml index f456e788815738ee237b6856088cf88018ca18bd..b34b9846d2dfc1097d9bb346d6a8d26489d93078 100644 --- a/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml +++ b/Kieker.WebGUI/src/main/webapp/WEB-INF/web.xml @@ -1,29 +1,32 @@ <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> - <context-param> - <param-name>javax.faces.STATE_SAVING_METHOD</param-name> - <param-value>server</param-value> - </context-param> - <context-param> - <param-name>javax.faces.PROJECT_STAGE</param-name> - <param-value>Development</param-value> - </context-param> + <context-param> + <param-name>javax.faces.STATE_SAVING_METHOD</param-name> + <param-value>server</param-value> + </context-param> + <context-param> + <param-name>javax.faces.PROJECT_STAGE</param-name> + <param-value>Development</param-value> + </context-param> - <filter> - <filter-name>PrimeFaces FileUpload Filter</filter-name> - <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> - <init-param> - <param-name>thresholdSize</param-name> - <param-value>51200</param-value> - </init-param> - </filter> - <filter-mapping> - <filter-name>PrimeFaces FileUpload Filter</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> + <!-- This filter is necessary for the PrimeFaces file upload in order to work. --> + <filter> + <filter-name>PrimeFaces FileUpload Filter</filter-name> + <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> + <init-param> + <param-name>thresholdSize</param-name> + <param-value>51200</param-value> + </init-param> + </filter> - <context-param> + <filter-mapping> + <filter-name>PrimeFaces FileUpload Filter</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <!-- This here makes sure that the theme chooser of PrimeFaces will work. --> + <context-param> <param-name>primefaces.THEME</param-name> <param-value>#{currentThemeBean.theme}</param-value> </context-param> @@ -46,14 +49,15 @@ </session-config> <welcome-file-list> - <welcome-file>faces/main.xhtml</welcome-file> + <welcome-file>faces/ProjectWorkSpace.xhtml</welcome-file> </welcome-file-list> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> - <filter> + <!-- This filter will be used by Pretty Filter in order to use better looking URLs. --> + <filter> <filter-name>Pretty Filter</filter-name> <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class> </filter> diff --git a/Kieker.WebGUI/src/main/webapp/css/AnalysisCockpit.css b/Kieker.WebGUI/src/main/webapp/css/AnalysisCockpit.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Kieker.WebGUI/src/main/webapp/css/AnalysisController.css b/Kieker.WebGUI/src/main/webapp/css/AnalysisController.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Kieker.WebGUI/src/main/webapp/css/AnalysisViewWorkSpace.css b/Kieker.WebGUI/src/main/webapp/css/AnalysisViewWorkSpace.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Kieker.WebGUI/src/main/webapp/main.css b/Kieker.WebGUI/src/main/webapp/css/Common.css similarity index 80% rename from Kieker.WebGUI/src/main/webapp/main.css rename to Kieker.WebGUI/src/main/webapp/css/Common.css index 836787cdca65b3b836df3afec05a0d31c85e9183..a703913e6eaa5af48aa55d47bcea80b69f285688 100644 --- a/Kieker.WebGUI/src/main/webapp/main.css +++ b/Kieker.WebGUI/src/main/webapp/css/Common.css @@ -5,17 +5,13 @@ */ .ui-layout-north { z-index: 20 !important; - overflow: visible !important;; + overflow: visible !important; } .ui-layout-north .ui-layout-unit-content { overflow: visible !important; } -.ui-selectonemenu-items { - font-size: 15px; -} - .ui-layout-center { font-size: 15px; } @@ -36,19 +32,20 @@ font-size: 15px; } -.ui-contextmenu { - font-size: 15px; -} - .ui-dialog { font-size: 15px; width: auto; } -.projectInputText .pluginInputText { - width: 90%; -} +.ui-selectonemenu-items { + font-size: 15px; +} -.ui-tree { - width: auto; +.ui-tooltip { + font-size: 15px; +} + +.logOutButton { + position: absolute; + right: 5px; } \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/css/ProjectOverview.css b/Kieker.WebGUI/src/main/webapp/css/ProjectOverview.css new file mode 100644 index 0000000000000000000000000000000000000000..9f0c53b1da8fce88c8011317bd7b353b38eb677c --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/css/ProjectOverview.css @@ -0,0 +1,5 @@ +@charset "UTF-8"; + +.ui-datatable-odd { + background: none repeat scroll 0 0 #F2F5F9; +} \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/css/ProjectWorkSpace.css b/Kieker.WebGUI/src/main/webapp/css/ProjectWorkSpace.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Kieker.WebGUI/src/main/webapp/js-graph-it.css b/Kieker.WebGUI/src/main/webapp/css/js-graph-it.css similarity index 100% rename from Kieker.WebGUI/src/main/webapp/js-graph-it.css rename to Kieker.WebGUI/src/main/webapp/css/js-graph-it.css diff --git a/Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/aboutDialog.xhtml similarity index 82% rename from Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml rename to Kieker.WebGUI/src/main/webapp/dialogs/aboutDialog.xhtml index 5bae983c2384c74a0e1f340097f26ddabeb29657..a79f154519c5698b1fe3d7cc061835c76318b0ea 100644 --- a/Kieker.WebGUI/src/main/webapp/main/aboutDialog.xhtml +++ b/Kieker.WebGUI/src/main/webapp/dialogs/aboutDialog.xhtml @@ -5,8 +5,6 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> - <!-- ******************************************************************************** --> - <!-- This is the about-dialog. --> <p:dialog header="About..." resizable="false" modal="true" widgetVar="aboutDialog" id="aboutDialog"> <h:form> @@ -27,5 +25,4 @@ </div> </h:form> </p:dialog> - <!-- ******************************************************************************** --> </ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/connectionDialog.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/connectionDialog.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..dc17e985705db3cbb9c18b5269d7a1c649de1448 --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/dialogs/connectionDialog.xhtml @@ -0,0 +1,15 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <p:dialog id="connectionDialog" header="Manage Connections" resizable="false" modal="true" widgetVar="connectionDialog"> + <h:form id="connectionDialogForm" rendered="#{not empty selectedMainProjectBean.mainProject}"> + + </h:form> + </p:dialog> + <!-- ******************************************************************************** --> +</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/manageLibrariesDialog.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/manageLibrariesDialog.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..9e4df24417d2b9c70f62fbfec9def811bc98f2ad --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/dialogs/manageLibrariesDialog.xhtml @@ -0,0 +1,46 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui"> + + <p:dialog id="manageLibrariesDialog" header="Libraries" resizable="false" + modal="true" widgetVar="manageLibrariesDialog"> + + <h:form id="dependenciesForm"> + <p:dataTable id="currentDependencies" value="#{currentWorkSpaceProjectBean.libraries}" var="dependency" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" > + + <p:column headerText="Filename"> + <h:outputText value="#{dependency.fst}"/> + </p:column> + + <p:column headerText="Size" style="text-align: center"> + <h:outputText value="#{dependency.snd} [MiByte]"/> + </p:column> + + <p:column headerText="Options" style="text-align: center; width:40px"> + <p:commandButton id="deleteButton" icon="ui-icon-trash"/> + <p:tooltip for="deleteButton" value="Delete Library"/> + </p:column> + </p:dataTable> + </h:form> + + <p:spacer width="0" height="5"/> + <div> + <!-- This is the form for the uploading. --> + <h:outputText value="Currently only *.jar-Dependencies can be uploaded. The maximal file size is limited to 100 [MiByte]." /> + <br /> + <br /> + <h:form enctype="multipart/form-data"> + <p:fileUpload auto="true" allowTypes="/(\.|\/)(jar)$/" sizeLimit="104857600" mode="advanced" fileUploadListener="#{currentWorkSpaceProjectBean.handleFileUpload}" update=":dependenciesForm :messages"/> + </h:form> + </div> + <hr/> + <div style="text-align: right"> + <h:form> + <p:commandButton value="Ok" ajax="true" onclick="manageLibrariesDialog.hide()" /> + </h:form> + </div> + </p:dialog> +</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/dialogs/projectDialogs.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/projectDialogs.xhtml new file mode 100644 index 0000000000000000000000000000000000000000..77d967d22f88aad45d5de9b9fce21d671cc1538d --- /dev/null +++ b/Kieker.WebGUI/src/main/webapp/dialogs/projectDialogs.xhtml @@ -0,0 +1,30 @@ +<ui:composition + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:p="http://primefaces.org/ui" + xmlns:c="http://java.sun.com/jsp/jstl/core"> + + <!-- ******************************************************************************** --> + <!-- This is the dialog to create a new project. --> + <p:dialog id="newProjectDialog" header="New Project" resizable="false" modal="true" widgetVar="newProjectDialog"> + <!-- Make sure that closing of the dialog also clears the input field. --> + <p:ajax event="close" update="newProjectDialogForm:newProjectInputText" /> + + <h:form id="newProjectDialogForm"> + <div style="text-align: center"> + <h:outputText value="Name: " /> + <p:inputText id="newProjectInputText" value="#{stringBean.string}" /> + </div> + + <hr/> + <div style="text-align: right"> + <p:commandButton value="Ok" action="#{projectsBean.addProject(stringBean.string)}" update=":projectsListForm :messages" oncomplete="newProjectDialog.hide()" /> + <p:spacer width="10px" height="10" /> + <p:commandButton value="Cancel" onclick="newProjectDialog.hide()" /> + </div> + </h:form> + </p:dialog> + <!-- ******************************************************************************** --> +</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml b/Kieker.WebGUI/src/main/webapp/dialogs/settingsDialog.xhtml similarity index 80% rename from Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml rename to Kieker.WebGUI/src/main/webapp/dialogs/settingsDialog.xhtml index 8b3035af5f58c0ff1beeac3e796639b77c1dc01b..a47b05babb4f1c61124933d652793d4b876780c0 100644 --- a/Kieker.WebGUI/src/main/webapp/main/settingsDialog.xhtml +++ b/Kieker.WebGUI/src/main/webapp/dialogs/settingsDialog.xhtml @@ -5,8 +5,6 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> - <!-- ******************************************************************************** --> - <!-- This is the dialog for settings and properties. --> <p:dialog id="settingsDialog" header="Settings" resizable="false" modal="true" widgetVar="settingsDialog"> <h:form> @@ -24,5 +22,4 @@ </div> </h:form> </p:dialog> - <!-- ******************************************************************************** --> </ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/handleAnalysis.css b/Kieker.WebGUI/src/main/webapp/handleAnalysis.css deleted file mode 100644 index 0bb60d77c5fdae3ee61386549dab9575a2c0af1d..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/handleAnalysis.css +++ /dev/null @@ -1,37 +0,0 @@ -@charset "UTF-8"; - -.ui-button { - font-size: 15px; -} - -.fileinput-button { - font-size: 5px; -} - -.ui-layout-center { - font-size: 15px; -} - -.ui-layout-north { - font-size: 15px; -} - -.ui-layout-south { - font-size: 15px; -} - -.ui-layout-east { - font-size: 15px; -} - -.ui-layout-west { - font-size: 15px; -} - -.ui-datatable { - font-size: 15px; -} - -.ui-panel { - font-size: 15px; -} \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml b/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml deleted file mode 100644 index e180744ca194e1beaa54da83019d8989cb9c5934..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/handleAnalysis.xhtml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <f:view contentType="text/html"> - <h:head> - <title>Kieker.WebGUI - Analysis</title> - <link rel="stylesheet" type="text/css" href="../handleAnalysis.css" /> - <script type="text/javascript" src="../js-graph-it.js"/> - <link rel="stylesheet" type="text/css" href="../js-graph-it.css"/> - <style> - .block { - position: absolute; - } - .connector { - background-color: #FF9900; - } - </style> - </h:head> - - <h:body onload="initPageObjects();"> - - <p:layout fullPage="true"> - <p:layoutUnit header="Navigation" position="north" collapsible="true" resizable="true"> - <!-- The control panel to get back. --> - <h:form> - <c:if test="#{empty selectedProjectBean.selectedProject}"> - No project selected. - </c:if> - Click - <h:link outcome="/main">here</h:link> - to get back to the main menu. - </h:form> - </p:layoutUnit> - - <c:choose> - <c:when test="#{empty selectedProjectBean.selectedProject}"> - <p:layoutUnit position="center" > - </p:layoutUnit> - </c:when> - <c:otherwise> - - <p:layoutUnit position="center"> - <h:form id="centerForm"> - <p:dashboard id="dashboard" binding="#{dashboardBean.dashboard}"> - - </p:dashboard> - </h:form> - </p:layoutUnit> - - <p:layoutUnit position="west" size="200" resizable="true" collapsible="true" header="Plugins"> - <h:form id="pluginsForm"> - <p:accordionPanel value="#{analysisControllerBean.pluginMap.keySet().toArray()}" var="plugin" multiple="true" activeIndex=""> - <p:tab title="#{plugin.name}"> - <ui:repeat value="#{projectsBean.getWidgets(analysisControllerBean.pluginMap.get(plugin).getClass())}" var="widget"> - <p:commandLink value="#{widget.name}" ajax="true" update=":centerForm" action="#{dashboardBean.addWidget(widget)}"/><br/> - </ui:repeat> - </p:tab> - </p:accordionPanel> - </h:form> - </p:layoutUnit> - - <p:layoutUnit position="south" header="Analysis Control" resizable="true" collapsible="true"> - <h:form id="analysisForm"> - <p:commandButton value="Instantiate Analysis" action="#{analysisControllerBean.instantiate(selectedProjectBean.selectedProject)}" update=":analysisForm:analysisStateText :pluginsForm"/> - <p:commandButton id="startAnalysisButton" value="Start Analysis" async="true" action="#{analysisControllerBean.controller.run()}" disabled="#{empty analysisControllerBean.controller}"/> - <p:commandButton id="stopAnalysisButton" value="Stop Analysis" async="true" action="#{analysisControllerBean.controller.terminate()}" disabled="#{empty analysisControllerBean.controller}"/> - <p:spacer height="0px" width="150px"/> - <c:choose> - <c:when test="#{empty analysisControllerBean.controller}"> - <h:outputText id="analysisStateText" value="Analysis State: N/A"/><br/> - </c:when> - <c:otherwise> - <h:outputText id="analysisStateText" value="Analysis State: #{analysisControllerBean.controller.state}"/> - </c:otherwise> - </c:choose> - <br/> - <p:spacer width="0px" height="5px"/> - <p:scrollPanel id="logPanel" style="height: 150px"> - <ui:repeat var="entry" value="#{analysisControllerBean.logEntries}"> - <h:outputText value="#{entry}" /><br/> - </ui:repeat> - </p:scrollPanel> - <p:poll interval="2" update=":analysisForm:logPanel :analysisForm:analysisStateText :analysisForm:startAnalysisButton :analysisForm:stopAnalysisButton"/> - </h:form> - </p:layoutUnit> - - </c:otherwise> - </c:choose> - </p:layout> - - - </h:body> - </f:view> - -</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Gray.png b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Gray.png new file mode 100644 index 0000000000000000000000000000000000000000..71c7b7afb598667ce2d3b94fe461a3a2c2c361b6 Binary files /dev/null and b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Gray.png differ diff --git a/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Green.png b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Green.png new file mode 100644 index 0000000000000000000000000000000000000000..1a55bc171a3924d89ba0995889f6c18c26ad85b4 Binary files /dev/null and b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Green.png differ diff --git a/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Red.png b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Red.png new file mode 100644 index 0000000000000000000000000000000000000000..0bf9ba32d99ac0b9f65ffa4a0ffa5d4442e0419b Binary files /dev/null and b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Red.png differ diff --git a/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Yellow.png b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..a2e9505e043f72fdfff21182f2a51ebecd69df75 Binary files /dev/null and b/Kieker.WebGUI/src/main/webapp/img/Icon_LED_Yellow.png differ diff --git a/Kieker.WebGUI/src/main/webapp/main/arrow.gif b/Kieker.WebGUI/src/main/webapp/img/arrow.gif similarity index 100% rename from Kieker.WebGUI/src/main/webapp/main/arrow.gif rename to Kieker.WebGUI/src/main/webapp/img/arrow.gif diff --git a/Kieker.WebGUI/src/main/webapp/main/arrow_d.gif b/Kieker.WebGUI/src/main/webapp/img/arrow_d.gif similarity index 100% rename from Kieker.WebGUI/src/main/webapp/main/arrow_d.gif rename to Kieker.WebGUI/src/main/webapp/img/arrow_d.gif diff --git a/Kieker.WebGUI/src/main/webapp/main/arrow_l.gif b/Kieker.WebGUI/src/main/webapp/img/arrow_l.gif similarity index 100% rename from Kieker.WebGUI/src/main/webapp/main/arrow_l.gif rename to Kieker.WebGUI/src/main/webapp/img/arrow_l.gif diff --git a/Kieker.WebGUI/src/main/webapp/main/arrow_r.gif b/Kieker.WebGUI/src/main/webapp/img/arrow_r.gif similarity index 100% rename from Kieker.WebGUI/src/main/webapp/main/arrow_r.gif rename to Kieker.WebGUI/src/main/webapp/img/arrow_r.gif diff --git a/Kieker.WebGUI/src/main/webapp/main/arrow_u.gif b/Kieker.WebGUI/src/main/webapp/img/arrow_u.gif similarity index 100% rename from Kieker.WebGUI/src/main/webapp/main/arrow_u.gif rename to Kieker.WebGUI/src/main/webapp/img/arrow_u.gif diff --git a/Kieker.WebGUI/src/main/webapp/js-graph-it.js b/Kieker.WebGUI/src/main/webapp/js/js-graph-it.js similarity index 100% rename from Kieker.WebGUI/src/main/webapp/js-graph-it.js rename to Kieker.WebGUI/src/main/webapp/js/js-graph-it.js diff --git a/Kieker.WebGUI/src/main/webapp/main.xhtml b/Kieker.WebGUI/src/main/webapp/main.xhtml deleted file mode 100644 index fc9dd9bb8b28614b07e710478dff32eb3ec6e2aa..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/main.xhtml +++ /dev/null @@ -1,223 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <f:view contentType="text/html"> - <h:head> - <title>Kieker.WebGUI</title> - <link rel="stylesheet" type="text/css" href="../main.css" /> - <script type="text/javascript" src="../js-graph-it.js"/> - <link rel="stylesheet" type="text/css" href="../js-graph-it.css"/> - <style> - .block { - position: absolute; - } - .connector { - background-color: #FF9900; - } - </style> - </h:head> - - <h:body onload="initPageObjects();"> - - <!-- This is the layout for the whole page. --> - <p:layout id="layout" fullPage="true"> - - <!-- ******************************************************************************** --> - <!-- This is the top unit within the layout and is used for the menu bar. --> - <p:layoutUnit position="north" size="60" collapsible="false"> - <h:form> - <p:menubar> - <p:submenu label="File"> - <p:menuitem value="New Project" onclick="newProjectDialog.show()" ajax="true" /> - <p:menuitem value="Import Project" ajax="true" /> - <p:menuitem value="Manage Dependencies" ajax="false" url="/Kieker.WebGUI/manageDependencies" /> - <p:separator /> - <p:menuitem value="Settings" onclick="settingsDialog.show()" ajax="true" /> - </p:submenu> - - <!-- This is the submenu for the current project, for example if someone doesn't want to use the context menu within the browser. --> - <p:submenu label="Current Project"> - <p:menuitem value="Save Project" ajax="true" action="#{projectsBean.saveProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" /> - <p:menuitem value="Set as Main Project" ajax="true" action="#{selectedMainProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}"/> - <p:separator /> - <p:menuitem value="Delete Project" ajax="true" onclick="deleteProjectDialog.show()" /> - <p:menuitem value="Reset Project" ajax="true" onclick="resetProjectDialog.show()" /> - <p:separator /> - <p:menuitem value="Configure Dependencies" ajax="false" url="/Kieker.WebGUI/projectDependencies" /> - <p:separator /> - <p:menuitem value="Analysis" ajax="false" url="/Kieker.WebGUI/handleAnalysis" /> - </p:submenu> - - <p:submenu label="Help"> - <p:menuitem value="About..." ajax="true" onclick="aboutDialog.show()" /> - </p:submenu> - </p:menubar> - - </h:form> - </p:layoutUnit> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- The following layout is at the left side of the page and shows the available projects. --> - <p:layoutUnit header="Projects" collapsible="true" position="west" size="200" resizable="true" minSize="100"> - <h:form id="projectsForm"> - <p:tree selection="#{selectedProjectBean.selectedNode}" id="projectsTree" selectionMode="single" value="#{projectsBean.projectsRoot}" var="node"> - <p:ajax event="select" listener="#{selectedProjectBean.onNodeSelect}"/> - - <p:treeNode type="project"> - <h:outputText style="font-weight: #{selectedMainProjectBean.mainProject == node ? 'bold' : 'normal' }" value="#{node.name}"/> - </p:treeNode> - - <p:treeNode type="dependencies"> - <h:outputText value="#{node}" /> - </p:treeNode> - - <p:treeNode type="usedPlugins"> - <h:outputText value="#{node}" /> - </p:treeNode> - - <p:treeNode type="usedPlugin"> - <h:outputText value="#{node}" /> - </p:treeNode> - </p:tree> - - <p:contextMenu for="projectsTree" nodeType="project"> - <p:menuitem value="Save Project" ajax="true" action="#{projectsBean.saveProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" /> - <p:menuitem value="Set as Main Project" ajax="true" action="#{selectedMainProjectBean.setMainProject(selectedProjectBean.getSelectedProject())}" /> - <p:separator /> - <p:menuitem value="Delete Project" ajax="true" onclick="deleteProjectDialog.show()" /> - - <p:menuitem value="Reset Project" ajax="true" onclick="resetProjectDialog.show()" /> - <p:separator /> - <p:menuitem value="Configure Dependencies" ajax="false" url="/Kieker.WebGUI/projectDependencies" /> - <p:separator /> - <p:menuitem value="Analysis" ajax="false" url="/Kieker.WebGUI/handleAnalysis" /> - </p:contextMenu> - - <p:contextMenu for="projectsTree" nodeType="dependencies"> - </p:contextMenu> - - <p:contextMenu for="projectsTree" nodeType="usedPlugins"> - </p:contextMenu> - </h:form> - - </p:layoutUnit> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- The following layout unit is within the center and used for the graph. --> - <p:layoutUnit position="center" id="centerLayout"> - <h:form id="centerForm" style="height: 100%"> - <div class="canvas" id="mainCanvas" style="width : 500px;height: 500px"> - <c:forEach items="#{selectedMainProjectBean.mainProject.plugins}" var="plugin" varStatus="counter"> - <p:remoteCommand name="setPlugin#{counter.index}" action="#{selectedPluginBean.setPlugin(plugin)}"/> - <!-- Netbeans reports an error here, but the code does still work though... --> - <div onclick="setPlugin#{counter.index}();" class="ui-panel ui-widget ui-widget-content ui-corner-all block draggable" id="#{stringToIDBean.stringToID(plugin)}" > - <div class="ui-panel-titlebar ui-widget-header ui-corner-all"> - <h:outputText style="font-weight: bold" value="#{plugin.getName()}"/> - </div> - <p:commandLink ajax="true" value="Connections" update=":connectionDialogForm" onclick="connectionDialog.show();"/> - <br/> - <p:commandLink ajax="true" value="Remove" action="#{selectedMainProjectBean.removePlugin(plugin)}" update=":propertiesForm"/> - </div> - - </c:forEach> - <c:forEach items="#{selectedMainProjectBean.validConnections}" var="connection"> - <div class="connector #{stringToIDBean.stringToID(connection.source)} #{stringToIDBean.stringToID(connection.destination)}"> - <label class="source-label"><h:outputText value="#{connection.outputPort.getName()}"/></label> - <label class="destination-label"><h:outputText value="#{connection.inputPort.getName()}"/></label> - - <img src="../main/arrow.gif" class="connector-end"/> - </div> - </c:forEach> - </div> - </h:form> - </p:layoutUnit> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- The following layout unit is located at the bottom and will be used for properties. --> - <p:layoutUnit position="south" size="150" header="Properties" resizable="true" collapsible="true"> - <h:form id="propertiesForm"> - <c:if test="#{not empty selectedPluginBean.plugin}"> - <p:dataTable value="#{selectedPluginBean.advancedProperties}" var="property" id="propertiesList" emptyMessage="No properties available"> - <p:column headerText="Key" style="width:125px"> - <h:outputText value="#{property.name}" rendered="#{not stringBean.checkString(property)}"/> - <h:outputText value="Name" rendered="#{stringBean.checkString(property)}"/> - </p:column> - - <p:column headerText="Value" style="width:125px"> - <p:cellEditor> - <f:facet name="output"> - <h:outputText value="#{property.value}" rendered="#{not stringBean.checkString(property)}"/> - <h:outputText value="#{selectedPluginBean.plugin.name}" rendered="#{stringBean.checkString(property)}"/> - </f:facet> - <f:facet name="input"> - <h:inputText value="#{property.value}" rendered="#{not stringBean.checkString(property)}"/> - <h:inputText value="#{selectedPluginBean.plugin.name}" rendered="#{stringBean.checkString(property)}"/> - </f:facet> - </p:cellEditor> - </p:column> - - <p:column headerText="Options" style="width:50px"> - <p:rowEditor /> - </p:column> - - <p:ajax event="rowEdit" update=":centerForm" /> - </p:dataTable> - </c:if> - </h:form> - </p:layoutUnit> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- The following layout unit is located at the right side of the page and is used as a tool palette. It shows the available plugins etc. --> - <p:layoutUnit position="east" size="300" header="Tool Palette" - resizable="true" collapsible="true"> - <h:form id="toolpalette"> - <p:accordionPanel multiple="true" activeIndex=""> - <p:tab title="Reader"> - <ui:repeat value="#{selectedMainProjectBean.availableReaders}" var="reader"> - <p:commandLink id="readerLink" value="#{reader.simpleName}" action="#{selectedMainProjectBean.addPlugin(reader)}" update=":projectsForm :centerForm" /><br/> - <p:tooltip style="font-size: 15px" for="readerLink" value="#{projectsBean.getDescription(reader)}"/> - </ui:repeat> - </p:tab> - <p:tab title="Filter"> - <ui:repeat value="#{selectedMainProjectBean.availableFilters}" var="filter"> - <p:commandLink id="filterLink" value="#{filter.simpleName}" action="#{selectedMainProjectBean.addPlugin(filter)}" update=":projectsForm :centerForm"/><br/> - <p:tooltip style="font-size: 15px" for="filterLink" value="#{projectsBean.getDescription(filter)}"/> - </ui:repeat> - </p:tab> - <p:tab title="Repositories"> - <ui:repeat value="#{selectedMainProjectBean.availableRepositories}" var="repository"> - <p:commandLink value="#{repository.simpleName}" update=":projectsForm :centerForm"/><br/> - </ui:repeat> - </p:tab> - </p:accordionPanel> - </h:form> - </p:layoutUnit> - <!-- ******************************************************************************** --> - </p:layout> - - <p:growl id="messages" showDetail="true" autoUpdate="true" sticky="false"/> - - <!-- Include the dialogs for creating/deleting projects etc. --> - <ui:include src="main/projectDialogs.xhtml" /> - - <!-- Include the dialog for the configuration. --> - <ui:include src="main/settingsDialog.xhtml" /> - - <!-- Include the about-dialog. --> - <ui:include src="main/aboutDialog.xhtml" /> - - <!-- Include the dialog to handle the connections. --> - <ui:include src="main/connectionDialog.xhtml" /> - </h:body> - </f:view> -</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml b/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml deleted file mode 100644 index cf19e145f55bc42ec88f2d5ab7f8881eb1171da0..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/main/connectionDialog.xhtml +++ /dev/null @@ -1,96 +0,0 @@ -<ui:composition - xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <!-- ******************************************************************************** --> - <p:dialog id="connectionDialog" header="Manage Connections" resizable="false" modal="true" widgetVar="connectionDialog"> - <h:form id="connectionDialogForm" rendered="#{not empty selectedMainProjectBean.mainProject}"> - <p:commandButton value="Add Connection" ajax="true" action="#{selectedMainProjectBean.addConnection()}" update=":connectionDialogForm"/> - <br/><br/> - <p:dataTable value="#{selectedMainProjectBean.connections}" var="connection" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"> - - <p:column headerText="Source" style="width:125px"> - <p:cellEditor> - <f:facet name="output"> - <h:outputText value="#{empty connection.source ? 'N/A' : connection.source.name}"/> - </f:facet> - <f:facet name="input"> - <p:selectOneMenu converter="kieker.webgui.converter.MIPluginToStringConverter" value="#{connection.source}" effectDuration="100"> - <f:selectItem value="#{null}" itemLabel="N/A" itemValue="#{null}"/> - <f:selectItems value="#{selectedMainProjectBean.mainProject.plugins}" var="plugin" itemLabel="#{plugin.name}" itemValue="#{plugin}"/> - <p:ajax event="change" update="validColumn outputPortsList"/> - </p:selectOneMenu> - </f:facet> - </p:cellEditor> - </p:column> - - <p:column headerText="Output Port" style="width:125px"> - <p:cellEditor> - <f:facet name="output"> - <h:outputText value="#{empty connection.outputPort ? 'N/A' : connection.outputPort.name}"/> - </f:facet> - <f:facet name="input"> - <h:form id="outputPortsList"> - <p:selectOneMenu rendered="#{not empty connection.source}" converter="kieker.webgui.converter.MIPortToStringConverter" value="#{connection.outputPort}" effectDuration="100"> - <f:selectItem value="#{null}" itemLabel="N/A" itemValue="#{null}"/> - <f:selectItems value="#{connection.source.outputPorts}" var="port" itemLabel="#{port.name}" itemValue="#{port}"/> - <p:ajax event="change" update="validColumn"/> - </p:selectOneMenu> - </h:form> - </f:facet> - </p:cellEditor> - </p:column> - - <p:column headerText="Destination" style="width:125px"> - <p:cellEditor> - <f:facet name="output"> - <h:outputText value="#{empty connection.destination ? 'N/A' : connection.destination.name}"/> - </f:facet> - <f:facet name="input"> - <p:selectOneMenu converter="kieker.webgui.converter.MIPluginToStringConverter" value="#{connection.destination}" effectDuration="100"> - <f:selectItem value="#{null}" itemLabel="N/A" itemValue="#{null}"/> - <f:selectItems value="#{selectedMainProjectBean.filters}" var="plugin" itemLabel="#{plugin.name}" itemValue="#{plugin}"/> - <p:ajax event="change" update="validColumn inputPortsList"/> - </p:selectOneMenu> - </f:facet> - </p:cellEditor> - </p:column> - - <p:column headerText="Input Port" style="width:125px"> - <p:cellEditor> - <f:facet name="output"> - <h:outputText value="#{empty connection.inputPort ? 'N/A' : connection.inputPort.name}"/> - </f:facet> - <f:facet name="input"> - <h:form id="inputPortsList"> - <p:selectOneMenu rendered="#{not empty connection.destination}" converter="kieker.webgui.converter.MIPortToStringConverter" value="#{connection.inputPort}" effectDuration="100"> - <f:selectItem value="#{null}" itemLabel="N/A" itemValue="#{null}"/> - <f:selectItems value="#{connection.destination.inputPorts}" var="port" itemLabel="#{port.name}" itemValue="#{port}"/> - <p:ajax event="change" update="validColumn"/> - </p:selectOneMenu> - </h:form> - </f:facet> - </p:cellEditor> - </p:column> - - <p:column id="validColumn" headerText="Valid" style="width:50px"> - <h:outputText value="#{connection.valid ? 'True' : 'False'}"/> - </p:column> - - <p:column headerText="Options" style="width:50px"> - <p:rowEditor /> - </p:column> - </p:dataTable> - <br/> - <hr/> - <div style="text-align: right"> - <p:commandButton value="Ok" action="#{selectedMainProjectBean.submitConnections()}" oncomplete="connectionDialog.hide();" /> - </div> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> -</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml b/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml deleted file mode 100644 index 1a6dbb7abe2f5f31eed33f40d7cd610dbc6512e2..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/main/projectDialogs.xhtml +++ /dev/null @@ -1,66 +0,0 @@ -<ui:composition - xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://java.sun.com/jsf/facelets" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <!-- ******************************************************************************** --> - <!-- This is the dialog to create a new project. --> - <p:dialog id="newProjectDialog" header="New Project" resizable="false" modal="true" widgetVar="newProjectDialog"> - <!-- Make sure that closing of the dialog also clears the input field. --> - <p:ajax event="close" update="newProjectDialogForm:newProjectInputText" /> - - <h:form id="newProjectDialogForm"> - <div style="text-align: center"> - <h:outputText value="Name: " /> - <p:inputText id="newProjectInputText" value="#{stringBean.string}" /> - </div> - - <hr/> - <div style="text-align: right"> - <p:commandButton value="Ok" action="#{projectsBean.addProject(stringBean.string)}" oncomplete="newProjectDialog.hide()" /> - <p:spacer width="10px" height="10" /> - <p:commandButton value="Cancel" onclick="newProjectDialog.hide()" /> - </div> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- This is the dialog to delete the selected project. --> - <p:dialog id="deleteProjectDialog" header="Delete Project" resizable="false" modal="true" widgetVar="deleteProjectDialog"> - <h:form> - <div style="text-align: center"> - <h:outputText value="Do you really want to remove the selected project?" /> - </div> - - <hr/> - <div style="text-align: right"> - <p:commandButton value="Yes" action="#{projectsBean.deleteProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" oncomplete="deleteProjectDialog.hide()" /> - <p:spacer width="10px" height="10" /> - <p:commandButton value="Cancel" onclick="deleteProjectDialog.hide()" /> - </div> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> - - <!-- ******************************************************************************** --> - <!-- This is the dialog to reset the selected project. --> - <p:dialog id="resetProjectDialog" header="Reset Project" resizable="false" modal="true" widgetVar="resetProjectDialog"> - <h:form> - <div style="text-align: center"> - <h:outputText value="Do you really want to reset the selected project?" /> - </div> - - <hr/> - <div style="text-align: right"> - <p:commandButton value="Yes" action="#{projectsBean.resetProject(selectedProjectBean.getSelectedProject())}" update=":projectsForm" oncomplete="resetProjectDialog.hide()" /> - <p:spacer width="10px" height="10" /> - <p:commandButton value="Cancel" onclick="resetProjectDialog.hide()" /> - </div> - </h:form> - </p:dialog> - <!-- ******************************************************************************** --> -</ui:composition> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/manageDependencies.css b/Kieker.WebGUI/src/main/webapp/manageDependencies.css deleted file mode 100644 index 4f9b12fd3116141d257c9ede86522175e40f977f..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/manageDependencies.css +++ /dev/null @@ -1,30 +0,0 @@ -@charset "UTF-8"; - -.ui-button { - font-size: 15px; -} - -.fileinput-button { - font-size: 5px; -} - -.ui-layout-center { - font-size: 15px; -} - -.ui-layout-north { - font-size: 15px; -} - -.ui-layout-south { - font-size: 15px; -} - - -.ui-datatable { - font-size: 15px; -} - -.ui-panel { - font-size: 15px; -} \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/manageDependencies.xhtml b/Kieker.WebGUI/src/main/webapp/manageDependencies.xhtml deleted file mode 100644 index 6ed5e5757a004160a2524ee35c60aee37cb4f550..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/manageDependencies.xhtml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui"> - - <f:view contentType="text/html"> - <h:head> - <title>Kieker.WebGUI - Dependencies</title> - <link rel="stylesheet" type="text/css" href="../manageDependencies.css" /> - </h:head> - - <h:body> - - <p:layout fullPage="true"> - <p:layoutUnit header="Navigation" position="north" collapsible="true" resizable="true"> - <!-- The control panel to get back. --> - <h:form> - Click - <h:link outcome="/main">here</h:link> - to get back to the main menu. - </h:form> - </p:layoutUnit> - - <p:layoutUnit header="Currently available Dependencies" position="center" > - <!-- This form shows the currently available dependencies. --> - <h:form id="currentDependenciesForm"> - <p:dataTable id="currentDependencies" value="#{dependenciesBean.dependencies}" var="dependency" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" > - - <p:column> - <f:facet name="header"> - Filename - </f:facet> - <h:outputText value="#{dependency}" > - <f:converter converterId="kieker.webgui.converter.MIDependencyToStringConverter" /> - </h:outputText> - </p:column> - - <p:column> - <f:facet name="header"> - Size - </f:facet> - <div align="center"> - <h:outputText value="#{dependency}" > - <f:converter converterId="kieker.webgui.converter.MIDependencyToSizeConverter" /> - </h:outputText> - </div> - </p:column> - - <p:column> - <f:facet name="header"> - # Plugins - </f:facet> - <div align="center"> - <h:outputText value="#{dependency}" > - <f:converter converterId="kieker.webgui.converter.MIDependencyToCountPluginsConverter" /> - </h:outputText> - </div> - </p:column> - - <p:column style="width:40px"> - <f:facet name="header"> - </f:facet> - <div align="center"> - <p:commandButton ajax="true" update=":currentDependenciesForm" icon="ui-icon-trash" title="Delete" - action="#{dependenciesBean.deleteDependency(dependency)}"/> - </div> - </p:column> - </p:dataTable> - </h:form> - </p:layoutUnit> - - <p:layoutUnit header="Upload Dependencies" position="south" collapsible="true" resizable="true"> - <!-- This is the form for the uploading. --> - <h:outputText value="Currently only *.jar-Dependencies can be uploaded. The maximal file size is limited to 100 [MiByte]." /> - <br /> - <br /> - <h:form enctype="multipart/form-data"> - <p:fileUpload value="#{dependencyUploadBean.file}" - allowTypes="/(\.|\/)(jar)$/" - sizeLimit="104857600" - mode="simple" /> - - <p:spacer width ="50px" height="0px"/> - <p:commandLink ajax="false" actionListener="#{dependencyUploadBean.upload}"> - <h:outputText value="Upload File" /> - </p:commandLink> - </h:form> - - </p:layoutUnit> - - </p:layout> - </h:body> - </f:view> - -</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/projectDependencies.css b/Kieker.WebGUI/src/main/webapp/projectDependencies.css deleted file mode 100644 index 06cd434ce5cca7a87cadedde3b67a351baa72e07..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/projectDependencies.css +++ /dev/null @@ -1,26 +0,0 @@ -@charset "UTF-8"; - -.ui-button { - font-size: 15px; -} - -.ui-layout-center { - font-size: 15px; -} - -.ui-layout-north { - font-size: 15px; -} - -.ui-panel { - font-size: 15px; -} - -.my-picklist .ui-picklist .ui-picklist-list { - height: 120px; - width: 520px; -} - -.column { - vertical-align: top -} \ No newline at end of file diff --git a/Kieker.WebGUI/src/main/webapp/projectDependencies.xhtml b/Kieker.WebGUI/src/main/webapp/projectDependencies.xhtml deleted file mode 100644 index d74b128d8784ed669dae6e97acc3e81c193df1c2..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/webapp/projectDependencies.xhtml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:p="http://primefaces.org/ui" - xmlns:c="http://java.sun.com/jsp/jstl/core"> - - <f:view contentType="text/html"> - <h:head> - <title>Kieker.WebGUI - Project Dependencies</title> - <link rel="stylesheet" title="Standard-Stylesheet" type="text/css" - href="../projectDependencies.css" /> - </h:head> - <body> - - <p:layout fullPage="true"> - <p:layoutUnit header="Navigation" position="north" collapsible="true" resizable="true"> - <!-- The control panel to get back. --> - <h:form> - <c:if test="#{empty selectedProjectBean.selectedProject}"> - No project selected. - </c:if> - Click - <h:link outcome="/main">here</h:link> - to get back to the main menu. - </h:form> - </p:layoutUnit> - - <c:choose> - <c:when test="#{empty selectedProjectBean.selectedProject}"> - <p:layoutUnit position="center" > - </p:layoutUnit> - </c:when> - <c:otherwise> - - <p:layoutUnit header="Currently used Dependencies for '#{selectedProjectBean.selectedProject.name}'" position="center" > - <h:form> - <h:panelGrid columns="2" columnClasses="column"> - <h:panelGrid columns="1"> - <p:commandButton ajax="true" value="Accept Selection" action="#{selectedDependenciesBean.submit()}" style="width: 100%" update=":messages"/> - <p:commandButton ajax="true" value="Reset Selection" style="width: 100%" /> - </h:panelGrid> - <p:selectManyCheckbox value="#{selectedDependenciesBean.dependencies}" - layout="pageDirection" - converter="kieker.webgui.converter.MIDependencyToStringConverter"> - <f:selectItems value="#{dependenciesBean.dependencies}" - var="dependency" itemLabel="#{dependency.filePath}" - itemValue="#{dependency}" /> - </p:selectManyCheckbox> - </h:panelGrid> - </h:form> - </p:layoutUnit> - - </c:otherwise> - </c:choose> - - </p:layout> - - <p:growl id="messages" showDetail="true" autoUpdate="true" sticky="false"/> - - </body> - </f:view> - -</html> \ No newline at end of file diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/common/LRUCacheTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/common/LRUCacheTest.java deleted file mode 100644 index e6bd40231bef34d599a0755c9713a360b2bf8811..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/test/java/kieker/webgui/common/LRUCacheTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package kieker.webgui.common; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.junit.Test; - -/** - * TestCase for {@link LRUCache}. - * - * @author Nils Christian Ehmke - * @version 1.0 - */ -public class LRUCacheTest extends TestCase { - - /** - * Creates a new instance of this class. - */ - public LRUCacheTest() {} - - @Test - public void testEntryStorage() { - final int n = 5; - final LRUCache<Integer, Integer> cache = new LRUCache<Integer, Integer>(n); - - // Make sure that there is nothing stored under the given values yet. - for (int i = 0; i < n; i++) { - Assert.assertNull(cache.get(i)); - } - - // Store everything - for (int i = 0; i < n; i++) { - cache.add(i, n - i); - } - - // Make sure that the values are still available - for (int i = 0; i < n; i++) { - Assert.assertEquals((Integer) (n - i), cache.get(i)); - } - - // Overwrite an entry - cache.add(0, 0); - // Make sure that it worked - Assert.assertEquals((Integer) 0, cache.get(0)); - } - - @Test - public void testMaximalStorage() { - final int n = 5; - final LRUCache<Integer, Integer> cache = new LRUCache<Integer, Integer>(n); - - // Make sure that there is nothing stored under the given values yet. - for (int i = 0; i < n; i++) { - Assert.assertNull(cache.get(i)); - } - - // Store everything and exceed the size - for (int i = 0; i < n + 1; i++) { - cache.add(i, n - i); - } - - // Make sure that the values are still available - for (int i = 1; i < n + 1; i++) { - Assert.assertEquals((Integer) (n - i), cache.get(i)); - } - - // Make sure that the oldest entry isn't available - Assert.assertNull(cache.get(0)); - } -} diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/common/PluginFinderTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/common/PluginFinderTest.java deleted file mode 100644 index 0020e52f424d5bee6a412d278380e68aa3e8449d..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/test/java/kieker/webgui/common/PluginFinderTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * Copyright 2012 by - * + Christian-Albrechts-University of Kiel - * + Department of Computer Science - * + Software Engineering Group - * and others. - * - * 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.common; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; -import kieker.analysis.plugin.AbstractPlugin; - -import org.junit.Test; - -/** - * @author Nils Christian Ehmke - * @version 1.0 - */ -public class PluginFinderTest extends TestCase { - - /** - * Creates a new instance of this class. - */ - public PluginFinderTest() {} - - /** - * This test makes sure that the plugin finder is able to find plugins within the kieker jar. - */ - @Test - public void testKiekerJarContainsPlugins() { - /* It can be assumed that the kieker jar contains at least one plugin. */ - try { - PluginClassLoader.getInstance().addURL(new URL("file", "localhost", "lib/kieker-1.6-SNAPSHOT_emf.jar")); - final List<Class<AbstractPlugin>> availableKiekerPlugins = PluginFinder.getAllPluginsWithinJar(new URL("file", "localhost", - "lib/kieker-1.6-SNAPSHOT_emf.jar")); - Assert.assertTrue("Kieker-Jar seems to contain no plugins.", availableKiekerPlugins.size() > 0); - } catch (final MalformedURLException ex) { - Assert.fail("Exception occured."); - } - } -}