signature:
public class Bindings { /** * Returns an < code > Enumeration < / code > over this bindings
 * < code > Binding < / code > s .
 * @ return an < code > Enumeration < / code > of < code > Bindings . Binding < / code > s
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public Enumeration getBindings ( ) throws MalformedElementException { } }

implementation:
final Node firstHref = getFirstChild ( root , "href" ) ; // $ NON - NLS - 1 $
Node segment = null ; if ( firstHref != null ) segment = getNextSibling ( ( Element ) firstHref , "segment" ) ; // $ NON - NLS - 1 $
final Node firstSegment = segment ; Enumeration e = new Enumeration ( ) { Node fCurrentHref = firstHref ; Node fCurrentSegment = firstSegment ; public boolean hasMoreElements ( ) { return fCurrentHref != null && fCurrentSegment != null ; } public Object nextElement ( ) { if ( ! hasMoreElements ( ) ) throw new NoSuchElementException ( ) ; String nextHref = getFirstText ( ( Element ) fCurrentHref ) ; String nextSegment = getFirstText ( ( Element ) fCurrentSegment ) ; Binding nextBinding = new Binding ( decodeHref ( nextHref ) , nextSegment ) ; fCurrentHref = getNextSibling ( ( Element ) fCurrentSegment , "href" ) ; // $ NON - NLS - 1 $
fCurrentSegment = null ; if ( fCurrentHref != null ) fCurrentSegment = getNextSibling ( ( Element ) fCurrentHref , "segment" ) ; // $ NON - NLS - 1 $
return nextBinding ; } } ; return e ;


signature:
public class ElementHelper { /** * Answer a DOM < code > Element < / code > that represents a set of < code > String < / code > .
 * The set is represented by a single < code > Element < / code > whose name is
 * given as the < code > setName < / code > argument . Each member of the set is
 * a child < code > Element < / code > named < code > memberName < / code > that has
 * text taken from the < code > memberEnum < / code > an < code > Enumeration < / code >
 * of < code > String < / code > . */
public Element newDAVElementSet ( QualifiedName setName , QualifiedName memberName , Enumeration memberEnum ) { } }

implementation: Element setElement = newDAVElement ( setName ) ; while ( memberEnum . hasMoreElements ( ) ) { String member = ( String ) memberEnum . nextElement ( ) ; Element memberElement = newDAVTextElement ( memberName , member ) ; setElement . appendChild ( memberElement ) ; } return setElement ;


signature:
public class DiagramEditPart { /** * / * ( non - Javadoc )
 * @ see org . eclipse . gef . editparts . AbstractGraphicalEditPart # createFigure ( ) */
protected IFigure createFigure ( ) { } }

implementation: Figure f = new FreeformLayer ( ) ; f . setBorder ( new MarginBorder ( 3 ) ) ; f . setLayoutManager ( new FreeformLayout ( ) ) ; return f ;


signature:
public class DiagramEditPart { /** * / * ( non - Javadoc )
 * @ see java . beans . PropertyChangeListener # propertyChange ( PropertyChangeEvent ) */
public void propertyChange ( PropertyChangeEvent evt ) { } }

implementation: String prop = evt . getPropertyName ( ) ; if ( ReteGraph . PROP_CHILD_ADDED . equals ( prop ) || ReteGraph . PROP_CHILD_REMOVED . equals ( prop ) ) { refreshChildren ( ) ; }


signature:
public class Request { /** * Returns the content length of this message ' s body , or - 1 if the
 * content length is unknown .
 * @ return the content length of this message ' s body */
public long getContentLength ( ) { } }

implementation: long contentLength = super . getContentLength ( ) ; if ( contentLength != - 1 ) return contentLength ; if ( requestBodyWriter == null ) return ( ( RequestInputStream ) is ) . length ( ) ; return - 1 ;


signature:
public class Request { /** * Writes this request ' s body to the given output stream . This method may
 * be called more than once during the lifetime of this request .
 * @ param os an output stream
 * @ exception IOException if there is an I / O error */
public void write ( OutputStream os ) throws IOException { } }

implementation: if ( requestBodyWriter == null ) { if ( inputRead ) { is . reset ( ) ; inputRead = false ; } super . write ( os ) ; } else { requestBodyWriter . writeRequestBody ( os ) ; }


signature:
public class HexConverter { /** * Converts the given byte array to its equivalent hexadecimal string
 * and returns the result . */
public static String toHex ( byte [ ] arr ) { } }

implementation: StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < arr . length ; ++ i ) { buf . append ( Integer . toHexString ( ( arr [ i ] >> 4 ) & 0x0f ) ) ; buf . append ( Integer . toHexString ( arr [ i ] & 0x0f ) ) ; } return buf . toString ( ) ;


signature:
public class HexConverter { /** * Converts the given int array to its equivalent hexadecimal string
 * and returns the result . */
public static String toHex ( int [ ] arr ) { } }

implementation: StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < arr . length ; ++ i ) { buf . append ( Integer . toHexString ( ( arr [ i ] >> 28 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 24 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 20 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 16 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 12 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 8 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] >> 4 ) & 0x0000000f ) ) ; buf . append ( Integer . toHexString ( ( arr [ i ] ) & 0x0000000f ) ) ; } return buf . toString ( ) ;


signature:
public class RepositoryContentProvider { /** * ( non - Javadoc )
 * @ see org . eclipse . jface . viewers . IContentProvider # inputChanged ( org . eclipse . jface . viewers . Viewer , java . lang . Object , java . lang . Object ) */
public void inputChanged ( Viewer v , Object oldInput , Object newInput ) { } }

implementation: if ( v instanceof AbstractTreeViewer ) { viewer = ( AbstractTreeViewer ) v ; manager = new DeferredTreeContentManager ( this , viewer ) ; }


signature:
public class RepositoryContentProvider { /** * ( non - Javadoc )
 * @ see org . eclipse . jface . viewers . IStructuredContentProvider # getElements ( java . lang . Object ) */
public Object [ ] getElements ( Object parent ) { } }

implementation: if ( parent . equals ( viewer ) ) { if ( invisibleRoot == null ) initialize ( ) ; return getChildren ( invisibleRoot ) ; } return getChildren ( parent ) ;


signature:
public class RepositoryContentProvider { /** * ( non - Javadoc )
 * @ see org . eclipse . jface . viewers . ITreeContentProvider # getParent ( java . lang . Object ) */
public Object getParent ( Object child ) { } }

implementation: if ( child instanceof TreeObject ) { return ( ( TreeObject ) child ) . getParent ( ) ; } return null ;


signature:
public class RepositoryContentProvider { /** * ( non - Javadoc )
 * @ see org . eclipse . jface . viewers . ITreeContentProvider # getChildren ( java . lang . Object ) */
public Object [ ] getChildren ( Object parent ) { } }

implementation: if ( parent == invisibleRoot ) { return ( ( TreeParent ) invisibleRoot ) . getChildren ( ) ; } else if ( parent instanceof TreeParent ) { return manager . getChildren ( parent ) ; } return new Object [ 0 ] ;


signature:
public class PropFind { /** * Creates a new WebDAV propfind element and sets it as the root of the
 * given document . Returns an editor on the new propfind element . The
 * document must not be < code > null < / code > , and must not already have a
 * root element .
 * @ param document the document that will become the root of a new
 * propfind element
 * @ return an element editor on a propfind element */
public static PropFind create ( Document document ) { } }

