Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0912c9d05b4886b764a48fb0ed443a2328f5dffd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*******************************************************************************
 * Copyright (c) 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 * yyyymmdd bug      Email and other contact information
 * -------- -------- -----------------------------------------------------------
 * 20060419   132905 cbrealey@ca.ibm.com - Chris Brealey          
 *******************************************************************************/
package org.eclipse.jst.ws.internal.conformance;

import java.util.Stack;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;

/**
 * @author cbrealey
 * A Java Web service conformance Rule tests some collection
 * of Java resources that implement, or are meant to implement,
 * a Web service against a single, concise requirement as is
 * typically defined by a specification (eg. JAX-RPC, JSR 109)
 * or a runtime (eg. Apache Axis).
 * <p>
 * Every rule must have a namespace and a unique ID under that
 * that namespace. Every rule may have a short name and a long
 * description, both of which are recommended but optional.
 * <p>
 * Every rule follows a lifecycle of initialization, analysis
 * and completion. A Java Web service rule engine will drive
 * the <code>init()</code> method to initialize the rule, then
 * drive the various <code>visit...()</code> methods as it
 * navigates some collection of JDT resources, then drive the
 * <code>getResults()</code> method to indicate analysis is done
 * and retrieve a status object with the results of the analysis.
 */
public interface IJavaWebServiceRule
{
	/**
	 * Returns the unique identifier of the rule
	 * within the namespace to which the rule belongs.
	 * @return The unique identifier of the rule.
	 * Valid rule identifiers must not be negative.
	 */
	public int getId ();
	
	/**
	 * Returns the namespace to which this rule belongs.
	 * @return The namespace to which this rule belongs.
	 * Never returns null.
	 */
	public String getNamespace ();

	/**
	 * Returns the translatable short name of this rule.  
	 * @return The translatable short name of this rule,
	 * or null if the rule has no name.
	 */
	public String getName ();

	/**
	 * Returns the translatable description of this rule.
	 * @return The translatable description of this rule,
	 * or null if the rule has no description.
	 */
	public String getDescription ();

	/**
	 * Called by the rule engine to give this rule a chance
	 * to initialize itself prior to visiting JDT objects.
	 * @param engine The engine initializing this rule.
	 */
	public void init ( IJavaWebServiceRuleEngine engine );

	/**
	 * Called by the rule engine when it decides to visit
	 * a Java class (ie. primitive types are excluded).
	 * @param jdtClass The class to visit.
	 * @param peanutTrail The trail of objects back to the root.
	 */
	public void visitClass ( IType jdtClass, Stack peanutTrail );

	/**
	 * Called by the rule engine when it decides to visit
	 * a Java class found on the throws clause of a method.
	 * @param jdtClass The exception class to visit.
	 * @param peanutTrail The trail of objects back to the root.
	 */
	public void visitException ( IType jdtClass, Stack peanutTrail );

	/**
	 * Called by the rule engine when it decides to visit
	 * a field belonging to a class.
	 * @param jdtField The field to visit.
	 * @param peanutTrail The trail of objects back to the root.
	 */
	public void visitField ( IField jdtField, Stack peanutTrail );

	/**
	 * Called by the rule engine when it decides to visit
	 * a Java Bean property (ie. represented by a "get" and/or
	 * "set" method) beloning to a class.
	 * @param beanProperty The property to visit.
	 * @param peanutTrail The trail of objects back to the root.
	 */
	public void visitProperty ( IJavaBeanProperty beanProperty, Stack peanutTrail );

	/**
	 * Called by the rule engine when it decides to visit a method.
	 * @param jdtMethod The method to visit.
	 * @param peanutTrail The trail of objects back to the root.
	 */
	public void visitMethod ( IMethod jdtMethod, Stack peanutTrail );

	/**
	 * Called by the rule engine after all JDT objects have
	 * been visited so that the rule can return a status
	 * object (usually a multi-status) with a summary of
	 * any violations by JDT objects detected by this rule.
	 * @return The results of the rule's analysis.
	 */
	public IStatus getResults ();
}

Back to the top