idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
10,800 | static SwiftApi swiftApi ( Map < String , String > targetProperties ) throws TargetException { validate ( targetProperties ) ; return ContextBuilder . newBuilder ( PROVIDER_SWIFT ) . endpoint ( targetProperties . get ( API_URL ) ) . credentials ( identity ( targetProperties ) , targetProperties . get ( PASSWORD ) ) . b... | Creates a JCloud context for Swift . |
10,801 | static void validate ( Map < String , String > targetProperties ) throws TargetException { checkProperty ( API_URL , targetProperties ) ; checkProperty ( IMAGE_NAME , targetProperties ) ; checkProperty ( TENANT_NAME , targetProperties ) ; checkProperty ( FLAVOR_NAME , targetProperties ) ; checkProperty ( SECURITY_GROUP... | Validates the basic target properties . |
10,802 | static void validateAll ( Map < String , String > targetProperties , String appName , String instanceName ) throws TargetException { validate ( targetProperties ) ; Set < String > mountPoints = new HashSet < > ( ) ; Set < String > volumeNames = new HashSet < > ( ) ; for ( String s : findStorageIds ( targetProperties ) ... | Validates the target properties including storage ones . |
10,803 | static String findStorageProperty ( Map < String , String > targetProperties , String storageId , String propertyPrefix ) { String property = propertyPrefix + storageId ; String value = targetProperties . get ( property ) ; return Utils . isEmptyOrWhitespaces ( value ) ? DEFAULTS . get ( propertyPrefix ) : value . trim... | Finds a storage property for a given storage ID . |
10,804 | static String expandVolumeName ( String nameTemplate , String appName , String instanceName ) { String name = nameTemplate . replace ( TPL_VOLUME_NAME , instanceName ) ; name = name . replace ( TPL_VOLUME_APP , appName ) ; name = name . replaceAll ( "[\\W_-]" , "-" ) ; return name ; } | Updates a volume name by replacing template variables . |
10,805 | public BlockProperty findPropertyBlockByName ( String propertyName ) { BlockProperty result = null ; for ( AbstractBlock region : this . innerBlocks ) { if ( region . getInstructionType ( ) == PROPERTY && propertyName . equals ( ( ( BlockProperty ) region ) . getName ( ) ) ) { result = ( BlockProperty ) region ; break ... | Finds a property by its name among the ones this instance owns . |
10,806 | public List < BlockProperty > findPropertiesBlockByName ( String propertyName ) { List < BlockProperty > result = new ArrayList < > ( ) ; for ( AbstractBlock region : this . innerBlocks ) { if ( region . getInstructionType ( ) == PROPERTY && propertyName . equals ( ( ( BlockProperty ) region ) . getName ( ) ) ) { resul... | Finds properties by name among the ones this instance owns . |
10,807 | public static Map . Entry < String , String > decodeIconUrl ( String path ) { if ( path . startsWith ( "/" ) ) path = path . substring ( 1 ) ; String name = null , version = null ; String [ ] parts = path . split ( "/" ) ; switch ( parts . length ) { case 2 : name = parts [ 0 ] ; break ; case 3 : name = parts [ 0 ] ; v... | Decodes an URL path to extract a name and a potential version . |
10,808 | public static String findIconUrl ( AbstractApplication app ) { StringBuilder sb = new StringBuilder ( ) ; File iconFile = findIcon ( app ) ; if ( iconFile != null ) { sb . append ( "/" ) ; sb . append ( app . getName ( ) ) ; if ( app instanceof ApplicationTemplate ) { sb . append ( "/" ) ; sb . append ( ( ( Application... | Finds the URL to access the icon of an application or templates . |
10,809 | public static String writeConfigurationFile ( FileDefinition relationsFile , boolean writeComments , String lineSeparator ) { return new FileDefinitionSerializer ( lineSeparator ) . write ( relationsFile , writeComments ) ; } | Writes a model into a string . |
10,810 | public static void saveRelationsFile ( FileDefinition relationsFile , boolean writeComments , String lineSeparator ) throws IOException { if ( relationsFile . getEditedFile ( ) == null ) throw new IOException ( "Save operation could not be performed. The model was not loaded from a local file." ) ; saveRelationsFileInt... | Saves the model into the original file . |
10,811 | public static void saveRelationsFileInto ( File targetFile , FileDefinition relationsFile , boolean writeComments , String lineSeparator ) throws IOException { String s = writeConfigurationFile ( relationsFile , writeComments , lineSeparator ) ; Utils . copyStream ( new ByteArrayInputStream ( s . getBytes ( StandardCha... | Saves the model into another file . |
10,812 | public static String labelFromCamelCase ( String camel ) { StringBuilder label = new StringBuilder ( ) ; for ( int i = 0 ; i < camel . length ( ) ; i ++ ) { char c = camel . charAt ( i ) ; if ( Character . isDigit ( c ) ) { if ( i > 0 && Character . isAlphabetic ( camel . charAt ( i - 1 ) ) ) label . append ( " " ) ; }... | Converts a camelcase variable name to a human readable text . |
10,813 | AbstractCommandExecution findExecutor ( AbstractCommandInstruction instr ) { AbstractCommandExecution result = null ; if ( RenameCommandInstruction . class . equals ( instr . getClass ( ) ) ) result = new RenameCommandExecution ( ( RenameCommandInstruction ) instr ) ; else if ( ReplicateCommandInstruction . class . equ... | Finds the right executor for an instruction . |
10,814 | private String convertPropertyFileLineToJSon ( String line , String json ) { if ( line == null ) return json ; String l = line . trim ( ) ; if ( l . length ( ) == 0 || l . startsWith ( "//" ) ) return json ; boolean inString = l . startsWith ( "\"" ) ; String english ; String rest ; if ( inString ) { boolean esc = fals... | Note this method has a side effect - it also fills the HashMap of translations . |
10,815 | public void targetAppears ( TargetHandler targetItf ) { this . defaultTargetHandlerResolver . addTargetHandler ( targetItf ) ; if ( this . timer != null ) restoreInstancesFrom ( targetItf ) ; } | This method is invoked by iPojo every time a new target handler appears . |
10,816 | public void setTargetResolver ( ITargetHandlerResolver targetHandlerResolver ) { if ( targetHandlerResolver == null ) { this . targetConfigurator . setTargetHandlerResolver ( this . defaultTargetHandlerResolver ) ; this . instancesMngr . setTargetHandlerResolver ( this . defaultTargetHandlerResolver ) ; } else { this .... | Sets the target resolver . |
10,817 | void restoreAllInstances ( ) { this . logger . fine ( "Restoring all the instance states from the current target handlers." ) ; for ( ManagedApplication ma : this . applicationMngr . getManagedApplications ( ) ) { List < TargetHandler > snapshot = this . defaultTargetHandlerResolver . getTargetHandlersSnapshot ( ) ; fo... | Restores the states of all the instances from the current target handlers . |
10,818 | void restoreInstancesFrom ( TargetHandler targetHandler ) { this . logger . fine ( "Restoring the instance states with the '" + targetHandler . getTargetId ( ) + "' target handler." ) ; for ( ManagedApplication ma : this . applicationMngr . getManagedApplications ( ) ) instancesMngr ( ) . restoreInstanceStates ( ma , t... | Restores the states of all the instances from a given target handler . |
10,819 | public boolean addMessagingClientFactory ( IMessagingClientFactory factory ) { final String type = factory . getType ( ) ; this . logger . fine ( "Adding messaging client factory: " + type ) ; final boolean result = this . factories . putIfAbsent ( type , factory ) == null ; if ( result ) notifyListeners ( factory , tr... | Adds a messaging client factory to this registry unless a similar one was already registered . |
10,820 | public boolean removeMessagingClientFactory ( IMessagingClientFactory factory ) { final String type = factory . getType ( ) ; this . logger . fine ( "Removing messaging client factory: " + type ) ; final boolean result = this . factories . remove ( type , factory ) ; if ( result ) notifyListeners ( factory , false ) ; ... | Removes a messaging client factory from this registry . |
10,821 | public static Object getValueToRender ( FacesContext context , UIComponent component ) { if ( component instanceof ValueHolder ) { if ( component instanceof EditableValueHolder ) { EditableValueHolder input = ( EditableValueHolder ) component ; Object submittedValue = input . getSubmittedValue ( ) ; ConfigContainer con... | This method has been copied from the PrimeFaces 5 project . |
10,822 | public void acknowledgeHeartBeat ( Instance scopedInstance ) { String count = scopedInstance . data . get ( MISSED_HEARTBEATS ) ; if ( count != null && Integer . parseInt ( count ) > THRESHOLD ) this . logger . info ( "Agent " + InstanceHelpers . computeInstancePath ( scopedInstance ) + " is alive and reachable again."... | Acknowledges a heart beat . |
10,823 | public void checkStates ( INotificationMngr notificationMngr ) { Collection < Instance > scopedInstances = InstanceHelpers . findAllScopedInstances ( this . application ) ; for ( Instance scopedInstance : scopedInstances ) { if ( scopedInstance . getStatus ( ) == InstanceStatus . NOT_DEPLOYED || scopedInstance . getSta... | Check the scoped instances states with respect to missed heart beats . |
10,824 | public static void markScopedInstanceAsNotDeployed ( Instance scopedInstance , ManagedApplication ma , INotificationMngr notificationMngr , IInstancesMngr instanceMngr ) { scopedInstance . data . remove ( Instance . IP_ADDRESS ) ; scopedInstance . data . remove ( Instance . MACHINE_ID ) ; scopedInstance . data . remove... | Updates a scoped instance and its children to be marked as not deployed . |
10,825 | private void dealWithMainComponent ( ) { this . typeToLocation . put ( this . component , new Point2D . Double ( this . hMargin , this . currentHeigth ) ) ; int width = H_PADDING + GraphUtils . computeShapeWidth ( this . component ) ; this . maxRowWidth = Math . max ( this . maxRowWidth , width ) ; this . aloneOnRow . ... | Finds the position for the main component . |
10,826 | private void dealWithOthers ( Collection < AbstractType > others ) { int col = 1 ; this . currentWidth = this . hMargin ; for ( AbstractType t : others ) { if ( col > this . maxPerLine ) { col = 1 ; this . currentHeigth += V_PADDING + GraphUtils . SHAPE_HEIGHT ; this . currentWidth = this . hMargin ; } this . typeToLoc... | Finds the position of other components . |
10,827 | public static URI buildNewURI ( URI referenceUri , String uriSuffix ) throws URISyntaxException { if ( uriSuffix == null ) throw new IllegalArgumentException ( "The URI suffix cannot be null." ) ; uriSuffix = uriSuffix . replaceAll ( "\\\\" , "/" ) ; URI importUri = null ; try { importUri = urlToUri ( new URL ( uriSuff... | Builds an URI from an URI and a suffix . |
10,828 | public static int executeCommand ( final Logger logger , final String [ ] command , final File workingDir , final Map < String , String > environmentVars , final String applicationName , final String scopedInstancePath ) throws IOException , InterruptedException { ExecutionResult result = executeCommandWithResult ( log... | Executes a command on the VM and logs the output . |
10,829 | public static int executeCommand ( final Logger logger , final List < String > command , final File workingDir , final Map < String , String > environmentVars , final String applicationName , final String scopedInstanceName ) throws IOException , InterruptedException { return executeCommand ( logger , command . toArray... | Executes a command on the VM and prints on the console its output . |
10,830 | public static List < DockerCommand > dockerfileToCommandList ( File dockerfile ) throws IOException { List < DockerCommand > result = new ArrayList < > ( ) ; FileInputStream in = new FileInputStream ( dockerfile ) ; Logger logger = Logger . getLogger ( DockerfileParser . class . getName ( ) ) ; BufferedReader br = null... | Parses a dockerfile to a list of commands . |
10,831 | public void enableCors ( boolean enableCors ) { if ( enableCors ) getProperties ( ) . put ( ResourceConfig . PROPERTY_CONTAINER_RESPONSE_FILTERS , ResponseCorsFilter . class . getName ( ) ) ; else getProperties ( ) . remove ( ResourceConfig . PROPERTY_CONTAINER_RESPONSE_FILTERS ) ; } | Enables or disables CORS . |
10,832 | public static String getVMIP ( String hostIpPort , String id ) throws TargetException { if ( ! hostIpPort . endsWith ( "/compute" ) && id . startsWith ( "urn:uuid:" ) ) id = id . substring ( 9 ) ; String vmIp = null ; URL url = null ; try { CookieHandler . setDefault ( new CookieManager ( null , CookiePolicy . ACCEPT_A... | Retrieves VM IP . |
10,833 | public static boolean isVMRunning ( String hostIpPort , String id ) throws TargetException { boolean result = false ; String ip = OcciVMUtils . getVMIP ( hostIpPort , id ) ; try { InetAddress inet = InetAddress . getByName ( ip ) ; result = inet . isReachable ( 5000 ) ; } catch ( Exception e ) { result = false ; final ... | Checks if VM is running . |
10,834 | public String createTarget ( String targetContent ) throws IOException { TargetValidator tv = new TargetValidator ( targetContent ) ; tv . validate ( ) ; if ( RoboconfErrorHelpers . containsCriticalErrors ( tv . getErrors ( ) ) ) throw new IOException ( "There are errors in the target definition." ) ; String targetId =... | CRUD operations on targets |
10,835 | public Map < String , byte [ ] > findScriptResourcesForAgent ( String targetId ) throws IOException { Map < String , byte [ ] > result = new HashMap < > ( 0 ) ; File targetDir = new File ( findTargetDirectory ( targetId ) , Constants . PROJECT_SUB_DIR_SCRIPTS ) ; if ( targetDir . isDirectory ( ) ) { List < String > exc... | Finding script resources |
10,836 | public List < TargetWrapperDescriptor > listPossibleTargets ( AbstractApplication app ) { String key = new InstanceContext ( app ) . toString ( ) ; String tplKey = null ; if ( app instanceof Application ) tplKey = new InstanceContext ( ( ( Application ) app ) . getTemplate ( ) ) . toString ( ) ; List < File > targetDir... | In relation with hints |
10,837 | public TargetProperties lockAndGetTarget ( Application app , Instance scopedInstance ) throws IOException { String instancePath = InstanceHelpers . computeInstancePath ( scopedInstance ) ; String targetId = findTargetId ( app , instancePath ) ; if ( targetId == null ) throw new IOException ( "No target was found for " ... | Atomic operations ... |
10,838 | public static void verify ( CommandExecutionContext executionContext , Component component ) throws CommandException { if ( executionContext != null && Constants . TARGET_INSTALLER . equalsIgnoreCase ( component . getInstallerName ( ) ) && executionContext . getMaxVm ( ) > 0 && executionContext . getMaxVm ( ) <= execut... | Verifies a new VM model can be created according to a given context . |
10,839 | public static void update ( CommandExecutionContext executionContext , Instance createdInstance ) { if ( executionContext != null ) { createdInstance . data . put ( executionContext . getNewVmMarkerKey ( ) , executionContext . getNewVmMarkerValue ( ) ) ; executionContext . getGlobalVmNumber ( ) . incrementAndGet ( ) ; ... | Updates an instance with context information . |
10,840 | public static List < ModelError > validateComponentRecipes ( File applicationFilesDirectory , Component component ) { List < ModelError > result ; if ( "puppet" . equalsIgnoreCase ( component . getInstallerName ( ) ) ) result = validatePuppetComponent ( applicationFilesDirectory , component ) ; else if ( "script" . equ... | Validates the recipes of a component . |
10,841 | private static void checkPuppetFile ( File pp , boolean withUpdateParams , Component component , Collection < ModelError > errors ) throws IOException { String [ ] cmd = { "puppet" , "parser" , "validate" , pp . getAbsolutePath ( ) } ; Logger logger = Logger . getLogger ( RecipesValidator . class . getName ( ) ) ; try ... | Reads a Puppet script and validates it . |
10,842 | public static String findManifestProperty ( String propertyName ) { String result = null ; InputStream is = null ; try { is = ManifestUtils . class . getResourceAsStream ( "/META-INF/MANIFEST.MF" ) ; Properties props = new Properties ( ) ; props . load ( is ) ; result = findManifestProperty ( props , propertyName ) ; }... | Finds a property in the MANIFEST file . |
10,843 | public static String findManifestProperty ( Properties props , String propertyName ) { String result = null ; for ( Map . Entry < Object , Object > entry : props . entrySet ( ) ) { if ( propertyName . equalsIgnoreCase ( String . valueOf ( entry . getKey ( ) ) ) ) { result = String . valueOf ( entry . getValue ( ) ) ; b... | Finds a property in the MANIFEST properties . |
10,844 | public static ErrorDetails applicationTpl ( String tplName , String tplVersion ) { return new ErrorDetails ( tplName + " (" + tplVersion + ")" , ErrorDetailsKind . APPLICATION_TEMPLATE ) ; } | Details for an application . |
10,845 | public static ErrorDetails exception ( Throwable t ) { return new ErrorDetails ( Utils . writeExceptionButDoNotUseItForLogging ( t ) , ErrorDetailsKind . EXCEPTION ) ; } | Details for an exception . |
10,846 | public static ErrorDetails exceptionName ( Throwable t ) { return new ErrorDetails ( t . getClass ( ) . getName ( ) , ErrorDetailsKind . EXCEPTION_NAME ) ; } | Details for an exception name . |
10,847 | static AzureProperties buildProperties ( Map < String , String > targetProperties ) throws TargetException { String [ ] properties = { AzureConstants . AZURE_SUBSCRIPTION_ID , AzureConstants . AZURE_KEY_STORE_FILE , AzureConstants . AZURE_KEY_STORE_PASSWORD , AzureConstants . AZURE_CREATE_CLOUD_SERVICE_TEMPLATE , Azure... | Validates the received properties and builds a Java bean from them . |
10,848 | public static ApplicationTemplateDescriptor load ( File f ) throws IOException { String fileContent = Utils . readFileContent ( f ) ; Logger logger = Logger . getLogger ( ApplicationTemplateDescriptor . class . getName ( ) ) ; Properties properties = Utils . readPropertiesQuietly ( fileContent , logger ) ; if ( propert... | Loads an application template s descriptor . |
10,849 | public static void save ( File f , ApplicationTemplateDescriptor descriptor ) throws IOException { Properties properties = new Properties ( ) ; if ( descriptor . name != null ) properties . setProperty ( APPLICATION_NAME , descriptor . name ) ; if ( descriptor . version != null ) properties . setProperty ( APPLICATION_... | Saves an application template s descriptor . |
10,850 | static String getLegacyProperty ( Properties props , String property , String defaultValue ) { String result = props . getProperty ( property , null ) ; if ( result == null ) result = props . getProperty ( LEGACY_PREFIX + property , defaultValue ) ; return result ; } | Gets a property value while supporting legacy ones . |
10,851 | public static void createProjectSkeleton ( File targetDirectory , CreationBean creationBean ) throws IOException { if ( creationBean . isMavenProject ( ) ) createMavenProject ( targetDirectory , creationBean ) ; else createSimpleProject ( targetDirectory , creationBean ) ; } | Creates a project for Roboconf . |
10,852 | public static List < File > createRecipeDirectories ( File applicationDirectory ) throws IOException { List < File > result = new ArrayList < > ( ) ; ApplicationLoadResult alr = RuntimeModelIo . loadApplicationFlexibly ( applicationDirectory ) ; if ( alr . getApplicationTemplate ( ) != null ) { for ( Component c : Comp... | Creates the recipes directories for a Roboconf components . |
10,853 | private static void createSimpleProject ( File targetDirectory , CreationBean creationBean ) throws IOException { String [ ] directoriesToCreate = creationBean . isReusableRecipe ( ) ? RR_DIRECTORIES : ALL_DIRECTORIES ; for ( String s : directoriesToCreate ) { File dir = new File ( targetDirectory , s ) ; Utils . creat... | Creates a simple project for Roboconf . |
10,854 | private static void createMavenProject ( File targetDirectory , CreationBean creationBean ) throws IOException { File rootDir = new File ( targetDirectory , Constants . MAVEN_SRC_MAIN_MODEL ) ; String [ ] directoriesToCreate = creationBean . isReusableRecipe ( ) ? RR_DIRECTORIES : ALL_DIRECTORIES ; for ( String s : dir... | Creates a Maven project for Roboconf . |
10,855 | private static void completeProjectCreation ( File targetDirectory , String descriptorContent , CreationBean creationBean ) throws IOException { File f = new File ( targetDirectory , Constants . PROJECT_DIR_GRAPH + "/" + GRAPH_EP ) ; InputStream in = ProjectUtils . class . getResourceAsStream ( "/graph-skeleton.graph" ... | Completes the creation of a Roboconf project . |
10,856 | private static ErrorDetails [ ] addLineAndFile ( int line , File file , ErrorDetails ... details ) { Set < ErrorDetails > updatedDetails = new LinkedHashSet < > ( ) ; if ( details != null ) updatedDetails . addAll ( Arrays . asList ( details ) ) ; if ( file != null ) { updatedDetails . add ( file ( file ) ) ; updatedDe... | Adds details about the line number and the file . |
10,857 | public static Map < String , String > buildReferenceMap ( Instance instance ) { Map < String , String > result = new HashMap < > ( ) ; String instancePath = InstanceHelpers . computeInstancePath ( instance ) ; result . put ( ROBOCONF_INSTANCE_NAME , instance . getName ( ) ) ; result . put ( ROBOCONF_INSTANCE_PATH , ins... | Builds a map with the variables defined by this class . |
10,858 | List < MonitoringHandlerRun > extractRuleSections ( File file , String fileContent , Properties params ) { StringBuilder sb = new StringBuilder ( ) ; List < String > sections = new ArrayList < String > ( ) ; for ( String s : Arrays . asList ( fileContent . trim ( ) . split ( "\n" ) ) ) { s = s . trim ( ) ; if ( s . len... | Reads the file content extracts rules sections and prepares the handler invocations . |
10,859 | public void setTags ( Collection < String > tags ) { synchronized ( this . tags ) { this . tags . clear ( ) ; if ( tags != null ) this . tags . addAll ( tags ) ; } } | Replaces all the tags . |
10,860 | public void validate ( ) { ErrorDetails details = null ; if ( this . fileName != null ) details = ErrorDetails . file ( this . fileName ) ; if ( this . failed ) { this . errors . add ( new ModelError ( ErrorCode . REC_TARGET_INVALID_FILE_OR_CONTENT , this . modelObject , details ) ) ; } else { String id = this . props ... | Validates target properties . |
10,861 | public static List < ModelError > parseDirectory ( File directory , Component c ) { List < ModelError > result = new ArrayList < > ( ) ; Set < String > targetIds = new HashSet < > ( ) ; for ( File f : Utils . listDirectFiles ( directory , Constants . FILE_EXT_PROPERTIES ) ) { TargetValidator tv = new TargetValidator ( ... | Parses a directory with one or several properties files . |
10,862 | public static List < ModelError > parseTargetProperties ( File projectDirectory , Component c ) { List < ModelError > errors ; File dir = ResourceUtils . findInstanceResourcesDirectory ( projectDirectory , c ) ; if ( dir . isDirectory ( ) && ! Utils . listAllFiles ( dir , Constants . FILE_EXT_PROPERTIES ) . isEmpty ( )... | Parses the target properties for a given component . |
10,863 | static int fixSelectionLength ( String fullText , int selectionOffset , int selectionLength ) { if ( selectionLength < 0 ) selectionLength = 0 ; else if ( selectionOffset + selectionLength > fullText . length ( ) ) selectionLength = fullText . length ( ) - selectionOffset ; for ( ; selectionOffset + selectionLength < f... | Fixes the selection length to get the whole line . |
10,864 | void createImage ( String imageId ) throws TargetException { File targetDirectory = this . parameters . getTargetPropertiesDirectory ( ) ; String dockerFilePath = this . parameters . getTargetProperties ( ) . get ( GENERATE_IMAGE_FROM ) ; if ( ! Utils . isEmptyOrWhitespaces ( dockerFilePath ) && targetDirectory != null... | Creates an image . |
10,865 | public String login ( String user , String pwd ) { String token = null ; try { this . authService . authenticate ( user , pwd ) ; token = UUID . randomUUID ( ) . toString ( ) ; Long now = new Date ( ) . getTime ( ) ; this . tokenToLoginTime . put ( token , now ) ; this . tokenToUsername . put ( token , user ) ; } catch... | Authenticates a user and creates a new session . |
10,866 | public boolean isSessionValid ( final String token , long validityPeriod ) { boolean valid = false ; Long loginTime = null ; if ( token != null ) loginTime = this . tokenToLoginTime . get ( token ) ; if ( validityPeriod < 0 ) { valid = loginTime != null ; } else if ( loginTime != null ) { long now = new Date ( ) . getT... | Determines whether a session is valid . |
10,867 | public void processEvent ( SystemEvent event ) throws AbortProcessingException { if ( ! FacesContext . getCurrentInstance ( ) . isPostback ( ) ) { insertLabelBeforeThisInputField ( ) ; insertMessageBehindThisInputField ( ) ; } } | Catching the PreRenderViewEvent allows AngularFaces to modify the JSF tree by adding a label and a message . |
10,868 | private boolean associateElasticIp ( ) { String elasticIp = this . targetProperties . get ( Ec2Constants . ELASTIC_IP ) ; if ( ! Utils . isEmptyOrWhitespaces ( elasticIp ) ) { this . logger . fine ( "Associating an elastic IP with the instance. IP = " + elasticIp ) ; AssociateAddressRequest associateAddressRequest = ne... | Associates an elastic IP with the VM . |
10,869 | private String createVolume ( String storageId , String snapshotId , int size ) { String volumeType = Ec2IaasHandler . findStorageProperty ( this . targetProperties , storageId , VOLUME_TYPE_PREFIX ) ; if ( volumeType == null ) volumeType = "standard" ; CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest ... | Creates volume for EBS . |
10,870 | private boolean volumeCreated ( String volumeId ) { DescribeVolumesRequest dvs = new DescribeVolumesRequest ( ) ; ArrayList < String > volumeIds = new ArrayList < String > ( ) ; volumeIds . add ( volumeId ) ; dvs . setVolumeIds ( volumeIds ) ; DescribeVolumesResult dvsresult = null ; try { dvsresult = this . ec2Api . d... | Checks whether volume is created . |
10,871 | private boolean volumesCreated ( ) { for ( Map . Entry < String , String > entry : this . storageIdToVolumeId . entrySet ( ) ) { String volumeId = entry . getValue ( ) ; if ( ! volumeCreated ( volumeId ) ) return false ; } return true ; } | Checks whether all specified volumes are created . |
10,872 | private String lookupVolume ( String volumeIdOrName ) { String ret = null ; if ( ! Utils . isEmptyOrWhitespaces ( volumeIdOrName ) ) { DescribeVolumesRequest dvs = new DescribeVolumesRequest ( Collections . singletonList ( volumeIdOrName ) ) ; DescribeVolumesResult dvsresult = null ; try { dvsresult = this . ec2Api . d... | Looks up volume by ID or Name tag . |
10,873 | public String get ( String key ) { String result ; try { result = this . bundle . getString ( key ) ; } catch ( MissingResourceException e ) { result = OOPS + key + '!' ; } return result ; } | Finds an internationalized string by key . |
10,874 | public Map < String , String > getExternalExports ( ) { return this . template != null ? this . template . externalExports : new HashMap < String , String > ( 0 ) ; } | A shortcut method to access the template s external exports mapping . |
10,875 | public boolean replaceApplicationBindings ( String externalExportPrefix , Set < String > applicationNames ) { boolean changed = false ; Set < String > oldApplicationNames = this . applicationBindings . remove ( externalExportPrefix ) ; if ( oldApplicationNames == null ) { changed = ! applicationNames . isEmpty ( ) ; } ... | Replaces application bindings for a given prefix . |
10,876 | static void interceptLoadingFiles ( Properties props ) throws IOException { Logger logger = Logger . getLogger ( UserDataHelpers . class . getName ( ) ) ; Set < String > keys = props . stringPropertyNames ( ) ; for ( final String key : keys ) { if ( ! key . startsWith ( ENCODE_FILE_CONTENT_PREFIX ) ) continue ; String ... | Intercepts the properties and loads file contents . |
10,877 | public void run ( String [ ] args ) throws Exception { if ( args . length != 1 ) throw new RuntimeException ( "A file path was expected as an argument." ) ; File targetFile = new File ( args [ 0 ] ) ; if ( ! targetFile . isFile ( ) ) throw new RuntimeException ( "File " + targetFile + " does not exist." ) ; Field [ ] f... | The real method that does the job . |
10,878 | public void extendComponent ( Component component ) { if ( this . extendedComponent != null ) this . extendedComponent . extendingComponents . remove ( this ) ; component . extendingComponents . add ( this ) ; this . extendedComponent = component ; } | Creates a bi - directional relation between this component and an extended one . |
10,879 | public List < Rule > findRulesToExecute ( ) { this . logger . fine ( "Looking for rules to execute after an event was recorded for application " + this . app ) ; List < Rule > result = new ArrayList < > ( ) ; long now = System . nanoTime ( ) ; for ( Rule rule : this . ruleNameToRule . values ( ) ) { long validPeriodSta... | Finds the rules to execute after an event was recorded . |
10,880 | private String safeApply ( Collection < InstanceContextBean > instances , Options options , String componentPath ) throws IOException { String installerName = ( String ) options . hash . get ( "installer" ) ; final InstanceFilter filter = InstanceFilter . createFilter ( componentPath , installerName ) ; final Collectio... | Same as above but with type - safe arguments . |
10,881 | private static Collection < InstanceContextBean > descendantInstances ( final InstanceContextBean instance ) { final Collection < InstanceContextBean > result = new ArrayList < InstanceContextBean > ( ) ; for ( final InstanceContextBean child : instance . getChildren ( ) ) { result . add ( child ) ; result . addAll ( d... | Returns all the descendant instances of the given instance . |
10,882 | public Class < ? > reflectClass ( final String className ) { Preconditions . checkArgument ( className != null && className . trim ( ) . length ( ) > 0 , "className cannot be null or empty" ) ; return provider . getClassReflectionProvider ( className ) . reflectClass ( ) ; } | This method will reflect a Class object that is represented by className . |
10,883 | public < T > ClassController < T > on ( final Class < T > clazz ) { return new DefaultClassController < T > ( provider , clazz ) ; } | Method to access reflection on clazz . |
10,884 | ComputeService jcloudContext ( Map < String , String > targetProperties ) throws TargetException { validate ( targetProperties ) ; ComputeServiceContext context = ContextBuilder . newBuilder ( targetProperties . get ( PROVIDER_ID ) ) . endpoint ( targetProperties . get ( ENDPOINT ) ) . credentials ( targetProperties . ... | Creates a JCloud context . |
10,885 | static void validate ( Map < String , String > targetProperties ) throws TargetException { checkProperty ( PROVIDER_ID , targetProperties ) ; checkProperty ( ENDPOINT , targetProperties ) ; checkProperty ( IMAGE_NAME , targetProperties ) ; checkProperty ( SECURITY_GROUP , targetProperties ) ; checkProperty ( IDENTITY ,... | Validates the target properties . |
10,886 | void updateAgentConfigurationFile ( TargetHandlerParameters parameters , SSHClient ssh , File tmpDir , Map < String , String > keyToNewValue ) throws IOException { this . logger . fine ( "Updating agent parameters on remote host..." ) ; String agentConfigDir = Utils . getValue ( parameters . getTargetProperties ( ) , S... | Updates the configuration file of an agent . |
10,887 | public static void updateImports ( Instance instance , Map < String , Collection < Import > > variablePrefixToImports ) { instance . getImports ( ) . clear ( ) ; if ( variablePrefixToImports != null ) instance . getImports ( ) . putAll ( variablePrefixToImports ) ; } | Updates the imports of an instance with new values . |
10,888 | public static Import findImportByExportingInstance ( Collection < Import > imports , String exportingInstancePath ) { Import result = null ; if ( imports != null && exportingInstancePath != null ) { for ( Import imp : imports ) { if ( exportingInstancePath . equals ( imp . getInstancePath ( ) ) ) { result = imp ; break... | Finds a specific import from the path of the instance that exports it . |
10,889 | public static Map < String , String > httpMessagingConfiguration ( String ip , int port ) { final Map < String , String > result = new LinkedHashMap < > ( ) ; result . put ( MessagingConstants . MESSAGING_TYPE_PROPERTY , HttpConstants . FACTORY_HTTP ) ; result . put ( HttpConstants . HTTP_SERVER_IP , ip == null ? HttpC... | Return a HTTP messaging configuration for the given parameters . |
10,890 | public List < Preference > listPreferences ( ) { this . logger . finer ( "Getting all the preferences." ) ; WebResource path = this . resource . path ( UrlConstants . PREFERENCES ) ; List < Preference > result = this . wsClient . createBuilder ( path ) . accept ( MediaType . APPLICATION_JSON ) . get ( new GenericType <... | Lists all the preferences . |
10,891 | public static String resolve ( String lang ) { String result ; if ( ! LANGUAGES . contains ( lang ) ) result = EN ; else result = lang ; return result ; } | Resolves a language to a supported translation . |
10,892 | static Map < String , String > loadContent ( String lang ) { Map < String , String > result = new LinkedHashMap < > ( ) ; try { InputStream in = TranslationBundle . class . getResourceAsStream ( "/" + lang + ".json" ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; Utils . copyStreamSafely ( in , os ) ; St... | Loads content from JSon files . |
10,893 | static void parseProperties ( Map < String , String > targetProperties ) throws TargetException { String [ ] properties = { Ec2Constants . EC2_ENDPOINT , Ec2Constants . EC2_ACCESS_KEY , Ec2Constants . EC2_SECRET_KEY , Ec2Constants . AMI_VM_NODE , Ec2Constants . VM_INSTANCE_TYPE , Ec2Constants . SSH_KEY_NAME , Ec2Consta... | Parses the properties and saves them in a Java bean . |
10,894 | public static AmazonEC2 createEc2Client ( Map < String , String > targetProperties ) throws TargetException { parseProperties ( targetProperties ) ; AWSCredentials credentials = new BasicAWSCredentials ( targetProperties . get ( Ec2Constants . EC2_ACCESS_KEY ) , targetProperties . get ( Ec2Constants . EC2_SECRET_KEY ) ... | Creates a client for EC2 . |
10,895 | private RunInstancesRequest prepareEC2RequestNode ( Map < String , String > targetProperties , String userData ) throws UnsupportedEncodingException { RunInstancesRequest runInstancesRequest = new RunInstancesRequest ( ) ; String flavor = targetProperties . get ( Ec2Constants . VM_INSTANCE_TYPE ) ; if ( Utils . isEmpty... | Prepares the request . |
10,896 | private Set < String > registerTargets ( ApplicationTemplate tpl ) throws IOException , UnauthorizedActionException { IOException conflictException = null ; Set < String > newTargetIds = new HashSet < > ( ) ; Map < Component , Set < String > > componentToTargetIds = new HashMap < > ( ) ; componentLoop : for ( Map . Ent... | Registers the targets available in this template . |
10,897 | private void unregisterTargets ( Set < String > newTargetIds ) { for ( String targetId : newTargetIds ) { try { this . targetsMngr . deleteTarget ( targetId ) ; } catch ( Exception e ) { this . logger . severe ( "A target ID that has just been registered could not be created. That's weird." ) ; Utils . logException ( t... | Unregisters targets . |
10,898 | public static InstanceContext parse ( String s ) { String name = null , qualifier = null , instancePathOrComponentName = null ; if ( s != null ) { Matcher m = Pattern . compile ( "(.*)::(.*)::(.*)" ) . matcher ( s ) ; if ( m . matches ( ) ) { name = m . group ( 1 ) . equals ( "null" ) ? null : m . group ( 1 ) ; qualifi... | Parses a string to resolve a target mapping key . |
10,899 | public static String buildTopicNameForAgent ( Instance instance ) { Instance scopedInstance = InstanceHelpers . findScopedInstance ( instance ) ; return buildTopicNameForAgent ( InstanceHelpers . computeInstancePath ( scopedInstance ) ) ; } | Builds the default topic name for an agent . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.