本文整理了Java中org.apache.tuscany.sca.monitor.Monitor.error()
方法的一些代码示例,展示了Monitor.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Monitor.error()
方法的具体详情如下:
包路径:org.apache.tuscany.sca.monitor.Monitor
类名称:Monitor
方法名:error
[英]A utility function for raising an error. It creates the problem and adds it to the monitor
[中]用于引发错误的实用函数。它会产生问题并将其添加到监视器中
代码示例来源:origin: org.apache.tuscany.sca/tuscany-contribution
/**
* Report a exception.
*
* @param problems
* @param message
* @param model
*/
private void error(Monitor monitor, String message, Object model, Throwable ex) {
Monitor.error(monitor, this, "contribution-validation-messages", message, ex);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* Report a error.
*
* @param monitor
* @param problems
* @param message
* @param model
*/
protected void error(Monitor monitor, String message, Object model, Object... messageParameters) {
Monitor.error(monitor, this, Messages.BUILDER_VALIDATION_BUNDLE, message, messageParameters);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* Report a exception.
*
* @param problems
* @param message
* @param model
*/
private void error(Monitor monitor, String message, Object model, Throwable ex) {
Monitor.error(monitor, this, "contribution-validation-messages", message, ex);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
/**
* Report a error.
*
* @param monitor
* @param problems
* @param message
* @param model
*/
protected void error(Monitor monitor, String message, Object model, Object... messageParameters) {
Monitor.error(monitor, this, Messages.BUILDER_VALIDATION_BUNDLE, message, messageParameters);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public void addModel(Object resolved, ProcessorContext context) {
Composite composite = (Composite)resolved;
Composite old = map.put(composite.getName(), composite);
if (old != null) {
Monitor.error(context.getMonitor(),
this,
Messages.RESOURCE_BUNDLE,
"DuplicateCompositeName",
composite.getName().toString(),
contribution.getLocation());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly-xml
public void addModel(Object resolved, ProcessorContext context) {
Composite composite = (Composite)resolved;
Composite old = map.put(composite.getName(), composite);
if (old != null) {
Monitor.error(context.getMonitor(),
this,
Messages.RESOURCE_BUNDLE,
"DuplicateCompositeName",
composite.getName().toString(),
contribution.getLocation());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
private boolean checkMutualExclusion(PolicySubject subject, BuilderContext context) {
if (subject == null) {
return false;
}
List<Intent> intents = subject.getRequiredIntents();
int size = intents.size();
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
Intent i1 = intents.get(i);
Intent i2 = intents.get(j);
if (i1 != i2 && i1.getExcludedIntents().contains(i2) || i2.getExcludedIntents().contains(i1)) {
Monitor.error(context.getMonitor(),
this,
Messages.ASSEMBLY_VALIDATION,
"MutuallyExclusiveIntents",
subject,
i1,
i2);
return true;
}
}
}
return false;
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
private boolean checkMutualExclusion(PolicySubject subject, BuilderContext context) {
if (subject == null) {
return false;
}
List<Intent> intents = subject.getRequiredIntents();
int size = intents.size();
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
Intent i1 = intents.get(i);
Intent i2 = intents.get(j);
if (i1 != i2 && i1.getExcludedIntents().contains(i2) || i2.getExcludedIntents().contains(i1)) {
Monitor.error(context.getMonitor(),
this,
Messages.ASSEMBLY_VALIDATION,
"MutuallyExclusiveIntents",
subject,
i1,
i2);
return true;
}
}
}
return false;
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly-xml
private void readRequiredIntents(Intent intent, XMLStreamReader reader, ProcessorContext context) {
String value = reader.getAttributeValue(null, REQUIRES);
if (value != null) {
List<Intent> requiredIntents = intent.getRequiredIntents();
for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
QName qname = getQNameValue(reader, tokens.nextToken());
Intent required = policyFactory.createIntent();
required.setName(qname);
required.setUnresolved(true);
requiredIntents.add(required);
}
// Check that a profile intent does not have "." in its name
if (requiredIntents.size() > 0) {
if (intent.getName().getLocalPart().contains(".")){
Monitor.error(context.getMonitor(),
this,
Messages.RESOURCE_BUNDLE,
"ProfileIntentNameWithPeriod",
intent.getName().toString());
}
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
private void readRequiredIntents(Intent intent, XMLStreamReader reader, ProcessorContext context) {
String value = reader.getAttributeValue(null, REQUIRES);
if (value != null) {
List<Intent> requiredIntents = intent.getRequiredIntents();
for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
QName qname = getQNameValue(reader, tokens.nextToken());
Intent required = policyFactory.createIntent();
required.setName(qname);
required.setUnresolved(true);
requiredIntents.add(required);
}
// Check that a profile intent does not have "." in its name
if (requiredIntents.size() > 0) {
if (intent.getName().getLocalPart().contains(".")){
Monitor.error(context.getMonitor(),
this,
Messages.RESOURCE_BUNDLE,
"ProfileIntentNameWithPeriod",
intent.getName().toString());
}
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public void stop(RuntimeEndpoint ep) {
ep.getCompositeContext().getEndpointRegistry().removeEndpoint(ep);
final ServiceBindingProvider bindingProvider = ep.getBindingProvider();
if (bindingProvider != null) {
try {
// Allow bindings to read properties. Requires PropertyPermission read in security policy.
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
bindingProvider.stop();
return null;
}
});
} catch (Throwable ex){
Monitor.error(monitor, this, "core-messages", "StopException", ex);
}
}
for (PolicyProvider policyProvider : ep.getPolicyProviders()) {
try {
policyProvider.stop();
} catch (Throwable ex){
Monitor.error(monitor, this, "core-messages", "StopException", ex);
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public void start(CompositeContext compositeContext, ScopedRuntimeComponent scopedRuntimeComponent) {
if (scopedRuntimeComponent.getScopeContainer() != null) {
try {
scopedRuntimeComponent.getScopeContainer().start();
} catch (Throwable ex){
Monitor.error(monitor, this, "core-messages", "StartException", ex);
rethrow(ex);
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
/**
* ASM50042 - Checks that if a component reference with multiplicity="1..1" is marked
* as nonOveridable then there are no composite references that promote it
*
* @param componentType
* @param compositeReference
* @param promotedComponentReference
* @param monitor
*/
private void validateNonOverridable(ComponentType componentType,
Reference compositeReference,
Reference promotedComponentReference,
Monitor monitor){
if ((promotedComponentReference.getMultiplicity() == Multiplicity.ONE_ONE) &&
(((ComponentReference)promotedComponentReference)).isNonOverridable() == true) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"CompositeReferencePromotesNonOverridableReference",
componentType.getURI(),
compositeReference.getName(),
promotedComponentReference.getName());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* ASM50042 - Checks that if a component reference with multiplicity="1..1" is marked
* as nonOveridable then there are no composite references that promote it
*
* @param componentType
* @param compositeReference
* @param promotedComponentReference
* @param monitor
*/
private void validateNonOverridable(ComponentType componentType,
Reference compositeReference,
Reference promotedComponentReference,
Monitor monitor){
if ((promotedComponentReference.getMultiplicity() == Multiplicity.ONE_ONE) &&
(((ComponentReference)promotedComponentReference)).isNonOverridable() == true) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"CompositeReferencePromotesNonOverridableReference",
componentType.getURI(),
compositeReference.getName(),
promotedComponentReference.getName());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
private void reconcileReferenceMultiplicity(ComponentType componentType,
Reference compositeReference,
Reference promotedComponentReference,
Monitor monitor) {
if (compositeReference.getMultiplicity() != null) {
if (!isValidMultiplicityOverride(promotedComponentReference.getTargets().size() > 0,
promotedComponentReference.getMultiplicity(),
compositeReference.getMultiplicity())) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"CompositeReferenceIncompatibleMultiplicity",
componentType.getURI(),
compositeReference.getName(),
promotedComponentReference.getName());
}
} else {
compositeReference.setMultiplicity(promotedComponentReference.getMultiplicity());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
private void reconcileReferenceMultiplicity(ComponentType componentType,
Reference compositeReference,
Reference promotedComponentReference,
Monitor monitor) {
if (compositeReference.getMultiplicity() != null) {
if (!isValidMultiplicityOverride(promotedComponentReference.getTargets().size() > 0,
promotedComponentReference.getMultiplicity(),
compositeReference.getMultiplicity())) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"CompositeReferenceIncompatibleMultiplicity",
componentType.getURI(),
compositeReference.getName(),
promotedComponentReference.getName());
}
} else {
compositeReference.setMultiplicity(promotedComponentReference.getMultiplicity());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
private void reconcileReferenceMultiplicity(Component component,
Reference componentReference,
Reference componentTypeReference,
Monitor monitor) {
if (componentReference.getMultiplicity() != null) {
if (!isValidMultiplicityOverride(componentTypeReference.getMultiplicity(), componentReference
.getMultiplicity())) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"ReferenceIncompatibleMultiplicity",
component.getName(),
componentReference.getName());
}
} else {
componentReference.setMultiplicity(componentTypeReference.getMultiplicity());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
private void reconcileReferenceMultiplicity(Component component,
Reference componentReference,
Reference componentTypeReference,
Monitor monitor) {
if (componentReference.getMultiplicity() != null) {
if (!isValidMultiplicityOverride(componentTypeReference.getMultiplicity(), componentReference
.getMultiplicity())) {
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"ReferenceIncompatibleMultiplicity",
component.getName(),
componentReference.getName());
}
} else {
componentReference.setMultiplicity(componentTypeReference.getMultiplicity());
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
private void addServicesFromComponentType(Component component, Monitor monitor) {
// Create a component service for each service
if (component.getImplementation() != null) {
for (Service service : component.getImplementation().getServices()) {
// check for duplicate service names in implementation
if (service != component.getImplementation().getService(service.getName())){
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"DuplicateImplementationServiceName",
component.getName(),
service.getName());
}
ComponentService componentService = (ComponentService)component.getService(service.getName());
// if the component doesn't have a service with the same name as the
// component type service then create one
if (componentService == null) {
componentService = assemblyFactory.createComponentService();
componentService.setForCallback(service.isForCallback());
String name = service.getName();
componentService.setName(name);
component.getServices().add(componentService);
}
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-builder
private void addReferencesFromComponentType(Component component, Monitor monitor) {
// Create a component reference for each reference
if (component.getImplementation() != null) {
for (Reference reference : component.getImplementation().getReferences()) {
// check for duplicate reference names in implementation
if (reference != component.getImplementation().getReference(reference.getName())){
Monitor.error(monitor,
this,
Messages.ASSEMBLY_VALIDATION,
"DuplicateImplementationReferenceName",
component.getName(),
reference.getName());
}
ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName());
// if the component doesn't have a reference with the same name as the
// component type reference then create one
if (componentReference == null) {
componentReference = assemblyFactory.createComponentReference();
componentReference.setForCallback(reference.isForCallback());
componentReference.setName(reference.getName());
componentReference.setReference(reference);
component.getReferences().add(componentReference);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!