Input: Helper method to close a response from the server . <p > Note that the argument MAY be <code > null< / code > in which case the call has no effect . < / p > [CODESPLIT] protected void closeResponse ( IResponse response ) throws SystemException { if ( response == null ) return ; try { response . close ( ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } }


Input: Make a copy of this resource and place it at the location defined by the given locator . <p > Uses default values of depth : infinity and overwrite : false for the copy . < / p > [CODESPLIT] public void copy ( ILocator destination ) throws DAVException { copy ( destination , IContext . DEPTH_INFINITY , false , null ) ; }


Input: Make a copy of this resource and place it at the location specified by the given destination locator . [CODESPLIT] public void copy ( ILocator destination , String depth , boolean overwrite , Collection propertyNames ) throws DAVException { // Define the request context. IContext context = newContext ( ) ; context . setDepth ( depth ) ; context . setOverwrite ( overwrite ) ; // Set up the request body to specify which properties should be kept alive. Document document = newDocument ( ) ; PropertyBehavior propertyBehavior = PropertyBehavior . create ( document ) ; if ( propertyNames == null ) propertyBehavior . setIsKeepAllAlive ( true ) ; else { Iterator namesItr = propertyNames . iterator ( ) ; while ( namesItr . hasNext ( ) ) { QualifiedName name = ( QualifiedName ) namesItr . next ( ) ; String nameURI = name . getQualifier ( ) + "/" + name . getLocalName ( ) ; //$NON-NLS-1$ propertyBehavior . addProperty ( nameURI ) ; } // end-while } // end-if // Call the server to perform the copy. IResponse response = null ; try { response = davClient . copy ( locator , destination , context , document ) ; examineResponse ( response ) ; examineMultiStatusResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: If the given response contains a multistatus body the bodies status are checked for errors . If an error is found an exception is thrown . [CODESPLIT] protected void examineMultiStatusResponse ( IResponse response ) throws DAVException { // If it is not a multistatus we don't look at it. if ( response . getStatusCode ( ) != IResponse . SC_MULTI_STATUS ) return ; // It is declared a multistatus, so if there is no response body // then that is a problem. if ( ! response . hasDocumentBody ( ) ) throw new DAVException ( Policy . bind ( "exception.responseMustHaveDocBody" ) ) ; //$NON-NLS-1$ // Extract the XML document from the response. Element documentElement ; try { documentElement = response . getDocumentBody ( ) . getDocumentElement ( ) ; if ( documentElement == null ) throw new DAVException ( Policy . bind ( "exception.invalidDoc" ) ) ; //$NON-NLS-1$ } catch ( IOException exception ) { throw new SystemException ( exception ) ; } // Enumerate all the responses in the multistat and check that // they are indicating success (i.e. are 200-series response codes). try { MultiStatus multistatus = new MultiStatus ( documentElement ) ; Enumeration responseEnum = multistatus . getResponses ( ) ; while ( responseEnum . hasMoreElements ( ) ) { ResponseBody responseBody = ( ResponseBody ) responseEnum . nextElement ( ) ; Enumeration propstatEnum = responseBody . getPropStats ( ) ; while ( propstatEnum . hasMoreElements ( ) ) { PropStat propstat = ( PropStat ) propstatEnum . nextElement ( ) ; examineStatusCode ( propstat . getStatusCode ( ) , propstat . getResponseDescription ( ) ) ; } // end-while } // end-while } catch ( MalformedElementException e ) { throw new SystemException ( e ) ; } }


Input: Helper method to extract the property status response from a multi status reponse and populate a URLTable with the results . [CODESPLIT] protected URLTable extractPropStats ( MultiStatus multiStatus ) throws IOException , MalformedElementException { // Construct a URLTable to return to the user. URLTable reply = new URLTable ( ) ; // For each response (resource). Enumeration responses = multiStatus . getResponses ( ) ; while ( responses . hasMoreElements ( ) ) { ResponseBody responseBody = ( ResponseBody ) responses . nextElement ( ) ; String href = responseBody . getHref ( ) ; // The href may be relative to the request URL. URL resourceURL = new URL ( new URL ( locator . getResourceURL ( ) ) , href ) ; Hashtable properties = new Hashtable ( ) ; reply . put ( resourceURL , properties ) ; // For each property status grouping. Enumeration propstats = responseBody . getPropStats ( ) ; while ( propstats . hasMoreElements ( ) ) { PropStat propstat = ( PropStat ) propstats . nextElement ( ) ; org . eclipse . webdav . dom . Status status = new org . eclipse . webdav . dom . Status ( propstat . getStatus ( ) ) ; // For each property with this status. Enumeration elements = propstat . getProp ( ) . getProperties ( ) ; while ( elements . hasMoreElements ( ) ) { Element element = ( Element ) elements . nextElement ( ) ; QualifiedName name = ElementEditor . getQualifiedName ( element ) ; // Add a property status object to the result set. PropertyStatus propertyStatus = new PropertyStatus ( element , status . getStatusCode ( ) , status . getStatusMessage ( ) ) ; properties . put ( name , propertyStatus ) ; } // end-while } // end-while } // end-while return reply ; }


Input: Return the content of this resource as an input stream . The input stream should be closed by the user . [CODESPLIT] public ResponseInputStream getContent ( ) throws DAVException { IResponse response = null ; try { response = davClient . get ( locator , newContext ( ) ) ; examineResponse ( response ) ; } catch ( IOException e ) { closeResponse ( response ) ; throw new SystemException ( e ) ; } return new ResponseInputStream ( response ) ; }


Input: Return an Enumeration over ActiveLocks which lists the locks currently held on this resource . Return an empty enumeration if the lock discovery property is not found on the resource . [CODESPLIT] public Enumeration getLocks ( ) throws DAVException { LockDiscovery lockdiscovery = null ; try { Element element = getProperty ( DAV_LOCK_DISCOVERY ) . getProperty ( ) ; lockdiscovery = new LockDiscovery ( element ) ; return lockdiscovery . getActiveLocks ( ) ; } catch ( WebDAVException exception ) { if ( exception . getStatusCode ( ) == IResponse . SC_NOT_FOUND ) return new EmptyEnumeration ( ) ; throw exception ; } catch ( MalformedElementException elemException ) { throw new SystemException ( elemException ) ; } }


Input: Returns a collection handle for the parent of this resource . <p > Note that this method does NOT perform a method call to the server to ensure that the collection exists . < / p > <p > Returns <code > null< / code > if this resource is the root . [CODESPLIT] public CollectionHandle getParent ( ) throws DAVException { Assert . isTrue ( locator . getLabel ( ) == null ) ; Assert . isTrue ( ! locator . isStable ( ) ) ; try { URL url = URLTool . getParent ( locator . getResourceURL ( ) ) ; if ( url == null ) return null ; String parentName = url . toString ( ) ; ILocator parentLocator = davClient . getDAVFactory ( ) . newLocator ( parentName ) ; return new CollectionHandle ( davClient , parentLocator ) ; } catch ( MalformedURLException e ) { throw new SystemException ( e ) ; } }


Input: Fetches and returns the specified properties for this resource and its children to the given depth . The returned table is a URLTable of hashtables . The keys in the first table are the <code > URL< / code > s of the resources . The nested table is a table where the keys are the names ( <code > QualifiedName< / code > ) of the properties and the values are the properties values ( <code > PropertyStatus< / code > ) . [CODESPLIT] public URLTable getProperties ( Collection propertyNames , String depth ) throws DAVException { // Set up the request context. IContext context = newContext ( ) ; context . setDepth ( depth ) ; // Set up the request body. Document document = newDocument ( ) ; PropFind propfind = PropFind . create ( document ) ; // null is a special value meaning 'all properties'. if ( propertyNames == null ) propfind . setIsAllProp ( true ) ; else { // Add all the property names to the request body. Prop prop = propfind . setProp ( ) ; Iterator namesItr = propertyNames . iterator ( ) ; while ( namesItr . hasNext ( ) ) prop . addPropertyName ( ( QualifiedName ) namesItr . next ( ) ) ; } // Were ready to make the server call. IResponse response = null ; try { // This contacts the server. response = davClient . propfind ( locator , context , document ) ; examineResponse ( response ) ; // Create a multi-status element editor on the response. if ( ! response . hasDocumentBody ( ) ) throw new DAVException ( Policy . bind ( "exception.respMustShareXMLDoc" ) ) ; //$NON-NLS-1$ Element documentElement = response . getDocumentBody ( ) . getDocumentElement ( ) ; if ( documentElement == null ) throw new DAVException ( Policy . bind ( "exception.respHasInvalidDoc" ) ) ; //$NON-NLS-1$ MultiStatus multiStatus = new MultiStatus ( documentElement ) ; // Construct a URLTable of results to return to the user. return extractPropStats ( multiStatus ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } catch ( MalformedElementException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Return the property status for the property with the given name . [CODESPLIT] public PropertyStatus getProperty ( QualifiedName propertyName ) throws DAVException { Collection names = new HashSet ( ) ; names . add ( propertyName ) ; URLTable result = getProperties ( names , IContext . DEPTH_ZERO ) ; URL url = null ; try { url = new URL ( locator . getResourceURL ( ) ) ; } catch ( MalformedURLException e ) { throw new SystemException ( e ) ; } Hashtable propTable = ( Hashtable ) result . get ( url ) ; if ( propTable == null ) throw new DAVException ( Policy . bind ( "exception.lookup" , url . toExternalForm ( ) ) ) ; //$NON-NLS-1$ return ( PropertyStatus ) propTable . get ( propertyName ) ; }


Input: Fetch and return the property names for the resource and the children resources to the specified depth . Returns <code > URLTable< / code > mapping resource URLs to enumerations over the property names for that resource . [CODESPLIT] public URLTable getPropertyNames ( String depth ) throws DAVException { // create and send the request IContext context = newContext ( ) ; context . setDepth ( depth ) ; IResponse response = null ; try { Document document = newDocument ( ) ; PropFind propfind = PropFind . create ( document ) ; propfind . setIsPropName ( true ) ; response = davClient . propfind ( locator , context , document ) ; examineResponse ( response ) ; if ( ! response . hasDocumentBody ( ) ) { throw new DAVException ( Policy . bind ( "exception.respMustHaveElmtBody" ) ) ; //$NON-NLS-1$ } Element documentElement = response . getDocumentBody ( ) . getDocumentElement ( ) ; if ( documentElement == null ) { throw new DAVException ( Policy . bind ( "exception.bodyMustHaveElmt" ) ) ; //$NON-NLS-1$ } MultiStatus multistatus = new MultiStatus ( documentElement ) ; //construct the URLTable to return to the user URLTable reply = new URLTable ( 10 ) ; Enumeration responses = multistatus . getResponses ( ) ; while ( responses . hasMoreElements ( ) ) { ResponseBody responseBody = ( ResponseBody ) responses . nextElement ( ) ; String href = responseBody . getHref ( ) ; URL resourceUrl = new URL ( new URL ( locator . getResourceURL ( ) ) , href ) ; Enumeration propstats = responseBody . getPropStats ( ) ; Vector vector = new Vector ( ) ; while ( propstats . hasMoreElements ( ) ) { PropStat propstat = ( PropStat ) propstats . nextElement ( ) ; Prop prop = propstat . getProp ( ) ; Enumeration names = prop . getPropertyNames ( ) ; while ( names . hasMoreElements ( ) ) { QualifiedName dname = ( QualifiedName ) names . nextElement ( ) ; vector . addElement ( dname ) ; } } reply . put ( resourceUrl , vector . elements ( ) ) ; } return reply ; } catch ( IOException e ) { throw new SystemException ( e ) ; } catch ( MalformedElementException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Retrieve the version tree infomration for the receiver assuming that the receiver is a version or a version - controlled resource . <p > The version tree info comprises a <code > URLTable< / code > whose keys are the <code > URL< / code > s of each version in the version history and whose values are <code > Vector< / code > s of the resource s immediate predecessor <code > URL< / code > s . Note that the root version is ( uniquely ) identified by an empty set of predecessors . < / p > [CODESPLIT] public URLTable getVersionTree ( ) throws DAVException { // Issue a version tree report against the receiver to retrieve // the successor set of all the versions. Document document = newDocument ( ) ; Element root = ElementEditor . create ( document , "version-tree" ) ; //$NON-NLS-1$ Element propElement = ElementEditor . appendChild ( root , "prop" ) ; //$NON-NLS-1$ ElementEditor . appendChild ( propElement , "predecessor-set" ) ; //$NON-NLS-1$ IResponse response = null ; try { // Run the REPORT and check for errors. response = davClient . report ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; if ( ! response . hasDocumentBody ( ) ) throw new DAVException ( Policy . bind ( "exception.respMustHaveElmtBody" ) ) ; //$NON-NLS-1$ // Get the body as a MultiStatus. Element documentElement = response . getDocumentBody ( ) . getDocumentElement ( ) ; if ( documentElement == null ) throw new DAVException ( Policy . bind ( "exception.bodyMustHaveElmt" ) ) ; //$NON-NLS-1$ MultiStatus multistatus = new MultiStatus ( documentElement ) ; // Construct the predecessor table. // This will contain the result. URLTable predecessorTable = new URLTable ( ) ; // For each response. Enumeration responses = multistatus . getResponses ( ) ; while ( responses . hasMoreElements ( ) ) { ResponseBody responseBody = ( ResponseBody ) responses . nextElement ( ) ; // Get the absolute URL of the resource. String href = responseBody . getHref ( ) ; URL resourceURL = new URL ( new URL ( locator . getResourceURL ( ) ) , href ) ; // Add an entry to the predecessor table. Vector predecessors = new Vector ( ) ; predecessorTable . put ( resourceURL , predecessors ) ; // For each propstat. Enumeration propstats = responseBody . getPropStats ( ) ; while ( propstats . hasMoreElements ( ) ) { PropStat propstat = ( PropStat ) propstats . nextElement ( ) ; // We are going to assume that the status is OK, or error out. if ( propstat . getStatusCode ( ) != IResponse . SC_OK ) throw new DAVException ( Policy . bind ( "exception.errorRetrievingProp" ) ) ; //$NON-NLS-1$ // For each property in the prop (there should only be one). Prop prop = propstat . getProp ( ) ; Enumeration elements = prop . getProperties ( ) ; while ( elements . hasMoreElements ( ) ) { Element element = ( Element ) elements . nextElement ( ) ; //  Look explicitly for the DAV:predecessor-set QualifiedName name = ElementEditor . getQualifiedName ( element ) ; if ( name . equals ( DAV_PREDECESSOR_SET ) ) { Enumeration e = new HrefSet ( element , DAV_PREDECESSOR_SET ) . getHrefs ( ) ; while ( e . hasMoreElements ( ) ) { URL predURL = new URL ( ( String ) e . nextElement ( ) ) ; predecessors . add ( predURL ) ; } // end-while } //end-if } // end-while } // end-while } //end-while // Phew, were done. return predecessorTable ; } catch ( IOException e ) { throw new SystemException ( e ) ; } catch ( MalformedElementException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Return the header from a message send to the server . [CODESPLIT] public IContext head ( ) throws DAVException { IResponse response = null ; try { response = davClient . head ( locator , newContext ( ) ) ; examineResponse ( response ) ; return response . getContext ( ) ; } catch ( IOException exception ) { throw new SystemException ( exception ) ; } finally { closeResponse ( response ) ; } }


Input: Lock this resource using the specified parameters . [CODESPLIT] public LockToken lock ( boolean isShared , String depth , int timeout , String owner ) throws DAVException { // Define the request context. IContext context = newContext ( ) ; context . setDepth ( depth ) ; context . setTimeout ( timeout ) ; // Create the request body. Document document = newDocument ( ) ; LockInfo lockinfo = LockInfo . create ( document ) ; lockinfo . setIsShared ( isShared ) ; // Add the owner if it is given. if ( owner != null ) { Owner ownerEditor = lockinfo . setOwner ( ) ; ownerEditor . getElement ( ) . appendChild ( document . createTextNode ( owner ) ) ; } // Send the lock request. IResponse response = null ; try { response = davClient . lock ( locator , context , document ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } // Extract the token from the resulting context. LockToken token = new LockToken ( response . getContext ( ) . getLockToken ( ) ) ; //fServerManager.addLock(newURL(fLocator.getResourceURL()), token, depth); return token ; }


Input: Move this resource to the location specified by the given locator . If a resource already exists at the destination and the overwrite boolean is true then write over top of the existing resource . Otherwise do not . The enumeration is over qualified names which are the names of the properties to move . [CODESPLIT] public void move ( ILocator destination , boolean overwrite , Enumeration names ) throws DAVException { IContext context = newContext ( ) ; context . setOverwrite ( overwrite ) ; Document document = newDocument ( ) ; PropertyBehavior propertyBehavior = PropertyBehavior . create ( document ) ; if ( names == null ) { propertyBehavior . setIsKeepAllAlive ( true ) ; } else { while ( names . hasMoreElements ( ) ) { Object obj = names . nextElement ( ) ; Assert . isTrue ( obj instanceof QualifiedName , Policy . bind ( "assert.propNameMustBeEnumOverQual" ) ) ; //$NON-NLS-1$ // fix this...can we really add property names to href elements? propertyBehavior . addProperty ( ( ( QualifiedName ) obj ) . getLocalName ( ) ) ; } } IResponse response = null ; try { response = davClient . move ( locator , destination , context , document ) ; examineResponse ( response ) ; examineMultiStatusResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Check in the receiver and answer a new Locator on the resulting version resource . [CODESPLIT] protected ILocator protectedCheckIn ( ) throws DAVException { IResponse response = null ; try { response = davClient . checkin ( locator , newContext ( ) , null ) ; examineResponse ( response ) ; String versionUrl = response . getContext ( ) . getLocation ( ) ; return davClient . getDAVFactory ( ) . newStableLocator ( versionUrl ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Check out the receiver and answer a new Locator on the resulting checked out resource . The result MAY be the same as the receiver s Locator if the server did not create a new resource as a consequence of the check out ( i . e . if it was checking out a vesion - controlled resource rather than a version ) . [CODESPLIT] protected ILocator protectedCheckOut ( ) throws DAVException { IResponse response = null ; try { response = davClient . checkout ( locator , newContext ( ) , null ) ; examineResponse ( response ) ; String resourceUrl = response . getContext ( ) . getLocation ( ) ; return davClient . getDAVFactory ( ) . newStableLocator ( resourceUrl ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Refresh the lock on this resource with the given lock token . Use the specified timeout value . [CODESPLIT] public void refreshLock ( LockToken lockToken , int timeout ) throws DAVException { // Set up the request in the context. IContext context = newContext ( ) ; context . setTimeout ( timeout ) ; context . setLockToken ( lockToken . getToken ( ) ) ; // Send the request to the server. IResponse response = null ; try { response = davClient . lock ( locator , context , null ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Remove the properties with the given names from this resource . [CODESPLIT] public void removeProperties ( Collection propertyNames ) throws DAVException { Assert . isNotNull ( propertyNames ) ; // Removing no properties is easy. if ( propertyNames . isEmpty ( ) ) return ; // Add the names of the properties to remove to the request body. Document document = newDocument ( ) ; PropertyUpdate propertyUpdate = PropertyUpdate . create ( document ) ; Prop prop = propertyUpdate . addRemove ( ) ; Iterator namesItr = propertyNames . iterator ( ) ; while ( namesItr . hasNext ( ) ) prop . addPropertyName ( ( QualifiedName ) namesItr . next ( ) ) ; // Send the PROPPATCH request. IResponse response = null ; try { response = davClient . proppatch ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; examineMultiStatusResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Remove the property with the given name from this resource . [CODESPLIT] public void removeProperty ( QualifiedName propertyName ) throws DAVException { Collection propertyNames = new Vector ( 1 ) ; propertyNames . add ( propertyName ) ; removeProperties ( propertyNames ) ; }


Input: Set the content of this resource to be the data stored in the given input stream . The type encoding is given in the content type argument and should be in the media format described by RFC2616 Sec 3 . 7 . The stream will automatically be closed after the data is consumed . If the resource does not exist it is created with the given content . [CODESPLIT] public void setContent ( String contentType , InputStream input ) throws DAVException { IResponse response = null ; try { IContext context = newContext ( ) ; context . setContentType ( contentType ) ; response = davClient . put ( locator , context , input ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Set the given properties on this resource . [CODESPLIT] public void setProperties ( Collection properties ) throws DAVException { Assert . isNotNull ( properties ) ; // Setting no properties is a no-op. if ( properties . isEmpty ( ) ) return ; // Build the request body to describe the properties to set. Document document = newDocument ( ) ; PropertyUpdate propertyUpdate = PropertyUpdate . create ( document ) ; Prop prop = propertyUpdate . addSet ( ) ; Iterator propertiesItr = properties . iterator ( ) ; while ( propertiesItr . hasNext ( ) ) { Element element = ( Element ) propertiesItr . next ( ) ; try { prop . addProperty ( element ) ; } catch ( MalformedElementException exception ) { throw new SystemException ( exception ) ; } } // end-while // Send the request to the server and examine the response for failures. IResponse response = null ; try { response = davClient . proppatch ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; examineMultiStatusResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Set the given property on this resource . [CODESPLIT] public void setProperty ( Element property ) throws DAVException { Collection properties = new Vector ( 1 ) ; properties . add ( property ) ; setProperties ( properties ) ; }


Input: Unlock this resource with the given lock token . [CODESPLIT] public void unlock ( LockToken token ) throws DAVException { // Send the lock token in the header of the request. IContext context = newContext ( ) ; context . setLockToken ( "<" + token . getToken ( ) + ">" ) ; //$NON-NLS-1$ //$NON-NLS-2$ IResponse response = null ; try { response = davClient . unlock ( locator , context ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Perform an UPDATE on the receiver to set the version it is based upon . [CODESPLIT] public void update ( ILocator version ) throws DAVException { Document document = newDocument ( ) ; Update . createVersion ( document , version . getResourceURL ( ) ) ; IResponse response = null ; try { response = davClient . update ( locator , newContext ( ) , document ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Bring the receiver under version control . This means that the receiver is replaced by a version - controlled resource . Note that the client may send version control to a resource that is already under version control with no adverse effects . [CODESPLIT] public void versionControl ( ) throws DAVException { IResponse response = null ; try { response = davClient . versionControl ( locator , newContext ( ) , null ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } }


Input: Delete this resource from the repository optionally succeeding in the delete if the resource was not found on the server . [CODESPLIT] public void delete ( boolean mustExist ) throws DAVException { IResponse response = null ; try { response = davClient . delete ( locator , newContext ( ) ) ; if ( ! mustExist && ( response . getStatusCode ( ) == IResponse . SC_NOT_FOUND ) ) return ; examineResponse ( response ) ; examineMultiStatusResponse ( response ) ; } catch ( IOException exception ) { throw new SystemException ( exception ) ; } finally { closeResponse ( response ) ; } }


Input: Check the given status code and throw a WebDAV exception if the code indicates failure . If the code is success this method does nothing . [CODESPLIT] protected void examineStatusCode ( int code , String message ) throws WebDAVException { if ( code >= 300 && code <= 399 ) throw new RedirectionException ( code , message ) ; if ( code >= 400 && code <= 499 ) throw new ClientException ( code , message ) ; if ( code >= 500 && code <= 599 ) throw new ServerException ( code , message ) ; }


Input: Return a boolean value indicating whether or not this resource exists on the server . <p > This implementation uses the HTTP HEAD method so the URL may or may not exist in the DAV namespace . The DAV RESOURCE_TYPE property is NOT checked . < / p > [CODESPLIT] public boolean exists ( ) throws DAVException { // Test existance by issuing a HEAD request. IResponse response = null ; try { response = davClient . head ( locator , newContext ( ) ) ; // If the resource was not found, then that answers the question. if ( response . getStatusCode ( ) == IResponse . SC_NOT_FOUND ) return false ; // Otherwise check for errors. examineResponse ( response ) ; // No problems by this point, so the resource is there and OK. return true ; } catch ( IOException exception ) { throw new SystemException ( exception ) ; } finally { closeResponse ( response ) ; } }


Input: Check to see if the resource is a working resource . <p > The resource is a working resource if it has &lt ; DAV : checked - out&gt ; and does not have &lt ; DAV : auto - checkout&gt ; in the &lt ; DAV : supported - live - properties - set&gt ; . < / p > [CODESPLIT] public boolean isWorkingResource ( ) throws DAVException { PropertyStatus propertyStat = getProperty ( DAV_SUPPORTED_LIVE_PROPERTY_SET ) ; // If the live-property-set is not supported, then the answer is 'no'. if ( propertyStat . getStatusCode ( ) == IResponse . SC_NOT_FOUND ) return false ; // If there was a problem getting the live property set, throw an exception. examineStatusCode ( propertyStat . getStatusCode ( ) , propertyStat . getStatusMessage ( ) ) ; // Check to see if the required properties are/are not in the supported set. try { Element propertySet = propertyStat . getProperty ( ) ; return ( ( ElementEditor . hasChild ( propertySet , DAV_CHECKED_OUT ) ) && ! ( ElementEditor . hasChild ( propertySet , DAV_AUTO_CHECKOUT ) ) ) ; } catch ( MalformedElementException exception ) { throw new SystemException ( exception ) ; } }


Input: This is a helper method to check to see if the resource has a property with the given name that in turn has a child with a given name . [CODESPLIT] protected boolean propertyHasChild ( QualifiedName propertyName , QualifiedName childName ) throws DAVException { // If the property is not found, then the answer is 'no'. PropertyStatus propertyStat = getProperty ( propertyName ) ; if ( propertyStat . getStatusCode ( ) == IResponse . SC_NOT_FOUND ) return false ; // If there was a problem getting the property, throw an exception. examineStatusCode ( propertyStat . getStatusCode ( ) , propertyStat . getStatusMessage ( ) ) ; // Check to see if the named child is in the retrieved property. try { return ElementEditor . hasChild ( propertyStat . getProperty ( ) , childName ) ; } catch ( MalformedElementException exception ) { throw new SystemException ( exception ) ; } }


Input: Adds the specified binding to this editor s bindings element . The given href and segment must not be <code > null< / code > . [CODESPLIT] public void addBinding ( String href , String segment ) { Assert . isNotNull ( href ) ; Assert . isNotNull ( segment ) ; appendChild ( root , "href" , encodeHref ( href ) ) ; //$NON-NLS-1$ appendChild ( root , "segment" , segment ) ; //$NON-NLS-1$ }


Input: Returns an <code > Enumeration< / code > over this bindings <code > Binding< / code > s . [CODESPLIT] public Enumeration getBindings ( ) throws MalformedElementException { 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 ; }


Input: Answer a DOM <code > Element< / code > that represents a set of <code > String< / code > . <p > 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 > . [CODESPLIT] public Element newDAVElementSet ( QualifiedName setName , QualifiedName memberName , Enumeration memberEnum ) { Element setElement = newDAVElement ( setName ) ; while ( memberEnum . hasMoreElements ( ) ) { String member = ( String ) memberEnum . nextElement ( ) ; Element memberElement = newDAVTextElement ( memberName , member ) ; setElement . appendChild ( memberElement ) ; } return setElement ; }


Input: / * ( non - Javadoc ) [CODESPLIT] protected IFigure createFigure ( ) { Figure f = new FreeformLayer ( ) ; f . setBorder ( new MarginBorder ( 3 ) ) ; f . setLayoutManager ( new FreeformLayout ( ) ) ; return f ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void propertyChange ( PropertyChangeEvent evt ) { String prop = evt . getPropertyName ( ) ; if ( ReteGraph . PROP_CHILD_ADDED . equals ( prop ) || ReteGraph . PROP_CHILD_REMOVED . equals ( prop ) ) { refreshChildren ( ) ; } }


Input: Returns the content length of this message s body or - 1 if the content length is unknown . [CODESPLIT] public long getContentLength ( ) { long contentLength = super . getContentLength ( ) ; if ( contentLength != - 1 ) return contentLength ; if ( requestBodyWriter == null ) return ( ( RequestInputStream ) is ) . length ( ) ; return - 1 ; }


Input: Writes this request s body to the given output stream . This method may be called more than once during the lifetime of this request . [CODESPLIT] public void write ( OutputStream os ) throws IOException { if ( requestBodyWriter == null ) { if ( inputRead ) { is . reset ( ) ; inputRead = false ; } super . write ( os ) ; } else { requestBodyWriter . writeRequestBody ( os ) ; } }


Input: Converts the given byte array to its equivalent hexadecimal string and returns the result . [CODESPLIT] public static String toHex ( byte [ ] arr ) { 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 ( ) ; }


Input: Converts the given int array to its equivalent hexadecimal string and returns the result . [CODESPLIT] public static String toHex ( int [ ] arr ) { 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 ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void inputChanged ( Viewer v , Object oldInput , Object newInput ) { if ( v instanceof AbstractTreeViewer ) { viewer = ( AbstractTreeViewer ) v ; manager = new DeferredTreeContentManager ( this , viewer ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public Object [ ] getElements ( Object parent ) { if ( parent . equals ( viewer ) ) { if ( invisibleRoot == null ) initialize ( ) ; return getChildren ( invisibleRoot ) ; } return getChildren ( parent ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public Object getParent ( Object child ) { if ( child instanceof TreeObject ) { return ( ( TreeObject ) child ) . getParent ( ) ; } return null ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public Object [ ] getChildren ( Object parent ) { if ( parent == invisibleRoot ) { return ( ( TreeParent ) invisibleRoot ) . getChildren ( ) ; } else if ( parent instanceof TreeParent ) { return manager . getChildren ( parent ) ; } return new Object [ 0 ] ; }


Input: 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 . [CODESPLIT] public static PropFind create ( Document document ) { 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 ; } }


Input: Returns <code > true< / code > iff this propfind is in the all prop form . [CODESPLIT] public boolean isAllProp ( ) throws MalformedElementException { 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 ; }


Input: Sets whether this propfind is in the all prop form . [CODESPLIT] public void setIsAllProp ( boolean isAllProp ) { 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 ) ; }


Input: Sets whether this propfind is in the prop name form . [CODESPLIT] public void setIsPropName ( boolean isPropName ) { 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 ) ; }


Input: 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 . [CODESPLIT] public Prop setProp ( ) { 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. } }


Input: Looks behind gets stuff after the white space . Basically ripping out the last word . [CODESPLIT] public static String stripLastWord ( String prefix ) { 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 ; } }


Input: 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 [CODESPLIT] public static String getCompilableText ( String backText ) { 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 ; } }


Input: / * propertyname extraction and bean convention methods names checks [CODESPLIT] public static boolean isGetter ( String methodName , int argCount , String returnedType ) { return isAccessor ( methodName , argCount , 0 , "get" , returnedType , Signature . SIG_VOID , false ) ; }


Input: 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 [CODESPLIT] public static String getPropertyName ( String methodName , int parameterCount , String returnType ) { 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 ; }


Input: 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 [CODESPLIT] public static String getWritablePropertyName ( String methodName , int parameterCount , String returnType ) { 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 ; }


Input: Determine if the given method is a bean accessor ( ie getter / setter ) [CODESPLIT] private static boolean isAccessor ( String methodName , int actualParameterCount , int requiredParameterCount , String prefix , String returnType , String requiredReturnType , boolean includeType ) { //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 ; }


Input: COMPENSATES FOR LACK OF getSimpleName IN java . lang . Class Borrowed and adpated from MVEL s org . mvel . util . ParseTools . getSimpleClassName ( Class ) [CODESPLIT] public static String getSimpleClassName ( Class < ? > cls ) { 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 ) ; } }


Input: Updates the outline page . [CODESPLIT] public void update ( ) { 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 ) ; } } }


Input: Returns the content length of this message s body or - 1 if the content length is unknown . [CODESPLIT] public long getContentLength ( ) { long contentLength = context . getContentLength ( ) ; if ( contentLength != - 1 ) return contentLength ; if ( is instanceof ByteArrayInputStream ) return ( ( ByteArrayInputStream ) is ) . available ( ) ; return - 1 ; }


Input: Writes this messages body to the given output stream . This method may only be called once during the lifetime of this message . [CODESPLIT] public void write ( OutputStream os ) throws IOException { 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 ; } }


Input: I don t see the need for any of this custom stepOver stuff why is it here? [CODESPLIT] public synchronized void stepOver ( ) throws DebugException { // 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 ) ; } }


Input: This will create markers for parse errors . Parse errors mean that antlr has picked up some major typos in the input source . [CODESPLIT] protected void markParseErrors ( List < DroolsBuildMarker > markers , List < BaseKnowledgeBuilderResultImpl > parserErrors ) { 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 ( ) ) ) ; } } }


Input: This will create markers for build errors that happen AFTER parsing . [CODESPLIT] private void markOtherErrors ( List < DroolsBuildMarker > markers , DroolsError [ ] buildErrors ) { // 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 ) ) ; } } }


Input: Skips the next character in s if it matches c otherwise a <code > ParserException< / code > is thrown . [CODESPLIT] public void match ( char c ) throws ParserException { checkPosition ( ) ; if ( s . charAt ( pos ) != c ) throw new ParserException ( ) ; ++ pos ; }


Input: 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 . [CODESPLIT] public String nextQuotedString ( ) throws ParserException { int start = pos ; match ( ' ' ) ; checkPosition ( ) ; while ( s . charAt ( pos ) != ' ' ) { ++ pos ; checkPosition ( ) ; } match ( ' ' ) ; return s . substring ( start , pos ) ; }


Input: Returns the next token in s . Throws a <code > ParserException< / code > if the next substring in s is not a token . [CODESPLIT] public String nextToken ( ) throws ParserException { 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 ) ; }


Input: Skips the next sequence of white space in s . An exception is not thrown if there is no matching white space . [CODESPLIT] public void skipWhiteSpace ( ) { while ( pos < s . length ( ) && Character . isWhitespace ( s . charAt ( pos ) ) ) ++ pos ; }


Input: Finds the local Guvnor metadata file associated with a given resource . [CODESPLIT] public static IFile findGuvnorMetadata ( IResource resource ) { 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 ; }


Input: Adds a resource to Guvnor . [CODESPLIT] public static boolean addResourceToGuvnor ( String repLoc , String targetLoc , IFile selectedFile ) { 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 ; }


Input: Commits changes to Guvnor . [CODESPLIT] public static void commitFileChanges ( IFile selectedFile ) { 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 ) ; } }


Input: Finds the local Guvnor metadata file associated with a given resource . [CODESPLIT] public static IFile findGuvnorMetadata ( IPath resource ) { 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 ; }


Input: Copy all the default values into the receiver . [CODESPLIT] public void collapse ( ) { if ( defaults != null ) { Enumeration keysEnum = defaults . keys ( ) ; while ( keysEnum . hasMoreElements ( ) ) { String key = ( String ) keysEnum . nextElement ( ) ; put ( key , get ( key ) ) ; } defaults = null ; } }


Input: Return the value for the given key . [CODESPLIT] public String get ( String key ) { String value = ( String ) properties . get ( new ContextKey ( key ) ) ; if ( value == null && defaults != null ) return defaults . get ( key ) ; return value ; }


Input: 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 . [CODESPLIT] public int getAge ( ) { String ageString = get ( AGE ) ; return ( ageString == null ) ? - 1 : Integer . parseInt ( ageString ) ; }


Input: 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 . [CODESPLIT] public long getContentLength ( ) { String lengthString = get ( CONTENT_LENGTH ) ; return ( lengthString == null ) ? - 1 : Long . parseLong ( lengthString ) ; }


Input: Return the integer value for the MAX_FORWARDS key . [CODESPLIT] public int getMaxForwards ( ) { String s = get ( MAX_FORWARDS ) ; return s == null ? - 1 : Integer . parseInt ( s ) ; }


Input: Get the flag that indicates if copy or move should overwrite an existing destination . Return the boolean value for the OVERWRITE key . [CODESPLIT] public boolean getOverwrite ( ) { String overwriteString = get ( OVERWRITE ) ; return overwriteString == null ? false : overwriteString . equalsIgnoreCase ( "T" ) ; //$NON-NLS-1$ }


Input: Return the boolean value for the PASSTHROUGH key . [CODESPLIT] public boolean getPassthrough ( ) { String s = get ( PASSTHROUGH ) ; return s == null ? false : s . equalsIgnoreCase ( "T" ) ; //$NON-NLS-1$ }


Input: 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 . [CODESPLIT] public int getTimeout ( ) { 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 ; }


Input: Return an enumeration over the context s keys . ( recursively computes the keys based on keys defaults as well ) [CODESPLIT] public Enumeration keys ( ) { 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 ( ) ; }


Input: Put the given key - value pair into the context . [CODESPLIT] public void put ( String key , String value ) { ContextKey ckey = new ContextKey ( key ) ; if ( ( value == null ) || ( value . length ( ) == 0 ) ) properties . remove ( ckey ) ; else properties . put ( ckey , value ) ; }


Input: 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 . [CODESPLIT] public void setTimeout ( int value ) { if ( value == - 1 ) put ( TIMEOUT , "" ) ; //$NON-NLS-1$ else put ( TIMEOUT , ( value == - 2 ) ? DEPTH_INFINITY : "Second-" + Integer . toString ( value ) ) ; //$NON-NLS-1$ }


Input: method will create a BufferedReader to read the file . [CODESPLIT] protected BufferedReader openDSLFile ( String filename ) { try { FileReader reader = new FileReader ( filename ) ; BufferedReader breader = new BufferedReader ( reader ) ; return breader ; } catch ( IOException e ) { e . printStackTrace ( ) ; return null ; } }


Input: method will use the BufferedReader to read the contents of the file . It calls other methods to parse the line and build the tree . [CODESPLIT] protected void parseFile ( BufferedReader reader ) { 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 ( ) ; } }


Input: method will strip out the when then * at the beginning of each line and the mapped drl expression [CODESPLIT] protected String stripHeadingAndCode ( String text ) { 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 ; } }


Input: Method will return just the object metadata [CODESPLIT] protected String getObjMetadata ( String text ) { if ( text . startsWith ( "[" ) ) { return text . substring ( 1 , text . lastIndexOf ( "]" ) ) ; } else { return "" ; } }


Input: method will strip the metadata from the text string [CODESPLIT] protected String stripObjMetadata ( String text ) { if ( text . startsWith ( "[" ) ) { return text . substring ( text . lastIndexOf ( "]" ) + 1 ) ; } else { return text ; } }


Input: 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 . [CODESPLIT] public void addTokens ( String metadata , StringTokenizer tokens ) { Node mnode = this . rootCond . addToken ( metadata ) ; Node thenode = mnode ; while ( tokens . hasMoreTokens ( ) ) { Node newnode = thenode . addToken ( tokens . nextToken ( ) ) ; thenode = newnode ; } }


Input: method adds the token to root [CODESPLIT] public void addTokens ( String [ ] tokens , Node rootNode ) { Node thenode = rootNode ; for ( int i = 0 ; i < tokens . length ; i ++ ) { Node newnode = thenode . addToken ( tokens [ i ] ) ; thenode = newnode ; } }


Input: 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 . [CODESPLIT] public Node [ ] getConditionChildren ( String text ) { 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 ) ; }


Input: the method expects the caller to pass the object [CODESPLIT] public Node [ ] getChildren ( String obj , String text ) { 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 ) ; }


Input: 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 [CODESPLIT] public ArrayList < String > getConditionChildrenList ( String text , boolean addChildren ) { 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 ; }


Input: 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 [CODESPLIT] public ArrayList < String > getConsequenceChildrenList ( String text , boolean addChildren ) { 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 ; }


Input: method will prepend the parent text to the child and generate the possible combinations in text format . [CODESPLIT] public void addChildToList ( Node n , String prefix , ArrayList < String > list ) { 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 ) ; } } }


Input: The method will print the DSLTree to System . out in text format . [CODESPLIT] public void printTree ( ) { System . out . println ( "ROOT" ) ; for ( Node n : rootCond . getChildren ( ) ) { printNode ( n ) ; } }


Input: method will print the node and then iterate over the children [CODESPLIT] protected void printNode ( Node n ) { printTabs ( n . getDepth ( ) ) ; System . out . println ( "- \"" + n . getToken ( ) + "\"" ) ; for ( Node c : n . getChildren ( ) ) { printNode ( c ) ; } }


Input: Method will print n number of tabs [CODESPLIT] protected void printTabs ( int count ) { for ( int idx = 0 ; idx < count ; idx ++ ) { System . out . print ( tab ) ; } }


Input: Reads a JSON value from the given string . [CODESPLIT] public static JsonValue readFrom ( String text ) { try { return new JsonParser ( text ) . parse ( ) ; } catch ( IOException exception ) { // JsonParser does not throw IOException for String throw new RuntimeException ( exception ) ; } }


Input: Returns a JsonValue instance that represents the given <code > float< / code > value . [CODESPLIT] public static JsonValue valueOf ( float value ) { 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 ) ) ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void fetchDeferredChildren ( Object object , IElementCollector collector , IProgressMonitor monitor ) { 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 ) ; } }


Input: Creates a directory listing . [CODESPLIT] public void listDirectory ( TreeParent node , IElementCollector collector , IProgressMonitor monitor ) { 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 ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public Object getParent ( Object o ) { if ( o instanceof TreeObject ) { return ( ( TreeObject ) o ) . getParent ( ) ; } else { return null ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void start ( BundleContext context ) throws Exception { super . start ( context ) ; plugin = this ; getWorkspace ( ) . addResourceChangeListener ( rcListner ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void stop ( BundleContext context ) throws Exception { plugin = null ; super . stop ( context ) ; getWorkspace ( ) . removeResourceChangeListener ( rcListner ) ; }


Input: Returns an image descriptor for the image file at the given plug - in relative path [CODESPLIT] public static ImageDescriptor getImageDescriptor ( String id ) { ImageDescriptor retVal = getDefault ( ) . getImageRegistry ( ) . getDescriptor ( id ) ; if ( retVal == null ) { retVal = loadImageDescriptor ( id ) ; getDefault ( ) . getImageRegistry ( ) . put ( id , retVal ) ; } return retVal ; }


Input: 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 > [CODESPLIT] public void addProxyServerException ( String pattern ) { Assert . isNotNull ( pattern ) ; proxyServerExceptions . put ( pattern , pattern ) ; }


Input: Returns the context for the origin server at the given <code > URL< / code > . [CODESPLIT] public IContext getContext ( URL originServerUrl ) { Assert . isNotNull ( originServerUrl ) ; return ( IContext ) contexts . get ( originServerUrl ) ; }


Input: 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 . [CODESPLIT] public Enumeration getOriginServerUrls ( ) { 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 ; }


Input: 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 . [CODESPLIT] public URL getProxyServerUrl ( URL originServerUrl ) { Assert . isNotNull ( originServerUrl ) ; return ( URL ) proxyServerUrls . get ( originServerUrl ) ; }


Input: Sends the given request to the server and returns the server s response . [CODESPLIT] public Response invoke ( Request request ) throws IOException { 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 ( ) ; } }


Input: 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 . [CODESPLIT] public void setContext ( URL originServerUrl , IContext context ) { Assert . isNotNull ( originServerUrl ) ; if ( context == null ) contexts . remove ( originServerUrl ) ; else contexts . put ( originServerUrl , context ) ; }


Input: 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 . [CODESPLIT] public void setProxyServerUrl ( URL originServerUrl , URL proxyServerUrl ) { Assert . isNotNull ( originServerUrl ) ; if ( proxyServerUrl == null ) proxyServerUrls . remove ( originServerUrl ) ; else proxyServerUrls . put ( originServerUrl , proxyServerUrl ) ; }


Input: Returns this connection s <code > InputStream< / code > . [CODESPLIT] public InputStream getInputStream ( ) throws IOException { 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 ; }


Input: Returns this connection s <code > OutputStream< / code > . [CODESPLIT] public OutputStream getOutputStream ( ) throws IOException { 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 ; }


Input: Returns the request header value associated with the given field name or <code > null< / code > if there is no such field name . [CODESPLIT] public String getRequestHeaderFieldValue ( String fieldName ) { Assert . isNotNull ( fieldName ) ; return requestHeader . getFieldValue ( fieldName ) ; }


Input: Returns the response header field name at the given position or <code > null< / code > if there is no field name at that position . [CODESPLIT] public String getResponseHeaderFieldName ( int position ) throws IOException { Assert . isTrue ( position >= 0 ) ; sendRequest ( ) ; return responseHeader . getFieldName ( position ) ; }


Input: Returns the response header field value at the given position or <code > null< / code > if there is no value at that position . [CODESPLIT] public String getResponseHeaderFieldValue ( int position ) throws IOException { Assert . isTrue ( position >= 0 ) ; sendRequest ( ) ; return responseHeader . getFieldValue ( position ) ; }


Input: 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 . [CODESPLIT] public String getResponseHeaderFieldValue ( String fieldName ) throws IOException { Assert . isNotNull ( fieldName ) ; sendRequest ( ) ; return responseHeader . getFieldValue ( fieldName ) ; }


Input: 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 . [CODESPLIT] public void setProxyServerUrl ( URL proxyServerUrl ) { 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 ; }


Input: Sets the request header value associated with the given field . [CODESPLIT] public void setRequestHeaderField ( String fieldName , String fieldValue ) { Assert . isNotNull ( fieldName ) ; Assert . isNotNull ( fieldValue ) ; endRequest ( ) ; requestHeader . addField ( fieldName , fieldValue ) ; }


Input: Sets the <code > URL< / code > of this connection s resource . [CODESPLIT] public void setResourceUrl ( URL resourceUrl ) { 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 ; }


Input: Sets the factory this connection uses to create sockets . If the given socket factory is <code > null< / code > the default socket is used . [CODESPLIT] public void setSocketFactory ( ISocketFactory socketFactory ) { endRequest ( ) ; if ( socketFactory == this . socketFactory ) return ; try { close ( ) ; } catch ( IOException e ) { // ignore? } this . socketFactory = socketFactory ; }


Input: Create the sample rule launcher file . [CODESPLIT] private void createRuleSampleLauncher ( IJavaProject project ) throws JavaModelException , IOException { 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" ) ; } }


Input: Create the sample rule file . [CODESPLIT] private void createRule ( IJavaProject project , IProgressMonitor monitor ) throws CoreException { 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" ) ; } }


Input: Create the sample RuleFlow file . [CODESPLIT] private void createRuleFlow ( IJavaProject project , IProgressMonitor monitor ) throws CoreException { 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" ) ; } }


Input: Create the sample RuleFlow launcher file . [CODESPLIT] private void createRuleFlowSampleLauncher ( IJavaProject project ) throws JavaModelException , IOException { 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" ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override protected IKieProjectWizardPage createStartPage ( String pageId ) { return new AbstractKieProjectStartWizardPage ( pageId ) { @ Override public String getTitle ( ) { return "Create New Drools Project" ; } } ; }


Input: Returns only the installable units that are features ignoring feature groups . [CODESPLIT] public List < IInstallableUnit > getSelectedIUs ( ) { 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 ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void run ( IAction action ) { 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 ( ) ; } }


Input: Writes the content of this editor to the given stream . Possible formats are for example SWT . IMAGE_BMP IMAGE_GIF IMAGE_JPEG IMAGE_PNG . [CODESPLIT] public void createImage ( OutputStream stream , int format ) { 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 ( ) ; } } }


Input: Copy all the default values into the receiver . [CODESPLIT] public void collapse ( ) { if ( defaults != null ) { Enumeration keysEnum = defaults . keys ( ) ; while ( keysEnum . hasMoreElements ( ) ) { Object key = keysEnum . nextElement ( ) ; localValues . put ( key , defaults . get ( key ) ) ; } defaults = null ; } }


Input: Return the value for the given key . [CODESPLIT] public Object get ( Object key ) { Object value = localValues . get ( key ) ; if ( value == null && defaults != null ) return defaults . get ( key ) ; return value ; }


Input: Return an enumeration over the context s keys . ( recursively computes the keys based on keys defaults as well ) [CODESPLIT] public Enumeration keys ( ) { if ( defaults == null ) return localValues . keys ( ) ; return new MergedEnumeration ( localValues . keys ( ) , defaults . keys ( ) ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public void run ( IAction action ) { assert ( selectedItems != null ) ; for ( Iterator it = selectedItems . iterator ( ) ; it . hasNext ( ) ; ) { Object oneItem = it . next ( ) ; if ( oneItem instanceof IFile ) { processUpdate ( ( IFile ) oneItem ) ; } } PlatformUtils . updateDecoration ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public Object loadAdapter ( Class adapter , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . loadAdapter ( adapter , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IStatus canModifyModules ( IModule [ ] add , IModule [ ] remove , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . canModifyModules ( add , remove , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public String getAttribute ( String attributeName , String defaultValue ) { // TODO Auto-generated method stub return server . getAttribute ( attributeName , defaultValue ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public Map getAttribute ( String attributeName , Map defaultValue ) { // TODO Auto-generated method stub return server . getAttribute ( attributeName , defaultValue ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IModule [ ] getChildModules ( IModule [ ] module , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . getChildModules ( module , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IModule [ ] getRootModules ( IModule module , IProgressMonitor monitor ) throws CoreException { // TODO Auto-generated method stub return server . getRootModules ( module , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IStatus publish ( int kind , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . publish ( kind , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void publish ( int kind , List < IModule [ ] > modules , IAdaptable info , IOperationListener listener ) { // TODO Auto-generated method stub server . publish ( kind , modules , info , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void start ( String launchMode , IProgressMonitor monitor ) throws CoreException { // TODO Auto-generated method stub server . start ( launchMode , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void start ( String launchMode , IOperationListener listener ) { // TODO Auto-generated method stub server . start ( launchMode , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void restart ( String launchMode , IProgressMonitor monitor ) { // TODO Auto-generated method stub server . restart ( launchMode , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void restart ( String launchMode , IOperationListener listener ) { // TODO Auto-generated method stub server . restart ( launchMode , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IStatus canControlModule ( IModule [ ] module , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . canControlModule ( module , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IStatus canRestartModule ( IModule [ ] module , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . canRestartModule ( module , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public IStatus canPublishModule ( IModule [ ] module , IProgressMonitor monitor ) { // TODO Auto-generated method stub return server . canPublishModule ( module , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void startModule ( IModule [ ] module , IOperationListener listener ) { // TODO Auto-generated method stub server . startModule ( module , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void stopModule ( IModule [ ] module , IOperationListener listener ) { // TODO Auto-generated method stub server . stopModule ( module , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void restartModule ( IModule [ ] module , IOperationListener listener ) { // TODO Auto-generated method stub server . restartModule ( module , listener ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public ILaunchConfiguration getLaunchConfiguration ( boolean create , IProgressMonitor monitor ) throws CoreException { // TODO Auto-generated method stub return server . getLaunchConfiguration ( create , monitor ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void synchronousStart ( String launchMode , IProgressMonitor monitor ) throws CoreException { // TODO Auto-generated method stub server . synchronousStart ( launchMode , monitor ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public String getHtml ( ) { AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; return NODE_NAME + "
expression : " + mvelConstraint . toString ( ) ; } return NODE_NAME + "
" ; }


Input: Constraint has field extractor and this method is returning fieldName it . [CODESPLIT] public String getFieldName ( ) { 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 ; }


Input: Constraint s evaluator string [CODESPLIT] public String getEvaluator ( ) { AlphaNodeFieldConstraint constraint = this . node . getConstraint ( ) ; if ( constraint instanceof MvelConstraint ) { MvelConstraint mvelConstraint = ( MvelConstraint ) constraint ; return mvelConstraint . toString ( ) ; } return null ; }


Input: Constraint field string [CODESPLIT] public String getValue ( ) { 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 ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public void run ( IAction action ) { assert ( selectedItems != null ) ; for ( Iterator it = selectedItems . iterator ( ) ; it . hasNext ( ) ; ) { Object oneSelection = it . next ( ) ; if ( oneSelection instanceof IFile ) { GuvnorMetadataUtils . commitFileChanges ( ( IFile ) oneSelection ) ; } } PlatformUtils . updateDecoration ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void selectionChanged ( IAction action , ISelection selection ) { boolean validResourceSet = ActionUtils . checkResourceSet ( selection , true ) && ActionUtils . areFilesDirty ( selection ) ; if ( validResourceSet ) { action . setEnabled ( true ) ; selectedItems = ( IStructuredSelection ) selection ; } else { action . setEnabled ( false ) ; selectedItems = null ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void setSessionAuthenticator ( IAuthenticator sessionAuthen ) { if ( sessionAuthen != null ) { client . getHttpClient ( ) . setAuthenticator ( sessionAuthen ) ; } else { client . getHttpClient ( ) . setAuthenticator ( platformAuthenticator ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public IContext createContext ( ) { 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 ; }