idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
28,800
public Vector wait ( TypedVector < Future < ActivityData > > futures ) throws ActivityException { Vector results = new Vector ( ) ; results . setSize ( futures . size ( ) ) ; try { int count = futures . size ( ) ; logger . trace ( "waiting for {} activities to complete..." , count ) ; long newTimeout = timeout ; while ...
Waits for all activities to complete before returning .
28,801
public synchronized T get ( ) { T val ; synchronized ( this ) { if ( valRef == null || ( val = valRef . get ( ) ) == null ) { val = make ( ) ; valRef = new WeakReference < T > ( val ) ; } } return val ; }
Get the cached object . If the object is not in memory it is recreated .
28,802
private void tidy ( ) { nonPermanent . entrySet ( ) . stream ( ) . map ( entry -> { List < WeakReference < IzouSoundLineBaseClass > > collect = entry . getValue ( ) . stream ( ) . filter ( izouSoundLineWeakReference -> izouSoundLineWeakReference . get ( ) != null ) . collect ( Collectors . toList ( ) ) ; if ( ! collect...
removes obsolete references
28,803
public void addIzouSoundLine ( AddOnModel addOnModel , IzouSoundLineBaseClass izouSoundLine ) { debug ( "adding soundLine " + izouSoundLine + " from " + addOnModel ) ; if ( permanentAddOn != null && permanentAddOn . equals ( addOnModel ) ) { addPermanent ( izouSoundLine ) ; } else { addNonPermanent ( addOnModel , izouS...
adds an IzouSoundLine will now be tracked by the SoundManager
28,804
private void closeCallback ( AddOnModel addOnModel , IzouSoundLine izouSoundLine ) { debug ( "removing soundline " + izouSoundLine + " from " + addOnModel ) ; Predicate < WeakReference < IzouSoundLineBaseClass > > removeFromList = weakReference -> weakReference . get ( ) != null && weakReference . get ( ) . equals ( iz...
the close - callback or the AddonModel removes now redundant references
28,805
private void permissionWithoutUsage ( ) { if ( isUsingNonJava ) return ; synchronized ( permanentUserReadWriteLock ) { permissionWithoutUsageLimit = LocalDateTime . now ( ) . plus ( 10 , ChronoUnit . SECONDS ) ; permissionWithoutUsageCloseThread = getMain ( ) . getThreadPoolManager ( ) . getAddOnsThreadPool ( ) . submi...
creates a LocaleDateTime - Object 10 seconds in the Future and a Thread which will remove it if it passes the threshold . the Thread
28,806
private void addPermanent ( IzouSoundLineBaseClass izouSoundLine ) { debug ( "adding " + izouSoundLine + " to permanent" ) ; if ( ! izouSoundLine . isPermanent ( ) ) izouSoundLine . setToPermanent ( ) ; synchronized ( permanentUserReadWriteLock ) { endWaitingForUsage ( ) ; if ( permanentLines == null ) { permanentLines...
adds the IzouSoundLine as permanent
28,807
private void addNonPermanent ( AddOnModel addOnModel , IzouSoundLineBaseClass izouSoundLine ) { debug ( "adding " + izouSoundLine + " from " + addOnModel + " to non-permanent" ) ; if ( izouSoundLine . isPermanent ( ) ) izouSoundLine . setToNonPermanent ( ) ; List < WeakReference < IzouSoundLineBaseClass > > weakReferen...
adds the IzouSoundLine as NonPermanent
28,808
public void requestPermanent ( AddOnModel addOnModel , Identification source , boolean nonJava ) { debug ( "requesting permanent for addon: " + addOnModel ) ; boolean notUsing = isUsing . compareAndSet ( false , true ) ; if ( ! notUsing ) { debug ( "already used by " + permanentAddOn ) ; synchronized ( permanentUserRea...
tries to register the AddonModel as permanent
28,809
public void endPermanent ( AddOnModel addOnModel ) { if ( ! isUsing . get ( ) || ( permanentAddOn != null && ! permanentAddOn . equals ( addOnModel ) ) ) return ; synchronized ( permanentUserReadWriteLock ) { permanentAddOn = null ; Identification tempID = this . knownIdentification ; this . knownIdentification = null ...
unregisters the AddonModel as permanent
28,810
void muteOthers ( AddOnModel addOnModel ) { Set < AddOnModel > toMute = nonPermanent . entrySet ( ) . stream ( ) . filter ( entry -> ! entry . getKey ( ) . equals ( addOnModel ) ) . flatMap ( entry -> entry . getValue ( ) . stream ( ) ) . map ( Reference :: get ) . filter ( Objects :: nonNull ) . peek ( izouSoundLineBa...
mutes the other Addons
28,811
private void mute ( AddOnModel model ) { IdentificationManager . getInstance ( ) . getIdentification ( this ) . map ( id -> new EventMinimalImpl ( SoundIDs . MuteEvent . type , id , SoundIDs . MuteEvent . descriptors ) ) . map ( eventMinimal -> eventMinimal . addResource ( new ResourceMinimalImpl < > ( SoundIDs . MuteE...
mutes the list of soundLines and fires the Mute - Event
28,812
public void eventFired ( EventModel event ) { if ( event . containsDescriptor ( SoundIDs . StartRequest . descriptor ) ) { Identification identification = event . getListResourceContainer ( ) . provideResource ( "izou.common.resource.selector" ) . stream ( ) . map ( ResourceModel :: getResource ) . filter ( resource ->...
Invoked when an activator - event occurs .
28,813
public static URL makeURL ( String specification ) throws MalformedURLException { logger . trace ( "retrieving URL for specification: '{}'" , specification ) ; if ( specification . startsWith ( "classpath:" ) ) { logger . trace ( "URL is of type 'classpath'" ) ; return new URL ( null , specification , new ClassPathURLS...
Returns an URL object for the given URL specification .
28,814
public int compareTo ( ItemAndSupport other ) { if ( other . support == this . support ) { return this . item - other . item ; } else { return other . support - this . support ; } }
Returns a negative integer zero or a positive integer as this object s support is less than equal to or greater than the specified object s support .
28,815
public int [ ] get ( ) { if ( capacity < buffer . size ( ) ) { capacity = buffer . size ( ) ; } int [ ] res = buffer . toArray ( ) ; buffer . clear ( capacity ) ; return res ; }
Resets the builder by the way
28,816
public String getV4Authorization ( String accessKey , String secretKey , String action , String url , String serviceId , Map < String , String > headers , String bodyHash ) throws InternalException { serviceId = serviceId . toLowerCase ( ) ; String regionId = "us-east-1" ; String host = url . replaceAll ( "https?:\\/\\...
Generates an AWS v4 signature authorization string
28,817
private String getOwnerId ( ) { APITrace . begin ( this , "AWSCloud.getOwnerId" ) ; try { ProviderContext ctx = getContext ( ) ; if ( ctx == null ) { return null ; } Map < String , String > parameters = getStandardParameters ( getContext ( ) , EC2Method . DESCRIBE_SECURITY_GROUPS ) ; EC2Method method ; NodeList blocks ...
Retrieve current account number using DescribeSecurityGroups . May not always be reliable but is better than nothing .
28,818
public static long getTimestampValue ( Node node ) throws CloudException { SimpleDateFormat fmt = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) ; fmt . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; String value = getTextValue ( node ) ; try { return fmt . parse ( value ) . getTime ( ) ; } catch ( ParseEx...
Gets the epoch form of the text value of the provided node .
28,819
public static < T > T getBean ( Class < T > type ) { checkBeanFactory ( 0 , type . getName ( ) ) ; return beanFactory . getBean ( type ) ; }
Pobiera z kontekstu aplikacji obiekt o wskazanym typie .
28,820
public static void generateSecretKey ( KeyConfig config ) throws NoSuchAlgorithmException , KeyStoreException , CertificateException , IOException { if ( config == null || config . getKeyStoreFile ( ) == null || StringUtils . isEmpty ( config . getKeyEntryName ( ) ) || config . getAlgorithm ( ) == null ) { throw new Ke...
Method which will generate a random Secret key and add it to a keystore with the entry name provided .
28,821
public static SecretKey getSecretKey ( File keystore , String entryName , String keyStorePassword ) throws KeyStoreException , NoSuchAlgorithmException , CertificateException , FileNotFoundException , IOException , UnrecoverableEntryException { KeyStore keyStore = KeyStore . getInstance ( "JCEKS" ) ; FileInputStream fi...
Method which will load a secret key from disk with the specified entry name .
28,822
public static SecretKey getSecretKey ( InputStream keyInputStream , String entryName , String keyStorePassword ) throws KeyStoreException , NoSuchAlgorithmException , CertificateException , IOException , UnrecoverableEntryException { KeyStore keyStore = KeyStore . getInstance ( "JCEKS" ) ; if ( keyInputStream == null )...
Method which will load a secret key from an input stream with the specified entry name .
28,823
public static SupportedType guess ( ISource source ) { Logger logger = LoggerFactory . getLogger ( MimeGuesser . class ) ; SupportedType type = SupportedType . TEXT ; if ( ! source . available ( ) ) { return type ; } InputStream stream = source . stream ( ) ; try { if ( stream . available ( ) <= 0 ) { logger . trace ( ...
Guesses the supported type from the given source . If the source type cannot be guessed then it returns TEXT . If the source is empty it returns TEXT . If it cannot guess then it returns TEXT .
28,824
public final DataModel fromJson ( final InputStream resource ) { ObjectMapper mapper = new ObjectMapper ( ) ; mapper . addMixInAnnotations ( DataType . class , DataTypeConfigMixin . class ) ; mapper . addMixInAnnotations ( ObjectDataType . class , ObjectDataTypeConfigMixin . class ) ; try { return mapper . readValue ( ...
Create data model definition from JSON file .
28,825
private void registerOrThrow ( AddOnModel addOn , String permissionMessage ) throws IzouSoundPermissionException { Function < PluginDescriptor , Boolean > checkPlayPermission = descriptor -> { if ( descriptor . getAddOnProperties ( ) == null ) throw new IzouPermissionException ( "addon_config.properties not found for a...
registers the AddOn or throws the Exception
28,826
public static int xmx2MB ( String xmx ) { int size = 200 ; if ( xmx == null || xmx . isEmpty ( ) ) { return size ; } String s = xmx . substring ( xmx . length ( ) - 1 , xmx . length ( ) ) ; int unit = - 1 ; int localSize = - 1 ; if ( unitMap . get ( s ) == null ) { localSize = Integer . valueOf ( xmx . substring ( 4 , ...
- Xmx to MByte
28,827
public XMLElement [ ] getChildren ( String name ) { java . util . List < XMLElement > list = new java . util . ArrayList < XMLElement > ( ) ; for ( XMLElement child : getChildren ( ) ) { if ( child . getName ( ) . equals ( name ) ) { list . add ( child ) ; } } return ( 0 < list . size ( ) ) ? list . toArray ( new XMLEl...
Returns children that have the specified name as a XMLElement array .
28,828
public final TaskExecutor < T > addObservers ( TaskObserver < T > ... observers ) { if ( observers != null ) { for ( TaskObserver < T > observer : observers ) { this . observers . add ( observer ) ; } } return this ; }
Adds task observers to the set of registered observers .
28,829
public List < Future < T > > execute ( @ SuppressWarnings ( "unchecked" ) Task < T > ... tasks ) { List < Future < T > > futures = new ArrayList < Future < T > > ( ) ; if ( tasks != null ) { synchronized ( queue ) { int i = 0 ; for ( Task < T > task : tasks ) { if ( task != null ) { this . tasks . add ( task ) ; TaskCa...
Starts the given set of tasks asynchronously returning their futures .
28,830
public List < T > waitForAll ( List < Future < T > > futures ) throws InterruptedException , ExecutionException { Map < Integer , T > results = new HashMap < Integer , T > ( ) ; int count = futures . size ( ) ; while ( count -- > 0 ) { int id = queue . take ( ) ; logger . trace ( "task '{}' complete (count: {}, queue: ...
Waits for all tasks to complete before returning ; if observers are provided they are called each time a task completes .
28,831
public static final Color fromString ( String value ) { if ( Strings . isValid ( value ) ) { Regex regex = new Regex ( COLOR_REGEX , false ) ; if ( regex . matches ( value . trim ( ) ) ) { int r = - 1 , g = - 1 , b = - 1 ; String [ ] matches = regex . getAllMatches ( value ) . get ( 0 ) ; if ( matches [ 0 ] != null && ...
Parses an input string and returns the corresponding colour object .
28,832
public static long copy ( final File input , final OutputStream output ) throws IOException { long size = 0L ; InputStream file_input = null ; try { file_input = new FileInputStream ( input ) ; size = copy ( file_input , output ) ; } finally { try { file_input . close ( ) ; } catch ( Exception ex ) { } } return size ; ...
Reads the contents from the file and writes them to the specified stream .
28,833
public static long copy ( final InputStream input , final File output ) throws IOException { OutputStream stream_output = null ; long size = 0L ; try { stream_output = new FileOutputStream ( output ) ; size = copy ( input , stream_output ) ; } finally { try { stream_output . close ( ) ; } catch ( Exception ex ) { } } r...
Reads the contents from the specified stream and writes them to the file .
28,834
public static long copy ( final InputStream input , final OutputStream output ) throws IOException { _LOG_ . debug ( "begin copy" ) ; @ SuppressWarnings ( "resource" ) BufferedInputStream b_input = ( BufferedInputStream . class . isInstance ( input ) ? BufferedInputStream . class . cast ( input ) : new BufferedInputStr...
Reads the contents from the specified input stream and writes them to the output stream . In this method the given streams are not closed .
28,835
public static long copy ( final Reader input , final Writer output ) throws IOException { _LOG_ . debug ( "begin copy" ) ; @ SuppressWarnings ( "resource" ) BufferedReader b_input = ( BufferedReader . class . isInstance ( input ) ? BufferedReader . class . cast ( input ) : new BufferedReader ( input ) ) ; @ SuppressWar...
Reads the contents from the specified input and writes them to the output . In this method the given streams are not closed .
28,836
public static String readCharacters ( final File file ) throws IOException { Reader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) , Charset . forName ( "UTF-8" ) ) ) ; StringWriter sw = new StringWriter ( ) ; Writer writer = new BufferedWriter ( sw ) ; copy ( reader , writer ) ; Str...
Reads the contents characters from the file .
28,837
public VpnGateway createVpnGateway ( String endpoint , String name , String description , VpnProtocol protocol , String bgpAsn ) throws CloudException , InternalException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "ENTER: " + AzureVPNSupport . class . getName ( ) + ".createVPNGateway()" ) ; } try { Provide...
Create local network for connecting VPN?
28,838
List < Annotation > getAnnotations ( Multimap < String , Annotation > groups , TokenMatcher matcher ) { if ( relationType == null ) { return getAnnotationStream ( groups , matcher ) . filter ( constraint ) . collect ( Collectors . toList ( ) ) ; } return getAnnotationStream ( groups , matcher ) . flatMap ( a -> { if ( ...
Gets annotations .
28,839
public static < T > SNAXParser < T > createParser ( XMLInputFactory factory , NodeModel < T > model ) { return new SNAXParser < T > ( factory , model ) ; }
Return a new SNAXParser using the specified model .
28,840
public void parse ( Reader reader , T data ) throws XMLStreamException , SNAXUserException { init ( reader , data ) ; for ( XMLEvent event = xmlReader . nextEvent ( ) ; xmlReader . hasNext ( ) ; event = xmlReader . nextEvent ( ) ) { processEvent ( event ) ; } }
Parse a data stream represented by a Reader to completion . This will process the entire document and trigger any ElementHandler calls that result from applying the selectors defined in the NodeModel . The data parameter will be passed back as an argument to all ElementHandler calls .
28,841
public static boolean isParseable ( Object input ) { return ( null != input ) && ( isWrapperType ( input . getClass ( ) ) || allPrimitiveTypes ( ) . contains ( input . getClass ( ) ) || ( String . class . isInstance ( input ) && ( Strs . inRange ( '0' , '9' ) . matchesAllOf ( MINUS_STRING . matcher ( ( String ) input )...
Check if the given input is able parse to number or boolean
28,842
protected void init ( Class < T > cls , Key ... keys ) { readDataSource = Execution . getDataSourceName ( cls . getName ( ) , true ) ; writeDataSource = Execution . getDataSourceName ( cls . getName ( ) , false ) ; if ( readDataSource == null ) { readDataSource = writeDataSource ; } if ( writeDataSource == null ) { wri...
Constructs a new persistent factory for objects of the specified class with the named unique identifier attributes as well as with reading the persistence properties file to find out the HandlerSocket host database port and pool size .
28,843
public Collection < T > hsFind ( final String index , final Operator operator , final int limit , final int offset , final String ... indexValues ) throws PersistenceException { if ( indexValues == null || indexValues . length == 0 ) { throw new PersistenceException ( "You must specify index values to use in the lookup...
Hits the HandlerSocket index directly caching objects it finds .
28,844
static int computeManhattan ( IntTuple t0 , IntTuple t1 ) { Utils . checkForEqualSize ( t0 , t1 ) ; int sum = 0 ; for ( int i = 0 ; i < t0 . getSize ( ) ; i ++ ) { int d = t0 . get ( i ) - t1 . get ( i ) ; sum += Math . abs ( d ) ; } return sum ; }
Computes the Manhattan distance between the given tuples
28,845
static int computeChebyshev ( IntTuple t0 , IntTuple t1 ) { Utils . checkForEqualSize ( t0 , t1 ) ; int max = 0 ; for ( int i = 0 ; i < t0 . getSize ( ) ; i ++ ) { int d = t0 . get ( i ) - t1 . get ( i ) ; max = Math . max ( max , Math . abs ( d ) ) ; } return max ; }
Computes the Chebyshev distance between the given tuples
28,846
public void receive ( byte [ ] byteArray ) throws IOException { if ( interpreter . isInSubProcessMode ( ) ) { if ( ! abortSubprocessModeIfNecessary ( byteArray ) ) { if ( echoEnabled ) { echoBytesToClient ( byteArray ) ; } interpreter . processRawInput ( byteArray ) ; } } else { processInput ( byteArray ) ; } }
Contains the loop that processes incoming bytes .
28,847
private void replaceCommandLine ( String replacement ) { int currentCLSize = commandLineBuffer . size ( ) ; commandLineBuffer = new ByteArrayOutputStream ( ) ; for ( int x = 0 ; x < replacement . length ( ) ; x ++ ) { commandLineBuffer . write ( replacement . charAt ( x ) ) ; } String replaceString = '\r' + promptStr ;...
Replaces the current command line on the telnet client with another one .
28,848
public void send ( byte [ ] message ) { try { ps . write ( message ) ; } catch ( IOException ioe ) { System . out . println ( new LogEntry ( Level . CRITICAL , "IO exception occurred while writing to client" , ioe ) ) ; connection . close ( "IO exception occurred while writing to client" ) ; } }
Sends a message to the telnet client .
28,849
public void beep ( ) { try { os . write ( BEL ) ; } catch ( IOException ioe ) { System . out . println ( new LogEntry ( Level . CRITICAL , "IO exception occurred while writing to client" , ioe ) ) ; connection . close ( "IO exception occurred while writing to client" ) ; } }
Tells the client to make a sound .
28,850
private void handleBackKey ( ) throws IOException { if ( commandLineBuffer . size ( ) > 0 && curPos > 0 ) { if ( echoEnabled ) { ps . write ( BACK ) ; } String curLine = overwriteCommandlineSkippingChar ( curPos - 1 ) ; eraseLastCharAndMoveBack ( curLine , curPos ) ; curPos -- ; } }
Rewrites the command line to show changes as a result of hitting the back key even if the cursor is positioned in the middle of the command line
28,851
private void handleDeleteKey ( ) throws IOException { if ( commandLineBuffer . size ( ) > 0 && curPos < commandLineBuffer . size ( ) ) { String curLine = overwriteCommandlineSkippingChar ( curPos ) ; eraseLastCharAndMoveBack ( curLine , curPos + 1 ) ; } }
Rewrites the command line to show changes as a result of hitting the delete key when the cursor is positioned in the middle of the command line
28,852
public static void run ( VicariousFactory factory ) { TweetProvider provider = factory . getTweetProvider ( ) ; List < Status > originals = null ; try { originals = provider . getTweets ( ) ; if ( originals == null || originals . isEmpty ( ) ) { return ; } } catch ( TwitterException exception ) { exception . printStack...
Runs a single iteration of the provide modify publish loop using the implementations provided by the given factory
28,853
@ Weight ( Weight . Unit . NORMAL ) public static < T > T [ ] joinArrays ( final T [ ] ... arrays ) { int commonLength = 0 ; for ( final T [ ] array : arrays ) { if ( array != null ) { commonLength += array . length ; } } @ SuppressWarnings ( "unchecked" ) final T [ ] result = ( T [ ] ) Array . newInstance ( arrays . g...
Join arrays provided as parameters all arrays must be the same type null values allowed .
28,854
@ Weight ( Weight . Unit . NORMAL ) public static < T > T [ ] append ( final T element , final T [ ] array ) { @ SuppressWarnings ( "unchecked" ) final T [ ] result = ( T [ ] ) Array . newInstance ( array . getClass ( ) . getComponentType ( ) , array . length + 1 ) ; System . arraycopy ( array , 0 , result , 1 , array ...
Append element to the start of an array .
28,855
public ResponseBuilder deleteResource ( final Resource res ) { final String baseUrl = getBaseUrl ( ) ; final String identifier = baseUrl + req . getPartition ( ) + req . getPath ( ) ; final Session session = ofNullable ( req . getSession ( ) ) . orElseGet ( HttpSession :: new ) ; checkDeleted ( res , identifier ) ; fin...
Delete the given resource
28,856
public Priority [ ] getPriorities ( ) { List < Priority > actualPriorities = new ArrayList < Priority > ( ) ; for ( String priority : getAvailablePriorities ( ) ) { if ( provider . getNumberOfAnnotations ( priority ) > 0 ) { actualPriorities . add ( Priority . fromString ( priority ) ) ; } } return actualPriorities . t...
Returns the actually used priorities .
28,857
public Collection < String > getAvailablePriorities ( ) { ArrayList < String > priorities = new ArrayList < String > ( ) ; if ( StringUtils . isNotEmpty ( high ) ) { priorities . add ( StringUtils . capitalize ( StringUtils . lowerCase ( Priority . HIGH . name ( ) ) ) ) ; } if ( StringUtils . isNotEmpty ( normal ) ) { ...
Returns the defined priorities .
28,858
public boolean dispatch ( String dispatch , String [ ] parameters ) { String dispatchURL = dispatch ; HttpServletRequest servletRequest = httpRequest . get ( ) ; HttpServletResponse servletResponse = httpResponse . get ( ) ; servletResponse . setContentType ( "text/html; charset=UTF-8" ) ; try { Request request = reque...
Iglu request attributes will be copied to the servlet request .
28,859
public InputStream getAsStream ( ) throws CacheException { InputStream stream = null ; try { logger . debug ( "opening connection..." ) ; stream = url . openConnection ( proxy != null ? proxy : Proxy . NO_PROXY ) . getInputStream ( ) ; if ( stream == null ) { logger . error ( "error opening stream" ) ; } else { logger ...
Accesses the given URL and returns its contents as a stream .
28,860
public int compare ( E entity1 , E entity2 ) { T value = property . get ( entity1 ) ; T value2 = property . get ( entity2 ) ; return value . compareTo ( value2 ) ; }
Compares the specified two entities .
28,861
public static < O > boolean eq ( O o1 , O o2 ) { return o1 != null ? o1 . equals ( o2 ) : o2 == null ; }
Verifies input objects are equal .
28,862
public static InetAddress forUriString ( String hostAddr ) { Preconditions . checkNotNull ( hostAddr ) ; String ipString ; int expectBytes ; if ( hostAddr . startsWith ( "[" ) && hostAddr . endsWith ( "]" ) ) { ipString = hostAddr . substring ( 1 , hostAddr . length ( ) - 1 ) ; expectBytes = 16 ; } else { ipString = ho...
Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL encoded in the format specified by RFC 3986 section 3 . 2 . 2 .
28,863
public static Inet4Address get6to4IPv4Address ( Inet6Address ip ) { Preconditions . checkArgument ( is6to4Address ( ip ) , "Address '%s' is not a 6to4 address." , toAddrString ( ip ) ) ; return getInet4Address ( Arrays . copyOfRange ( ip . getAddress ( ) , 2 , 6 ) ) ; }
Returns the IPv4 address embedded in a 6to4 address .
28,864
public static TeredoInfo getTeredoInfo ( Inet6Address ip ) { Preconditions . checkArgument ( isTeredoAddress ( ip ) , "Address '%s' is not a Teredo address." , toAddrString ( ip ) ) ; byte [ ] bytes = ip . getAddress ( ) ; Inet4Address server = getInet4Address ( Arrays . copyOfRange ( bytes , 4 , 8 ) ) ; int flags = By...
Returns the Teredo information embedded in a Teredo address .
28,865
public static Inet4Address getCoercedIPv4Address ( InetAddress ip ) { if ( ip instanceof Inet4Address ) { return ( Inet4Address ) ip ; } byte [ ] bytes = ip . getAddress ( ) ; boolean leadingBytesOfZero = true ; for ( int i = 0 ; i < 15 ; ++ i ) { if ( bytes [ i ] != 0 ) { leadingBytesOfZero = false ; break ; } } if ( ...
Coerces an IPv6 address into an IPv4 address .
28,866
static List < DiffBean > diff ( Map < String , Object > oldObject , Map < String , Object > newObject ) { if ( oldObject == null ) oldObject = Objects . newHashMap ( ) ; if ( newObject == null ) newObject = Objects . newHashMap ( ) ; oldObject = Objects . copy ( oldObject ) ; newObject = Objects . copy ( newObject ) ; ...
Get difference between two maps
28,867
public AppEngineTransaction beginTransaction ( ) { if ( isTransactional ( ) ) { throw new IllegalStateException ( "Transaction has already started [" + transaction . get ( ) . id ( ) + "]" ) ; } AppEngineTransaction tx = new AppEngineTransaction ( this ) ; transaction . set ( tx ) ; logger . fine ( "Transaction [" + tr...
Begins transaction . You have to do transactional operation after calling this method .
28,868
public void close ( ) { AppEngineTransaction tx = transaction . get ( ) ; if ( tx != null ) { tx . rollback ( ) ; } }
Closes this session .
28,869
public void update ( Object entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } assertTransactional ( ) ; List < Log > logs = transaction . get ( ) . logs ( ) ; if ( logs . isEmpty ( ) ) { throw new IllegalStateException ( "Log [" + Log . Operation . UPD...
Updates the entity in the datastore with the specified one . This method must be invoked under a transaction .
28,870
public void delete ( Object entity ) { if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } assertTransactional ( ) ; List < Log > logs = transaction . get ( ) . logs ( ) ; if ( logs . isEmpty ( ) ) { throw new IllegalStateException ( "Log [" + Log . Operation . DEL...
Deletes the specified entity from the datastore . This method must be invoked under a transaction .
28,871
public static String getExceptionCause ( final Exception exception ) { if ( exception == null ) { return "" ; } final StringBuilder cause = new StringBuilder ( ) ; Throwable nestedException = ( Throwable ) exception ; while ( nestedException != null ) { cause . append ( "Caused by: " ) . append ( nestedException . toSt...
Get a string that represent the caused by of the exception
28,872
public static Exception getLowestException ( final Exception exception , final String exceptionPrefix ) { if ( exception == null ) { return null ; } Throwable nestedException = ( Throwable ) exception ; Exception lastLowException = null ; while ( nestedException != null ) { if ( nestedException . getClass ( ) . toStrin...
Get the most inner exception that is exception from exceptionPrefix type . If the exception does not include inner exception of type exceptionPrefix returns null .
28,873
private static Throwable getInnerException ( Throwable exception ) { final Throwable tmpException = exception ; exception = getExceptionCauseUsingWellKnownTypes ( tmpException ) ; if ( exception == null ) { for ( CauseMethodName methodName : CauseMethodName . values ( ) ) { exception = getExceptionCauseUsingMethodName ...
Get a one level inner exception
28,874
private static Throwable getExceptionCauseUsingMethodName ( final Throwable throwable , final CauseMethodName methodName ) { Method method = null ; try { method = throwable . getClass ( ) . getMethod ( methodName . toString ( ) , ( Class [ ] ) null ) ; } catch ( NoSuchMethodException exception ) { } catch ( SecurityExc...
To discover inner exception this method try to use reflection of known methods that could give the nested exception . So it ignore case of NoSuchMethodException SecurityException IllegalAccessException IllegalArgumentException and InvocationTargetException .
28,875
public Optional < Identification > getIdentification ( Identifiable identifiable ) { if ( ! registered . containsKey ( identifiable . getID ( ) ) ) { return Optional . empty ( ) ; } AddOnModel registered = addOnInformationManager . getAddonModel ( this . registered . get ( identifiable . getID ( ) ) ) ; AddOnModel requ...
If you have registered with an Identifiable interface you can receive Identification Instances with this method .
28,876
public Optional < Identification > getIdentification ( String id ) { return Optional . ofNullable ( registered . get ( id ) ) . map ( IdentificationImpl :: createIdentification ) ; }
If a class has registered with an Identifiable interface you can receive an Identification Instance describing the class by providing his ID .
28,877
public boolean registerIdentification ( Identifiable identifiable ) { if ( identifiable == null || identifiable . getID ( ) == null || identifiable . getID ( ) . isEmpty ( ) ) return false ; if ( registered . containsValue ( identifiable ) || registered . containsKey ( identifiable . getID ( ) ) ) { return false ; } re...
Registers an Identifiable ID has to be unique .
28,878
protected void initialize ( String pFileName , boolean parse ) { this . fileName = pFileName ; Path path = null ; try { path = getPath ( pFileName ) ; List < String > lines = Files . readAllLines ( path , Charset . defaultCharset ( ) ) ; int i = 1 ; for ( String line : lines ) { processLine ( line , i , parse ) ; } } c...
Initialize abbreviations . It reads a file and fulfill the abbreviation map .
28,879
public Integer lookup ( String entry ) { if ( ! data . containsKey ( entry ) ) { int oldsize = data . size ( ) ; data . put ( entry , data . size ( ) + 1 ) ; String msg = String . format ( "new entry: %s (size: %d -> %d)" , entry , oldsize , data . size ( ) ) ; if ( fileName != null ) { msg += " " + fileName ; } LOGGER...
Looking for the abbreviated value of a text .
28,880
public void save ( String fileName ) throws FileNotFoundException , UnsupportedEncodingException { try ( PrintWriter writer = new PrintWriter ( fileName , "UTF-8" ) ) { for ( Map . Entry < String , Integer > entry : data . entrySet ( ) ) { writer . println ( String . format ( "%d;%s" , entry . getValue ( ) , entry . ge...
Save the abbreviations into a file .
28,881
private Path getPath ( String fileName ) throws IOException , URISyntaxException { Path path ; URL url = getClass ( ) . getClassLoader ( ) . getResource ( fileName ) ; if ( url == null ) { throw new IOException ( String . format ( "File %s is not existing" , fileName ) ) ; } URI uri = url . toURI ( ) ; Map < String , S...
A get a java . nio . file . Path object from a file name .
28,882
private String fetchRemoteIfNecessary ( String s ) { if ( s . startsWith ( "s3" ) ) { String [ ] bucketAndKey = parseBucketKeyAndFileName ( s ) ; String bucket = bucketAndKey [ 0 ] ; String key = bucketAndKey [ 1 ] ; String fileName = bucketAndKey [ 2 ] ; log . info ( "KeyTool - fetching " + s ) ; S3Object obj = s3Clie...
review - remove the need for a keys dir - keep keys in memory
28,883
private String [ ] parseBucketKeyAndFileName ( String s ) { String [ ] ret = new String [ 3 ] ; s = s . substring ( "s3://" . length ( ) ) ; int index = s . indexOf ( "/" ) ; String bucket = s . substring ( 0 , index ) ; String key = s . substring ( index + 1 ) ; String fn = s . substring ( s . lastIndexOf ( "/" ) + 1 ...
rushing this morning - MA
28,884
public Response getPartitions ( final UriInfo uriInfo , final HttpHeaders headers ) { final IRI identifier = rdf . createIRI ( properties . getProperty ( "baseUrl" , uriInfo . getBaseUri ( ) . toString ( ) ) ) ; LOGGER . debug ( "Request for root resource at: {}" , identifier . getIRIString ( ) ) ; final List < Triple ...
Get a representation of the root resource
28,885
@ Action ( domainEvent = DownloadLayoutEvent . class , semantics = SemanticsOf . SAFE , restrictTo = RestrictTo . PROTOTYPING ) @ ActionLayout ( contributed = Contributed . AS_ACTION , cssClassFa = "fa-download" ) @ MemberOrder ( sequence = "500.900" ) public Clob downloadLayout ( final Object domainObject ) { return d...
Download the JSON layout of the domain object s type .
28,886
void prepareForWrite ( long xaDataRecorderId ) throws IOException , InterruptedException { this . dataLogger . reopen ( AccessMode . WRITE ) ; this . writeStartSequence ( xaDataRecorderId ) ; }
prepares the Logger for writing . The current content is removed .
28,887
public void put ( Object entity ) { ResourceManager < Transaction > manager = new AppEngineResourceManager ( datastore , datastore . beginTransaction ( ) , transaction ) ; manager . put ( entity ) ; Log log = new Log ( transaction . logs ( ) . size ( ) + 1 , Log . Operation . PUT , entity ) ; log . state ( State . UNCO...
Puts the specified entity instance into the datastore newly within the current transaction .
28,888
public void update ( Object entity ) { ResourceManager < Transaction > manager = managers . get ( keyValue ( entity ) ) ; if ( manager == null ) { throw new IllegalStateException ( "Log [" + Log . Operation . UPDATE + "] is not allowed: previous operation must be [" + Log . Operation . GET + "]" ) ; } manager . update ...
Updates the entity in the datastore with the specified one within the current transaction .
28,889
public void rollback ( ) { for ( ResourceManager < Transaction > manager : managers . values ( ) ) { Transaction transaction = manager . transaction ( ) ; if ( transaction . isActive ( ) ) { try { transaction . rollback ( ) ; } catch ( Exception e ) { logger . warning ( "Transaction [" + transaction . getId ( ) + "]: R...
Rolls back every operation in the current transaction .
28,890
protected static SQLEnum value ( Class < ? extends SQLEnum > clazz , String value ) { if ( value == null ) { return null ; } value = value . trim ( ) ; if ( valuesCache . containsKey ( clazz ) ) { Map < String , SQLEnum > map2 = valuesCache . get ( clazz ) ; if ( map2 . containsKey ( value ) ) { return map2 . get ( val...
Hay un problema se puede llamar a este metodo antes de cargar la clase hija por lo que habria un proiblema
28,891
protected Object callNativeFunction ( HttpServletRequest request , HttpServletResponse response ) { ServletWebRequest servletWebRequest = new ServletWebRequest ( request ) ; AtmosRequest atmosRequest = new AtmosRequest ( servletWebRequest ) ; AtmosResponse atmosResponse = new AtmosResponse ( ) ; Context context = Conte...
Call Javascript Native Function
28,892
public String getRedirectUrl ( ) throws XMLStreamException , IOException { String url = this . settings . getIdpSsoTargetUrl ( ) ; url += "?SAMLRequest=" ; url += URLEncoder . encode ( this . getXmlBase64Request ( ) , "UTF-8" ) ; if ( this . parameters != null ) { for ( Map . Entry < String , String > param : this . pa...
Return the full IDP redirect url with encoded SAML request
28,893
void connect ( SocketAddress socketAddress , boolean useSSL ) { ChannelFactory channelFactory = new NioClientSocketChannelFactory ( Executors . newCachedThreadPool ( ) , Executors . newCachedThreadPool ( ) ) ; ChannelPipeline clientPipeline = NettyChannelPipeline . newPipeline ( connection ) ; SslHandler sslHandler = n...
Connect to the remote server and perform the SSL handshake if SSL is being used .
28,894
public void quit ( String reason ) { if ( ! connected ) { throw new NotConnectedException ( ) ; } Message quit = new Message ( MessageType . QUIT , reason ) ; ChannelFuture future = connection . send ( quit ) ; future . addListener ( new ChannelFutureListener ( ) { public void operationComplete ( ChannelFuture future )...
Quit from the server and close all network connections
28,895
public Channel join ( String channelName ) { if ( ! connected ) { throw new NotConnectedException ( ) ; } ChannelImpl channel = new ChannelImpl ( this , channelName ) ; if ( channel . join ( ) ) { return channel ; } return null ; }
Join the given channel . Create a new channel object for this connection join the channel and return the IRCChannel object .
28,896
public NegateMultiPos < S , Integer , Integer > before ( int rightIndex ) { return new NegateMultiPos < S , Integer , Integer > ( 0 , rightIndex ) { protected S result ( ) { return aQueue ( 'J' , left , right , pos , position , null , plusminus , filltgt ) ; } } ; }
Sets the substring in the beginning and given right index as the search string
28,897
public NegateMultiPos < S , Integer , Character > after ( int leftIndex ) { return new NegateMultiPos < S , Integer , Character > ( leftIndex , null ) { protected S result ( ) { return aQueue ( 'K' , left , right , pos , position , null , plusminus , filltgt ) ; } } ; }
Sets the substring in given left index and the ending as the search string
28,898
public AsymmMultiPos < S , String , String > betn ( String left , String right ) { return new AsymmMultiPos < S , String , String > ( left , right ) { protected S result ( ) { if ( Strs . isEmpty ( asymmLR ) ) { return aQueue ( 'S' , left , right , pos , position , inclusive , plusminus , filltgt ) ; } else { return aQ...
Sets the substrings in given left tag and right tag as the search string
28,899
public InclusMultiPos < S , String , String > before ( String right ) { return new InclusMultiPos < S , String , String > ( right , null ) { protected S result ( ) { return aQueue ( 'B' , left , right , pos , position , inclusive , plusminus , filltgt ) ; } } ; }
Sets the substrings in given left tag and ending as the search string