idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
6,300
private RunInstancesResponseType runInstances ( final String imageId , final String instanceType , final int minCount , final int maxCount ) { RunInstancesResponseType ret = new RunInstancesResponseType ( ) ; RunningInstancesSetType instSet = new RunningInstancesSetType ( ) ; Class < ? extends AbstractMockEc2Instance >...
Handles runInstances request with only simplified filters of imageId instanceType minCount and maxCount .
6,301
private StartInstancesResponseType startInstances ( final Set < String > instanceIDs ) { StartInstancesResponseType ret = new StartInstancesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType ( ) ; changeSet . getItem ( )...
Handles startInstances request with only a simplified filter of instanceIDs .
6,302
private StopInstancesResponseType stopInstances ( final Set < String > instanceIDs ) { StopInstancesResponseType ret = new StopInstancesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType ( ) ; changeSet . getItem ( ) . a...
Handles stopInstances request with only a simplified filter of instanceIDs .
6,303
private TerminateInstancesResponseType terminateInstances ( final Set < String > instanceIDs ) { TerminateInstancesResponseType ret = new TerminateInstancesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; InstanceStateChangeSetType changeSet = new InstanceStateChangeSetType ( ) ; changeS...
Handles terminateInstances request with only a simplified filter of instanceIDs .
6,304
private DescribeImagesResponseType describeImages ( final Set < String > imageId ) { DescribeImagesResponseType ret = new DescribeImagesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; DescribeImagesResponseInfoType info = new DescribeImagesResponseInfoType ( ) ; for ( String ami : MOCK_...
Handles describeImages request as simple as without any filters to use .
6,305
private DescribeRouteTablesResponseType describeRouteTables ( ) { DescribeRouteTablesResponseType ret = new DescribeRouteTablesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; RouteTableSetType routeTableSet = new RouteTableSetType ( ) ; for ( Iterator < MockRouteTable > mockRouteTable =...
Handles describeRouteTables request and returns response with a route table .
6,306
private CreateRouteTableResponseType createRouteTable ( final String vpcId , final String cidrBlock ) { CreateRouteTableResponseType ret = new CreateRouteTableResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockRouteTable mockRouteTable = mockRouteTableController . createRouteTable ( ci...
Handles createRouteTable request to create routetable and returns response with a route table .
6,307
private CreateRouteResponseType createRoute ( final String destinationCidrBlock , final String internetGatewayId , final String routeTableId ) { CreateRouteResponseType ret = new CreateRouteResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockRouteTableController . createRoute ( destinat...
Handles createRoute request to create route and returns response with a route table .
6,308
private CreateVolumeResponseType createVolume ( final String volumeType , final String size , final String availabilityZone , final int iops , final String snapshotId ) { CreateVolumeResponseType ret = new CreateVolumeResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockVolume mockVolume...
Handles createVolume request to create volume and returns response with a volume .
6,309
private CreateSubnetResponseType createSubnet ( final String vpcId , final String cidrBlock ) { CreateSubnetResponseType ret = new CreateSubnetResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockSubnet mockSubnet = mockSubnetController . createSubnet ( cidrBlock , vpcId ) ; SubnetType s...
Handles createSubnet request to create Subnet and returns response with a subnet .
6,310
private CreateSecurityGroupResponseType createSecurityGroup ( final String groupName , final String groupDescription , final String vpcId ) { CreateSecurityGroupResponseType ret = new CreateSecurityGroupResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockSecurityGroup mockSecurityGroup ...
Handles createSecurityGroup request to create SecurityGroup and returns response with a SecurityGroup .
6,311
private AuthorizeSecurityGroupIngressResponseType authorizeSecurityGroupIngress ( final String groupId , final String ipProtocol , final Integer fromPort , final Integer toPort , final String cidrIp ) { AuthorizeSecurityGroupIngressResponseType ret = new AuthorizeSecurityGroupIngressResponseType ( ) ; ret . setRequestI...
Handles authorizeSecurityGroupIngress request to SecurityGroup and returns response with a SecurityGroup .
6,312
private AuthorizeSecurityGroupEgressResponseType authorizeSecurityGroupEgress ( final String groupId , final String ipProtocol , final Integer fromPort , final Integer toPort , final String cidrIp ) { AuthorizeSecurityGroupEgressResponseType ret = new AuthorizeSecurityGroupEgressResponseType ( ) ; ret . setRequestId ( ...
Handles authorizeSecurityGroupEgress request to SecurityGroup and returns response with a SecurityGroup .
6,313
private CreateInternetGatewayResponseType createInternetGateway ( ) { CreateInternetGatewayResponseType ret = new CreateInternetGatewayResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockInternetGateway mockInternetGateway = mockInternetGatewayController . createInternetGateway ( ) ; In...
Handles createInternetGateway request to create InternetGateway and returns response with a InternetGateway .
6,314
private DeleteRouteTableResponseType deleteRouteTable ( final String routeTableId ) { DeleteRouteTableResponseType ret = new DeleteRouteTableResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockRouteTableController . deleteRouteTable ( routeTableId ) ; return ret ; }
Handles deleteRouteTable request to delete routetable and returns response with a route table .
6,315
private DeleteSubnetResponseType deleteSubnet ( final String subnetId ) { DeleteSubnetResponseType ret = new DeleteSubnetResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockSubnetController . deleteSubnet ( subnetId ) ; return ret ; }
Handles deleteSubnet request to delete subnet and returns response with a subnet .
6,316
private DeleteSecurityGroupResponseType deleteSecurityGroup ( final String securityGroupId ) { DeleteSecurityGroupResponseType ret = new DeleteSecurityGroupResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockSecurityGroupController . deleteSecurityGroup ( securityGroupId ) ; return ret ...
Handles deleteSecurityGroup request to delete SecurityGroup and returns response with a SecurityGroup .
6,317
private DeleteVolumeResponseType deleteVolume ( final String volumeId ) { DeleteVolumeResponseType ret = new DeleteVolumeResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockVolumeController . deleteVolume ( volumeId ) ; return ret ; }
Handles deleteVolume request to delete volume and returns response with a volume .
6,318
private boolean isVolumeIdExists ( final List < String > volumeIds , final String volumeId ) { if ( volumeIds != null && volumeIds . size ( ) > 0 ) { for ( String volId : volumeIds ) { if ( volId . equals ( volumeId ) ) { return true ; } } } return false ; }
Check whether volumeId exists in list .
6,319
private DescribeSubnetsResponseType describeSubnets ( ) { DescribeSubnetsResponseType ret = new DescribeSubnetsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; SubnetSetType subnetSetType = new SubnetSetType ( ) ; for ( Iterator < MockSubnet > mockSubnet = mockSubnetController . describe...
Handles describeSubnets request and returns response with a subnet Set .
6,320
private DescribeInternetGatewaysResponseType describeInternetGateways ( ) { DescribeInternetGatewaysResponseType ret = new DescribeInternetGatewaysResponseType ( ) ; InternetGatewaySetType internetGatewaySet = new InternetGatewaySetType ( ) ; for ( Iterator < MockInternetGateway > mockInternetGateway = mockInternetGate...
Handles describeInternetGateways request and returns response with a Internet gateway .
6,321
private DescribeSecurityGroupsResponseType describeSecurityGroups ( ) { DescribeSecurityGroupsResponseType ret = new DescribeSecurityGroupsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; SecurityGroupSetType securityGroupSet = new SecurityGroupSetType ( ) ; for ( Iterator < MockSecurity...
Handles describeSecurityGroups request and returns response with a security group .
6,322
private DescribeVpcsResponseType describeVpcs ( ) { DescribeVpcsResponseType ret = new DescribeVpcsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; VpcSetType vpcSet = new VpcSetType ( ) ; for ( Iterator < MockVpc > mockVpc = mockVpcController . describeVpcs ( ) . iterator ( ) ; mockVpc ...
Handles describeVpcs request and returns response with a vpc .
6,323
private DescribeTagsResponseType describeTags ( ) { DescribeTagsResponseType ret = new DescribeTagsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; TagSetType tagsSet = new TagSetType ( ) ; for ( MockTags mockVpc : mockTagsController . describeTags ( ) ) { for ( String resourceId : mockV...
Handles describeTags request and returns response with a Tags .
6,324
private CreateTagsResponseType createTags ( final List < String > resourcesSet , final Map < String , String > tagSet ) { CreateTagsResponseType ret = new CreateTagsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockTagsController . createTags ( resourcesSet , tagSet ) ; ret . setRetur...
Handles createTags request and create new Tags .
6,325
private DeleteTagsResponseType deleteTags ( final List < String > resources ) { DeleteTagsResponseType ret = new DeleteTagsResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockTagsController . deleteTags ( resources ) ; return ret ; }
Handles deleteTags request and delete Tags and returns response .
6,326
private CreateVpcResponseType createVpc ( final String cidrBlock , final String instanceTenancy ) { CreateVpcResponseType ret = new CreateVpcResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; MockVpc mockVpc = mockVpcController . createVpc ( cidrBlock , instanceTenancy ) ; VpcType vpcType ...
Handles createVpc request and create new Vpc .
6,327
private DeleteVpcResponseType deleteVpc ( final String vpcId ) { DeleteVpcResponseType ret = new DeleteVpcResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; mockVpcController . deleteVpc ( vpcId ) ; return ret ; }
Handles deleteVpc request and delete Vpc and returns response .
6,328
private String getXmlError ( final String errorCode , final String errorMessage ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( "errorCode" , StringEscapeUtils . escapeXml ( errorCode ) ) ; data . put ( "errorMessage" , StringEscapeUtils . escapeXml ( errorMessage ) ) ; data . put ...
Generate error response body in xml and write it with writer .
6,329
private String getBlankResponseXml ( ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( "requestID" , UUID . randomUUID ( ) . toString ( ) ) ; String ret = null ; try { ret = TemplateUtils . get ( BLANK_RESPONSE_TEMPLATE , data ) ; } catch ( AwsMockException e ) { log . error ( "fatal...
Generate blank response body in xml and write it with writer .
6,330
public Collection < AbstractMockEc2Instance > describeInstances ( final Set < String > instanceIDs ) { if ( null == instanceIDs || instanceIDs . size ( ) == 0 ) { return allMockEc2Instances . values ( ) ; } else { return getInstances ( instanceIDs ) ; } }
List mock ec2 instances in current aws - mock .
6,331
public List < String > listInstanceIDs ( final Set < String > instanceIDs ) { Set < String > allInstanceIDs = allMockEc2Instances . keySet ( ) ; if ( null == instanceIDs || instanceIDs . size ( ) == 0 ) { return new ArrayList < String > ( allInstanceIDs ) ; } else { List < String > filteredInstanceIDs = new ArrayList <...
List mock ec2 instance IDs in current aws - mock .
6,332
public List < InstanceStateChangeType > stopInstances ( final Set < String > instanceIDs ) { List < InstanceStateChangeType > ret = new ArrayList < InstanceStateChangeType > ( ) ; Collection < AbstractMockEc2Instance > instances = getInstances ( instanceIDs ) ; for ( AbstractMockEc2Instance instance : instances ) { if ...
Stop one or more existing mock ec2 instances .
6,333
private Collection < AbstractMockEc2Instance > getInstances ( final Set < String > instanceIDs ) { Collection < AbstractMockEc2Instance > ret = new ArrayList < AbstractMockEc2Instance > ( ) ; for ( String instanceID : instanceIDs ) { ret . add ( getMockEc2Instance ( instanceID ) ) ; } return ret ; }
Get mock ec2 instances by instance IDs .
6,334
public void destroyCleanupTerminatedInstanceTimer ( ) { cleanupTerminatedInstancesScheduledFuture . cancel ( true ) ; cleanupTerminatedInstancesScheduledFuture = null ; cleanupTerminatedInstancesTimer . shutdown ( ) ; cleanupTerminatedInstancesTimer = null ; }
Cancel the internal timer of cleaning up terminated mock ec2 instances .
6,335
public static List < Image > describeAllImages ( ) { AWSCredentials credentials = new BasicAWSCredentials ( "foo" , "bar" ) ; AmazonEC2Client amazonEC2Client = new AmazonEC2Client ( credentials ) ; String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/" ; amazonEC2Client . setEndpoint ( ec2Endpoint ) ; Desc...
Describe all available AMIs within aws - mock .
6,336
public MockVpc createVpc ( final String cidrBlock , final String instanceTenancy ) { MockVpc ret = new MockVpc ( ) ; ret . setCidrBlock ( cidrBlock ) ; ret . setVpcId ( "vpc-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , VPC_ID_POSTFIX_LENGTH ) ) ; ret . setInstanceTenancy ( instanceTenancy ) ; synchronized...
Create the mock VPC .
6,337
public MockVpc deleteVpc ( final String vpcId ) { if ( vpcId != null && allMockVpcInstances . containsKey ( vpcId ) ) { return allMockVpcInstances . remove ( vpcId ) ; } return null ; }
Delete vpc .
6,338
private GetMetricStatisticsResponse getMetricStatistics ( final String [ ] statistics , final DateTime startTime , final DateTime endTime , final int period , final String metricName ) { GetMetricStatisticsResponse ret = new GetMetricStatisticsResponse ( ) ; GetMetricStatisticsResult result = new GetMetricStatisticsRes...
Handles GetMetricStatistics request as simple as without any filters to use .
6,339
private DescribeAlarmsResponse describeAlarms ( ) { DescribeAlarmsResponse ret = new DescribeAlarmsResponse ( ) ; DescribeAlarmsResult result = new DescribeAlarmsResult ( ) ; MetricAlarms metricAlarms = new MetricAlarms ( ) ; MetricAlarm metricAlarm = new MetricAlarm ( ) ; metricAlarm . setAlarmDescription ( "CPU usage...
Handles describeAlarms request .
6,340
private XMLGregorianCalendar toXMLGregorianCalendar ( final DateTime date ) { GregorianCalendar gCalendar = new GregorianCalendar ( date . getZone ( ) . toTimeZone ( ) ) ; gCalendar . setTime ( date . toDate ( ) ) ; XMLGregorianCalendar xmlGrogerianCalendar = null ; try { xmlGrogerianCalendar = DatatypeFactory . newIns...
Converts java . util . Date to javax . xml . datatype . XMLGregorianCalendar .
6,341
private StandardUnit getMetricUnit ( final String metricName ) { String result = null ; if ( metricName . equals ( Constants . CPU_UTILIZATION ) ) { result = Constants . UNIT_PERCENT ; } else if ( metricName . equals ( Constants . DISK_READ_BYTES ) ) { result = Constants . UNIT_BYTES ; } else if ( metricName . equals (...
Get the Metric Unit .
6,342
public static void write ( final String templateFilename , final Map < String , Object > data , final Writer writer ) { Template tmpl = null ; try { tmpl = conf . getTemplate ( templateFilename ) ; } catch ( FileNotFoundException e1 ) { String errMsg = "FileNotFoundException: template file '" + templateFilename + "' no...
Process with given template + data and then put result to writer .
6,343
public static String get ( final String templateName , final Map < String , Object > data ) { StringWriter writer = new StringWriter ( ) ; write ( templateName , data , writer ) ; return writer . toString ( ) ; }
Process with given template + data and get result as a string .
6,344
public static void saveAll ( final Object obj , final PersistenceStoreType storeType ) { try { File file = new File ( persistenceStorePath + File . separator + storeType ) ; File directory = file . getParentFile ( ) ; if ( null != directory && ! directory . exists ( ) ) { directory . mkdirs ( ) ; } log . info ( "aws-mo...
Save object to the binary file defined as filename in property persistence . store . file .
6,345
public static Object loadAll ( final PersistenceStoreType storeType ) { Object ret = null ; try { File file = new File ( persistenceStorePath + File . separator + storeType ) ; log . info ( "aws-mock: try to load objects from {}" , file . getAbsolutePath ( ) ) ; ObjectInputStream in = new ObjectInputStream ( new FileIn...
Load object from the binary file defined as filename in property .
6,346
public MockVolume createVolume ( final String volumeType , final String size , final String availabilityZone , final int iops , final String snapshotId ) { MockVolume ret = new MockVolume ( ) ; ret . setVolumeType ( volumeType ) ; ret . setVolumeId ( "vol-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , VOLUM...
Create the mock Volume .
6,347
public MockVolume deleteVolume ( final String volumeId ) { if ( volumeId != null && allMockVolumes . containsKey ( volumeId ) ) { return allMockVolumes . remove ( volumeId ) ; } return null ; }
Delete Mock Volume .
6,348
public final void contextInitialized ( final ServletContextEvent sce ) { if ( persistenceEnabled ) { AbstractMockEc2Instance [ ] instanceArray = ( AbstractMockEc2Instance [ ] ) PersistenceUtils . loadAll ( PersistenceStoreType . EC2 ) ; if ( null != instanceArray ) { MockEc2Controller . getInstance ( ) . restoreAllMock...
We load the saved instances if persistence of enabled on web application starting .
6,349
public final void contextDestroyed ( final ServletContextEvent sce ) { Collection < AbstractMockEc2Instance > instances = MockEc2Controller . getInstance ( ) . getAllMockEc2Instances ( ) ; for ( AbstractMockEc2Instance instance : instances ) { instance . destroyInternalTimer ( ) ; } if ( persistenceEnabled ) { Abstract...
We save the instances if persistence of enabled on web application shutting - down .
6,350
public static String marshall ( final GetMetricStatisticsResponse obj , final String localPartQName , final String requestVersion ) { StringWriter writer = new StringWriter ( ) ; try { synchronized ( jaxbMarshaller ) { JAXBElement < GetMetricStatisticsResponse > jAXBElement = new JAXBElement < GetMetricStatisticsRespon...
marshall object to string .
6,351
public MockRouteTable createRouteTable ( final String cidrBlock , final String vpcId ) { MockRouteTable ret = new MockRouteTable ( ) ; ret . setRouteTableId ( "rtb-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , ROUTETABLE_ID_POSTFIX_LENGTH ) ) ; ret . setVpcId ( vpcId ) ; MockRoute mockRoute = new MockRoute...
Create the mock RouteTable .
6,352
public MockRouteTable deleteRouteTable ( final String routetableId ) { if ( routetableId != null && allMockRouteTables . containsKey ( routetableId ) ) { return allMockRouteTables . remove ( routetableId ) ; } return null ; }
Delete RouteTable .
6,353
public MockRoute createRoute ( final String destinationCidrBlock , final String internetGatewayId , final String routeTableId ) { MockRoute ret = new MockRoute ( ) ; ret . setDestinationCidrBlock ( destinationCidrBlock ) ; ret . setGatewayId ( internetGatewayId ) ; ret . setOrigin ( "CreateRoute" ) ; MockRouteTable moc...
Create the mock Route .
6,354
public MockRouteTable getMockRouteTable ( final String routetableId ) { if ( routetableId != null ) { return allMockRouteTables . get ( routetableId ) ; } return null ; }
Get mock RouteTable instance by RouteTable ID .
6,355
public MockSecurityGroup createSecurityGroup ( final String groupName , final String groupDescription , final String vpcId ) { MockSecurityGroup ret = new MockSecurityGroup ( ) ; ret . setGroupName ( groupName ) ; ret . setGroupDescription ( groupDescription ) ; ret . setGroupId ( "sg-" + UUID . randomUUID ( ) . toStri...
Create the mock SecurityGroup .
6,356
public MockSecurityGroup authorizeSecurityGroupIngress ( final String groupId , final String ipProtocol , final Integer fromPort , final Integer toPort , final String cidrIp ) { if ( groupId == null ) { return null ; } MockSecurityGroup ret = allMockSecurityGroup . get ( groupId ) ; if ( ret != null ) { MockIpPermissio...
Authorize the mock SecurityGroup to Ingress IpProtocol .
6,357
public MockSecurityGroup deleteSecurityGroup ( final String securityGroupId ) { if ( securityGroupId != null && allMockSecurityGroup . containsKey ( securityGroupId ) ) { return allMockSecurityGroup . remove ( securityGroupId ) ; } return null ; }
Delete MockSecurityGroup .
6,358
public static List < Instance > runInstances ( final String imageId , final int runCount ) { AWSCredentials credentials = new BasicAWSCredentials ( "foo" , "bar" ) ; AmazonEC2Client amazonEC2Client = new AmazonEC2Client ( credentials ) ; String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/" ; amazonEC2Cli...
Run some new ec2 instances .
6,359
public MockTags createTags ( final List < String > resourcesSet , final Map < String , String > tagSet ) { MockTags ret = new MockTags ( ) ; ret . setResourcesSet ( resourcesSet ) ; ret . setTagSet ( tagSet ) ; allMockTags . add ( ret ) ; return ret ; }
Create the mock Tags .
6,360
public boolean deleteTags ( final List < String > resources ) { for ( MockTags mockTags : allMockTags ) { if ( mockTags . getResourcesSet ( ) . containsAll ( resources ) ) { allMockTags . remove ( mockTags ) ; return true ; } } return false ; }
Delete Mock tags .
6,361
public static Set < String > getPropertiesByPrefix ( final String propertyNamePrefix ) { Set < String > ret = new TreeSet < String > ( ) ; Set < Object > keys = properties . keySet ( ) ; for ( Object key : keys ) { if ( null != key && key . toString ( ) . startsWith ( propertyNamePrefix ) ) { ret . add ( properties . g...
Get a set of properties those share the same given name prefix .
6,362
public static int getIntFromProperty ( final String propertyName ) { try { return Integer . parseInt ( properties . getProperty ( propertyName ) ) ; } catch ( NumberFormatException e ) { log . error ( "NumberFormatException caught during reading property from properties file: " + e . getMessage ( ) ) ; return 0 ; } }
Get int type of property value by name .
6,363
public static void startScheduler ( int threadPoolSize , String annotatedJobsPackageName ) throws SundialSchedulerException { try { createScheduler ( threadPoolSize , annotatedJobsPackageName ) ; getScheduler ( ) . start ( ) ; } catch ( SchedulerException e ) { throw new SundialSchedulerException ( "COULD NOT START SUN...
Starts the Sundial Scheduler
6,364
public static void startJob ( String jobName ) throws SundialSchedulerException { try { getScheduler ( ) . triggerJob ( jobName , null ) ; } catch ( SchedulerException e ) { throw new SundialSchedulerException ( "ERROR STARTING JOB!!!" , e ) ; } }
Starts a Job matching the given Job Name
6,365
public static void removeJob ( String jobName ) throws SundialSchedulerException { try { getScheduler ( ) . deleteJob ( jobName ) ; } catch ( SchedulerException e ) { throw new SundialSchedulerException ( "ERROR REMOVING JOB!!!" , e ) ; } }
Removes a Job matching the given Job Name
6,366
public static void startJob ( String jobName , Map < String , Object > params ) throws SundialSchedulerException { try { JobDataMap jobDataMap = new JobDataMap ( ) ; for ( String key : params . keySet ( ) ) { jobDataMap . put ( key , params . get ( key ) ) ; } getScheduler ( ) . triggerJob ( jobName , jobDataMap ) ; } ...
Starts a Job matching the the given Job Name found in jobs . xml or jobs manually added .
6,367
public static void removeTrigger ( String triggerName ) throws SundialSchedulerException { try { getScheduler ( ) . unscheduleJob ( triggerName ) ; } catch ( SchedulerException e ) { throw new SundialSchedulerException ( "ERROR REMOVING TRIGGER!!!" , e ) ; } }
Removes a Trigger matching the the given Trigger Name
6,368
public static List < String > getAllJobNames ( ) throws SundialSchedulerException { List < String > allJobNames = new ArrayList < String > ( ) ; try { Set < String > allJobKeys = getScheduler ( ) . getJobKeys ( ) ; for ( String jobKey : allJobKeys ) { allJobNames . add ( jobKey ) ; } } catch ( SchedulerException e ) { ...
Generates an alphabetically sorted List of all Job names in the DEFAULT job group
6,369
public static Map < String , List < Trigger > > getAllJobsAndTriggers ( ) throws SundialSchedulerException { Map < String , List < Trigger > > allJobsMap = new TreeMap < String , List < Trigger > > ( ) ; try { Set < String > allJobKeys = getScheduler ( ) . getJobKeys ( ) ; for ( String jobKey : allJobKeys ) { List < Tr...
Generates a Map of all Job names with corresponding Triggers
6,370
public static void shutdown ( ) throws SundialSchedulerException { logger . debug ( "shutdown() called." ) ; try { getScheduler ( ) . shutdown ( ) ; scheduler = null ; } catch ( Exception e ) { throw new SundialSchedulerException ( "COULD NOT SHUTDOWN SCHEDULER!!!" , e ) ; } }
Halts the Scheduler s firing of Triggers and cleans up all resources associated with the Scheduler .
6,371
private void initDocumentParser ( ) throws ParserConfigurationException { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; docBuilderFactory . setNamespaceAware ( false ) ; docBuilderFactory . setValidating ( true ) ; docBuilderFactory . setAttribute ( "http://java.sun.com/xml/jaxp/...
Initializes the XML parser .
6,372
public void processFile ( String fileName , boolean failOnFileNotFound ) throws Exception { boolean fileFound = false ; InputStream f = null ; try { String furl = null ; File file = new File ( fileName ) ; if ( ! file . exists ( ) ) { URL url = classLoadHelper . getResource ( fileName ) ; if ( url != null ) { try { fur...
Process the xml file in the given location and schedule all of the jobs defined within it .
6,373
public void scheduleJobs ( Scheduler sched ) throws SchedulerException { List < JobDetail > jobs = new LinkedList < JobDetail > ( getLoadedJobs ( ) ) ; List < OperableTrigger > triggers = new LinkedList < OperableTrigger > ( getLoadedTriggers ( ) ) ; logger . info ( "Adding " + jobs . size ( ) + " jobs, " + triggers . ...
Schedules the given sets of jobs and triggers .
6,374
public ThreadGroup getSchedulerThreadGroup ( ) { if ( threadGroup == null ) { threadGroup = new ThreadGroup ( "QuartzScheduler" ) ; if ( quartzSchedulerResources . getMakeSchedulerThreadDaemon ( ) ) { threadGroup . setDaemon ( true ) ; } } return threadGroup ; }
Returns the name of the thread group for Quartz s main threads .
6,375
protected void initContextContainer ( JobExecutionContext jobExecutionContext ) { JobContext jobContext = new JobContext ( ) ; jobContext . addQuartzContext ( jobExecutionContext ) ; contextContainer . set ( jobContext ) ; }
Initialize the ThreadLocal with a JobExecutionContext object
6,376
public void shutdown ( ) { synchronized ( nextRunnableLock ) { isShutdown = true ; if ( workers == null ) { return ; } Iterator < WorkerThread > workerThreads = workers . iterator ( ) ; while ( workerThreads . hasNext ( ) ) { WorkerThread wt = workerThreads . next ( ) ; JobRunShell jobRunShell = wt . getRunnable ( ) ; ...
Terminate any worker threads in this thread group .
6,377
public List < Trigger > getTriggersForJob ( String jobKey ) { ArrayList < Trigger > trigList = new ArrayList < Trigger > ( ) ; synchronized ( lock ) { for ( int i = 0 ; i < wrappedTriggers . size ( ) ; i ++ ) { TriggerWrapper tw = wrappedTriggers . get ( i ) ; if ( tw . jobKey . equals ( jobKey ) ) { trigList . add ( (...
Get all of the Triggers that are associated to the given Job .
6,378
public String getMessage ( ) { if ( getValidationExceptions ( ) . size ( ) == 0 ) { return super . getMessage ( ) ; } StringBuffer sb = new StringBuffer ( ) ; boolean first = true ; for ( Iterator iter = getValidationExceptions ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Exception e = ( Exception ) iter . next ( ) ; ...
Returns the detail message string .
6,379
public void addQuartzContext ( JobExecutionContext jobExecutionContext ) { for ( Object mapKey : jobExecutionContext . getMergedJobDataMap ( ) . keySet ( ) ) { map . put ( ( String ) mapKey , jobExecutionContext . getMergedJobDataMap ( ) . get ( mapKey ) ) ; } map . put ( KEY_JOB_NAME , jobExecutionContext . getJobDeta...
Add all the mappings from the JobExecutionContext to the JobContext
6,380
@ SuppressWarnings ( "unchecked" ) public < T > T get ( String key ) { T value = ( T ) map . get ( key ) ; return value ; }
Get a value from a key out of the JobContext
6,381
@ SuppressWarnings ( "unchecked" ) public < T > T getRequiredValue ( String key ) { T value = ( T ) map . get ( key ) ; if ( value == null ) { throw new RequiredParameterException ( ) ; } return value ; }
Get a required value from a key out of the Job Context
6,382
public static CronTriggerBuilder cronTriggerBuilder ( String cronExpression ) throws ParseException { CronExpression . validateExpression ( cronExpression ) ; return new CronTriggerBuilder ( cronExpression ) ; }
Create a CronScheduleBuilder with the given cron - expression .
6,383
public String escape ( String string ) { int end = string . length ( ) ; int index = nextEscapeIndex ( string , 0 , end ) ; return index == end ? string : escapeSlow ( string , index ) ; }
Returns the escaped form of a given literal string .
6,384
public void tick ( long duration , TimeUnit timeUnit ) { long remaining = toTicks ( duration , timeUnit ) ; do { remaining = deltaQueue . tick ( remaining ) ; runUntilIdle ( ) ; } while ( deltaQueue . isNotEmpty ( ) && remaining > 0 ) ; }
Runs time forwards by a given duration executing any commands scheduled for execution during that time period and any background tasks spawned by the scheduled tasks . Therefore when a call to tick returns the executor will be idle .
6,385
public void assertIsSatisfied ( ) { if ( firstError != null ) { throw firstError ; } else if ( ! dispatcher . isSatisfied ( ) ) { throw expectationErrorTranslator . translate ( ExpectationError . notAllSatisfied ( this ) ) ; } }
Fails the test if there are any expectations that have not been met .
6,386
public ScriptedAction where ( String name , Object value ) { try { interpreter . set ( name , value ) ; } catch ( EvalError e ) { throw new IllegalArgumentException ( "invalid name binding" , e ) ; } return this ; }
Defines a variable that can be referred to by the script .
6,387
@ SuppressWarnings ( "unchecked" ) private < T > T asMockedType ( @ SuppressWarnings ( "unused" ) T mockObject , Object capturingImposter ) { return ( T ) capturingImposter ; }
Damn you Java generics! Damn you to HELL!
6,388
protected synchronized void sendUpdates ( ) { log . debug ( "sendUpdates" ) ; final int currentVersion = getVersion ( ) ; log . debug ( "Current version: {}" , currentVersion ) ; final String name = getName ( ) ; Set < ISharedObjectEvent > ownerEvents = ownerMessage . getEvents ( ) ; if ( ! ownerEvents . isEmpty ( ) ) ...
Send update notification over data channel of RTMP connection
6,389
protected void notifyModified ( ) { log . debug ( "notifyModified - modified: {} update counter: {}" , modified . get ( ) , updateCounter . get ( ) ) ; if ( updateCounter . get ( ) == 0 ) { if ( modified . get ( ) ) { updateVersion ( ) ; lastModified = System . currentTimeMillis ( ) ; if ( storage == null || ! storage ...
Send notification about modification of SO
6,390
protected void returnAttributeValue ( String name ) { ownerMessage . addEvent ( Type . CLIENT_UPDATE_DATA , name , getAttribute ( name ) ) ; }
Return an attribute value to the owner .
6,391
public Object getAttribute ( String name , Object value ) { log . debug ( "getAttribute - name: {} value: {}" , name , value ) ; Object result = null ; if ( name != null ) { result = attributes . putIfAbsent ( name , value ) ; if ( result == null ) { modified . set ( true ) ; final SharedObjectEvent event = new SharedO...
Return attribute by name and set if it doesn t exist yet .
6,392
public boolean removeAttribute ( String name ) { boolean result = true ; final SharedObjectEvent event = new SharedObjectEvent ( Type . CLIENT_DELETE_DATA , name , null ) ; if ( ownerMessage . addEvent ( event ) ) { if ( super . removeAttribute ( name ) ) { modified . set ( true ) ; syncEvents . add ( event ) ; deleteS...
Removes attribute with given name
6,393
protected void sendMessage ( String handler , List < ? > arguments ) { final SharedObjectEvent event = new SharedObjectEvent ( Type . CLIENT_SEND_MESSAGE , handler , arguments ) ; if ( ownerMessage . addEvent ( event ) ) { syncEvents . add ( event ) ; sendStats . incrementAndGet ( ) ; if ( log . isTraceEnabled ( ) ) { ...
Broadcast event to event handler
6,394
protected boolean register ( IEventListener listener ) { log . debug ( "register - listener: {}" , listener ) ; boolean registered = listeners . add ( listener ) ; if ( registered ) { listenerStats . increment ( ) ; ownerMessage . addEvent ( Type . CLIENT_INITIAL_DATA , null , null ) ; if ( ! isPersistent ( ) ) { owner...
Register event listener
6,395
protected void unregister ( IEventListener listener ) { log . debug ( "unregister - listener: {}" , listener ) ; if ( listeners . remove ( listener ) ) { listenerStats . decrement ( ) ; } }
Unregister event listener
6,396
protected void checkRelease ( ) { if ( ! isPersistent ( ) && listeners . isEmpty ( ) && ! isAcquired ( ) ) { log . info ( "Deleting shared object {} because all clients disconnected and it is no longer acquired" , name ) ; if ( storage != null ) { if ( ! storage . remove ( this ) ) { log . error ( "Could not remove sha...
Check if shared object must be released .
6,397
protected void beginUpdate ( IEventListener listener ) { log . debug ( "beginUpdate - listener: {}" , listener ) ; source = listener ; updateCounter . incrementAndGet ( ) ; }
Begin update of this Shared Object and setting listener
6,398
protected boolean clear ( ) { log . debug ( "clear" ) ; super . removeAttributes ( ) ; ownerMessage . addEvent ( Type . CLIENT_CLEAR_DATA , name , null ) ; notifyModified ( ) ; changeStats . incrementAndGet ( ) ; return true ; }
Deletes all the attributes and sends a clear event to all listeners . The persistent data object is also removed from a persistent shared object .
6,399
protected void close ( ) { log . debug ( "close" ) ; closed . compareAndSet ( false , true ) ; super . removeAttributes ( ) ; listeners . clear ( ) ; syncEvents . clear ( ) ; ownerMessage . getEvents ( ) . clear ( ) ; }
Detaches a reference from this shared object reset it s state this will destroy the reference immediately . This is useful when you don t want to proxy a shared object any longer .