idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
9,600 | public void addEvent ( LogEvent event ) { try { write ( getString ( event ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } | Add a new event |
9,601 | public static String escapeShell ( final String s ) { if ( null == s ) { return s ; } if ( s . startsWith ( "'" ) && s . endsWith ( "'" ) ) { return s ; } else if ( s . startsWith ( "\"" ) && s . endsWith ( "\"" ) ) { return s . replaceAll ( "([\\\\`])" , "\\\\$1" ) ; } return s . replaceAll ( "([&><|;\\\\`])" , "\\\\$... | Escape characters meaningful to bash shell unless the string is already surrounded in single quotes |
9,602 | public static String escapeWindowsShell ( final String s ) { if ( null == s ) { return s ; } if ( s . startsWith ( "'" ) && s . endsWith ( "'" ) ) { return s ; } else if ( s . startsWith ( "\"" ) && s . endsWith ( "\"" ) ) { return s . replaceAll ( "([`^])" , "^$1" ) ; } return s . replaceAll ( "([&><|;^`])" , "^$1" ) ... | Escape characters meaningful to windows unless the string is already surrounded in single quotes |
9,603 | public static String stringFromProperties ( Properties props ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( 2048 ) ; props . store ( baos , null ) ; String propsString ; propsString = URLEncoder . encode ( baos . toString ( "ISO-8859-1" ) , "ISO-8859-1" ) ; return propsString ; } | Returns the Properties formatted as a String |
9,604 | public static Properties propertiesFromString ( String propString ) throws IOException { Properties props = new Properties ( ) ; String pstring = URLDecoder . decode ( propString , "ISO-8859-1" ) ; props . load ( new ByteArrayInputStream ( pstring . getBytes ( ) ) ) ; return props ; } | Convert a String into a Properties object |
9,605 | public static Collection listPropertiesWithPrefix ( Properties props , String prefix ) { final HashSet set = new HashSet ( ) ; for ( Iterator i = props . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String key = ( String ) i . next ( ) ; if ( key . startsWith ( prefix ) ) { set . add ( props . getProperty ( key ) ... | Returns a Collection of all property values that have keys with a certain prefix . |
9,606 | protected Map < String , Map < String , String > > loadConfigData ( final ExecutionContext context , final Map < String , Object > instanceData , final Map < String , Map < String , String > > localDataContext , final Description description , final String serviceName ) throws ConfigurationException { final PropertyRes... | Loads the plugin configuration values stored in project or framework properties also |
9,607 | protected void loadContentConversionPropertyValues ( final Map < String , String > data , final ExecutionContext context , final List < Property > pluginProperties ) throws ConfigurationException { for ( Property property : pluginProperties ) { String name = property . getName ( ) ; String propValue = data . get ( name... | Looks for properties with content conversion and converts the values |
9,608 | private void convertStoragePathValue ( final Map < String , String > data , final StorageTree storageTree , final String name , final String propValue , final Map < String , Object > renderingOptions ) throws ConfigurationException { String root = null ; if ( null != renderingOptions . get ( StringRenderingConstants . ... | Converts storage path properties by loading the values into the config data . |
9,609 | private void convertPrivateDataValue ( final Map < String , String > data , final DataContext privateDataContext , final String name , final String propValue , final Map < String , Object > renderingOptions ) throws ConfigurationException { boolean clearValue = isValueConversionFailureRemove ( renderingOptions ) ; Stri... | Converts properties that refer to a private data context value |
9,610 | public static ThreadBoundJschLogger getInstance ( final PluginLogger logger , final int loggingLevel ) { getInstance ( ) ; instance . setThreadLogger ( logger , loggingLevel ) ; return instance ; } | Bind to static Jsch logger and return the logger instance |
9,611 | private Set < Resource < T > > filterResources ( Path path , Predicate < Resource > test ) { validatePath ( path ) ; if ( ! hasDirectory ( path ) ) { throw StorageException . listException ( path , "not a directory path: " + path ) ; } File file = filepathMapper . directoryForPath ( path ) ; HashSet < Resource < T > > ... | Return a filtered set of resources |
9,612 | protected Object pathSynch ( Path path ) { Object newref = new Object ( ) ; Object oldref = locks . putIfAbsent ( path . getPath ( ) , newref ) ; return null != oldref ? oldref : newref ; } | Return an object that can be synchronized on for the given path . |
9,613 | private < T > void load ( YamlSourceLoader < T > loader , YamlPolicyCreator < T > creator ) throws IOException { int index = 1 ; try ( final YamlSourceLoader < T > loader1 = loader ) { for ( T yamlDoc : loader1 . loadAll ( ) ) { String ident = identity + "[" + index + "]" ; if ( null == yamlDoc ) { continue ; } try { P... | load yaml stream as sequence of policy documents |
9,614 | public static String getMessageLogLevel ( final int level , final String defLevel ) { switch ( level ) { case ( Constants . ERR_LEVEL ) : return Constants . MSG_ERR ; case ( Constants . DEBUG_LEVEL ) : return Constants . MSG_DEBUG ; case ( Constants . INFO_LEVEL ) : return Constants . MSG_INFO ; case ( Constants . VERB... | Get message loglevel string for the integer value |
9,615 | public static String parentPathString ( String path ) { String [ ] split = componentsFromPathString ( path ) ; if ( split . length > 1 ) { StringBuilder stringBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < split . length - 1 ; i ++ ) { if ( i > 0 ) { stringBuilder . append ( SEPARATOR ) ; } stringBuilder . app... | Return the string representing the parent of the given path |
9,616 | public static String cleanPath ( String path ) { if ( path . endsWith ( SEPARATOR ) ) { path = path . replaceAll ( SEPARATOR + "+$" , "" ) ; } if ( path . startsWith ( SEPARATOR ) ) { path = path . replaceAll ( "^" + SEPARATOR + "+" , "" ) ; } return path . replaceAll ( "/+" , SEPARATOR ) ; } | Clean the path string by removing leading and trailing slashes and removing duplicate slashes . |
9,617 | public static < T extends ContentMeta > ResourceSelector < T > exactMetadataResourceSelector ( final Map < String , String > required , final boolean requireAll ) { return new ResourceSelector < T > ( ) { public boolean matchesContent ( T content ) { for ( String key : required . keySet ( ) ) { String expect = required... | A resource selector which requires metadata values to be equal to some required strings |
9,618 | public static < T extends ContentMeta > ResourceSelector < T > regexMetadataResourceSelector ( final Map < String , String > required , final boolean requireAll ) { return new ResourceSelector < T > ( ) { Map < String , Pattern > patternMap = new HashMap < String , Pattern > ( ) ; private Pattern forString ( String reg... | A resource selector which requires metadata values to match regexes |
9,619 | public static < T extends ContentMeta > ResourceSelector < T > composeSelector ( final ResourceSelector < T > a , final ResourceSelector < T > b , final boolean and ) { return new ResourceSelector < T > ( ) { public boolean matchesContent ( T content ) { boolean a1 = a . matchesContent ( content ) ; if ( a1 && ! and ||... | compose two selectors |
9,620 | public static < T extends ContentMeta > ResourceSelector < T > allResourceSelector ( ) { return new ResourceSelector < T > ( ) { public boolean matchesContent ( T content ) { return true ; } } ; } | A resource selector which always matches |
9,621 | public static Map < String , String > resourceType ( String kind , Map < String , String > meta ) { HashMap < String , String > authResource = new HashMap < String , String > ( ) ; if ( null != meta ) { authResource . putAll ( meta ) ; } authResource . put ( TYPE_FIELD , GENERIC_RESOURCE_TYPE_NAME ) ; authResource . pu... | Return a resource map for a generic resource type |
9,622 | public static Set < Attribute > context ( String key , String value ) { if ( null == key ) { throw new IllegalArgumentException ( "key cannot be null" ) ; } if ( null == value ) { throw new IllegalArgumentException ( "value cannot be null" ) ; } return Collections . singleton ( new Attribute ( URI . create ( Environmen... | Create a singleton context attribute set |
9,623 | public static String contextAsString ( final Set < Attribute > context ) { StringBuilder sb = new StringBuilder ( ) ; for ( Attribute attribute : context ) { if ( sb . length ( ) < 1 ) { sb . append ( "{" ) ; } else { sb . append ( ", " ) ; } sb . append ( Attribute . propertyKeyForURIBase ( attribute , EnvironmentalCo... | Generate a string representation of the context attribute set |
9,624 | protected int runPluginScript ( final PluginStepContext executionContext , final PrintStream outputStream , final PrintStream errorStream , final Framework framework , final Map < String , Object > configuration ) throws IOException , InterruptedException , ConfigurationException { Description pluginDesc = getDescripti... | Runs the script configured for the script plugin and channels the output to two streams . |
9,625 | protected Map < String , Map < String , String > > createStepItemDataContext ( final Framework framework , final String project , final Map < String , Map < String , String > > context , final Map < String , Object > configuration ) { final Map < String , Map < String , String > > localDataContext = createScriptDataCon... | Create a data context containing the plugin values file scriptfile and base as well as all config values . |
9,626 | protected DataContext createScriptDataContext ( final Framework framework , final String project , final Map < String , Map < String , String > > context ) { BaseDataContext localDataContext = new BaseDataContext ( ) ; localDataContext . merge ( ScriptDataContextUtil . createScriptDataContextObjectForProject ( framewor... | create script data context |
9,627 | private ResourceMeta filter ( Path path , ResourceMeta resourceMeta , Operation op ) { ResourceMetaBuilder resourceMetaBuilder = StorageUtil . create ( new HashMap < String , String > ( resourceMeta . getMeta ( ) ) ) ; final HasInputStream result ; switch ( op ) { case READ : case UPDATE : case CREATE : try { if ( op =... | perform appropriate plugin filter method based on the operation enacted |
9,628 | public void parse ( ) throws ResourceXMLParserException , IOException { final EntityResolver resolver = createEntityResolver ( ) ; final SAXReader reader = new SAXReader ( false ) ; reader . setEntityResolver ( resolver ) ; try { final Document doc ; if ( null == this . doc ) { final InputStream in ; if ( null != file ... | Parse the document applying the configured Receiver to the parsed entities |
9,629 | private Entity parseEnt ( final Node node , final EntitySet set ) throws ResourceXMLParserException { final Entity ent = parseResourceRef ( set , node ) ; ent . setResourceType ( node . getName ( ) ) ; parseEntProperties ( ent , node ) ; parseEntSubAttributes ( ent , node ) ; return ent ; } | Given xml Node and EntitySet parse the entity defined in the Node |
9,630 | public HasInputStream readResource ( Path path , ResourceMetaBuilder resourceMetaBuilder , final HasInputStream hasResourceStream ) { if ( wasEncoded ( resourceMetaBuilder ) ) { return decode ( hasResourceStream ) ; } return null ; } | Reads stored data so decodes a base64 stream if the metadata indicates it has been encoded |
9,631 | public static Map < String , String > toStringStringMap ( Map input ) { Map < String , String > map = new HashMap < > ( ) ; for ( Object o : input . keySet ( ) ) { map . put ( o . toString ( ) , input . get ( o ) != null ? input . get ( o ) . toString ( ) : "" ) ; } return map ; } | Convert all values to string via toString |
9,632 | private void loadFileSources ( final File directory , final String project ) { if ( ! directory . isDirectory ( ) ) { logger . warn ( "Not a directory: " + directory ) ; } final Set < String > exts = new HashSet < String > ( framework . getResourceFormatParserService ( ) . listSupportedFileExtensions ( ) ) ; final File... | Discover new files in the directory and add file sources |
9,633 | protected void initOptions ( ) { if ( null != toolOptions && ! optionsHaveInited ) { for ( CLIToolOptions toolOpts : toolOptions ) { toolOpts . addOptions ( options ) ; } optionsHaveInited = true ; } } | initialize any options will apply this for each CLIToolOptions added to the tool . subclasses may override this but should call super |
9,634 | protected String optionDisplayString ( final String opt , boolean extended ) { StringBuffer stringBuffer = new StringBuffer ( ) ; stringBuffer . append ( "-" ) . append ( opt ) ; Option option = getOption ( opt ) ; if ( null != option ) { if ( option . getLongOpt ( ) != null ) { stringBuffer . append ( "/--" ) ; string... | Return a string to display the specified option in help text |
9,635 | public void run ( final String [ ] args ) throws CLIToolException { PropertyConfigurator . configure ( Constants . getLog4jPropertiesFile ( ) . getAbsolutePath ( ) ) ; CommandLine cli = parseArgs ( args ) ; validateOptions ( cli , args ) ; go ( ) ; } | Run the tool s lifecycle given the input arguments . |
9,636 | public CommandLine parseArgs ( final String [ ] args ) throws CLIToolOptionsException { initOptions ( ) ; final CommandLineParser parser = new PosixParser ( ) ; try { commandLine = parser . parse ( getOptions ( ) , args ) ; } catch ( ParseException e ) { help ( ) ; throw new CLIToolOptionsException ( e ) ; } if ( null ... | Parse the options will apply this for each CLIToolOptions added to the tool . subclasses may override this but should call super |
9,637 | public void validateOptions ( final CommandLine cli , final String [ ] args ) throws CLIToolOptionsException { if ( null != toolOptions ) { for ( final CLIToolOptions toolOpts : toolOptions ) { toolOpts . validate ( cli , args ) ; } } } | Validate the values parsed by the options will apply this for each CLIToolOptions added to the tool . subclasses may override this but should call super |
9,638 | public void help ( ) { final HelpFormatter formatter = new HelpFormatter ( ) ; final String helpString = getHelpString ( ) ; formatter . printHelp ( 80 , helpString , "options:" , getOptions ( ) , "[RUNDECK version " + VersionConstants . VERSION + " (" + VersionConstants . BUILD + ")]" ) ; } | Writes help message . |
9,639 | public static void updateFileFromFile ( final File sourceFile , final String destinationFilePath ) throws UpdateException { if ( ! sourceFile . exists ( ) ) { throw new UpdateException ( "Source file does not exist: " + sourceFile ) ; } if ( ! sourceFile . isFile ( ) ) { throw new UpdateException ( "Not a file: " + sou... | Get the source File and store it to a destination file path |
9,640 | private static void moveFile ( final File fromFile , final File toFile ) throws UpdateException { try { FileUtils . mkParentDirs ( toFile ) ; Files . move ( fromFile . toPath ( ) , toFile . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } catch ( IOException ioe ) { throw new UpdateException ( "Unable to move t... | Rename the file . Handle possible OS specific issues |
9,641 | public static void update ( final FileUpdater updater , final File destFile ) throws UpdateException { final File lockFile = new File ( destFile . getAbsolutePath ( ) + ".lock" ) ; final File newDestFile = new File ( destFile . getAbsolutePath ( ) + ".new" ) ; try { synchronized ( UpdateUtils . class ) { final FileChan... | Update a destination file with an updater implementation while maintaining appropriate locks around the action and file |
9,642 | public ContextStack < T > copyPush ( final T value ) { final ContextStack < T > stack1 = copy ( ) ; stack1 . push ( value ) ; return stack1 ; } | Return a new stack based with the same contents and one value pushed |
9,643 | public ContextStack < T > copyPop ( ) { final ContextStack < T > stack1 = copy ( ) ; stack1 . pop ( ) ; return stack1 ; } | Return a new stack with the same contents but pop a value |
9,644 | public String getFrameworkNodeHostname ( ) { String hostname = getLookup ( ) . getProperty ( "framework.server.hostname" ) ; if ( null != hostname ) { return hostname . trim ( ) ; } else { return hostname ; } } | Gets the value of framework . server . hostname property |
9,645 | public String getFrameworkNodeName ( ) { String name = getLookup ( ) . getProperty ( "framework.server.name" ) ; if ( null != name ) { return name . trim ( ) ; } else { return name ; } } | Gets the value of framework . server . name property |
9,646 | public static String escape ( String input , char echar , char [ ] special ) { StringBuilder sb = new StringBuilder ( ) ; for ( Character character : special ) { sb . append ( character ) ; } sb . append ( echar ) ; String s = Matcher . quoteReplacement ( new String ( new char [ ] { echar } ) ) ; return input . replace... | Escape the input string using the escape delimiter for the given special chars |
9,647 | public static String join ( String [ ] input , char separator ) { StringBuilder stringBuilder = new StringBuilder ( ) ; for ( String s : input ) { if ( stringBuilder . length ( ) > 0 ) { stringBuilder . append ( separator ) ; } stringBuilder . append ( s ) ; } return stringBuilder . toString ( ) ; } | Join an array of strings with the given separator without escaping |
9,648 | public static String joinEscaped ( String [ ] input , char separator , char echar , char [ ] special ) { StringBuilder sb = new StringBuilder ( ) ; char [ ] schars = new char [ ( special != null ? special . length : 0 ) + 1 ] ; if ( special != null && special . length > 0 ) { System . arraycopy ( special , 0 , schars ,... | Join an array of strings with the given separator escape char and other special chars for escaping |
9,649 | public ResourceFormatParser getParserForFileExtension ( final File file ) throws UnsupportedFormatException { String extension = getFileExtension ( file . getName ( ) ) ; if ( null != extension ) { return getParserForFileExtension ( extension ) ; } else { throw new UnsupportedFormatException ( "Could not determine form... | Return a parser for a file based on the file extension . |
9,650 | public ResourceFormatParser getParserForFileExtension ( final String extension ) throws UnsupportedFormatException { for ( final ResourceFormatParser resourceFormatParser : listParsers ( ) ) { if ( resourceFormatParser . getFileExtensions ( ) . contains ( extension ) ) { return resourceFormatParser ; } } throw new Unsu... | Return a parser for a file based on the bare file extension . |
9,651 | public ResourceFormatParser getParserForMIMEType ( final String mimeType ) throws UnsupportedFormatException { final String cleanMime ; if ( null != mimeType && mimeType . indexOf ( ";" ) > 0 ) { cleanMime = mimeType . substring ( 0 , mimeType . indexOf ( ";" ) ) ; } else { cleanMime = mimeType ; } if ( ! validMimeType... | Return a parser for a mime type . |
9,652 | public static String [ ] merge ( final String [ ] input , final String [ ] list ) { final List < String > v = new ArrayList < String > ( Arrays . asList ( list ) ) ; for ( final String anInput : input ) { if ( ( null != anInput ) && ! v . contains ( anInput ) ) { v . add ( anInput ) ; } } return v . toArray ( new Strin... | Merge to string arrays |
9,653 | public static String [ ] subtract ( final String [ ] input , final String [ ] list ) { final Set < String > difference = new HashSet < String > ( Arrays . asList ( list ) ) ; difference . removeAll ( Arrays . asList ( input ) ) ; return difference . toArray ( new String [ difference . size ( ) ] ) ; } | Subtract one string array from another |
9,654 | public static String asString ( final Object [ ] input , final String delim ) { final StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < input . length ; i ++ ) { if ( i > 0 ) { sb . append ( delim ) ; } sb . append ( input [ i ] . toString ( ) ) ; } return sb . toString ( ) ; } | Format an array of objects as a string separated by a delimiter by calling toString on each object |
9,655 | public static String [ ] difference ( final String [ ] list1 , final String [ ] list2 ) { HashSet < String > set = new HashSet < String > ( ) ; HashSet < String > set1 = new HashSet < String > ( Arrays . asList ( list1 ) ) ; HashSet < String > set2 = new HashSet < String > ( Arrays . asList ( list2 ) ) ; for ( final St... | The difference set operation |
9,656 | public static INodeSet parseFile ( final File file , final Framework framework , final String project ) throws ResourceModelSourceException , ConfigurationException { final FileResourceModelSource prov = new FileResourceModelSource ( framework ) ; prov . configure ( Configuration . build ( ) . file ( file ) . includeSe... | Utility method to directly parse the nodes from a file |
9,657 | public static ResourceMetaBuilder create ( Map < String , String > meta ) { ResourceMetaBuilder mutableRundeckResourceMeta = new ResourceMetaBuilder ( meta ) ; return mutableRundeckResourceMeta ; } | Create a new builder with a set of metadata |
9,658 | public static boolean deletePathRecursive ( Tree < ResourceMeta > tree , Path path ) { if ( tree . hasResource ( path ) ) { return tree . deleteResource ( path ) ; } else if ( tree . hasDirectory ( path ) ) { Set < Resource < ResourceMeta > > resources = tree . listDirectory ( path ) ; boolean failed = false ; for ( Re... | Delete all resources and subdirectories of the given resource path |
9,659 | public static < S > StorageTree resolvedTree ( S context , ExtTree < S , ResourceMeta > authStorage ) { return ResolvedExtTree . with ( context , authStorage ) ; } | Create a StorageTree using authorization context and authorizing tree |
9,660 | public static PoliciesCache fromFile ( File singleFile , Set < Attribute > forcedContext ) { return fromSourceProvider ( YamlProvider . getFileProvider ( singleFile ) , forcedContext ) ; } | Create a cache from a single file source |
9,661 | public static PoliciesCache fromSourceProvider ( final SourceProvider provider , final Set < Attribute > forcedContext ) { return new PoliciesCache ( provider , forcedContext ) ; } | Create from a provider with a forced context |
9,662 | public static PoliciesCache fromDir ( File rootDir , final Set < Attribute > forcedContext ) { return fromSourceProvider ( YamlProvider . getDirProvider ( rootDir ) , forcedContext ) ; } | Create a cache from a directory source |
9,663 | public PropertyBuilder renderingAsTextarea ( ) { if ( this . type != Property . Type . String ) { throw new IllegalStateException ( "stringRenderingTextarea can only be applied to a String property" ) ; } return renderingOption ( StringRenderingConstants . DISPLAY_TYPE_KEY , StringRenderingConstants . DisplayType . MUL... | Set the string property to display as a Multi - line Text area . |
9,664 | public PropertyBuilder renderingAsPassword ( ) { if ( this . type != Property . Type . String ) { throw new IllegalStateException ( "stringRenderingPassword can only be applied to a String property" ) ; } return renderingOption ( StringRenderingConstants . DISPLAY_TYPE_KEY , StringRenderingConstants . DisplayType . PAS... | Set the string property to display as a Password . |
9,665 | public Property build ( ) { if ( null == type ) { throw new IllegalStateException ( "type is required" ) ; } if ( null == name ) { throw new IllegalStateException ( "name is required" ) ; } return PropertyUtil . forType ( type , name , title , description , required , value , values , labels , validator , scope , rende... | Build the Property object |
9,666 | private String translatePathExternal ( String intpath ) { if ( fullPath ) { return intpath ; } else { return PathUtil . appendPath ( rootPath . getPath ( ) , intpath ) ; } } | convert internal path to external |
9,667 | private Resource < T > translateResourceExternal ( Resource < T > resource ) { if ( fullPath ) { return resource ; } return new translatedResource < T > ( resource , translatePathExternal ( resource . getPath ( ) ) ) ; } | Expose a resource with a path that maps to external path |
9,668 | public static Function < ResourceModelSourceFactory , ResourceModelSource > factoryConverter ( final Properties configuration ) { return new Function < ResourceModelSourceFactory , ResourceModelSource > ( ) { public ResourceModelSource apply ( final ResourceModelSourceFactory resourceModelSourceFactory ) { try { return... | Given input configuration produce a function to convert from a factory to model source |
9,669 | public static NodeStepResult with ( final NodeStepResult result , final WFSharedContext dataContext ) { return new NodeStepDataResultImpl ( result , result . getException ( ) , result . getFailureReason ( ) , result . getFailureMessage ( ) , result . getFailureData ( ) , result . getNode ( ) , dataContext ) ; } | Add a data context to a source result |
9,670 | public ArrayList < String > buildCommandForNode ( Map < String , Map < String , String > > dataContext , String osFamily ) { return buildCommandForNode ( this , dataContext , osFamily ) ; } | Generate the quoted and expanded argument list by expanding property values given the data context and quoting for the given OS |
9,671 | public void visitWith ( ExecArg . Visitor visitor ) { for ( ExecArg arg : getList ( ) ) { arg . accept ( visitor ) ; } } | Visit with a visitor |
9,672 | public static void extractZip ( final String path , final File dest ) throws IOException { extractZip ( path , dest , null ) ; } | Extracts all contents of the file to the destination directory |
9,673 | public static void extractZipFile ( final String path , final File dest , final String fileName ) throws IOException { FilenameFilter filter = null ; if ( null != fileName ) { filter = new FilenameFilter ( ) { public boolean accept ( final File file , final String name ) { return fileName . equals ( name ) || fileName ... | Extracts a single entry from the zip |
9,674 | public IRundeckProject createFrameworkProjectStrict ( final String projectName , final Properties properties ) { return createFrameworkProjectInt ( projectName , properties , true ) ; } | Create a new project if it doesn t otherwise throw exception |
9,675 | public void removeFrameworkProject ( final String projectName ) { synchronized ( projectCache ) { removeSubDir ( projectName ) ; projectCache . remove ( projectName ) ; } } | Remove a project definition |
9,676 | @ SuppressWarnings ( "unchecked" ) public synchronized < T > T load ( final PluggableService < T > service , final String providerName ) throws ProviderLoaderException { final ProviderIdent ident = new ProviderIdent ( service . getName ( ) , providerName ) ; debug ( "loadInstance for " + ident + ": " + pluginJar ) ; if... | Load provider instance for the service |
9,677 | public String [ ] getClassnames ( ) { final Attributes attributes = getMainAttributes ( ) ; if ( null == attributes ) { return null ; } final String value = attributes . getValue ( RUNDECK_PLUGIN_CLASSNAMES ) ; if ( null == value ) { return null ; } return value . split ( "," ) ; } | Get the declared list of provider classnames for the file |
9,678 | private Attributes getMainAttributes ( ) { if ( null == mainAttributes ) { mainAttributes = getJarMainAttributes ( pluginJar ) ; String pluginName = mainAttributes . getValue ( RUNDECK_PLUGIN_NAME ) ; if ( pluginName == null ) { pluginName = mainAttributes . getValue ( RUNDECK_PLUGIN_CLASSNAMES ) ; } pluginId = PluginU... | return the main attributes from the jar manifest |
9,679 | static < T , X extends T > T createProviderForClass ( final PluggableService < T > service , final Class < X > cls ) throws PluginException , ProviderCreationException { debug ( "Try loading provider " + cls . getName ( ) ) ; if ( ! ( service instanceof JavaClassProviderLoadable ) ) { return null ; } JavaClassProviderL... | Attempt to create an instance of thea provider for the given service |
9,680 | static Plugin getPluginMetadata ( final Class < ? > cls ) throws PluginException { final String pluginname ; if ( ! cls . isAnnotationPresent ( Plugin . class ) ) { throw new PluginException ( "No Plugin annotation was found for the class: " + cls . getName ( ) ) ; } final Plugin annotation = ( Plugin ) cls . getAnnota... | Get the Plugin annotation for the class |
9,681 | protected File createCachedJar ( final File dir , final String jarName ) throws PluginException { File cachedJar ; try { cachedJar = new File ( dir , jarName ) ; cachedJar . deleteOnExit ( ) ; FileUtils . fileCopy ( pluginJar , cachedJar , true ) ; } catch ( IOException e ) { throw new PluginException ( e ) ; } return ... | Creates a single cached version of the pluginJar located within pluginJarCacheDirectory deleting all existing versions of pluginJar |
9,682 | private Class < ? > loadClass ( final String classname ) throws PluginException { if ( null == classname ) { throw new IllegalArgumentException ( "A null java class name was specified." ) ; } if ( null != classCache . get ( classname ) ) { return classCache . get ( classname ) ; } CachedJar cachedJar1 = getCachedJar ( ... | Load a class from the jar file by name |
9,683 | protected Collection < File > extractDependentLibs ( final File cachedir ) throws IOException { final Attributes attributes = getMainAttributes ( ) ; if ( null == attributes ) { debug ( "no manifest attributes" ) ; return null ; } final ArrayList < File > files = new ArrayList < File > ( ) ; final String libs = attribu... | Extract the dependent libs and return the extracted jar files |
9,684 | public synchronized boolean isLoaderFor ( final ProviderIdent ident ) { final String [ ] strings = getClassnames ( ) ; for ( final String classname : strings ) { try { if ( matchesProviderDeclaration ( ident , loadClass ( classname ) ) ) { return true ; } } catch ( PluginException e ) { e . printStackTrace ( ) ; } } re... | Return true if the file has a class that provides the ident . |
9,685 | public void close ( ) throws IOException { debug ( String . format ( "close jar provider loader for: %s" , pluginJar ) ) ; synchronized ( this ) { closed = true ; } if ( null != cachedJar ) { cachedJar . close ( ) ; classCache . clear ( ) ; cachedJar = null ; } } | Close class loaders and delete cached files |
9,686 | public void expire ( ) { synchronized ( this ) { expired = true ; } int i = loadCount . get ( ) ; debug ( String . format ( "expire jar provider loader for: %s (loadCount: %d)" , pluginJar , i ) ) ; if ( i <= 0 ) { try { close ( ) ; } catch ( IOException e ) { } } } | Expire the loader cache item |
9,687 | public static boolean isValidJarPlugin ( final File file ) { try { try ( final JarInputStream jarInputStream = new JarInputStream ( new FileInputStream ( file ) ) ) { final Manifest manifest = jarInputStream . getManifest ( ) ; if ( null == manifest ) { return false ; } final Attributes mainAttributes = manifest . getM... | Return true if the file is a valid jar plugin file |
9,688 | static void validateJarManifest ( final Attributes mainAttributes ) throws InvalidManifestException { final String value1 = mainAttributes . getValue ( RUNDECK_PLUGIN_ARCHIVE ) ; final String plugvers = mainAttributes . getValue ( RUNDECK_PLUGIN_VERSION ) ; final String plugclassnames = mainAttributes . getValue ( RUND... | Validate whether the jar file has a valid manifest throw exception if invalid |
9,689 | static boolean getLoadLocalLibsFirstForFile ( final File file ) { Attributes attributes = loadMainAttributes ( file ) ; if ( null == attributes ) { return false ; } boolean loadFirstDefault = true ; String loadFirst = attributes . getValue ( RUNDECK_PLUGIN_LIBS_LOAD_FIRST ) ; if ( null != loadFirst ) { return Boolean .... | Return true if the jar attributes declare it should load local dependency classes first . |
9,690 | public void initialize ( Framework framework ) { setFramework ( framework ) ; NodeStepExecutionService . getInstanceForFramework ( getFramework ( ) ) ; NodeExecutorService . getInstanceForFramework ( getFramework ( ) ) ; FileCopierService . getInstanceForFramework ( getFramework ( ) ) ; NodeDispatcherService . getInsta... | Initialize children the various resource management objects |
9,691 | public void setService ( final String name , final FrameworkSupportService service ) { synchronized ( services ) { if ( null == services . get ( name ) && null != service ) { services . put ( name , service ) ; } else if ( null == service ) { services . remove ( name ) ; } } } | Set a service by name |
9,692 | protected StepExecutionResult executeWFItem ( final StepExecutionContext executionContext , final Map < Integer , StepExecutionResult > failedMap , final int c , final StepExecutionItem cmd ) { boolean hasHandler = cmd instanceof HasFailureHandler ; boolean hideError = false ; if ( hasHandler ) { final HasFailureHandle... | Execute a workflow item returns true if the item succeeds . This method will throw an exception if the workflow item fails and the Workflow is has keepgoing == false . |
9,693 | protected WorkflowStatusResult executeWorkflowItemsForNodeSet ( final StepExecutionContext executionContext , final Map < Integer , StepExecutionResult > failedMap , final List < StepExecutionResult > resultList , final List < StepExecutionItem > iWorkflowCmdItems , final boolean keepgoing , final int beginStepIndex , ... | Execute the sequence of ExecutionItems within the context and with the given keepgoing value |
9,694 | protected void addStepFailureContextData ( StepExecutionResult stepResult , ExecutionContextImpl . Builder builder ) { HashMap < String , String > resultData = new HashMap < > ( ) ; if ( null != stepResult . getFailureData ( ) ) { for ( final Map . Entry < String , Object > entry : stepResult . getFailureData ( ) . ent... | Add step result failure information to the data context |
9,695 | protected void addNodeStepFailureContextData ( final StepExecutionResult dispatcherStepResult , final ExecutionContextImpl . Builder builder ) { final Map < String , ? extends NodeStepResult > resultMap ; if ( NodeDispatchStepExecutor . isWrappedDispatcherResult ( dispatcherStepResult ) ) { DispatcherResult dispatcherR... | Add any node - specific step failure information to the node - specific data contexts |
9,696 | protected Map < String , Collection < StepExecutionResult > > convertFailures ( final Map < Integer , StepExecutionResult > failedMap ) { final Map < String , Collection < StepExecutionResult > > failures = new HashMap < > ( ) ; for ( final Map . Entry < Integer , StepExecutionResult > entry : failedMap . entrySet ( ) ... | Convert map of step execution results keyed by step number to a collection of step execution results keyed by node name |
9,697 | public static Description descriptionForProvider ( final boolean includeFieldProperties , final Object providerForType ) { if ( providerForType instanceof Describable ) { final Describable desc = ( Describable ) providerForType ; return desc . getDescription ( ) ; } else if ( PluginAdapterUtility . canBuildDescription ... | Get or build the description of a plugin instance of a given type |
9,698 | public synchronized void remove ( final File file ) { final T t = cache . get ( file ) ; expiry . remove ( file ) ; cache . remove ( file ) ; if ( null != t && t instanceof Expireable ) { final Expireable exp = ( Expireable ) t ; exp . expire ( ) ; } } | Remove entry for a file . |
9,699 | public static FrameworkProjectConfig create ( final String name , final File propertyFile , final IFilesystemFramework filesystemFramework ) { return new FrameworkProjectConfig ( name , propertyFile , filesystemFramework ) ; } | Create from existing file |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.