Input: Use this to prevent duplicate runtime types . [CODESPLIT] public static ImList < Class > registerClasses ( Class ... cs ) { if ( cs == null ) { throw new IllegalArgumentException ( "Can't register a null type array" ) ; } if ( cs . length == 0 ) { throw new IllegalArgumentException ( "Can't register a zero-length type array" ) ; } for ( Class c : cs ) { if ( c == null ) { throw new IllegalArgumentException ( "There shouldn't be any null types in this array!" ) ; } } ArrayHolder < Class > ah = new ArrayHolder <> ( cs ) ; ImList < Class > registeredTypes ; synchronized ( Lock . INSTANCE ) { registeredTypes = typeMap . get ( ah ) ; if ( registeredTypes == null ) { ImList < Class > vecCs = vec ( cs ) ; typeMap . put ( ah , vecCs ) ; registeredTypes = vecCs ; } } // We are returning the original array.  If we returned our safe copy, it could be modified! return registeredTypes ; }


Input: Public static factory method [CODESPLIT] public static < A , B , C , D , E , F , G > Tuple7 < A , B , C , D , E , F , G > of ( A a , B b , C c , D d , E e , F f , G g ) { return new Tuple7 <> ( a , b , c , d , e , f , g ) ; }


Input: Returns a new mutable vector . For some reason calling empty () . mutable () sometimes requires an explicit type parameter in Java so this convenience method works around that . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public static < T > MutableVector < T > emptyMutable ( ) { PersistentVector < T > e = empty ( ) ; return e . mutable ( ) ; }


Input: Public static factory method to create a vector from an Iterable . A varargs version of this method is : { [CODESPLIT] static public < T > PersistentVector < T > ofIter ( Iterable < T > items ) { MutableVector < T > ret = emptyMutable ( ) ; for ( T item : items ) { ret . append ( item ) ; } return ret . immutable ( ) ; }


Input: Returns the array ( of type E ) from the leaf node indicated by the given index . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) private E [ ] leafNodeArrayFor ( int i ) { // i is the index into this vector.  Each 5 bits represent an index into an array.  The // highest 5 bits (that are less than the shift value) are the index into the top-level // array. The lowest 5 bits index the the leaf.  The guts of this method indexes into the // array at each level, finally indexing into the leaf node. if ( i >= 0 && i < size ) { if ( i >= tailoff ( ) ) { return tail ; } Node node = root ; for ( int level = shift ; level > 0 ; level -= NODE_LENGTH_POW_2 ) { node = ( Node ) node . array [ ( i >>> level ) & LOW_BITS ] ; } return ( E [ ] ) node . array ; } throw new IndexOutOfBoundsException ( ) ; }


Input: Returns the item specified by the given index . [CODESPLIT] @ Override public E get ( int i ) { E [ ] node = leafNodeArrayFor ( i ) ; return node [ i & LOW_BITS ] ; }


Input: { [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ Override public PersistentVector < E > replace ( int i , E val ) { if ( i >= 0 && i < size ) { if ( i >= tailoff ( ) ) { Object [ ] newTail = new Object [ tail . length ] ; System . arraycopy ( tail , 0 , newTail , 0 , tail . length ) ; newTail [ i & LOW_BITS ] = val ; return new PersistentVector <> ( size , shift , root , ( E [ ] ) newTail ) ; } return new PersistentVector <> ( size , shift , doAssoc ( shift , root , i , val ) , tail ) ; } if ( i == size ) { return append ( val ) ; } throw new IndexOutOfBoundsException ( ) ; }


Input: Inserts a new item at the end of the Vecsicle . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) @ Override public PersistentVector < E > append ( E val ) { //room in tail? //	if(tail.length < MAX_NODE_LENGTH) if ( size - tailoff ( ) < MAX_NODE_LENGTH ) { E [ ] newTail = ( E [ ] ) new Object [ tail . length + 1 ] ; System . arraycopy ( tail , 0 , newTail , 0 , tail . length ) ; newTail [ tail . length ] = val ; return new PersistentVector <> ( size + 1 , shift , root , newTail ) ; } //full tail, push into tree Node newroot ; Node tailnode = new Node ( root . edit , tail ) ; int newshift = shift ; //overflow root? if ( ( size >>> NODE_LENGTH_POW_2 ) > ( 1 << shift ) ) { newroot = new Node ( root . edit ) ; newroot . array [ 0 ] = root ; newroot . array [ 1 ] = newPath ( root . edit , shift , tailnode ) ; newshift += NODE_LENGTH_POW_2 ; } else { newroot = pushTail ( shift , root , tailnode ) ; } return new PersistentVector <> ( size + 1 , newshift , newroot , ( E [ ] ) new Object [ ] { val } ) ; }


Input: Efficiently adds items to the end of this PersistentVector . [CODESPLIT] @ Override public PersistentVector < E > concat ( Iterable < ? extends E > items ) { return ( PersistentVector < E > ) ImList . super . concat ( items ) ; }


Input: { [CODESPLIT] @ Override public UnmodListIterator < E > listIterator ( int index ) { if ( ( index < 0 ) || ( index > size ) ) { // To match ArrayList and other java.util.List expectations throw new IndexOutOfBoundsException ( "Index: " + index ) ; } return new UnmodListIterator < E > ( ) { private int i = index ; private int base = i - ( i % MAX_NODE_LENGTH ) ; private E [ ] array = ( index < size ( ) ) ? leafNodeArrayFor ( i ) : null ; /** {@inheritDoc} */ @ Override public boolean hasNext ( ) { return i < size ( ) ; } /** {@inheritDoc} */ @ Override public boolean hasPrevious ( ) { return i > 0 ; } /** {@inheritDoc} */ @ Override public E next ( ) { if ( i >= size ) { // To match ArrayList and other java.util.List expectations // If we didn't catch this, it would be an ArrayIndexOutOfBoundsException. throw new NoSuchElementException ( ) ; } if ( i - base == MAX_NODE_LENGTH ) { array = leafNodeArrayFor ( i ) ; base += MAX_NODE_LENGTH ; } return array [ i ++ & LOW_BITS ] ; } /** {@inheritDoc} */ @ Override public int nextIndex ( ) { return i ; } /** {@inheritDoc} */ @ Override public E previous ( ) { // To match contract of ListIterator and implementation of ArrayList if ( i < 1 ) { // To match ArrayList and other java.util.List expectations. throw new NoSuchElementException ( ) ; } if ( i - base == 0 ) { //                    System.out.println("i - base was zero"); array = leafNodeArrayFor ( i - 1 ) ; base -= MAX_NODE_LENGTH ; } else if ( i == size ) { // Can start with index past array. array = leafNodeArrayFor ( i - 1 ) ; base = i - ( i % MAX_NODE_LENGTH ) ; } return array [ -- i & LOW_BITS ] ; } } ; }


Input: } [CODESPLIT] private static Node doAssoc ( int level , Node node , int i , Object val ) { Node ret = new Node ( node . edit , node . array . clone ( ) ) ; if ( level == 0 ) { ret . array [ i & LOW_BITS ] = val ; } else { int subidx = ( i >>> level ) & LOW_BITS ; ret . array [ subidx ] = doAssoc ( level - NODE_LENGTH_POW_2 , ( Node ) node . array [ subidx ] , i , val ) ; } return ret ; }


Input: Public static factory method [CODESPLIT] public static < A , B , C , D , E , F , G , H , I > Tuple9 < A , B , C , D , E , F , G , H , I > of ( A a , B b , C c , D d , E e , F f , G g , H h , I i ) { return new Tuple9 <> ( a , b , c , d , e , f , g , h , i ) ; }


Input: Returns a new PersistentHashMap of the given keys and their paired values . Use the { @link StaticImports#tup ( Object Object ) } method to define those key / value pairs briefly and easily . This data definition method is one of the few methods in this project that support varargs . [CODESPLIT] @ SafeVarargs public static < K , V > ImMap < K , V > map ( Map . Entry < K , V > ... kvPairs ) { if ( ( kvPairs == null ) || ( kvPairs . length < 1 ) ) { return PersistentHashMap . empty ( ) ; } return PersistentHashMap . of ( Arrays . asList ( kvPairs ) ) ; }


Input: Returns a new MutableMap of the given keys and their paired values . Use the { @link StaticImports#tup ( Object Object ) } method to define those key / value pairs briefly and easily . This data definition method is one of the few methods in this project that support varargs . [CODESPLIT] @ SafeVarargs public static < K , V > MutableMap < K , V > mutableMap ( Map . Entry < K , V > ... kvPairs ) { MutableMap < K , V > ret = PersistentHashMap . emptyMutable ( ) ; if ( kvPairs == null ) { return ret ; } for ( Map . Entry < K , V > me : kvPairs ) { ret . assoc ( me ) ; } return ret ; }


Input: Returns a mutable RRB Tree { [CODESPLIT] @ SafeVarargs static public < T > MutableRrbt < T > mutableRrb ( T ... items ) { if ( ( items == null ) || ( items . length < 1 ) ) { return RrbTree . emptyMutable ( ) ; } return RrbTree . < T > emptyMutable ( ) . concat ( Arrays . asList ( items ) ) ; }


Input: Returns a new MutableSet of the values . This data definition method is one of the few methods in this project that support varargs . If the input contains duplicate elements later values overwrite earlier ones . [CODESPLIT] @ SafeVarargs public static < T > MutableSet < T > mutableSet ( T ... items ) { MutableSet < T > ret = PersistentHashSet . emptyMutable ( ) ; if ( items == null ) { return ret ; } for ( T t : items ) { ret . put ( t ) ; } return ret ; }


Input: Returns a MutableVector of the given items . This data definition method is one of the few methods in this project that support varargs . [CODESPLIT] @ SafeVarargs public static < T > MutableList < T > mutableVec ( T ... items ) { MutableList < T > ret = PersistentVector . emptyMutable ( ) ; if ( items == null ) { return ret ; } for ( T t : items ) { ret . append ( t ) ; } return ret ; }


Input: Returns a new immutable RRB Tree { @link ImRrbt } of the given items . An RRB Tree is an immutable list that supports random inserts split and join ( the PersistentVector does not ) . If you build it entirely with random inserts then the RRB tree get () method may be about 5x slower . Otherwise performance is about the same . [CODESPLIT] @ SafeVarargs static public < T > ImRrbt < T > rrb ( T ... items ) { if ( ( items == null ) || ( items . length < 1 ) ) { return RrbTree . empty ( ) ; } return mutableRrb ( items ) . immutable ( ) ; }


Input: Returns a new PersistentHashSet of the values . This data definition method is one of the few methods in this project that support varargs . If the input contains duplicate elements later values overwrite earlier ones . [CODESPLIT] @ SafeVarargs public static < T > ImSet < T > set ( T ... items ) { if ( ( items == null ) || ( items . length < 1 ) ) { return PersistentHashSet . empty ( ) ; } return PersistentHashSet . of ( Arrays . asList ( items ) ) ; }


Input: Returns a new PersistentTreeMap of the specified comparator and the given key / value pairs . Use the tup () method to define those key / value pairs briefly and easily . The keys are sorted according to the comparator you provide . [CODESPLIT] public static < K , V > ImSortedMap < K , V > sortedMap ( Comparator < ? super K > comp , Iterable < Map . Entry < K , V > > kvPairs ) { return PersistentTreeMap . ofComp ( comp , kvPairs ) ; }


Input: Returns a new PersistentTreeSet of the given comparator and items . [CODESPLIT] public static < T > ImSortedSet < T > sortedSet ( Comparator < ? super T > comp , Iterable < T > elements ) { return Xform . of ( elements ) . toImSortedSet ( comp ) ; }


Input: Returns a new PersistentTreeSet of the given comparable items . [CODESPLIT] public static < T extends Comparable < T > > ImSortedSet < T > sortedSet ( Iterable < T > items ) { return PersistentTreeSet . of ( items ) ; }


Input: Returns a new PersistentVector of the given items . This data definition method is one of the few methods in this project that support varargs . [CODESPLIT] @ SafeVarargs static public < T > ImList < T > vec ( T ... items ) { if ( ( items == null ) || ( items . length < 1 ) ) { return PersistentVector . empty ( ) ; } return mutableVec ( items ) . immutable ( ) ; }


Input: If you need to wrap a regular Java array outside this project to perform a transformation on it this method is the most convenient efficient way to do so . [CODESPLIT] @ SafeVarargs public static < T > UnmodIterable < T > xformArray ( T ... items ) { return Xform . of ( Arrays . asList ( items ) ) ; }


Input: Wrap a String ( or CharSequence ) to perform a Character - by - Character transformation on it . [CODESPLIT] public static UnmodIterable < Character > xformChars ( CharSequence seq ) { //noinspection Convert2Lambda return new UnmodIterable < Character > ( ) { @ Override public UnmodIterator < Character > iterator ( ) { return new UnmodIterator < Character > ( ) { private int idx = 0 ; @ Override public boolean hasNext ( ) { return idx < seq . length ( ) ; } @ Override public Character next ( ) { int nextIdx = idx + 1 ; Character c = seq . charAt ( idx ) ; idx = nextIdx ; return c ; } } ; } } ; }


Input: Creates a new StringBuilder with the given number of spaces and returns it . [CODESPLIT] public static StringBuilder indentSpace ( int len ) { StringBuilder sB = new StringBuilder ( ) ; if ( len < 1 ) { return sB ; } while ( len > SPACES_LENGTH_MINUS_ONE ) { sB . append ( SPACES [ SPACES_LENGTH_MINUS_ONE ] ) ; len = len - SPACES_LENGTH_MINUS_ONE ; } return sB . append ( SPACES [ len ] ) ; }


Input: There is Arrays . toString but this is intended to produce Cymling code some day . [CODESPLIT] public static < T > String arrayString ( T [ ] items ) { StringBuilder sB = new StringBuilder ( "A[" ) ; boolean isFirst = true ; for ( T item : items ) { if ( isFirst ) { isFirst = false ; } else { sB . append ( " " ) ; } if ( item instanceof String ) { sB . append ( "\"" ) . append ( item ) . append ( "\"" ) ; } else { sB . append ( item ) ; } } return sB . append ( "]" ) . toString ( ) ; }


Input: TODO : We need one of these for each type of primitive for pretty - printing without commas . [CODESPLIT] public static String arrayString ( int [ ] items ) { StringBuilder sB = new StringBuilder ( "i[" ) ; boolean isFirst = true ; for ( int item : items ) { if ( isFirst ) { isFirst = false ; } else { sB . append ( " " ) ; } sB . append ( item ) ; } return sB . append ( "]" ) . toString ( ) ; }


Input: Construct a LazyRef from the given initialization function . [CODESPLIT] public static < T > LazyRef < T > of ( Fn0 < T > producer ) { if ( producer == null ) { throw new IllegalArgumentException ( "The producer function cannot be null (the value it returns can)" ) ; } return new LazyRef <> ( producer ) ; }


Input: This whole method is synchronized on the advice of Goetz2006 p . 347 [CODESPLIT] public synchronized T applyEx ( ) { // Have we produced our value yet? if ( producer != null ) { // produce our value. value = producer . apply ( ) ; // Delete the producer to 1. mark the work done and 2. free resources. producer = null ; } // We're clear to return the lazily computed value. return value ; }


Input: Helper function to avoid type warnings . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] singleElementArray ( T elem , Class < T > tClass ) { if ( tClass == null ) { return ( T [ ] ) new Object [ ] { elem } ; } T [ ] newItems = ( T [ ] ) Array . newInstance ( tClass , 1 ) ; newItems [ 0 ] = elem ; return newItems ; }


Input: Returns a new array one longer than the given one with the specified item inserted at the specified index . [CODESPLIT] public static < T > T [ ] insertIntoArrayAt ( T item , T [ ] items , int idx , Class < T > tClass ) { // Make an array that's one bigger.  It's too bad that the JVM bothers to // initialize this with nulls. @ SuppressWarnings ( "unchecked" ) T [ ] newItems = ( T [ ] ) ( ( tClass == null ) ? new Object [ items . length + 1 ] : Array . newInstance ( tClass , items . length + 1 ) ) ; // If we aren't inserting at the first item, array-copy the items before the insert // point. if ( idx > 0 ) { System . arraycopy ( items , 0 , newItems , 0 , idx ) ; } // Insert the new item. newItems [ idx ] = item ; // If we aren't inserting at the last item, array-copy the items after the insert // point. if ( idx < items . length ) { System . arraycopy ( items , idx , newItems , idx + 1 , items . length - idx ) ; } return newItems ; }


Input: Returns a new array containing the first n items of the given array . [CODESPLIT] public static < T > T [ ] arrayCopy ( T [ ] items , int length , Class < T > tClass ) { // Make an array of the appropriate size.  It's too bad that the JVM bothers to // initialize this with nulls. @ SuppressWarnings ( "unchecked" ) T [ ] newItems = ( T [ ] ) ( ( tClass == null ) ? new Object [ length ] : Array . newInstance ( tClass , length ) ) ; // array-copy the items up to the new length. if ( length > 0 ) { System . arraycopy ( items , 0 , newItems , 0 , items . length < length ? items . length : length ) ; } return newItems ; }


Input: Called splice but handles precat ( idx = 0 ) and concat ( idx = origItems . length ) . [CODESPLIT] public static < A > A [ ] spliceIntoArrayAt ( A [ ] insertedItems , A [ ] origItems , int idx , Class < A > tClass ) { // Make an array that big enough.  It's too bad that the JVM bothers to // initialize this with nulls. @ SuppressWarnings ( "unchecked" ) A [ ] newItems = tClass == null ? ( A [ ] ) new Object [ insertedItems . length + origItems . length ] : ( A [ ] ) Array . newInstance ( tClass , insertedItems . length + origItems . length ) ; // If we aren't inserting at the first item, array-copy the items before the insert // point. if ( idx > 0 ) { //               src,  srcPos, dest,destPos,length System . arraycopy ( origItems , 0 , newItems , 0 , idx ) ; } // Insert the new items //               src,      srcPos,     dest, destPos, length System . arraycopy ( insertedItems , 0 , newItems , idx , insertedItems . length ) ; // If we aren't inserting at the last item, array-copy the items after the insert // point. if ( idx < origItems . length ) { System . arraycopy ( origItems , idx , newItems , idx + insertedItems . length , origItems . length - idx ) ; } return newItems ; }


Input: } [CODESPLIT] public static < T > T [ ] replaceInArrayAt ( T replacedItem , T [ ] origItems , int idx , Class < T > tClass ) { // Make an array that big enough.  It's too bad that the JVM bothers to // initialize this with nulls. @ SuppressWarnings ( "unchecked" ) T [ ] newItems = ( T [ ] ) ( ( tClass == null ) ? new Object [ origItems . length ] : Array . newInstance ( tClass , origItems . length ) ) ; System . arraycopy ( origItems , 0 , newItems , 0 , origItems . length ) ; newItems [ idx ] = replacedItem ; return newItems ; }


Input: Only call this if the array actually needs to be split ( 0 &lt ; splitPoint &lt ; orig . length ) . [CODESPLIT] public static < T > Tuple2 < T [ ] , T [ ] > splitArray ( T [ ] orig , int splitIndex ) { //, Class<T> tClass) { //        if (splitIndex < 1) { //            throw new IllegalArgumentException("Called split when splitIndex < 1"); //        } //        if (splitIndex > orig.length - 1) { //            throw new IllegalArgumentException("Called split when splitIndex > orig.length - 1"); //        } // NOTE: // I sort of suspect that generic 2D array creation where the two arrays are of a different // length is not possible in Java, or if it is, it's not likely to be much faster than // what we have here.  I'd just copy the Arrays.copyOf code everywhere this function is used // if you want more speed. //        int rightLength = orig.length - splitIndex; //        Class<T> tClass = (Class<T>) orig.getClass().getComponentType(); //        Tuple2<T[],T[]> split = Tuple2.of((T[]) Array.newInstance(tClass, splitIndex), //                                          (T[]) Array.newInstance(tClass, rightLength)); // // Tuple2<T[],T[]> split = return Tuple2 . of ( Arrays . copyOf ( orig , splitIndex ) , Arrays . copyOfRange ( orig , splitIndex , orig . length ) ) ; //        // original array, offset, newArray, offset, length //        System.arraycopy(orig, 0, split._1(), 0, splitIndex); // //        System.arraycopy(orig, splitIndex, split._2(), 0, rightLength); //        return split; }


Input: Only call this if the array actually needs to be split ( 0 &lt ; splitPoint &lt ; orig . length ) . [CODESPLIT] public static int [ ] [ ] splitArray ( int [ ] orig , int splitIndex ) { // This function started an exact duplicate of the one above, but for ints. //        if (splitIndex < 1) { //            throw new IllegalArgumentException("Called split when splitIndex < 1"); //        } //        if (splitIndex > orig.length - 1) { //            throw new IllegalArgumentException("Called split when splitIndex > orig.length - 1"); //        } int rightLength = orig . length - splitIndex ; int [ ] [ ] split = new int [ ] [ ] { new int [ splitIndex ] , new int [ rightLength ] } ; // original array, offset, newArray, offset, length System . arraycopy ( orig , 0 , split [ 0 ] , 0 , splitIndex ) ; System . arraycopy ( orig , splitIndex , split [ 1 ] , 0 , rightLength ) ; return split ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitDescriptorImpl parse ( InputStream inputStream ) throws DeploymentException { Object jaxbPojo = buildJAXBPojo ( inputStream ) ; if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee11 . du . DeployableUnit ) { return new DeployableUnitDescriptorImpl ( ( org . mobicents . slee . container . component . deployment . jaxb . slee11 . du . DeployableUnit ) jaxbPojo ) ; } else if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee . du . DeployableUnit ) { return new DeployableUnitDescriptorImpl ( ( org . mobicents . slee . container . component . deployment . jaxb . slee . du . DeployableUnit ) jaxbPojo ) ; } else { throw new SLEEException ( "unexpected class of jaxb pojo built: " + ( jaxbPojo != null ? jaxbPojo . getClass ( ) : null ) ) ; } }


Input: Some operations require that the transaction be suspended [CODESPLIT] private void suspendIfAssoaciatedWithThread ( ) throws SystemException { // if there is a tx associated with this thread and it is this one // then suspend it to dissociate the thread (dumb feature?!?! of jboss ts) final SleeTransaction currentThreadTransaction = transactionManager . getSleeTransaction ( ) ; if ( currentThreadTransaction != null && currentThreadTransaction . equals ( this ) ) { // lets use the real tx manager directly, to avoid any other procedures transactionManager . getRealTransactionManager ( ) . suspend ( ) ; } }


Input: Verifies if the wrapped transaction is active and if dissociates it from the thread if needed [CODESPLIT] private void beforeAsyncOperation ( ) throws IllegalStateException , SecurityException { try { int status = transaction . getStatus ( ) ; if ( asyncOperationInitiated . getAndSet ( true ) || ( status != Status . STATUS_ACTIVE && status != Status . STATUS_MARKED_ROLLBACK ) ) { throw new IllegalStateException ( "There is no active tx, tx is in state: " + status ) ; } suspendIfAssoaciatedWithThread ( ) ; } catch ( SystemException e ) { throw new IllegalStateException ( e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void asyncCommit ( CommitListener commitListener ) throws IllegalStateException , SecurityException { beforeAsyncOperation ( ) ; transactionManager . getExecutorService ( ) . submit ( new AsyncTransactionCommitRunnable ( commitListener , transaction ) ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void asyncRollback ( RollbackListener rollbackListener ) throws IllegalStateException , SecurityException { beforeAsyncOperation ( ) ; transactionManager . getExecutorService ( ) . submit ( new AsyncTransactionRollbackRunnable ( rollbackListener , transaction ) ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean delistResource ( XAResource arg0 , int arg1 ) throws IllegalStateException , SystemException { return transaction . delistResource ( arg0 , arg1 ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean enlistResource ( XAResource arg0 ) throws IllegalStateException , RollbackException { try { return transaction . enlistResource ( arg0 ) ; } catch ( SystemException e ) { // this should be a bug in slee 1.1 api, the exceptions thrown // should match jta transaction interface throw new RuntimeException ( e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void commit ( ) throws RollbackException , HeuristicMixedException , HeuristicRollbackException , SecurityException , IllegalStateException , SystemException { if ( asyncOperationInitiated . get ( ) ) { throw new IllegalStateException ( ) ; } try { transaction . commit ( ) ; } finally { suspendIfAssoaciatedWithThread ( ) ; } }


Input: Get a <code > ResourceAdaptorEntityState< / code > object from an integer value . [CODESPLIT] public static ResourceAdaptorEntityState fromInt ( int state ) throws IllegalArgumentException { switch ( state ) { case ENTITY_INACTIVE : return INACTIVE ; case ENTITY_ACTIVE : return ACTIVE ; case ENTITY_STOPPING : return STOPPING ; default : throw new IllegalArgumentException ( "Invalid state: " + state ) ; } }


Input: Builds a service component contained in the specified du jar file with the specified and adds it to the specified deployable unit . [CODESPLIT] public List < ServiceComponentImpl > buildComponents ( String serviceDescriptorFileName , JarFile deployableUnitJar ) throws DeploymentException { // make component jar entry JarEntry componentDescriptor = deployableUnitJar . getJarEntry ( serviceDescriptorFileName ) ; InputStream componentDescriptorInputStream = null ; List < ServiceComponentImpl > result = new ArrayList < ServiceComponentImpl > ( ) ; try { componentDescriptorInputStream = deployableUnitJar . getInputStream ( componentDescriptor ) ; ServiceDescriptorFactoryImpl descriptorFactory = componentManagement . getComponentDescriptorFactory ( ) . getServiceDescriptorFactory ( ) ; for ( ServiceDescriptorImpl descriptor : descriptorFactory . parse ( componentDescriptorInputStream ) ) { result . add ( new ServiceComponentImpl ( descriptor ) ) ; } } catch ( IOException e ) { throw new DeploymentException ( "failed to parse service descriptor from " + componentDescriptor . getName ( ) , e ) ; } finally { if ( componentDescriptorInputStream != null ) { try { componentDescriptorInputStream . close ( ) ; } catch ( IOException e ) { logger . error ( "failed to close inputstream of descriptor for jar " + componentDescriptor . getName ( ) ) ; } } } return result ; }


Input:
Recursively walk a directory tree and return a List of all jars Files found ; the List is sorted using File . compareTo . [CODESPLIT] static public List getJarsFileListing ( File aStartingDir ) throws FileNotFoundException { validateDirectory ( aStartingDir ) ; List result = new ArrayList ( ) ; File [ ] filesAndDirs = aStartingDir . listFiles ( new FileFilter ( ) { public boolean accept ( File pathname ) { if ( pathname . getName ( ) . endsWith ( ".jar" ) ) return true ; return false ; } } ) ; List filesDirs = Arrays . asList ( filesAndDirs ) ; Iterator filesIter = filesDirs . iterator ( ) ; File file = null ; while ( filesIter . hasNext ( ) ) { file = ( File ) filesIter . next ( ) ; result . add ( file ) ; // always add, even if directory
 if ( ! file . isFile ( ) ) { // must be a directory
 // recursive call!
 List deeperList = getJarsFileListing ( file ) ; result . addAll ( deeperList ) ; } } Collections . sort ( result ) ; return result ; }


Input: Directory is valid if it exists does not represent a file and can be read . [CODESPLIT] static private void validateDirectory ( File aDirectory ) throws FileNotFoundException { if ( aDirectory == null ) { throw new IllegalArgumentException ( "Directory should not be null." ) ; } if ( ! aDirectory . exists ( ) ) { throw new FileNotFoundException ( "Directory does not exist: " + aDirectory ) ; } if ( ! aDirectory . isDirectory ( ) ) { throw new IllegalArgumentException ( "Is not a directory: " + aDirectory ) ; } if ( ! aDirectory . canRead ( ) ) { throw new IllegalArgumentException ( "Directory cannot be read: " + aDirectory ) ; } }


Input: Create the links with possible interfaces [CODESPLIT] public static void createInterfaceLinks ( CtClass concreteClass , CtClass [ ] interfaces ) { if ( interfaces != null ) concreteClass . setInterfaces ( interfaces ) ; else return ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { logger . trace ( concreteClass . getName ( ) + " Implements link with " + interfaces [ i ] . getName ( ) + " interface created" ) ; } }


Input: Create the inheritance link with the sbb absract class provided by the sbb developer [CODESPLIT] public static void createInheritanceLink ( CtClass concreteClass , CtClass superClass ) { if ( superClass == null ) return ; try { concreteClass . setSuperclass ( superClass ) ; logger . trace ( concreteClass . getName ( ) + " Inheritance link with " + superClass . getName ( ) + " class created" ) ; } catch ( CannotCompileException cce ) { cce . printStackTrace ( ) ; } }


Input:
Add a concrete method invoking the interceptor <B > interceptorName < / B > with the same parameters name return type as the method <B > method < / B > [CODESPLIT] public static void addInterceptedMethod ( CtClass concreteClass , CtMethod method , String interceptorName , boolean callSuperMethod ) { if ( method == null ) throw new InvalidParameterException ( "Intercepted method should not be null" ) ; if ( interceptorName == null ) throw new InvalidParameterException ( "Interceptor class name should not be null" ) ; String methodToAdd = "public " ; //Add the return type
 boolean hasReturn = false ; CtClass returnType = null ; try { returnType = method . getReturnType ( ) ; methodToAdd = methodToAdd . concat ( returnType . getName ( ) + " " ) ; hasReturn = true ; } catch ( NotFoundException nfe ) { //nfe.printStackTrace();
 logger . trace ( "No return type -- assuming return type is void " ) ; methodToAdd = methodToAdd + "void " ; } //Add the method name
 methodToAdd = methodToAdd . concat ( method . getName ( ) + "(" ) ; //Add the parameters
 CtClass [ ] parameterTypes = null ; ; String parametersInit = "Object[] args=null;" ; String argsInit = "Class[] classes=null;" ; try { parameterTypes = method . getParameterTypes ( ) ; parametersInit = parametersInit + "args=new Object[" + parameterTypes . length + "];" ; argsInit = argsInit + "classes=new Class[" + parameterTypes . length + "];" ; for ( int argNumber = 0 ; argNumber < parameterTypes . length ; argNumber ++ ) { methodToAdd = methodToAdd . concat ( parameterTypes [ argNumber ] . getName ( ) + " arg_" + argNumber ) ; //handle the primitive types
 if ( ! parameterTypes [ argNumber ] . isPrimitive ( ) ) parametersInit = parametersInit + " args[" + argNumber + "]=arg_" + argNumber + ";" ; else parametersInit = parametersInit + " args[" + argNumber + "]=" + ClassUtils . getObjectFromPrimitiveType ( parameterTypes [ argNumber ] . getName ( ) , "arg_" + argNumber ) + ";" ; String typeClass = parameterTypes [ argNumber ] . getName ( ) ; //handle the primitive types
 if ( ! parameterTypes [ argNumber ] . isPrimitive ( ) ) { if ( parameterTypes [ argNumber ] . isArray ( ) ) { String arrayClassRepresentation = toArray ( parameterTypes [ argNumber ] ) ; if ( arrayClassRepresentation != null ) argsInit = argsInit + "classes[" + argNumber + "]=" + SleeContainerUtils . class . getName ( ) + ".getCurrentThreadClassLoader().loadClass(\"" + arrayClassRepresentation + "\");" ; } else argsInit = argsInit + "classes[" + argNumber + "]=" + SleeContainerUtils . class . getName ( ) + ".getCurrentThreadClassLoader().loadClass(\"" + typeClass + "\");" ; } else argsInit = argsInit + "classes[" + argNumber + "]=" + ClassUtils . getClassFromPrimitiveType ( typeClass ) + ".TYPE;" ; if ( argNumber + 1 < parameterTypes . length ) methodToAdd = methodToAdd + "," ; } methodToAdd += ") " ; // Add method exceptions
 if ( method . getExceptionTypes ( ) . length > 0 ) { CtClass [ ] exceptions = method . getExceptionTypes ( ) ; methodToAdd += " throws " ; for ( int i = 0 ; i < exceptions . length - 1 ; i ++ ) { String exName = exceptions [ i ] . getName ( ) ; methodToAdd += exName + ", " ; } methodToAdd += exceptions [ exceptions . length - 1 ] . getName ( ) ; } } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; throw new SLEEException ( "Failed creating concrete Profile MBean implementation class" , nfe ) ; } // Start adding method body
 methodToAdd += " { " ; methodToAdd += "" + parametersInit ; methodToAdd += "" + argsInit ; methodToAdd += "Class clazz=this.getClass();" ; methodToAdd += "Object result=null;" ; methodToAdd += "try{" ; //call the super method
 if ( callSuperMethod ) { if ( method . getName ( ) . equals ( "profileStore" ) ) { methodToAdd = methodToAdd + "super." + method . getName ( ) + "(" ; if ( parameterTypes != null && parameterTypes . length > 0 ) { for ( int argNumber = 0 ; argNumber < parameterTypes . length ; argNumber ++ ) { methodToAdd = methodToAdd + "arg_" + argNumber ; if ( argNumber + 1 < parameterTypes . length ) methodToAdd = methodToAdd + "," ; } } methodToAdd = methodToAdd + ");" ; } } methodToAdd = methodToAdd + "java.lang.reflect.Method method=clazz.getDeclaredMethod(\"" + method . getName ( ) + "\",classes" + ");" ; methodToAdd = methodToAdd + "result=" + interceptorName + ".invoke(this,method,args); " ; methodToAdd = methodToAdd + "}catch(RuntimeException t){t.printStackTrace(); throw (t); " + " } catch (Exception ex1) { ex1.printStackTrace(); throw (ex1); }" ; //call the super method
 if ( callSuperMethod ) { if ( ! method . getName ( ) . equals ( "profileStore" ) ) { methodToAdd = methodToAdd + "super." + method . getName ( ) + "(" ; if ( parameterTypes != null && parameterTypes . length > 0 ) { for ( int argNumber = 0 ; argNumber < parameterTypes . length ; argNumber ++ ) { methodToAdd = methodToAdd + "arg_" + argNumber ; if ( argNumber + 1 < parameterTypes . length ) methodToAdd += "," ; } } methodToAdd += ");" ; } } //handle the primitive types
 if ( hasReturn ) { if ( ! returnType . getName ( ) . equalsIgnoreCase ( "void" ) ) { if ( ! returnType . isPrimitive ( ) ) methodToAdd = methodToAdd + "return (" + returnType . getName ( ) + ")result;" ; else methodToAdd = methodToAdd + "return " + ClassUtils . getPrimitiveTypeFromObject ( returnType . getName ( ) , "result" ) + ";" ; } } methodToAdd += "}" ; //Add the implementation code
 logger . trace ( "Method " + methodToAdd + " added" ) ; CtMethod methodTest ; try { methodTest = CtNewMethod . make ( methodToAdd , concreteClass ) ; concreteClass . addMethod ( methodTest ) ; } catch ( CannotCompileException cce ) { throw new SLEEException ( "Cannot compile method " + method . getName ( ) , cce ) ; } }


Input: Transform an array class to its string representation <BR > example : String [] - > [ Ljava . lang . String ; [CODESPLIT] public static String toArray ( CtClass typeClass ) { StringTokenizer st = new StringTokenizer ( typeClass . getName ( ) , "[" ) ; String name = null ; CtClass arrayClass ; try { arrayClass = typeClass . getComponentType ( ) ; if ( ! arrayClass . isPrimitive ( ) ) name = "L" + arrayClass . getName ( ) . replace ( ' ' , ' ' ) + ";" ; else name = toJvmRepresentation ( arrayClass . getName ( ) ) ; st . nextToken ( ) ; while ( st . hasMoreTokens ( ) ) { st . nextToken ( ) ; name = "[" + name ; } } catch ( NotFoundException e ) { e . printStackTrace ( ) ; } return name ; }


Input: Get the jvm representation of the primitives types <BR > Exemple : int - > I boolean - > Z and so on ... [CODESPLIT] public static String toJvmRepresentation ( String primitiveTypeName ) { if ( primitiveTypeName . equals ( "int" ) ) return "I" ; if ( primitiveTypeName . equals ( "boolean" ) ) return "Z" ; if ( primitiveTypeName . equals ( "byte" ) ) return "B" ; if ( primitiveTypeName . equals ( "char" ) ) return "C" ; if ( primitiveTypeName . equals ( "double" ) ) return "D" ; if ( primitiveTypeName . equals ( "float" ) ) return "F" ; if ( primitiveTypeName . equals ( "long" ) ) return "J" ; if ( primitiveTypeName . equals ( "short" ) ) return "S" ; if ( primitiveTypeName . equals ( "void" ) ) return "V" ; return primitiveTypeName ; }


Input: Copy declared methods from one class to another [CODESPLIT] public static void copyMethods ( CtClass source , CtClass destination , CtClass [ ] exceptions ) { copyMethods ( source . getDeclaredMethods ( ) , destination , exceptions ) ; }


Input: Copy methods to a class [CODESPLIT] public static void copyMethods ( CtMethod [ ] methods , CtClass destination , CtClass [ ] exceptions ) { CtMethod methodCopy = null ; for ( CtMethod method : methods ) { try { methodCopy = new CtMethod ( method , destination , null ) ; if ( exceptions != null ) { try { methodCopy . setExceptionTypes ( exceptions ) ; } catch ( NotFoundException e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } } destination . addMethod ( methodCopy ) ; } catch ( CannotCompileException e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ServiceActivity getActivity ( ) throws TransactionRequiredLocalException , FactoryException { final SleeContainer sleeContainer = serviceManagement . getSleeContainer ( ) ; final SleeTransactionManager stm = sleeContainer . getTransactionManager ( ) ; stm . mandateTransaction ( ) ; ServiceID serviceID = SleeThreadLocals . getInvokingService ( ) ; if ( serviceID == null ) { throw new FactoryException ( "unable to find out the invoking service id" ) ; } return new ServiceActivityImpl ( serviceID ) ; }


Input:
Parser for the deployment descriptor . Minimal version obtained from Container . [CODESPLIT] private Collection < DeployableComponent > parseDescriptor ( ) throws IOException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Descriptor for " + this . diURL . toString ( ) ) ; } Collection < DeployableComponent > deployableComponents = new ArrayList < DeployableComponent > ( ) ; SleeContainer sleeContainer = SleeContainer . lookupFromJndi ( ) ; ComponentDescriptorFactory componentDescriptorFactory = sleeContainer . getComponentManagement ( ) . getComponentDescriptorFactory ( ) ; // Special case for the services...
 if ( this . diShortName . endsWith ( ".xml" ) ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Service Descriptor." ) ; } InputStream is = null ; try { is = diURL . openStream ( ) ; ServiceDescriptorFactory sdf = componentDescriptorFactory . getServiceDescriptorFactory ( ) ; List < ? extends ServiceDescriptor > serviceDescriptors = sdf . parse ( is ) ; for ( ServiceDescriptor sd : serviceDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; dc . componentType = SERVICE_COMPONENT ; dc . componentID = sd . getServiceID ( ) ; dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > serviceDependencies = sd . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : serviceDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } dc . installActions . add ( new ActivateServiceAction ( ( ServiceID ) dc . componentID , sleeContainerDeployer . getSleeContainer ( ) . getServiceManagement ( ) ) ) ; dc . uninstallActions . add ( new DeactivateServiceAction ( ( ServiceID ) dc . componentID , sleeContainerDeployer . getSleeContainer ( ) . getServiceManagement ( ) ) ) ; deployableComponents . add ( dc ) ; } return deployableComponents ; } catch ( Exception e ) { logger . error ( "" , e ) ; return null ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } try { URL descriptorXML = null ; // Determine whether the type of this instance is an sbb, event, RA
 // type, etc.
 if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/sbb-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing SBB Descriptor." ) ; } InputStream is = null ; try { is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 SbbDescriptorFactory sbbdf = componentDescriptorFactory . getSbbDescriptorFactory ( ) ; List < ? extends SbbDescriptor > sbbDescriptors = sbbdf . parse ( is ) ; if ( sbbDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no sbb definitions" ) ; return null ; } for ( SbbDescriptor sbbDescriptor : sbbDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; dc . componentType = SBB_COMPONENT ; // Get the Component ID
 dc . componentID = sbbDescriptor . getSbbID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > sbbDependencies = sbbDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : sbbDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } // FIXME: This is special case for Links. Maybe it
 // should be treated in SbbDescriptorImpl?
 for ( ResourceAdaptorTypeBindingDescriptor raTypeBinding : sbbDescriptor . getResourceAdaptorTypeBindings ( ) ) { for ( ResourceAdaptorEntityBindingDescriptor raEntityBinding : raTypeBinding . getResourceAdaptorEntityBinding ( ) ) { String raLink = raEntityBinding . getResourceAdaptorEntityLink ( ) ; // Add the dependency
 dc . dependencies . add ( raLink ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( raLink ) ; } } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/profile-spec-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Profile Specification Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ProfileSpecificationDescriptorFactory psdf = componentDescriptorFactory . getProfileSpecificationDescriptorFactory ( ) ; List < ? extends ProfileSpecificationDescriptor > psDescriptors = psdf . parse ( is ) ; // Get a list of the profile specifications in the
 // deployable unit.
 if ( psDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no profile-spec definitions" ) ; return null ; } // Iterate through the profile spec nodes
 for ( ProfileSpecificationDescriptor psDescriptor : psDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = PROFILESPEC_COMPONENT ; // Get the Component ID
 dc . componentID = psDescriptor . getProfileSpecificationID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > psDependencies = psDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : psDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/event-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Event Definition Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 EventTypeDescriptorFactory etdf = componentDescriptorFactory . getEventTypeDescriptorFactory ( ) ; List < ? extends EventTypeDescriptor > etDescriptors = etdf . parse ( is ) ; if ( etDescriptors == null || etDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no event-type definitions" ) ; return null ; } for ( EventTypeDescriptor etDescriptor : etDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = EVENTTYPE_COMPONENT ; // Get the Component ID
 dc . componentID = etDescriptor . getEventTypeID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > etDependencies = etDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : etDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/resource-adaptor-type-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Resource Adaptor Type Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ResourceAdaptorTypeDescriptorFactory ratdf = componentDescriptorFactory . getResourceAdaptorTypeDescriptorFactory ( ) ; List < ? extends ResourceAdaptorTypeDescriptor > ratDescriptors = ratdf . parse ( is ) ; if ( ratDescriptors == null || ratDescriptors . isEmpty ( ) ) { logger . warn ( "The " + duWrapper . getFileName ( ) + " deployment descriptor contains no resource-adaptor-type definitions" ) ; return null ; } // Go through all the Resource Adaptor Type Elements
 for ( ResourceAdaptorTypeDescriptor ratDescriptor : ratDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = RATYPE_COMPONENT ; // Get the Component ID
 dc . componentID = ratDescriptor . getResourceAdaptorTypeID ( ) ; // Get the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > ratDependencies = ratDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : ratDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/resource-adaptor-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Resource Adaptor Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 ResourceAdaptorDescriptorFactory radf = componentDescriptorFactory . getResourceAdaptorDescriptorFactory ( ) ; List < ? extends ResourceAdaptorDescriptor > raDescriptors = radf . parse ( is ) ; DeployConfigParser sleeDeployConfigParser = sleeContainerDeployer . getSLEEDeployConfigParser ( ) ; // Go through all the Resource Adaptor Elements
 for ( ResourceAdaptorDescriptor raDescriptor : raDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = RA_COMPONENT ; // Set the Component ID
 dc . componentID = raDescriptor . getResourceAdaptorID ( ) ; // Set the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > raDependencies = raDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : raDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } // get management actions for this ra, in SLEE's deploy config
 if ( sleeDeployConfigParser != null ) { Collection < ManagementAction > managementActions = sleeDeployConfigParser . getPostInstallActions ( ) . get ( dc . getComponentKey ( ) ) ; if ( managementActions != null ) { dc . installActions . addAll ( managementActions ) ; } managementActions = sleeDeployConfigParser . getPreUninstallActions ( ) . get ( dc . getComponentKey ( ) ) ; if ( managementActions != null ) { dc . uninstallActions . addAll ( managementActions ) ; } } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else if ( ( descriptorXML = duWrapper . getEntry ( "META-INF/library-jar.xml" ) ) != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Parsing Library Descriptor." ) ; } InputStream is = null ; try { // Get the InputStream
 is = descriptorXML . openStream ( ) ; // Parse the descriptor using the factory
 LibraryDescriptorFactory ldf = componentDescriptorFactory . getLibraryDescriptorFactory ( ) ; List < ? extends LibraryDescriptor > libraryDescriptors = ldf . parse ( is ) ; // Go through all the Resource Adaptor Elements
 for ( LibraryDescriptor libraryDescriptor : libraryDescriptors ) { DeployableComponent dc = new DeployableComponent ( this , sleeContainerDeployer ) ; // Set Component Type
 dc . componentType = LIBRARY_COMPONENT ; // Set the Component ID
 dc . componentID = libraryDescriptor . getLibraryID ( ) ; // Set the Component Key
 dc . componentKey = getComponentIdAsString ( dc . componentID ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Component ID: " + dc . componentKey ) ; logger . trace ( "------------------------------ Dependencies ------------------------------" ) ; } // Get the set of this sbb dependencies
 Set < ComponentID > libraryDependencies = libraryDescriptor . getDependenciesSet ( ) ; // Iterate through dependencies set
 for ( ComponentID dependencyId : libraryDependencies ) { // Add the dependency
 dc . dependencies . add ( getComponentIdAsString ( dependencyId ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( getComponentIdAsString ( dependencyId ) ) ; } } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "--------------------------- End of Dependencies --------------------------" ) ; } deployableComponents . add ( dc ) ; } } catch ( Exception e ) { logger . error ( "" , e ) ; } finally { // Clean up!
 if ( is != null ) { try { is . close ( ) ; } finally { is = null ; } } } } else { logger . warn ( "\r\n--------------------------------------------------------------------------------\r\n" + "No Component Descriptor found in '" + duWrapper . getFileName ( ) + "'.\r\n" + "--------------------------------------------------------------------------------" ) ; return new ArrayList < DeployableComponent > ( ) ; } } finally { } return deployableComponents ; }


Input: Get an <code > AddressPlan< / code > object from an integer value . [CODESPLIT] public static AddressPlan fromInt ( int plan ) throws IllegalArgumentException { switch ( plan ) { case ADDRESS_PLAN_NOT_PRESENT : return NOT_PRESENT ; case ADDRESS_PLAN_UNDEFINED : return UNDEFINED ; case ADDRESS_PLAN_IP : return IP ; case ADDRESS_PLAN_MULTICAST : return MULTICAST ; case ADDRESS_PLAN_UNICAST : return UNICAST ; case ADDRESS_PLAN_E164 : return E164 ; case ADDRESS_PLAN_AESA : return AESA ; case ADDRESS_PLAN_URI : return URI ; case ADDRESS_PLAN_NSAP : return NSAP ; case ADDRESS_PLAN_SMTP : return SMTP ; case ADDRESS_PLAN_X400 : return X400 ; case ADDRESS_PLAN_SIP : return SIP ; case ADDRESS_PLAN_E164_MOBILE : return E164_MOBILE ; case ADDRESS_PLAN_H323 : return H323 ; case ADDRESS_PLAN_GT : return GT ; case ADDRESS_PLAN_SSN : return SSN ; case ADDRESS_PLAN_SLEE_PROFILE_TABLE : return SLEE_PROFILE_TABLE ; case ADDRESS_PLAN_SLEE_PROFILE : return SLEE_PROFILE ; default : throw new IllegalArgumentException ( "Invalid address plan: " + plan ) ; } }


Input: Get an <code > AddressPlan< / code > object from a string value . [CODESPLIT] public static AddressPlan fromString ( String plan ) throws NullPointerException , IllegalArgumentException { if ( plan == null ) throw new NullPointerException ( "plan is null" ) ; if ( plan . equalsIgnoreCase ( NOT_PRESENT_STRING ) ) return NOT_PRESENT ; if ( plan . equalsIgnoreCase ( UNDEFINED_STRING ) ) return UNDEFINED ; if ( plan . equalsIgnoreCase ( IP_STRING ) ) return IP ; if ( plan . equalsIgnoreCase ( MULTICAST_STRING ) ) return MULTICAST ; if ( plan . equalsIgnoreCase ( UNICAST_STRING ) ) return UNICAST ; if ( plan . equalsIgnoreCase ( E164_STRING ) ) return E164 ; if ( plan . equalsIgnoreCase ( AESA_STRING ) ) return AESA ; if ( plan . equalsIgnoreCase ( URI_STRING ) ) return URI ; if ( plan . equalsIgnoreCase ( NSAP_STRING ) ) return NSAP ; if ( plan . equalsIgnoreCase ( SMTP_STRING ) ) return SMTP ; if ( plan . equalsIgnoreCase ( X400_STRING ) ) return X400 ; if ( plan . equalsIgnoreCase ( SIP_STRING ) ) return SIP ; if ( plan . equalsIgnoreCase ( E164_MOBILE_STRING ) ) return E164_MOBILE ; if ( plan . equalsIgnoreCase ( H323_STRING ) ) return H323 ; if ( plan . equalsIgnoreCase ( GT_STRING ) ) return GT ; if ( plan . equalsIgnoreCase ( SSN_STRING ) ) return SSN ; if ( plan . equalsIgnoreCase ( SLEE_PROFILE_TABLE_STRING ) ) return SLEE_PROFILE_TABLE ; if ( plan . equalsIgnoreCase ( SLEE_PROFILE_STRING ) ) return SLEE_PROFILE ; throw new IllegalArgumentException ( "Invalid address plan: " + plan ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public TimerID setTimer ( ActivityContextInterface aci , Address address , long startTime , TimerOptions timerOptions ) throws NullPointerException , IllegalArgumentException , FacilityException { return setTimer ( aci , address , startTime , Long . MAX_VALUE , 1 , timerOptions ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public TimerID setTimer ( ActivityContextInterface aci , Address address , long startTime , long period , int numRepetitions , TimerOptions timerOptions ) throws NullPointerException , IllegalArgumentException , TransactionRolledbackLocalException , FacilityException { if ( aci == null ) throw new NullPointerException ( "Null ActivityContextInterface" ) ; if ( startTime < 0 ) throw new IllegalArgumentException ( "startTime < 0" ) ; if ( period <= 0 ) throw new IllegalArgumentException ( "period <= 0" ) ; if ( timerOptions == null ) throw new NullPointerException ( "Null TimerOptions" ) ; if ( timerOptions . getTimeout ( ) > period ) throw new IllegalArgumentException ( "timeout > period" ) ; if ( timerOptions . getTimeout ( ) < this . getResolution ( ) ) timerOptions . setTimeout ( Math . min ( period , this . getResolution ( ) ) ) ; if ( period == Long . MAX_VALUE && numRepetitions == 1 ) { // non periodic value, the framework expects it to be negative instead
 period = - 1 ; } // when numRepetitions == 0 the timer repeats infinitely or until
 // canceled
 if ( numRepetitions < 0 ) throw new IllegalArgumentException ( "numRepetitions < 0" ) ; SleeTransactionManager txMgr = sleeContainer . getTransactionManager ( ) ; boolean startedTx = txMgr . requireTransaction ( ) ; TimerIDImpl timerID = new TimerIDImpl ( sleeContainer . getUuidGenerator ( ) . createUUID ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setTimer: timerID = " + timerID + " , startTime = " + startTime + " period = " + period + " numRepetitions = " + numRepetitions + " timeroptions =" + timerOptions ) ; } // Attach to activity context
 org . mobicents . slee . container . activity . ActivityContextInterface aciImpl = ( org . mobicents . slee . container . activity . ActivityContextInterface ) aci ; aciImpl . getActivityContext ( ) . attachTimer ( timerID ) ; // schedule timer task
 TimerFacilityTimerTaskData taskData = new TimerFacilityTimerTaskData ( timerID , aciImpl . getActivityContext ( ) . getActivityContextHandle ( ) , address , startTime , period , numRepetitions , timerOptions ) ; final TimerFacilityTimerTask task = new TimerFacilityTimerTask ( taskData ) ; if ( configuration . getTaskExecutionWaitsForTxCommitConfirmation ( ) ) { final CountDownLatch countDownLatch = new CountDownLatch ( 1 ) ; task . setCountDownLatch ( countDownLatch ) ; TransactionalAction action = new TransactionalAction ( ) { @ Override public void execute ( ) { countDownLatch . countDown ( ) ; } } ; TransactionContext txContext = txMgr . getTransactionContext ( ) ; txContext . getAfterCommitActions ( ) . add ( action ) ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } scheduler . schedule ( task ) ; // If we started a tx for this operation, we commit it now
 if ( startedTx ) { try { txMgr . commit ( ) ; } catch ( Exception e ) { throw new TransactionRolledbackLocalException ( "Failed to commit transaction" ) ; } } return timerID ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void cancelTimer ( TimerID timerID ) throws NullPointerException , TransactionRolledbackLocalException , FacilityException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "cancelTimer: timerID = " + timerID ) ; } if ( timerID == null ) throw new NullPointerException ( "Null TimerID" ) ; SleeTransactionManager txMgr = sleeContainer . getTransactionManager ( ) ; boolean terminateTx = txMgr . requireTransaction ( ) ; boolean doRollback = true ; try { cancelTimer ( timerID , true ) ; doRollback = false ; } finally { try { txMgr . requireTransactionEnd ( terminateTx , doRollback ) ; } catch ( Throwable e ) { throw new TransactionRolledbackLocalException ( e . getMessage ( ) , e ) ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ActivityContextInterface getActivityContextInterface ( TimerID timerID ) throws NullPointerException , TransactionRequiredLocalException , FacilityException { if ( timerID == null ) { throw new NullPointerException ( "null timerID" ) ; } sleeContainer . getTransactionManager ( ) . mandateTransaction ( ) ; TimerFacilityTimerTaskData taskData = ( TimerFacilityTimerTaskData ) scheduler . getTimerTaskData ( timerID ) ; if ( taskData != null ) { try { return sleeContainer . getActivityContextFactory ( ) . getActivityContext ( taskData . getActivityContextHandle ( ) ) . getActivityContextInterface ( ) ; } catch ( Exception e ) { throw new FacilityException ( e . getMessage ( ) , e ) ; } } else { return null ; } }


Input: Determine whether the specified notification should be delivered to notification listeners using this notification filter . [CODESPLIT] public boolean isNotificationEnabled ( Notification notification ) { if ( ! ( notification instanceof AlarmNotification ) ) return false ; if ( minLevel_10 != null ) { // SLEE 1.0 comparison Level alarmLevel = ( ( AlarmNotification ) notification ) . getLevel ( ) ; return alarmLevel != null && ! minLevel_10 . isHigherLevel ( alarmLevel ) ; } else { // SLEE 1.1 comparison AlarmLevel alarmLevel = ( ( AlarmNotification ) notification ) . getAlarmLevel ( ) ; return alarmLevel != null && ! minLevel_11 . isHigherLevel ( alarmLevel ) ; } }


Input: Builds a list of { [CODESPLIT] public List < SbbDescriptorImpl > parse ( InputStream inputStream ) throws DeploymentException { Object jaxbPojo = buildJAXBPojo ( inputStream ) ; List < SbbDescriptorImpl > result = new ArrayList < SbbDescriptorImpl > ( ) ; boolean isSlee11 = false ; MSbbJar mSbbJar = null ; if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee . sbb . SbbJar ) { mSbbJar = new MSbbJar ( ( org . mobicents . slee . container . component . deployment . jaxb . slee . sbb . SbbJar ) jaxbPojo ) ; } else if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee11 . sbb . SbbJar ) { mSbbJar = new MSbbJar ( ( org . mobicents . slee . container . component . deployment . jaxb . slee11 . sbb . SbbJar ) jaxbPojo ) ; isSlee11 = true ; } else { throw new SLEEException ( "unexpected class of jaxb pojo built: " + ( jaxbPojo != null ? jaxbPojo . getClass ( ) : null ) ) ; } MSecurityPermissions mSbbJarSecurityPermissions = mSbbJar . getSecurityPermissions ( ) ; for ( MSbb mSbb : mSbbJar . getSbb ( ) ) { result . add ( new SbbDescriptorImpl ( mSbb , mSbbJarSecurityPermissions , isSlee11 ) ) ; } return result ; }


Input: TMP DEV METHODS [CODESPLIT] private TreeItem doTree ( FQDNNode localRoot ) { TreeItem localLeaf = new TreeItem ( ) ; LogTreeNode logTreeNode = new LogTreeNode ( browseContainer , localRoot . getShortName ( ) , localRoot . getFqdName ( ) , localRoot . isWasLeaf ( ) , this ) ; localLeaf . setWidget ( logTreeNode ) ; if ( localRoot . getChildren ( ) . size ( ) > 0 ) { Tree t = new Tree ( ) ; ArrayList names = new ArrayList ( localRoot . getChildrenNames ( ) ) ; Collections . sort ( names ) ; Iterator it = names . iterator ( ) ; while ( it . hasNext ( ) ) { t . addItem ( doTree ( localRoot . getChild ( ( String ) it . next ( ) ) ) ) ; } localLeaf . addItem ( t ) ; } return localLeaf ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { serviceID = new ServiceID ( in . readUTF ( ) , in . readUTF ( ) , in . readUTF ( ) ) ; convergenceName = in . readUTF ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void writeExternal ( ObjectOutput out ) throws IOException { out . writeUTF ( serviceID . getName ( ) ) ; out . writeUTF ( serviceID . getVendor ( ) ) ; out . writeUTF ( serviceID . getVersion ( ) ) ; out . writeUTF ( convergenceName ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void serviceInstall ( ServiceComponent serviceComponent ) { // create object pools for ( SbbID sbbID : serviceComponent . getSbbIDs ( sleeContainer . getComponentRepository ( ) ) ) { // create the pool for the given SbbID sbbPoolManagement . createObjectPool ( serviceComponent . getServiceID ( ) , sleeContainer . getComponentRepository ( ) . getComponentByID ( sbbID ) , sleeContainer . getTransactionManager ( ) ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void serviceUninstall ( ServiceComponent serviceComponent ) { // remove sbb object pools for ( SbbID sbbID : serviceComponent . getSbbIDs ( sleeContainer . getComponentRepository ( ) ) ) { // remove the pool for the given SbbID sbbPoolManagement . removeObjectPool ( serviceComponent . getServiceID ( ) , sleeContainer . getComponentRepository ( ) . getComponentByID ( sbbID ) , sleeContainer . getTransactionManager ( ) ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public SbbObjectPoolImpl getObjectPool ( ServiceID serviceID , SbbID sbbID ) { return sbbPoolManagement . getObjectPool ( serviceID , sbbID ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void installSbb ( final SbbComponent sbbComponent ) throws Exception { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing " + sbbComponent ) ; } final SleeTransactionManager sleeTransactionManager = sleeContainer . getTransactionManager ( ) ; sleeTransactionManager . mandateTransaction ( ) ; // change classloader ClassLoader oldClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( sbbComponent . getClassLoader ( ) ) ; // Set up the comp/env naming context for the Sbb. JndiManagement jndiManagement = sleeContainer . getJndiManagement ( ) ; jndiManagement . componentInstall ( sbbComponent ) ; jndiManagement . pushJndiContext ( sbbComponent ) ; try { setupSbbEnvironment ( sbbComponent ) ; } finally { jndiManagement . popJndiContext ( ) ; } // generate class code for the sbb new SbbClassCodeGenerator ( ) . process ( sbbComponent ) ; //FIXME: this will erase stack trace.	 //} catch (Exception ex) { //	throw ex; } finally { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; } // Set 1.0 Trace to off sleeContainer . getTraceManagement ( ) . getTraceFacility ( ) . setTraceLevelOnTransaction ( sbbComponent . getSbbID ( ) , Level . OFF ) ; sleeContainer . getAlarmManagement ( ) . registerComponent ( sbbComponent . getSbbID ( ) ) ; // if we are in cluster mode we need to add the sbb class loader domain to the replication class loader if ( ! sleeContainer . getCluster ( ) . getMobicentsCache ( ) . isLocalMode ( ) ) { final ReplicationClassLoader replicationClassLoader = sleeContainer . getReplicationClassLoader ( ) ; replicationClassLoader . addDomain ( sbbComponent . getClassLoaderDomain ( ) ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { replicationClassLoader . removeDomain ( sbbComponent . getClassLoaderDomain ( ) ) ; } } ; sleeTransactionManager . getTransactionContext ( ) . getAfterRollbackActions ( ) . add ( action ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void uninstallSbb ( final SbbComponent sbbComponent ) throws SystemException , Exception , NamingException { final SleeTransactionManager sleeTransactionManager = sleeContainer . getTransactionManager ( ) ; sleeTransactionManager . mandateTransaction ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Uninstalling " + sbbComponent ) ; // remove sbb from trace and alarm facilities sleeContainer . getTraceManagement ( ) . getTraceFacility ( ) . unSetTraceLevel ( sbbComponent . getSbbID ( ) ) ; sleeContainer . getAlarmManagement ( ) . unRegisterComponent ( sbbComponent . getSbbID ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Removed SBB " + sbbComponent . getSbbID ( ) + " from trace and alarm facilities" ) ; } sleeContainer . getJndiManagement ( ) . componentUninstall ( sbbComponent ) ; // if we are in cluster mode we need to remove the sbb class loader domain from the replication class loader if ( ! sleeContainer . getCluster ( ) . getMobicentsCache ( ) . isLocalMode ( ) ) { final ReplicationClassLoader replicationClassLoader = sleeContainer . getReplicationClassLoader ( ) ; TransactionalAction action2 = new TransactionalAction ( ) { public void execute ( ) { replicationClassLoader . removeDomain ( sbbComponent . getClassLoaderDomain ( ) ) ; } } ; sleeTransactionManager . getTransactionContext ( ) . getAfterCommitActions ( ) . add ( action2 ) ; } }


Input:
Removes the specified sbb entity but without changing to sbb s class loader first . [CODESPLIT] private void removeSbbEntityWithCurrentClassLoader ( final SbbEntity sbbEntity ) { // remove entity
 sbbEntity . remove ( ) ; // remove from tx data
 final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; final SbbEntityID sbbEntityID = sbbEntity . getSbbEntityId ( ) ; txContext . getData ( ) . remove ( sbbEntityID ) ; // if sbb entity is root add a tx action to ensure lock is removed
 if ( sbbEntityID . isRootSbbEntity ( ) ) { TransactionalAction txAction = new TransactionalAction ( ) { @ Override public void execute ( ) { lockFacility . remove ( sbbEntityID ) ; } } ; txContext . getAfterCommitActions ( ) . add ( txAction ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitID install ( String url ) throws NullPointerException , MalformedURLException , AlreadyDeployedException , DeploymentException , ManagementException { try { final SleeContainer sleeContainer = getSleeContainer ( ) ; final DeployableUnitBuilder deployableUnitBuilder = sleeContainer . getDeployableUnitManagement ( ) . getDeployableUnitBuilder ( ) ; final SleeTransactionManager sleeTransactionManager = sleeContainer . getTransactionManager ( ) ; final ComponentRepository componentRepositoryImpl = sleeContainer . getComponentRepository ( ) ; final DeployableUnitManagement deployableUnitManagement = sleeContainer . getDeployableUnitManagement ( ) ; synchronized ( sleeContainer . getManagementMonitor ( ) ) { DeployableUnitID deployableUnitID = new DeployableUnitID ( url ) ; logger . info ( "Installing " + deployableUnitID ) ; if ( deployableUnitManagement . getDeployableUnit ( deployableUnitID ) != null ) { throw new AlreadyDeployedException ( "there is already a DU deployed for url " + url ) ; } DeployableUnit deployableUnit = null ; Thread currentThread = Thread . currentThread ( ) ; ClassLoader currentClassLoader = currentThread . getContextClassLoader ( ) ; Set < SleeComponent > componentsInstalled = new HashSet < SleeComponent > ( ) ; boolean rollback = true ; try { // start transaction sleeTransactionManager . begin ( ) ; // build du deployableUnit = deployableUnitBuilder . build ( url , tempDUJarsDeploymentRoot , componentRepositoryImpl ) ; // install each component built for ( LibraryComponent component : deployableUnit . getLibraryComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; updateSecurityPermissions ( component , false ) ; logger . info ( "Installed " + component ) ; } for ( EventTypeComponent component : deployableUnit . getEventTypeComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; logger . info ( "Installed " + component ) ; } for ( ResourceAdaptorTypeComponent component : deployableUnit . getResourceAdaptorTypeComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; sleeContainer . getResourceManagement ( ) . installResourceAdaptorType ( component ) ; componentsInstalled . add ( component ) ; logger . info ( "Installed " + component ) ; } // before executing the logic to install an profile spec, ra // or sbb insert the components in the repo, a component can // require that another is already in repo for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; } for ( ResourceAdaptorComponent component : deployableUnit . getResourceAdaptorComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; } for ( SbbComponent component : deployableUnit . getSbbComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; } // run the install logic to install an profile spec, ra or // sbb for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; sleeContainer . getSleeProfileTableManager ( ) . installProfileSpecification ( component ) ; componentsInstalled . add ( component ) ; updateSecurityPermissions ( component , false ) ; logger . info ( "Installed " + component ) ; } for ( ResourceAdaptorComponent component : deployableUnit . getResourceAdaptorComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; sleeContainer . getResourceManagement ( ) . installResourceAdaptor ( component ) ; componentsInstalled . add ( component ) ; updateSecurityPermissions ( component , false ) ; logger . info ( "Installed " + component ) ; } for ( SbbComponent component : deployableUnit . getSbbComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; sleeContainer . getSbbManagement ( ) . installSbb ( component ) ; componentsInstalled . add ( component ) ; updateSecurityPermissions ( component , false ) ; logger . info ( "Installed " + component ) ; } // finally install the services currentThread . setContextClassLoader ( currentClassLoader ) ; for ( ServiceComponent component : deployableUnit . getServiceComponents ( ) . values ( ) ) { componentRepositoryImpl . putComponent ( component ) ; sleeContainer . getServiceManagement ( ) . installService ( component ) ; componentsInstalled . add ( component ) ; logger . info ( "Installed " + component + ". Root sbb is " + component . getRootSbbComponent ( ) ) ; } deployableUnitManagement . addDeployableUnit ( deployableUnit ) ; logger . info ( "Installed " + deployableUnitID ) ; updateSecurityPermissions ( null , true ) ; rollback = false ; return deployableUnitID ; } finally { currentThread . setContextClassLoader ( currentClassLoader ) ; try { if ( rollback ) { if ( deployableUnit != null ) { // remove all components added to repo // put all components in the repo again for ( LibraryComponent component : deployableUnit . getLibraryComponents ( ) . values ( ) ) { removeSecurityPermissions ( component , false ) ; componentRepositoryImpl . removeComponent ( component . getLibraryID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( EventTypeComponent component : deployableUnit . getEventTypeComponents ( ) . values ( ) ) { componentRepositoryImpl . removeComponent ( component . getEventTypeID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( ResourceAdaptorTypeComponent component : deployableUnit . getResourceAdaptorTypeComponents ( ) . values ( ) ) { removeSecurityPermissions ( component , false ) ; if ( componentsInstalled . contains ( component ) ) { sleeContainer . getResourceManagement ( ) . uninstallResourceAdaptorType ( component ) ; } componentRepositoryImpl . removeComponent ( component . getResourceAdaptorTypeID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { if ( componentsInstalled . contains ( component ) ) { sleeContainer . getSleeProfileTableManager ( ) . uninstallProfileSpecification ( component ) ; } componentRepositoryImpl . removeComponent ( component . getProfileSpecificationID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( ResourceAdaptorComponent component : deployableUnit . getResourceAdaptorComponents ( ) . values ( ) ) { removeSecurityPermissions ( component , false ) ; if ( componentsInstalled . contains ( component ) ) { sleeContainer . getResourceManagement ( ) . uninstallResourceAdaptor ( component ) ; } componentRepositoryImpl . removeComponent ( component . getResourceAdaptorID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( SbbComponent component : deployableUnit . getSbbComponents ( ) . values ( ) ) { removeSecurityPermissions ( component , false ) ; if ( componentsInstalled . contains ( component ) ) { sleeContainer . getSbbManagement ( ) . uninstallSbb ( component ) ; } componentRepositoryImpl . removeComponent ( component . getSbbID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } for ( ServiceComponent component : deployableUnit . getServiceComponents ( ) . values ( ) ) { if ( componentsInstalled . contains ( component ) ) { sleeContainer . getServiceManagement ( ) . uninstallService ( component ) ; } componentRepositoryImpl . removeComponent ( component . getServiceID ( ) ) ; logger . info ( "Uninstalled " + component + " due to tx rollback" ) ; } removeSecurityPermissions ( null , true ) ; // undeploy the unit deployableUnit . undeploy ( ) ; } sleeTransactionManager . rollback ( ) ; } else { sleeTransactionManager . commit ( ) ; } } catch ( Exception ex ) { throw new ManagementException ( "Exception while completing transaction" , ex ) ; } } } } catch ( AlreadyDeployedException e ) { throw e ; } catch ( DeploymentException e ) { // This will remove stack trace; // throw e; throw new DeploymentException ( "Failure encountered during deploy process." , e ) ; } catch ( Throwable e ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( e . getMessage ( ) , e ) ; } throw new ManagementException ( e . getMessage ( ) , e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void uninstall ( DeployableUnitID deployableUnitID ) throws NullPointerException , UnrecognizedDeployableUnitException , DependencyException , InvalidStateException , ManagementException { logger . info ( "Uninstalling " + deployableUnitID ) ; final SleeContainer sleeContainer = getSleeContainer ( ) ; final SleeTransactionManager sleeTransactionManager = sleeContainer . getTransactionManager ( ) ; final ServiceManagement serviceManagement = sleeContainer . getServiceManagement ( ) ; final ResourceManagement resourceManagement = sleeContainer . getResourceManagement ( ) ; final DeployableUnitManagement deployableUnitManagement = sleeContainer . getDeployableUnitManagement ( ) ; final ComponentRepository componentRepositoryImpl = sleeContainer . getComponentRepository ( ) ; // we sync on the container's monitor object synchronized ( sleeContainer . getManagementMonitor ( ) ) { if ( this . isInstalled ( deployableUnitID ) ) { Thread currentThread = Thread . currentThread ( ) ; ClassLoader currentClassLoader = currentThread . getContextClassLoader ( ) ; DeployableUnit deployableUnit = null ; boolean rollback = true ; try { // start transaction sleeTransactionManager . begin ( ) ; // get du deployableUnit = deployableUnitManagement . getDeployableUnit ( deployableUnitID ) ; // Check if its safe to remove the deployable unit. for ( SleeComponent sleeComponent : deployableUnit . getDeployableUnitComponents ( ) ) { for ( SleeComponent referringComponent : sleeContainer . getComponentRepository ( ) . getReferringComponents ( sleeComponent ) ) { if ( ! referringComponent . getDeployableUnit ( ) . getDeployableUnitID ( ) . equals ( deployableUnitID ) ) { throw new DependencyException ( "Component " + referringComponent + " refers DU component " + sleeComponent ) ; } } } for ( ServiceComponent component : deployableUnit . getServiceComponents ( ) . values ( ) ) { serviceManagement . uninstallService ( component ) ; componentRepositoryImpl . removeComponent ( component . getServiceID ( ) ) ; logger . info ( "Uninstalled " + component ) ; } for ( SbbComponent component : deployableUnit . getSbbComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; removeSecurityPermissions ( component , false ) ; sleeContainer . getSbbManagement ( ) . uninstallSbb ( component ) ; componentRepositoryImpl . removeComponent ( component . getSbbID ( ) ) ; logger . info ( "Uninstalled " + component ) ; } for ( ResourceAdaptorComponent component : deployableUnit . getResourceAdaptorComponents ( ) . values ( ) ) { removeSecurityPermissions ( component , false ) ; resourceManagement . uninstallResourceAdaptor ( component ) ; componentRepositoryImpl . removeComponent ( component . getResourceAdaptorID ( ) ) ; logger . info ( "Uninstalled " + component ) ; } for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; removeSecurityPermissions ( component , false ) ; sleeContainer . getSleeProfileTableManager ( ) . uninstallProfileSpecification ( component ) ; componentRepositoryImpl . removeComponent ( component . getProfileSpecificationID ( ) ) ; logger . info ( "Uninstalled " + component ) ; } for ( ResourceAdaptorTypeComponent component : deployableUnit . getResourceAdaptorTypeComponents ( ) . values ( ) ) { resourceManagement . uninstallResourceAdaptorType ( component ) ; componentRepositoryImpl . removeComponent ( component . getResourceAdaptorTypeID ( ) ) ; logger . info ( "Uninstalled " + component ) ; } for ( EventTypeID componentID : deployableUnit . getEventTypeComponents ( ) . keySet ( ) ) { componentRepositoryImpl . removeComponent ( componentID ) ; logger . info ( "Uninstalled " + componentID ) ; } for ( LibraryID componentID : deployableUnit . getLibraryComponents ( ) . keySet ( ) ) { removeSecurityPermissions ( componentRepositoryImpl . getComponentByID ( componentID ) , false ) ; componentRepositoryImpl . removeComponent ( componentID ) ; logger . info ( "Uninstalled " + componentID ) ; } removeSecurityPermissions ( null , true ) ; // remove du deployableUnitManagement . removeDeployableUnit ( deployableUnitID ) ; rollback = false ; logger . info ( "Uninstalled " + deployableUnitID ) ; } catch ( InvalidStateException ex ) { logger . error ( ex . getMessage ( ) , ex ) ; throw ex ; } catch ( DependencyException ex ) { logger . error ( ex . getMessage ( ) , ex ) ; throw ex ; } catch ( Throwable ex ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( ex . getMessage ( ) , ex ) ; throw new ManagementException ( "Exception removing deployable Unit " , ex ) ; } finally { currentThread . setContextClassLoader ( currentClassLoader ) ; try { if ( rollback ) { if ( deployableUnit != null ) { // put all components in the repo again for ( LibraryComponent component : deployableUnit . getLibraryComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { updateSecurityPermissions ( component , false ) ; logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( EventTypeComponent component : deployableUnit . getEventTypeComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( ResourceAdaptorTypeComponent component : deployableUnit . getResourceAdaptorTypeComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { updateSecurityPermissions ( component , false ) ; logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( ResourceAdaptorComponent component : deployableUnit . getResourceAdaptorComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { updateSecurityPermissions ( component , false ) ; logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( SbbComponent component : deployableUnit . getSbbComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { updateSecurityPermissions ( component , false ) ; logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } for ( ServiceComponent component : deployableUnit . getServiceComponents ( ) . values ( ) ) { if ( componentRepositoryImpl . putComponent ( component ) ) { logger . info ( "Reinstalled " + component + " due to tx rollback" ) ; } } updateSecurityPermissions ( null , true ) ; deployableUnitManagement . addDeployableUnit ( deployableUnit ) ; } sleeTransactionManager . rollback ( ) ; } else { sleeTransactionManager . commit ( ) ; // FIXME: For JBoss 7.2.0.Final: // we have a problem with org.hibernate.service.UnknownServiceException: // Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry] // see https://hibernate.atlassian.net/browse/HHH-8586 for ( ProfileSpecificationComponent component : deployableUnit . getProfileSpecificationComponents ( ) . values ( ) ) { currentThread . setContextClassLoader ( component . getClassLoader ( ) ) ; removeSecurityPermissions ( component , false ) ; sleeContainer . getSleeProfileTableManager ( ) . closeEntityManagerFactory ( component ) ; logger . info ( "Finalized " + component ) ; } // Clean up all the class files. deployableUnit . undeploy ( ) ; } } catch ( Throwable ex ) { throw new ManagementException ( "Exception while completing transaction" , ex ) ; } } } else { throw new UnrecognizedDeployableUnitException ( "deployable unit " + deployableUnitID ) ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitID getDeployableUnit ( String deploymentUrl ) throws NullPointerException , UnrecognizedDeployableUnitException , ManagementException { DeployableUnitID deployableUnitID = new DeployableUnitID ( deploymentUrl ) ; boolean duExists = true ; try { if ( getSleeContainer ( ) . getDeployableUnitManagement ( ) . getDeployableUnit ( deployableUnitID ) == null ) { duExists = false ; } } catch ( Throwable e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } if ( duExists ) { return deployableUnitID ; } else { throw new UnrecognizedDeployableUnitException ( deploymentUrl ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitID [ ] getDeployableUnits ( ) throws ManagementException { try { return getSleeContainer ( ) . getDeployableUnitManagement ( ) . getDeployableUnits ( ) ; } catch ( Throwable e ) { throw new ManagementException ( "failed to get deployable units" , e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public SbbID [ ] getSbbs ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSbbs()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getSbbIDs ( ) . toArray ( new SbbID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventTypeID [ ] getEventTypes ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getEventTypes()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getEventComponentIDs ( ) . toArray ( new EventTypeID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ProfileSpecificationID [ ] getProfileSpecifications ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getProfileSpecifications()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getProfileSpecificationIDs ( ) . toArray ( new ProfileSpecificationID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ServiceID [ ] getServices ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getServices()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getServiceIDs ( ) . toArray ( new ServiceID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ResourceAdaptorTypeID [ ] getResourceAdaptorTypes ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getResourceAdaptorTypes()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getResourceAdaptorTypeIDs ( ) . toArray ( new ResourceAdaptorTypeID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ResourceAdaptorID [ ] getResourceAdaptors ( ) throws ManagementException { try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getResourceAdaptors()" ) ; } return getSleeContainer ( ) . getComponentRepository ( ) . getResourceAdaptorIDs ( ) . toArray ( new ResourceAdaptorID [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ComponentID [ ] getReferringComponents ( ComponentID componentId ) throws NullPointerException , UnrecognizedComponentException , ManagementException { try { return getSleeContainer ( ) . getComponentRepository ( ) . getReferringComponents ( componentId ) ; } catch ( NullPointerException ex ) { throw ex ; } catch ( UnrecognizedComponentException ex ) { throw ex ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitDescriptor getDescriptor ( DeployableUnitID deployableUnitID ) throws NullPointerException , UnrecognizedDeployableUnitException , ManagementException { if ( deployableUnitID == null ) throw new NullPointerException ( "deployableUnitID should not be null" ) ; DeployableUnitDescriptor dud = null ; try { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getDescriptor " + deployableUnitID ) ; } DeployableUnit du = getSleeContainer ( ) . getDeployableUnitManagement ( ) . getDeployableUnit ( deployableUnitID ) ; if ( du != null ) { dud = du . getSpecsDeployableUnitDescriptor ( ) ; } } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } if ( dud == null ) { throw new UnrecognizedDeployableUnitException ( "unrecognized deployable unit " + deployableUnitID ) ; } else { return dud ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public DeployableUnitDescriptor [ ] getDescriptors ( DeployableUnitID [ ] duIds ) throws NullPointerException , ManagementException { if ( duIds == null ) throw new NullPointerException ( "Null arg!" ) ; final DeployableUnitManagement deployableUnitManagement = getSleeContainer ( ) . getDeployableUnitManagement ( ) ; try { Set < DeployableUnitDescriptor > result = new HashSet < DeployableUnitDescriptor > ( ) ; for ( DeployableUnitID deployableUnitID : deployableUnitManagement . getDeployableUnits ( ) ) { DeployableUnit deployableUnit = deployableUnitManagement . getDeployableUnit ( deployableUnitID ) ; result . add ( deployableUnit . getSpecsDeployableUnitDescriptor ( ) ) ; } return result . toArray ( new DeployableUnitDescriptor [ 0 ] ) ; } catch ( Throwable ex ) { throw new ManagementException ( "Error in tx manager " , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ComponentDescriptor getDescriptor ( ComponentID componentID ) throws NullPointerException , UnrecognizedComponentException , ManagementException { if ( componentID == null ) throw new NullPointerException ( "null component ID" ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getDescriptor: componentID " + componentID ) ; } try { ComponentRepository componentRepositoryImpl = getSleeContainer ( ) . getComponentRepository ( ) ; SleeComponent component = null ; if ( componentID instanceof EventTypeID ) { component = componentRepositoryImpl . getComponentByID ( ( EventTypeID ) componentID ) ; } else if ( componentID instanceof LibraryID ) { component = componentRepositoryImpl . getComponentByID ( ( LibraryID ) componentID ) ; } else if ( componentID instanceof ProfileSpecificationID ) { component = componentRepositoryImpl . getComponentByID ( ( ProfileSpecificationID ) componentID ) ; } else if ( componentID instanceof ResourceAdaptorID ) { component = componentRepositoryImpl . getComponentByID ( ( ResourceAdaptorID ) componentID ) ; } else if ( componentID instanceof ResourceAdaptorTypeID ) { component = componentRepositoryImpl . getComponentByID ( ( ResourceAdaptorTypeID ) componentID ) ; } else if ( componentID instanceof SbbID ) { component = componentRepositoryImpl . getComponentByID ( ( SbbID ) componentID ) ; } else if ( componentID instanceof ServiceID ) { component = componentRepositoryImpl . getComponentByID ( ( ServiceID ) componentID ) ; } if ( component != null ) return component . getComponentDescriptor ( ) ; else return null ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ComponentDescriptor [ ] getDescriptors ( ComponentID [ ] componentIds ) throws NullPointerException , ManagementException { if ( componentIds == null ) throw new NullPointerException ( "null component ids" ) ; try { ComponentDescriptor [ ] descriptors = new ComponentDescriptor [ componentIds . length ] ; for ( int i = 0 ; i < descriptors . length ; i ++ ) { descriptors [ i ] = getDescriptor ( componentIds [ i ] ) ; } return descriptors ; } catch ( ManagementException ex ) { throw ex ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean isInstalled ( DeployableUnitID deployableUnitID ) throws NullPointerException , ManagementException { if ( deployableUnitID == null ) throw new NullPointerException ( "null deployableUnitID" ) ; try { return getSleeContainer ( ) . getDeployableUnitManagement ( ) . getDeployableUnit ( deployableUnitID ) != null ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean isInstalled ( ComponentID componentID ) throws NullPointerException , ManagementException { if ( componentID == null ) throw new NullPointerException ( "null componentID" ) ; try { return getSleeContainer ( ) . getComponentRepository ( ) . isInstalled ( componentID ) ; } catch ( Throwable ex ) { throw new ManagementException ( ex . getMessage ( ) , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public int getActivitiesMapped ( ) { int result = 0 ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { result += getActivitiesMapped ( i ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public int getActivitiesMapped ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getActivitiesMapped ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getAverageEventRoutingTime ( ) { long time = 0L ; long events = 0L ; for ( EventTypeID eventTypeID : eventRouter . getSleeContainer ( ) . getComponentManagement ( ) . getComponentRepository ( ) . getEventComponentIDs ( ) ) { for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { final EventRouterExecutorStatistics eventRouterExecutorStatistics = getEventRouterExecutorStatistics ( i ) ; if ( eventRouterExecutorStatistics != null ) { EventTypeRoutingStatistics eventTypeRoutingStatistics = eventRouterExecutorStatistics . getEventTypeRoutingStatistics ( eventTypeID ) ; if ( eventTypeRoutingStatistics != null ) { time += eventTypeRoutingStatistics . getRoutingTime ( ) ; events += eventTypeRoutingStatistics . getEventsRouted ( ) ; } } } } return time == 0L ? 0L : time / events ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getAverageEventRoutingTime ( EventTypeID eventTypeID ) { long time = 0L ; long events = 0L ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { final EventRouterExecutorStatistics eventRouterExecutorStatistics = getEventRouterExecutorStatistics ( i ) ; if ( eventRouterExecutorStatistics != null ) { EventTypeRoutingStatistics eventTypeRoutingStatistics = eventRouterExecutorStatistics . getEventTypeRoutingStatistics ( eventTypeID ) ; if ( eventTypeRoutingStatistics != null ) { time += eventTypeRoutingStatistics . getRoutingTime ( ) ; events += eventTypeRoutingStatistics . getEventsRouted ( ) ; } } } return time == 0L ? 0L : time / events ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getAverageEventRoutingTime ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getAverageEventRoutingTime ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getEventsRouted ( EventTypeID eventTypeID ) { long result = 0L ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { result += getEventsRouted ( i , eventTypeID ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getEventsRouted ( int executor , EventTypeID eventTypeID ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getEventsRouted ( eventTypeID ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getExecutedTasks ( ) { long result = 0L ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { result += getExecutedTasks ( i ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getExecutedTasks ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getExecutedTasks ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getExecutingTime ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getExecutingTime ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getIdleTime ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getIdleTime ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getMiscTasksExecuted ( ) { long result = 0L ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { result += getMiscTasksExecuted ( i ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getMiscTasksExecuted ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getMiscTasksExecuted ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getMiscTasksExecutingTime ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getMiscTasksExecutingTime ( ) ; }