implementation:
Assert . isNotNull ( document ) ; Assert . isTrue ( document . getDocumentElement ( ) == null ) ; Element element = create ( document , "propfind" ) ; // $ NON - NLS - 1 $
try { return new PropFind ( element ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; }


signature:
public class PropFind { /** * Returns < code > true < / code > iff this propfind is in the " all prop "
 * form .
 * @ return a boolean indicating whether this propfind is in the " all
 * prop " form
 * @ throws MalformedElementException if there is reason to believe that
 * this editor ' s underlying element is not well formed */
public boolean isAllProp ( ) throws MalformedElementException { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; ensureNotNull ( Policy . bind ( "ensure.missingAllpropOrPropnameOrPropElmt" ) , child ) ; // $ NON - NLS - 1 $
boolean isAllProp = isDAVElement ( child , "allprop" ) ; // $ NON - NLS - 1 $
child = getNextSibling ( child , childNames ) ; ensureNull ( Policy . bind ( "ensure.conflictingAllpropOrPropnameOrPropElmt" ) , child ) ; // $ NON - NLS - 1 $
return isAllProp ;


signature:
public class PropFind { /** * Sets whether this propfind is in the " all prop " form .
 * @ param isAllProp boolean indicating whether this propfind will be in the
 * " all prop " form */
public void setIsAllProp ( boolean isAllProp ) { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; boolean isAlreadyAllProp = isDAVElement ( child , "allprop" ) ; // $ NON - NLS - 1 $
if ( isAllProp ) { if ( ! isAlreadyAllProp ) { if ( child != null ) root . removeChild ( child ) ; appendChild ( root , "allprop" ) ; // $ NON - NLS - 1 $
} } else if ( isAlreadyAllProp ) root . removeChild ( child ) ;


signature:
public class PropFind { /** * Sets whether this propfind is in the " prop name " form .
 * @ param isPropName boolean indicating whether this propfind will be in the
 * " prop name " form */
public void setIsPropName ( boolean isPropName ) { } }

implementation:
Element child = getFirstChild ( root , childNames ) ; boolean isAlreadyPropName = isDAVElement ( child , "propname" ) ; // $ NON - NLS - 1 $
if ( isPropName ) { if ( ! isAlreadyPropName ) { if ( child != null ) root . removeChild ( child ) ; appendChild ( root , "propname" ) ; // $ NON - NLS - 1 $
} } else if ( isAlreadyPropName ) root . removeChild ( child ) ;


signature:
public class PropFind { /** * Creates and sets a new prop on this propfind and returns an editor on
 * it . This propfind must not already be in the " all prop " or " prop
 * name " form .
 * @ return an editor on a new prop element */
public Prop setProp ( ) { } }

implementation:
Assert . isTrue ( getFirstChild ( root , new String [ ] { "allprop" , "propname" } ) == null ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
Element prop = setChild ( root , "prop" , new String [ ] { "prop" } , true ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
try { return new Prop ( prop ) ; } catch ( MalformedElementException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; // $ NON - NLS - 1 $
return null ; // Never reached .
}


signature:
public class CompletionUtil { /** * Looks behind , gets stuff after the white space . Basically ripping out the
 * last word . */
public static String stripLastWord ( String prefix ) { } }

implementation: if ( "" . equals ( prefix ) ) { return prefix ; } if ( prefix . charAt ( prefix . length ( ) - 1 ) == ' ' ) { return "" ; } else { char [ ] c = prefix . toCharArray ( ) ; int start = 0 ; for ( int i = c . length - 1 ; i >= 0 ; i -- ) { if ( Character . isWhitespace ( c [ i ] ) || c [ i ] == '(' || c [ i ] == ':' || c [ i ] == ';' || c [ i ] == '=' || c [ i ] == '<' || c [ i ] == '>' || c [ i ] == '.' || c [ i ] == '{' || c [ i ] == '}' ) { start = i + 1 ; break ; } } prefix = prefix . substring ( start , prefix . length ( ) ) ; return prefix ; }


signature:
public class CompletionUtil { /** * Attempt to enhance a consequence backtext such that it should compile in MVEL
 * @ param backText
 * @ return a substring of the back text , that should be compilable without
 * syntax errors by the mvel compiler
 * TODO : add tests and more use
 * cases */
public static String getCompilableText ( String backText ) { } }

implementation:
String trimed = backText . trim ( ) ; if ( trimed . endsWith ( ";" ) ) { // RHS expression should compile if it ends with ; but to get the last object ,
// we do no want it , to simulate a return statement
return backText . substring ( 0 , backText . length ( ) - 1 ) ; } else if ( trimed . endsWith ( "." ) || trimed . endsWith ( "," ) ) { // RHS expression should compile if it ends with no dot or comma
return backText . substring ( 0 , backText . length ( ) - 1 ) ; } else if ( CompletionUtil . COMPLETED_MVEL_EXPRESSION . matcher ( backText ) . matches ( ) ) { // RHS expression should compile if closed . just need to close the
// statement
return backText + ";" ; // } else if ( INCOMPLETED _ MVEL _ EXPRESSION . matcher ( backText ) . matches ( ) ) {
// / / remove the last char and close the statement
// return backText . substring ( 0,
// backText . length ( ) - 1 ) ;
} else { // TODO : support completion within with { } blocks
// TODO : support completion within nested expression .
return backText ; }


signature:
public class CompletionUtil { /** * propertyname extraction and bean convention methods names checks */
public static boolean isGetter ( String methodName , int argCount , String returnedType ) { } }

implementation: return isAccessor ( methodName , argCount , 0 , "get" , returnedType , Signature . SIG_VOID , false ) ;


signature:
public class CompletionUtil { /** * Given a data depicting a method ( name , # or params / args , returned type key ) , tries to return a bean property name derived from that method .
 * If a bean property name is not found , the initial method name is returned
 * @ param methodName
 * @ param parameterCount
 * @ param returnType
 * @ return a bean property name */
public static String getPropertyName ( String methodName , int parameterCount , String returnType ) { } }

implementation: if ( methodName == null ) { return null ; } String simpleName = methodName . replaceAll ( "\\(\\)" , "" ) ; int prefixLength = 0 ; if ( isIsGetter ( simpleName , parameterCount , returnType ) ) { prefixLength = 2 ; } else if ( isGetter ( simpleName , parameterCount , returnType ) || isSetter ( simpleName , parameterCount , returnType ) ) { prefixLength = 3 ; } else { return methodName ; } char firstChar = Character . toLowerCase ( simpleName . charAt ( prefixLength ) ) ; String propertyName = firstChar + simpleName . substring ( prefixLength + 1 ) ; return propertyName ;


signature:
public class CompletionUtil { /** * Given a data depicting a method ( name , # or params / args , returned type key ) , tries to return a writable bean property name derived from that method .
 * If a writable ( ie setter ) bean property name is not found , the initial method name is returned
 * @ param methodName
 * @ param parameterCount
 * @ param returnType
 * @ return a bean property name */
public static String getWritablePropertyName ( String methodName , int parameterCount , String returnType ) { } }

implementation: if ( methodName == null ) { return null ; } String simpleName = methodName . replaceAll ( "\\(\\)" , "" ) ; if ( ! isSetter ( simpleName , parameterCount , returnType ) ) { return methodName ; } int prefixLength = 3 ; char firstChar = Character . toLowerCase ( simpleName . charAt ( prefixLength ) ) ; String propertyName = firstChar + simpleName . substring ( prefixLength + 1 ) ; return propertyName ;


signature:
public class CompletionUtil { /** * Determine if the given method is a bean accessor ( ie getter / setter )
 * @ param methodName
 * @ param actualParameterCount
 * @ param requiredParameterCount
 * @ param prefix
 * @ param returnType
 * @ param requiredReturnType
 * @ param includeType
 * @ return true if the method is a bean accessor , false otherwise */
private static boolean isAccessor ( String methodName , int actualParameterCount , int requiredParameterCount , String prefix , String returnType , String requiredReturnType , boolean includeType ) { } }

implementation:
// must be longer than the accessor prefix
if ( methodName . length ( ) < prefix . length ( ) + 1 ) { return false ; } // start with get , set or is
if ( ! methodName . startsWith ( prefix ) ) { return false ; } if ( actualParameterCount != requiredParameterCount ) { return false ; } // if we check for the returned type , verify that the returned type is of the cirrect type signature
if ( includeType ) { if ( ! requiredReturnType . equals ( returnType ) ) { return false ; } } else { if ( requiredReturnType . equals ( returnType ) ) { return false ; } } return true ;


signature:
public class CompletionUtil { /** * COMPENSATES FOR LACK OF getSimpleName IN java . lang . Class
 * Borrowed and adpated from MVEL ' s org . mvel . util . ParseTools . getSimpleClassName ( Class )
 * @ param cls - - class reference
 * @ return Simple name of class */
public static String getSimpleClassName ( Class < ? > cls ) { } }

implementation: int lastIndex = cls . getName ( ) . lastIndexOf ( '$' ) ; if ( lastIndex < 0 ) { lastIndex = cls . getName ( ) . lastIndexOf ( '.' ) ; } if ( cls . isArray ( ) ) { return cls . getName ( ) . substring ( lastIndex + 1 ) + "[]" ; } else { return cls . getName ( ) . substring ( lastIndex + 1 ) ; }


signature:
public class RuleContentOutlinePage { /** * Updates the outline page . */
public void update ( ) { } }

implementation: TreeViewer viewer = getTreeViewer ( ) ; if ( viewer != null ) { Control control = viewer . getControl ( ) ; if ( control != null && ! control . isDisposed ( ) ) { initRules ( ) ; populatePackageTreeNode ( ) ; viewer . refresh ( ) ; control . setRedraw ( false ) ; viewer . expandToLevel ( 2 ) ; control . setRedraw ( true ) ; } }


signature:
public class Message { /** * Returns the content length of this message ' s body , or - 1 if the
 * content length is unknown .
 * @ return the content length of this message ' s body */
public long getContentLength ( ) { } }

implementation: long contentLength = context . getContentLength ( ) ; if ( contentLength != - 1 ) return contentLength ; if ( is instanceof ByteArrayInputStream ) return ( ( ByteArrayInputStream ) is ) . available ( ) ; return - 1 ;


signature:
public class Message { /** * Writes this messages body to the given output stream . This method may
 * only be called once during the lifetime of this message .
 * @ param os an output stream
 * @ exception IOException if there is an I / O error */
public void write ( OutputStream os ) throws IOException { } }

implementation:
Assert . isTrue ( ! inputRead ) ; Assert . isTrue ( ! hasInputStream ) ; int bytesRead = 0 ; int totalBytesRead = 0 ; byte [ ] buffer = bufferPool . getBuffer ( ) ; long contentLength = getContentLength ( ) ; try { while ( bytesRead != - 1 && ( contentLength == - 1 || contentLength > totalBytesRead ) ) { if ( contentLength == - 1 ) { bytesRead = is . read ( buffer ) ; } else { bytesRead = is . read ( buffer , 0 , ( int ) Math . min ( buffer . length , contentLength - totalBytesRead ) ) ; } if ( bytesRead == - 1 ) { if ( contentLength >= 0 ) { throw new IOException ( Policy . bind ( "exception.unexpectedEndStream" ) ) ; // $ NON - NLS - 1 $
} } else { totalBytesRead += bytesRead ; os . write ( buffer , 0 , bytesRead ) ; } } } finally { bufferPool . putBuffer ( buffer ) ; inputRead = true ; }


signature:
public class DroolsThread { /** * I don ' t see the need for any of this custom stepOver stuff , why is it here ? */
public synchronized void stepOver ( ) throws DebugException { } }

implementation:
// Detection for active stackframe
if ( ! ( getTopStackFrame ( ) instanceof MVELStackFrame ) ) { super . stepOver ( ) ; return ; } // MVEL step over
MVELStackFrame mvelStack = ( MVELStackFrame ) getTopStackFrame ( ) ; if ( ! canStepOver ( ) || ! mvelStack . canStepOver ( ) ) { return ; } if ( ! setRemoteOnBreakReturn ( Debugger . STEP ) ) { return ; } setRunning ( true ) ; preserveStackFrames ( ) ; fireEvent ( new DebugEvent ( this , DebugEvent . RESUME , DebugEvent . STEP_OVER ) ) ; try { getUnderlyingThread ( ) . resume ( ) ; } catch ( RuntimeException e ) { // stepEnd ( ) ;
targetRequestFailed ( MessageFormat . format ( JDIDebugModelMessages . JDIThread_exception_stepping , e . toString ( ) ) , e ) ; }


signature:
public class DroolsBuilder { /** * This will create markers for parse errors . Parse errors mean that antlr
 * has picked up some major typos in the input source . */
protected void markParseErrors ( List < DroolsBuildMarker > markers , List < BaseKnowledgeBuilderResultImpl > parserErrors ) { } }

implementation:
for ( Iterator < BaseKnowledgeBuilderResultImpl > iter = parserErrors . iterator ( ) ; iter . hasNext ( ) ; ) { Object error = iter . next ( ) ; if ( error instanceof ParserError ) { ParserError err = ( ParserError ) error ; markers . add ( new DroolsBuildMarker ( err . getMessage ( ) , err . getRow ( ) ) ) ; } else if ( error instanceof KnowledgeBuilderResult ) { KnowledgeBuilderResult res = ( KnowledgeBuilderResult ) error ; int [ ] errorLines = res . getLines ( ) ; markers . add ( new DroolsBuildMarker ( res . getMessage ( ) , errorLines != null && errorLines . length > 0 ? errorLines [ 0 ] : - 1 ) ) ; } else if ( error instanceof ExpanderException ) { ExpanderException exc = ( ExpanderException ) error ; // TODO line mapping is incorrect
markers . add ( new DroolsBuildMarker ( exc . getMessage ( ) , - 1 ) ) ; } else { markers . add ( new DroolsBuildMarker ( error . toString ( ) ) ) ; } }


signature:
public class DroolsBuilder { /** * This will create markers for build errors that happen AFTER parsing . */
private void markOtherErrors ( List < DroolsBuildMarker > markers , DroolsError [ ] buildErrors ) { } }

implementation:
// TODO are there warnings too ?
for ( int i = 0 ; i < buildErrors . length ; i ++ ) { DroolsError error = buildErrors [ i ] ; if ( error instanceof GlobalError ) { GlobalError globalError = ( GlobalError ) error ; markers . add ( new DroolsBuildMarker ( "Global error: " + globalError . getGlobal ( ) , - 1 ) ) ; } else if ( error instanceof RuleBuildError ) { RuleBuildError ruleError = ( RuleBuildError ) error ; // TODO try to retrieve line number ( or even character start - end )
// disabled for now because line number are those of the rule class ,
// not the rule file itself
if ( ruleError . getObject ( ) instanceof CompilationProblem [ ] ) { CompilationProblem [ ] problems = ( CompilationProblem [ ] ) ruleError . getObject ( ) ; for ( int j = 0 ; j < problems . length ; j ++ ) { markers . add ( new DroolsBuildMarker ( problems [ j ] . getMessage ( ) , ruleError . getLine ( ) ) ) ; } } else { markers . add ( new DroolsBuildMarker ( ruleError . getRule ( ) . getName ( ) + ":" + ruleError . getMessage ( ) , ruleError . getLine ( ) ) ) ; } } else if ( error instanceof ParserError ) { ParserError parserError = ( ParserError ) error ; // TODO try to retrieve character start - end
markers . add ( new DroolsBuildMarker ( parserError . getMessage ( ) , parserError . getRow ( ) ) ) ; } else if ( error instanceof FunctionError ) { FunctionError functionError = ( FunctionError ) error ; // TODO add line to function error
// TODO try to retrieve character start - end
if ( functionError . getObject ( ) instanceof CompilationProblem [ ] ) { CompilationProblem [ ] problems = ( CompilationProblem [ ] ) functionError . getObject ( ) ; for ( int j = 0 ; j < problems . length ; j ++ ) { markers . add ( new DroolsBuildMarker ( problems [ j ] . getMessage ( ) , functionError . getLines ( ) [ j ] ) ) ; } } else { markers . add ( new DroolsBuildMarker ( functionError . getFunctionDescr ( ) . getName ( ) + ":" + functionError . getMessage ( ) , - 1 ) ) ; } } else if ( error instanceof FieldTemplateError ) { markers . add ( new DroolsBuildMarker ( error . getMessage ( ) , ( ( FieldTemplateError ) error ) . getLine ( ) ) ) ; } else if ( error instanceof FactTemplateError ) { markers . add ( new DroolsBuildMarker ( error . getMessage ( ) , ( ( FactTemplateError ) error ) . getLine ( ) ) ) ; } else if ( error instanceof ImportError ) { markers . add ( new DroolsBuildMarker ( "ImportError: " + error . getMessage ( ) ) ) ; } else if ( error instanceof DescrBuildError ) { markers . add ( new DroolsBuildMarker ( "BuildError: " + error . getMessage ( ) , ( ( DescrBuildError ) error ) . getLine ( ) ) ) ; } else { markers . add ( new DroolsBuildMarker ( "Unknown DroolsError " + error . getClass ( ) + ": " + error ) ) ; } }


signature:
public class Parser { /** * Skips the next character in s if it matches c , otherwise a
 * < code > ParserException < / code > is thrown .
 * @ param c
 * @ throws ParserException */
public void match ( char c ) throws ParserException { } }

implementation: checkPosition ( ) ; if ( s . charAt ( pos ) != c ) throw new ParserException ( ) ; ++ pos ;


signature:
public class Parser { /** * Returns the next quoted string is s ( quotes included ) . Throws a
 * < code > ParserException < / code > if the next substring in s is not a
 * quoted string .
 * @ return the next quoted string in s ( quotes included )
 * @ throws ParserException */
public String nextQuotedString ( ) throws ParserException { } }

implementation: int start = pos ; match ( '"' ) ; checkPosition ( ) ; while ( s . charAt ( pos ) != '"' ) { ++ pos ; checkPosition ( ) ; } match ( '"' ) ; return s . substring ( start , pos ) ;


signature:
public class Parser { /** * Returns the next token in s . Throws a < code > ParserException < / code > if
 * the next substring in s is not a token .
 * @ return the next token in s
 * @ throws ParserException */
public String nextToken ( ) throws ParserException { } }

implementation: int start = pos ; checkPosition ( ) ; boolean done = false ; while ( ! done && pos < s . length ( ) ) { int c = s . charAt ( pos ) ; if ( c <= 31 || c == 127 || c == '(' || c == ')' || c == '<' || c == '>' || c == '@' || c == ',' || c == ';' || c == ':' || c == '\\' || c == '"' || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' || c == '{' || c == '}' || Character . isWhitespace ( ( char ) c ) ) { done = true ; } else { ++ pos ; } } if ( start == pos ) { throw new ParserException ( ) ; } return s . substring ( start , pos ) ;


signature:
public class Parser { /** * Skips the next sequence of white space in s . An exception is not
 * thrown if there is no matching white space . */
public void skipWhiteSpace ( ) { } }

implementation: while ( pos < s . length ( ) && Character . isWhitespace ( s . charAt ( pos ) ) ) ++ pos ;


signature:
public class GuvnorMetadataUtils { /** * Finds the local Guvnor metadata file associated with a given resource .
 * @ param resource The resource to locate metadata for .
 * @ return The metadata file for the given resource , null if metadata is not found . */
public static IFile findGuvnorMetadata ( IResource resource ) { } }

implementation:
IFile res = null ; IPath dir = resource . getFullPath ( ) . removeLastSegments ( 1 ) ; IPath mdpath = dir . append ( ".guvnorinfo" ) . append ( "." + resource . getName ( ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
IResource mdResource = resource . getWorkspace ( ) . getRoot ( ) . findMember ( mdpath ) ; if ( mdResource != null && mdResource . exists ( ) && mdResource instanceof IFile ) { res = ( IFile ) mdResource ; } return res ;


signature:
public class GuvnorMetadataUtils { /** * Adds a resource to Guvnor .
 * @ param repLoc The location of the Guvnor repository
 * @ param targetLoc The location in Guvnor to add the resource
 * @ param selectedFile The resource to add
 * @ return true if the resource is added , false if there is already a resource
 * with the same name in the given location . */
public static boolean addResourceToGuvnor ( String repLoc , String targetLoc , IFile selectedFile ) { } }

implementation:
boolean res = false ; try { String fullPath = targetLoc + selectedFile . getName ( ) ; IWebDavClient client = WebDavServerCache . getWebDavClient ( repLoc ) ; if ( client == null ) { client = WebDavClientFactory . createClient ( new URL ( repLoc ) ) ; WebDavServerCache . cacheWebDavClient ( repLoc , client ) ; } try { // res = client . createResource ( fullPath , selectedFile . getContents ( ) , false ) ;
// Hack : When creating a file , if the actual contents are passed first ,
// the client hangs for about 20 seconds when closing the InputStream .
// Don ' t know why . . .
// But , if the file is created with empty contents , and then the contents
// set , the operation is fast ( less than a couple of seconds )
res = client . createResource ( fullPath , new ByteArrayInputStream ( new byte [ 0 ] ) , false ) ; if ( res ) { client . putResource ( fullPath , selectedFile . getContents ( ) ) ; } } catch ( WebDavException wde ) { if ( wde . getErrorCode ( ) != IResponse . SC_UNAUTHORIZED ) { // If not an authentication failure , we don ' t know what to do with it
throw wde ; } boolean retry = PlatformUtils . getInstance ( ) . authenticateForServer ( repLoc , client ) ; if ( retry ) { // res = client . createResource ( fullPath , selectedFile . getContents ( ) , false ) ;
// See Hack note immediately above . . .
res = client . createResource ( fullPath , new ByteArrayInputStream ( new byte [ 0 ] ) , false ) ; if ( res ) { client . putResource ( fullPath , selectedFile . getContents ( ) ) ; } } } if ( res ) { GuvnorMetadataUtils . markCurrentGuvnorResource ( selectedFile ) ; ResourceProperties resProps = client . queryProperties ( fullPath ) ; GuvnorMetadataProps mdProps = new GuvnorMetadataProps ( selectedFile . getName ( ) , repLoc , fullPath , resProps . getLastModifiedDate ( ) , resProps . getRevision ( ) ) ; GuvnorMetadataUtils . setGuvnorMetadataProps ( selectedFile . getFullPath ( ) , mdProps ) ; } } catch ( Exception e ) { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; } return res ;


signature:
public class GuvnorMetadataUtils { /** * Commits changes to Guvnor .
 * @ param selectedFile The Guvnor controlled file with pending changes */
public static void commitFileChanges ( IFile selectedFile ) { } }

implementation:
try { GuvnorMetadataProps props = GuvnorMetadataUtils . getGuvnorMetadata ( selectedFile ) ; IWebDavClient client = WebDavServerCache . getWebDavClient ( props . getRepository ( ) ) ; if ( client == null ) { client = WebDavClientFactory . createClient ( new URL ( props . getRepository ( ) ) ) ; WebDavServerCache . cacheWebDavClient ( props . getRepository ( ) , client ) ; } ResourceProperties remoteProps = null ; try { remoteProps = client . queryProperties ( props . getFullpath ( ) ) ; } catch ( WebDavException wde ) { if ( wde . getErrorCode ( ) != IResponse . SC_UNAUTHORIZED ) { // If not an authentication failure , we don ' t know what to do with it
throw wde ; } boolean retry = PlatformUtils . getInstance ( ) . authenticateForServer ( props . getRepository ( ) , client ) ; if ( retry ) { remoteProps = client . queryProperties ( props . getFullpath ( ) ) ; } } if ( remoteProps == null ) { throw new Exception ( "Could not retrieve server version of " + props . getFullpath ( ) ) ; // $ NON - NLS - 1 $
} // Check to make sure that the version in the repository is the same as the base
// version for the local copy
boolean proceed = true ; if ( ! props . getRevision ( ) . equals ( remoteProps . getRevision ( ) ) ) { String msg = MessageFormat . format ( Messages . getString ( "overwrite.confirmation" ) , // $ NON - NLS - 1 $
new Object [ ] { selectedFile . getName ( ) , remoteProps . getRevision ( ) , props . getRevision ( ) } ) ; Display display = PlatformUI . getWorkbench ( ) . getDisplay ( ) ; proceed = MessageDialog . openQuestion ( display . getActiveShell ( ) , Messages . getString ( "overwrite.confirmation.caption" ) , msg ) ; // $ NON - NLS - 1 $
} if ( proceed ) { client . putResource ( props . getFullpath ( ) , selectedFile . getContents ( ) ) ; GuvnorMetadataUtils . markCurrentGuvnorResource ( selectedFile ) ; ResourceProperties resProps = client . queryProperties ( props . getFullpath ( ) ) ; GuvnorMetadataProps mdProps = GuvnorMetadataUtils . getGuvnorMetadata ( selectedFile ) ; mdProps . setVersion ( resProps . getLastModifiedDate ( ) ) ; mdProps . setRevision ( resProps . getRevision ( ) ) ; GuvnorMetadataUtils . setGuvnorMetadataProps ( selectedFile . getFullPath ( ) , mdProps ) ; } } catch ( Exception e ) { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; }


signature:
public class GuvnorMetadataUtils { /** * Finds the local Guvnor metadata file associated with a given resource .
 * @ param resource The resource path to locate metadata for .
 * @ return The metadata file for the given resource , null if metadata is not found . */
public static IFile findGuvnorMetadata ( IPath resource ) { } }

implementation:
IFile res = null ; IPath dir = resource . removeLastSegments ( 1 ) ; IPath mdpath = dir . append ( ".guvnorinfo" ) . append ( "." + resource . lastSegment ( ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
IResource mdResource = Activator . getDefault ( ) . getWorkspace ( ) . getRoot ( ) . findMember ( mdpath ) ; if ( mdResource != null && mdResource . exists ( ) && mdResource instanceof IFile ) { res = ( IFile ) mdResource ; } return res ;


signature:
public class Context { /** * Copy all the default values into the receiver . */
public void collapse ( ) { } }

implementation: if ( defaults != null ) { Enumeration keysEnum = defaults . keys ( ) ; while ( keysEnum . hasMoreElements ( ) ) { String key = ( String ) keysEnum . nextElement ( ) ; put ( key , get ( key ) ) ; } defaults = null ; }


signature:
public class Context { /** * Return the value for the given key .
 * @ param key the key to look up
 * @ return the value for the key or null if none . */
public String get ( String key ) { } }

implementation: String value = ( String ) properties . get ( new ContextKey ( key ) ) ; if ( value == null && defaults != null ) return defaults . get ( key ) ; return value ;


signature:
public class Context { /** * Get the sender ' s estimate of the time since the response was generated .
 * Return the int value for the AGE key . Return - 1 if the value is not set .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for AGE
 * @ see Context # getAge ( ) */
public int getAge ( ) { } }

implementation: String ageString = get ( AGE ) ; return ( ageString == null ) ? - 1 : Integer . parseInt ( ageString ) ;


signature:
public class Context { /** * Get the content length in bytes of the entity body .
 * Return the value for the CONTENT _ LENGTH key .
 * Returns - 1 if the Content - Length has not been set .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for CONTENT _ LENGTH
 * @ see Context # getContentLength ( ) */
public long getContentLength ( ) { } }

implementation: String lengthString = get ( CONTENT_LENGTH ) ; return ( lengthString == null ) ? - 1 : Long . parseLong ( lengthString ) ;


signature:
public class Context { /** * Return the integer value for the MAX _ FORWARDS key .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for MAX _ FORWARDS
 * @ see Context # getMaxForwards ( ) */
public int getMaxForwards ( ) { } }

implementation: String s = get ( MAX_FORWARDS ) ; return s == null ? - 1 : Integer . parseInt ( s ) ;


signature:
public class Context { /** * Get the flag that indicates if copy or move should overwrite
 * an existing destination . Return the boolean value for the
 * OVERWRITE key .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for OVERWRITE
 * @ see Context # OVERWRITE */
public boolean getOverwrite ( ) { } }

implementation: String overwriteString = get ( OVERWRITE ) ; return overwriteString == null ? false : overwriteString . equalsIgnoreCase ( "T" ) ; // $ NON - NLS - 1 $


signature:
public class Context { /** * Return the boolean value for the PASSTHROUGH key .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for PASSTHROUGH
 * @ see Context # getPassthrough ( ) */
public boolean getPassthrough ( ) { } }

implementation: String s = get ( PASSTHROUGH ) ; return s == null ? false : s . equalsIgnoreCase ( "T" ) ; // $ NON - NLS - 1 $


signature:
public class Context { /** * Get the lock timeout value . The value - 1 means that the
 * value was not set , the value - 2 means that the value was " Infinity " .
 * Return the integer value for the TIMEOUT key .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ return the value for TIMEOUT
 * @ see Context # getTimeout ( ) */
public int getTimeout ( ) { } }

implementation:
String timeoutString = get ( TIMEOUT ) ; if ( timeoutString == null ) return - 1 ; if ( timeoutString . equalsIgnoreCase ( DEPTH_INFINITY ) ) return - 2 ; if ( timeoutString . regionMatches ( true , 1 , "Second-" , 1 , 7 ) ) // $ NON - NLS - 1 $
return Integer . parseInt ( timeoutString . substring ( 7 ) ) ; // ignore all other cases , and use infinite timeout
return - 2 ;


signature:
public class Context { /** * Return an enumeration over the context ' s keys . ( recursively computes the
 * keys based on keys defaults as well )
 * @ return an enumeration over the context keys */
public Enumeration keys ( ) { } }

implementation:
if ( defaults == null ) return new ContextKeyToStringEnum ( properties . keys ( ) ) ; Enumeration allKeys = new MergedEnumeration ( new ContextKeyToStringEnum ( properties . keys ( ) ) , defaults . keys ( ) ) ; Hashtable keysSet = new Hashtable ( ) ; while ( allKeys . hasMoreElements ( ) ) keysSet . put ( allKeys . nextElement ( ) , "ignored" ) ; // $ NON - NLS - 1 $
return keysSet . keys ( ) ;


signature:
public class Context { /** * Put the given key - value pair into the context .
 * @ param key the key
 * @ param value its associated value */
public void put ( String key , String value ) { } }

implementation: ContextKey ckey = new ContextKey ( key ) ; if ( ( value == null ) || ( value . length ( ) == 0 ) ) properties . remove ( ckey ) ; else properties . put ( ckey , value ) ;


signature:
public class Context { /** * Set the lock timeout value in seconds . Pass - 1 to clear the
 * value , pass - 2 to set " Infinity " . Set the integer value for the
 * TIMEOUT key .
 * < p > Implements the corresponding API in the interface
 * < code > Context < / code > . < / p >
 * @ param value the value for TIMEOUT
 * @ see Context # setTimeout ( int ) */
public void setTimeout ( int value ) { } }

implementation:
if ( value == - 1 ) put ( TIMEOUT , "" ) ; // $ NON - NLS - 1 $
else put ( TIMEOUT , ( value == - 2 ) ? DEPTH_INFINITY : "Second-" + Integer . toString ( value ) ) ; // $ NON - NLS - 1 $


signature:
public class DSLTree { /** * method will create a BufferedReader to read the file .
 * @ param filename
 * @ return */
protected BufferedReader openDSLFile ( String filename ) { } }

implementation: try { FileReader reader = new FileReader ( filename ) ; BufferedReader breader = new BufferedReader ( reader ) ; return breader ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; }


signature:
public class DSLTree { /** * method will use the BufferedReader to read the contents of the file .
 * It calls other methods to parse the line and build the tree .
 * @ param reader */
protected void parseFile ( BufferedReader reader ) { } }

implementation: String line = null ; try { while ( ( line = reader . readLine ( ) ) != null ) { Section section = getSection ( line ) ; String nl = stripHeadingAndCode ( line ) ; String objname = this . getObjMetadata ( nl ) ; nl = this . stripObjMetadata ( nl ) ; addEntry ( section , nl , objname ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; }


signature:
public class DSLTree { /** * method will strip out the when , then , * at the beginning of each
 * line and the mapped drl expression
 * @ param text
 * @ return */
protected String stripHeadingAndCode ( String text ) { } }

implementation: if ( text . startsWith ( DSLMappingEntry . CONDITION . getSymbol ( ) ) ) { return text . substring ( DSLMappingEntry . CONDITION . getSymbol ( ) . length ( ) + 2 , text . indexOf ( "=" ) ) ; } else if ( text . startsWith ( DSLMappingEntry . CONSEQUENCE . getSymbol ( ) ) ) { return text . substring ( DSLMappingEntry . CONSEQUENCE . getSymbol ( ) . length ( ) + 2 , text . indexOf ( "=" ) ) ; } else if ( text . startsWith ( DSLMappingEntry . ANY . getSymbol ( ) ) ) { return text . substring ( DSLMappingEntry . ANY . getSymbol ( ) . length ( ) + 2 , text . indexOf ( "=" ) ) ; } else if ( text . startsWith ( "#" ) ) { return "" ; } else { return text ; }


signature:
public class DSLTree { /** * Method will return just the object metadata
 * @ param text
 * @ return */
protected String getObjMetadata ( String text ) { } }

implementation: if ( text . startsWith ( "[" ) ) { return text . substring ( 1 , text . lastIndexOf ( "]" ) ) ; } else { return "" ; }


signature:
public class DSLTree { /** * method will strip the metadata from the text string
 * @ param text
 * @ return */
protected String stripObjMetadata ( String text ) { } }

implementation: if ( text . startsWith ( "[" ) ) { return text . substring ( text . lastIndexOf ( "]" ) + 1 ) ; } else { return text ; }


signature:
public class DSLTree { /** * The method is different than addTokens ( StringTokenizer ) . this method
 * expects additional metadata . It expects to get an object name or " * "
 * meaning all . If the metadata is a wildcard all , it will add the
 * tokens to all the top level nodes that are immediate child of root .
 * @ param metadata
 * @ param tokens */
public void addTokens ( String metadata , StringTokenizer tokens ) { } }

implementation: Node mnode = this . rootCond . addToken ( metadata ) ; Node thenode = mnode ; while ( tokens . hasMoreTokens ( ) ) { Node newnode = thenode . addToken ( tokens . nextToken ( ) ) ; thenode = newnode ; }


signature:
public class DSLTree { /** * method adds the token to root
 * @ param tokens */
public void addTokens ( String [ ] tokens , Node rootNode ) { } }

implementation: Node thenode = rootNode ; for ( int i = 0 ; i < tokens . length ; i ++ ) { Node newnode = thenode . addToken ( tokens [ i ] ) ; thenode = newnode ; }


signature:
public class DSLTree { /** * the method will tokenize the text and try to find
 * the node that matches and return the children . the method
 * will traverse down the network as far as it can and return
 * the children at that level .
 * @ param text
 * @ return */
public Node [ ] getConditionChildren ( String text ) { } }

implementation:
Node thenode = this . rootCond ; if ( text . length ( ) > 0 ) { StringTokenizer tokenz = new StringTokenizer ( text ) ; this . last = this . current ; while ( tokenz . hasMoreTokens ( ) ) { String strtk = tokenz . nextToken ( ) ; Node ch = thenode . getChild ( strtk ) ; // if a child is found , we set thenode to the child Node
if ( ch != null ) { thenode = ch ; } else { break ; } } if ( thenode != this . rootCond ) { this . current = thenode ; } } Collection < Node > children = thenode . getChildren ( ) ; Node [ ] nchild = new Node [ children . size ( ) ] ; return children . toArray ( nchild ) ;


signature:
public class DSLTree { /** * the method expects the caller to pass the object
 * @ param obj
 * @ param text
 * @ return */
public Node [ ] getChildren ( String obj , String text ) { } }

implementation:
Node thenode = this . rootCond . getChild ( obj ) ; if ( thenode == null ) { for ( Node child : this . rootCond . getChildren ( ) ) { String tokenText = child . getToken ( ) ; if ( tokenText != null ) { int index = tokenText . indexOf ( "{" ) ; if ( index != - 1 ) { String substring = tokenText . substring ( 0 , index ) ; if ( obj != null && obj . startsWith ( substring ) ) { thenode = child ; } } } } } if ( thenode != null && text . length ( ) > 0 ) { StringTokenizer tokenz = new StringTokenizer ( text ) ; this . last = this . current ; while ( tokenz . hasMoreTokens ( ) ) { String strtk = tokenz . nextToken ( ) ; Node ch = thenode . getChild ( strtk ) ; // if a child is found , we set thenode to the child Node
if ( ch != null ) { thenode = ch ; } else { break ; } } if ( thenode != this . rootCond ) { this . current = thenode ; } } if ( thenode == null ) { return null ; // thenode = this . rootCond ;
} Collection < Node > children = thenode . getChildren ( ) ; Node [ ] nchild = new Node [ children . size ( ) ] ; return children . toArray ( nchild ) ;


signature:
public class DSLTree { /** * for convienance , the method will return a list of strings
 * that are children of the last node found . If the editor
 * wants to generate the children strings , call the method
 * with true
 * @ param text
 * @ return */
public ArrayList < String > getConditionChildrenList ( String text , boolean addChildren ) { } }

implementation: Node [ ] c = getConditionChildren ( text ) ; this . suggestions . clear ( ) ; for ( int idx = 0 ; idx < c . length ; idx ++ ) { this . suggestions . add ( c [ idx ] . getToken ( ) ) ; if ( addChildren ) { this . addChildToList ( c [ idx ] , c [ idx ] . getToken ( ) , this . suggestions ) ; } } return this . suggestions ;


signature:
public class DSLTree { /** * for convienance , the method will return a list of strings
 * that are children of the last node found . If the editor
 * wants to generate the children strings , call the method
 * with true
 * @ param text
 * @ return */
public ArrayList < String > getConsequenceChildrenList ( String text , boolean addChildren ) { } }

implementation: Node [ ] c = getConsequenceChildren ( text ) ; this . suggestions . clear ( ) ; for ( int idx = 0 ; idx < c . length ; idx ++ ) { if ( addChildren ) { this . addChildToList ( c [ idx ] , c [ idx ] . getToken ( ) , this . suggestions ) ; } else { this . suggestions . add ( c [ idx ] . getToken ( ) ) ; } } return this . suggestions ;


signature:
public class DSLTree { /** * method will prepend the parent text to the child and generate
 * the possible combinations in text format .
 * @ param n
 * @ param prefix
 * @ param list */
public void addChildToList ( Node n , String prefix , ArrayList < String > list ) { } }

implementation:
if ( n . getChildren ( ) . size ( ) > 0 ) { for ( Node child : n . getChildren ( ) ) { if ( prefix != null && "-" . equals ( child . getToken ( ) ) ) { if ( ! list . contains ( prefix ) ) { list . add ( prefix ) ; } return ; } String text = ( prefix == null ? "" : prefix + " " ) + child . getToken ( ) ; // list . add ( text ) ;
addChildToList ( child , text , list ) ; } } else { if ( ! list . contains ( prefix ) ) { list . add ( prefix ) ; } }


signature:
public class DSLTree { /** * The method will print the DSLTree to System . out in text format . */
public void printTree ( ) { } }

implementation: System . out . println ( "ROOT" ) ; for ( Node n : rootCond . getChildren ( ) ) { printNode ( n ) ; }


signature:
public class DSLTree { /** * method will print the node and then iterate over the children
 * @ param n */
protected void printNode ( Node n ) { } }

implementation: printTabs ( n . getDepth ( ) ) ; System . out . println ( "- \"" + n . getToken ( ) + "\"" ) ; for ( Node c : n . getChildren ( ) ) { printNode ( c ) ; }


signature:
public class DSLTree { /** * Method will print n number of tabs
 * @ param count */
protected void printTabs ( int count ) { } }

implementation: for ( int idx = 0 ; idx < count ; idx ++ ) { System . out . print ( tab ) ; }


signature:
public class JsonValue { /** * Reads a JSON value from the given string .
 * @ param text
 * the string that contains the JSON value
 * @ return the JSON value that has been read
 * @ throws ParseException
 * if the input is not valid JSON */
public static JsonValue readFrom ( String text ) { } }

implementation:
try { return new JsonParser ( text ) . parse ( ) ; } catch ( IOException exception ) { // JsonParser does not throw IOException for String
throw new RuntimeException ( exception ) ; }


signature:
public class JsonValue { /** * Returns a JsonValue instance that represents the given < code > float < / code > value .
 * @ param value
 * the value to get a JSON representation for
 * @ return a JSON value that represents the given value */
public static JsonValue valueOf ( float value ) { } }

implementation: if ( Float . isInfinite ( value ) || Float . isNaN ( value ) ) { throw new IllegalArgumentException ( "Infinite and NaN values not permitted in JSON" ) ; } return new JsonNumber ( cutOffPointZero ( Float . toString ( value ) ) ) ;


signature:
public class TreeParent { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . progress . IDeferredWorkbenchAdapter # fetchDeferredChildren ( java . lang . Object , org . eclipse . ui . progress . IElementCollector , org . eclipse . core . runtime . IProgressMonitor ) */
public void fetchDeferredChildren ( Object object , IElementCollector collector , IProgressMonitor monitor ) { } }

implementation:
if ( ! ( object instanceof TreeParent ) ) { return ; } TreeParent node = ( TreeParent ) object ; if ( node . getNodeType ( ) == Type . NONE ) { List < GuvnorRepository > reps = Activator . getLocationManager ( ) . getRepositories ( ) ; monitor . beginTask ( Messages . getString ( "pending" ) , reps . size ( ) ) ; // $ NON - NLS - 1 $
for ( int i = 0 ; i < reps . size ( ) ; i ++ ) { TreeParent p = new TreeParent ( reps . get ( i ) . getLocation ( ) , Type . REPOSITORY ) ; p . setParent ( node ) ; p . setGuvnorRepository ( reps . get ( i ) ) ; ResourceProperties props = new ResourceProperties ( ) ; props . setBase ( "" ) ; // $ NON - NLS - 1 $
p . setResourceProps ( props ) ; collector . add ( p , monitor ) ; monitor . worked ( 1 ) ; } monitor . done ( ) ; } if ( EnumSet . of ( Type . REPOSITORY , Type . GLOBALS , Type . PACKAGES , Type . SNAPSHOTS , Type . PACKAGE , Type . SNAPSHOT_PACKAGE ) . contains ( node . getNodeType ( ) ) ) { listDirectory ( node , collector , monitor ) ; }


signature:
public class TreeParent { /** * Creates a directory listing .
 * @ param node The directory to list .
 * @ param collector The collector for the elements listed .
 * @ param monitor Progress monitor for the operation . */
public void listDirectory ( TreeParent node , IElementCollector collector , IProgressMonitor monitor ) { } }

implementation:
monitor . beginTask ( Messages . getString ( "pending" ) , 1 ) ; // $ NON - NLS - 1 $
monitor . worked ( 1 ) ; GuvnorRepository rep = node . getGuvnorRepository ( ) ; try { IWebDavClient webdav = WebDavServerCache . getWebDavClient ( rep . getLocation ( ) ) ; if ( webdav == null ) { webdav = WebDavClientFactory . createClient ( new URL ( rep . getLocation ( ) ) ) ; WebDavServerCache . cacheWebDavClient ( rep . getLocation ( ) , webdav ) ; } Map < String , ResourceProperties > listing = null ; try { listing = webdav . listDirectory ( node . getFullPath ( ) ) ; } catch ( WebDavException wde ) { if ( wde . getErrorCode ( ) != IResponse . SC_UNAUTHORIZED ) { // If not an authentication failure , we don ' t know what to do with it
throw wde ; } boolean retry = PlatformUtils . getInstance ( ) . authenticateForServer ( node . getGuvnorRepository ( ) . getLocation ( ) , webdav ) ; if ( retry ) { listing = webdav . listDirectory ( node . getFullPath ( ) ) ; } } if ( listing != null ) { for ( String s : listing . keySet ( ) ) { ResourceProperties resProps = listing . get ( s ) ; TreeObject o = null ; if ( resProps . isDirectory ( ) ) { Type childType ; switch ( getNodeType ( ) ) { case REPOSITORY : if ( s . startsWith ( "snapshot" ) ) { childType = Type . SNAPSHOTS ; } else if ( s . startsWith ( "packages" ) ) { childType = Type . PACKAGES ; } else if ( s . startsWith ( "globalarea" ) ) { childType = Type . GLOBALS ; } else { childType = Type . PACKAGE ; } break ; case SNAPSHOTS : childType = Type . SNAPSHOT_PACKAGE ; break ; case SNAPSHOT_PACKAGE : childType = Type . SNAPSHOT ; break ; default : childType = Type . PACKAGE ; } o = new TreeParent ( s , childType ) ; } else { o = new TreeObject ( s , Type . RESOURCE ) ; } o . setGuvnorRepository ( rep ) ; o . setResourceProps ( resProps ) ; node . addChild ( o ) ; collector . add ( o , monitor ) ; } } monitor . worked ( 1 ) ; } catch ( WebDavException e ) { if ( e . getErrorCode ( ) == IResponse . SC_UNAUTHORIZED ) { PlatformUtils . reportAuthenticationFailure ( ) ; } else { if ( e . getErrorCode ( ) == IResponse . SC_NOT_IMPLEMENTED ) { Activator . getDefault ( ) . displayMessage ( IStatus . ERROR , Messages . getString ( "rep.connect.fail" ) ) ; // $ NON - NLS - 1 $
} else { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; } } } catch ( ConnectException ce ) { Activator . getDefault ( ) . displayMessage ( IStatus . ERROR , Messages . getString ( "rep.connect.fail" ) ) ; // $ NON - NLS - 1 $
} catch ( Exception e ) { Activator . getDefault ( ) . displayError ( IStatus . ERROR , e . getMessage ( ) , e , true ) ; }


signature:
public class TreeParent { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . model . IWorkbenchAdapter # getParent ( java . lang . Object ) */
public Object getParent ( Object o ) { } }

implementation: if ( o instanceof TreeObject ) { return ( ( TreeObject ) o ) . getParent ( ) ; } else { return null ; }


signature:
public class Activator { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . plugin . AbstractUIPlugin # start ( org . osgi . framework . BundleContext ) */
public void start ( BundleContext context ) throws Exception { } }

implementation: super . start ( context ) ; plugin = this ; getWorkspace ( ) . addResourceChangeListener ( rcListner ) ;


signature:
public class Activator { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . plugin . AbstractUIPlugin # stop ( org . osgi . framework . BundleContext ) */
public void stop ( BundleContext context ) throws Exception { } }

implementation: plugin = null ; super . stop ( context ) ; getWorkspace ( ) . removeResourceChangeListener ( rcListner ) ;


signature:
public class Activator { /** * Returns an image descriptor for the image file at the given
 * plug - in relative path
 * @ param path the path
 * @ return the image descriptor */
public static ImageDescriptor getImageDescriptor ( String id ) { } }

implementation: ImageDescriptor retVal = getDefault ( ) . getImageRegistry ( ) . getDescriptor ( id ) ; if ( retVal == null ) { retVal = loadImageDescriptor ( id ) ; getDefault ( ) . getImageRegistry ( ) . put ( id , retVal ) ; } return retVal ;


signature:
public class HttpClient { /** * Adds the given proxy server exception pattern to this client .
 * Origin servers whose hostname match the pattern do not communicate
 * through the defualt proxy server . The pattern must contain zero or
 * one stars ( * ) . A star must appear at either the beginning or the
 * end of the pattern . A star matches zero or more characters . The
 * following are valid patterns :
 * < ul >
 * < li > www . company . com : 80 < / li >
 * < li > * . company . com < / li >
 * < li > www . company . * < / li >
 * < / ul >
 * @ param pattern a proxy server exception pattern , for example :
 * " * . company . com " .
 * @ see # getDefaultProxyServerUrl ( )
 * @ see # getProxyServerExceptions ( )
 * @ see # getProxyServerUrl ( URL )
 * @ see # removeProxyServerException ( String )
 * @ see # setDefaultProxyServerUrl ( URL )
 * @ see # setProxyServerUrl ( URL , URL ) */
public void addProxyServerException ( String pattern ) { } }

implementation: Assert . isNotNull ( pattern ) ; proxyServerExceptions . put ( pattern , pattern ) ;


signature:
public class HttpClient { /** * Returns the context for the origin server at the given
 * < code > URL < / code > .
 * @ param originServerUrl the < code > URL < / code > of an origin server
 * @ return the context for the origin server at the given
 * < code > URL < / code >
 * @ see # getDefaultContext ( )
 * @ see # setDefaultContext ( Context )
 * @ see # setContext ( URL , Context ) */
public IContext getContext ( URL originServerUrl ) { } }

implementation: Assert . isNotNull ( originServerUrl ) ; return ( IContext ) contexts . get ( originServerUrl ) ;


signature:
public class HttpClient { /** * Returns an < code > Enumeration < / code > over the origin server
 * < code > URL < / code > s known to this client . The known origin server
 * < code > URL < / code > s are gleaned from this client ' s mapped contexts and
 * mapped proxy server < code > URL < / code > s .
 * @ return an < code > Enumeration < / code > over the origin server
 * < code > URL < / code > s known to this client
 * @ see # getContext ( URL )
 * @ see # setContext ( URL , Context )
 * @ see # getProxyServerUrl ( URL )
 * @ see # setProxyServerUrl ( URL , URL ) */
public Enumeration getOriginServerUrls ( ) { } }

implementation: final Enumeration enum1 = contexts . keys ( ) ; final Enumeration enum2 = proxyServerUrls . keys ( ) ; Enumeration e = new Enumeration ( ) { public boolean hasMoreElements ( ) { return enum1 . hasMoreElements ( ) || enum2 . hasMoreElements ( ) ; } public Object nextElement ( ) { if ( enum1 . hasMoreElements ( ) ) return enum1 . nextElement ( ) ; return enum2 . nextElement ( ) ; } } ; return e ;


signature:
public class HttpClient { /** * Returns the < code > URL < / code > of the proxy server that the origin
 * server at the given < code > URL < / code > uses , or < code > null < / code > if
 * no proxy server is used .
 * @ param originServerUrl the < code > URL < code > of an origin server
 * @ return the < code > URL < / code > of a proxy server , or < code > null < / code >
 * @ see # addProxyServerException ( String )
 * @ see # getDefaultProxyServerUrl ( )
 * @ see # getProxyServerExceptions ( )
 * @ see # removeProxyServerException ( String )
 * @ see # setDefaultProxyServerUrl ( URL )
 * @ see # setProxyServerUrl ( URL , URL ) */
public URL getProxyServerUrl ( URL originServerUrl ) { } }

implementation: Assert . isNotNull ( originServerUrl ) ; return ( URL ) proxyServerUrls . get ( originServerUrl ) ;


signature:
public class HttpClient { /** * Sends the given request to the server and returns the server ' s
 * response .
 * @ param request the request to send to the server
 * @ return the server ' s response
 * @ throws IOException if an I / O error occurs . Reasons include :
 * < ul >
 * < li > The client is closed .
 * < li > The client could not connect to the server
 * < li > An I / O error occurs while communicating with the server
 * < ul > */
public Response invoke ( Request request ) throws IOException { } }

implementation:
Assert . isNotNull ( request ) ; try { open ( ) ; URL resourceUrl = request . getResourceUrl ( ) ; URL originServerUrl = new URL ( resourceUrl . getProtocol ( ) , resourceUrl . getHost ( ) , resourceUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
URL proxyServerUrl = getProxyServerUrl ( originServerUrl ) ; if ( proxyServerUrl == null && ! matchesProxyServerException ( originServerUrl ) ) { proxyServerUrl = getDefaultProxyServerUrl ( ) ; } IContext context = webDAVFactory . newContext ( request . getContext ( ) ) ; IContext defaultContext = getContext ( originServerUrl ) ; if ( defaultContext == null ) { defaultContext = getDefaultContext ( ) ; } if ( defaultContext != null ) { Enumeration e = defaultContext . keys ( ) ; while ( e . hasMoreElements ( ) ) { String key = ( String ) e . nextElement ( ) ; context . put ( key , defaultContext . get ( key ) ) ; } } if ( authority != null ) { authority . authorize ( request , null , context , proxyServerUrl , true ) ; authority . authorize ( request , null , context , proxyServerUrl , false ) ; } return invoke1 ( request , context , proxyServerUrl , originServerUrl , 0 , 0 ) ; } finally { request . close ( ) ; }


signature:
public class HttpClient { /** * Set the context for the origin server at the given < code > URL < / code > .
 * If the given context is < code > null < / code > , the context for the
 * specified origin server is removed .
 * @ param originServerUrl the < code > URL < / code > of an origin server
 * @ param context the context for the specified origin server
 * @ see # getContext ( URL )
 * @ see # getDefaultContext ( )
 * @ see # setDefaultContext ( Context ) */
public void setContext ( URL originServerUrl , IContext context ) { } }

implementation: Assert . isNotNull ( originServerUrl ) ; if ( context == null ) contexts . remove ( originServerUrl ) ; else contexts . put ( originServerUrl , context ) ;


signature:
public class HttpClient { /** * Sets the < code > URL < / code > of the proxy server that this client uses
 * to communicate with the origin server at the given < code > URL < / code > .
 * If the proxy server < code > URL < / code > is < code > null < / code > , the
 * default proxy server is used if the specified origin server does not
 * match a proxy server exception pattern .
 * @ param originServerUrl the < code > URL < / code > of on origin server
 * @ param proxyServerUrl the < code > URL < / code > of a proxy server , or
 * < code > null < / code >
 * @ see # addProxyServerException ( String )
 * @ see # getDefaultProxyServerUrl ( )
 * @ see # getProxyServerExceptions ( )
 * @ see # getProxyServerUrl ( URL )
 * @ see # removeProxyServerException ( String )
 * @ see # setDefaultProxyServerUrl ( URL ) */
public void setProxyServerUrl ( URL originServerUrl , URL proxyServerUrl ) { } }

implementation: Assert . isNotNull ( originServerUrl ) ; if ( proxyServerUrl == null ) proxyServerUrls . remove ( originServerUrl ) ; else proxyServerUrls . put ( originServerUrl , proxyServerUrl ) ;


signature:
public class HttpConnection { /** * Returns this connection ' s < code > InputStream < / code > .
 * @ return this connection ' s < code > InputStream < / code >
 * @ exception IOException if an I / O error occurs while sending the
 * request */
public InputStream getInputStream ( ) throws IOException { } }

implementation:
if ( is != null ) return is ; sendRequest ( ) ; String transferEncoding = responseHeader . getFieldValue ( "Transfer-Encoding" ) ; // $ NON - NLS - 1 $
String contentLength = responseHeader . getFieldValue ( "Content-Length" ) ; // $ NON - NLS - 1 $
if ( "chunked" . equalsIgnoreCase ( transferEncoding ) ) { // $ NON - NLS - 1 $
is = new ChunkedInputStream ( ) ; } else if ( method . equals ( "HEAD" ) && statusCode == HTTP_OK ) { // $ NON - NLS - 1 $
is = new LimitedInputStream ( 0 ) ; } else if ( contentLength != null ) { try { is = new LimitedInputStream ( Integer . parseInt ( contentLength ) ) ; } catch ( NumberFormatException e ) { throw new IOException ( e . getMessage ( ) ) ; } } else if ( ( statusCode >= 100 && statusCode < 200 ) || statusCode == HTTP_NO_CONTENT || statusCode == HTTP_NOT_MODIFIED ) { is = new LimitedInputStream ( 0 ) ; } else { closeConnection = true ; is = socketIn ; } return is ;


signature:
public class HttpConnection { /** * Returns this connection ' s < code > OutputStream < / code > .
 * @ return this connection ' s < code > OutputStream < / code >
 * @ exception IOException if an I / O error occurs while sending the
 * request */
public OutputStream getOutputStream ( ) throws IOException { } }

implementation:
if ( os != null ) return os ; String contentLength = requestHeader . getFieldValue ( "Content-Length" ) ; // $ NON - NLS - 1 $
if ( sendChunked && httpVersion > 1.0 ) { os = new ChunkedOutputStream ( ) ; } else if ( contentLength != null ) { try { os = new LimitedOutputStream ( Integer . parseInt ( contentLength ) ) ; } catch ( NumberFormatException e ) { throw new IOException ( Policy . bind ( "exception.malformedContentLength" ) ) ; // $ NON - NLS - 1 $
} } else { os = new CachedOutputStream ( ) ; return os ; } sendRequest ( ) ; return os ;


signature:
public class HttpConnection { /** * Returns the request header value associated with the given field name ,
 * or < code > null < / code > if there is no such field name .
 * @ param fieldName the request header field name
 * @ return the request header value associated with the given field name
 * @ see # setRequestHeaderField ( String , String ) */
public String getRequestHeaderFieldValue ( String fieldName ) { } }

implementation: Assert . isNotNull ( fieldName ) ; return requestHeader . getFieldValue ( fieldName ) ;


signature:
public class HttpConnection { /** * Returns the response header field name at the given position , or
 * < code > null < / code > if there is no field name at that position .
 * @ param position a position in the response header greater than or
 * equal to zero
 * @ return the response header field name at the given postion
 * @ exception IOException if an I / O error occurs while sending the
 * request
 * @ see # getResponseHeaderFieldValue ( int )
 * @ see # getResponseHeaderFieldValue ( String ) */
public String getResponseHeaderFieldName ( int position ) throws IOException { } }

implementation: Assert . isTrue ( position >= 0 ) ; sendRequest ( ) ; return responseHeader . getFieldName ( position ) ;


signature:
public class HttpConnection { /** * Returns the response header field value at the given position , or
 * < code > null < / code > if there is no value at that position .
 * @ param position a position in the response header greater than or
 * equal to zero
 * @ return the response header field value at the given postion
 * @ exception IOException if an I / O error occurs while sending the
 * request
 * @ see # getResponseHeaderFieldName ( int )
 * @ see # getResponseHeaderFieldValue ( String ) */
public String getResponseHeaderFieldValue ( int position ) throws IOException { } }

implementation: Assert . isTrue ( position >= 0 ) ; sendRequest ( ) ; return responseHeader . getFieldValue ( position ) ;


signature:
public class HttpConnection { /** * Returns the response header field value that is associated with the
 * given field name , or < code > null < / code > if there is no value associated
 * with that field name .
 * @ param fieldName the name of a response header field
 * @ return the response header field value that is associated with the
 * given field name
 * @ exception IOException if an I / O error occurs while sending the
 * request
 * @ see # getResponseHeaderFieldValue ( int )
 * @ see # getResponseHeaderFieldName ( int ) */
public String getResponseHeaderFieldValue ( String fieldName ) throws IOException { } }

implementation: Assert . isNotNull ( fieldName ) ; sendRequest ( ) ; return responseHeader . getFieldValue ( fieldName ) ;


signature:
public class HttpConnection { /** * Sets the < code > URL < / code > of the proxy server this connection uses to
 * communicate with the origin server . If < code > null < / code > is given , no
 * proxy server is used .
 * @ param proxyServerUrl the < code > URL < / code > of a proxy server
 * @ see # getProxyServerUrl ( ) */
public void setProxyServerUrl ( URL proxyServerUrl ) { } }

implementation:
endRequest ( ) ; if ( proxyServerUrl == null && this . proxyServerUrl == null ) return ; boolean closeConnection = true ; if ( proxyServerUrl != null && this . proxyServerUrl != null ) { URL oldProxyServerUrl = null ; URL newProxyServerUrl = null ; try { oldProxyServerUrl = new URL ( this . proxyServerUrl . getProtocol ( ) , this . proxyServerUrl . getHost ( ) , this . proxyServerUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
newProxyServerUrl = new URL ( proxyServerUrl . getProtocol ( ) , proxyServerUrl . getHost ( ) , proxyServerUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { // ignore or log ?
} if ( oldProxyServerUrl . equals ( newProxyServerUrl ) ) { closeConnection = false ; } } if ( closeConnection ) { try { close ( ) ; } catch ( IOException e ) { // ignore or log ?
} } this . proxyServerUrl = proxyServerUrl ;


signature:
public class HttpConnection { /** * Sets the request header value associated with the given field .
 * @ param fieldName the request header field
 * @ param fieldValue the request header value
 * @ see # getRequestHeaderFieldValue ( String ) */
public void setRequestHeaderField ( String fieldName , String fieldValue ) { } }

implementation: Assert . isNotNull ( fieldName ) ; Assert . isNotNull ( fieldValue ) ; endRequest ( ) ; requestHeader . addField ( fieldName , fieldValue ) ;


signature:
public class HttpConnection { /** * Sets the < code > URL < / code > of this connection ' s resource .
 * @ param resourceUrl the < code > URL < / code > of this connection ' s resource
 * @ see # getResourceUrl ( ) */
public void setResourceUrl ( URL resourceUrl ) { } }

implementation:
Assert . isNotNull ( resourceUrl ) ; endRequest ( ) ; URL oldOriginServerUrl = null ; URL newOriginServerUrl = null ; try { oldOriginServerUrl = new URL ( this . resourceUrl . getProtocol ( ) , this . resourceUrl . getHost ( ) , this . resourceUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
newOriginServerUrl = new URL ( resourceUrl . getProtocol ( ) , resourceUrl . getHost ( ) , resourceUrl . getPort ( ) , "/" ) ; // $ NON - NLS - 1 $
} catch ( MalformedURLException e ) { // ignore ?
} if ( ! oldOriginServerUrl . equals ( newOriginServerUrl ) ) { try { close ( ) ; } catch ( IOException e ) { // ignore ?
} } this . resourceUrl = resourceUrl ;


signature:
public class HttpConnection { /** * Sets the factory this connection uses to create sockets . If the given
 * socket factory is < code > null < / code > the default socket is used .
 * @ param socketFactory the factory this connection uses to create
 * sockets */
public void setSocketFactory ( ISocketFactory socketFactory ) { } }

implementation:
endRequest ( ) ; if ( socketFactory == this . socketFactory ) return ; try { close ( ) ; } catch ( IOException e ) { // ignore ?
} this . socketFactory = socketFactory ;


signature:
public class NewDroolsProjectWizard { /** * Create the sample rule launcher file . */
private void createRuleSampleLauncher ( IJavaProject project ) throws JavaModelException , IOException { } }

implementation: Version version = startPage . getRuntime ( ) . getVersion ( ) ; if ( version . getMajor ( ) == 4 ) { createProjectJavaFile ( project , "org/drools/eclipse/wizard/project/RuleLauncherSample_4.java.template" , "DroolsTest.java" ) ; } else if ( version . getMajor ( ) == 5 ) { createProjectJavaFile ( project , "org/drools/eclipse/wizard/project/RuleLauncherSample_5.java.template" , "DroolsTest.java" ) ; } else if ( version . getMajor ( ) >= 6 ) { createProjectJavaFile ( project , "org/drools/eclipse/wizard/project/RuleLauncherSample_6.java.template" , "DroolsTest.java" ) ; }


signature:
public class NewDroolsProjectWizard { /** * Create the sample rule file . */
private void createRule ( IJavaProject project , IProgressMonitor monitor ) throws CoreException { } }

implementation: if ( startPage . getRuntime ( ) . getVersion ( ) . getMajor ( ) >= 6 ) { FileUtils . createFolder ( project , "src/main/resources/com/sample/rules" , monitor ) ; createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/Sample.drl.template" , "src/main/resources/com/sample/rules" , "Sample.drl" ) ; } else { createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/Sample.drl.template" , "src/main/rules" , "Sample.drl" ) ; }


signature:
public class NewDroolsProjectWizard { /** * Create the sample RuleFlow file . */
private void createRuleFlow ( IJavaProject project , IProgressMonitor monitor ) throws CoreException { } }

implementation: Version version = startPage . getRuntime ( ) . getVersion ( ) ; if ( version . getMajor ( ) == 4 ) { createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/ruleflow_4.rf.template" , "src/main/rules" , "ruleflow.rf" ) ; createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/ruleflow_4.rfm.template" , "src/main/rules" , "ruleflow.rfm" ) ; createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/ruleflow_4.drl.template" , "src/main/rules" , "ruleflow.drl" ) ; } else if ( version . getMajor ( ) == 5 && version . getMinor ( ) == 0 ) { createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/ruleflow.rf.template" , "src/main/rules" , "ruleflow.rf" ) ; } else if ( version . getMajor ( ) == 5 ) { createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/sample.bpmn.template" , "src/main/rules" , "sample.bpmn" ) ; } else { FileUtils . createFolder ( project , "src/main/resources/com/sample/process" , monitor ) ; createProjectFile ( project , monitor , "org/drools/eclipse/wizard/project/sample.bpmn.template" , "src/main/resources/com/sample/process" , "sample.bpmn" ) ; }


signature:
public class NewDroolsProjectWizard { /** * Create the sample RuleFlow launcher file . */
private void createRuleFlowSampleLauncher ( IJavaProject project ) throws JavaModelException , IOException { } }

implementation: String s ; Version version = startPage . getRuntime ( ) . getVersion ( ) ; if ( version . getMajor ( ) == 4 ) { s = "org/drools/eclipse/wizard/project/RuleFlowLauncherSample_4.java.template" ; } else if ( version . getMajor ( ) == 5 && version . getMinor ( ) == 0 ) { s = "org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template" ; } else if ( version . getMajor ( ) == 5 ) { s = "org/drools/eclipse/wizard/project/ProcessLauncherSample_bpmn_5.java.template" ; } else { s = "org/drools/eclipse/wizard/project/ProcessLauncherSample_bpmn_6.java.template" ; } createProjectJavaFile ( project , s , "ProcessTest.java" ) ;


signature:
public class NewDroolsProjectWizard { /** * / * ( non - Javadoc )
 * @ see org . kie . eclipse . wizard . project . AbstractKieProjectWizard # createStartPage ( java . lang . String )
 * Create the Wizard Start Page */
@ Override protected IKieProjectWizardPage createStartPage ( String pageId ) { } }

implementation: return new AbstractKieProjectStartWizardPage ( pageId ) { @ Override public String getTitle ( ) { return "Create New Drools Project" ; } } ;


signature:
public class IUTreeViewer { /** * Returns only the installable units that are features , ignoring feature groups .
 * @ return */
public List < IInstallableUnit > getSelectedIUs ( ) { } }

implementation: List < IInstallableUnit > result = new ArrayList < IInstallableUnit > ( ) ; for ( Object o : getCheckedElements ( ) ) { if ( o instanceof IUTreeItem ) { IUTreeItem item = ( IUTreeItem ) o ; if ( item . parent != null ) result . add ( item . iu ) ; } } return result ;


signature:
public class AddAction { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . IActionDelegate # run ( org . eclipse . jface . action . IAction ) */
public void run ( IAction action ) { } }

implementation: assert ( targetPart != null && selectedItems != null ) ; AddResourceWizard wiz = new AddResourceWizard ( ) ; wiz . init ( Activator . getDefault ( ) . getWorkbench ( ) , selectedItems ) ; WizardDialog dialog = new WizardDialog ( targetPart . getSite ( ) . getShell ( ) , wiz ) ; dialog . create ( ) ; if ( dialog . open ( ) == WizardDialog . OK ) { PlatformUtils . refreshRepositoryView ( ) ; }


signature:
public class GenericModelEditor { /** * Writes the content of this editor to the given stream .
 * Possible formats are for example SWT . IMAGE _ BMP , IMAGE _ GIF ,
 * IMAGE _ JPEG , IMAGE _ PNG .
 * @ param stream
 * @ param format */
public void createImage ( OutputStream stream , int format ) { } }

implementation: SWTGraphics g = null ; GC gc = null ; Image image = null ; LayerManager layerManager = ( LayerManager ) getGraphicalViewer ( ) . getEditPartRegistry ( ) . get ( LayerManager . ID ) ; IFigure figure = layerManager . getLayer ( LayerConstants . PRINTABLE_LAYERS ) ; Rectangle r = figure . getBounds ( ) ; try { image = new Image ( Display . getDefault ( ) , r . width , r . height ) ; gc = new GC ( image ) ; g = new SWTGraphics ( gc ) ; g . translate ( r . x * - 1 , r . y * - 1 ) ; figure . paint ( g ) ; ImageLoader imageLoader = new ImageLoader ( ) ; imageLoader . data = new ImageData [ ] { image . getImageData ( ) } ; imageLoader . save ( stream , format ) ; } catch ( Throwable t ) { DroolsEclipsePlugin . log ( t ) ; } finally { if ( g != null ) { g . dispose ( ) ; } if ( gc != null ) { gc . dispose ( ) ; } if ( image != null ) { image . dispose ( ) ; } }


signature:
public class NestedHashtable { /** * Copy all the default values into the receiver . */
public void collapse ( ) { } }

implementation: if ( defaults != null ) { Enumeration keysEnum = defaults . keys ( ) ; while ( keysEnum . hasMoreElements ( ) ) { Object key = keysEnum . nextElement ( ) ; localValues . put ( key , defaults . get ( key ) ) ; } defaults = null ; }


signature:
public class NestedHashtable { /** * Return the value for the given key .
 * @ param key the key to look up
 * @ return the value for the key or null if none . */
public Object get ( Object key ) { } }

implementation: Object value = localValues . get ( key ) ; if ( value == null && defaults != null ) return defaults . get ( key ) ; return value ;


signature:
public class NestedHashtable { /** * Return an enumeration over the context ' s keys . ( recursively computes the
 * keys based on keys defaults as well )
 * @ return an enumeration over the context keys */
public Enumeration keys ( ) { } }

implementation: if ( defaults == null ) return localValues . keys ( ) ; return new MergedEnumeration ( localValues . keys ( ) , defaults . keys ( ) ) ;


signature:
public class UpdateAction { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . IActionDelegate # run ( org . eclipse . jface . action . IAction ) */
@ SuppressWarnings ( "unchecked" ) public void run ( IAction action ) { } }

implementation: assert ( selectedItems != null ) ; for ( Iterator it = selectedItems . iterator ( ) ; it . hasNext ( ) ; ) { Object oneItem = it . next ( ) ; if ( oneItem instanceof IFile ) { processUpdate ( ( IFile ) oneItem ) ; } } PlatformUtils . updateDecoration ( ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # loadAdapter ( java . lang . Class , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public Object loadAdapter ( Class adapter , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . loadAdapter ( adapter , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # canModifyModules ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . wst . server . core . IModule [ ] , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IStatus canModifyModules ( IModule [ ] add , IModule [ ] remove , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . canModifyModules ( add , remove , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # getAttribute ( java . lang . String , java . lang . String ) */
@ Override public String getAttribute ( String attributeName , String defaultValue ) { } }

implementation:
// TODO Auto - generated method stub
return server . getAttribute ( attributeName , defaultValue ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # getAttribute ( java . lang . String , java . util . Map ) */
@ Override public Map getAttribute ( String attributeName , Map defaultValue ) { } }


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # getChildModules ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IModule [ ] getChildModules ( IModule [ ] module , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . getChildModules ( module , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServerAttributes # getRootModules ( org . eclipse . wst . server . core . IModule , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IModule [ ] getRootModules ( IModule module , IProgressMonitor monitor ) throws CoreException { } }

implementation:
// TODO Auto - generated method stub
return server . getRootModules ( module , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # publish ( int , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IStatus publish ( int kind , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . publish ( kind , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # publish ( int , java . util . List , org . eclipse . core . runtime . IAdaptable , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void publish ( int kind , List < IModule [ ] > modules , IAdaptable info , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . publish ( kind , modules , info , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # start ( java . lang . String , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public void start ( String launchMode , IProgressMonitor monitor ) throws CoreException { } }

implementation:
// TODO Auto - generated method stub
server . start ( launchMode , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # start ( java . lang . String , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void start ( String launchMode , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . start ( launchMode , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # restart ( java . lang . String , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public void restart ( String launchMode , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
server . restart ( launchMode , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # restart ( java . lang . String , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void restart ( String launchMode , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . restart ( launchMode , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # canControlModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IStatus canControlModule ( IModule [ ] module , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . canControlModule ( module , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # canRestartModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IStatus canRestartModule ( IModule [ ] module , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . canRestartModule ( module , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # canPublishModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public IStatus canPublishModule ( IModule [ ] module , IProgressMonitor monitor ) { } }

implementation:
// TODO Auto - generated method stub
return server . canPublishModule ( module , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # startModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void startModule ( IModule [ ] module , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . startModule ( module , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # stopModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void stopModule ( IModule [ ] module , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . stopModule ( module , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # restartModule ( org . eclipse . wst . server . core . IModule [ ] , org . eclipse . wst . server . core . IServer . IOperationListener ) */
@ Override public void restartModule ( IModule [ ] module , IOperationListener listener ) { } }

implementation:
// TODO Auto - generated method stub
server . restartModule ( module , listener ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # getLaunchConfiguration ( boolean , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public ILaunchConfiguration getLaunchConfiguration ( boolean create , IProgressMonitor monitor ) throws CoreException { } }

implementation:
// TODO Auto - generated method stub
return server . getLaunchConfiguration ( create , monitor ) ;


signature:
public class ServerProxy { /** * / * ( non - Javadoc )
 * @ see org . eclipse . wst . server . core . IServer # synchronousStart ( java . lang . String , org . eclipse . core . runtime . IProgressMonitor ) */
@ Override public void synchronousStart ( String launchMode , IProgressMonitor monitor ) throws CoreException { } }

implementation:
// TODO Auto - generated method stub
server . synchronousStart ( launchMode , monitor ) ;


signature:
public class AlphaNodeVertex { /** * / * ( non - Javadoc )
 * @ see org . drools . core . reteoo . BaseNodeVertex # getHtml ( ) */
public String getHtml ( ) { } }

implementation:
AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; return NODE_NAME + "
expression : " + mvelConstraint . toString ( ) ; } return NODE_NAME + "
" ;


signature:
public class AlphaNodeVertex { /** * Constraint has field extractor and this method is returning fieldName
 * it .
 * @ return field name */
public String getFieldName ( ) { } }

implementation: AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; InternalReadAccessor accessor = mvelConstraint . getFieldExtractor ( ) ; if ( accessor instanceof ClassFieldReader ) { return ( ( ClassFieldReader ) accessor ) . getFieldName ( ) ; } } return null ;


signature:
public class AlphaNodeVertex { /** * Constraint ' s evaluator string
 * @ return evaluator string */
public String getEvaluator ( ) { } }

implementation: AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; return mvelConstraint . toString ( ) ; } return null ;


signature:
public class AlphaNodeVertex { /** * Constraint field string
 * @ return field string */
public String getValue ( ) { } }

implementation: AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; FieldValue field = mvelConstraint . getField ( ) ; return field != null ? field . toString ( ) : null ; } return null ;


signature:
public class CommitAction { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . IActionDelegate # run ( org . eclipse . jface . action . IAction ) */
@ SuppressWarnings ( "unchecked" ) public void run ( IAction action ) { } }

implementation: assert ( selectedItems != null ) ; for ( Iterator it = selectedItems . iterator ( ) ; it . hasNext ( ) ; ) { Object oneSelection = it . next ( ) ; if ( oneSelection instanceof IFile ) { GuvnorMetadataUtils . commitFileChanges ( ( IFile ) oneSelection ) ; } } PlatformUtils . updateDecoration ( ) ;


signature:
public class CommitAction { /** * ( non - Javadoc )
 * @ see org . eclipse . ui . IActionDelegate # selectionChanged ( org . eclipse . jface . action . IAction , org . eclipse . jface . viewers . ISelection ) */
public void selectionChanged ( IAction action , ISelection selection ) { } }

implementation: boolean validResourceSet = ActionUtils . checkResourceSet ( selection , true ) && ActionUtils . areFilesDirty ( selection ) ; if ( validResourceSet ) { action . setEnabled ( true ) ; selectedItems = ( IStructuredSelection ) selection ; } else { action . setEnabled ( false ) ; selectedItems = null ; }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # setSessionAuthenticator ( org . eclipse . webdav . http . client . IAuthenticator ) */
public void setSessionAuthenticator ( IAuthenticator sessionAuthen ) { } }

implementation: if ( sessionAuthen != null ) { client . getHttpClient ( ) . setAuthenticator ( sessionAuthen ) ; } else { client . getHttpClient ( ) . setAuthenticator ( platformAuthenticator ) ; }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # createContext ( ) */
public IContext createContext ( ) { } }

implementation:
IContext context = WebDAVFactory . contextFactory . newContext ( ) ; // Need to make sure the USER - AGENT header is present for Guvnor
context . put ( "USER-AGENT" , "guvnor" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
return context ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # listDirectory ( java . lang . String ) */
public Map < String , ResourceProperties > listDirectory ( String path ) throws Exception { } }

implementation:
IResponse response = null ; try { IContext context = createContext ( ) ; context . put ( "Depth" , "1" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
ILocator locator = WebDAVFactory . locatorFactory . newLocator ( path ) ; response = client . propfind ( locator , context , null ) ; if ( response . getStatusCode ( ) != IResponse . SC_MULTI_STATUS ) { throw new WebDavException ( response ) ; } Map < String , ResourceProperties > res = StreamProcessingUtils . parseListing ( path , response . getInputStream ( ) ) ; addGuvnorResourceProperties ( res , path ) ; return res ; } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # queryProperties ( java . lang . String ) */
public ResourceProperties queryProperties ( String resource ) throws Exception { } }

implementation:
IResponse response = null ; try { IContext context = createContext ( ) ; context . put ( "Depth" , "1" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; response = client . propfind ( locator , context , null ) ; if ( response . getStatusCode ( ) != IResponse . SC_MULTI_STATUS && response . getStatusCode ( ) != IResponse . SC_OK ) { throw new WebDavException ( response ) ; } Map < String , ResourceProperties > props = StreamProcessingUtils . parseListing ( "" , response . getInputStream ( ) ) ; // $ NON - NLS - 1 $
if ( props . keySet ( ) . size ( ) != 1 ) { throw new Exception ( props . keySet ( ) . size ( ) + " entries found for " + resource ) ; // $ NON - NLS - 1 $
} String fullpath = props . keySet ( ) . iterator ( ) . next ( ) ; ResourceProperties res = props . get ( fullpath ) ; String filename = new Path ( fullpath ) . lastSegment ( ) ; addGuvnorResourceProperties ( res , filename , resource ) ; return res ; } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class WebDavClient { /** * Adds Guvnor - specific resource properties to the collection .
 * @ param props The resource properties colleciton
 * @ param filename The name of the resource
 * @ param resource The full path to the resource in Guvnor
 * @ throws Exception */
private void addGuvnorResourceProperties ( ResourceProperties props , String filename , String resource ) throws Exception { } }

implementation:
if ( props == null ) { return ; } IResponse response = null ; try { String path = resource . substring ( 0 , resource . lastIndexOf ( '/' ) ) ; String apiVer = changeToAPICall ( path ) ; Properties guvProps = new Properties ( ) ; response = getResourceInputStream ( apiVer ) ; guvProps . load ( response . getInputStream ( ) ) ; String val = guvProps . getProperty ( filename ) ; if ( val != null ) { StringTokenizer tokens = new StringTokenizer ( val , "," ) ; // $ NON - NLS - 1 $
// String dateStamp = tokens . nextToken ( ) ;
// String revision = tokens . nextToken ( ) ;
if ( tokens . hasMoreElements ( ) ) { props . setLastModifiedDate ( tokens . nextToken ( ) ) ; } if ( tokens . hasMoreElements ( ) ) { props . setRevision ( tokens . nextToken ( ) ) ; } } else { Exception nfe = new Exception ( "Failed to get Guvnor properties for " + filename ) ; // $ NON - NLS - 1 $
Activator . getDefault ( ) . writeLog ( IStatus . WARNING , nfe . getMessage ( ) , nfe ) ; } } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # getResourceContents ( java . lang . String ) */
public String getResourceContents ( String resource ) throws Exception { } }

implementation: IResponse response = null ; try { response = getResourceInputStream ( resource ) ; return StreamProcessingUtils . getStreamContents ( response . getInputStream ( ) ) ; } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # getResourceVersionContents ( java . lang . String , java . lang . String ) */
public String getResourceVersionContents ( String resource , String version ) throws Exception { } }

implementation:
String apiVer = changeToAPICall ( resource ) + "?version=" + version ; // $ NON - NLS - 1 $
return getResourceContents ( apiVer ) ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # getInputStream ( java . lang . String ) */
public IResponse getResourceInputStream ( String resource ) throws Exception { } }

implementation: ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; IResponse response = client . get ( locator , createContext ( ) ) ; if ( response . getStatusCode ( ) != IResponse . SC_OK ) { throw new WebDavException ( response ) ; } return response ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # getResourceVersionInputStream ( java . lang . String , java . lang . String ) */
public IResponse getResourceVersionInputStream ( String resource , String version ) throws Exception { } }

implementation:
String apiVer = changeToAPICall ( resource ) + "?version=" + version ; // $ NON - NLS - 1 $
return getResourceInputStream ( apiVer ) ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # createResource ( java . lang . String , java . io . InputStream ) */
public boolean createResource ( String resource , InputStream is ) throws Exception { } }

implementation: return createResource ( resource , is , true ) ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # createResource ( java . lang . String , java . io . InputStream , boolean ) */
public boolean createResource ( String resource , InputStream is , boolean overwrite ) throws Exception { } }

implementation: boolean res = true ; if ( ! overwrite ) { try { if ( queryProperties ( resource ) != null ) { res = false ; } } catch ( WebDavException e ) { if ( e . getErrorCode ( ) != IResponse . SC_NOT_FOUND ) { throw e ; } } } IResponse response = null ; try { if ( res ) { ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; response = client . put ( locator , createContext ( ) , is ) ; if ( response . getStatusCode ( ) != IResponse . SC_OK && response . getStatusCode ( ) != IResponse . SC_CREATED ) { throw new WebDavException ( response ) ; } } } finally { if ( response != null ) { response . close ( ) ; } } return res ;


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # putResource ( java . lang . String , java . io . InputStream ) */
public void putResource ( String resource , InputStream is ) throws Exception { } }

implementation: IResponse response = null ; try { ILocator locator = WebDAVFactory . locatorFactory . newLocator ( resource ) ; response = client . put ( locator , createContext ( ) , is ) ; if ( response . getStatusCode ( ) != IResponse . SC_OK && response . getStatusCode ( ) != IResponse . SC_NO_CONTENT && response . getStatusCode ( ) != IResponse . SC_CREATED ) { throw new WebDavException ( response ) ; } } finally { if ( response != null ) { response . close ( ) ; } }


signature:
public class WebDavClient { /** * ( non - Javadoc )
 * @ see org . guvnor . tools . utils . webdav . IWebDavClient # getResourceVersions ( java . lang . String ) */
public IResponse getResourceVersions ( String resource ) throws Exception { } }

implementation:
String apiVer = changeToAPICall ( resource ) + "?version=all" ; // $ NON - NLS - 1 $
return getResourceInputStream ( apiVer ) ;