diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-29 07:32:09 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-09-29 07:32:09 +0000 |
commit | 023074370754b13a5bdd8a2c589225fb12275b20 (patch) | |
tree | f8aae48c347a545d97413cb89802768751da3a1e /branches/sca-equinox/modules | |
parent | fcef778b4fb5b4ee7d828c1e9cfb62af2d48d869 (diff) |
More fixes to monitor. Removed remaining dependencies on DefaultLoggingMonitorImpl implementation class.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@700007 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
14 files changed, 53 insertions, 41 deletions
diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java index 53993cf39a..6528124a2a 100644 --- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java @@ -95,7 +95,7 @@ public class JavaExportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributePackageMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java index 684e9b01f4..bd2911b60b 100644 --- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java @@ -97,7 +97,7 @@ public class JavaImportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributePackageMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java index b11933fbef..369460b280 100644 --- a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java @@ -95,7 +95,7 @@ public class NamespaceExportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeNameSpaceMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java index 282c0cfbe7..7163876339 100644 --- a/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java @@ -99,7 +99,7 @@ public class NamespaceImportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeNameSpaceMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java index 371af3ae54..e43d705ec3 100644 --- a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java @@ -96,7 +96,7 @@ public class ResourceExportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeURIMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java index 42ca5709d2..1e99b0b01b 100644 --- a/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java @@ -98,7 +98,7 @@ public class ResourceImportProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeURIMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java index b6fb7a0d2e..8dc6ab7ab1 100644 --- a/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java +++ b/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java @@ -103,7 +103,7 @@ public class ContributionMetadataProcessorTestCase extends TestCase { assertTrue(true); }*/ staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeCompositeMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java b/branches/sca-equinox/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java index 0b304a0854..d642244f2c 100644 --- a/branches/sca-equinox/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java +++ b/branches/sca-equinox/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java @@ -77,6 +77,7 @@ import org.apache.tuscany.sca.domain.manager.impl.ContributionCollectionImpl.Cac import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; +import org.apache.tuscany.sca.monitor.Problem.Severity; import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; @@ -181,7 +182,7 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) { continue; } - entries.add(entry(workspace, contribution)); + entries.add(entry(workspace, contribution, monitor)); } return entries.toArray(new Entry[entries.size()]); } @@ -193,7 +194,7 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl Workspace workspace = readContributions(readWorkspace()); for (Contribution contribution: workspace.getContributions()) { if (key.equals(contribution.getURI())) { - return item(workspace, contribution); + return item(workspace, contribution, monitor); } } throw new NotFoundException(key); @@ -292,7 +293,7 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl // Skip the specified contribution continue; } - entries.add(entry(workspace, dependency)); + entries.add(entry(workspace, dependency, monitor)); } break; } @@ -362,7 +363,7 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl Contribution contribution = contributionFactory.createContribution(); contribution.setURI(uri); contribution.setLocation(locationPath); - entries.add(entry(suggestionWorkspace, contribution)); + entries.add(entry(suggestionWorkspace, contribution, monitor)); } } @@ -378,20 +379,22 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl * @param contribution * @return */ - private static Entry<String, Item> entry(Workspace workspace, Contribution contribution) { + private static Entry<String, Item> entry(Workspace workspace, Contribution contribution, Monitor monitor) { Entry<String, Item> entry = new Entry<String, Item>(); entry.setKey(contribution.getURI()); - entry.setData(item(workspace, contribution)); + entry.setData(item(workspace, contribution, monitor)); return entry; } /** * Returns an item representing a contribution. * + * @param workspace * @param contribution + * @param monitor * @return */ - private static Item item(Workspace workspace, Contribution contribution) { + private static Item item(Workspace workspace, Contribution contribution, final Monitor monitor) { String contributionURI = contribution.getURI(); Item item = new Item(); item.setTitle(title(contributionURI)); @@ -400,7 +403,7 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl // List the contribution dependencies in the item contents final List<String> problems = new ArrayList<String>(); - Monitor monitor = new Monitor() { + Monitor recordingMonitor = new Monitor() { public void problem(Problem problem) { problems.add(problem.getMessageId() + " " + problem.getProblemObject().toString()); } @@ -408,10 +411,23 @@ public class ContributionCollectionImpl implements ItemCollection, LocalItemColl public List<Problem> getProblems() { return null; } + + public Problem getLastProblem() { + // TODO Auto-generated method stub + return null; + } + + public Problem createProblem(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Exception cause) { + return monitor.createProblem(sourceClassName, bundleName, severity, problemObject, messageId, cause); + } + + public Problem createProblem(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Object... messageParams) { + return monitor.createProblem(sourceClassName, bundleName, severity, problemObject, messageId, messageParams); + } }; StringBuffer sb = new StringBuffer(); - ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(monitor); + ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(recordingMonitor); List<Contribution> dependencies = analyzer.buildContributionDependencies(contribution, workspace); if (dependencies.size() > 1) { sb.append("Dependencies: <span id=\"dependencies\">"); diff --git a/branches/sca-equinox/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java b/branches/sca-equinox/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java index f5a898465a..9e19788112 100644 --- a/branches/sca-equinox/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java @@ -103,7 +103,7 @@ public class BPELImplementationProcessorTestCase extends TestCase { public void testLoadInvalidComposite() throws Exception { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID)); staxProcessor.read(reader); - Problem problem = monitor.getLastLoggedProblem(); + Problem problem = monitor.getLastProblem(); assertNotNull(problem); assertEquals("AttributeProcessMissing", problem.getMessageId()); } diff --git a/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java b/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java index 1dc397659b..74648701c6 100644 --- a/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java +++ b/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java @@ -21,7 +21,6 @@ package org.apache.tuscany.sca.implementation.node.builder.impl; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.namespace.QName; @@ -42,8 +41,6 @@ import org.apache.tuscany.sca.implementation.node.NodeImplementation; import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl; import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; /** * @@ -63,24 +60,6 @@ public class CalculateBindingURITestCase extends TestCase { assemblyFactory = new DefaultAssemblyFactory(); scaBindingFactory = new TestBindingFactory(); nodeImplementationFactory = new NodeImplementationFactoryImpl(); - monitor = new Monitor() { - public void problem(Problem problem) { - if (problem.getSeverity() == Severity.INFO) { - logger.info(problem.toString()); - } else if (problem.getSeverity() == Severity.WARNING) { - logger.warning(problem.toString()); - } else if (problem.getSeverity() == Severity.ERROR) { - if (problem.getCause() != null) { - logger.log(Level.SEVERE, problem.toString(), problem.getCause()); - } else { - logger.severe(problem.toString()); - } - } - } - public List<Problem> getProblems() { - return null; - } - }; configurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor); Binding defaultBinding = new TestBindingImpl(); defaultBinding.setURI("http://myhost:8080/root"); diff --git a/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java b/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java index bc0c3b1507..6c08bbed0f 100644 --- a/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java +++ b/branches/sca-equinox/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java @@ -39,7 +39,6 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtens import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl; import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; /** diff --git a/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java b/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java index ef49ddd323..f0ac8a6dbb 100644 --- a/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java +++ b/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java @@ -48,7 +48,7 @@ public interface Monitor { * * @return */ - public Problem getLastLoggedProblem(); + public Problem getLastProblem(); /** * Create a new problem. diff --git a/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java b/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java index 585e616632..fa562a5f23 100644 --- a/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java +++ b/branches/sca-equinox/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/MonitorImpl.java @@ -75,7 +75,7 @@ public class MonitorImpl implements Monitor { return problemCache; } - public Problem getLastLoggedProblem(){ + public Problem getLastProblem(){ if (problemCache.isEmpty()) { return null; } diff --git a/branches/sca-equinox/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory b/branches/sca-equinox/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory new file mode 100644 index 0000000000..ae81aef136 --- /dev/null +++ b/branches/sca-equinox/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+org.apache.tuscany.sca.monitor.DefaultMonitorFactory
|