You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/06/13 08:29:18 UTC
svn commit: r667376 [3/3] - in /incubator/tuscany/java/sca:
itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/
itest/recursive-ws/src/test/java/policy/
itest/validation/src/test/java/calculator/warn...
Modified: incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java Thu Jun 12 23:29:16 2008
@@ -51,8 +51,7 @@
*/
public class WidgetImplementationProcessor implements StAXArtifactProcessor<WidgetImplementation> {
private static final QName IMPLEMENTATION_WIDGET = new QName(Constants.SCA10_TUSCANY_NS, "implementation.widget");
- private static final String MSG_LOCATION_MISSING = "Reading implementation.widget - location attribute missing";
-
+
private AssemblyFactory assemblyFactory;
private ContributionFactory contributionFactory;
private WidgetImplementationFactory implementationFactory;
@@ -112,14 +111,13 @@
// Read the location attribute specifying the location of the resources
String location = reader.getAttributeValue(null, "location");
-
if (location != null) {
implementation = implementationFactory.createWidgetImplementation();
implementation.setLocation(location);
implementation.setUnresolved(true);
} else {
error("LocationAttributeMissing", reader);
- throw new ContributionReadException(MSG_LOCATION_MISSING);
+ //throw new ContributionReadException(MSG_LOCATION_MISSING);
}
// Skip to end element
@@ -134,28 +132,31 @@
public void resolve(WidgetImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
- // Resolve the resource directory location
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(implementation.getLocation());
- Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
- if (resolved.getLocation() != null) {
- try {
- implementation.setLocationURL(new URL(resolved.getLocation()));
- implementation.setUnresolved(false);
-
- //introspect implementation
- WidgetImplementationIntrospector widgetIntrospector = new WidgetImplementationIntrospector(assemblyFactory, implementation);
- widgetIntrospector.introspectImplementation();
-
- } catch (IOException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
+ if (implementation != null) {
+ // Resolve the resource directory location
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(implementation.getLocation());
+ Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
+ if (resolved.getLocation() != null) {
+ try {
+ implementation.setLocationURL(new URL(resolved.getLocation()));
+
+ //introspect implementation
+ WidgetImplementationIntrospector widgetIntrospector =
+ new WidgetImplementationIntrospector(assemblyFactory, implementation);
+ widgetIntrospector.introspectImplementation();
+
+ implementation.setUnresolved(false);
+ } catch (IOException e) {
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error("ContributionResolveException", resolver, ce);
+ //throw ce;
+ }
+ } else {
+ error("CouldNotResolveLocation", resolver, implementation.getLocation());
+ //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
}
- } else {
- error("CouldNotResolveLocation", resolver, implementation.getLocation());
- throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
- }
+ }
}
public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
Modified: incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java Thu Jun 12 23:29:16 2008
@@ -53,8 +53,7 @@
private static final String IMPLEMENTATION_XQUERY = "implementation.xquery";
private static final QName IMPLEMENTATION_XQUERY_QNAME =
new QName(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
- private static final String MSG_LOCATION_MISSING = "Reading implementation.xquery - location attribute missing";
-
+
private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
private ContributionFactory contributionFactory;
@@ -90,17 +89,20 @@
*/
public XQueryImplementation read(XMLStreamReader reader)
throws ContributionReadException, XMLStreamException {
+
+ /* Create the XQuery implementation and set the location into it */
+ XQueryImplementation xqueryImplementation = null;
/* Read the location attribute for the XQuery implementation */
String xqueryLocation = reader.getAttributeValue(null, LOCATION);
- if (xqueryLocation == null) {
+ if (xqueryLocation != null) {
+ xqueryImplementation = XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
+ xqueryImplementation.setLocation(xqueryLocation);
+ xqueryImplementation.setUnresolved(true);
+ } else {
error("LocationAttributeMissing", reader);
- throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
- /* Create the XQuery implementation and set the location into it */
- XQueryImplementation xqueryImplementation =
- XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
- xqueryImplementation.setLocation(xqueryLocation);
+ //throw new ContributionReadException(MSG_LOCATION_MISSING);
+ }
// Skip to end element
while (reader.hasNext()) {
@@ -109,8 +111,6 @@
}
} // end while
- xqueryImplementation.setUnresolved(true);
-
return xqueryImplementation;
}
@@ -135,23 +135,25 @@
*/
public void resolve(XQueryImplementation xqueryImplementation, ModelResolver resolver)
throws ContributionResolveException {
-
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(xqueryImplementation.getLocation());
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() == null) {
- error("CouldNotLocateFile", resolver, xqueryImplementation.getLocation());
- throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
- }
- xqueryImplementation.setLocationURL(artifact.getLocation());
-
- XQueryIntrospector introspector = new XQueryIntrospector(assemblyFactory, javaFactory);
-
- boolean success = introspector.introspect(xqueryImplementation, resolver);
-
- if (success) {
- xqueryImplementation.setUnresolved(false);
- }
+
+ if (xqueryImplementation != null) {
+ Artifact artifact = contributionFactory.createArtifact();
+ artifact.setURI(xqueryImplementation.getLocation());
+ artifact = resolver.resolveModel(Artifact.class, artifact);
+ if (artifact.getLocation() != null) {
+ xqueryImplementation.setLocationURL(artifact.getLocation());
+
+ XQueryIntrospector introspector = new XQueryIntrospector(assemblyFactory, javaFactory);
+
+ boolean success = introspector.introspect(xqueryImplementation, resolver);
+ if (success) {
+ xqueryImplementation.setUnresolved(false);
+ }
+ } else {
+ error("CouldNotLocateFile", resolver, xqueryImplementation.getLocation());
+ //throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
+ }
+ }
}
}
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Thu Jun 12 23:29:16 2008
@@ -149,10 +149,11 @@
Class javaClass = classReference.getJavaClass();
if (javaClass == null) {
error("ClassNotFoundException", resolver, javaInterface.getName());
- throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
+ return javaInterface;
+ //throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
}
- try {
-
+
+ try {
// Introspect the Java interface and populate the interface and
// operations
javaFactory.createJavaInterface(javaInterface, javaClass);
@@ -160,7 +161,8 @@
} catch (InvalidInterfaceException e) {
ContributionResolveException ce = new ContributionResolveException(e);
error("ContributionResolveException", javaFactory, ce);
- throw ce;
+ return javaInterface;
+ //throw ce;
}
// Cache the resolved interface
Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java Thu Jun 12 23:29:16 2008
@@ -92,11 +92,14 @@
} catch (Exception e) {
ContributionReadException ce = new ContributionReadException(e);
error("ContributionReadException", artifactURL, ce);
- throw ce;
+ //throw ce;
+ return null;
}
}
public void resolve(WSDLDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ if (model == null) return;
+
Definition definition = model.getDefinition();
if (definition != null) {
for (Object imports : definition.getImports().values()) {
@@ -133,7 +136,7 @@
} catch (Exception e) {
ContributionResolveException ce = new ContributionResolveException(e);
error("ContributionResolveException", resolver, ce);
- throw ce;
+ //throw ce;
}
} else {
if (location.startsWith("/")) {
@@ -154,7 +157,7 @@
} catch (Exception e) {
ContributionResolveException ce = new ContributionResolveException(e);
error("ContributionResolveException", resolver, ce);
- throw ce;
+ //throw ce;
}
}
}
Modified: incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java Thu Jun 12 23:29:16 2008
@@ -69,7 +69,7 @@
private void warning(String message, Object model, Object... messageParameters) {
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
+ monitor.problem(problem);
}
}
@@ -83,7 +83,7 @@
private void error(String message, Object model, Object... messageParameters) {
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
+ monitor.problem(problem);
}
}
@@ -97,7 +97,7 @@
private void error(String message, Object model, Exception ex) {
if (monitor != null) {
Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
+ monitor.problem(problem);
}
}
@@ -108,20 +108,23 @@
* @throws ContributionReadException
*/
private WSDLInterface createWSDLInterface(String uri) throws ContributionReadException {
- WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
- wsdlInterface.setUnresolved(true);
+
+ WSDLInterface wsdlInterface = null;
// Read a QName in the form:
// namespace#wsdl.interface(name)
int index = uri.indexOf('#');
if (index == -1) {
error("InvalidWSDLInterfaceAttr", wsdlFactory, uri);
- throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
- }
- String namespace = uri.substring(0, index);
- String name = uri.substring(index + 1);
- name = name.substring("wsdl.interface(".length(), name.length() - 1);
- wsdlInterface.setName(new QName(namespace, name));
+ //throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
+ } else {
+ wsdlInterface = wsdlFactory.createWSDLInterface();
+ wsdlInterface.setUnresolved(true);
+ String namespace = uri.substring(0, index);
+ String name = uri.substring(index + 1);
+ name = name.substring("wsdl.interface(".length(), name.length() - 1);
+ wsdlInterface.setName(new QName(namespace, name));
+ }
return wsdlInterface;
}
@@ -137,13 +140,15 @@
String uri = reader.getAttributeValue(null, INTERFACE);
if (uri != null) {
WSDLInterface wsdlInterface = createWSDLInterface(uri);
- wsdlInterfaceContract.setInterface(wsdlInterface);
+ if (wsdlInterface != null)
+ wsdlInterfaceContract.setInterface(wsdlInterface);
}
uri = reader.getAttributeValue(null, CALLBACK_INTERFACE);
if (uri != null) {
WSDLInterface wsdlCallbackInterface = createWSDLInterface(uri);
- wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
+ if (wsdlCallbackInterface != null)
+ wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
}
// Skip to end element
@@ -210,12 +215,12 @@
wsdlDefinition.setDefinition(portType.getDefinition());
wsdlInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver);
wsdlInterface.setWsdlDefinition(wsdlDefinition);
+ resolver.addModel(wsdlInterface);
} catch (InvalidInterfaceException e) {
ContributionResolveException ce = new ContributionResolveException(e);
error("ContributionResolveException", wsdlFactory, ce);
- throw ce;
- }
- resolver.addModel(wsdlInterface);
+ //throw ce;
+ }
}
else {
warning("WsdlInterfaceDoesNotMatch", wsdlDefinition, wsdlInterface.getName());
Modified: incubator/tuscany/java/sca/modules/monitor-logging/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultLoggingMonitorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/monitor-logging/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultLoggingMonitorImpl.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/monitor-logging/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultLoggingMonitorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/monitor-logging/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultLoggingMonitorImpl.java Thu Jun 12 23:29:16 2008
@@ -19,6 +19,10 @@
package org.apache.tuscany.sca.monitor.impl;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -35,18 +39,11 @@
public class DefaultLoggingMonitorImpl implements Monitor {
private static final Logger logger = Logger.getLogger(DefaultLoggingMonitorImpl.class.getName());
- // remembers the last logged problem for testing purposes
- private Problem lastProblem = null;
+ // Cache all the problem reported to monitor for further analysis
+ private List<Problem> problemCache = new ArrayList<Problem>();
- /**
- * Reports a build problem.
- *
- * @param problem
- */
public void problem(Problem problem) {
- lastProblem = problem;
-
Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
if (problemLogger == null){
@@ -54,19 +51,53 @@
}
if (problem.getSeverity() == Severity.INFO) {
- problemLogger.log(Level.INFO, problem.getMessageId(), problem.getMessageParams());
- } else if (problem.getSeverity() == Severity.WARNING) {
- problemLogger.log(Level.WARNING, problem.getMessageId(), problem.getMessageParams());
- } else if (problem.getSeverity() == Severity.ERROR) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.INFO, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.WARNING) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.ERROR) {
if (problem.getCause() != null) {
- problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getCause());
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(),
+ null, problem.getMessageId(), problem.getCause());
} else {
- problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getMessageParams());
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
}
}
}
+ public List<Problem> getProblems(){
+ return problemCache;
+ }
+
public Problem getLastLoggedProblem(){
- return lastProblem;
+ return problemCache.get(problemCache.size() - 1);
+ }
+
+ public boolean isMessageLogged(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Problem getProblem(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return problem;
+ }
+ }
+
+ return null;
}
}
Modified: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java (original)
+++ incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java Thu Jun 12 23:29:16 2008
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.monitor;
+import java.util.List;
+
/**
* A monitor for the watching for validation problems
*
@@ -32,4 +34,11 @@
*/
void problem(Problem problem);
+ /**
+ * Returns a list of reported problems.
+ *
+ * @return the list of problems. The list may be empty
+ */
+ List<Problem> getProblems();
+
}
Modified: incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java Thu Jun 12 23:29:16 2008
@@ -19,6 +19,10 @@
package org.apache.tuscany.sca.monitor.impl;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -32,19 +36,12 @@
*/
public class DefaultMonitorImpl implements Monitor {
private static final Logger logger = Logger.getLogger(DefaultMonitorImpl.class.getName());
+
+ // Cache all the problem reported to monitor for further analysis
+ private List<Problem> problemCache = new ArrayList<Problem>();
- // remembers the last logged problem for testing purposes
- private Problem lastProblem = null;
-
- /**
- * Reports a build problem.
- *
- * @param problem
- */
public void problem(Problem problem) {
- lastProblem = problem;
-
Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
if (problemLogger == null){
@@ -52,19 +49,53 @@
}
if (problem.getSeverity() == Severity.INFO) {
- problemLogger.log(Level.INFO, problem.getMessageId(), problem.getMessageParams());
- } else if (problem.getSeverity() == Severity.WARNING) {
- problemLogger.log(Level.WARNING, problem.getMessageId(), problem.getMessageParams());
- } else if (problem.getSeverity() == Severity.ERROR) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.INFO, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.WARNING) {
+ problemCache.add(problem);
+ problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
+ }
+ else if (problem.getSeverity() == Severity.ERROR) {
if (problem.getCause() != null) {
- problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getCause());
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(),
+ null, problem.getMessageId(), problem.getCause());
} else {
- problemLogger.log(Level.SEVERE, problem.getMessageId(), problem.getMessageParams());
+ problemCache.add(problem);
+ problemLogger.logp(Level.SEVERE, problem.getSourceClassName(), null,
+ problem.getMessageId(), problem.getMessageParams());
}
}
}
+ public List<Problem> getProblems(){
+ return problemCache;
+ }
+
public Problem getLastLoggedProblem(){
- return lastProblem;
+ return problemCache.get(problemCache.size() - 1);
+ }
+
+ public boolean isMessageLogged(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Problem getProblem(String messageId) {
+ for (Problem problem : problemCache){
+ if (problem.getMessageId().equals(messageId)){
+ return problem;
+ }
+ }
+
+ return null;
}
}
Modified: incubator/tuscany/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java Thu Jun 12 23:29:16 2008
@@ -49,11 +49,16 @@
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.contribution.service.ContributionService;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.core.assembly.ActivationException;
import org.apache.tuscany.sca.core.assembly.CompositeActivator;
import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
+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.node.SCAClient;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
@@ -81,6 +86,7 @@
private XMLInputFactory inputFactory;
private ModelFactoryExtensionPoint modelFactories;
private StAXArtifactProcessorExtensionPoint artifactProcessors;
+ private Monitor monitor;
// The composite loaded into this node
private Composite composite;
@@ -268,6 +274,11 @@
// Save the composite activator
compositeActivator = runtime.getCompositeActivator();
+
+ // save the monitor
+ UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
}
private void configureNode(ConfiguredNodeImplementation configuration) throws Exception {
@@ -302,6 +313,7 @@
// Load the contribution
logger.log(Level.INFO, "Loading contribution: " + contributionURL);
contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
+ analyseProblems();
}
// Load the specified composite
@@ -320,9 +332,13 @@
composite = configuration.getComposite();
}
+ analyseProblems();
+
// Resolve it within the context of the first contribution
Contribution mainContribution = contributions.get(contributions.size()-1);
compositeProcessor.resolve(composite, mainContribution.getModelResolver());
+
+ analyseProblems();
// Create a top level composite to host our composite
// This is temporary to make the activator happy
@@ -341,6 +357,22 @@
// Build the composite
runtime.buildComposite(composite);
+
+ analyseProblems();
+ }
+
+ private void analyseProblems() throws Exception {
+
+ for (Problem problem : monitor.getProblems()){
+ if ((problem.getSeverity() == Severity.ERROR) &&
+ (!problem.getMessageId().equals("SchemaError"))){
+ if (problem.getCause() != null){
+ throw problem.getCause();
+ } else {
+ throw new ServiceRuntimeException(problem.toString());
+ }
+ }
+ }
}
public void start() {
Modified: incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java Thu Jun 12 23:29:16 2008
@@ -82,11 +82,12 @@
String roleNames = reader.getAttributeValue(null, ROLES);
if (roleNames == null) {
error("RequiredAttributeRolesMissing", reader);
- throw new IllegalArgumentException("Required attribute 'roles' is missing.");
- }
- StringTokenizer st = new StringTokenizer(roleNames);
- while (st.hasMoreTokens()) {
- policy.getRoleNames().add(st.nextToken());
+ //throw new IllegalArgumentException("Required attribute 'roles' is missing.");
+ } else {
+ StringTokenizer st = new StringTokenizer(roleNames);
+ while (st.hasMoreTokens()) {
+ policy.getRoleNames().add(st.nextToken());
+ }
}
} else if ("permitAll".equals(ac)) {
policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
@@ -137,6 +138,13 @@
}
public void resolve(AuthorizationPolicy policy, ModelResolver resolver) throws ContributionResolveException {
+
+ if ((policy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) &&
+ (policy.getRoleNames().isEmpty())){
+ // role names are required so leave policy unresolved
+ return;
+ }
+
//right now nothing to resolve
policy.setUnresolved(false);
}
Modified: incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java Thu Jun 12 23:29:16 2008
@@ -79,9 +79,10 @@
String roleName = reader.getAttributeValue(null, ROLE);
if (roleName == null) {
error("RequiredAttributeRolesMissing", reader);
- throw new IllegalArgumentException("Required attribute 'roles' is missing.");
+ //throw new IllegalArgumentException("Required attribute 'roles' is missing.");
+ } else {
+ policy.setRunAsRole(roleName);
}
- policy.setRunAsRole(roleName);
} else if ("useCallerIdentity".equals(ac)) {
policy.setUseCallerIdentity(true);
}
@@ -123,8 +124,10 @@
}
public void resolve(SecurityIdentityPolicy policy, ModelResolver resolver) throws ContributionResolveException {
- //right now nothing to resolve
- policy.setUnresolved(false);
+
+ if (policy.getRunAsRole() != null)
+ //right now nothing to resolve
+ policy.setUnresolved(false);
}
}
Modified: incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java Thu Jun 12 23:29:16 2008
@@ -140,9 +140,11 @@
Class callbackClass = classReference.getJavaClass();
if (callbackClass == null) {
error("ClassNotFoundException", resolver, policy.getCallbackHandlerClassName());
- throw new ContributionResolveException(new ClassNotFoundException(policy.getCallbackHandlerClassName()));
- }
- policy.setCallbackHandlerClass(callbackClass);
+ //throw new ContributionResolveException(new ClassNotFoundException(policy.getCallbackHandlerClassName()));
+ } else {
+ policy.setCallbackHandlerClass(callbackClass);
+ policy.setUnresolved(false);
+ }
}
}
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java Thu Jun 12 23:29:16 2008
@@ -104,13 +104,14 @@
return implType;
} else {
error("UnrecognizedIntentAttachPointType", reader, type);
- throw new ContributionReadException("Unrecognized IntentAttachPointType - " + type);
+ //throw new ContributionReadException("Unrecognized IntentAttachPointType - " + type);
}
} else {
error("RequiredAttributeMissing", reader, TYPE);
- throw new ContributionReadException("Required attribute '" + TYPE +
- "' missing from BindingType Definition");
- }
+ //throw new ContributionReadException("Required attribute '" + TYPE +
+ //"' missing from BindingType Definition");
+ }
+ return null;
}
private void readAlwaysProvidedIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
@@ -182,10 +183,13 @@
}
public void resolve(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
- resolveAlwaysProvidedIntents(extnType, resolver);
- resolveMayProvideIntents(extnType, resolver);
- extnType.setUnresolved(false);
- //resolveExtensionType(extnType, resolver);
+
+ if (extnType != null && extnType.isUnresolved()) {
+ resolveAlwaysProvidedIntents(extnType, resolver);
+ resolveMayProvideIntents(extnType, resolver);
+ extnType.setUnresolved(false);
+ //resolveExtensionType(extnType, resolver);
+ }
}
private void resolveAlwaysProvidedIntents(IntentAttachPointType extensionType,
@@ -200,9 +204,9 @@
alwaysProvided.add(providedIntent);
} else {
error("AlwaysProvidedIntentNotFound", resolver, providedIntent, extensionType);
- throw new ContributionResolveException("Always Provided Intent - " + providedIntent
- + " not found for ExtensionType "
- + extensionType);
+ //throw new ContributionResolveException("Always Provided Intent - " + providedIntent
+ //+ " not found for ExtensionType "
+ //+ extensionType);
}
} else {
alwaysProvided.add(providedIntent);
@@ -225,9 +229,9 @@
mayProvide.add(providedIntent);
} else {
error("MayProvideIntentNotFound", resolver, providedIntent, extensionType);
- throw new ContributionResolveException("May Provide Intent - " + providedIntent
- + " not found for ExtensionType "
- + extensionType);
+ //throw new ContributionResolveException("May Provide Intent - " + providedIntent
+ //+ " not found for ExtensionType "
+ //+ extensionType);
}
} else {
mayProvide.add(providedIntent);
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java Thu Jun 12 23:29:16 2008
@@ -176,8 +176,8 @@
writer.writeAttribute(CONSTRAINS, sb.toString());
} else {
error("ContrainsAttributeMissing", policyIntent, policyIntent.getName());
- throw new ContributionWriteException("Contrains attribute missing from " +
- "Policy Intent Definition" + policyIntent.getName());
+ //throw new ContributionWriteException("Contrains attribute missing from " +
+ //"Policy Intent Definition" + policyIntent.getName());
}
}
@@ -251,9 +251,8 @@
requiredIntents.add(resolvedRequiredIntent);
} else {
error("RequiredIntentNotFound", resolver, requiredIntent, policyIntent);
- throw new ContributionResolveException("Required Intent - " + requiredIntent
- + " not found for ProfileIntent "
- + policyIntent);
+ //throw new ContributionResolveException("Required Intent - " + requiredIntent
+ //+ " not found for ProfileIntent " + policyIntent);
}
} else {
requiredIntents.add(requiredIntent);
@@ -276,9 +275,8 @@
policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
} else {
error("QualifiableIntentNotFound", resolver, qualifiableIntent, policyIntent);
- throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
- + " not found for QualifiedIntent "
- + policyIntent);
+ //throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
+ //+ " not found for QualifiedIntent " + policyIntent);
}
}
@@ -314,9 +312,8 @@
String value = reader.getAttributeValue(null, CONSTRAINS);
if ( policyIntent instanceof QualifiedIntent && value != null) {
error("ErrorInPolicyIntentDefinition", policyIntent, policyIntent.getName(), QUALIFIED_INTENT_CONSTRAINS_ERROR);
- String errorMsg =
- "Error in PolicyIntent Definition - " + policyIntent.getName() + QUALIFIED_INTENT_CONSTRAINS_ERROR;
- throw new ContributionReadException(errorMsg);
+ //String errorMsg = "Error in PolicyIntent Definition - " + policyIntent.getName() + QUALIFIED_INTENT_CONSTRAINS_ERROR;
+ //throw new ContributionReadException(errorMsg);
} else {
if (value != null) {
List<QName> constrainedArtifacts = policyIntent.getConstrains();
@@ -368,10 +365,8 @@
excludedIntents.add(resolvedExcludedIntent);
} else {
error("ExcludedIntentNotFound", resolver, excludedIntent, policyIntent);
- throw new ContributionResolveException(
- "Excluded Intent " + excludedIntent
- + " not found for intent " + policyIntent);
-
+ //throw new ContributionResolveException("Excluded Intent " + excludedIntent
+ //+ " not found for intent " + policyIntent);
}
} else {
excludedIntents.add(excludedIntent);
Modified: incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java Thu Jun 12 23:29:16 2008
@@ -143,7 +143,7 @@
} catch (XPathExpressionException e) {
ContributionReadException ce = new ContributionReadException(e);
error("ContributionReadException", policySet, ce);
- throw ce;
+ //throw ce;
}
readProvidedIntents(policySet, reader);
@@ -163,7 +163,7 @@
readIntentMap(reader, policySet, mappedIntent);
} else {
error("IntentNotSpecified", policySet, policySetName);
- throw new ContributionReadException("Intent Map provides for Intent not specified as provided by parent PolicySet - " + policySetName);
+ //throw new ContributionReadException("Intent Map provides for Intent not specified as provided by parent PolicySet - " + policySetName);
}
} else if ( POLICY_SET_REFERENCE_QNAME.equals(name) ) {
PolicySet referredPolicySet = policyFactory.createPolicySet();
@@ -230,9 +230,9 @@
readIntentMap(reader, policySet, qualifiedIntent);
} else {
error("IntentMapDoesNotMatch", providedIntent, providedIntent, qualifierName, policySet);
- throw new ContributionReadException("Intent provided by IntentMap " +
- providedIntent + " does not match parent qualifier " + qualifierName +
- " in policyset - " + policySet);
+ //throw new ContributionReadException("Intent provided by IntentMap " +
+ //providedIntent + " does not match parent qualifier " + qualifierName +
+ //" in policyset - " + policySet);
}
}/* else if ( WS_POLICY_QNAME.equals(name) ) {
OMElement policyElement = loadElement(reader);
@@ -278,8 +278,8 @@
mappedPolicies.put(mappedIntent, policyList);
} else {
error("UnableToMapPolicies", mappedPolicies, mappedIntent, policySet);
- throw new ContributionReadException("Unable to map policies for default qualifier in IntentMap for - " +
- mappedIntent + " in policy set - " + policySet);
+ //throw new ContributionReadException("Unable to map policies for default qualifier in IntentMap for - " +
+ //mappedIntent + " in policy set - " + policySet);
}
defaultQualifier = null;
}
@@ -375,9 +375,8 @@
providedIntents.add(resolvedProvidedIntent);
} else {
error("ProvidedIntentNotFound", policySet, providedIntent, policySet);
- throw new ContributionResolveException("Provided Intent - " + providedIntent
- + " not found for PolicySet "
- + policySet);
+ //throw new ContributionResolveException("Provided Intent - " + providedIntent
+ //+ " not found for PolicySet " + policySet);
}
} else {
@@ -400,10 +399,8 @@
mappedPolicies.put(resolvedMappedIntent, entry.getValue());
} else {
error("MappedIntentNotFound", policySet, mappedIntent, policySet);
- throw new ContributionResolveException("Mapped Intent - " + mappedIntent
- + " not found for PolicySet "
- + policySet);
-
+ //throw new ContributionResolveException("Mapped Intent - " + mappedIntent
+ //+ " not found for PolicySet " + policySet);
}
} else {
mappedPolicies.put(mappedIntent, entry.getValue());
@@ -424,9 +421,8 @@
referredPolicySets.add(resolvedReferredPolicySet);
} else {
error("ReferredPolicySetNotFound", policySet, referredPolicySet, policySet);
- throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
- + "not found for PolicySet - "
- + policySet);
+ //throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
+ //+ "not found for PolicySet - " + policySet);
}
} else {
referredPolicySets.add(referredPolicySet);
Modified: incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/EndpointResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/EndpointResolverImpl.java?rev=667376&r1=667375&r2=667376&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/EndpointResolverImpl.java (original)
+++ incubator/tuscany/java/sca/modules/runtime-tomcat/src/main/java/org/apache/tuscany/sca/runtime/tomcat/EndpointResolverImpl.java Thu Jun 12 23:29:16 2008
@@ -103,7 +103,12 @@
DefaultEndpointBuilder ebi = new DefaultEndpointBuilder(new Monitor() {
public void problem(Problem problem) {
logger.warning(problem.toString());
- }});
+ }
+
+ public List<Problem> getProblems() {
+ return null;
+ }
+ });
ebi.build(endpoint);
}