idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
2,300 | public RequestToken login ( BaasHandler < BaasUser > handler ) { return login ( null , RequestOptions . DEFAULT , handler ) ; } | Asynchronously logins this user . The handler will be invoked upon completion of the request . |
2,301 | public RequestToken login ( String registrationId , BaasHandler < BaasUser > handler ) { return login ( registrationId , RequestOptions . DEFAULT , handler ) ; } | Asynchronously logins this user with password and registrationId obtained through gcm . The handler will be invoked upon completion of the request . |
2,302 | public RequestToken login ( String regitrationId , int flags , BaasHandler < BaasUser > handler ) { BaasBox box = BaasBox . getDefault ( ) ; if ( password == null ) throw new IllegalStateException ( "password cannot be null" ) ; NetworkTask < BaasUser > task = new LoginRequest ( box , this , regitrationId , flags , han... | Asynchronously logins the user with password and registrationId obtained through gcm . The handler will be invoked upon completion of the request . The request is executed at the gien priority . |
2,303 | public BaasResult < BaasUser > loginSync ( String registrationId ) { BaasBox box = BaasBox . getDefault ( ) ; if ( password == null ) throw new IllegalStateException ( "password cannot be null" ) ; NetworkTask < BaasUser > task = new LoginRequest ( box , this , registrationId , RequestOptions . DEFAULT , null ) ; retur... | Synchronously logins the user with password and registrationId obtained through gcm . |
2,304 | public BaasResult < Void > logoutSync ( String registration ) { BaasBox box = BaasBox . getDefaultChecked ( ) ; LogoutRequest request = new LogoutRequest ( box , this , registration , RequestOptions . DEFAULT , null ) ; return box . submitSync ( request ) ; } | Synchronously logouts current user from the server . |
2,305 | public RequestToken save ( int flags , BaasHandler < BaasUser > handler ) { BaasBox box = BaasBox . getDefaultChecked ( ) ; SaveUser task = new SaveUser ( box , this , flags , handler ) ; return box . submitAsync ( task ) ; } | Asynchronously saves the updates made to the current user . |
2,306 | public BaasResult < BaasUser > saveSync ( ) { BaasBox box = BaasBox . getDefaultChecked ( ) ; SaveUser task = new SaveUser ( box , this , RequestOptions . DEFAULT , null ) ; return box . submitSync ( task ) ; } | Synchronously saves the updates made to the current user . |
2,307 | public RequestToken signup ( int flags , BaasHandler < BaasUser > handler ) { return signupWithStrategy ( flags , DefaultSignupStrategy . INSTANCE , handler ) ; } | Asynchronously signups this user to baasbox using provided password and priority |
2,308 | public RequestToken unfollow ( int flags , BaasHandler < BaasUser > handler ) { BaasBox box = BaasBox . getDefaultChecked ( ) ; Follow follow = new Follow ( box , false , this , flags , handler ) ; return box . submitAsync ( follow ) ; } | Asynchronously requests to unfollow the user |
2,309 | public int get ( int index ) { if ( d_bitsPerElem == 0 ) return 0 ; int startIdx = ( index * d_bitsPerElem ) / INT_SIZE ; int startBit = ( index * d_bitsPerElem ) % INT_SIZE ; int result = ( d_data [ startIdx ] >>> startBit ) & MASK [ d_bitsPerElem ] ; if ( ( startBit + d_bitsPerElem ) > INT_SIZE ) { int done = INT_SIZ... | Get the integer at the given index . |
2,310 | public GetServiceStatusResult withMessages ( Message ... values ) { List < Message > list = getMessages ( ) ; for ( Message value : values ) { list . add ( value ) ; } return this ; } | Add values for Messages return this . |
2,311 | private void appendValue ( Object value ) { if ( value instanceof Boolean ) { closeTag ( ) ; append ( value . toString ( ) ) ; } else if ( value instanceof Number ) { closeTag ( ) ; append ( value . toString ( ) ) ; } else if ( value instanceof String ) { closeTag ( ) ; escape ( ( String ) value ) ; } else if ( value i... | Append a value to output . |
2,312 | protected void append ( String v ) { try { writer . write ( v ) ; } catch ( Exception e ) { throw MwsUtl . wrap ( e ) ; } } | Append a string to the output . |
2,313 | protected void append ( String v , int start , int end ) { try { writer . write ( v , start , end - start ) ; } catch ( Exception e ) { throw MwsUtl . wrap ( e ) ; } } | Append range of a string to the output . |
2,314 | private void addRequiredParametersToRequest ( HttpPost request ) { parameters . put ( "Action" , operationName ) ; parameters . put ( "Version" , serviceEndpoint . version ) ; parameters . put ( "Timestamp" , MwsUtl . getFormattedTimestamp ( ) ) ; parameters . put ( "AWSAccessKeyId" , connection . getAwsAccessKeyId ( )... | Add authentication related and version parameter and set request body with all of the parameters |
2,315 | private String getResponseBody ( HttpResponse postResponse ) { InputStream input = null ; try { input = postResponse . getEntity ( ) . getContent ( ) ; Reader reader = new InputStreamReader ( input , MwsUtl . DEFAULT_ENCODING ) ; StringBuilder b = new StringBuilder ( ) ; char [ ] c = new char [ 1024 ] ; int len ; while... | Read stream into string |
2,316 | private MwsResponseHeaderMetadata getResponseHeaderMetadata ( HttpResponse response ) { Header requestIdHeader = response . getFirstHeader ( "x-mws-request-id" ) ; String requestId = requestIdHeader == null ? null : requestIdHeader . getValue ( ) ; Header timestampHeader = response . getFirstHeader ( "x-mws-timestamp" ... | Get the metadata from the response headers . |
2,317 | private boolean pauseIfRetryNeeded ( int retries ) { if ( retries >= connection . getMaxErrorRetry ( ) ) { return false ; } long delay = ( long ) ( Math . random ( ) * Math . pow ( 4 , retries ) * 125 ) ; try { Thread . sleep ( delay ) ; } catch ( Exception e ) { throw MwsUtl . wrap ( e ) ; } return true ; } | Random exponential back - off sleep on failed request . |
2,318 | private HttpPost createRequest ( ) { HttpPost request = new HttpPost ( serviceEndpoint . uri ) ; try { request . addHeader ( "Content-Type" , "application/x-www-form-urlencoded; charset=utf-8" ) ; request . addHeader ( "X-Amazon-User-Agent" , connection . getUserAgent ( ) ) ; for ( Map . Entry < String , String > heade... | Create a HttpPost request for this call and add required headers and parameters to it . |
2,319 | private HttpResponse executeRequest ( HttpPost request ) throws Exception { try { HttpClient httpClient = connection . getHttpClient ( ) ; HttpContext httpContext = connection . getHttpContext ( ) ; HttpResponse response = httpClient . execute ( request , httpContext ) ; return response ; } catch ( Exception e ) { thro... | Execute a request on this calls connection and context . |
2,320 | public MwsResponse execute ( ) { HttpPost request = createRequest ( ) ; try { HttpResponse hr = executeRequest ( request ) ; StatusLine statusLine = hr . getStatusLine ( ) ; int status = statusLine . getStatusCode ( ) ; String message = statusLine . getReasonPhrase ( ) ; rhmd = getResponseHeaderMetadata ( hr ) ; String... | Perform a synchronous call with no retry or error handling . |
2,321 | private static String calculateStringToSignV0 ( Map < String , String > parameters ) { StringBuilder data = new StringBuilder ( ) ; data . append ( parameters . get ( "Action" ) ) . append ( parameters . get ( "Timestamp" ) ) ; return data . toString ( ) ; } | Calculate String to Sign for SignatureVersion 0 |
2,322 | private static String calculateStringToSignV1 ( Map < String , String > parameters ) { StringBuilder data = new StringBuilder ( ) ; Map < String , String > sorted = new TreeMap < String , String > ( String . CASE_INSENSITIVE_ORDER ) ; sorted . putAll ( parameters ) ; Iterator < Entry < String , String > > pairs = sorte... | Calculate String to Sign for SignatureVersion 1 |
2,323 | static String calculateStringToSignV2 ( URI serviceUri , Map < String , String > parameters ) { StringBuilder data = new StringBuilder ( ) ; data . append ( "POST" ) ; data . append ( "\n" ) ; data . append ( serviceUri . getHost ( ) . toLowerCase ( ) ) ; if ( ! usesStandardPort ( serviceUri ) ) { data . append ( ":" )... | Calculate String to Sign for SignatureVersion 2 |
2,324 | private static String cleanWS ( String s ) { s = replaceAll ( s , OuterWhiteSpacesPtn , "" ) ; s = replaceAll ( s , WhiteSpacesPtn , " " ) ; return s ; } | Clean white space . Remove leading and trailing and replace internal runs with a single space character . |
2,325 | protected static String urlEncode ( String value , boolean path ) { try { value = URLEncoder . encode ( value , DEFAULT_ENCODING ) ; } catch ( Exception e ) { throw wrap ( e ) ; } value = replaceAll ( value , plusPtn , "%20" ) ; value = replaceAll ( value , asteriskPtn , "%2A" ) ; value = replaceAll ( value , pct7EPtn ... | URL encode a value . |
2,326 | static String getFormattedTimestamp ( ) { DateFormat df = dateFormatPool . getAndSet ( null ) ; if ( df == null ) { df = createISODateFormat ( ) ; } String timestamp = df . format ( new Date ( ) ) ; dateFormatPool . set ( df ) ; return timestamp ; } | Get a ISO 8601 formatted timestamp of now . |
2,327 | static Date parseTimestamp ( String timestamp ) throws ParseException { DateFormat df = dateFormatPool . getAndSet ( null ) ; if ( df == null ) { df = createISODateFormat ( ) ; } Date date = df . parse ( timestamp ) ; dateFormatPool . set ( df ) ; return date ; } | Parse an ISO 8601 formatted timestamp |
2,328 | static < T > T newInstance ( Class < T > cls ) { try { return cls . newInstance ( ) ; } catch ( Exception e ) { throw wrap ( e ) ; } } | Create a new instance of a class wrap exceptions . |
2,329 | static String toXmlString ( Node node ) { try { Transformer transformer = getTF ( ) . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "yes" ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF-8" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "no" ) ... | Get xml string for contents of node . |
2,330 | public static void close ( Closeable a ) { try { if ( a != null ) { a . close ( ) ; } } catch ( Exception e ) { throw wrap ( e ) ; } } | Close a Closeable if it is not null . |
2,331 | public static String escapeAppVersion ( String s ) { s = cleanWS ( s ) ; s = replaceAll ( s , BackSlashPtn , EscBackSlash ) ; s = replaceAll ( s , LParenPtn , EscLParen ) ; return s ; } | Escape an application version string . |
2,332 | public static TransformerFactory getTF ( ) { TransformerFactory tf = threadTF . get ( ) ; if ( tf == null ) { tf = TransformerFactory . newInstance ( ) ; threadTF . set ( tf ) ; } return tf ; } | Get a thread local transformer factory . |
2,333 | public static RuntimeException wrap ( Throwable e ) { if ( e instanceof RuntimeException ) { return ( RuntimeException ) e ; } return new RuntimeException ( e ) ; } | Wrap Checked exceptions in runtime exception . |
2,334 | synchronized void freeze ( ) { if ( frozen ) { return ; } if ( userAgent == null ) { setDefaultUserAgent ( ) ; } serviceMap = new HashMap < String , ServiceEndpoint > ( ) ; if ( log . isDebugEnabled ( ) ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "Creating MwsConnection {" ) ; buf . append ( "applica... | Initialize the connection . |
2,335 | private ExecutorService getSharedES ( ) { synchronized ( this . getClass ( ) ) { if ( sharedES != null ) { return sharedES ; } sharedES = new ThreadPoolExecutor ( maxAsyncThreads / 10 , maxAsyncThreads , 60L , TimeUnit . SECONDS , new ArrayBlockingQueue < Runnable > ( maxAsyncQueueSize ) , new ThreadFactory ( ) { priva... | Get the shared executor service that is used by async calls if no executor is supplied . |
2,336 | private void setDefaultUserAgent ( ) { setUserAgent ( MwsUtl . escapeAppName ( applicationName ) , MwsUtl . escapeAppVersion ( applicationVersion ) , MwsUtl . escapeAttributeValue ( "Java/" + System . getProperty ( "java.version" ) + "/" + System . getProperty ( "java.class.version" ) + "/" + System . getProperty ( "ja... | Set the default user agent string . Called when connection first opened if user agent is not set explicitly . |
2,337 | ServiceEndpoint getServiceEndpoint ( String servicePath ) { synchronized ( serviceMap ) { ServiceEndpoint sep = serviceMap . get ( servicePath ) ; if ( sep == null ) { sep = new ServiceEndpoint ( endpoint , servicePath ) ; serviceMap . put ( servicePath , sep ) ; } return sep ; } } | Get a MwsServiceUri for the servicePath . |
2,338 | @ SuppressWarnings ( "unchecked" ) public < T extends MwsObject > T call ( MwsRequestType type , MwsObject requestData ) { MwsReader responseReader = null ; try { String servicePath = type . getServicePath ( ) ; String operationName = type . getOperationName ( ) ; MwsCall mc = newCall ( servicePath , operationName ) ; ... | Call an operation and return the response data . |
2,339 | public < T extends MwsObject > Future < T > callAsync ( final MwsRequestType type , final MwsObject requestData ) { return getExecutorService ( ) . submit ( new Callable < T > ( ) { public T call ( ) { return MwsConnection . this . call ( type , requestData ) ; } } ) ; } | Call a request async return a future on the response data . |
2,340 | public synchronized void setEndpoint ( URI endpoint ) { checkUpdatable ( ) ; int port = endpoint . getPort ( ) ; if ( port == 80 || port == 443 ) { if ( MwsUtl . usesStandardPort ( endpoint ) ) { try { endpoint = new URI ( endpoint . getScheme ( ) , endpoint . getHost ( ) , endpoint . getPath ( ) , endpoint . getFragme... | Sets service endpoint property . |
2,341 | public synchronized void setUserAgent ( String applicationName , String applicationVersion , String programmingLanguage , String ... additionalNameValuePairs ) { checkUpdatable ( ) ; StringBuilder b = new StringBuilder ( ) ; b . append ( applicationName ) ; b . append ( "/" ) ; b . append ( applicationVersion ) ; b . a... | Sets UserAgent property |
2,342 | public GetOrderRequest withAmazonOrderId ( String ... values ) { List < String > list = getAmazonOrderId ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for AmazonOrderId return this . |
2,343 | public Order withPaymentExecutionDetail ( PaymentExecutionDetailItem ... values ) { List < PaymentExecutionDetailItem > list = getPaymentExecutionDetail ( ) ; for ( PaymentExecutionDetailItem value : values ) { list . add ( value ) ; } return this ; } | Add values for PaymentExecutionDetail return this . |
2,344 | public void setServiceURL ( String serviceUrl ) { try { URI fullURI = URI . create ( serviceUrl ) ; URI partialURI = new URI ( fullURI . getScheme ( ) , null , fullURI . getHost ( ) , fullURI . getPort ( ) , null , null , null ) ; cc . setEndpoint ( partialURI ) ; String path = fullURI . getPath ( ) ; if ( path != null... | Set the service URL to make requests against . |
2,345 | protected void append ( String value ) { try { writer . write ( value ) ; } catch ( Exception e ) { throw MwsUtl . wrap ( e ) ; } } | Append string to the output . |
2,346 | public OrderItem withPromotionIds ( String ... values ) { List < String > list = getPromotionIds ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for PromotionIds return this . |
2,347 | private String getElementText ( Element element ) { Node node = element . getFirstChild ( ) ; if ( node == null || node . getNodeType ( ) != Node . TEXT_NODE ) { return null ; } return node . getNodeValue ( ) . trim ( ) ; } | Read begin tag text end tag . |
2,348 | @ SuppressWarnings ( "unchecked" ) private < T > T parseElement ( Element element , Class < T > cls ) { T value ; if ( element == null ) { value = null ; } else if ( MwsObject . class . isAssignableFrom ( cls ) ) { value = MwsUtl . newInstance ( cls ) ; Element holdElement = currentElement ; Node holdChild = currentChi... | Read an element into a new instance of a class . |
2,349 | @ SuppressWarnings ( "unchecked" ) private < T > T parseString ( String v , Class < T > cls ) { Object value ; if ( v == null || v . length ( ) == 0 ) { value = null ; } else if ( cls == String . class ) { value = v ; } else if ( cls == Boolean . class || cls == boolean . class ) { if ( v . equalsIgnoreCase ( "true" ) ... | Parse a string to a value of the given class . |
2,350 | public ListOrdersRequest withOrderStatus ( String ... values ) { List < String > list = getOrderStatus ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for OrderStatus return this . |
2,351 | public ListOrdersRequest withMarketplaceId ( String ... values ) { List < String > list = getMarketplaceId ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for MarketplaceId return this . |
2,352 | public ListOrdersRequest withFulfillmentChannel ( String ... values ) { List < String > list = getFulfillmentChannel ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for FulfillmentChannel return this . |
2,353 | public ListOrdersRequest withPaymentMethod ( String ... values ) { List < String > list = getPaymentMethod ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for PaymentMethod return this . |
2,354 | public ListOrdersRequest withTFMShipmentStatus ( String ... values ) { List < String > list = getTFMShipmentStatus ( ) ; for ( String value : values ) { list . add ( value ) ; } return this ; } | Add values for TFMShipmentStatus return this . |
2,355 | public ListOrdersResult withOrders ( Order ... values ) { List < Order > list = getOrders ( ) ; for ( Order value : values ) { list . add ( value ) ; } return this ; } | Add values for Orders return this . |
2,356 | public ListOrderItemsResult withOrderItems ( OrderItem ... values ) { List < OrderItem > list = getOrderItems ( ) ; for ( OrderItem value : values ) { list . add ( value ) ; } return this ; } | Add values for OrderItems return this . |
2,357 | public static void unload ( ) { if ( elements != null ) { for ( Element style : elements ) { style . removeFromParent ( ) ; } elements . clear ( ) ; } } | Unload the current loaded theme . |
2,358 | public boolean hasSameDefaultVariant ( VariantSet obj ) { return ( this . defaultVariant == null && obj . defaultVariant == null ) || ( this . defaultVariant != null && this . defaultVariant . equals ( obj . defaultVariant ) ) ; } | Returns true of the variantSet passed in parameter has the same default value |
2,359 | protected String getTempFilePath ( GeneratorContext context , CacheMode cacheMode ) { return getTempDirectory ( ) + cacheMode + URL_SEPARATOR + getResourceCacheKey ( context . getPath ( ) , context ) ; } | Returns the file path of the temporary resource |
2,360 | protected String getResourceCacheKey ( String path , GeneratorContext context ) { StringBuilder strbCacheKey = new StringBuilder ( path ) ; if ( StringUtils . isNotEmpty ( context . getBracketsParam ( ) ) ) { strbCacheKey . append ( "_" ) . append ( context . getBracketsParam ( ) ) ; } if ( StringUtils . isNotEmpty ( c... | Returns the cache key for linked resources map |
2,361 | protected boolean checkResourcesModified ( GeneratorContext context , List < FilePathMapping > fMappings ) { boolean resourceModified = false ; for ( Iterator < FilePathMapping > iter = fMappings . iterator ( ) ; iter . hasNext ( ) && ! resourceModified ; ) { FilePathMapping fMapping = iter . next ( ) ; resourceModifie... | Checks if the resources have been modified |
2,362 | protected Reader retrieveFromCache ( String path , GeneratorContext context , CacheMode cacheMode ) { Reader rd = null ; String filePath = getTempFilePath ( context , cacheMode ) ; FileInputStream fis = null ; File file = new File ( filePath ) ; if ( file . exists ( ) ) { try { fis = new FileInputStream ( file ) ; } ca... | Retrieves the resource from cache if it exists |
2,363 | protected Reader createTempResource ( GeneratorContext context , CacheMode cacheMode , Reader rd ) { String filePath = getTempFilePath ( context , cacheMode ) ; Writer wr = null ; FileOutputStream fos = null ; try { File f = new File ( filePath ) ; if ( ! f . getParentFile ( ) . exists ( ) ) { f . getParentFile ( ) . m... | Creates the temporary resource |
2,364 | protected void resetCache ( ) { cacheProperties . clear ( ) ; linkedResourceMap . clear ( ) ; cacheProperties . put ( JawrConfig . JAWR_CHARSET_NAME , config . getResourceCharset ( ) . name ( ) ) ; } | Resets the cache |
2,365 | protected boolean isCacheValid ( ) { return StringUtils . equals ( cacheProperties . getProperty ( JawrConfig . JAWR_CHARSET_NAME ) , config . getResourceCharset ( ) . name ( ) ) ; } | Returns true if the cache is valid |
2,366 | protected synchronized void serializeCacheMapping ( ) { for ( Map . Entry < String , List < FilePathMapping > > entry : linkedResourceMap . entrySet ( ) ) { StringBuilder strb = new StringBuilder ( ) ; Iterator < FilePathMapping > iter = entry . getValue ( ) . iterator ( ) ; if ( iter . hasNext ( ) ) { for ( ; iter . h... | Serialize the cache file mapping |
2,367 | protected void loadCacheMapping ( ) { File f = new File ( getCacheFilePath ( ) ) ; if ( f . exists ( ) ) { try ( InputStream is = new FileInputStream ( f ) ; BufferedReader rd = new BufferedReader ( new FileReader ( f ) ) ) { cacheProperties . load ( is ) ; for ( Enumeration < ? > properyNames = cacheProperties . prope... | Loads the less file mapping |
2,368 | private AbstractChainedGlobalProcessor < T > addOrCreateChain ( AbstractChainedGlobalProcessor < T > chain , String key ) { AbstractChainedGlobalProcessor < T > toAdd ; if ( customPostprocessors . get ( key ) == null ) { toAdd = buildProcessorByKey ( key ) ; } else { toAdd = ( AbstractChainedGlobalProcessor < T > ) cus... | Creates an AbstractChainedGlobalProcessor . If the supplied chain is null the new chain is returned . Otherwise it is added to the existing chain . |
2,369 | public static void initApplication ( Application app ) { MarkupFactory factory = new MarkupFactory ( ) { public MarkupParser newMarkupParser ( final MarkupResourceStream resource ) { MarkupParser parser = new MarkupParser ( new XmlPullParser ( ) , resource ) ; parser . add ( new JawrWicketLinkTagHandler ( ) ) ; return ... | Initialize the wicket application |
2,370 | private StringBuffer buildFormJavascript ( ValidatorResources validatorResources , String formName , Locale locale , String messageNS , boolean stopOnErrors ) { Form form = validatorResources . getForm ( locale , formName ) ; return createDynamicJavascript ( validatorResources , form , messageNS , stopOnErrors ) ; } | Creates a validator for a specific form . |
2,371 | protected String getJavascriptBegin ( String jsFormName , String methods ) { StringBuffer sb = new StringBuffer ( ) ; String name = jsFormName . replace ( '/' , '_' ) ; name = jsFormName . substring ( 0 , 1 ) . toUpperCase ( ) + jsFormName . substring ( 1 , jsFormName . length ( ) ) ; sb . append ( "\n var bCancel =... | Returns the opening script element and some initial javascript . |
2,372 | public void change ( ) { float newChange = ( random . nextFloat ( ) * 4 ) - 2 ; newChange = Math . round ( newChange * 100.0F ) / 100.0F ; if ( last . floatValue ( ) + newChange < 9 ) { newChange = - newChange ; } change = new BigDecimal ( newChange ) ; change = change . setScale ( 2 , BigDecimal . ROUND_UP ) ; last = ... | Alter the stock price |
2,373 | public static void initJMXBean ( JawrApplicationConfigManager appConfigMgr , ServletContext servletContext , String resourceType , String mBeanPrefix ) { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; if ( mbs != null ) { ObjectName jawrConfigMgrObjName = JmxUtils . getMBeanObjectName ( servle... | Initialize the JMX Bean |
2,374 | public static void unregisterJMXBean ( ServletContext servletContext , String resourceType , String mBeanPrefix ) { try { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; if ( mbs != null ) { ObjectName jawrConfigMgrObjName = JmxUtils . getMBeanObjectName ( servletContext , resourceType , mBeanPrefix ... | Unregister the JMX Bean |
2,375 | public static ObjectName getAppJawrConfigMBeanObjectName ( ServletContext servletContext , String mBeanPrefix ) { return getMBeanObjectName ( getContextPath ( servletContext ) , JAWR_APP_CONFIG_MANAGER_TYPE , mBeanPrefix , null ) ; } | Returns the object name for the Jawr Application configuration Manager MBean |
2,376 | private static ObjectName getMBeanObjectName ( final String contextPath , final String objectType , final String mBeanPrefix , final String resourceType ) { String curCtxPath = contextPath ; if ( StringUtils . isEmpty ( curCtxPath ) ) { curCtxPath = ServletContextUtils . getContextPath ( null ) ; } if ( curCtxPath . ch... | Returns the object name for the Jawr MBean |
2,377 | private static ObjectName getObjectName ( String name ) { ObjectName mBeanName = null ; try { mBeanName = new ObjectName ( name ) ; } catch ( MalformedObjectNameException | NullPointerException e ) { throw new JmxConfigException ( e ) ; } return mBeanName ; } | Create an object name from the name passed in parameter |
2,378 | private void write ( int c ) throws IOException { if ( ! firstCharacterWritten ) { if ( c != '\n' ) { out . write ( c ) ; firstCharacterWritten = true ; } } else { out . write ( c ) ; } } | Writes the character on the output stream |
2,379 | public ResourceBundlesHandler buildResourceBundlesHandler ( ) throws DuplicateBundlePathException , BundleDependencyException { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Building resources handler... " ) ; } if ( null == jawrConfig ) { throw new IllegalStateException ( "Must set the JawrConfig for this facto... | Build a ResourceBundlesHandler . Must be invoked after setting at least the ResourceHandler . |
2,380 | protected boolean isProcessingBundleFromCacheMapping ( ) { boolean processBundleFromCacheMapping = false ; if ( jawrConfig . getUseBundleMapping ( ) && resourceBundleHandler . isExistingMappingFile ( ) ) { Properties cachedMappingProperties = resourceBundleHandler . getJawrBundleMapping ( ) ; String storedHashcode = ca... | Returns true if the bundle should be processed using cache mapping information |
2,381 | protected List < BundlingProcessLifeCycleListener > getBundlingProcessLifeCycleListeners ( ) { List < BundlingProcessLifeCycleListener > lifeCycleListeners = new ArrayList < > ( ) ; List < BundlingProcessLifeCycleListener > generatorLifeCycleListeners = jawrConfig . getGeneratorRegistry ( ) . getBundlingProcessLifeCycl... | Returns the life cycle listeners |
2,382 | private void initResourceBundlesFromFullMapping ( List < JoinableResourceBundle > resourceBundles ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Building bundles from the full bundle mapping. Only modified bundles will be processed." ) ; } Properties mappingProperties = resourceBundleHandler . getJawrBundleMa... | Initialize the resource bundles from the mapping file |
2,383 | private void initResourceBundles ( List < JoinableResourceBundle > resourceBundles ) throws DuplicateBundlePathException , BundleDependencyException { bundleDefinitionsWithDependencies = new HashSet < > ( ) ; if ( null != bundleDefinitions ) { if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Adding custom bundle defi... | Initialize the resource bundles |
2,384 | private JoinableResourceBundle getBundleFromName ( String name , List < JoinableResourceBundle > bundles ) { JoinableResourceBundle bundle = null ; for ( JoinableResourceBundle aBundle : bundles ) { if ( aBundle . getName ( ) . equals ( name ) ) { bundle = aBundle ; break ; } } return bundle ; } | Returns a bundle from its name |
2,385 | private JoinableResourceBundle buildResourcebundle ( ResourceBundleDefinition definition ) throws BundleDependencyException { if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Init bundle with id:" + definition . getBundleId ( ) ) ; validateBundleId ( definition ) ; DebugInclusion inclusion = DebugInclusion . ALWAYS... | Build a JoinableResourceBundle using a ResourceBundleDefinition |
2,386 | private void validateBundleId ( ResourceBundleDefinition definition ) { String bundleId = definition . getBundleId ( ) ; if ( bundleId != null ) { if ( ! bundleId . endsWith ( fileExtension ) ) { throw new BundlingProcessException ( "The extension of the bundle " + definition . getBundleName ( ) + " - " + bundleId + " ... | Validates the bundle ID |
2,387 | private List < JoinableResourceBundle > getBundleDependencies ( ResourceBundleDefinition definition , List < JoinableResourceBundle > bundles ) throws BundleDependencyException { List < JoinableResourceBundle > dependencies = new ArrayList < > ( ) ; List < String > processedBundles = new ArrayList < > ( ) ; if ( defini... | Returns the bundle dependencies from the resource bundle definition |
2,388 | private void initBundleDependencies ( String rootBundleDefinition , ResourceBundleDefinition definition , List < JoinableResourceBundle > bundleDependencies , List < String > processedBundles , List < JoinableResourceBundle > bundles ) throws BundleDependencyException { List < String > bundleDefDependencies = definitio... | Initialize the bundle dependencies |
2,389 | private boolean bundleListContains ( List < JoinableResourceBundle > bundles , String bundleName ) { boolean contains = false ; for ( JoinableResourceBundle bundle : bundles ) { if ( bundle . getName ( ) . equals ( bundleName ) ) { contains = true ; break ; } } return contains ; } | Checks if the bundle name exists in the bundle list |
2,390 | private JoinableResourceBundle buildDirMappedResourceBundle ( String bundleId , String pathMapping ) { List < String > path = Collections . singletonList ( pathMapping ) ; JoinableResourceBundle newBundle = new JoinableResourceBundleImpl ( bundleId , generateBundleNameFromBundleId ( bundleId ) , null , fileExtension , ... | Build a bundle based on a mapping returned by the ResourceBundleDirMapperFactory . |
2,391 | private String generateBundleNameFromBundleId ( String bundleId ) { String bundleName = bundleId ; if ( bundleName . startsWith ( "/" ) ) { bundleName = bundleName . substring ( 1 ) ; } int idxExtension = FileNameUtils . indexOfExtension ( bundleName ) ; if ( idxExtension != - 1 ) { bundleName = bundleName . substring ... | Generates the bundle ID from the bundle name |
2,392 | private JoinableResourceBundle buildOrphansResourceBundle ( String bundleId , List < String > orphanPaths ) { JoinableResourceBundle newBundle = new JoinableResourceBundleImpl ( bundleId , generateBundleNameFromBundleId ( bundleId ) , null , fileExtension , new InclusionPattern ( ) , orphanPaths , resourceReaderHandler... | Builds a single bundle containing all the paths specified . Useful to make a single bundle out of every resource that is orphan after processing config definitions . |
2,393 | private JoinableResourceBundle buildOrphanResourceBundle ( String orphanPath ) { String mapping = orphanPath ; List < String > paths = Collections . singletonList ( mapping ) ; JoinableResourceBundle newBundle = new JoinableResourceBundleImpl ( orphanPath , generateBundleNameFromBundleId ( orphanPath ) , null , fileExt... | Build a non - global single - file resource bundle for orphans . |
2,394 | public void setExludedDirMapperDirs ( Set < String > exludedDirMapperDirs ) { if ( null != exludedDirMapperDirs ) this . excludedDirMapperDirs = PathNormalizer . normalizePaths ( exludedDirMapperDirs ) ; } | Sets the paths to exclude when using the dirMapper . |
2,395 | @ SuppressWarnings ( "static-access" ) public static Object bindings ( Context cx , Scriptable thisObj , Object [ ] args , Function funObj ) { if ( args . length == 1 ) { Object arg = args [ 0 ] ; if ( arg instanceof Wrapper ) { arg = ( ( Wrapper ) arg ) . unwrap ( ) ; } if ( arg instanceof ExternalScriptable ) { Scrip... | The bindings function takes a JavaScript scope object of type ExternalScriptable and returns the underlying Bindings instance . |
2,396 | public synchronized void write ( byte [ ] b , int off , int len ) throws IOException { super . write ( b , off , len ) ; this . branch . write ( b , off , len ) ; } | Write the specified bytes to both streams . |
2,397 | public static ResourceReader getResourceReaderProxy ( ResourceGenerator generator , ResourceReaderHandler rsReaderHandler , JawrConfig config ) { ResourceReader proxy = null ; int nbExtraInterface = 0 ; Class < ? > [ ] extraInterfaces = new Class < ? > [ 2 ] ; boolean isResourceGenerator = generator instanceof Resource... | Creates a Resource reader from a resource generator . |
2,398 | private static Class < ? > [ ] getGeneratorInterfaces ( ResourceGenerator generator ) { Set < Class < ? > > interfaces = new HashSet < > ( ) ; addInterfaces ( generator , interfaces ) ; return ( Class [ ] ) interfaces . toArray ( new Class [ ] { } ) ; } | Returns the array of interfaces implemented by the ResourceGenerator |
2,399 | private static void addInterfaces ( Object obj , Set < Class < ? > > interfaces ) { Class < ? > [ ] generatorInterfaces = null ; Class < ? > superClass = null ; if ( obj instanceof Class ) { generatorInterfaces = ( ( Class < ? > ) obj ) . getInterfaces ( ) ; superClass = ( ( Class < ? > ) obj ) . getSuperclass ( ) ; } ... | Adds all the interfaces of the object passed in parameter in the set of interfaces . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.