diff --git a/.gitignore b/.gitignore index 8f099c2a167543d488bfe008e38589c9250d9654..e6dfcc13c15913f548c089723faba3167b6efd5f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ /Kieker.WebGUI/data /Kieker.WebGUI/user /Kieker.WebGUI/derby.log +/Kieker.WebGUI/bin/derby.log +/Kieker.WebGUI/bin/user diff --git a/Kieker.WebGUI/.pmd b/Kieker.WebGUI/.pmd index 8305b0f7e8abc632746c5f9ef4f8578f9128fb42..7b9043677dd900577bb4b0367b6bd7965422946a 100644 --- a/Kieker.WebGUI/.pmd +++ b/Kieker.WebGUI/.pmd @@ -4,440 +4,416 @@ <ruleSetFile>.ruleset</ruleSetFile> <rules> <rule> - <name>AvoidDecimalLiteralsInBigDecimalConstructor</name> - <ruleset>Basic Rules</ruleset> - </rule> - <rule> - <name>AvoidMultipleUnaryOperators</name> - <ruleset>Basic Rules</ruleset> + <name>AbstractClassWithoutAbstractMethod</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidThreadGroup</name> - <ruleset>Basic Rules</ruleset> + <name>AbstractClassWithoutAnyMethod</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidUsingHardCodedIP</name> - <ruleset>Basic Rules</ruleset> + <name>AbstractNaming</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>AvoidUsingOctalValues</name> - <ruleset>Basic Rules</ruleset> + <name>AccessorClassGeneration</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>BigIntegerInstantiation</name> - <ruleset>Basic Rules</ruleset> + <name>AddEmptyString</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>BooleanInstantiation</name> - <ruleset>Basic Rules</ruleset> + <name>AppendCharacterWithChar</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>BrokenNullCheck</name> - <ruleset>Basic Rules</ruleset> + <name>AssignmentToNonFinalStatic</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>CheckResultSet</name> - <ruleset>Basic Rules</ruleset> + <name>AtLeastOneConstructor</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>ClassCastExceptionWithToArray</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidAccessibilityAlteration</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>CollapsibleIfStatements</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidArrayLoops</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>DoubleCheckedLocking</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidAssertAsIdentifier</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>EmptyCatchBlock</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidCallingFinalize</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>EmptyFinallyBlock</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidCatchingThrowable</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>EmptyIfStmt</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidConstantsInterface</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>EmptyInitializer</name> + <name>AvoidDecimalLiteralsInBigDecimalConstructor</name> <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>EmptyStatementNotInLoop</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidDeeplyNestedIfStmts</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>EmptyStaticInitializer</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidDollarSigns</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>EmptySwitchStatements</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidEnumAsIdentifier</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>EmptySynchronizedBlock</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidFieldNameMatchingMethodName</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>EmptyTryBlock</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidFieldNameMatchingTypeName</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>EmptyWhileStmt</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidInstanceofChecksInCatchClause</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>ForLoopShouldBeWhileLoop</name> + <name>AvoidMultipleUnaryOperators</name> <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>JumbledIncrementer</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidProtectedFieldInFinalClass</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>MisplacedNullCheck</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidReassigningParameters</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>OverrideBothEqualsAndHashcode</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidRethrowingException</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>ReturnFromFinallyBlock</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidStringBufferField</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>UnconditionalIfStatement</name> + <name>AvoidThreadGroup</name> <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>UnnecessaryConversionTemporary</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidThrowingNewInstanceOfSameException</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>UnnecessaryReturn</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidThrowingRawExceptionTypes</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>UnusedNullCheckInEquals</name> + <name>AvoidUsingHardCodedIP</name> <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>UselessOperationOnImmutable</name> - <ruleset>Basic Rules</ruleset> + <name>AvoidUsingNativeCode</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>UselessOverridingMethod</name> + <name>AvoidUsingOctalValues</name> <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>ForLoopsMustUseBraces</name> - <ruleset>Braces Rules</ruleset> - </rule> - <rule> - <name>IfElseStmtsMustUseBraces</name> - <ruleset>Braces Rules</ruleset> - </rule> - <rule> - <name>IfStmtsMustUseBraces</name> - <ruleset>Braces Rules</ruleset> - </rule> - <rule> - <name>WhileLoopsMustUseBraces</name> - <ruleset>Braces Rules</ruleset> - </rule> - <rule> - <name>CloneThrowsCloneNotSupportedException</name> - <ruleset>Clone Implementation Rules</ruleset> - </rule> - <rule> - <name>ProperCloneImplementation</name> - <ruleset>Clone Implementation Rules</ruleset> - </rule> - <rule> - <name>AssignmentInOperand</name> + <name>AvoidUsingShortType</name> <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>AtLeastOneConstructor</name> - <ruleset>Controversial Rules</ruleset> + <name>BadComparison</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidAccessibilityAlteration</name> - <ruleset>Controversial Rules</ruleset> + <name>BigIntegerInstantiation</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>AvoidUsingNativeCode</name> - <ruleset>Controversial Rules</ruleset> + <name>BooleanGetMethodName</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>AvoidUsingShortType</name> - <ruleset>Controversial Rules</ruleset> + <name>BooleanInstantiation</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> <name>BooleanInversion</name> <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>DefaultPackage</name> - <ruleset>Controversial Rules</ruleset> + <name>BrokenNullCheck</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>DoNotCallGarbageCollectionExplicitly</name> - <ruleset>Controversial Rules</ruleset> + <name>ByteInstantiation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>DontImportSun</name> - <ruleset>Controversial Rules</ruleset> + <name>CheckResultSet</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>NullAssignment</name> - <ruleset>Controversial Rules</ruleset> + <name>ClassCastExceptionWithToArray</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>SuspiciousOctalEscape</name> - <ruleset>Controversial Rules</ruleset> + <name>ClassNamingConventions</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>UnnecessaryParentheses</name> - <ruleset>Controversial Rules</ruleset> + <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AbstractClassWithoutAbstractMethod</name> - <ruleset>Design Rules</ruleset> + <name>CloneMethodMustImplementCloneable</name> + <ruleset>Type Resolution Rules</ruleset> </rule> <rule> - <name>AbstractClassWithoutAnyMethod</name> - <ruleset>Design Rules</ruleset> + <name>CloneThrowsCloneNotSupportedException</name> + <ruleset>Clone Implementation Rules</ruleset> </rule> <rule> - <name>AccessorClassGeneration</name> + <name>CloseResource</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AssignmentToNonFinalStatic</name> - <ruleset>Design Rules</ruleset> + <name>CollapsibleIfStatements</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>AvoidConstantsInterface</name> + <name>CompareObjectsWithEquals</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidDeeplyNestedIfStmts</name> - <ruleset>Design Rules</ruleset> + <name>ConsecutiveLiteralAppends</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>AvoidInstanceofChecksInCatchClause</name> + <name>ConstructorCallsOverridableMethod</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidProtectedFieldInFinalClass</name> + <name>DefaultLabelNotLastInSwitchStmt</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidReassigningParameters</name> - <ruleset>Design Rules</ruleset> + <name>DefaultPackage</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>BadComparison</name> - <ruleset>Design Rules</ruleset> + <name>DoNotCallGarbageCollectionExplicitly</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name> - <ruleset>Design Rules</ruleset> + <name>DoNotCallSystemExit</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>CloseResource</name> - <ruleset>Design Rules</ruleset> + <name>DoNotExtendJavaLangError</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>CompareObjectsWithEquals</name> - <ruleset>Design Rules</ruleset> + <name>DoNotThrowExceptionInFinally</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>ConstructorCallsOverridableMethod</name> - <ruleset>Design Rules</ruleset> + <name>DoNotUseThreads</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>DefaultLabelNotLastInSwitchStmt</name> - <ruleset>Design Rules</ruleset> + <name>DontImportJavaLang</name> + <ruleset>Import Statement Rules</ruleset> </rule> <rule> - <name>EmptyMethodInAbstractClassShouldBeAbstract</name> - <ruleset>Design Rules</ruleset> + <name>DontImportSun</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>EqualsNull</name> - <ruleset>Design Rules</ruleset> + <name>DoubleCheckedLocking</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>FinalFieldCouldBeStatic</name> - <ruleset>Design Rules</ruleset> + <name>DuplicateImports</name> + <ruleset>Import Statement Rules</ruleset> </rule> <rule> - <name>IdempotentOperations</name> - <ruleset>Design Rules</ruleset> + <name>EmptyCatchBlock</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>ImmutableField</name> - <ruleset>Design Rules</ruleset> + <name>EmptyFinalizer</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>InstantiationToGetClass</name> - <ruleset>Design Rules</ruleset> + <name>EmptyFinallyBlock</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>MissingBreakInSwitch</name> - <ruleset>Design Rules</ruleset> + <name>EmptyIfStmt</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>MissingStaticMethodInNonInstantiatableClass</name> - <ruleset>Design Rules</ruleset> + <name>EmptyInitializer</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>NonCaseLabelInSwitchStatement</name> + <name>EmptyMethodInAbstractClassShouldBeAbstract</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>NonStaticInitializer</name> - <ruleset>Design Rules</ruleset> + <name>EmptyStatementNotInLoop</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>NonThreadSafeSingleton</name> - <ruleset>Design Rules</ruleset> + <name>EmptyStaticInitializer</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>OptimizableToArrayCall</name> - <ruleset>Design Rules</ruleset> + <name>EmptySwitchStatements</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>PositionLiteralsFirstInComparisons</name> - <ruleset>Design Rules</ruleset> + <name>EmptySynchronizedBlock</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>PreserveStackTrace</name> - <ruleset>Design Rules</ruleset> + <name>EmptyTryBlock</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>ReturnEmptyArrayRatherThanNull</name> - <ruleset>Design Rules</ruleset> + <name>EmptyWhileStmt</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>SimpleDateFormatNeedsLocale</name> + <name>EqualsNull</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>SimplifyBooleanExpressions</name> - <ruleset>Design Rules</ruleset> + <name>ExceptionAsFlowControl</name> + <ruleset>Strict Exception Rules</ruleset> </rule> <rule> - <name>SimplifyBooleanReturns</name> + <name>FinalFieldCouldBeStatic</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>SimplifyConditional</name> - <ruleset>Design Rules</ruleset> + <name>FinalizeDoesNotCallSuperFinalize</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>SingularField</name> - <ruleset>Design Rules</ruleset> + <name>FinalizeOnlyCallsSuperFinalize</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>SwitchDensity</name> - <ruleset>Design Rules</ruleset> + <name>FinalizeOverloaded</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>SwitchStmtsShouldHaveDefault</name> - <ruleset>Design Rules</ruleset> + <name>FinalizeShouldBeProtected</name> + <ruleset>Finalizer Rules</ruleset> </rule> <rule> - <name>TooFewBranchesForASwitchStatement</name> - <ruleset>Design Rules</ruleset> + <name>ForLoopShouldBeWhileLoop</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>UncommentedEmptyConstructor</name> - <ruleset>Design Rules</ruleset> + <name>ForLoopsMustUseBraces</name> + <ruleset>Braces Rules</ruleset> </rule> <rule> - <name>UncommentedEmptyMethod</name> + <name>IdempotentOperations</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UnnecessaryLocalBeforeReturn</name> - <ruleset>Design Rules</ruleset> + <name>IfElseStmtsMustUseBraces</name> + <ruleset>Braces Rules</ruleset> </rule> <rule> - <name>UnsynchronizedStaticDateFormatter</name> - <ruleset>Design Rules</ruleset> + <name>IfStmtsMustUseBraces</name> + <ruleset>Braces Rules</ruleset> </rule> <rule> - <name>UseCollectionIsEmpty</name> + <name>ImmutableField</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseLocaleWithCaseConversions</name> - <ruleset>Design Rules</ruleset> + <name>ImportFromSamePackage</name> + <ruleset>Import Statement Rules</ruleset> </rule> <rule> - <name>UseNotifyAllInsteadOfNotify</name> - <ruleset>Design Rules</ruleset> + <name>InefficientEmptyStringCheck</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>UseSingleton</name> + <name>InefficientStringBuffering</name> + <ruleset>String and StringBuffer Rules</ruleset> + </rule> + <rule> + <name>InstantiationToGetClass</name> <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidCallingFinalize</name> - <ruleset>Finalizer Rules</ruleset> + <name>InsufficientStringBufferDeclaration</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>EmptyFinalizer</name> - <ruleset>Finalizer Rules</ruleset> + <name>IntegerInstantiation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>FinalizeDoesNotCallSuperFinalize</name> - <ruleset>Finalizer Rules</ruleset> + <name>JumbledIncrementer</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>FinalizeOnlyCallsSuperFinalize</name> - <ruleset>Finalizer Rules</ruleset> + <name>JUnit4SuitesShouldUseSuiteAnnotation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>FinalizeOverloaded</name> - <ruleset>Finalizer Rules</ruleset> + <name>JUnit4TestShouldUseAfterAnnotation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>FinalizeShouldBeProtected</name> - <ruleset>Finalizer Rules</ruleset> + <name>JUnit4TestShouldUseBeforeAnnotation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>DontImportJavaLang</name> - <ruleset>Import Statement Rules</ruleset> + <name>JUnit4TestShouldUseTestAnnotation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>DuplicateImports</name> - <ruleset>Import Statement Rules</ruleset> + <name>JUnitAssertionsShouldIncludeMessage</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>ImportFromSamePackage</name> - <ruleset>Import Statement Rules</ruleset> + <name>JUnitSpelling</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>TooManyStaticImports</name> - <ruleset>Import Statement Rules</ruleset> + <name>JUnitStaticSuite</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>DoNotCallSystemExit</name> - <ruleset>J2EE Rules</ruleset> + <name>JUnitTestsShouldIncludeAssert</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>DoNotUseThreads</name> - <ruleset>J2EE Rules</ruleset> + <name>JUnitUseExpected</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> <name>LocalHomeNamingConvention</name> @@ -448,112 +424,96 @@ <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>MDBAndSessionBeanNamingConvention</name> - <ruleset>J2EE Rules</ruleset> - </rule> - <rule> - <name>RemoteInterfaceNamingConvention</name> - <ruleset>J2EE Rules</ruleset> + <name>LocalVariableCouldBeFinal</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>RemoteSessionInterfaceNamingConvention</name> - <ruleset>J2EE Rules</ruleset> + <name>LongInstantiation</name> + <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>StaticEJBFieldShouldBeFinal</name> - <ruleset>J2EE Rules</ruleset> + <name>LooseCoupling</name> + <ruleset>Type Resolution Rules</ruleset> </rule> <rule> - <name>UseProperClassLoader</name> + <name>MDBAndSessionBeanNamingConvention</name> <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>ProperLogger</name> - <ruleset>Jakarta Commons Logging Rules</ruleset> - </rule> - <rule> - <name>UseCorrectExceptionLogging</name> - <ruleset>Jakarta Commons Logging Rules</ruleset> - </rule> - <rule> - <name>JUnitAssertionsShouldIncludeMessage</name> - <ruleset>JUnit Rules</ruleset> - </rule> - <rule> - <name>JUnitSpelling</name> - <ruleset>JUnit Rules</ruleset> + <name>MethodArgumentCouldBeFinal</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>JUnitStaticSuite</name> - <ruleset>JUnit Rules</ruleset> + <name>MethodNamingConventions</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>JUnitTestsShouldIncludeAssert</name> - <ruleset>JUnit Rules</ruleset> + <name>MethodWithSameNameAsEnclosingClass</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>SimplifyBooleanAssertion</name> - <ruleset>JUnit Rules</ruleset> + <name>MisleadingVariableName</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>TestClassWithoutTestCases</name> - <ruleset>JUnit Rules</ruleset> + <name>MisplacedNullCheck</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>UnnecessaryBooleanAssertion</name> - <ruleset>JUnit Rules</ruleset> + <name>MissingBreakInSwitch</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseAssertEqualsInsteadOfAssertTrue</name> - <ruleset>JUnit Rules</ruleset> + <name>MissingStaticMethodInNonInstantiatableClass</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseAssertNullInsteadOfAssertTrue</name> - <ruleset>JUnit Rules</ruleset> + <name>NonCaseLabelInSwitchStatement</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseAssertSameInsteadOfAssertTrue</name> - <ruleset>JUnit Rules</ruleset> + <name>NonStaticInitializer</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidAssertAsIdentifier</name> - <ruleset>Migration Rules</ruleset> + <name>NonThreadSafeSingleton</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidEnumAsIdentifier</name> - <ruleset>Migration Rules</ruleset> + <name>NoPackage</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>ByteInstantiation</name> - <ruleset>Migration Rules</ruleset> + <name>OptimizableToArrayCall</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>IntegerInstantiation</name> - <ruleset>Migration Rules</ruleset> + <name>OverrideBothEqualsAndHashcode</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>JUnit4SuitesShouldUseSuiteAnnotation</name> - <ruleset>Migration Rules</ruleset> + <name>PositionLiteralsFirstInComparisons</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>JUnit4TestShouldUseAfterAnnotation</name> - <ruleset>Migration Rules</ruleset> + <name>PreserveStackTrace</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>JUnit4TestShouldUseBeforeAnnotation</name> - <ruleset>Migration Rules</ruleset> + <name>ProperCloneImplementation</name> + <ruleset>Clone Implementation Rules</ruleset> </rule> <rule> - <name>JUnit4TestShouldUseTestAnnotation</name> - <ruleset>Migration Rules</ruleset> + <name>ProperLogger</name> + <ruleset>Jakarta Commons Logging Rules</ruleset> </rule> <rule> - <name>JUnitUseExpected</name> - <ruleset>Migration Rules</ruleset> + <name>RemoteInterfaceNamingConvention</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>LongInstantiation</name> - <ruleset>Migration Rules</ruleset> + <name>RemoteSessionInterfaceNamingConvention</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> <name>ReplaceEnumerationWithIterator</name> @@ -567,53 +527,65 @@ <name>ReplaceVectorWithList</name> <ruleset>Migration Rules</ruleset> </rule> + <rule> + <name>ReturnEmptyArrayRatherThanNull</name> + <ruleset>Design Rules</ruleset> + </rule> + <rule> + <name>ReturnFromFinallyBlock</name> + <ruleset>Basic Rules</ruleset> + </rule> <rule> <name>ShortInstantiation</name> <ruleset>Migration Rules</ruleset> </rule> <rule> - <name>AbstractNaming</name> + <name>ShortMethodName</name> <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>AvoidDollarSigns</name> - <ruleset>Naming Rules</ruleset> + <name>SimpleDateFormatNeedsLocale</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidFieldNameMatchingMethodName</name> - <ruleset>Naming Rules</ruleset> + <name>SimplifyBooleanAssertion</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>AvoidFieldNameMatchingTypeName</name> - <ruleset>Naming Rules</ruleset> + <name>SimplifyBooleanExpressions</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>BooleanGetMethodName</name> - <ruleset>Naming Rules</ruleset> + <name>SimplifyBooleanReturns</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>ClassNamingConventions</name> - <ruleset>Naming Rules</ruleset> + <name>SimplifyConditional</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>MethodNamingConventions</name> - <ruleset>Naming Rules</ruleset> + <name>SimplifyStartsWith</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>MethodWithSameNameAsEnclosingClass</name> - <ruleset>Naming Rules</ruleset> + <name>SingularField</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>MisleadingVariableName</name> - <ruleset>Naming Rules</ruleset> + <name>StaticEJBFieldShouldBeFinal</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>NoPackage</name> - <ruleset>Naming Rules</ruleset> + <name>StringBufferInstantiationWithChar</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>ShortMethodName</name> - <ruleset>Naming Rules</ruleset> + <name>StringInstantiation</name> + <ruleset>String and StringBuffer Rules</ruleset> + </rule> + <rule> + <name>StringToString</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> <name>SuspiciousConstantFieldName</name> @@ -628,112 +600,124 @@ <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>VariableNamingConventions</name> - <ruleset>Naming Rules</ruleset> + <name>SuspiciousOctalEscape</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>AddEmptyString</name> - <ruleset>Optimization Rules</ruleset> + <name>SwitchDensity</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidArrayLoops</name> - <ruleset>Optimization Rules</ruleset> + <name>SwitchStmtsShouldHaveDefault</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>LocalVariableCouldBeFinal</name> - <ruleset>Optimization Rules</ruleset> + <name>TestClassWithoutTestCases</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>MethodArgumentCouldBeFinal</name> - <ruleset>Optimization Rules</ruleset> + <name>TooFewBranchesForASwitchStatement</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>SimplifyStartsWith</name> - <ruleset>Optimization Rules</ruleset> + <name>TooManyStaticImports</name> + <ruleset>Import Statement Rules</ruleset> </rule> <rule> - <name>UnnecessaryWrapperObjectCreation</name> - <ruleset>Optimization Rules</ruleset> + <name>UncommentedEmptyConstructor</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseArrayListInsteadOfVector</name> - <ruleset>Optimization Rules</ruleset> + <name>UncommentedEmptyMethod</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UseArraysAsList</name> - <ruleset>Optimization Rules</ruleset> + <name>UnconditionalIfStatement</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>UseStringBufferForStringAppends</name> - <ruleset>Optimization Rules</ruleset> + <name>UnnecessaryBooleanAssertion</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>AvoidCatchingThrowable</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryCaseChange</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>AvoidRethrowingException</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryConversionTemporary</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>AvoidThrowingNewInstanceOfSameException</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryLocalBeforeReturn</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AvoidThrowingRawExceptionTypes</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryParentheses</name> + <ruleset>Controversial Rules</ruleset> </rule> <rule> - <name>DoNotExtendJavaLangError</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryReturn</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>DoNotThrowExceptionInFinally</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnnecessaryWrapperObjectCreation</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>ExceptionAsFlowControl</name> - <ruleset>Strict Exception Rules</ruleset> + <name>UnsynchronizedStaticDateFormatter</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>AppendCharacterWithChar</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedFormalParameter</name> + <ruleset>Unused Code Rules</ruleset> </rule> <rule> - <name>AvoidStringBufferField</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedImports</name> + <ruleset>Type Resolution Rules</ruleset> </rule> <rule> - <name>ConsecutiveLiteralAppends</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedLocalVariable</name> + <ruleset>Unused Code Rules</ruleset> </rule> <rule> - <name>InefficientEmptyStringCheck</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedNullCheckInEquals</name> + <ruleset>Basic Rules</ruleset> </rule> <rule> - <name>InefficientStringBuffering</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedPrivateField</name> + <ruleset>Unused Code Rules</ruleset> </rule> <rule> - <name>InsufficientStringBufferDeclaration</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UnusedPrivateMethod</name> + <ruleset>Unused Code Rules</ruleset> </rule> <rule> - <name>StringBufferInstantiationWithChar</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UseArrayListInsteadOfVector</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>StringInstantiation</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UseArraysAsList</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>StringToString</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UseAssertEqualsInsteadOfAssertTrue</name> + <ruleset>JUnit Rules</ruleset> </rule> <rule> - <name>UnnecessaryCaseChange</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UseAssertNullInsteadOfAssertTrue</name> + <ruleset>JUnit Rules</ruleset> + </rule> + <rule> + <name>UseAssertSameInsteadOfAssertTrue</name> + <ruleset>JUnit Rules</ruleset> + </rule> + <rule> + <name>UseCollectionIsEmpty</name> + <ruleset>Design Rules</ruleset> + </rule> + <rule> + <name>UseCorrectExceptionLogging</name> + <ruleset>Jakarta Commons Logging Rules</ruleset> </rule> <rule> <name>UseEqualsToCompareStrings</name> @@ -743,41 +727,49 @@ <name>UseIndexOfChar</name> <ruleset>String and StringBuffer Rules</ruleset> </rule> + <rule> + <name>UselessOperationOnImmutable</name> + <ruleset>Basic Rules</ruleset> + </rule> + <rule> + <name>UselessOverridingMethod</name> + <ruleset>Basic Rules</ruleset> + </rule> <rule> <name>UselessStringValueOf</name> <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>UseStringBufferLength</name> - <ruleset>String and StringBuffer Rules</ruleset> + <name>UseLocaleWithCaseConversions</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>CloneMethodMustImplementCloneable</name> - <ruleset>Type Resolution Rules</ruleset> + <name>UseNotifyAllInsteadOfNotify</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>LooseCoupling</name> - <ruleset>Type Resolution Rules</ruleset> + <name>UseProperClassLoader</name> + <ruleset>J2EE Rules</ruleset> </rule> <rule> - <name>UnusedImports</name> - <ruleset>Type Resolution Rules</ruleset> + <name>UseSingleton</name> + <ruleset>Design Rules</ruleset> </rule> <rule> - <name>UnusedFormalParameter</name> - <ruleset>Unused Code Rules</ruleset> + <name>UseStringBufferForStringAppends</name> + <ruleset>Optimization Rules</ruleset> </rule> <rule> - <name>UnusedLocalVariable</name> - <ruleset>Unused Code Rules</ruleset> + <name>UseStringBufferLength</name> + <ruleset>String and StringBuffer Rules</ruleset> </rule> <rule> - <name>UnusedPrivateField</name> - <ruleset>Unused Code Rules</ruleset> + <name>VariableNamingConventions</name> + <ruleset>Naming Rules</ruleset> </rule> <rule> - <name>UnusedPrivateMethod</name> - <ruleset>Unused Code Rules</ruleset> + <name>WhileLoopsMustUseBraces</name> + <ruleset>Braces Rules</ruleset> </rule> </rules> <includeDerivedFiles>false</includeDerivedFiles> diff --git a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs index 85c1f324c0ab7799a460baa45fcc81ea925c6417..e8289876c66750599f4fa14d9eb344c4825c6f54 100644 --- a/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs +++ b/Kieker.WebGUI/.settings/org.eclipse.jdt.ui.prefs @@ -58,7 +58,7 @@ formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=ex org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;org.primefaces;org.eclipse;de.cau.cs.kieler; +org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;org.primefaces;org.eclipse;de.cau.cs.kieler;net.vidageek;org.springframework; org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=true diff --git a/Kieker.WebGUI/config/quality-config/cs-conf.xml b/Kieker.WebGUI/config/quality-config/cs-conf.xml index 3abf3c329ecb5f5b7e61746fcecedd17bda14a1b..b7d26517818e5be4acceb5c83ba6810e44574493 100644 --- a/Kieker.WebGUI/config/quality-config/cs-conf.xml +++ b/Kieker.WebGUI/config/quality-config/cs-conf.xml @@ -668,7 +668,7 @@ <!-- See http://checkstyle.sf.net/config_import.html !--> <module name="ImportOrder"> <property name="option" value="under"/> - <property name="groups" value="java,javax,junit,org,com,kieker,kieker,org.primefaces,org.eclipse"/> + <property name="groups" value="java,javax,junit,org,com,kieker,kieker,org.primefaces,org.eclipse,de.cau.cs.kieler,net.vidageek,org.springframework"/> <property name="ordered" value="true"/> <property name="separated" value="true"/> <property name="caseSensitive" value="true"/> diff --git a/Kieker.WebGUI/config/quality-config/pmdrules.xml b/Kieker.WebGUI/config/quality-config/pmdrules.xml index 3dc278260a401fc8161b174c0dfcca556c9fd07f..6f91926fd458895477aecb3c1c2bf65517f9aab2 100644 --- a/Kieker.WebGUI/config/quality-config/pmdrules.xml +++ b/Kieker.WebGUI/config/quality-config/pmdrules.xml @@ -30,6 +30,7 @@ <exclude name="UnnecessaryConstructor"/> <exclude name="UseConcurrentHashMap"/> <exclude name="AssignmentInOperand"/> + <exclude name="NullAssignment"/> </rule> <!--<rule ref="rulesets/coupling.xml">--> diff --git a/Kieker.WebGUI/pom.xml b/Kieker.WebGUI/pom.xml index 7f1069d599b639b8ee175c37fb90e438ba6c707f..2325abc30bc1d6ecc5cc31d2387e7539d68ecc76 100644 --- a/Kieker.WebGUI/pom.xml +++ b/Kieker.WebGUI/pom.xml @@ -45,6 +45,11 @@ </repositories> <dependencies> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>2.0.1</version> + </dependency> <dependency> <groupId>net.vidageek</groupId> <artifactId>mirror</artifactId> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java index 3828075aade437b8eabe67758bb467d95ddebfdf..d21277b37fed2338da6f7ffd45433bf643d2a5dd 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ClassAndMethodContainer.java @@ -45,10 +45,14 @@ import kieker.common.logging.LogImplWebguiLogging; import kieker.webgui.common.exception.ProjectLoadException; /** - * The {@link ClassAndMethodContainer} is a container which contains - as the name already suggests - various classes and methods. To be more precisely, it uses a - * given class loader to load the equivalence of specific classes within this application to ensure that comparisons, assignments and the use of specific methods - * will be done correctly. This is necessary as for every project within this application there will be a number of libraries which will be combined in one class - * loader. This will result in multiple version of one and the same class and therefore in problems, if one doesn't use the correct class version. + * The {@link ClassAndMethodContainer} is a container which contains - as the name already tells - various classes and methods. To be more precisely, it uses a + * given class loader to load the equivalence of specific classes via reflection within this application to ensure that comparisons, assignments and the use of + * specific methods will be done correctly. This is necessary as for every project within this application there will be a number of libraries which will be combined + * in one class loader. This will result in multiple version of one and the same class and therefore in problems, if one doesn't use the correct class version.<br> + * </br> + * + * As we use the Mirror framework in this project (which simplifies some accesses to the Java reflection API) not all methods and classes have to be loaded in this + * class. * * @author Nils Christian Ehmke */ @@ -75,32 +79,17 @@ public class ClassAndMethodContainer { private Class<?> imageClass; private Class<?> plainTextClass; private Class<?> htmlTextClass; - - private Method pluginDescriptionMethod; - private Method repositoryDescriptionMethod; - private Method pluginConfigurationMethod; private Method repositoryConfigurationMethod; - private Method pluginOutputPortsMethod; - private Method pluginRepositoryPortsMethod; - private Method displayNameMethod; - private Method inputPortNameMethod; - private Method outputPortNameMethod; - private Method repositoryPortNameMethod; - private Method propertyNameMethod; - private Method propertyDefaultValueMethod; private Method plainTextgetTextMethod; private Method analysisControllerWithMappingGetController; private Method analysisControllerWithMappingGetMapping; private Method analysisControllerCreateAnalysisController; - private Method analysisControllerThreadStart; - private Method analysisControllerThreadTerminate; + private Method analysisControllerThreadJoin; private Method analysisControllerGetState; - private Method propertyDescriptionMethod; + private Method analysisControllerLoadFromFile; - private Method displayDescriptionMethod; - private Method pluginDependenciesMethod; - private Method repositoryDependenciesMethod; + private Method pluginProgrammaticOnlyMethod; private Method repositoryProgrammaticOnlyMethod; private Method logImplWebguiLoggingClassGetEntriesMethod; @@ -167,28 +156,11 @@ public class ClassAndMethodContainer { private void loadMethods() throws SecurityException, NoSuchMethodException { // The following part has to be done carefully: The methods will be loaded via the name - this.pluginDescriptionMethod = this.pluginAnnotationClass.getMethod("description", new Class<?>[0]); - this.repositoryDescriptionMethod = this.repositoryAnnotationClass.getMethod("description", new Class<?>[0]); - this.pluginConfigurationMethod = this.pluginAnnotationClass.getMethod("configuration", new Class<?>[0]); this.repositoryConfigurationMethod = this.repositoryAnnotationClass.getMethod("configuration", new Class<?>[0]); - this.pluginOutputPortsMethod = this.pluginAnnotationClass.getMethod("outputPorts", new Class<?>[0]); - this.pluginRepositoryPortsMethod = this.pluginAnnotationClass.getMethod("repositoryPorts", new Class<?>[0]); - this.displayNameMethod = this.displayAnnotationClass.getMethod("name", new Class<?>[0]); - this.inputPortNameMethod = this.inputPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.outputPortNameMethod = this.outputPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.repositoryPortNameMethod = this.repositoryPortAnnotationClass.getMethod("name", new Class<?>[0]); - this.propertyNameMethod = this.propertyAnnotationClass.getMethod("name", new Class<?>[0]); - this.propertyDefaultValueMethod = this.propertyAnnotationClass.getMethod("defaultValue", new Class<?>[0]); this.plainTextgetTextMethod = this.plainTextClass.getMethod("getText", new Class<?>[0]); this.analysisControllerWithMappingGetController = this.analysisControllerWithMappingClass.getMethod("getController", new Class<?>[0]); this.analysisControllerWithMappingGetMapping = this.analysisControllerWithMappingClass.getMethod("getPluginMap", new Class<?>[0]); - this.analysisControllerThreadStart = this.analysisControllerThreadClass.getMethod("start", new Class<?>[0]); - this.analysisControllerThreadTerminate = this.analysisControllerThreadClass.getMethod("terminate", new Class<?>[0]); this.analysisControllerGetState = this.analysisControllerClass.getMethod("getState", new Class<?>[0]); - this.propertyDescriptionMethod = this.propertyAnnotationClass.getMethod("description", new Class<?>[0]); - this.displayDescriptionMethod = this.displayAnnotationClass.getMethod("description", new Class<?>[0]); - this.pluginDependenciesMethod = this.pluginAnnotationClass.getMethod("dependencies", new Class<?>[0]); - this.repositoryDependenciesMethod = this.repositoryAnnotationClass.getMethod("dependencies", new Class<?>[0]); this.pluginProgrammaticOnlyMethod = this.pluginAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); this.repositoryProgrammaticOnlyMethod = this.repositoryAnnotationClass.getMethod("programmaticOnly", new Class<?>[0]); this.logImplWebguiLoggingClassGetEntriesMethod = this.logImplWebguiLoggingClass.getMethod("getEntries", String.class); @@ -257,34 +229,10 @@ public class ClassAndMethodContainer { return this.displayAnnotationClass; } - public Method getPluginDescriptionMethod() { - return this.pluginDescriptionMethod; - } - - public Method getRepositoryDescriptionMethod() { - return this.repositoryDescriptionMethod; - } - - public Method getPluginConfigurationMethod() { - return this.pluginConfigurationMethod; - } - public Method getRepositoryConfigurationMethod() { return this.repositoryConfigurationMethod; } - public Method getPluginOutputPortsMethod() { - return this.pluginOutputPortsMethod; - } - - public Method getPluginRepositoryPortsMethod() { - return this.pluginRepositoryPortsMethod; - } - - public Method getDisplayNameMethod() { - return this.displayNameMethod; - } - public Class<?> getAbstractRepositoryClass() { return this.abstractRepositoryClass; } @@ -293,26 +241,6 @@ public class ClassAndMethodContainer { return this.abstractPluginClass; } - public Method getInputPortNameMethod() { - return this.inputPortNameMethod; - } - - public Method getOutputPortNameMethod() { - return this.outputPortNameMethod; - } - - public Method getRepositoryPortNameMethod() { - return this.repositoryPortNameMethod; - } - - public Method getPropertyNameMethod() { - return this.propertyNameMethod; - } - - public Method getPropertyDefaultValueMethod() { - return this.propertyDefaultValueMethod; - } - public Class<?> getImageClass() { return this.imageClass; } @@ -353,14 +281,6 @@ public class ClassAndMethodContainer { return this.analysisControllerWithMappingGetController; } - public Method getAnalysisControllerThreadStart() { - return this.analysisControllerThreadStart; - } - - public Method getAnalysisControllerThreadTerminate() { - return this.analysisControllerThreadTerminate; - } - public Method getAnalysisControllerThreadJoin() { return this.analysisControllerThreadJoin; } @@ -369,10 +289,6 @@ public class ClassAndMethodContainer { return this.analysisControllerGetState; } - public Method getPropertyDescriptionMethod() { - return this.propertyDescriptionMethod; - } - public Constructor<?> getAnalysisControllerThreadConstructor() { return this.analysisControllerThreadConstructor; } @@ -381,18 +297,6 @@ public class ClassAndMethodContainer { return this.analysisControllerLoadFromFile; } - public Method getPluginDependenciesMethod() { - return this.pluginDependenciesMethod; - } - - public Method getDisplayDescriptionMethod() { - return this.displayDescriptionMethod; - } - - public Method getRepositoryDependenciesMethod() { - return this.repositoryDependenciesMethod; - } - public Method getPluginProgrammaticOnlyMethod() { return this.pluginProgrammaticOnlyMethod; } @@ -461,23 +365,6 @@ public class ClassAndMethodContainer { return null; } - /** - * This method can be used to invoke a given method with no parameters, without having to mind about the exceptions. If an exception occurs, the given default - * value will be returned. A call to this method is the same as {@link ClassAndMethodContainer#invokeMethod(Method, Object, Object, Object...)} with - * {@code new Object[0]} as parameters. - * - * @param method - * The method to be invoked. - * @param obj - * The object on which the method will be invoked. - * @param defaultReturn - * The default return value in case of an exception. - * @return The result of the invoked method if everything went well, the default value otherwise. - */ - public static Object invokeMethod(final Method method, final Object obj, final Object defaultReturn) { - return ClassAndMethodContainer.invokeMethod(method, obj, defaultReturn, new Object[0]); - } - /** * This method can be used to invoke a given <b>class</b>-method with no parameters, without having to mind about the exceptions. If an exception occurs, the * given default value will be returned. A call to this method is the same as {@link ClassAndMethodContainer#invokeMethod(Method, Object, Object, Object...)} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java index c734bffa31c7623eff15d9aaacc45b505fe53eca..a5799f9b26e97afd749c1acfc85b87fcfb8b21bf 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/EnvironmentLoaderListener.java @@ -39,24 +39,13 @@ public class EnvironmentLoaderListener implements ServletContextListener { // No code necessary } - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ @Override public void contextDestroyed(final ServletContextEvent event) { // No code necessary } - /* - * (non-Javadoc) - * - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ @Override public void contextInitialized(final ServletContextEvent event) { - // Before setting the logging property, use the log factory to make sure that the log entries of the WebGUI itself will be shown in the terminal EnvironmentLoaderListener.LOG.info("Starting Kieker.WebGUI environment initialization."); final long tin = System.currentTimeMillis(); diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ViewScope.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ViewScope.java index e8c5e8b81a96f2aadde8ae89616db3c0434fdf9c..37087b76cb3e9840e659f33f92576d6e285ace01 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/ViewScope.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/ViewScope.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.config.Scope; /** - * The class {@link ViewScope} is necessary as Spring doesn't provide a view scope like JSF. Therefore the view scope has to be implemented by us. + * The class {@link ViewScope} is necessary as Spring doesn't provide a view scope like JSF does. Therefore the view scope has to be implemented by us. * * @author Nils Christian Ehmke */ @@ -37,9 +37,8 @@ public class ViewScope implements Scope { // No code necessary. } - @SuppressWarnings("rawtypes") @Override - public Object get(final String name, final ObjectFactory objectFactory) { + public Object get(final String name, final ObjectFactory<?> objectFactory) { final Map<String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap(); if (viewMap.containsKey(name)) { @@ -52,41 +51,21 @@ public class ViewScope implements Scope { } } - /* - * (non-Javadoc) - * - * @see org.springframework.beans.factory.config.Scope#remove(java.lang.String) - */ @Override public Object remove(final String name) { return FacesContext.getCurrentInstance().getViewRoot().getViewMap().remove(name); } - /* - * (non-Javadoc) - * - * @see org.springframework.beans.factory.config.Scope#getConversationId() - */ @Override public String getConversationId() { return null; } - /* - * (non-Javadoc) - * - * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String, java.lang.Runnable) - */ @Override - public void registerDestructionCallback(final String name, final Runnable callback) { // NOPMD (Threads are not used) + public void registerDestructionCallback(final String name, final Runnable callback) { // NOPMD (Threads are not used here) // Not supported } - /* - * (non-Javadoc) - * - * @see org.springframework.beans.factory.config.Scope#resolveContextualObject(java.lang.String) - */ @Override public Object resolveContextualObject(final String key) { return null; diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/GraphLayoutException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/GraphLayoutException.java index 1b0272de51fb854ba199dc3c84de6cb5fcec466c..a0fdf29e8b56f84eaec92b235a5b5dd18dad6676 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/GraphLayoutException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/GraphLayoutException.java @@ -17,7 +17,7 @@ package kieker.webgui.common.exception; /** - * This class represents an exception which can occur during the autolayout of a graph. + * This class represents an exception which can occur during the auto layout of a graph. * * @author Nils Christian Ehmke */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/InvalidAnalysisStateException.java similarity index 82% rename from Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/InvalidAnalysisStateException.java index 6bd73cd2628ff2eedd148124920aefcf03ea09b8..5b20146de64373fe9b716ba9afb5378fa1ecc188 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/AnalysisStateException.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/common/exception/InvalidAnalysisStateException.java @@ -17,18 +17,18 @@ package kieker.webgui.common.exception; /** - * This class represents an exception occurring when the analysis is in an invalid state for the ordered method. + * This class represents an exception occurring when the analysis is in an invalid state for the ordered action. * * @author Nils Christian Ehmke */ -public class AnalysisStateException extends AbstractKiekerWebGUIException { +public class InvalidAnalysisStateException extends AbstractKiekerWebGUIException { private static final long serialVersionUID = 1L; /** * Creates a new instance of this class. */ - public AnalysisStateException() { + public InvalidAnalysisStateException() { super(); } @@ -38,7 +38,7 @@ public class AnalysisStateException extends AbstractKiekerWebGUIException { * @param msg * The message used for the exception. */ - public AnalysisStateException(final String msg) { + public InvalidAnalysisStateException(final String msg) { super(msg); } @@ -50,7 +50,7 @@ public class AnalysisStateException extends AbstractKiekerWebGUIException { * @param cause * The cause for the exception. */ - public AnalysisStateException(final String msg, final Throwable cause) { + public InvalidAnalysisStateException(final String msg, final Throwable cause) { super(msg, cause); } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/ComponentListContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/ComponentListContainer.java index c05aa54c3e075bc0003729d70266a1f5c1f6846b..79f4ba60f1b3b0a105fb6dd2bbf6eb3e94626f0b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/ComponentListContainer.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/ComponentListContainer.java @@ -17,18 +17,22 @@ package kieker.webgui.domain; import java.util.List; +import kieker.webgui.domain.pluginDecorators.FilterDecorator; +import kieker.webgui.domain.pluginDecorators.ReaderDecorator; +import kieker.webgui.domain.pluginDecorators.RepositoryDecorator; + /** - * This class is a container for multiple {@link PluginContainer} or {@link RepositoryContainer} instances. For each of the component type (reader, filter, - * repository) there is exactly one list available. This class will mostly be used to deliver a set of available components for a project. A bean using them could - * for example copy the available instances. + * This class is a container for multiple {@link ReaderDecorator}, {@link FilterDecorator} or {@link RepositoryDecorator} instances. For each of the component type + * (reader, filter, repository) there is exactly one list available. This class will mostly be used to deliver a set of available components for a project. A bean + * can, for example, use the components as a prototype to copy new model instances. * * @author Nils Christian Ehmke */ public class ComponentListContainer { - private final List<PluginContainer> readers; - private final List<PluginContainer> filters; - private final List<RepositoryContainer> repositories; + private final List<ReaderDecorator> readers; + private final List<FilterDecorator> filters; + private final List<RepositoryDecorator> repositories; /** * Creates a new instance of this class using the given parameters. @@ -40,21 +44,21 @@ public class ComponentListContainer { * @param repositories * The list containing the repositories. */ - public ComponentListContainer(final List<PluginContainer> readers, final List<PluginContainer> filters, final List<RepositoryContainer> repositories) { + public ComponentListContainer(final List<ReaderDecorator> readers, final List<FilterDecorator> filters, final List<RepositoryDecorator> repositories) { this.readers = readers; this.filters = filters; this.repositories = repositories; } - public List<PluginContainer> getReaders() { + public List<ReaderDecorator> getReaders() { return this.readers; } - public List<PluginContainer> getFilters() { + public List<FilterDecorator> getFilters() { return this.filters; } - public List<RepositoryContainer> getRepositories() { + public List<RepositoryDecorator> getRepositories() { return this.repositories; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/PluginContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/PluginContainer.java deleted file mode 100644 index 4ed90682a15c5a772a5dad4ec7bf30dad86e493e..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/PluginContainer.java +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************** - * Copyright 2013 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ - -package kieker.webgui.domain; - -import java.util.Map; - -import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; -import kieker.analysis.model.analysisMetaModel.MIDisplay; -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.MIProperty; -import kieker.analysis.model.analysisMetaModel.MIReader; -import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector; - -/** - * This is a container to wrap a single instance of {@link MIPlugin} together with different meta information. - * - * @author Nils Christian Ehmke - */ -public class PluginContainer implements IComponentContainer { - - private final Map<String, String> propertyDescriptions; - private final Map<String, String> displayDescriptions; - private final boolean fullyInitialized; - private final MIPlugin plugin; - private final String description; - private final String dependency; - - /** - * Creates a new instance of this class using the given parameters. - * - * @param plugin - * The plugin to be stored in this container. - * @param description - * The description of the plugin. - * @param dependency - * The dependency description of the plugin. - * @param fullyInitialized - * A flag to determine whether the plugin has been initialized fully or whether there was an error during the class loading. - * @param propertyDescriptions - * A map containing the descriptions of the properties of the plugin. - * @param displayDescriptions - * A map containing the display descriptions of the properties of the plugin. - */ - public PluginContainer(final MIPlugin plugin, final String description, final String dependency, final boolean fullyInitialized, - final Map<String, String> propertyDescriptions, final Map<String, String> displayDescriptions) { - this.plugin = plugin; - this.description = description; - this.dependency = dependency; - this.fullyInitialized = fullyInitialized; - this.propertyDescriptions = propertyDescriptions; - this.displayDescriptions = displayDescriptions; - } - - public String getDescription() { - return this.description; - } - - public String getDependency() { - return this.dependency; - } - - public boolean isFullyInitialized() { - return this.fullyInitialized; - } - - public boolean isReader() { - return this.plugin instanceof MIReader; - } - - public boolean isFilter() { - return this.plugin instanceof MIFilter; - } - - /** - * Delivers the description of the given display. - * - * @param display - * The name of the display. - * @return The human readable description of the given display. - */ - public String getDisplayDescription(final String display) { - return this.displayDescriptions.get(display); - } - - /** - * {@inheritDoc} - */ - @Override - public String getPropertyDescription(final String property) { - return this.propertyDescriptions.get(property); - } - - /** - * Getter for the property {@link PluginContainer#plugin}. <b>DO NOT MODIFIY THIS OBJECT!</b> Use {@link PluginContainer#newInstance(MIAnalysisMetaModelFactory)} - * instead to get a copy. - * - * @return The current value of the property. - */ - public MIPlugin getPlugin() { - return this.plugin; - } - - /** - * Delivers a copy of the plugin instance within this container. - * - * @param factory - * The factory to be used to create the copy. - * @return A deep copy of the plugin. - */ - public MIPlugin newInstance(final MIAnalysisMetaModelFactory factory) { - final MIPlugin pluginCopy; - - if (this.plugin instanceof MIReader) { - pluginCopy = factory.createReader(); - } else if (this.plugin instanceof MIFilter) { - pluginCopy = factory.createFilter(); - // Copy the input ports of the plugin instance - for (final MIInputPort inputPort : ((MIFilter) this.plugin).getInputPorts()) { - final MIInputPort inputPortCopy = factory.createInputPort(); - inputPortCopy.setName(inputPort.getName()); - inputPortCopy.setParent((MIFilter) pluginCopy); - ((MIFilter) pluginCopy).getInputPorts().add(inputPortCopy); - } - } else { - // This should not happen - return null; - } - - // Copy the output ports of the plugin instance - for (final MIOutputPort outputPort : this.plugin.getOutputPorts()) { - final MIOutputPort outputPortCopy = factory.createOutputPort(); - outputPortCopy.setName(outputPort.getName()); - outputPortCopy.setParent(pluginCopy); - pluginCopy.getOutputPorts().add(outputPortCopy); - } - - // Copy the repository "ports" - for (final MIRepositoryConnector repositoryConnector : this.plugin.getRepositories()) { - final MIRepositoryConnector repositoryConnectorCopy = factory.createRepositoryConnector(); - repositoryConnectorCopy.setName(repositoryConnector.getName()); - pluginCopy.getRepositories().add(repositoryConnectorCopy); - } - - // Copy the displays - for (final MIDisplay display : this.plugin.getDisplays()) { - final MIDisplay displayCopy = factory.createDisplay(); - displayCopy.setName(display.getName()); - displayCopy.setParent(pluginCopy); - pluginCopy.getDisplays().add(displayCopy); - } - - // Copy the properties - for (final MIProperty property : this.plugin.getProperties()) { - final MIProperty propertyCopy = factory.createProperty(); - propertyCopy.setName(property.getName()); - propertyCopy.setValue(property.getValue()); - pluginCopy.getProperties().add(propertyCopy); - } - - // Copy the remaining attributes - pluginCopy.setClassname(this.plugin.getClassname()); - pluginCopy.setName(this.plugin.getName()); - - return pluginCopy; - } - -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/RepositoryContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/RepositoryContainer.java deleted file mode 100644 index 524aa00c8a6d1988c98f2ae9206ea2a32a0cc1eb..0000000000000000000000000000000000000000 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/RepositoryContainer.java +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright 2013 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ - -package kieker.webgui.domain; - -import java.util.Map; - -import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; -import kieker.analysis.model.analysisMetaModel.MIProperty; -import kieker.analysis.model.analysisMetaModel.MIRepository; - -/** - * This is a container to wrap a single instance of {@link MIRepository} together with different meta information. - * - * @author Nils Christian Ehmke - */ -public class RepositoryContainer implements IComponentContainer { - - private final Map<String, String> propertyDescriptions; - private final boolean fullyInitialized; - private final MIRepository repository; - private final String description; - private final String dependency; - - /** - * Creates a new instance of this class using the given parameters. - * - * @param repository - * The repository to be stored in this container. - * @param description - * The description of the repository. - * @param dependency - * The dependency description of the repository. - * @param fullyInitialized - * A flag to determine whether the repository has been initialized fully or whether there was an error during the class loading. - * @param propertyDescriptions - * A map containing the descriptions of the properties of the repository. - */ - public RepositoryContainer(final MIRepository repository, final String description, final String dependency, final boolean fullyInitialized, - final Map<String, String> propertyDescriptions) { - this.repository = repository; - this.description = description; - this.dependency = dependency; - this.fullyInitialized = fullyInitialized; - this.propertyDescriptions = propertyDescriptions; - } - - public String getDescription() { - return this.description; - } - - public String getDependency() { - return this.dependency; - } - - public boolean isFullyInitialized() { - return this.fullyInitialized; - } - - /* - * (non-Javadoc) - * - * @see kieker.webgui.common.IComponentContainer#getPropertyDescription(java.lang.String) - */ - @Override - public String getPropertyDescription(final String property) { - return this.propertyDescriptions.get(property); - } - - /** - * Getter for the property {@link RepositoryContainer#repository}. <b>DO NOT MODIFIY THIS OBJECT!</b> Use - * {@link RepositoryContainer#newInstance(MIAnalysisMetaModelFactory)} instead to get a copy. - * - * @return The current value of the property. - */ - public MIRepository getRepository() { - return this.repository; - } - - /** - * Delivers a copy of the repository instance within this container. - * - * @param factory - * The factory to be used to create the copy. - * @return A deep copy of the repository. - */ - public MIRepository newInstance(final MIAnalysisMetaModelFactory factory) { - final MIRepository repositoryCopy; - - repositoryCopy = factory.createRepository(); - - // Copy the properties - for (final MIProperty property : this.repository.getProperties()) { - final MIProperty propertyCopy = factory.createProperty(); - propertyCopy.setName(property.getName()); - propertyCopy.setValue(property.getValue()); - repositoryCopy.getProperties().add(propertyCopy); - } - - // Copy the remaining attributes - repositoryCopy.setClassname(this.repository.getClassname()); - repositoryCopy.setName(this.repository.getName()); - - return repositoryCopy; - } - -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java index 9fbb1210f7f6310b70c2cfdf978aedd701e26ddc..0e105a5d2b86117e203f6e8de5b4ba61fd058217 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/User.java @@ -80,7 +80,7 @@ public class User { } /** - * This enum represents the available roles within this systen. + * This enum represents the available roles within this system. * * @author Nils Christian Ehmke */ @@ -108,29 +108,5 @@ public class User { public int getID() { return this.id; } - - /** - * Delivers the corresponding role to the given id. if the id cannot be recognized the value {@link Role#ROLE_GUEST} will be returned. - * - * @param id - * The id to be recognized. - * - * @return The corresponding role. - */ - public static Role fromID(final int id) { - final Role role; - - if (id == 2) { - role = Role.ROLE_ADMIN; - } else { - if (id == 1) { - role = Role.ROLE_USER; - } else { - role = Role.ROLE_GUEST; - } - } - - return role; - } } } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractAnalysisComponentDecorator.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractAnalysisComponentDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..d59a0ccd4293aba8dfdbe681023262815301f2f2 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractAnalysisComponentDecorator.java @@ -0,0 +1,272 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.domain.pluginDecorators; + +import java.lang.reflect.InvocationTargetException; +import java.util.Map; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisComponent; +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIProperty; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; + +/** + * This is the abstract base for all other decorators which decorate the components from the analysis meta model. It adds some properties and methods to an + * {@link MIAnalysisComponent} instance. The already existing behavior of the {@link MIAnalysisComponent} instance is not modified. + * + * @author Nils Christian Ehmke + * + * @param <T> + * The type of the decorator. This can be specified by inheriting classes in order to provide a more specific interface to access the class. + */ +public abstract class AbstractAnalysisComponentDecorator<T extends MIAnalysisComponent> implements MIAnalysisComponent { + + /** The component wrapped by this decorator. */ + protected final T analysisComponent; + + private final Map<String, String> propertiesDescriptions; + private final String description; + private final String dependency; + private final boolean fullyInitialized; + + /** + * Constructor to instantiate the fields of this class. + * + * @param analysisComponent + * The component wrapped by this decorator. + * @param propertiesDescriptions + * The descriptions of the properties. + * @param description + * The description of the wrapped component. + * @param dependency + * The dependency description of the wrapped component. + * @param fullyInitialized + * A flag to show whether the component has been fully initialized or not. + */ + public AbstractAnalysisComponentDecorator(final T analysisComponent, final Map<String, String> propertiesDescriptions, final String description, + final String dependency, final boolean fullyInitialized) { + this.analysisComponent = analysisComponent; + this.propertiesDescriptions = propertiesDescriptions; + this.description = description; + this.dependency = dependency; + this.fullyInitialized = fullyInitialized; + } + + public final String getDescription() { + return this.description; + } + + public final String getDependency() { + return this.dependency; + } + + public final boolean isFullyInitialized() { + return this.fullyInitialized; + } + + /** + * Delivers the description for the given property. + * + * @param property + * The property whose description should be delivered. + * + * @return The description. + */ + public final String getPropertyDescription(final String property) { + return this.propertiesDescriptions.get(property); + } + + /** + * Delivers a new copy of the wrapped component. + * + * @param factory + * The factory which is used to create the component. + * + * @return A (deep) copy of the wrapped component. + */ + public final T newCopy(final MIAnalysisMetaModelFactory factory) { + final T componentCopy = this.createComponent(factory); + + this.refineComponentCopy(factory, componentCopy); + + return componentCopy; + } + + /** + * Inheriting classes should implement this method to deliver the actual copy (without further properties) of the wrapped component. + * + * @param factory + * The factory which should be used to create the component. + * + * @return A (non-deep) copy of the wrapped component. + */ + protected abstract T createComponent(final MIAnalysisMetaModelFactory factory); + + /** + * Inheriting classes should overwrite this method in order to refine the copy of the wrapped component. The new method should call + * {@code super.refineComponentCopy(factory, componentCopy)} though, in order to make sure that the other properties will be copied as well. + * + * @param factory + * The factory which should be used to create the new sub components. + * @param componentCopy + * The copy of the wrapped component, which can be refined by inheriting classes. + */ + protected void refineComponentCopy(final MIAnalysisMetaModelFactory factory, final T componentCopy) { + // Copy the properties + for (final MIProperty property : this.analysisComponent.getProperties()) { + final MIProperty propertyCopy = factory.createProperty(); + propertyCopy.setName(property.getName()); + propertyCopy.setValue(property.getValue()); + componentCopy.getProperties().add(propertyCopy); + } + + // Copy the remaining attributes + componentCopy.setClassname(this.analysisComponent.getClassname()); + componentCopy.setName(this.analysisComponent.getName()); + } + + @Override + public final TreeIterator<EObject> eAllContents() { + return this.analysisComponent.eAllContents(); + } + + @Override + public final EClass eClass() { + return this.analysisComponent.eClass(); + } + + @Override + public final EObject eContainer() { + return this.analysisComponent.eContainer(); + } + + @Override + public final EStructuralFeature eContainingFeature() { + return this.analysisComponent.eContainingFeature(); + } + + @Override + public final EReference eContainmentFeature() { + return this.analysisComponent.eContainmentFeature(); + } + + @Override + public final EList<EObject> eContents() { + return this.analysisComponent.eContents(); + } + + @Override + public final EList<EObject> eCrossReferences() { + return this.analysisComponent.eCrossReferences(); + } + + @Override + public final Object eGet(final EStructuralFeature arg0) { + return this.analysisComponent.eGet(arg0); + } + + @Override + public final Object eGet(final EStructuralFeature arg0, final boolean arg1) { + return this.analysisComponent.eGet(arg0, arg1); + } + + @Override + public final Object eInvoke(final EOperation arg0, final EList<?> arg1) throws InvocationTargetException { + return this.analysisComponent.eInvoke(arg0, arg1); + } + + @Override + public final boolean eIsProxy() { + return this.analysisComponent.eIsProxy(); + } + + @Override + public final boolean eIsSet(final EStructuralFeature arg0) { + return this.analysisComponent.eIsSet(arg0); + } + + @Override + public final Resource eResource() { + return this.analysisComponent.eResource(); + } + + @Override + public final void eSet(final EStructuralFeature arg0, final Object arg1) { + this.analysisComponent.eSet(arg0, arg1); + } + + @Override + public final void eUnset(final EStructuralFeature arg0) { + this.analysisComponent.eUnset(arg0); + } + + @Override + public final EList<Adapter> eAdapters() { + return this.analysisComponent.eAdapters(); + } + + @Override + public final boolean eDeliver() { + return this.analysisComponent.eDeliver(); + } + + @Override + public final void eNotify(final Notification arg0) { + this.analysisComponent.eNotify(arg0); + } + + @Override + public final void eSetDeliver(final boolean arg0) { + this.analysisComponent.eSetDeliver(arg0); + } + + @Override + public final String getName() { + return this.analysisComponent.getName(); + } + + @Override + public final void setName(final String value) { + this.analysisComponent.setName(value); + } + + @Override + public final String getClassname() { + return this.analysisComponent.getClassname(); + } + + @Override + public final void setClassname(final String value) { + this.analysisComponent.setClassname(value); + } + + @Override + public final EList<MIProperty> getProperties() { + return this.analysisComponent.getProperties(); + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractPluginDecorator.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractPluginDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..af72fb9f8c5039b0713eee255ec3c001afb1aaec --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/AbstractPluginDecorator.java @@ -0,0 +1,120 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.domain.pluginDecorators; + +import java.util.Map; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIDisplay; +import kieker.analysis.model.analysisMetaModel.MIOutputPort; +import kieker.analysis.model.analysisMetaModel.MIPlugin; +import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector; + +import org.eclipse.emf.common.util.EList; + +/** + * This is the abstract base for all other decorators which decorate the plugins from the analysis meta model. It adds some properties and methods to an + * {@link MIPlugin} instance. The already existing behavior of the {@link MIPlugin} instance is not modified. + * + * @author Nils Christian Ehmke + * + * @param <T> + * The type of the decorator. This can be specified by inheriting classes in order to provide a more specific interface to access the class. + */ +public abstract class AbstractPluginDecorator<T extends MIPlugin> extends AbstractAnalysisComponentDecorator<T> implements MIPlugin { + + private final Map<String, String> displaysDescriptions; + + /** + * Constructor to instantiate the fields of this class. + * + * @param analysisComponent + * The component wrapped by this decorator. + * @param propertiesDescriptions + * The descriptions of the properties. + * @param description + * The description of the wrapped component. + * @param dependency + * The dependency description of the wrapped component. + * @param fullyInitialized + * A flag to show whether the component has been fully initialized or not. + * @param displaysDescriptions + * The descriptions of the displays. + */ + public AbstractPluginDecorator(final T analysisComponent, final Map<String, String> propertiesDescriptions, final String description, final String dependency, + final boolean fullyInitialized, final Map<String, String> displaysDescriptions) { + super(analysisComponent, propertiesDescriptions, description, dependency, fullyInitialized); + + this.displaysDescriptions = displaysDescriptions; + } + + /** + * Delivers the description for the given display. + * + * @param display + * The display whose description should be delivered. + * + * @return The description. + */ + public final String getDisplayDescription(final String display) { + return this.displaysDescriptions.get(display); + } + + @Override + protected void refineComponentCopy(final MIAnalysisMetaModelFactory factory, final T componentCopy) { + super.refineComponentCopy(factory, componentCopy); + + // Copy the output ports of the plugin instance + for (final MIOutputPort outputPort : super.analysisComponent.getOutputPorts()) { + final MIOutputPort outputPortCopy = factory.createOutputPort(); + outputPortCopy.setName(outputPort.getName()); + outputPortCopy.setParent(componentCopy); + componentCopy.getOutputPorts().add(outputPortCopy); + } + + // Copy the repository "ports" + for (final MIRepositoryConnector repositoryConnector : super.analysisComponent.getRepositories()) { + final MIRepositoryConnector repositoryConnectorCopy = factory.createRepositoryConnector(); + repositoryConnectorCopy.setName(repositoryConnector.getName()); + componentCopy.getRepositories().add(repositoryConnectorCopy); + } + + // Copy the displays + for (final MIDisplay display : super.analysisComponent.getDisplays()) { + final MIDisplay displayCopy = factory.createDisplay(); + displayCopy.setName(display.getName()); + displayCopy.setParent(componentCopy); + componentCopy.getDisplays().add(displayCopy); + } + } + + @Override + public final EList<MIRepositoryConnector> getRepositories() { + return super.analysisComponent.getRepositories(); + } + + @Override + public final EList<MIOutputPort> getOutputPorts() { + return super.analysisComponent.getOutputPorts(); + } + + @Override + public final EList<MIDisplay> getDisplays() { + return super.analysisComponent.getDisplays(); + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/FilterDecorator.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/FilterDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..0a0042849fe0339883361d5b7dd63406996f839f --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/FilterDecorator.java @@ -0,0 +1,79 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.domain.pluginDecorators; + +import java.util.Map; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIFilter; +import kieker.analysis.model.analysisMetaModel.MIInputPort; + +import org.eclipse.emf.common.util.EList; + +/** + * This is the actual decorator which decorates an {@link MIFilter} instance with some more properties and methods. The already existing behavior of the + * {@link MIFilter} instance is not modified. + * + * @author Nils Christian Ehmke + */ +public class FilterDecorator extends AbstractPluginDecorator<MIFilter> implements MIFilter { + + /** + * Constructor to instantiate the fields of this class. + * + * @param analysisComponent + * The component wrapped by this decorator. + * @param propertiesDescriptions + * The descriptions of the properties. + * @param description + * The description of the wrapped component. + * @param dependency + * The dependency description of the wrapped component. + * @param fullyInitialized + * A flag to show whether the component has been fully initialized or not. + * @param displaysDescriptions + * The descriptions of the displays. + */ + public FilterDecorator(final MIFilter analysisComponent, final Map<String, String> propertiesDescriptions, final String description, final String dependency, + final boolean fullyInitialized, final Map<String, String> displaysDescriptions) { + super(analysisComponent, propertiesDescriptions, description, dependency, fullyInitialized, displaysDescriptions); + } + + @Override + protected final MIFilter createComponent(final MIAnalysisMetaModelFactory factory) { + return factory.createFilter(); + } + + @Override + protected final void refineComponentCopy(final MIAnalysisMetaModelFactory factory, final MIFilter componentCopy) { + super.refineComponentCopy(factory, componentCopy); + + // Copy the input ports of the plugin instance + for (final MIInputPort inputPort : super.analysisComponent.getInputPorts()) { + final MIInputPort inputPortCopy = factory.createInputPort(); + inputPortCopy.setName(inputPort.getName()); + inputPortCopy.setParent(componentCopy); + componentCopy.getInputPorts().add(inputPortCopy); + } + } + + @Override + public final EList<MIInputPort> getInputPorts() { + return super.analysisComponent.getInputPorts(); + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/ReaderDecorator.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/ReaderDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..529c93c1e476b9d72bda96f969451ee22f12d587 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/ReaderDecorator.java @@ -0,0 +1,58 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.domain.pluginDecorators; + +import java.util.Map; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIReader; + +/** + * This is the actual decorator which decorates an {@link MIReader} instance with some more properties and methods. The already existing behavior of the + * {@link MIReader} instance is not modified. + * + * @author Nils Christian Ehmke + */ +public class ReaderDecorator extends AbstractPluginDecorator<MIReader> implements MIReader { + + /** + * Constructor to instantiate the fields of this class. + * + * @param analysisComponent + * The component wrapped by this decorator. + * @param propertiesDescriptions + * The descriptions of the properties. + * @param description + * The description of the wrapped component. + * @param dependency + * The dependency description of the wrapped component. + * @param fullyInitialized + * A flag to show whether the component has been fully initialized or not. + * @param displaysDescriptions + * The descriptions of the displays. + */ + public ReaderDecorator(final MIReader analysisComponent, final Map<String, String> propertiesDescriptions, final String description, final String dependency, + final boolean fullyInitialized, final Map<String, String> displaysDescriptions) { + super(analysisComponent, propertiesDescriptions, description, dependency, fullyInitialized, displaysDescriptions); + } + + @Override + protected final MIReader createComponent(final MIAnalysisMetaModelFactory factory) { + return factory.createReader(); + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/RepositoryDecorator.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/RepositoryDecorator.java new file mode 100644 index 0000000000000000000000000000000000000000..ab70fcff300b861d5aa865b36b268dbf137c48f4 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/RepositoryDecorator.java @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.domain.pluginDecorators; + +import java.util.Map; + +import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; +import kieker.analysis.model.analysisMetaModel.MIRepository; + +/** + * This is the actual decorator which decorates an {@link MIRepository} instance with some more properties and methods. The already existing behavior of the + * {@link MIRepository} instance is not modified. + * + * @author Nils Christian Ehmke + */ +public class RepositoryDecorator extends AbstractAnalysisComponentDecorator<MIRepository> implements MIRepository { + + /** + * Constructor to instantiate the fields of this class. + * + * @param analysisComponent + * The component wrapped by this decorator. + * @param propertiesDescriptions + * The descriptions of the properties. + * @param description + * The description of the wrapped component. + * @param dependency + * The dependency description of the wrapped component. + * @param fullyInitialized + * A flag to show whether the component has been fully initialized or not. + */ + public RepositoryDecorator(final MIRepository analysisComponent, final Map<String, String> propertiesDescriptions, final String description, + final String dependency, final boolean fullyInitialized) { + super(analysisComponent, propertiesDescriptions, description, dependency, fullyInitialized); + } + + @Override + protected final MIRepository createComponent(final MIAnalysisMetaModelFactory factory) { + return factory.createRepository(); + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/IComponentContainer.java b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/package-info.java similarity index 63% rename from Kieker.WebGUI/src/main/java/kieker/webgui/domain/IComponentContainer.java rename to Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/package-info.java index 797ea54357f8a48b59a655151b6ef4f3b301874c..4e0b387da075622443c9b40a84719c9e61a82f9d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/domain/IComponentContainer.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/domain/pluginDecorators/package-info.java @@ -13,22 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package kieker.webgui.domain; /** - * This is the interface for component containers of different types (plugins and repositories). It exists to have a common base for the implementing classes. + * This package contains decorators for some of the components of the analysis meta model. The decorators add some properties and methods to those components. * * @author Nils Christian Ehmke */ -public interface IComponentContainer { +package kieker.webgui.domain.pluginDecorators; - /** - * Delivers the description of the given property. - * - * @param property - * The property name. - * @return The human readable description of the property. - */ - public String getPropertyDescription(final String property); - -} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java index 97f634a599c1a2b25acd289e67ba61d122cf14ce..831ec8be711deadcffa2fd3b8a6061db629efd72 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IProjectDAO.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.util.Collection; import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; - import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.NewerProjectException; @@ -32,6 +30,8 @@ import kieker.webgui.domain.ComponentListContainer; import org.primefaces.model.UploadedFile; +import org.springframework.security.access.prepost.PreAuthorize; + /** * This is the interface for the data access object(s) which will access for example the file system to manage the available projects. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java index a3af141975dd800b3cbfc7982d8ad8e6073dd491..35fd8b1aaf2f4da8447b257316cdc56ff5e7aeb3 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/IUserDAO.java @@ -18,14 +18,14 @@ package kieker.webgui.persistence; import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; - import kieker.webgui.common.exception.DataAccessException; import kieker.webgui.domain.User; +import org.springframework.security.access.prepost.PreAuthorize; + /** * This is the interface for the data access object(s) which will access for example a database to manage the available users. The methods within this interface are - * only accessible by administrators. Furthermore the methods should be transactional. + * only accessible by administrators. * * @author Nils Christian Ehmke */ diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java index a8b165e3cfd475eb6a85468a0d69a0d8d77591c9..eb041455b39e3097e946f0cf12eed19d6296249d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/DerbyUserDAOImpl.java @@ -25,10 +25,6 @@ import java.util.List; import javax.sql.DataSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.datasource.DataSourceUtils; -import org.springframework.stereotype.Service; - import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.exception.DataAccessException; @@ -36,6 +32,10 @@ import kieker.webgui.domain.User; import kieker.webgui.domain.User.Role; import kieker.webgui.persistence.IUserDAO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.stereotype.Service; + /** * An implementation of the {@link IUserDAO} interface, which uses Apache Derby to store and manage the available users. A transaction manager is not necessary, as * all of the used commands are atomic (except for the getUsers() method, which is read only though). diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java index f03958ae13a8d3e66bee963dcbb9ccc653fc53c7..9e674b6151bc1b5669869cc8061f1a3d89032cbf 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/FSProjectDAOImpl.java @@ -24,7 +24,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.lang.ref.WeakReference; -import java.lang.reflect.Modifier; import java.net.MalformedURLException; import java.net.URL; import java.security.AccessController; @@ -38,22 +37,20 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +import javax.annotation.Nullable; import javax.annotation.PostConstruct; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Service; -import org.springframework.util.FileCopyUtils; -import org.springframework.util.FileSystemUtils; -import org.springframework.util.WeakReferenceMonitor; -import org.springframework.util.WeakReferenceMonitor.ReleaseListener; - +import com.google.common.base.Function; +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; import com.google.common.io.Files; import kieker.analysis.AnalysisController; +import kieker.analysis.analysisComponent.AbstractAnalysisComponent; import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.MIProject; -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.logging.Log; import kieker.common.logging.LogFactory; @@ -62,15 +59,25 @@ import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.domain.ComponentListContainer; -import kieker.webgui.domain.PluginContainer; -import kieker.webgui.domain.RepositoryContainer; +import kieker.webgui.domain.pluginDecorators.FilterDecorator; +import kieker.webgui.domain.pluginDecorators.ReaderDecorator; +import kieker.webgui.domain.pluginDecorators.RepositoryDecorator; import kieker.webgui.persistence.IProjectDAO; import kieker.webgui.persistence.impl.util.Class2ModelInstanceConverter; import kieker.webgui.persistence.impl.util.CloseableURLClassLoader; import kieker.webgui.persistence.impl.util.PluginFinder; +import kieker.webgui.persistence.impl.util.SimpleCastFunction; import org.primefaces.model.UploadedFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Service; +import org.springframework.util.FileCopyUtils; +import org.springframework.util.FileSystemUtils; +import org.springframework.util.WeakReferenceMonitor; +import org.springframework.util.WeakReferenceMonitor.ReleaseListener; + /** * This is an implementation of the {@link IProjectDAO} interface, which uses the file system to store the available projects and everything. * @@ -136,9 +143,9 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { final CloseableURLClassLoader classLoader = (CloseableURLClassLoader) this.getClassLoader(project, dummyObject); // NOPMD (No ordinary classloader) final ClassAndMethodContainer classAndMethodContainer = new ClassAndMethodContainer(classLoader); - final List<PluginContainer> readers = new ArrayList<PluginContainer>(); - final List<PluginContainer> filters = new ArrayList<PluginContainer>(); - final List<RepositoryContainer> repositories = new ArrayList<RepositoryContainer>(); + final List<ReaderDecorator> readers = new ArrayList<ReaderDecorator>(); + final List<FilterDecorator> filters = new ArrayList<FilterDecorator>(); + final List<RepositoryDecorator> repositories = new ArrayList<RepositoryDecorator>(); // Update the components using all available dependencies final Collection<String> libs = this.listAllLibraries(project); @@ -160,31 +167,32 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { } } - private void initializeAvailableComponentsLists(final List<PluginContainer> readers, final List<PluginContainer> filters, - final List<RepositoryContainer> repositories, final URL lib, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) + private void initializeAvailableComponentsLists(final List<ReaderDecorator> readers, final List<FilterDecorator> filters, + final List<RepositoryDecorator> repositories, final URL lib, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws IOException { // FInd the available classes within the library - final List<Class<AbstractRepository>> repositoryClasses = this.pluginFinder.getAllRepositoriesWithinJar(lib, classLoader, classAndMethodContainer); - final List<Class<AbstractPlugin>> pluginClasses = this.pluginFinder.getAllPluginsWithinJar(lib, classLoader, classAndMethodContainer); - - // Convert the repositories into model instances - for (final Class<AbstractRepository> repository : repositoryClasses) { - if (!(Modifier.isAbstract(repository.getModifiers()) || this.class2ModelInstanceConverter.isProgrammaticOnly(repository, classAndMethodContainer))) { - repositories.add(this.class2ModelInstanceConverter.convertRepository2ModelInstance(repository, classAndMethodContainer)); - } - } - - // Convert the plugins into model instances - for (final Class<AbstractPlugin> plugin : pluginClasses) { - if (!(Modifier.isAbstract(plugin.getModifiers()) || this.class2ModelInstanceConverter.isProgrammaticOnly(plugin, classAndMethodContainer))) { - final PluginContainer pluginContainer = this.class2ModelInstanceConverter.convertPlugin2ModelInstance(plugin, classAndMethodContainer); - if (pluginContainer.isReader()) { - readers.add(pluginContainer); - } else { - filters.add(pluginContainer); - } - } - } + final Collection<Class<AbstractRepository>> repositoryClasses = this.pluginFinder.getAllRepositoriesWithinJar(lib, classLoader, classAndMethodContainer); + final Collection<Class<AbstractFilterPlugin>> filterClasses = this.pluginFinder.getAllFiltersWithinJar(lib, classLoader, classAndMethodContainer); + final Collection<Class<AbstractReaderPlugin>> readerClasses = this.pluginFinder.getAllReadersWithinJar(lib, classLoader, classAndMethodContainer); + + // Rule those out which are for programmatic purposes only and transform the remaining with the converter service into model instances. + final Collection<RepositoryDecorator> repositoryModelInstances = Collections2.transform(Collections2.transform( + Collections2.filter(repositoryClasses, new IsNotProgrammaticOnly(classAndMethodContainer)), + new SimpleCastFunction<Class<? extends AbstractAnalysisComponent>, Class<AbstractRepository>>()), new ConvertRepositoryClass2ModelInstanceFunction( + classAndMethodContainer)); + final Collection<FilterDecorator> filterModelInstances = Collections2.transform(Collections2.transform( + Collections2.filter(filterClasses, new IsNotProgrammaticOnly(classAndMethodContainer)), + new SimpleCastFunction<Class<? extends AbstractAnalysisComponent>, Class<AbstractFilterPlugin>>()), new ConvertFilterClass2ModelInstanceFunction( + classAndMethodContainer)); + final Collection<ReaderDecorator> readerModelInstances = Collections2.transform(Collections2.transform( + Collections2.filter(readerClasses, new IsNotProgrammaticOnly(classAndMethodContainer)), + new SimpleCastFunction<Class<? extends AbstractAnalysisComponent>, Class<AbstractReaderPlugin>>()), new ConvertReaderClass2ModelInstanceFunction( + classAndMethodContainer)); + + // Add the model instances to our lists. + repositories.addAll(repositoryModelInstances); + readers.addAll(readerModelInstances); + filters.addAll(filterModelInstances); } private static void createDirectoryIfNecessary(final String dirName) throws IOException { @@ -859,4 +867,81 @@ public class FSProjectDAOImpl implements IProjectDAO, ReleaseListener { } } + /** + * A predicate which can be used to check whether a class is for programmatic purposes only or not. + * + * @author Nils Christian Ehmke + */ + private class IsNotProgrammaticOnly implements Predicate<Class<? extends AbstractAnalysisComponent>> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public IsNotProgrammaticOnly(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + public boolean apply(@Nullable final Class<? extends AbstractAnalysisComponent> elem) { + return (elem != null) && !FSProjectDAOImpl.this.class2ModelInstanceConverter.isProgrammaticOnly(elem, this.classAndMethodContainer); + } + + } + + private class ConvertRepositoryClass2ModelInstanceFunction implements Function<Class<AbstractRepository>, RepositoryDecorator> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public ConvertRepositoryClass2ModelInstanceFunction(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + @Nullable + public RepositoryDecorator apply(@Nullable final Class<AbstractRepository> repository) { + if (repository == null) { + return null; + } + return FSProjectDAOImpl.this.class2ModelInstanceConverter.convertRepositoryClass2ModelInstance(repository, this.classAndMethodContainer); + } + + } + + private class ConvertReaderClass2ModelInstanceFunction implements Function<Class<AbstractReaderPlugin>, ReaderDecorator> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public ConvertReaderClass2ModelInstanceFunction(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + @Nullable + public ReaderDecorator apply(@Nullable final Class<AbstractReaderPlugin> reader) { + if (reader == null) { + return null; + } + return FSProjectDAOImpl.this.class2ModelInstanceConverter.convertReaderClass2ModelInstance(reader, this.classAndMethodContainer); + } + + } + + private class ConvertFilterClass2ModelInstanceFunction implements Function<Class<AbstractFilterPlugin>, FilterDecorator> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public ConvertFilterClass2ModelInstanceFunction(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + @Nullable + public FilterDecorator apply(@Nullable final Class<AbstractFilterPlugin> filter) { + if (filter == null) { + return null; + } + return FSProjectDAOImpl.this.class2ModelInstanceConverter.convertFilterClass2ModelInstance(filter, this.classAndMethodContainer); + } + + } + } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/Class2ModelInstanceConverter.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/Class2ModelInstanceConverter.java index 50e4e0d02887b8a6fae9bf9983a561c6f9e8d48c..9cd4a18fe676ef8484f75f995099587772888d72 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/Class2ModelInstanceConverter.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/Class2ModelInstanceConverter.java @@ -16,17 +16,14 @@ package kieker.webgui.persistence.impl.util; import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; -import org.springframework.stereotype.Service; - +import kieker.analysis.analysisComponent.AbstractAnalysisComponent; import kieker.analysis.model.analysisMetaModel.MIAnalysisComponent; import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.MIDisplay; @@ -35,17 +32,23 @@ import kieker.analysis.model.analysisMetaModel.MIInputPort; import kieker.analysis.model.analysisMetaModel.MIOutputPort; import kieker.analysis.model.analysisMetaModel.MIPlugin; import kieker.analysis.model.analysisMetaModel.MIProperty; +import kieker.analysis.model.analysisMetaModel.MIReader; import kieker.analysis.model.analysisMetaModel.MIRepository; -import kieker.analysis.model.analysisMetaModel.MIRepositoryConnector; import kieker.analysis.plugin.AbstractPlugin; -import kieker.analysis.plugin.annotation.Property; +import kieker.analysis.plugin.filter.AbstractFilterPlugin; +import kieker.analysis.plugin.reader.AbstractReaderPlugin; import kieker.analysis.repository.AbstractRepository; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.ClassAndMethodContainer; -import kieker.webgui.common.exception.ComponentInitializationException; -import kieker.webgui.domain.PluginContainer; -import kieker.webgui.domain.RepositoryContainer; +import kieker.webgui.domain.pluginDecorators.AbstractAnalysisComponentDecorator; +import kieker.webgui.domain.pluginDecorators.FilterDecorator; +import kieker.webgui.domain.pluginDecorators.ReaderDecorator; +import kieker.webgui.domain.pluginDecorators.RepositoryDecorator; + +import net.vidageek.mirror.dsl.Mirror; + +import org.springframework.stereotype.Service; /** * This service provides methods to convert a given {@link Class} instance (the one from a reflection loaded repository or plugin) to a meta model instance. This is @@ -68,404 +71,241 @@ public class Class2ModelInstanceConverter { } /** - * This method converts the given class instance into a model instance. + * Converts the given {@link AbstractReaderPlugin} instance into a model instance using the given parameters. * * @param clazz - * The class to be converted. + * The class to convert. * @param classAndMethodContainer - * The container which will be used for the converting. + * The container which will be used during the reflection calls. * - * @return An object containing the model instance. + * @return A model instance representing the given class as a meta model component. */ - public PluginContainer convertPlugin2ModelInstance(final Class<AbstractPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer) { - final Map<String, String> propertyDescriptions = new HashMap<String, String>(); - final Map<String, String> displayDescriptions = new HashMap<String, String>(); - boolean fullyInitialized; - String description = ""; - String dependency = ""; - - // Create a new instance for the model - final MIPlugin plugin; - if (classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) { - plugin = Class2ModelInstanceConverter.FACTORY.createReader(); - } else { - plugin = Class2ModelInstanceConverter.FACTORY.createFilter(); - } - plugin.setClassname(clazz.getName()); - plugin.setName(clazz.getSimpleName()); - - // Those are the attributes which can go wrong because of the lazy class loading - try { - description = Class2ModelInstanceConverter.getDescription(clazz, classAndMethodContainer); - dependency = Class2ModelInstanceConverter.getDependencies(clazz, classAndMethodContainer); - - Class2ModelInstanceConverter.fillProperties(clazz, plugin, classAndMethodContainer, propertyDescriptions); - Class2ModelInstanceConverter.fillPorts(clazz, plugin, classAndMethodContainer); - Class2ModelInstanceConverter.fillDisplays(clazz, plugin, classAndMethodContainer, displayDescriptions); - - fullyInitialized = true; - } catch (final ComponentInitializationException ex) { - // This exception can occur if (for example) a class is missing. We clear the component as far as possible - except for the description and the - // dependencies. This is important - plugin.getProperties().clear(); - plugin.getOutputPorts().clear(); - propertyDescriptions.clear(); - displayDescriptions.clear(); - if (plugin instanceof MIFilter) { - ((MIFilter) plugin).getInputPorts().clear(); - } - - fullyInitialized = false; - - Class2ModelInstanceConverter.LOG.info("A component with the classname '" + clazz.getCanonicalName() + "' could not be initialized.", ex); - } - - // Assemble the resulting instance with everything we could extract and return it - return new PluginContainer(plugin, description, dependency, fullyInitialized, Collections.unmodifiableMap(propertyDescriptions), - Collections.unmodifiableMap(displayDescriptions)); + public ReaderDecorator convertReaderClass2ModelInstance(final Class<AbstractReaderPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer) { + return (ReaderDecorator) this.convertComponentClass2ModelInstance(clazz, classAndMethodContainer, Type.Reader); } /** - * Tells whether the given class is "programmaticOnly". If there is no annotation which could tell the state of the flag, true will be returned. + * Converts the given {@link AbstractFilterPlugin} instance into a model instance using the given parameters. * * @param clazz - * The class of the plugin or repository. + * The class to convert. * @param classAndMethodContainer - * The container which will be used for the reflection access. + * The container which will be used during the reflection calls. * - * @return The state of the programmaticOnly flag of the plugin or repository. + * @return A model instance representing the given class as a meta model component. */ - public boolean isProgrammaticOnly(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) { - boolean result; - try { - // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); - final Annotation annotationRepository = clazz.getAnnotation(classAndMethodContainer.getRepositoryAnnotationClass()); - - final Method pluginProgOnlyMethod = classAndMethodContainer.getPluginProgrammaticOnlyMethod(); - final Method repoProgOnlyMethod = classAndMethodContainer.getRepositoryProgrammaticOnlyMethod(); - - // Now check which one of them is available - if (annotationPlugin == null) { - if (annotationRepository == null) { - // None. Say it is programmatic only. - result = true; - } else { - result = (Boolean) repoProgOnlyMethod.invoke(annotationRepository); - } - } else { - result = (Boolean) pluginProgOnlyMethod.invoke(annotationPlugin); - } - - } catch (final IllegalAccessException ex) { - result = true; - } catch (final IllegalArgumentException ex) { - result = true; - } catch (final InvocationTargetException ex) { - result = true; - } catch (final NoClassDefFoundError ex) { - result = true; - } - - return result; + public FilterDecorator convertFilterClass2ModelInstance(final Class<AbstractFilterPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer) { + return (FilterDecorator) this.convertComponentClass2ModelInstance(clazz, classAndMethodContainer, Type.Filter); } /** - * This method converts the given class instance into a model instance. + * Converts the given {@link AbstractRepository} instance into a model instance using the given parameters. * * @param clazz - * The class to be converted. + * The class to convert. * @param classAndMethodContainer - * The container which will be used for the converting. + * The container which will be used during the reflection calls. * - * @return An object containing the model instance. + * @return A model instance representing the given class as a meta model component. */ - public RepositoryContainer convertRepository2ModelInstance(final Class<AbstractRepository> clazz, final ClassAndMethodContainer classAndMethodContainer) { + public RepositoryDecorator convertRepositoryClass2ModelInstance(final Class<AbstractRepository> clazz, final ClassAndMethodContainer classAndMethodContainer) { + return (RepositoryDecorator) this.convertComponentClass2ModelInstance(clazz, classAndMethodContainer, Type.Repository); + } + + @SuppressWarnings("unchecked") + private AbstractAnalysisComponentDecorator<? extends MIAnalysisComponent> convertComponentClass2ModelInstance( + final Class<? extends AbstractAnalysisComponent> clazz, + final ClassAndMethodContainer classAndMethodContainer, final Type type) { + final MIAnalysisComponent plugin = this.createSuitableModelInstance(clazz, classAndMethodContainer); + + final Collection<MIProperty> properties = new ArrayList<MIProperty>(); + final Collection<MIInputPort> inputPorts = new ArrayList<MIInputPort>(); + final Collection<MIOutputPort> outputPorts = new ArrayList<MIOutputPort>(); + final Collection<MIDisplay> displays = new ArrayList<MIDisplay>(); final Map<String, String> propertyDescriptions = new HashMap<String, String>(); - boolean fullyInitialized; + final Map<String, String> displayDescriptions = new HashMap<String, String>(); String description = ""; String dependency = ""; + boolean fullyInitialized = true; - // Create a new instance for the model - final MIRepository repository = Class2ModelInstanceConverter.FACTORY.createRepository(); - - repository.setClassname(clazz.getName()); - repository.setName(clazz.getSimpleName()); - - // Those are the attributes which can go wrong because of the lazy class loading try { - description = Class2ModelInstanceConverter.getDescription(clazz, classAndMethodContainer); - dependency = Class2ModelInstanceConverter.getDependencies(clazz, classAndMethodContainer); - Class2ModelInstanceConverter.fillProperties(clazz, repository, classAndMethodContainer, propertyDescriptions); - - fullyInitialized = true; - } catch (final ComponentInitializationException ex) { - // This exception can occur if (for example) a class is missing. We clear the component as far as possible - except for the description and the - // dependencies. This is important - repository.getProperties().clear(); - - fullyInitialized = false; - - Class2ModelInstanceConverter.LOG.warn("A component with the classname '" + clazz.getCanonicalName() + "' could not be initialized.", ex); - } - - // Assemble the resulting instance with everything we could extract and return it - return new RepositoryContainer(repository, description, dependency, fullyInitialized, Collections.unmodifiableMap(propertyDescriptions)); - } - - private static String getDescription(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) throws ComponentInitializationException { - try { - final String description; - // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); - final Annotation annotationRepository = clazz.getAnnotation(classAndMethodContainer.getRepositoryAnnotationClass()); - - final Method pluginDescrMethod = classAndMethodContainer.getPluginDescriptionMethod(); - final Method repoDescrMethod = classAndMethodContainer.getRepositoryDescriptionMethod(); - - // Now check which one of them is available - if ((annotationPlugin == null) || ((String) pluginDescrMethod.invoke(annotationPlugin)).isEmpty()) { - if ((annotationRepository == null) || ((String) repoDescrMethod.invoke(annotationRepository)).isEmpty()) { - // None. Deliver a human readable substitute. - description = "No description available"; - } else { - description = (String) repoDescrMethod.invoke(annotationRepository); + description = this.fillDescription(clazz, classAndMethodContainer); + dependency = this.fillDependency(clazz, classAndMethodContainer); + + this.fillProperties(clazz, classAndMethodContainer, properties, propertyDescriptions); + plugin.getProperties().addAll(properties); + if ((type == Type.Filter) || (type == Type.Reader)) { + this.fillOutputPorts((Class<AbstractPlugin>) clazz, classAndMethodContainer, outputPorts, (MIPlugin) plugin); + this.fillDisplays((Class<AbstractPlugin>) clazz, classAndMethodContainer, displays, displayDescriptions); + ((MIPlugin) plugin).getOutputPorts().addAll(outputPorts); + ((MIPlugin) plugin).getDisplays().addAll(displays); + if (type == Type.Filter) { + this.fillInputPorts((Class<AbstractFilterPlugin>) clazz, classAndMethodContainer, inputPorts, (MIFilter) plugin); + ((MIFilter) plugin).getInputPorts().addAll(inputPorts); } - } else { - description = (String) pluginDescrMethod.invoke(annotationPlugin); } + } catch (final Throwable ex) { // NOCS NOPMD (Throwable) + Class2ModelInstanceConverter.LOG.info("A component with the classname '" + clazz.getCanonicalName() + "' could not be initialized.", ex); - return description; - } catch (final IllegalAccessException ex) { - throw new ComponentInitializationException("Could not load the description of the class.", ex); - } catch (final IllegalArgumentException ex) { - throw new ComponentInitializationException("Could not load the description of the class.", ex); - } catch (final InvocationTargetException ex) { - throw new ComponentInitializationException("Could not load the description of the class.", ex); - } catch (final NoClassDefFoundError ex) { - throw new ComponentInitializationException("Could not load the description of the class.", ex); - } - } - - private static String getDependencies(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) throws ComponentInitializationException { - try { - final String description; - - // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); - final Annotation annotationRepository = clazz.getAnnotation(classAndMethodContainer.getRepositoryAnnotationClass()); - - final Method pluginDepMethod = classAndMethodContainer.getPluginDependenciesMethod(); - final Method repoDepMethod = classAndMethodContainer.getRepositoryDependenciesMethod(); - - // Now check which one of them is available - if (annotationPlugin == null) { - if (annotationRepository == null) { - // None. Deliver a human readable substitute. - description = "No dependency information available"; - } else { - description = (String) repoDepMethod.invoke(annotationRepository); + plugin.getProperties().clear(); + if ((type == Type.Filter) || (type == Type.Reader)) { + ((MIPlugin) plugin).getOutputPorts().clear(); + ((MIPlugin) plugin).getDisplays().clear(); + if (type == Type.Filter) { + ((MIFilter) plugin).getDisplays().clear(); } - } else { - description = (String) pluginDepMethod.invoke(annotationPlugin); } - return description; - } catch (final IllegalAccessException ex) { - throw new ComponentInitializationException("Could not load the dependencies of the class.", ex); - } catch (final IllegalArgumentException ex) { - throw new ComponentInitializationException("Could not load the dependencies of the class.", ex); - } catch (final InvocationTargetException ex) { - throw new ComponentInitializationException("Could not load the dependencies of the class.", ex); - } catch (final NoClassDefFoundError ex) { - throw new ComponentInitializationException("Could not load the dependencies of the class.", ex); + fullyInitialized = false; } - } - - private static void fillProperties(final Class<?> clazz, final MIAnalysisComponent component, final ClassAndMethodContainer classAndMethodContainer, - final Map<String, String> propertyDescriptions) throws ComponentInitializationException { - try { - // Get the default configuration and use it to initialize the model repository - final List<Annotation> properties = Class2ModelInstanceConverter.getProperties(clazz, classAndMethodContainer); - - for (final Annotation property : properties) { - final MIProperty mProperty = Class2ModelInstanceConverter.FACTORY.createProperty(); + plugin.setClassname(clazz.getName()); + plugin.setName(clazz.getSimpleName()); - mProperty.setName((String) classAndMethodContainer.getPropertyNameMethod().invoke(property)); - mProperty.setValue((String) classAndMethodContainer.getPropertyDefaultValueMethod().invoke(property)); + // Decide what to return + AbstractAnalysisComponentDecorator<? extends MIAnalysisComponent> result; + switch (type) { + case Filter: + result = new FilterDecorator((MIFilter) plugin, Collections.unmodifiableMap(propertyDescriptions), description, dependency, fullyInitialized, + Collections.unmodifiableMap(displayDescriptions)); + break; + case Reader: + result = new ReaderDecorator((MIReader) plugin, Collections.unmodifiableMap(propertyDescriptions), description, dependency, fullyInitialized, + Collections.unmodifiableMap(displayDescriptions)); + break; + case Repository: + result = new RepositoryDecorator((MIRepository) plugin, Collections.unmodifiableMap(propertyDescriptions), description, dependency, fullyInitialized); + break; + default: + result = null; + break; + } - if (component instanceof MIPlugin) { - ((MIPlugin) component).getProperties().add(mProperty); - } else { - ((MIRepository) component).getProperties().add(mProperty); - } + return result; + } - // Get the description as well - final String description = (String) classAndMethodContainer.getPropertyDescriptionMethod().invoke(property); - propertyDescriptions.put(mProperty.getName(), description); - } - } catch (final IllegalAccessException ex) { - throw new ComponentInitializationException("Could not load the properties of the class.", ex); - } catch (final IllegalArgumentException ex) { - throw new ComponentInitializationException("Could not load the properties of the class.", ex); - } catch (final InvocationTargetException ex) { - throw new ComponentInitializationException("Could not load the properties of the class.", ex); - } catch (final NoClassDefFoundError ex) { - throw new ComponentInitializationException("Could not load the properties of the class.", ex); + private void fillInputPorts(final Class<AbstractFilterPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer, + final Collection<MIInputPort> inputPorts, + final MIFilter parent) { + final Collection<Method> methods = this.getInputPortMethods(clazz, classAndMethodContainer); + for (final Method method : methods) { + final Annotation inputPortAnnotation = method.getAnnotation(classAndMethodContainer.getInputPortAnnotationClass()); + final MIInputPort newPort = Class2ModelInstanceConverter.FACTORY.createInputPort(); + newPort.setName((String) new Mirror().on(inputPortAnnotation).invoke().method("name").withoutArgs()); + newPort.setParent(parent); + inputPorts.add(newPort); } } - private static List<Annotation> getProperties(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) throws IllegalArgumentException, - IllegalAccessException, InvocationTargetException { - // Get the two potential annotations - final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); - final Annotation annotationRepository = clazz.getAnnotation(classAndMethodContainer.getRepositoryAnnotationClass()); - - final Annotation[] properties; - - // Now check which one of them is available - if (annotationPlugin == null) { - if (annotationRepository == null) { - // None. - properties = new Property[0]; - } else { - properties = (Annotation[]) classAndMethodContainer.getRepositoryConfigurationMethod().invoke(annotationRepository); - } - } else { - properties = (Annotation[]) classAndMethodContainer.getPluginConfigurationMethod().invoke(annotationPlugin); + private void fillDisplays(final Class<? extends AbstractPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer, + final Collection<MIDisplay> displays, + final Map<String, String> displayDescriptions) { + final Collection<Method> methods = this.getDisplayMethods(clazz, classAndMethodContainer); + for (final Method method : methods) { + final Annotation displayAnnotation = method.getAnnotation(classAndMethodContainer.getDisplayAnnotationClass()); + final MIDisplay newDisplay = Class2ModelInstanceConverter.FACTORY.createDisplay(); + newDisplay.setName((String) new Mirror().on(displayAnnotation).invoke().method("name").withoutArgs()); + displays.add(newDisplay); + displayDescriptions.put(newDisplay.getName(), (String) new Mirror().on(displayAnnotation).invoke().method("description").withoutArgs()); } - - return Arrays.asList(properties); } - private static void fillDisplays(final Class<AbstractPlugin> clazz, final MIPlugin plugin, final ClassAndMethodContainer classAndMethodContainer, - final Map<String, String> displayDescriptions) throws ComponentInitializationException { - try { - // Get the displays and convert them into model instances - final List<Annotation> displays = Class2ModelInstanceConverter.getDisplays(clazz, classAndMethodContainer); - - for (final Annotation display : displays) { - final MIDisplay mDisplay = Class2ModelInstanceConverter.FACTORY.createDisplay(); - mDisplay.setName((String) classAndMethodContainer.getDisplayNameMethod().invoke(display)); - plugin.getDisplays().add(mDisplay); + private Collection<Method> getAnnotatedMethods(final Class<? extends AbstractPlugin> clazz, final Class<? extends Annotation> annotation) { + final Collection<Method> result = new ArrayList<Method>(); - // Get the description as well - final String description = (String) classAndMethodContainer.getDisplayDescriptionMethod().invoke(display); - displayDescriptions.put(mDisplay.getName(), description); + final Method[] methods = clazz.getMethods(); + for (final Method method : methods) { + if (method.isAnnotationPresent(annotation)) { + result.add(method); } - } catch (final IllegalAccessException ex) { - throw new ComponentInitializationException("Could not load the displays of the class.", ex); - } catch (final IllegalArgumentException ex) { - throw new ComponentInitializationException("Could not load the displays of the class.", ex); - } catch (final InvocationTargetException ex) { - throw new ComponentInitializationException("Could not load the displays of the class.", ex); - } catch (final NoClassDefFoundError ex) { - throw new ComponentInitializationException("Could not load the displays of the class.", ex); } + + return result; } - private static void fillPorts(final Class<AbstractPlugin> clazz, final MIPlugin plugin, final ClassAndMethodContainer classAndMethodContainer) throws - ComponentInitializationException { - try { - // Get the ports - final List<Annotation> inputPorts = Class2ModelInstanceConverter.getInputPorts(clazz, classAndMethodContainer); - final List<Annotation> outputPorts = Class2ModelInstanceConverter.getOutputPorts(clazz, classAndMethodContainer); - final List<Annotation> repositoryPorts = Class2ModelInstanceConverter.getRepositoryPorts(clazz, classAndMethodContainer); - - // Add input ports - if (plugin instanceof MIFilter) { - for (final Annotation inputPort : inputPorts) { - final MIInputPort mInputPort = Class2ModelInstanceConverter.FACTORY.createInputPort(); - mInputPort.setName((String) classAndMethodContainer.getInputPortNameMethod().invoke(inputPort)); - mInputPort.setParent((MIFilter) plugin); - } - } + private Collection<Method> getInputPortMethods(final Class<AbstractFilterPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer) { + return this.getAnnotatedMethods(clazz, classAndMethodContainer.getInputPortAnnotationClass()); + } - // Add output ports. - for (final Annotation outputPort : outputPorts) { - final MIOutputPort mOutputPort = Class2ModelInstanceConverter.FACTORY.createOutputPort(); - mOutputPort.setName((String) classAndMethodContainer.getOutputPortNameMethod().invoke(outputPort)); - mOutputPort.setParent(plugin); - } + private Collection<Method> getDisplayMethods(final Class<? extends AbstractPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer) { + return this.getAnnotatedMethods(clazz, classAndMethodContainer.getDisplayAnnotationClass()); + } - // Add repository ports. - for (final Annotation repositoryPort : repositoryPorts) { - final MIRepositoryConnector mConnector = Class2ModelInstanceConverter.FACTORY.createRepositoryConnector(); - mConnector.setName((String) classAndMethodContainer.getRepositoryPortNameMethod().invoke(repositoryPort)); - plugin.getRepositories().add(mConnector); - } - } catch (final IllegalAccessException ex) { - throw new ComponentInitializationException("Could not load the ports of the class.", ex); - } catch (final IllegalArgumentException ex) { - throw new ComponentInitializationException("Could not load the ports of the class.", ex); - } catch (final InvocationTargetException ex) { - throw new ComponentInitializationException("Could not load the ports of the class.", ex); - } catch (final NoClassDefFoundError ex) { - throw new ComponentInitializationException("Could not load the ports of the class.", ex); + private void fillOutputPorts(final Class<? extends AbstractPlugin> clazz, final ClassAndMethodContainer classAndMethodContainer, + final Collection<MIOutputPort> outputPorts, final MIPlugin parent) { + final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer); + final Annotation[] outputPortAnnotations = (Annotation[]) new Mirror().on(annotation).invoke().method("outputPorts").withoutArgs(); + for (final Annotation outputPortAnnotation : outputPortAnnotations) { + final MIOutputPort newPort = Class2ModelInstanceConverter.FACTORY.createOutputPort(); + newPort.setName((String) new Mirror().on(outputPortAnnotation).invoke().method("name").withoutArgs()); + newPort.setParent(parent); + outputPorts.add(newPort); } } - private static List<Annotation> getInputPorts(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) { - final List<Annotation> result = new ArrayList<Annotation>(); - - for (final Method method : clazz.getMethods()) { - // Get the potential annotation - final Annotation annotationPort = method.getAnnotation(classAndMethodContainer.getInputPortAnnotationClass()); - // Now check whether it is available - if (annotationPort != null) { - result.add(annotationPort); - } + private void fillProperties(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer, + final Collection<MIProperty> properties, final Map<String, String> propertyDescriptions) { + final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer); + final Annotation[] propertyAnnotations = (Annotation[]) new Mirror().on(annotation).invoke().method("configuration").withoutArgs(); + for (final Annotation propertyAnnotation : propertyAnnotations) { + final MIProperty newProperty = Class2ModelInstanceConverter.FACTORY.createProperty(); + newProperty.setName((String) new Mirror().on(propertyAnnotation).invoke().method("name").withoutArgs()); + newProperty.setValue((String) new Mirror().on(propertyAnnotation).invoke().method("defaultValue").withoutArgs()); + properties.add(newProperty); + propertyDescriptions.put(newProperty.getName(), (String) new Mirror().on(propertyAnnotation).invoke().method("description").withoutArgs()); } + } - return result; + private String fillDependency(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer) { + final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer); + return (String) new Mirror().on(annotation).invoke().method("dependencies").withoutArgs(); } - private static List<Annotation> getOutputPorts(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) throws IllegalArgumentException, - IllegalAccessException, InvocationTargetException { - final List<Annotation> result = new ArrayList<Annotation>(); + private String fillDescription(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer) { + final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer); + return (String) new Mirror().on(annotation).invoke().method("description").withoutArgs(); + } - // Get the potential annotation + private Annotation getSuitableAnnotation(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer) { + // Get the two potential annotations final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); + final Annotation annotationRepository = clazz.getAnnotation(classAndMethodContainer.getRepositoryAnnotationClass()); - // Now check whether it is available + // Find out which of them exists if (annotationPlugin != null) { - for (final Annotation oPort : (Annotation[]) classAndMethodContainer.getPluginOutputPortsMethod().invoke(annotationPlugin)) { - result.add(oPort); - } + return annotationPlugin; + } else { + return annotationRepository; } - - return result; } - private static List<Annotation> getRepositoryPorts(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) throws IllegalArgumentException, - IllegalAccessException, InvocationTargetException { - final List<Annotation> result = new ArrayList<Annotation>(); - - // Get the potential annotation - final Annotation annotationPlugin = clazz.getAnnotation(classAndMethodContainer.getPluginAnnotationClass()); - - // Now check whether it is available - if (annotationPlugin != null) { - for (final Annotation rPort : (Annotation[]) classAndMethodContainer.getPluginRepositoryPortsMethod().invoke(annotationPlugin)) { - result.add(rPort); - } + private MIAnalysisComponent createSuitableModelInstance(final Class<? extends AbstractAnalysisComponent> clazz, + final ClassAndMethodContainer classAndMethodContainer) { + if (classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(clazz)) { + return Class2ModelInstanceConverter.FACTORY.createReader(); + } else if (classAndMethodContainer.getAbstractFilterPluginClass().isAssignableFrom(clazz)) { + return Class2ModelInstanceConverter.FACTORY.createFilter(); + } else { + return Class2ModelInstanceConverter.FACTORY.createRepository(); } - - return result; } - private static List<Annotation> getDisplays(final Class<?> clazz, final ClassAndMethodContainer classAndMethodContainer) { - final List<Annotation> result = new ArrayList<Annotation>(); - - for (final Method method : clazz.getMethods()) { - // Get the potential annotation - final Annotation display = method.getAnnotation(classAndMethodContainer.getDisplayAnnotationClass()); - // Now check whether it is available - if (display != null) { - result.add(display); - } - } + /** + * Tells whether the given class is "programmaticOnly". + * + * @param clazz + * The class of the plugin or repository. + * @param classAndMethodContainer + * The container which will be used for the reflection access. + * + * @return The state of the programmaticOnly flag of the plugin or repository. + */ + public boolean isProgrammaticOnly(final Class<? extends AbstractAnalysisComponent> clazz, final ClassAndMethodContainer classAndMethodContainer) { + final Annotation annotation = this.getSuitableAnnotation(clazz, classAndMethodContainer); + return (Boolean) new Mirror().on(annotation).invoke().method("programmaticOnly").withoutArgs(); + } - return result; + private static enum Type { + Reader, Filter, Repository } + } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/CloseableURLClassLoader.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/CloseableURLClassLoader.java index a7f24e34ae0b6d516134551c2fe43394938642bb..f2084d59baf70b9adcbcc7b0260922f9d18d76da 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/CloseableURLClassLoader.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/CloseableURLClassLoader.java @@ -23,8 +23,8 @@ import java.util.Collection; /** * A class loader which extends the {@link URLClassLoader} with a close-method using a hack. This will probably only work for a Sun VM. The class itself will - * partially <b>not</b> be checked by Findbugs (there is an exception-rule in the configuration-file) as I <b>know</b> that the code is dangerous. It is a hack after - * all. + * partially <b>not</b> be checked by Findbugs (there is an exception-rule in the configuration-file) as we <b>know</b> that the code is dangerous. It is a hack + * after all. * * @author Nils Christian Ehmke */ @@ -36,22 +36,17 @@ public class CloseableURLClassLoader extends URLClassLoader implements Closeable * Creates a new instance of this class using the given parameters. * * @param urls - * The URLs to be used by the classloader. + * The URLs to be used by the class loader. * @param parent - * The parent of this classloader. + * The parent of this class loader. */ public CloseableURLClassLoader(final URL[] urls, final ClassLoader parent) { super(urls, parent); } - /* - * (non-Javadoc) - * - * @see java.io.Closeable#close() - */ @Override public synchronized void close() throws IOException { - // Make sure that the classloader can only be closed once. + // Make sure that the class loader can only be closed once. if (!this.closed) { this.closed = true; diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/PluginFinder.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/PluginFinder.java index 66cb2ee82dea9f99b4bc4f67a92921bd8fbbe436..ad6db336daf100ad17940cddee231c3a2aea8371 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/PluginFinder.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/PluginFinder.java @@ -16,18 +16,26 @@ package kieker.webgui.persistence.impl.util; import java.io.IOException; +import java.lang.reflect.Modifier; import java.net.URL; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; -import org.springframework.stereotype.Service; +import javax.annotation.Nullable; + +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; -import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.plugin.filter.AbstractFilterPlugin; +import kieker.analysis.plugin.reader.AbstractReaderPlugin; import kieker.analysis.repository.AbstractRepository; import kieker.webgui.common.ClassAndMethodContainer; +import org.springframework.stereotype.Service; + /** * 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. * @@ -44,80 +52,84 @@ public class PluginFinder { } /** - * This method delivers all classes which are available in the given jar and are compatible with <code>AbstractRepository</code>.. + * This method delivers all classes which are available in the given jar and are compatible with <code>AbstractRepository</code>. None of them is abstract. * * @param url - * The url for the jar. + * The URL for the jar. * @param classLoader - * The classloader which should be used to load the classes. + * The class loader which should be used to load the classes. * @param classAndMethodContainer * The container for the necessary reflection methods. + * * @return A list containing all available repository-classes or null, if an exception occurred. + * * @throws IOException * If something went wrong during the opening of the jar file. */ - public List<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url, final ClassLoader classLoader, + public Collection<Class<AbstractRepository>> getAllRepositoriesWithinJar(final URL url, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws IOException { - // Get a list containing all available classes within the given jar - final List<Class<?>> clazzes = this.getAllClassesWithinJar(url, classLoader); - - List<Class<AbstractRepository>> result = null; - - result = new ArrayList<Class<AbstractRepository>>(); - for (final Class<?> clazz : clazzes) { - // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(classAndMethodContainer.getRepositoryAnnotationClass()) - && classAndMethodContainer.getAbstractRepositoryClass().isAssignableFrom(clazz)) { - result.add((Class<AbstractRepository>) clazz); - } - } - - return result; + return Collections2.transform(Collections2.filter(Collections2.filter(this.getAllClassesWithinJar(url, classLoader), + new IsRepositoryPredicate(classAndMethodContainer)), new IsNotAbstractPredicate()), new SimpleCastFunction<Class<?>, Class<AbstractRepository>>()); } /** * This method delivers all classes which are available in the given jar and have the Plugin-Annotation from the Kieker framework (And are correctly compatible - * with <code>AbstractPlugin</code>). + * with <code>AbstractReaderPlugin</code>). None of them is abstract. * * @param url - * The url for the jar. + * The URL for the jar. * @param classLoader - * The classloader which should be used to load the classes. + * The class loader which should be used to load the classes. * @param classAndMethodContainer * The container for the necessary reflection methods. + * * @return A list containing all available plugin-classes or null, if an exception occurred. + * * @throws IOException * If something went wrong during the opening of the jar file. */ - public List<Class<AbstractPlugin>> getAllPluginsWithinJar(final URL url, final ClassLoader classLoader, + public Collection<Class<AbstractReaderPlugin>> getAllReadersWithinJar(final URL url, final ClassLoader classLoader, final ClassAndMethodContainer classAndMethodContainer) throws IOException { - final List<Class<?>> clazzes = this.getAllClassesWithinJar(url, classLoader); - List<Class<AbstractPlugin>> result = null; - - result = new ArrayList<Class<AbstractPlugin>>(); - for (final Class<?> clazz : clazzes) { - // This is the cast resulting in an unchecked cast warning. - if (clazz.isAnnotationPresent(classAndMethodContainer.getPluginAnnotationClass()) - && classAndMethodContainer.getAbstractPluginClass().isAssignableFrom(clazz)) { - result.add((Class<AbstractPlugin>) clazz); - } - } + return Collections2.transform(Collections2.filter(Collections2.filter(this.getAllClassesWithinJar(url, classLoader), + new IsReaderPredicate(classAndMethodContainer)), new IsNotAbstractPredicate()), new SimpleCastFunction<Class<?>, Class<AbstractReaderPlugin>>()); + } - return result; + /** + * This method delivers all classes which are available in the given jar and have the Plugin-Annotation from the Kieker framework (And are correctly compatible + * with <code>AbstractFilterPlugin</code>). None of them is abstract. + * + * @param url + * The URL for the jar. + * @param classLoader + * The class loader which should be used to load the classes. + * @param classAndMethodContainer + * The container for the necessary reflection methods. + * + * @return A list containing all available plugin-classes or null, if an exception occurred. + * + * @throws IOException + * If something went wrong during the opening of the jar file. + */ + public Collection<Class<AbstractFilterPlugin>> getAllFiltersWithinJar(final URL url, final ClassLoader classLoader, + final ClassAndMethodContainer classAndMethodContainer) throws IOException { + return Collections2.transform(Collections2.filter(Collections2.filter(this.getAllClassesWithinJar(url, classLoader), + new IsFilterPredicate(classAndMethodContainer)), new IsNotAbstractPredicate()), new SimpleCastFunction<Class<?>, Class<AbstractFilterPlugin>>()); } /** * This method delivers all classes which are available in the given jar. * * @param url - * The url for the jar. + * The URL for the jar. * @param classLoader - * The classloader which should be used to load the classes. + * The class loader which should be used to load the classes. + * * @return A list containing all available classes or null, if an exception occurred. + * * @throws IOException * If something went wrong during the opening of the jar file. */ - private List<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) throws IOException { + private Collection<Class<?>> getAllClassesWithinJar(final URL url, final ClassLoader classLoader) throws IOException { JarInputStream stream = null; try { final List<Class<?>> result = new ArrayList<Class<?>>(); @@ -153,4 +165,85 @@ public class PluginFinder { } } + /** + * A predicate which can be used to check whether a class is a repository or not. + * + * @author Nils Christian Ehmke + */ + private static class IsRepositoryPredicate implements Predicate<Class<?>> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public IsRepositoryPredicate(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + public boolean apply(@Nullable final Class<?> elem) { + return (elem != null) && elem.isAnnotationPresent(this.classAndMethodContainer.getRepositoryAnnotationClass()) + && this.classAndMethodContainer.getAbstractRepositoryClass().isAssignableFrom(elem); + } + + } + + /** + * A predicate which can be used to check whether a class is a reader or not. + * + * @author Nils Christian Ehmke + */ + private static class IsReaderPredicate implements Predicate<Class<?>> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public IsReaderPredicate(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + public boolean apply(@Nullable final Class<?> elem) { + return (elem != null) && elem.isAnnotationPresent(this.classAndMethodContainer.getPluginAnnotationClass()) + && this.classAndMethodContainer.getAbstractReaderPluginClass().isAssignableFrom(elem); + } + + } + + /** + * A predicate which can be used to check whether a class is a filter or not. + * + * @author Nils Christian Ehmke + */ + private static class IsFilterPredicate implements Predicate<Class<?>> { + + private final ClassAndMethodContainer classAndMethodContainer; + + public IsFilterPredicate(final ClassAndMethodContainer classAndMethodContainer) { + this.classAndMethodContainer = classAndMethodContainer; + } + + @Override + public boolean apply(@Nullable final Class<?> elem) { + return (elem != null) && elem.isAnnotationPresent(this.classAndMethodContainer.getPluginAnnotationClass()) + && this.classAndMethodContainer.getAbstractFilterPluginClass().isAssignableFrom(elem); + } + + } + + /** + * A predicate which can be used to check whether a class is abstract or not. + * + * @author Nils Christian Ehmke + */ + private static class IsNotAbstractPredicate implements Predicate<Class<?>> { + + public IsNotAbstractPredicate() { + // No code necessary + } + + @Override + public boolean apply(@Nullable final Class<?> elem) { + return (elem != null) && !Modifier.isAbstract(elem.getModifiers()); + } + + } + } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/SimpleCastFunction.java b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/SimpleCastFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..8d74af1b269457e2ec262f010e7a6f5019bde2e7 --- /dev/null +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/persistence/impl/util/SimpleCastFunction.java @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright 2013 Kieker Project (http://kieker-monitoring.net) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ***************************************************************************/ + +package kieker.webgui.persistence.impl.util; + +import javax.annotation.Nullable; + +import com.google.common.base.Function; + +/** + * A function which simply casts from the source type to the target type. + * + * @author Nils Christian Ehmke + * + * @param <S> + * The source type. + * @param <T> + * The target type. + */ +public class SimpleCastFunction<S, T> implements Function<S, T> { + + /** + * Default constructor. + */ + public SimpleCastFunction() { + // No code necessary + } + + @SuppressWarnings("unchecked") + @Override + @Nullable + public T apply(@Nullable final S elem) { + return (T) elem; + } + +} diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IGraphLayoutService.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IGraphLayoutService.java index 84e6fe95d2bda71f041feda50a0a7f828206f5e8..321fc3665f04b2681ecdef737dc1d75808f74be2 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IGraphLayoutService.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IGraphLayoutService.java @@ -16,10 +16,10 @@ package kieker.webgui.service; -import org.springframework.security.access.prepost.PreAuthorize; - import kieker.webgui.common.exception.GraphLayoutException; +import org.springframework.security.access.prepost.PreAuthorize; + /** * An interface for a service providing a graph layouter. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java index 2a3049764b69b550e777470ba280bbf08677a1c0..ec59a5855acfaa1985fe3061d23e3ba354e41f62 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IProjectService.java @@ -20,14 +20,12 @@ import java.io.IOException; import java.util.Collection; import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; - import kieker.analysis.AnalysisController.STATE; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.AnalysisInitializationException; -import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; +import kieker.webgui.common.exception.InvalidAnalysisStateException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -35,6 +33,8 @@ import kieker.webgui.domain.ComponentListContainer; import org.primefaces.model.UploadedFile; +import org.springframework.security.access.prepost.PreAuthorize; + /** * This is the interface for a component which is responsible for managing all projects. This means that this interface can be used to create, copy, delete projects * as well as to start and stop the corresponding analyses and similar things. The facade should abstract from details like the (memory) locations and from @@ -288,13 +288,13 @@ public interface IProjectService { * The class loader to be used during the loading. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis of the given project is in the wrong state to be initialized. This means that it has not been cleaned yet. * @throws AnalysisInitializationException * If an error occurred during the initialization of the analysis. */ @PreAuthorize("hasAnyRole('User', 'Administrator')") - public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, AnalysisStateException, + public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, InvalidAnalysisStateException, AnalysisInitializationException; /** @@ -304,11 +304,11 @@ public interface IProjectService { * The name of the project whose analysis should be cleaned. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis of the given project is in the wrong state to be cleaned. This means that it has not been terminated yet. */ @PreAuthorize("hasAnyRole('User', 'Administrator')") - public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; + public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException; /** * This method starts the analysis of the given project. @@ -317,11 +317,11 @@ public interface IProjectService { * The name of the project whose analysis should be started. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis of the given project is in the wrong state to be started. This means that it has not been initialized yet. */ @PreAuthorize("hasAnyRole('User', 'Administrator')") - public void startAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; + public void startAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException; /** * This method stops the analysis of the given project. @@ -330,11 +330,11 @@ public interface IProjectService { * The name of the project whose analysis should be stopped. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis of the given project is in the wrong state to be stopped. This means that it has not been started yet or is no longer running. */ @PreAuthorize("hasAnyRole('User', 'Administrator')") - public void stopAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException; + public void stopAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException; /** * This method delivers the display object of the (currently running) analysis for the given project and the given parameters. Technically it is an instance of @@ -371,11 +371,11 @@ public interface IProjectService { * @param projectName * The name of the project. * @return An array containing the entries of the log. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to deliver the entries. */ @PreAuthorize("isAuthenticated()") - public Object[] getLogEntries(final String projectName) throws AnalysisStateException; + public Object[] getLogEntries(final String projectName) throws InvalidAnalysisStateException; /** * Deletes the given library of the given project. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java index 6e2da22c2130f478bf3aa6435d0ddaf1adc9cd4d..56353e74aafc30839fbf10d8022cd1087baceee1 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/IUserService.java @@ -17,11 +17,11 @@ package kieker.webgui.service; import java.util.List; -import org.springframework.security.access.prepost.PreAuthorize; - import kieker.webgui.common.exception.DataAccessException; import kieker.webgui.domain.User; +import org.springframework.security.access.prepost.PreAuthorize; + /** * This is an interface to the service which can be used to manage the available users within the system. The methods within this interface are only accessible by * administrators. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java index 5efacd2ac2861a2dac216afdc0898aacc2191172..5e5332bfd28a198d1901887ecaa3fd03069f7379 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/GraphLayoutServiceImpl.java @@ -22,8 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.springframework.stereotype.Service; - import kieker.webgui.common.exception.GraphLayoutException; import kieker.webgui.service.IGraphLayoutService; @@ -44,6 +42,8 @@ import de.cau.cs.kieler.kiml.options.PortConstraints; import de.cau.cs.kieler.kiml.util.KimlUtil; import de.cau.cs.kieler.klay.layered.LayeredLayoutProvider; +import org.springframework.stereotype.Service; + /** * This class provides a single method to perform an auto layout on a given graph from the GraphFlow. The JavaScript GraphFlow throws an "autoLayout"-Event upon * using the function autoLayout(). This event provides two Strings which may be used by this class' layoutGraph(nodes, edges) method. The return value can then be diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/ProjectServiceImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/ProjectServiceImpl.java index dcba8d58000bcf5cdb53766cd29846b9d0a6dffa..36d71100c3c580788f0ad75de53a91861b846db8 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/ProjectServiceImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/ProjectServiceImpl.java @@ -22,15 +22,12 @@ import java.util.List; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import kieker.analysis.AnalysisController.STATE; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.AnalysisInitializationException; -import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; +import kieker.webgui.common.exception.InvalidAnalysisStateException; import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectAlreadyExistingException; import kieker.webgui.common.exception.ProjectNotExistingException; @@ -41,6 +38,9 @@ import kieker.webgui.service.impl.util.ACManager; import org.primefaces.model.UploadedFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + /** * This is an implemented facade for the project management. For technical reasons it is a singleton class. * @@ -257,7 +257,7 @@ public class ProjectServiceImpl implements IProjectService { * @see kieker.webgui.service.IProjectService#initializeAnalysis(java.lang.String, java.lang.ClassLoader) */ @Override - public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, AnalysisStateException, + public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, InvalidAnalysisStateException, AnalysisInitializationException { // We have to lock both - the project and the analysis, as a file has to be loaded final Object projectLock = this.getLock(projectName, this.fileSystemLocks); @@ -276,7 +276,7 @@ public class ProjectServiceImpl implements IProjectService { * @see kieker.webgui.service.IProjectService#cleanAnalysis(java.lang.String) */ @Override - public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException { + public void cleanAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException { final Object analysisLock = this.getLock(projectName, this.analysesLocks); synchronized (analysisLock) { @@ -290,7 +290,7 @@ public class ProjectServiceImpl implements IProjectService { * @see kieker.webgui.service.IProjectService#startAnalysis(java.lang.String) */ @Override - public void startAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException { + public void startAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException { final Object analysisLock = this.getLock(projectName, this.analysesLocks); synchronized (analysisLock) { @@ -304,7 +304,7 @@ public class ProjectServiceImpl implements IProjectService { * @see kieker.webgui.service.IProjectService#stopAnalysis(java.lang.String) */ @Override - public void stopAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException { + public void stopAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException { final Object analysisLock = this.getLock(projectName, this.analysesLocks); synchronized (analysisLock) { @@ -372,7 +372,7 @@ public class ProjectServiceImpl implements IProjectService { * @see kieker.webgui.service.IProjectService#getLogEntries(java.lang.String) */ @Override - public Object[] getLogEntries(final String projectName) throws AnalysisStateException { + public Object[] getLogEntries(final String projectName) throws InvalidAnalysisStateException { final Object analysisLock = this.getLock(projectName, this.analysesLocks); synchronized (analysisLock) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/UserServiceImpl.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/UserServiceImpl.java index acaa55c6da0af6bb2bf004887a8f5cf80b1f5f5a..05436e4a38c4eb5adcb628b2e0c1e6b155e4186b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/UserServiceImpl.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/UserServiceImpl.java @@ -17,14 +17,14 @@ package kieker.webgui.service.impl; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import kieker.webgui.common.exception.DataAccessException; import kieker.webgui.domain.User; import kieker.webgui.persistence.IUserDAO; import kieker.webgui.service.IUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + /** * This is an implementation of the {@link IUserService} interface. The work will be delegated to the underlying data access object. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/ACManager.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/ACManager.java index 2dd6f4d3e621f52b6fb749626769f80ffe154d8a..afc376759a357088401959c53e1734872154d197 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/ACManager.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/ACManager.java @@ -18,16 +18,16 @@ package kieker.webgui.service.impl.util; import java.util.concurrent.ConcurrentHashMap; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import kieker.analysis.AnalysisController.STATE; import kieker.webgui.common.exception.AnalysisInitializationException; -import kieker.webgui.common.exception.AnalysisStateException; import kieker.webgui.common.exception.DisplayNotFoundException; +import kieker.webgui.common.exception.InvalidAnalysisStateException; import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.persistence.IProjectDAO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + /** * This manager is responsible for the currently used and running instances of {@code AnalysisController}. It supplies methods to check the states of analysis, * instantiate, start and to stop them. This is also a singleton instance. @@ -59,14 +59,14 @@ public class ACManager { * If a project with the given name does not exist. * @throws AnalysisInitializationException * If an error occurred during the initialization of the analysis. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to be initialized. */ - public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, AnalysisStateException, + public void initializeAnalysis(final String projectName, final ClassLoader classLoader) throws ProjectNotExistingException, InvalidAnalysisStateException, AnalysisInitializationException { // The analysis for the given project must not exist! if (this.analyses.containsKey(projectName)) { - throw new AnalysisStateException("The analysis has not been cleaned yet."); + throw new InvalidAnalysisStateException("The analysis has not been cleaned yet."); } final Analysis analysis = new Analysis(classLoader, this.projectDAO.getProjectFile(projectName)); @@ -78,10 +78,10 @@ public class ACManager { * * @param projectName * The name of the project to be cleaned. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to be cleaned. */ - public void cleanAnalysis(final String projectName) throws AnalysisStateException { + public void cleanAnalysis(final String projectName) throws InvalidAnalysisStateException { // The analysis for the given project must exist! if (!this.analyses.containsKey(projectName)) { // Nothing to do @@ -91,7 +91,7 @@ public class ACManager { // The analysis for the given project must not run if (STATE.RUNNING.toString().equals(analysis.getCurrentState().toString())) { - throw new AnalysisStateException("The analysis is still running."); + throw new InvalidAnalysisStateException("The analysis is still running."); } this.analyses.remove(projectName); @@ -104,19 +104,19 @@ public class ACManager { * The name of the project to be started. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to be started. */ - public void startAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException { + public void startAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException { // The analysis for the given project must exist! if (!this.analyses.containsKey(projectName)) { - throw new AnalysisStateException("The analysis has not been initialized yet."); + throw new InvalidAnalysisStateException("The analysis has not been initialized yet."); } final Analysis analysis = this.analyses.get(projectName); // The analysis for the given project must be ready if (!STATE.READY.toString().equals(analysis.getCurrentState().toString())) { - throw new AnalysisStateException("The analysis is not ready."); + throw new InvalidAnalysisStateException("The analysis is not ready."); } analysis.start(); @@ -129,19 +129,19 @@ public class ACManager { * The name of the project to be stopped. * @throws ProjectNotExistingException * If a project with the given name does not exist. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to be stopped. */ - public void stopAnalysis(final String projectName) throws ProjectNotExistingException, AnalysisStateException { + public void stopAnalysis(final String projectName) throws ProjectNotExistingException, InvalidAnalysisStateException { // The analysis for the given project must exist! if (!this.analyses.containsKey(projectName)) { - throw new AnalysisStateException("The analysis has not been initialized yet."); + throw new InvalidAnalysisStateException("The analysis has not been initialized yet."); } final Analysis analysis = this.analyses.get(projectName); // The analysis for the given project must be running if (!STATE.RUNNING.toString().equals(analysis.getCurrentState().toString())) { - throw new AnalysisStateException("The analysis is not running."); + throw new InvalidAnalysisStateException("The analysis is not running."); } analysis.stop(); @@ -153,13 +153,13 @@ public class ACManager { * @param projectName * The name of the project. * @return An array containing the entries of the log. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in an invalid state to deliver the entries. */ - public Object[] getLogEntries(final String projectName) throws AnalysisStateException { + public Object[] getLogEntries(final String projectName) throws InvalidAnalysisStateException { // The analysis for the given project must exist! if (!this.analyses.containsKey(projectName)) { - throw new AnalysisStateException("The analysis has not been initialized yet."); + throw new InvalidAnalysisStateException("The analysis has not been initialized yet."); } return this.analyses.get(projectName).getLogEntries(); } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/Analysis.java b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/Analysis.java index 6831593f9a0853317bb299311a4909545e4d29db..b8d71dcc4b7dc10900109dbbae10831bc6adc0c6 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/Analysis.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/service/impl/util/Analysis.java @@ -21,17 +21,17 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import net.vidageek.mirror.dsl.Mirror; -import net.vidageek.mirror.exception.MirrorException; - import kieker.analysis.AnalysisController; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.ClassAndMethodContainer; import kieker.webgui.common.exception.AnalysisInitializationException; -import kieker.webgui.common.exception.AnalysisStateException; +import kieker.webgui.common.exception.InvalidAnalysisStateException; import kieker.webgui.common.exception.ProjectLoadException; +import net.vidageek.mirror.dsl.Mirror; +import net.vidageek.mirror.exception.MirrorException; + /** * An analysis within the web gui. * @@ -57,12 +57,12 @@ public class Analysis { * The class loader to be used to initialize the analysis. * @param projectFile * The file to be loaded. - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If something went wrong during the loading of the analysis. * @throws AnalysisInitializationException * If an error occurred during the instantiation of the analysis. */ - public Analysis(final ClassLoader classLoader, final File projectFile) throws AnalysisStateException, AnalysisInitializationException { + public Analysis(final ClassLoader classLoader, final File projectFile) throws InvalidAnalysisStateException, AnalysisInitializationException { try { this.classAndMethodContainer = new ClassAndMethodContainer(classLoader); @@ -90,10 +90,10 @@ public class Analysis { /** * Starts the analysis. * - * @throws AnalysisStateException + * @throws InvalidAnalysisStateException * If the analysis is in the wrong state to be started. */ - public void start() throws AnalysisStateException { + public void start() throws InvalidAnalysisStateException { try { new Mirror().on(this.analysisControllerThread).invoke().method("start").withoutArgs(); } catch (final MirrorException ex) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java index 24e0634c3e08684c91138c9cbf55ae8ecf5062f7..5cafd10013436ec6b8599a5e0357244d58aa5cd9 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/application/ProjectsBean.java @@ -25,11 +25,6 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.AnalysisController.STATE; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.common.logging.Log; @@ -43,6 +38,11 @@ import kieker.webgui.web.beans.view.CurrentProjectOverviewBean; import org.primefaces.model.UploadedFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * This class is a {@code Spring} managed bean to manage a list with all application wide available projects. It provides methods to receive this list as well * as methods to add, create, rename, open and copy projects. Furthermore the state of existing projects (like the timestamp or the state of the analysis) can be diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java index 1f41503182544c41d2783b3a42472148fc662995..5425a517baafca8ff6d65a3d45ef317f65e50580 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/NewUserBean.java @@ -16,11 +16,11 @@ package kieker.webgui.web.beans.request; +import kieker.webgui.domain.User.Role; + import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import kieker.webgui.domain.User.Role; - /** * This simple {@code Spring} managed bean is request scoped and can be used to store the necessary data for a new user during a request. It should not be used, for * example, to deliver a list containing the available user within the system, as this bean contains a field for the password. For such cases you should use diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/UploadFileBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/UploadFileBean.java index eac5cab1f8c9b05a886885fdd9864948a8b26814..eb4586632535ae8ed15a1f71174326cf1e92d964 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/UploadFileBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/request/UploadFileBean.java @@ -16,11 +16,11 @@ package kieker.webgui.web.beans.request; +import org.primefaces.model.UploadedFile; + import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import org.primefaces.model.UploadedFile; - /** * This simple {@code Spring} managed bean is request scoped and can be used to store the necessary data for a file upload. * diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/session/UserBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/session/UserBean.java index 62f839b57499c13f809592a43675f457b1dd7fc8..83c0812c97a55b7b094b852d8d93427f4358fa41 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/session/UserBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/session/UserBean.java @@ -25,6 +25,8 @@ import javax.faces.context.FacesContext; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; +import kieker.webgui.web.beans.application.GlobalPropertiesBean; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.security.core.GrantedAuthority; @@ -32,8 +34,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; -import kieker.webgui.web.beans.application.GlobalPropertiesBean; - /** * This bean contains information about the user of this session (like the properties and configurations). This class is a {@code Spring} managed bean with session * scope. This means also that it is possible to login the same user multiple times.<br> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java index e7f935681ba891214c2a142432ab3d061fee1ae1..d3ea5ee49e16b592c9bd7a03e61464c87e39442d 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorBean.java @@ -26,10 +26,6 @@ import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.event.ValueChangeEvent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.model.analysisMetaModel.MIAnalysisComponent; import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.MIDependency; @@ -49,9 +45,10 @@ import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.domain.ComponentListContainer; -import kieker.webgui.domain.IComponentContainer; -import kieker.webgui.domain.PluginContainer; -import kieker.webgui.domain.RepositoryContainer; +import kieker.webgui.domain.pluginDecorators.AbstractAnalysisComponentDecorator; +import kieker.webgui.domain.pluginDecorators.FilterDecorator; +import kieker.webgui.domain.pluginDecorators.ReaderDecorator; +import kieker.webgui.domain.pluginDecorators.RepositoryDecorator; import kieker.webgui.service.IProjectService; import kieker.webgui.web.beans.application.GlobalPropertiesBean; import kieker.webgui.web.beans.application.ProjectsBean; @@ -61,6 +58,10 @@ import org.primefaces.context.RequestContext; import org.primefaces.event.FileUploadEvent; import org.primefaces.model.UploadedFile; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * The {@link CurrentAnalysisEditorBean} contains the necessary data behind an instance of the analysis editor. It provides various methods to manipulate the current * project, as the analysis editor is the most important part of the whole application. The connection to the graph within the editor is done via another bean (the @@ -100,8 +101,8 @@ public class CurrentAnalysisEditorBean { * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b> */ public CurrentAnalysisEditorBean() { - this.availableComponents = new ComponentListContainer(Collections.<PluginContainer>emptyList(), Collections.<PluginContainer>emptyList(), - Collections.<RepositoryContainer>emptyList()); + this.availableComponents = new ComponentListContainer(Collections.<ReaderDecorator>emptyList(), Collections.<FilterDecorator>emptyList(), + Collections.<RepositoryDecorator>emptyList()); } /** @@ -317,9 +318,9 @@ public class CurrentAnalysisEditorBean { * @param container * The container which delivers the copy of the repository. */ - public void addRepository(final RepositoryContainer container) { + public void addRepository(final RepositoryDecorator container) { // Create a new instance for the model - final MIRepository repository = container.newInstance(CurrentAnalysisEditorBean.FACTORY); + final MIRepository repository = container.newCopy(CurrentAnalysisEditorBean.FACTORY); // Add it to the project - and to the graph this.project.getRepositories().add(repository); @@ -328,23 +329,30 @@ public class CurrentAnalysisEditorBean { this.setModificationsFlag(); } + public void addReader(final ReaderDecorator container) { + // Create a new instance for the model + final MIPlugin plugin = container.newCopy(CurrentAnalysisEditorBean.FACTORY); + + // Add it to the project - and to the graph + this.project.getPlugins().add(plugin); + this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin); + + this.setModificationsFlag(); + } + /** * This method adds a new plugin to the current model, using the given instance of {@code PluginContainer} for it. * * @param container * The container which delivers the copy of the plugin. */ - public void addPlugin(final PluginContainer container) { + public void addFilter(final FilterDecorator container) { // Create a new instance for the model - final MIPlugin plugin = container.newInstance(CurrentAnalysisEditorBean.FACTORY); + final MIPlugin plugin = container.newCopy(CurrentAnalysisEditorBean.FACTORY); // Add it to the project - and to the graph this.project.getPlugins().add(plugin); - if (plugin instanceof MIReader) { - this.currentAnalysisEditorGraphBean.addReader((MIReader) plugin); - } else { - this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin); - } + this.currentAnalysisEditorGraphBean.addFilter((MIFilter) plugin); this.setModificationsFlag(); } @@ -410,29 +418,29 @@ public class CurrentAnalysisEditorBean { * @return A human readable description and a substitution if there is no description. */ public String getDescription(final MIAnalysisComponent component, final String property) { - IComponentContainer container = null; + AbstractAnalysisComponentDecorator<? extends MIAnalysisComponent> container = null; // Find the container which contains the component if (component instanceof MIReader) { final String className = ((MIReader) component).getClassname(); - for (final PluginContainer reader : this.availableComponents.getReaders()) { - if (reader.getPlugin().getClassname().equals(className)) { + for (final ReaderDecorator reader : this.availableComponents.getReaders()) { + if (reader.getClassname().equals(className)) { container = reader; break; } } } else if (component instanceof MIFilter) { final String className = ((MIFilter) component).getClassname(); - for (final PluginContainer filter : this.availableComponents.getFilters()) { - if (filter.getPlugin().getClassname().equals(className)) { + for (final FilterDecorator filter : this.availableComponents.getFilters()) { + if (filter.getClassname().equals(className)) { container = filter; break; } } } else { final String className = ((MIRepository) component).getClassname(); - for (final RepositoryContainer repository : this.availableComponents.getRepositories()) { - if (repository.getRepository().getClassname().equals(className)) { + for (final RepositoryDecorator repository : this.availableComponents.getRepositories()) { + if (repository.getClassname().equals(className)) { container = repository; break; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java index b49437042683a3cb68c69704412cb47784440c12..3e2148d55f3c7f9b05c253b99e34a5960c94d64c 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentAnalysisEditorGraphBean.java @@ -20,10 +20,6 @@ import java.util.Map; import javax.faces.context.FacesContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.model.analysisMetaModel.MIAnalysisComponent; import kieker.analysis.model.analysisMetaModel.MIFilter; import kieker.analysis.model.analysisMetaModel.MIInputPort; @@ -44,6 +40,10 @@ import org.primefaces.context.RequestContext; import org.eclipse.emf.common.util.EList; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * The {@link CurrentAnalysisEditorGraphBean} contains the necessary data behind an graph of the analysis editor. It provides various methods to manipulate the * current graph.<br> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java index 4226352c86928d8260341d05cfa481a64e9f5c74..2eb08c172f74acf0335c40ea6706d40b5502e256 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitBean.java @@ -23,10 +23,6 @@ import javax.faces.application.FacesMessage; import javax.faces.component.html.HtmlOutputText; import javax.faces.context.FacesContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.model.analysisMetaModel.MIDisplayConnector; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIView; @@ -46,6 +42,10 @@ import org.primefaces.model.DashboardModel; import org.primefaces.model.DefaultDashboardColumn; import org.primefaces.model.DefaultDashboardModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * This class is a {@code Spring} managed bean with view scope containing the necessary data behind an instance of the cockpit.<br> * <br/> diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java index 37f2d079a3cff2facb54977422f5794b2fcdeec0..bea534ce25093d941133db0891a323517edef5a3 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentCockpitEditorBean.java @@ -29,13 +29,10 @@ import javax.faces.component.UIInput; import javax.faces.component.html.HtmlOutputText; import javax.faces.context.FacesContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.model.analysisMetaModel.MIAnalysisMetaModelFactory; import kieker.analysis.model.analysisMetaModel.MIDisplay; import kieker.analysis.model.analysisMetaModel.MIDisplayConnector; +import kieker.analysis.model.analysisMetaModel.MIPlugin; import kieker.analysis.model.analysisMetaModel.MIProject; import kieker.analysis.model.analysisMetaModel.MIView; import kieker.analysis.model.analysisMetaModel.impl.MAnalysisMetaModelFactory; @@ -46,8 +43,10 @@ import kieker.webgui.common.exception.NewerProjectException; import kieker.webgui.common.exception.ProjectLoadException; import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.domain.ComponentListContainer; -import kieker.webgui.domain.PluginContainer; -import kieker.webgui.domain.RepositoryContainer; +import kieker.webgui.domain.pluginDecorators.AbstractPluginDecorator; +import kieker.webgui.domain.pluginDecorators.FilterDecorator; +import kieker.webgui.domain.pluginDecorators.ReaderDecorator; +import kieker.webgui.domain.pluginDecorators.RepositoryDecorator; import kieker.webgui.service.IProjectService; import kieker.webgui.web.beans.application.GlobalPropertiesBean; import kieker.webgui.web.beans.application.ProjectsBean; @@ -62,6 +61,10 @@ import org.primefaces.model.DashboardModel; import org.primefaces.model.DefaultDashboardColumn; import org.primefaces.model.DefaultDashboardModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * The {@link CurrentCockpitEditorBean} contains the necessary data behind an instance of the cockpit editor. * The class is a Spring managed bean with view scope to make sure that one user (even in one session) can open multiple projects at a time without causing any @@ -103,8 +106,8 @@ public class CurrentCockpitEditorBean { * Creates a new instance of this class. <b>Do not call this constructor manually. It will only be accessed by Spring.</b> */ public CurrentCockpitEditorBean() { - this.availableComponents = new ComponentListContainer(Collections.<PluginContainer>emptyList(), Collections.<PluginContainer>emptyList(), - Collections.<RepositoryContainer>emptyList()); + this.availableComponents = new ComponentListContainer(Collections.<ReaderDecorator>emptyList(), Collections.<FilterDecorator>emptyList(), + Collections.<RepositoryDecorator>emptyList()); this.createDashboard(); } @@ -271,18 +274,18 @@ public class CurrentCockpitEditorBean { */ public String getDescription(final MIDisplay display) { final String parentClassname = display.getParent().getClassname(); - PluginContainer parentContainer = null; + AbstractPluginDecorator<? extends MIPlugin> parentContainer = null; // Find the correct parent container - for (final PluginContainer plugin : this.availableComponents.getFilters()) { - if (plugin.getPlugin().getClassname().equals(parentClassname)) { + for (final FilterDecorator plugin : this.availableComponents.getFilters()) { + if (plugin.getClassname().equals(parentClassname)) { parentContainer = plugin; break; } } if (parentContainer == null) { - for (final PluginContainer plugin : this.availableComponents.getReaders()) { - if (plugin.getPlugin().getClassname().equals(parentClassname)) { + for (final ReaderDecorator plugin : this.availableComponents.getReaders()) { + if (plugin.getClassname().equals(parentClassname)) { parentContainer = plugin; break; } diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentControllerBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentControllerBean.java index ccd34501a350fc383bc721e56b3f465130903147..05ea569377258531bab783b48b6eb5f7b7ffcb4c 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentControllerBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentControllerBean.java @@ -25,18 +25,18 @@ import java.util.Collection; import java.util.Date; import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.analysis.AnalysisController; import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.exception.AnalysisInitializationException; -import kieker.webgui.common.exception.AnalysisStateException; +import kieker.webgui.common.exception.InvalidAnalysisStateException; import kieker.webgui.common.exception.ProjectNotExistingException; import kieker.webgui.service.IProjectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * /** * The {@link CurrentControllerBean} contains the necessary data behind an instance of the analysis controller. The class is a Spring managed bean with view scope to @@ -79,7 +79,7 @@ public class CurrentControllerBean { this.addLogEntry("Starting Analysis for project '" + this.projectName + "'"); try { this.projectService.startAnalysis(this.projectName); - } catch (final AnalysisStateException ex) { + } catch (final InvalidAnalysisStateException ex) { CurrentControllerBean.LOG.info("The analysis has already been started.", ex); this.addLogEntry(ex); } catch (final ProjectNotExistingException ex) { @@ -98,7 +98,7 @@ public class CurrentControllerBean { synchronized (this) { this.projectService.stopAnalysis(this.projectName); } - } catch (final AnalysisStateException ex) { + } catch (final InvalidAnalysisStateException ex) { CurrentControllerBean.LOG.info("The analysis has not been started yet.", ex); this.addLogEntry(ex); } catch (final ProjectNotExistingException ex) { @@ -114,7 +114,7 @@ public class CurrentControllerBean { this.addLogEntry("Instantiating Analysis for project '" + this.projectName + "'"); try { this.projectService.initializeAnalysis(this.projectName, this.projectService.getClassLoader(this.projectName, this)); // NOPMD (ClassLoader) - } catch (final AnalysisStateException ex) { + } catch (final InvalidAnalysisStateException ex) { CurrentControllerBean.LOG.error("The analysis has already been instantiated.", ex); this.addLogEntry(ex); } catch (final ProjectNotExistingException ex) { @@ -139,7 +139,7 @@ public class CurrentControllerBean { } catch (final ProjectNotExistingException ex) { CurrentControllerBean.LOG.info("The project does not exist.", ex); this.addLogEntry(ex); - } catch (final AnalysisStateException ex) { + } catch (final InvalidAnalysisStateException ex) { CurrentControllerBean.LOG.error("The analysis has not been instantiated yet.", ex); this.addLogEntry(ex); @@ -239,7 +239,7 @@ public class CurrentControllerBean { public Object[] getAnalysisLog() { try { return this.projectService.getLogEntries(this.projectName); - } catch (final AnalysisStateException ex) { + } catch (final InvalidAnalysisStateException ex) { // Ignore return new Object[0]; } catch (final NullPointerException ex) { diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentProjectOverviewBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentProjectOverviewBean.java index 48fe8371dfb4e82820bdf3f07fc05ab0b456f89b..0c26dc764666e942aed1aa19862d5a868e7dbe4c 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentProjectOverviewBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentProjectOverviewBean.java @@ -21,14 +21,14 @@ import java.util.List; import javax.annotation.PostConstruct; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.webgui.web.beans.application.ProjectsBean; import org.primefaces.event.SelectEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * The {@link CurrentProjectOverviewBean} contains the necessary data behind an instance of the project overview.<br> * The class is a Spring managed bean with view scope. diff --git a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java index 548a0b4888300392c0287a5eac2846b9aaee86cd..fbb8823c7827168507375ef5bb6442407dbd4a6b 100644 --- a/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java +++ b/Kieker.WebGUI/src/main/java/kieker/webgui/web/beans/view/CurrentUserManagementBean.java @@ -22,10 +22,6 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - import kieker.common.logging.Log; import kieker.common.logging.LogFactory; import kieker.webgui.common.exception.DataAccessException; @@ -34,6 +30,10 @@ import kieker.webgui.domain.User.Role; import kieker.webgui.service.IUserService; import kieker.webgui.web.beans.application.GlobalPropertiesBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + /** * The {@link CurrentUserManagementBean} contains the necessary data behind an instance of the user management page. * The class is a Spring managed bean with view scope to make sure that one user (even in one session) can open multiple instances of the page at a time without diff --git a/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml b/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml index 05991f6c3f8f7d113b7988212c6d36dcdbf90a78..13b01accf03ee17bbe8650acab4d0e4fb8ca51d9 100644 --- a/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml +++ b/Kieker.WebGUI/src/main/webapp/pages/AnalysisEditorPage.xhtml @@ -179,12 +179,12 @@ <p:accordionPanel multiple="true" activeIndex="0,1,2"> <p:tab title="#{localizedAnalysisEditorPageMessages.reader}"> <ui:repeat value="#{currentAnalysisEditorBean.availableComponents.readers}" var="reader"> - <p:commandLink id="readerLink" value="#{reader.plugin.name}" action="#{currentAnalysisEditorBean.addPlugin(reader)}" update=":messages" disabled="#{not reader.fullyInitialized}" /><br/> + <p:commandLink id="readerLink" value="#{reader.name}" action="#{currentAnalysisEditorBean.addReader(reader)}" update=":messages" disabled="#{not reader.fullyInitialized}" /><br/> <p:tooltip for="readerLink"> <b> <div align="center"> - <h:outputText value="#{reader.plugin.name}"/><br/> - <h:outputText value="(#{reader.plugin.classname})"/> + <h:outputText value="#{reader.name}"/><br/> + <h:outputText value="(#{reader.classname})"/> </div> </b> <br/> @@ -192,21 +192,21 @@ <ul> <li><h:outputText value="#{reader.description}"/></li> </ul> - <ui:fragment rendered="#{not empty reader.plugin.outputPorts}"> + <ui:fragment rendered="#{not empty reader.outputPorts}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.outputPorts}:"/></b> - <p:dataList value="#{reader.plugin.outputPorts}" var="port"> + <p:dataList value="#{reader.outputPorts}" var="port"> #{port.name} </p:dataList> </ui:fragment> - <ui:fragment rendered="#{not empty reader.plugin.repositories}"> + <ui:fragment rendered="#{not empty reader.repositories}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.repositoryPorts}:" /></b> - <p:dataList value="#{reader.plugin.repositories}" var="port"> + <p:dataList value="#{reader.repositories}" var="port"> #{port.name} </p:dataList> </ui:fragment> - <ui:fragment rendered="#{not empty reader.plugin.properties}"> + <ui:fragment rendered="#{not empty reader.properties}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.configuration}:"/></b> - <p:dataList value="#{reader.plugin.properties}" var="property"> + <p:dataList value="#{reader.properties}" var="property"> #{property.name} </p:dataList> </ui:fragment> @@ -221,12 +221,12 @@ </p:tab> <p:tab title="#{localizedAnalysisEditorPageMessages.filter}"> <ui:repeat value="#{currentAnalysisEditorBean.availableComponents.filters}" var="filter"> - <p:commandLink id="filterLink" value="#{filter.plugin.name}" action="#{currentAnalysisEditorBean.addPlugin(filter)}" update=":messages"/><br/> + <p:commandLink id="filterLink" value="#{filter.name}" action="#{currentAnalysisEditorBean.addFilter(filter)}" update=":messages"/><br/> <p:tooltip for="filterLink" > <b> <div align="center"> - <h:outputText value="#{filter.plugin.name}"/><br/> - <h:outputText value="(#{filter.plugin.classname})"/> + <h:outputText value="#{filter.name}"/><br/> + <h:outputText value="(#{filter.classname})"/> </div> </b> <br/> @@ -234,27 +234,27 @@ <ul> <li><h:outputText value="#{filter.description}"/></li> </ul> - <ui:fragment rendered="#{not empty filter.plugin.inputPorts}"> + <ui:fragment rendered="#{not empty filter.inputPorts}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.inputPorts}:"/></b> - <p:dataList value="#{filter.plugin.inputPorts}" var="port"> + <p:dataList value="#{filter.inputPorts}" var="port"> #{port.name} </p:dataList> </ui:fragment> - <ui:fragment rendered="#{not empty filter.plugin.outputPorts}"> + <ui:fragment rendered="#{not empty filter.outputPorts}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.outputPorts}:"/></b> - <p:dataList value="#{filter.plugin.outputPorts}" var="port"> + <p:dataList value="#{filter.outputPorts}" var="port"> #{port.name} </p:dataList> </ui:fragment> - <ui:fragment rendered="#{not empty filter.plugin.repositories}"> + <ui:fragment rendered="#{not empty filter.repositories}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.repositoryPorts}:"/></b> - <p:dataList value="#{filter.plugin.repositories}" var="port"> + <p:dataList value="#{filter.repositories}" var="port"> #{port.name} </p:dataList> </ui:fragment> - <ui:fragment rendered="#{not empty filter.plugin.properties}"> + <ui:fragment rendered="#{not empty filter.properties}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.configuration}:"/></b> - <p:dataList value="#{filter.plugin.properties}" var="property"> + <p:dataList value="#{filter.properties}" var="property"> #{property.name} </p:dataList> </ui:fragment> @@ -269,12 +269,12 @@ </p:tab> <p:tab title="#{localizedAnalysisEditorPageMessages.repositories}"> <ui:repeat value="#{currentAnalysisEditorBean.availableComponents.repositories}" var="repository"> - <p:commandLink id="repositoryLink" value="#{repository.repository.name}" action="#{currentAnalysisEditorBean.addRepository(repository)}" update=":messages"/><br/> + <p:commandLink id="repositoryLink" value="#{repository.name}" action="#{currentAnalysisEditorBean.addRepository(repository)}" update=":messages"/><br/> <p:tooltip for="repositoryLink"> <b> <div align="center"> - <h:outputText value="#{repository.repository.name}"/><br/> - <h:outputText value="(#{repository.repository.classname})"/> + <h:outputText value="#{repository.name}"/><br/> + <h:outputText value="(#{repository.classname})"/> </div> </b> <br/> @@ -282,9 +282,9 @@ <ul> <li><h:outputText value="#{repository.description}"/></li> </ul> - <ui:fragment rendered="#{not empty repository.repository.properties}"> + <ui:fragment rendered="#{not empty repository.properties}"> <b><h:outputText value="#{localizedAnalysisEditorPageMessages.configuration}:"/></b> - <p:dataList value="#{repository.repository.properties}" var="property"> + <p:dataList value="#{repository.properties}" var="property"> #{property.name} </p:dataList> </ui:fragment> diff --git a/Kieker.WebGUI/src/test/java/kieker/webgui/persistence/impl/util/PluginFinderTest.java b/Kieker.WebGUI/src/test/java/kieker/webgui/persistence/impl/util/PluginFinderTest.java index 96a54c99310ae77654b4a326d39625be8612aa7a..b8de9c4bb2fce4dc481cd16516844e5315a4b3ee 100644 --- a/Kieker.WebGUI/src/test/java/kieker/webgui/persistence/impl/util/PluginFinderTest.java +++ b/Kieker.WebGUI/src/test/java/kieker/webgui/persistence/impl/util/PluginFinderTest.java @@ -18,12 +18,13 @@ package kieker.webgui.persistence.impl.util; import java.io.IOException; import java.net.URL; -import java.util.List; +import java.util.Collection; import org.junit.Assert; import org.junit.Test; -import kieker.analysis.plugin.AbstractPlugin; +import kieker.analysis.plugin.filter.AbstractFilterPlugin; +import kieker.analysis.plugin.reader.AbstractReaderPlugin; import kieker.analysis.repository.AbstractRepository; import kieker.webgui.common.ClassAndMethodContainer; @@ -54,11 +55,13 @@ public class PluginFinderTest { final ClassAndMethodContainer classAndMethodContainer = new ClassAndMethodContainer(classLoader); try { - final List<Class<AbstractPlugin>> plugins = pluginFinder.getAllPluginsWithinJar(kiekerURL, classLoader, classAndMethodContainer); - final List<Class<AbstractRepository>> repositories = pluginFinder.getAllRepositoriesWithinJar(kiekerURL, classLoader, classAndMethodContainer); + final Collection<Class<AbstractFilterPlugin>> filters = pluginFinder.getAllFiltersWithinJar(kiekerURL, classLoader, classAndMethodContainer); + final Collection<Class<AbstractReaderPlugin>> readers = pluginFinder.getAllReadersWithinJar(kiekerURL, classLoader, classAndMethodContainer); + final Collection<Class<AbstractRepository>> repositories = pluginFinder.getAllRepositoriesWithinJar(kiekerURL, classLoader, classAndMethodContainer); // There should be at least one element of both types - Assert.assertFalse("No plugins found.", plugins.isEmpty()); + Assert.assertFalse("No filters found.", filters.isEmpty()); + Assert.assertFalse("No readers found.", readers.isEmpty()); Assert.assertFalse("No repositories found.", repositories.isEmpty()); classLoader.close();