v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
- *
v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- * where last buffer being read, if not completely full, was not returned.
- *
v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.
- *
v1.3.3 - Fixed I/O streams which were totally messed up.
- *
- *
- *
- * I am placing this code in the Public Domain. Do with it as you will.
- * This software comes with no guarantees or warranties but with
- * plenty of well-wishing instead!
- * Please visit http://iharder.net/xmlizable
- * periodically to check for updates or to contribute improvements.
- *
- *
- * @author Robert Harder
- * @author rob@iharder.net
- * @version 1.3.4
- */
-public class Base64
-{
-
- /** Specify encoding (value is true). */
- public final static boolean ENCODE = true;
-
-
- /** Specify decoding (value is false). */
- public final static boolean DECODE = false;
-
-
- /** Maximum line length (76) of Base64 output. */
- private final static int MAX_LINE_LENGTH = 76;
-
-
- /** The equals sign (=) as a byte. */
- private final static byte EQUALS_SIGN = (byte)'=';
-
-
- /** The new line character (\n) as a byte. */
- private final static byte NEW_LINE = (byte)'\n';
-
-
- /** The 64 valid Base64 values. */
- private final static byte[] ALPHABET =
- {
- (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
- (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
- (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
- (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
- (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
- (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
- (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
- (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
- (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
- (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
- };
-
- /**
- * Translates a Base64 value to either its 6-bit reconstruction value
- * or a negative number indicating some other meaning.
- **/
- final static byte[] DECODABET =
- {
- -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
- -5,-5, // Whitespace: Tab and Linefeed
- -9,-9, // Decimal 11 - 12
- -5, // Whitespace: Carriage Return
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26
- -9,-9,-9,-9,-9, // Decimal 27 - 31
- -5, // Whitespace: Space
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42
- 62, // Plus sign at decimal 43
- -9,-9,-9, // Decimal 44 - 46
- 63, // Slash at decimal 47
- 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine
- -9,-9,-9, // Decimal 58 - 60
- -1, // Equals sign at decimal 61
- -9,-9,-9, // Decimal 62 - 64
- 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N'
- 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z'
- -9,-9,-9,-9,-9,-9, // Decimal 91 - 96
- 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm'
- 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z'
- -9,-9,-9,-9 // Decimal 123 - 126
- /*,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
- -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */
- };
-
- //private final static byte BAD_ENCODING = -9; // Indicates error in encoding
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
-
-
- /** Defeats instantiation. */
- private Base64 (){}
-
-
-/* ******** E N C O D I N G M E T H O D S ******** */
-
-
- /**
- * Encodes the first three bytes of array threeBytes
- * and returns a four-byte array in Base64 notation.
- *
- * @param threeBytes the array to convert
- * @return four byte array in Base64 notation.
- * @since 1.3
- */
-
- protected static byte[] encode3to4( byte[] threeBytes )
- { return encode3to4( threeBytes, 3 );
- } // end encodeToBytes
-
-
-
- /**
- * Encodes up to the first three bytes of array threeBytes
- * and returns a four-byte array in Base64 notation.
- * The actual number of significant bytes in your array is
- * given by numSigBytes.
- * The array threeBytes needs only be as big as
- * numSigBytes.
- *
- * @param threeBytes the array to convert
- * @param numSigBytes the number of significant bytes in your array
- * @return four byte array in Base64 notation.
- * @since 1.3
- */
- static byte[] encode3to4( byte[] threeBytes, int numSigBytes )
- { byte[] dest = new byte[4];
- encode3to4( threeBytes, 0, numSigBytes, dest, 0 );
- return dest;
- }
-
-
-
- /**
- * Encodes up to three bytes of the array source
- * and writes the resulting four Base64 bytes to destination.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * srcOffset and destOffset.
- * This method does not check to make sure your arrays
- * are large enough to accomodate srcOffset + 3 for
- * the source array or destOffset + 4 for
- * the destination array.
- * The actual number of significant bytes in your array is
- * given by numSigBytes.
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param numSigBytes the number of significant bytes in your array
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the destination array
- * @since 1.3
- */
- static byte[] encode3to4(
- byte[] source, int srcOffset, int numSigBytes,
- byte[] destination, int destOffset )
- {
- // 1 2 3
- // 01234567890123456789012345678901 Bit position
- // --------000000001111111122222222 Array position from threeBytes
- // --------| || || || | Six bit groups to index ALPHABET
- // >>18 >>12 >> 6 >> 0 Right shift necessary
- // 0x3f 0x3f 0x3f Additional AND
-
- // Create buffer with zero-padding if there are only one or two
- // significant bytes passed in the array.
- // We have to shift left 24 in order to flush out the 1's that appear
- // when Java treats a value as negative that is cast from a byte to an int.
- int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 )
- | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
- | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
-
- switch( numSigBytes )
- {
- case 3:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ];
- return destination;
-
- case 2:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ];
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- case 1:
- destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ];
- destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
- destination[ destOffset + 2 ] = EQUALS_SIGN;
- destination[ destOffset + 3 ] = EQUALS_SIGN;
- return destination;
-
- default:
- return destination;
- } // end switch
- } // end encode3to4
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return null.
- *
- * @param serializableObject The object to encode
- * @return The Base64-encoded object
- * @since 1.4
- */
- public static String encodeObject( java.io.Serializable serializableObject )
- {
- return encodeObject( serializableObject, true );
- } // end encodeObject
-
- /**
- * Serializes an object and returns the Base64-encoded
- * version of that serialized object. If the object
- * cannot be serialized or there is another error,
- * the method will return null.
- *
- * @param serializableObject The object to encode
- * @param breakLines Break lines at 80 characters or less.
- * @return The Base64-encoded object
- * @since 1.4
- */
- public static String encodeObject( java.io.Serializable serializableObject, boolean breakLines )
- {
- java.io.ByteArrayOutputStream baos = null;
- java.io.OutputStream b64os = null;
- java.io.ObjectOutputStream oos = null;
-
- try
- {
- baos = new java.io.ByteArrayOutputStream();
- b64os = new Base64.OutputStream( baos, Base64.ENCODE, breakLines );
- oos = new java.io.ObjectOutputStream( b64os );
-
- oos.writeObject( serializableObject );
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ oos.close(); } catch( Exception e ){}
- try{ b64os.close(); } catch( Exception e ){}
- try{ baos.close(); } catch( Exception e ){}
- } // end finally
-
- return new String( baos.toByteArray() );
- } // end encode
-
-
- /**
- * Encodes a byte array into Base64 notation.
- * Equivalen to calling
- * encodeBytes( source, 0, source.length )
- *
- * @param source The data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source )
- {
- return encodeBytes( source, true );
- } // end encodeBytes
-
- /**
- * Encodes a byte array into Base64 notation.
- * Equivalen to calling
- * encodeBytes( source, 0, source.length )
- *
- * @param source The data to convert
- * @param breakLines Break lines at 80 characters or less.
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, boolean breakLines )
- {
- return encodeBytes( source, 0, source.length, breakLines );
- } // end encodeBytes
-
-
- /**
- * Encodes a byte array into Base64 notation.
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, int off, int len )
- {
- return encodeBytes( source, off, len, true );
- } // end encodeBytes
-
-
- /**
- * Encodes a byte array into Base64 notation.
- *
- * @param source The data to convert
- * @param off Offset in array where conversion should begin
- * @param len Length of data to convert
- * @param breakLines Break lines at 80 characters or less.
- * @since 1.4
- */
- public static String encodeBytes( byte[] source, int off, int len, boolean breakLines )
- {
- int len43 = len * 4 / 3;
- byte[] outBuff = new byte[ ( len43 ) // Main 4:3
- + ( (len % 3) > 0 ? 4 : 0 ) // Account for padding
- + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
- int d = 0;
- int e = 0;
- int len2 = len - 2;
- int lineLength = 0;
- for( ; d < len2; d+=3, e+=4 )
- {
- encode3to4( source, d+off, 3, outBuff, e );
-
- lineLength += 4;
- if( breakLines && lineLength == MAX_LINE_LENGTH )
- {
- outBuff[e+4] = NEW_LINE;
- e++;
- lineLength = 0;
- } // end if: end of line
- } // en dfor: each piece of array
-
- if( d < len )
- {
- encode3to4( source, d+off, len - d, outBuff, e );
- e += 4;
- } // end if: some padding needed
-
- return new String( outBuff, 0, e );
- } // end encodeBytes
-
-
- /**
- * Encodes a string in Base64 notation with line breaks
- * after every 75 Base64 characters.
- *
- * @param s the string to encode
- * @return the encoded string
- * @since 1.3
- */
- public static String encodeString( String s )
- {
- return encodeString( s, true );
- } // end encodeString
-
- /**
- * Encodes a string in Base64 notation with line breaks
- * after every 75 Base64 characters.
- *
- * @param s the string to encode
- * @param breakLines Break lines at 80 characters or less.
- * @return the encoded string
- * @since 1.3
- */
- public static String encodeString( String s, boolean breakLines )
- {
- return encodeBytes( s.getBytes(), breakLines );
- } // end encodeString
-
-
-
-
-/* ******** D E C O D I N G M E T H O D S ******** */
-
-
- /**
- * Decodes the first four bytes of array fourBytes
- * and returns an array up to three bytes long with the
- * decoded values.
- *
- * @param fourBytes the array with Base64 content
- * @return array with decoded values
- * @since 1.3
- */
- static byte[] decode4to3( byte[] fourBytes )
- {
- byte[] outBuff1 = new byte[3];
- int count = decode4to3( fourBytes, 0, outBuff1, 0 );
- byte[] outBuff2 = new byte[ count ];
-
- for( int i = 0; i < count; i++ )
- outBuff2[i] = outBuff1[i];
-
- return outBuff2;
- }
-
-
-
-
- /**
- * Decodes four bytes from array source
- * and writes the resulting bytes (up to three of them)
- * to destination.
- * The source and destination arrays can be manipulated
- * anywhere along their length by specifying
- * srcOffset and destOffset.
- * This method does not check to make sure your arrays
- * are large enough to accomodate srcOffset + 4 for
- * the source array or destOffset + 3 for
- * the destination array.
- * This method returns the actual number of bytes that
- * were converted from the Base64 encoding.
- *
- *
- * @param source the array to convert
- * @param srcOffset the index where conversion begins
- * @param destination the array to hold the conversion
- * @param destOffset the index where output will be put
- * @return the number of decoded bytes converted
- * @since 1.3
- */
- static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset )
- {
- // Example: Dk==
- if( source[ srcOffset + 2] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- return 1;
- }
-
- // Example: DkL=
- else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
- {
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
-
- destination[ destOffset ] = (byte)( outBuff >>> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
- return 2;
- }
-
- // Example: DkLE
- else
- {
- try{
- // Two ways to do the same thing. Don't know which way I like best.
- //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
- // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
- // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
- // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
- int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
- | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
- | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
- | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
-
-
- destination[ destOffset ] = (byte)( outBuff >> 16 );
- destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
- destination[ destOffset + 2 ] = (byte)( outBuff );
-
- return 3;
- }catch( Exception e){
- System.out.println(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
- System.out.println(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
- System.out.println(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
- System.out.println(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
- return -1;
- } //e nd catch
- }
- } // end decodeToBytes
-
-
-
- /**
- * Decodes data from Base64 notation.
- *
- * @param s the string to decode
- * @return the decoded data
- * @since 1.4
- */
- public static byte[] decode( String s )
- {
- byte[] bytes = s.getBytes();
- return decode( bytes, 0, bytes.length );
- } // end decode
-
-
- /**
- * Decodes data from Base64 notation and
- * returns it as a string.
- * Equivlaent to calling
- * new String( decode( s ) )
- *
- * @param s the strind to decode
- * @return The data as a string
- * @since 1.4
- */
- public static String decodeToString( String s )
- { return new String( decode( s ) );
- } // end decodeToString
-
-
- /**
- * Attempts to decode Base64 data and deserialize a Java
- * Object within. Returns null if there was an error.
- *
- * @param encodedObject The Base64 data to decode
- * @return The decoded and deserialized object
- * @since 1.4
- */
- public static Object decodeToObject( String encodedObject )
- {
- byte[] objBytes = decode( encodedObject );
-
- java.io.ByteArrayInputStream bais = null;
- java.io.ObjectInputStream ois = null;
-
- try
- {
- bais = new java.io.ByteArrayInputStream( objBytes );
- ois = new java.io.ObjectInputStream( bais );
-
- return ois.readObject();
- } // end try
- catch( java.io.IOException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- catch( java.lang.ClassNotFoundException e )
- {
- e.printStackTrace();
- return null;
- } // end catch
- finally
- {
- try{ bais.close(); } catch( Exception e ){}
- try{ ois.close(); } catch( Exception e ){}
- } // end finally
- } // end decodeObject
-
-
- /**
- * Decodes Base64 content in byte array format and returns
- * the decoded byte array.
- *
- * @param source The Base64 encoded data
- * @param off The offset of where to begin decoding
- * @param len The length of characters to decode
- * @return decoded data
- * @since 1.3
- */
- public static byte[] decode( byte[] source, int off, int len )
- {
- int len34 = len * 3 / 4;
- byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
- int outBuffPosn = 0;
-
- byte[] b4 = new byte[4];
- int b4Posn = 0;
- int i = 0;
- byte sbiCrop = 0;
- byte sbiDecode = 0;
- len += off;
- for( i = off; i < len; i++ )
- {
- sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
- sbiDecode = DECODABET[ sbiCrop ];
-
- if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
- {
- if( sbiDecode >= EQUALS_SIGN_ENC )
- {
- b4[ b4Posn++ ] = sbiCrop;
- if( b4Posn > 3 )
- {
- outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn );
- b4Posn = 0;
-
- // If that was the equals sign, break out of 'for' loop
- if( sbiCrop == EQUALS_SIGN )
- break;
- } // end if: quartet built
-
- } // end if: equals sign or better
-
- } // end if: white space, equals sign or better
- else
- {
- System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
- return null;
- } // end else:
- } // each input character
-
- byte[] out = new byte[ outBuffPosn ];
- System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
- return out;
- } // end decode
-
-
-
-
- /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64#InputStream} will read data from another
- * {@link java.io.InputStream}, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @see java.io.FilterInputStream
- * @since 1.3
- */
- public static class InputStream extends java.io.FilterInputStream
- {
- private boolean encode; // Encoding or decoding
- private int position; // Current position in the buffer
- private byte[] buffer; // Small buffer holding converted data
- private int bufferLength; // Length of buffer (3 or 4)
- private int numSigBytes; // Number of meaningful bytes in the buffer
- private int lineLength;
- private boolean breakLines; // Break lines at less than 80 characters
-
-
- /**
- * Constructs a {@link Base64#InputStream} in DECODE mode.
- *
- * @param in the {@link java.io.InputStream} from which to read data.
- * @since 1.3
- */
- public InputStream( java.io.InputStream in )
- {
- this( in, Base64.DECODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64#InputStream} in
- * either ENCODE or DECODE mode.
- *
- * @param in the {@link java.io.InputStream} from which to read data.
- * @param encode Conversion direction
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @since 1.3
- */
- public InputStream( java.io.InputStream in, boolean encode )
- {
- this( in, encode, true );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64#InputStream} in
- * either ENCODE or DECODE mode.
- *
- * @param in the {@link java.io.InputStream} from which to read data.
- * @param encode Conversion direction
- * @param breakLines Break lines at less than 80 characters.
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @since 1.3
- */
- public InputStream( java.io.InputStream in, boolean encode, boolean breakLines )
- {
- super( in );
- this.breakLines = breakLines;
- this.encode = encode;
- this.bufferLength = encode ? 4 : 3;
- this.buffer = new byte[ bufferLength ];
- this.position = -1;
- this.lineLength = 0;
- } // end constructor
-
- /**
- * Reads enough of the input stream to convert
- * to/from Base64 and returns the next byte.
- *
- * @return next byte
- * @since 1.3
- */
- public int read() throws java.io.IOException
- {
- // Do we need to get data?
- if( position < 0 )
- {
- if( encode )
- {
- byte[] b3 = new byte[3];
- int numBinaryBytes = 0;
- for( int i = 0; i < 3; i++ )
- {
- try
- {
- int b = in.read();
-
- // If end of stream, b is -1.
- if( b >= 0 )
- {
- b3[i] = (byte)b;
- numBinaryBytes++;
- } // end if: not end of stream
-
- } // end try: read
- catch( java.io.IOException e )
- {
- // Only a problem if we got no data at all.
- if( i == 0 )
- throw e;
-
- } // end catch
- } // end for: each needed input byte
-
- if( numBinaryBytes > 0 )
- {
- encode3to4( b3, 0, numBinaryBytes, buffer, 0 );
- position = 0;
- numSigBytes = 4;
- } // end if: got data
- else
- {
- return -1;
- } // end else
- } // end if: encoding
-
- // Else decoding
- else
- {
- byte[] b4 = new byte[4];
- int i = 0;
- for( i = 0; i < 4; i++ )
- {
- // Read four "meaningful" bytes:
- int b = 0;
- do{ b = in.read(); }
- while( b >= 0 && DECODABET[ b & 0x7f ] <= WHITE_SPACE_ENC );
-
- if( b < 0 )
- break; // Reads a -1 if end of stream
-
- b4[i] = (byte)b;
- } // end for: each needed input byte
-
- if( i == 4 )
- {
- numSigBytes = decode4to3( b4, 0, buffer, 0 );
- position = 0;
- } // end if: got four characters
- else if( i == 0 ){
- return -1;
- } // end else if: also padded correctly
- else
- {
- // Must have broken out from above.
- throw new java.io.IOException( "Improperly padded Base64 input." );
- } // end
-
- } // end else: decode
- } // end else: get data
-
- // Got data?
- if( position >= 0 )
- {
- // End of relevant data?
- if( /*!encode &&*/ position >= numSigBytes )
- return -1;
-
- if( encode && breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- lineLength = 0;
- return '\n';
- } // end if
- else
- {
- lineLength++; // This isn't important when decoding
- // but throwing an extra "if" seems
- // just as wasteful.
-
- int b = buffer[ position++ ];
-
- if( position >= bufferLength )
- position = -1;
-
- return b & 0xFF; // This is how you "cast" a byte that's
- // intended to be unsigned.
- } // end else
- } // end if: position >= 0
-
- // Else error
- else
- {
- // When JDK1.4 is more accepted, use an assertion here.
- throw new java.io.IOException( "Error in Base64 code reading stream." );
- } // end else
- } // end read
-
-
- /**
- * Calls {@link #read} repeatedly until the end of stream
- * is reached or len bytes are read.
- * Returns number of bytes read into array or -1 if
- * end of stream is encountered.
- *
- * @param dest array to hold values
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @return bytes read into array or -1 if end of stream is encountered.
- * @since 1.3
- */
- public int read( byte[] dest, int off, int len ) throws java.io.IOException
- {
- int i;
- int b;
- for( i = 0; i < len; i++ )
- {
- b = read();
-
- //if( b < 0 && i == 0 )
- // return -1;
-
- if( b >= 0 )
- dest[off + i] = (byte)b;
- else if( i == 0 )
- return -1;
- else
- break; // Out of 'for' loop
- } // end for: each byte read
- return i;
- } // end read
-
- } // end inner class InputStream
-
-
-
-
-
-
- /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
-
-
-
- /**
- * A {@link Base64#OutputStream} will write data to another
- * {@link java.io.OutputStream}, given in the constructor,
- * and encode/decode to/from Base64 notation on the fly.
- *
- * @see Base64
- * @see java.io.FilterOutputStream
- * @since 1.3
- */
- public static class OutputStream extends java.io.FilterOutputStream
- {
- private boolean encode;
- private int position;
- private byte[] buffer;
- private int bufferLength;
- private int lineLength;
- private boolean breakLines;
-
-
- /**
- * Constructs a {@link Base64#OutputStream} in ENCODE mode.
- *
- * @param out the {@link java.io.OutputStream} to which data will be written.
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out )
- {
- this( out, Base64.ENCODE );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64#OutputStream} in
- * either ENCODE or DECODE mode.
- *
- * @param out the {@link java.io.OutputStream} to which data will be written.
- * @param encode Conversion direction
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out, boolean encode )
- {
- this( out, encode, true );
- } // end constructor
-
-
- /**
- * Constructs a {@link Base64#OutputStream} in
- * either ENCODE or DECODE mode.
- *
- * @param out the {@link java.io.OutputStream} to which data will be written.
- * @param encode Conversion direction
- * @param breakLines Break lines to be less than 80 characters.
- * @see Base64#ENCODE
- * @see Base64#DECODE
- * @since 1.3
- */
- public OutputStream( java.io.OutputStream out, boolean encode, boolean breakLines )
- {
- super( out );
- this.breakLines = breakLines;
- this.encode = encode;
- this.bufferLength = encode ? 3 : 4;
- this.buffer = new byte[ bufferLength ];
- this.position = 0;
- this.lineLength = 0;
- } // end constructor
-
-
- /**
- * Writes the byte to the output stream after
- * converting to/from Base64 notation.
- * When encoding, bytes are buffered three
- * at a time before the output stream actually
- * gets a write() call.
- * When decoding, bytes are buffered four
- * at a time.
- *
- * @param theByte the byte to write
- * @since 1.3
- */
- public void write(int theByte) throws java.io.IOException
- {
- if( encode )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to encode.
- {
- out.write( Base64.encode3to4( buffer, bufferLength ) );
-
- lineLength += 4;
- if( breakLines && lineLength >= MAX_LINE_LENGTH )
- {
- out.write( NEW_LINE );
- lineLength = 0;
- } // end if: end of line
-
- position = 0;
- } // end if: enough to output
- } // end if: encoding
-
- // Else, Decoding
- else
- {
- // Meaningful Base64 character?
- if( DECODABET[ theByte & 0x7f ] > WHITE_SPACE_ENC )
- {
- buffer[ position++ ] = (byte)theByte;
- if( position >= bufferLength ) // Enough to output.
- {
- out.write( Base64.decode4to3( buffer ) );
- position = 0;
- } // end if: enough to output
- } // end if: meaningful base64 character
- else if( DECODABET[ theByte & 0x7f ] != WHITE_SPACE_ENC )
- {
- throw new java.io.IOException( "Invalid character in Base64 data." );
- } // end else: not white space either
- } // end else: decoding
- } // end write
-
-
-
- /**
- * Calls {@link #write} repeatedly until len
- * bytes are written.
- *
- * @param theBytes array from which to read bytes
- * @param off offset for array
- * @param len max number of bytes to read into array
- * @since 1.3
- */
- public void write( byte[] theBytes, int off, int len ) throws java.io.IOException
- {
- for( int i = 0; i < len; i++ )
- {
- write( theBytes[ off + i ] );
- } // end for: each byte written
-
- } // end write
-
-
- /**
- * Appropriately pads Base64 notation when encoding
- * or throws an exception if Base64 input is not
- * properly padded when decoding.
- *
- * @since 1.3
- */
- public void flush() throws java.io.IOException
- {
- super.flush();
-
- if( position > 0 )
- {
- if( encode )
- {
- out.write( Base64.encode3to4( buffer, position ) );
- position = 0;
- } // end if: encoding
- else
- {
- throw new java.io.IOException( "Base64 input not properly padded." );
- } // end else: decoding
- } // end if: buffer partially full
-
- out.flush();
- } // end flush
-
-
- /**
- * Flushes and closes (I think, in the superclass) the stream.
- *
- * @since 1.3
- */
- public void close() throws java.io.IOException
- {
- super.close();
- //this.flush();
-
- out.close();
-
- buffer = null;
- out = null;
- } // end close
-
- } // end inner class OutputStream
-
-
-} // end class Base64
diff --git a/orkbasej/pom.xml b/orkbasej/pom.xml
new file mode 100644
index 00000000..f99102c3
--- /dev/null
+++ b/orkbasej/pom.xml
@@ -0,0 +1,122 @@
+
+ 4.0.0
+ net.sf.oreka
+ orkbasej
+ 0.0.2-SNAPSHOT
+
+ src/main/java
+
+
+ src/resources
+
+
+
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 1.8
+
+
+
+
+
+
+ mysql
+ mysql-connector-java
+ 8.0.20
+
+
+
+ org.hibernate
+ hibernate-core
+ 5.4.15.Final
+
+
+
+ org.hibernate.common
+ hibernate-commons-annotations
+ 5.1.0.Final
+
+
+
+ hsqldb
+ hsqldb
+ 1.8.0.4
+
+
+ org.apache.commons
+ commons-lang3
+ 3.10
+
+
+ javax.transaction
+ jta
+ 1.1
+
+
+ junit
+ junit
+ 4.13.1
+
+
+
+ com.cloudhopper.proxool
+ proxool
+ 0.9.1
+
+
+ javax.servlet
+ servlet-api
+
+
+ log4j
+ log4j
+
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 4.0.0
+ provided
+
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.17.0
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.17.0
+
+
+
+ org.apache.logging.log4j
+ log4j-1.2-api
+ 2.11.0
+
+
+
+ org.apache.logging.log4j
+ log4j-web
+ 2.11.0
+
+
+
+ org.projectlombok
+ lombok
+ 1.16.20
+ provided
+
+
+
+
+
\ No newline at end of file
diff --git a/orkbasej/java/net/sf/oreka/Cycle.java b/orkbasej/src/main/java/net/sf/oreka/Cycle.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/Cycle.java
rename to orkbasej/src/main/java/net/sf/oreka/Cycle.java
diff --git a/orkbasej/java/net/sf/oreka/Day.java b/orkbasej/src/main/java/net/sf/oreka/Day.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/Day.java
rename to orkbasej/src/main/java/net/sf/oreka/Day.java
diff --git a/orkbasej/java/net/sf/oreka/Direction.java b/orkbasej/src/main/java/net/sf/oreka/Direction.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/Direction.java
rename to orkbasej/src/main/java/net/sf/oreka/Direction.java
diff --git a/orkbasej/java/net/sf/oreka/HibernateManager.java b/orkbasej/src/main/java/net/sf/oreka/HibernateManager.java
similarity index 96%
rename from orkbasej/java/net/sf/oreka/HibernateManager.java
rename to orkbasej/src/main/java/net/sf/oreka/HibernateManager.java
index 729ece00..c90013a5 100644
--- a/orkbasej/java/net/sf/oreka/HibernateManager.java
+++ b/orkbasej/src/main/java/net/sf/oreka/HibernateManager.java
@@ -37,7 +37,7 @@
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
-import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
import org.logicalcobwebs.proxool.ProxoolFacade;
@@ -58,12 +58,12 @@ public static HibernateManager instance() {
}
public void configure(String filename) throws Exception {
-
+
File configFile = new File(filename);
-
- AnnotationConfiguration config = new AnnotationConfiguration();
+
+ Configuration config = new Configuration();
config.configure(configFile);
-
+
// Configure the proxool connection pool
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
Properties info = new Properties();
@@ -79,11 +79,11 @@ public void configure(String filename) throws Exception {
String driverUrl = config.getProperty("hibernate.connection.url");
String url = "proxool." + alias + ":" + driverClass + ":" + driverUrl;
ProxoolFacade.registerConnectionPool(url, info);
-
+
// Let hibernate know we want to use proxool
config.setProperty("hibernate.proxool.pool_alias", alias);
config.setProperty("hibernate.proxool.existing_pool", "true");
-
+
config.addAnnotatedClass(OrkProgram.class);
config.addAnnotatedClass(OrkSession.class);
config.addAnnotatedClass(OrkSegment.class);
@@ -95,7 +95,7 @@ public void configure(String filename) throws Exception {
config.addAnnotatedClass(OrkPort.class);
config.addAnnotatedClass(OrkPortFace.class);
sessionFactory = config.buildSessionFactory();
-
+
// Add admin user if does not exist yet
Session hbnSession = null;
Transaction tx = null;
diff --git a/orkbasej/java/net/sf/oreka/OrkBase.java b/orkbasej/src/main/java/net/sf/oreka/OrkBase.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/OrkBase.java
rename to orkbasej/src/main/java/net/sf/oreka/OrkBase.java
diff --git a/orkbasej/java/net/sf/oreka/OrkException.java b/orkbasej/src/main/java/net/sf/oreka/OrkException.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/OrkException.java
rename to orkbasej/src/main/java/net/sf/oreka/OrkException.java
diff --git a/orkbasej/java/net/sf/oreka/OrkObject.java b/orkbasej/src/main/java/net/sf/oreka/OrkObject.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/OrkObject.java
rename to orkbasej/src/main/java/net/sf/oreka/OrkObject.java
diff --git a/orkbasej/java/net/sf/oreka/OrkObjectFactory.java b/orkbasej/src/main/java/net/sf/oreka/OrkObjectFactory.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/OrkObjectFactory.java
rename to orkbasej/src/main/java/net/sf/oreka/OrkObjectFactory.java
diff --git a/orkbasej/java/net/sf/oreka/OrkTest.java b/orkbasej/src/main/java/net/sf/oreka/OrkTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/OrkTest.java
rename to orkbasej/src/main/java/net/sf/oreka/OrkTest.java
diff --git a/orkbasej/java/net/sf/oreka/ServiceClass.java b/orkbasej/src/main/java/net/sf/oreka/ServiceClass.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/ServiceClass.java
rename to orkbasej/src/main/java/net/sf/oreka/ServiceClass.java
diff --git a/orkbasej/java/net/sf/oreka/bo/UserBo.java b/orkbasej/src/main/java/net/sf/oreka/bo/UserBo.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/bo/UserBo.java
rename to orkbasej/src/main/java/net/sf/oreka/bo/UserBo.java
diff --git a/orkbasej/java/net/sf/oreka/messages/AsyncMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/AsyncMessage.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/AsyncMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/AsyncMessage.java
diff --git a/orkbasej/java/net/sf/oreka/messages/Message.java b/orkbasej/src/main/java/net/sf/oreka/messages/Message.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/Message.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/Message.java
diff --git a/orkbasej/java/net/sf/oreka/messages/SimpleResponseMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/SimpleResponseMessage.java
similarity index 99%
rename from orkbasej/java/net/sf/oreka/messages/SimpleResponseMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/SimpleResponseMessage.java
index 2da91313..8443655f 100644
--- a/orkbasej/java/net/sf/oreka/messages/SimpleResponseMessage.java
+++ b/orkbasej/src/main/java/net/sf/oreka/messages/SimpleResponseMessage.java
@@ -20,15 +20,13 @@ public class SimpleResponseMessage extends AsyncMessage {
boolean success = false;
String comment = "";
-
- public void define(OrkSerializer serializer) throws OrkException {
+ public void define(OrkSerializer serializer) throws OrkException {
success = serializer.booleanValue("success", success, true);
comment = serializer.stringValue("comment", comment, false);
}
public String getOrkClassName() {
-
return "simpleresponse";
}
diff --git a/orkbasej/java/net/sf/oreka/messages/SyncMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/SyncMessage.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/SyncMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/SyncMessage.java
diff --git a/orkbasej/java/net/sf/oreka/messages/test/TestMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/test/TestMessage.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/test/TestMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/test/TestMessage.java
diff --git a/orkbasej/java/net/sf/oreka/messages/test/TestNestedMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/test/TestNestedMessage.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/test/TestNestedMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/test/TestNestedMessage.java
diff --git a/orkbasej/java/net/sf/oreka/messages/test/TestSubMessage.java b/orkbasej/src/main/java/net/sf/oreka/messages/test/TestSubMessage.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/messages/test/TestSubMessage.java
rename to orkbasej/src/main/java/net/sf/oreka/messages/test/TestSubMessage.java
diff --git a/orkbasej/java/net/sf/oreka/persistent/AnnotatedTestClass.java b/orkbasej/src/main/java/net/sf/oreka/persistent/AnnotatedTestClass.java
similarity index 95%
rename from orkbasej/java/net/sf/oreka/persistent/AnnotatedTestClass.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/AnnotatedTestClass.java
index f4e9c11d..a20790c6 100644
--- a/orkbasej/java/net/sf/oreka/persistent/AnnotatedTestClass.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/AnnotatedTestClass.java
@@ -37,7 +37,7 @@ public void setFirstname(String firstname) {
this.firstname = firstname;
}
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public long getId() {
return Id;
}
diff --git a/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java b/orkbasej/src/main/java/net/sf/oreka/persistent/AnnotationsTest.java
similarity index 98%
rename from orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/AnnotationsTest.java
index aae1f911..6fad3d5a 100644
--- a/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/AnnotationsTest.java
@@ -23,7 +23,7 @@
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
-import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
//import org.hibernate.tool.hbm2ddl.SchemaExport;
//import org.hibernate.ScrollableResults;
@@ -61,8 +61,8 @@ public static void main(String[] args) {
// int sec = (int)(mili/1000);
// long mili2 = (long)sec*1000;
// Date date2 = new Date(mili2);
-
- AnnotationConfiguration config = (AnnotationConfiguration)new AnnotationConfiguration();
+
+ Configuration config = new Configuration();
// .setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect")
// .setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver")
// .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:test")
diff --git a/orkbasej/java/net/sf/oreka/persistent/HbnXmlTest.java b/orkbasej/src/main/java/net/sf/oreka/persistent/HbnXmlTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/persistent/HbnXmlTest.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/HbnXmlTest.java
diff --git a/orkbasej/java/net/sf/oreka/persistent/HbnXmlTestClass.java b/orkbasej/src/main/java/net/sf/oreka/persistent/HbnXmlTestClass.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/persistent/HbnXmlTestClass.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/HbnXmlTestClass.java
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkDomain.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkDomain.java
similarity index 91%
rename from orkbasej/java/net/sf/oreka/persistent/OrkDomain.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkDomain.java
index fad87bde..6d0472ca 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkDomain.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkDomain.java
@@ -1,97 +1,97 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/**
- *
- */
-package net.sf.oreka.persistent;
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orkdomain")
-public class OrkDomain implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private String name = "";
- private String description = "";
-
- /**
- *
- */
- public OrkDomain() {
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
-
- /**
- * @param description The description to set.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+/**
+ *
+ */
+package net.sf.oreka.persistent;
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orkdomain")
+public class OrkDomain implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private String name = "";
+ private String description = "";
+
+ /**
+ *
+ */
+ public OrkDomain() {
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkLoginString.java
similarity index 83%
rename from orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkLoginString.java
index f27ed249..3bb96f25 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkLoginString.java
@@ -1,133 +1,128 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/**
- *
- */
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orkloginstring")
-public class OrkLoginString implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private String loginString;
- private OrkUser user;
- private OrkDomain domain;
-
- /**
- * @hibernate.many-to-one
- * @return Returns the domain.
- */
- @ManyToOne
- public OrkDomain getDomain() {
- return domain;
- }
-
-
- /**
- * @param domain The domain to set.
- */
- public void setDomain(OrkDomain domain) {
- this.domain = domain;
- }
-
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the loginString.
- */
- public String getLoginString() {
- return loginString;
- }
-
-
- /**
- * @param loginString The loginString to set.
- */
- public void setLoginString(String loginString) {
- this.loginString = loginString;
- }
-
-
- /**
- * @hibernate.many-to-one
- * @return Returns the user.
- */
- @ManyToOne
- public OrkUser getUser() {
- return user;
- }
-
-
- /**
- * @param user The user to set.
- */
- public void setUser(OrkUser user) {
- this.user = user;
- }
-
-// public void bidirSetUser(User user) {
-// this.user = user;
-// if(user != null) {
-// user.getLoginStrings().add(this);
-// }
-// }
-//
-// public void bidirRemoveUser(User user) {
-// this.user = null;
-// if(user != null) {
-// user.getLoginStrings().remove(this);
-// }
-// }
-
- /**
- *
- */
- public OrkLoginString() {
- }
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+/**
+ *
+ */
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orkloginstring")
+public class OrkLoginString implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private String loginString;
+ private OrkUser user;
+ private OrkDomain domain;
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the domain.
+ */
+ @ManyToOne
+ public OrkDomain getDomain() {
+ return domain;
+ }
+
+
+ /**
+ * @param domain The domain to set.
+ */
+ public void setDomain(OrkDomain domain) {
+ this.domain = domain;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the loginString.
+ */
+ public String getLoginString() {
+ return loginString;
+ }
+
+
+ /**
+ * @param loginString The loginString to set.
+ */
+ public void setLoginString(String loginString) {
+ this.loginString = loginString;
+ }
+
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the user.
+ */
+ @ManyToOne
+ public OrkUser getUser() {
+ return user;
+ }
+
+
+ /**
+ * @param user The user to set.
+ */
+ public void setUser(OrkUser user) {
+ this.user = user;
+ }
+
+// public void bidirSetUser(User user) {
+// this.user = user;
+// if(user != null) {
+// user.getLoginStrings().add(this);
+// }
+// }
+//
+// public void bidirRemoveUser(User user) {
+// this.user = null;
+// if(user != null) {
+// user.getLoginStrings().remove(this);
+// }
+// }
+
+ /**
+ *
+ */
+ public OrkLoginString() {
+ }
+
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkPort.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkPort.java
similarity index 89%
rename from orkbasej/java/net/sf/oreka/persistent/OrkPort.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkPort.java
index 5ef07339..3cdad838 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkPort.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkPort.java
@@ -1,39 +1,39 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "orkport")
-public class OrkPort implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
-
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "orkport")
+public class OrkPort implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkPortFace.java
similarity index 95%
rename from orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkPortFace.java
index bb83a2f8..96bcf90c 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkPortFace.java
@@ -1,54 +1,54 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@Entity
-@Table(name = "orkportface")
-public class OrkPortFace implements Serializable {
-
- static final long serialVersionUID = 1l;
- private OrkPort port;
- private OrkService service;
- private String name;
-
- @Id
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- @ManyToOne
- public OrkPort getPort() {
- return port;
- }
- public void setPort(OrkPort recPort) {
- this.port = recPort;
- }
- @ManyToOne
- public OrkService getService() {
- return service;
- }
- public void setService(OrkService service) {
- this.service = service;
- }
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "orkportface")
+public class OrkPortFace implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private OrkPort port;
+ private OrkService service;
+ private String name;
+
+ @Id
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ @ManyToOne
+ public OrkPort getPort() {
+ return port;
+ }
+ public void setPort(OrkPort recPort) {
+ this.port = recPort;
+ }
+ @ManyToOne
+ public OrkService getService() {
+ return service;
+ }
+ public void setService(OrkService service) {
+ this.service = service;
+ }
+
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkProgram.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkProgram.java
similarity index 94%
rename from orkbasej/java/net/sf/oreka/persistent/OrkProgram.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkProgram.java
index 9609ccc7..fa6fc060 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkProgram.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkProgram.java
@@ -1,514 +1,514 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/**
- *
- */
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import net.sf.oreka.Cycle;
-import net.sf.oreka.Day;
-import net.sf.oreka.Direction;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orkprogram")
-public class OrkProgram implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private String name = "";
- private String description = "";
- private boolean discarded = false;
- private Date timestamp;
- private OrkUser creator;
- private boolean active = true;
- private Direction direction = Direction.ALL;
- private int minDuration = 0;
- private int maxDuration = 0;
- private double randomPercent = 0.0;
- private Cycle cycle = Cycle.PERMANENT;
- private Day startDay = Day.UNKN;
- private Day stopDay = Day.UNKN;
- private Date startTime = null;
- private Date stopTime = null;
- private int recPerCycle = 0;
- private int recordedSoFar = 0;
- private String localParty = "";
- private String remoteParty = "";
- private int keepForHours = 0;
- private OrkUser targetUser;
- private OrkPort targetPort;
-
- //private Set RecSegments;
- private Collection recSegments;
-
- /**
- * @hibernate.set
- * lazy="true"
- * table="PrgToSeg"
- * @hibernate.collection-key
- * column="RecProgram"
- * @hibernate.collection-many-to-many
- * column="RecSegment"
- * class="net.sf.oreka.persistent.RecSegment"
- * @return Returns the recSegments.
- */
- @ManyToMany
-// (
-// targetEntity="net.sf.oreka.persistent.RecSegment"
-// )
- @JoinTable(
- name="orkprogtoseg",
- joinColumns={@JoinColumn(name="progId")},
- inverseJoinColumns={@JoinColumn(name="segId")}
- )
- public Collection getRecSegments() {
- return recSegments;
- }
-
-
- /**
- * @param recSegments The recSegments to set.
- */
- public void setRecSegments(Collection recSegments) {
- this.recSegments = recSegments;
- }
-
-
- public OrkProgram () {
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
- try {
- startTime = sdf.parse("00:00:00");
- stopTime = sdf.parse("00:00:00");
- }
- catch (Exception e) {;}
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the active.
- */
- public boolean isActive() {
- return active;
- }
-
-
- /**
- * @param active The active to set.
- */
- public void setActive(boolean active) {
- this.active = active;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the cycle.
- */
- public Cycle getCycle() {
- return cycle;
- }
-
-
- /**
- * @param cycle The cycle to set.
- */
- public void setCycle(Cycle cycle) {
- this.cycle = cycle;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the description.
- */
- public String getDescription() {
- return description;
- }
-
-
- /**
- * @param description The description to set.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the direction.
- */
- public Direction getDirection() {
- return direction;
- }
-
-
- /**
- * @param direction The direction to set.
- */
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
-
- /**
- * @return Returns the discarded.
- */
- public boolean isDiscarded() {
- return discarded;
- }
-
-
- /**
- * @param discarded The discarded to set.
- */
- public void setDiscarded(boolean discarded) {
- this.discarded = discarded;
- }
-
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the keepForHours.
- */
- public int getKeepForHours() {
- return keepForHours;
- }
-
-
- /**
- * @param keepForHours The keepForHours to set.
- */
- public void setKeepForHours(int keepForHours) {
- this.keepForHours = keepForHours;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the localParty.
- */
- public String getLocalParty() {
- return localParty;
- }
-
-
- /**
- * @param localParty The localParty to set.
- */
- public void setLocalParty(String localParty) {
- this.localParty = localParty;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the maxDuration.
- */
- public int getMaxDuration() {
- return maxDuration;
- }
-
-
- /**
- * @param maxDuration The maxDuration to set.
- */
- public void setMaxDuration(int maxDuration) {
- this.maxDuration = maxDuration;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the minDuration.
- */
- public int getMinDuration() {
- return minDuration;
- }
-
-
- /**
- * @param minDuration The minDuration to set.
- */
- public void setMinDuration(int minDuration) {
- this.minDuration = minDuration;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the name.
- */
- public String getName() {
- return name;
- }
-
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the randomPercent.
- */
- public double getRandomPercent() {
- return randomPercent;
- }
-
-
- /**
- * @param randomPercent The randomPercent to set.
- */
- public void setRandomPercent(double randomPercent) {
- this.randomPercent = randomPercent;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the recordedSoFar.
- */
- public int getRecordedSoFar() {
- return recordedSoFar;
- }
-
-
- /**
- * @param recordedSoFar The recordedSoFar to set.
- */
- public void setRecordedSoFar(int recordedSoFar) {
- this.recordedSoFar = recordedSoFar;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the recPerCycle.
- */
- public int getRecPerCycle() {
- return recPerCycle;
- }
-
-
- /**
- * @param recPerCycle The recPerCycle to set.
- */
- public void setRecPerCycle(int recPerCycle) {
- this.recPerCycle = recPerCycle;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the remoteParty.
- */
- public String getRemoteParty() {
- return remoteParty;
- }
-
-
- /**
- * @param remoteParty The remoteParty to set.
- */
- public void setRemoteParty(String remoteParty) {
- this.remoteParty = remoteParty;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the startTime.
- */
- public Date getStartTime() {
- return startTime;
- }
-
-
- /**
- * @param startTime The startTime to set.
- */
- public void setStartTime(Date startTime) {
- this.startTime = startTime;
- }
-
-
- public Day getStartDay() {
- return startDay;
- }
-
-
-
- public void setStartDay(Day startDay) {
- this.startDay = startDay;
- }
-
-
-
- public Day getStopDay() {
- return stopDay;
- }
-
-
-
- public void setStopDay(Day stopDay) {
- this.stopDay = stopDay;
- }
-
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the stopTime.
- */
- public Date getStopTime() {
- return stopTime;
- }
-
-
- /**
- * @param stopTime The stopTime to set.
- */
- public void setStopTime(Date stopTime) {
- this.stopTime = stopTime;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the targetPort.
- */
- @ManyToOne
- public OrkPort getTargetPort() {
- return targetPort;
- }
-
-
- /**
- * @param targetPort The targetPort to set.
- */
- public void setTargetPort(OrkPort targetPort) {
- this.targetPort = targetPort;
- }
-
- /**
- * @hibernate.many-to-one
- * @return Returns the targetUser.
- */
- @ManyToOne
- public OrkUser getTargetUser() {
- return targetUser;
- }
-
-
-
- /**
- * @param targetUser The targetUser to set.
- */
- public void setTargetUser(OrkUser targetUser) {
- this.targetUser = targetUser;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the timestamp.
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
-
- /**
- * @param timestamp The timestamp to set.
- */
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
-
- /**
- * @hibernate.many-to-one
- * @return Returns the owner.
- */
- @ManyToOne
- public OrkUser getCreator() {
- return creator;
- }
-
-
-
- /**
- * @param owner The owner to set.
- */
- public void setCreator(OrkUser creator) {
- this.creator = creator;
- }
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+/**
+ *
+ */
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import net.sf.oreka.Cycle;
+import net.sf.oreka.Day;
+import net.sf.oreka.Direction;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orkprogram")
+public class OrkProgram implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private String name = "";
+ private String description = "";
+ private boolean discarded = false;
+ private Date timestamp;
+ private OrkUser creator;
+ private boolean active = true;
+ private Direction direction = Direction.ALL;
+ private int minDuration = 0;
+ private int maxDuration = 0;
+ private double randomPercent = 0.0;
+ private Cycle cycle = Cycle.PERMANENT;
+ private Day startDay = Day.UNKN;
+ private Day stopDay = Day.UNKN;
+ private Date startTime = null;
+ private Date stopTime = null;
+ private int recPerCycle = 0;
+ private int recordedSoFar = 0;
+ private String localParty = "";
+ private String remoteParty = "";
+ private int keepForHours = 0;
+ private OrkUser targetUser;
+ private OrkPort targetPort;
+
+ //private Set RecSegments;
+ private Collection recSegments;
+
+ /**
+ * @hibernate.set
+ * lazy="true"
+ * table="PrgToSeg"
+ * @hibernate.collection-key
+ * column="RecProgram"
+ * @hibernate.collection-many-to-many
+ * column="RecSegment"
+ * class="net.sf.oreka.persistent.RecSegment"
+ * @return Returns the recSegments.
+ */
+ @ManyToMany
+// (
+// targetEntity="net.sf.oreka.persistent.RecSegment"
+// )
+ @JoinTable(
+ name="orkprogtoseg",
+ joinColumns={@JoinColumn(name="progId")},
+ inverseJoinColumns={@JoinColumn(name="segId")}
+ )
+ public Collection getRecSegments() {
+ return recSegments;
+ }
+
+
+ /**
+ * @param recSegments The recSegments to set.
+ */
+ public void setRecSegments(Collection recSegments) {
+ this.recSegments = recSegments;
+ }
+
+
+ public OrkProgram () {
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+ try {
+ startTime = sdf.parse("00:00:00");
+ stopTime = sdf.parse("00:00:00");
+ }
+ catch (Exception e) {;}
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the active.
+ */
+ public boolean isActive() {
+ return active;
+ }
+
+
+ /**
+ * @param active The active to set.
+ */
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the cycle.
+ */
+ public Cycle getCycle() {
+ return cycle;
+ }
+
+
+ /**
+ * @param cycle The cycle to set.
+ */
+ public void setCycle(Cycle cycle) {
+ this.cycle = cycle;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the description.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+
+ /**
+ * @param description The description to set.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the direction.
+ */
+ public Direction getDirection() {
+ return direction;
+ }
+
+
+ /**
+ * @param direction The direction to set.
+ */
+ public void setDirection(Direction direction) {
+ this.direction = direction;
+ }
+
+
+ /**
+ * @return Returns the discarded.
+ */
+ public boolean isDiscarded() {
+ return discarded;
+ }
+
+
+ /**
+ * @param discarded The discarded to set.
+ */
+ public void setDiscarded(boolean discarded) {
+ this.discarded = discarded;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the keepForHours.
+ */
+ public int getKeepForHours() {
+ return keepForHours;
+ }
+
+
+ /**
+ * @param keepForHours The keepForHours to set.
+ */
+ public void setKeepForHours(int keepForHours) {
+ this.keepForHours = keepForHours;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the localParty.
+ */
+ public String getLocalParty() {
+ return localParty;
+ }
+
+
+ /**
+ * @param localParty The localParty to set.
+ */
+ public void setLocalParty(String localParty) {
+ this.localParty = localParty;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the maxDuration.
+ */
+ public int getMaxDuration() {
+ return maxDuration;
+ }
+
+
+ /**
+ * @param maxDuration The maxDuration to set.
+ */
+ public void setMaxDuration(int maxDuration) {
+ this.maxDuration = maxDuration;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the minDuration.
+ */
+ public int getMinDuration() {
+ return minDuration;
+ }
+
+
+ /**
+ * @param minDuration The minDuration to set.
+ */
+ public void setMinDuration(int minDuration) {
+ this.minDuration = minDuration;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the randomPercent.
+ */
+ public double getRandomPercent() {
+ return randomPercent;
+ }
+
+
+ /**
+ * @param randomPercent The randomPercent to set.
+ */
+ public void setRandomPercent(double randomPercent) {
+ this.randomPercent = randomPercent;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the recordedSoFar.
+ */
+ public int getRecordedSoFar() {
+ return recordedSoFar;
+ }
+
+
+ /**
+ * @param recordedSoFar The recordedSoFar to set.
+ */
+ public void setRecordedSoFar(int recordedSoFar) {
+ this.recordedSoFar = recordedSoFar;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the recPerCycle.
+ */
+ public int getRecPerCycle() {
+ return recPerCycle;
+ }
+
+
+ /**
+ * @param recPerCycle The recPerCycle to set.
+ */
+ public void setRecPerCycle(int recPerCycle) {
+ this.recPerCycle = recPerCycle;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the remoteParty.
+ */
+ public String getRemoteParty() {
+ return remoteParty;
+ }
+
+
+ /**
+ * @param remoteParty The remoteParty to set.
+ */
+ public void setRemoteParty(String remoteParty) {
+ this.remoteParty = remoteParty;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the startTime.
+ */
+ public Date getStartTime() {
+ return startTime;
+ }
+
+
+ /**
+ * @param startTime The startTime to set.
+ */
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+
+
+ public Day getStartDay() {
+ return startDay;
+ }
+
+
+
+ public void setStartDay(Day startDay) {
+ this.startDay = startDay;
+ }
+
+
+
+ public Day getStopDay() {
+ return stopDay;
+ }
+
+
+
+ public void setStopDay(Day stopDay) {
+ this.stopDay = stopDay;
+ }
+
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the stopTime.
+ */
+ public Date getStopTime() {
+ return stopTime;
+ }
+
+
+ /**
+ * @param stopTime The stopTime to set.
+ */
+ public void setStopTime(Date stopTime) {
+ this.stopTime = stopTime;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the targetPort.
+ */
+ @ManyToOne
+ public OrkPort getTargetPort() {
+ return targetPort;
+ }
+
+
+ /**
+ * @param targetPort The targetPort to set.
+ */
+ public void setTargetPort(OrkPort targetPort) {
+ this.targetPort = targetPort;
+ }
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the targetUser.
+ */
+ @ManyToOne
+ public OrkUser getTargetUser() {
+ return targetUser;
+ }
+
+
+
+ /**
+ * @param targetUser The targetUser to set.
+ */
+ public void setTargetUser(OrkUser targetUser) {
+ this.targetUser = targetUser;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the timestamp.
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+
+ /**
+ * @param timestamp The timestamp to set.
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the owner.
+ */
+ @ManyToOne
+ public OrkUser getCreator() {
+ return creator;
+ }
+
+
+
+ /**
+ * @param owner The owner to set.
+ */
+ public void setCreator(OrkUser creator) {
+ this.creator = creator;
+ }
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkSegment.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkSegment.java
similarity index 94%
rename from orkbasej/java/net/sf/oreka/persistent/OrkSegment.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkSegment.java
index b1a02eb2..e22043da 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkSegment.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkSegment.java
@@ -1,335 +1,335 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import net.sf.oreka.Direction;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orksegment")
-public class OrkSegment implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private OrkSession session;
- private long sessionOffset;
- private OrkTape tape;
- private long tapeOffset;
- private Date timestamp = new Date(0);
- private long duration;
- private String localParty = "";
- private String localEntryPoint = "";
- private String remoteParty = "";
- private Direction direction;
- private OrkUser user;
- private String loginString = "";
- private OrkPort port;
- private String portName;
- //private java.util.Set RecPrograms;
- private Collection recPrograms;
-
- public OrkSegment() {
- direction = Direction.UNKN;
- recPrograms = new ArrayList();
- }
-
- /**
- * @hibernate.property
- *
- * @hibernate.column
- * name="direction"
- * index="direction"
- * not-null="true"
- * @return Returns the direction.
- */
- public Direction getDirection() {
- return direction;
- }
-
- /**
- * @param direction The direction to set.
- */
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the duration.
- */
- public long getDuration() {
- return duration;
- }
-
- /**
- * @param duration The duration to set.
- */
- public void setDuration(long duration) {
- this.duration = duration;
- }
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @hibernate.collection-many-to-many
- * column="RecSegmentId"
- * class="RecProgram"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
- /**
- * @hibernate.property
- *
- * @hibernate.column
- * name="localParty"
- * index="localParty"
- * not-null="true"
- *
- * @return Returns the localParty.
- */
- public String getLocalParty() {
- return localParty;
- }
-
- /**
- * @param localParty The localParty to set.
- */
- public void setLocalParty(String localParty) {
- this.localParty = localParty;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the loginString.
- */
- public String getLoginString() {
- return loginString;
- }
-
- /**
- * @param loginString The loginString to set.
- */
- public void setLoginString(String loginString) {
- this.loginString = loginString;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the remoteParty.
- */
- public String getRemoteParty() {
- return remoteParty;
- }
-
- /**
- * @param remoteParty The remoteParty to set.
- */
- public void setRemoteParty(String remoteParty) {
- this.remoteParty = remoteParty;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the RecTapeOffset.
- */
- public long getTapeOffset() {
- return tapeOffset;
- }
-
- /**
- * @param RecTapeOffset The RecTapeOffset to set.
- */
- public void setTapeOffset(long recTapeOffset) {
- this.tapeOffset = recTapeOffset;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the timestamp.
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
- /**
- * @param timestamp The timestamp to set.
- */
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * @hibernate.many-to-one
- * @return Returns the RecSession.
- */
- @ManyToOne
- public OrkSession getSession() {
- return session;
- }
-
- /**
- * @param OrkSession The RecSession to set.
- */
- public void setSession(OrkSession recSession) {
- this.session = recSession;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the RecSessionOffset.
- */
- public long getSessionOffset() {
- return sessionOffset;
- }
-
- /**
- * @param RecSessionOffset The RecSessionOffset to set.
- */
- public void setSessionOffset(long recSessionOffset) {
- this.sessionOffset = recSessionOffset;
- }
-
- /**
- * @hibernate.many-to-one
- * @return Returns the recTape.
- */
- @ManyToOne
- public OrkTape getTape() {
- return tape;
- }
-
-
- /**
- * @param recTape The recTape to set.
- */
- public void setTape(OrkTape recTape) {
- this.tape = recTape;
- }
-
- /**
- * @hibernate.set
- * lazy="true"
- * table="PrgToSeg"
- * @hibernate.collection-key
- * column="RecSegment"
- * @hibernate.collection-many-to-many
- * column="RecProgram"
- * class="net.sf.oreka.persistent.RecProgram"
- * @return Returns the recPrograms.
- */
- @ManyToMany
- @JoinTable(
- name="orkprogtoseg",
- joinColumns={@JoinColumn(name="segId")},
- inverseJoinColumns={@JoinColumn(name="progId")}
- )
- public Collection getRecPrograms() {
- return recPrograms;
- }
-
-
- /**
- * @param recPrograms The recPrograms to set.
- */
- public void setRecPrograms(Collection recPrograms) {
- this.recPrograms = recPrograms;
- }
-
- /**
- * @hibernate.many-to-one
- * @return Returns the user.
- */
- @ManyToOne
- public OrkUser getUser() {
- return user;
- }
-
-
- /**
- * @param user The user to set.
- */
- public void setUser(OrkUser user) {
- this.user = user;
- }
-
- public String getLocalEntryPoint() {
- return localEntryPoint;
- }
-
- public void setLocalEntryPoint(String localEntryPoint) {
- this.localEntryPoint = localEntryPoint;
- }
-
- @Transient
- public long getStopTime() {
- return timestamp.getTime() + duration;
- }
-
- @ManyToOne
- public OrkPort getPort() {
- return port;
- }
-
- public void setPort(OrkPort port) {
- this.port = port;
- }
-
- public String getPortName() {
- return portName;
- }
-
-
- public void setPortName(String recPortName) {
- this.portName = recPortName;
- }
-
-
-
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import net.sf.oreka.Direction;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orksegment")
+public class OrkSegment implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private OrkSession session;
+ private long sessionOffset;
+ private OrkTape tape;
+ private long tapeOffset;
+ private Date timestamp = new Date(0);
+ private long duration;
+ private String localParty = "";
+ private String localEntryPoint = "";
+ private String remoteParty = "";
+ private Direction direction;
+ private OrkUser user;
+ private String loginString = "";
+ private OrkPort port;
+ private String portName;
+ //private java.util.Set RecPrograms;
+ private Collection recPrograms;
+
+ public OrkSegment() {
+ direction = Direction.UNKN;
+ recPrograms = new ArrayList();
+ }
+
+ /**
+ * @hibernate.property
+ *
+ * @hibernate.column
+ * name="direction"
+ * index="direction"
+ * not-null="true"
+ * @return Returns the direction.
+ */
+ public Direction getDirection() {
+ return direction;
+ }
+
+ /**
+ * @param direction The direction to set.
+ */
+ public void setDirection(Direction direction) {
+ this.direction = direction;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the duration.
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ /**
+ * @param duration The duration to set.
+ */
+ public void setDuration(long duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @hibernate.collection-many-to-many
+ * column="RecSegmentId"
+ * class="RecProgram"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @hibernate.property
+ *
+ * @hibernate.column
+ * name="localParty"
+ * index="localParty"
+ * not-null="true"
+ *
+ * @return Returns the localParty.
+ */
+ public String getLocalParty() {
+ return localParty;
+ }
+
+ /**
+ * @param localParty The localParty to set.
+ */
+ public void setLocalParty(String localParty) {
+ this.localParty = localParty;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the loginString.
+ */
+ public String getLoginString() {
+ return loginString;
+ }
+
+ /**
+ * @param loginString The loginString to set.
+ */
+ public void setLoginString(String loginString) {
+ this.loginString = loginString;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the remoteParty.
+ */
+ public String getRemoteParty() {
+ return remoteParty;
+ }
+
+ /**
+ * @param remoteParty The remoteParty to set.
+ */
+ public void setRemoteParty(String remoteParty) {
+ this.remoteParty = remoteParty;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the RecTapeOffset.
+ */
+ public long getTapeOffset() {
+ return tapeOffset;
+ }
+
+ /**
+ * @param RecTapeOffset The RecTapeOffset to set.
+ */
+ public void setTapeOffset(long recTapeOffset) {
+ this.tapeOffset = recTapeOffset;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the timestamp.
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * @param timestamp The timestamp to set.
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the RecSession.
+ */
+ @ManyToOne
+ public OrkSession getSession() {
+ return session;
+ }
+
+ /**
+ * @param OrkSession The RecSession to set.
+ */
+ public void setSession(OrkSession recSession) {
+ this.session = recSession;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the RecSessionOffset.
+ */
+ public long getSessionOffset() {
+ return sessionOffset;
+ }
+
+ /**
+ * @param RecSessionOffset The RecSessionOffset to set.
+ */
+ public void setSessionOffset(long recSessionOffset) {
+ this.sessionOffset = recSessionOffset;
+ }
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the recTape.
+ */
+ @ManyToOne
+ public OrkTape getTape() {
+ return tape;
+ }
+
+
+ /**
+ * @param recTape The recTape to set.
+ */
+ public void setTape(OrkTape recTape) {
+ this.tape = recTape;
+ }
+
+ /**
+ * @hibernate.set
+ * lazy="true"
+ * table="PrgToSeg"
+ * @hibernate.collection-key
+ * column="RecSegment"
+ * @hibernate.collection-many-to-many
+ * column="RecProgram"
+ * class="net.sf.oreka.persistent.RecProgram"
+ * @return Returns the recPrograms.
+ */
+ @ManyToMany
+ @JoinTable(
+ name="orkprogtoseg",
+ joinColumns={@JoinColumn(name="segId")},
+ inverseJoinColumns={@JoinColumn(name="progId")}
+ )
+ public Collection getRecPrograms() {
+ return recPrograms;
+ }
+
+
+ /**
+ * @param recPrograms The recPrograms to set.
+ */
+ public void setRecPrograms(Collection recPrograms) {
+ this.recPrograms = recPrograms;
+ }
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the user.
+ */
+ @ManyToOne
+ public OrkUser getUser() {
+ return user;
+ }
+
+
+ /**
+ * @param user The user to set.
+ */
+ public void setUser(OrkUser user) {
+ this.user = user;
+ }
+
+ public String getLocalEntryPoint() {
+ return localEntryPoint;
+ }
+
+ public void setLocalEntryPoint(String localEntryPoint) {
+ this.localEntryPoint = localEntryPoint;
+ }
+
+ @Transient
+ public long getStopTime() {
+ return timestamp.getTime() + duration;
+ }
+
+ @ManyToOne
+ public OrkPort getPort() {
+ return port;
+ }
+
+ public void setPort(OrkPort port) {
+ this.port = port;
+ }
+
+ public String getPortName() {
+ return portName;
+ }
+
+
+ public void setPortName(String recPortName) {
+ this.portName = recPortName;
+ }
+
+
+
+
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkService.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkService.java
similarity index 94%
rename from orkbasej/java/net/sf/oreka/persistent/OrkService.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkService.java
index 48ceffcc..7a7ab287 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkService.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkService.java
@@ -1,217 +1,219 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/**
- *
- */
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import net.sf.oreka.ServiceClass;
-import net.sf.oreka.util.TomcatServerXMLParser;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orkservice")
-public class OrkService implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private String name = "";
- private String hostname = "";
- private int tcpPort = 0;
- private String fileServeProtocol = "";
- private int fileServeTcpPort = 0;
- private String fileServePath = "";
- private ServiceClass serviceClass;
- private boolean recordMaster = false;
- private String contextPath = "";
-
- /**
- *
- */
- public OrkService() {
- serviceClass = ServiceClass.UNKN;
- contextPath = TomcatServerXMLParser.getAudioContextPath();
- }
-
- /**
- *
- * @hibernate.property
- * not-null="true"
- * @return Returns the fileServePath.
- */
- public String getFileServePath() {
- if (fileServePath==null)
- fileServePath="";
- return fileServePath;
- }
-
-
- /**
- * @param fileServePath The fileServePath to set.
- */
- public void setFileServePath(String fileServePath) {
- this.fileServePath = fileServePath;
- }
-
- public int getFileServeTcpPort() {
- return fileServeTcpPort;
- }
-
- public void setFileServeTcpPort(int fileServeTcpPort) {
- this.fileServeTcpPort = fileServeTcpPort;
- }
-
- public int getTcpPort() {
- return tcpPort;
- }
-
- public void setTcpPort(int tcpPort) {
- this.tcpPort = tcpPort;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the fileServeProtocol.
- */
- public String getFileServeProtocol() {
- return fileServeProtocol;
- }
-
-
- /**
- * @param fileServeProtocol The fileServeProtocol to set.
- */
- public void setFileServeProtocol(String fileServeProtocol) {
- this.fileServeProtocol = fileServeProtocol;
- }
-
-
- /**
- * @hibernate.property
- * unique="true"
- * not-null="true"
- * @return Returns the gUID.
- */
- public String getName() {
- return name;
- }
-
-
- /**
- * @param name The name to set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the hostname.
- */
- public String getHostname() {
- return hostname;
- }
-
-
- /**
- * @param hostname The hostname to set.
- */
- public void setHostname(String hostname) {
- this.hostname = hostname;
- }
-
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
- public ServiceClass getServiceClass() {
- return serviceClass;
- }
-
- public void setServiceClass(ServiceClass serviceClass) {
- this.serviceClass = serviceClass;
- }
-
- public boolean isRecordMaster() {
- return recordMaster;
- }
-
- public void setRecordMaster(boolean cdrMaster) {
- this.recordMaster = cdrMaster;
- }
-
- public String getContextPath() {
- if (contextPath==null)
- contextPath="";
- return contextPath;
- }
-
- public void setContextPath(String contextPath) {
- this.contextPath = contextPath;
- }
-
- @Transient
- public String getContextPathWithPrefix() {
-
- String contextPathWithPrefix = getContextPath();
-
- // Add / prefix if non-existent
- if (contextPathWithPrefix.trim().length()!=0 && !contextPathWithPrefix.startsWith("/"))
- contextPathWithPrefix = "/" + contextPathWithPrefix;
-
- return contextPathWithPrefix;
- }
-
- @Transient
- public String getFileServePathWithPrefix() {
-
- String fileServePathWithPrefix = getFileServePath();
-
- // Add / prefix if non-existent
- if (fileServePathWithPrefix.trim().length()!=0 && !fileServePathWithPrefix.startsWith("/"))
- fileServePathWithPrefix = "/" + fileServePathWithPrefix;
-
- return fileServePathWithPrefix;
- }
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+/**
+ *
+ */
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import lombok.ToString;
+import net.sf.oreka.ServiceClass;
+import net.sf.oreka.util.TomcatServerXMLParser;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orkservice")
+@ToString
+public class OrkService implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private String name = "";
+ private String hostname = "";
+ private int tcpPort = 0;
+ private String fileServeProtocol = "";
+ private int fileServeTcpPort = 0;
+ private String fileServePath = "";
+ private ServiceClass serviceClass;
+ private boolean recordMaster = false;
+ private String contextPath = "";
+
+ /**
+ *
+ */
+ public OrkService() {
+ serviceClass = ServiceClass.UNKN;
+ contextPath = TomcatServerXMLParser.getAudioContextPath();
+ }
+
+ /**
+ *
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the fileServePath.
+ */
+ public String getFileServePath() {
+ if (fileServePath==null)
+ fileServePath="";
+ return fileServePath;
+ }
+
+
+ /**
+ * @param fileServePath The fileServePath to set.
+ */
+ public void setFileServePath(String fileServePath) {
+ this.fileServePath = fileServePath;
+ }
+
+ public int getFileServeTcpPort() {
+ return fileServeTcpPort;
+ }
+
+ public void setFileServeTcpPort(int fileServeTcpPort) {
+ this.fileServeTcpPort = fileServeTcpPort;
+ }
+
+ public int getTcpPort() {
+ return tcpPort;
+ }
+
+ public void setTcpPort(int tcpPort) {
+ this.tcpPort = tcpPort;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the fileServeProtocol.
+ */
+ public String getFileServeProtocol() {
+ return fileServeProtocol;
+ }
+
+
+ /**
+ * @param fileServeProtocol The fileServeProtocol to set.
+ */
+ public void setFileServeProtocol(String fileServeProtocol) {
+ this.fileServeProtocol = fileServeProtocol;
+ }
+
+
+ /**
+ * @hibernate.property
+ * unique="true"
+ * not-null="true"
+ * @return Returns the gUID.
+ */
+ public String getName() {
+ return name;
+ }
+
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the hostname.
+ */
+ public String getHostname() {
+ return hostname;
+ }
+
+
+ /**
+ * @param hostname The hostname to set.
+ */
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public ServiceClass getServiceClass() {
+ return serviceClass;
+ }
+
+ public void setServiceClass(ServiceClass serviceClass) {
+ this.serviceClass = serviceClass;
+ }
+
+ public boolean isRecordMaster() {
+ return recordMaster;
+ }
+
+ public void setRecordMaster(boolean cdrMaster) {
+ this.recordMaster = cdrMaster;
+ }
+
+ public String getContextPath() {
+ if (contextPath==null)
+ contextPath="";
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ @Transient
+ public String getContextPathWithPrefix() {
+
+ String contextPathWithPrefix = getContextPath();
+
+ // Add / prefix if non-existent
+ if (contextPathWithPrefix.trim().length()!=0 && !contextPathWithPrefix.startsWith("/"))
+ contextPathWithPrefix = "/" + contextPathWithPrefix;
+
+ return contextPathWithPrefix;
+ }
+
+ @Transient
+ public String getFileServePathWithPrefix() {
+
+ String fileServePathWithPrefix = getFileServePath();
+
+ // Add / prefix if non-existent
+ if (fileServePathWithPrefix.trim().length()!=0 && !fileServePathWithPrefix.startsWith("/"))
+ fileServePathWithPrefix = "/" + fileServePathWithPrefix;
+
+ return fileServePathWithPrefix;
+ }
+
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkSession.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkSession.java
similarity index 91%
rename from orkbasej/java/net/sf/oreka/persistent/OrkSession.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkSession.java
index 9dfc8ce2..30c9581e 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkSession.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkSession.java
@@ -1,85 +1,85 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orksession")
-public class OrkSession implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private Date timestamp = new Date(0);
- private long duration;
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return
- */
- public long getDuration() {
- return duration;
- }
-
- public void setDuration(long duration) {
- this.duration = duration;
- }
-
- /**
- * @hibernate.id
- * generator-class="native"
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- public void setId(int id) {
- this.id = id;
- }
-
- /**
- * @hibernate.property
- * @return
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- @Transient
- public long getStopTime() {
- return timestamp.getTime() + duration;
- }
-
- public void setStopTime(long stopTime) {
- duration = stopTime - timestamp.getTime();
- }
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orksession")
+public class OrkSession implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id;
+ private Date timestamp = new Date(0);
+ private long duration;
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ public void setDuration(long duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @hibernate.property
+ * @return
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ @Transient
+ public long getStopTime() {
+ return timestamp.getTime() + duration;
+ }
+
+ public void setStopTime(long stopTime) {
+ duration = stopTime - timestamp.getTime();
+ }
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkTape.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkTape.java
similarity index 87%
rename from orkbasej/java/net/sf/oreka/persistent/OrkTape.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkTape.java
index 17466310..8b1d566c 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkTape.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkTape.java
@@ -1,264 +1,283 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import net.sf.oreka.Direction;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orktape")
-public class OrkTape implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id;
- private Date timestamp = new Date(0);
- private long duration;
- private String filename = "";
- private OrkService service;
- private String localParty = "";
- private String localEntryPoint = "";
- private String remoteParty = "";
- private Direction direction;
- private OrkPort port;
- private String portName;
- private Date expiryTimestamp = new Date(0);
-
- public OrkTape()
- {
- // Defaults
- direction = Direction.UNKN;
- }
-
- /**
- * @hibernate.property
- * @hibernate.column
- * name="direction"
- * index="direction"
- * not-null="true"
- * @return Returns the direction.
- */
- public Direction getDirection() {
- return direction;
- }
-
- /**
- * @param direction The direction to set.
- */
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the duration.
- */
- public long getDuration() {
- return duration;
- }
-
- /**
- * @param duration The duration to set.
- */
- public void setDuration(long duration) {
- this.duration = duration;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the expiryTimestamp.
- */
- public Date getExpiryTimestamp() {
- return expiryTimestamp;
- }
-
- /**
- * @param expiryTimestamp The expiryTimestamp to set.
- */
- public void setExpiryTimestamp(Date expiryTimestamp) {
- this.expiryTimestamp = expiryTimestamp;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the filename.
- */
- public String getFilename() {
- return filename;
- }
-
- /**
- * @param filename The filename to set.
- */
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the localParty.
- */
- public String getLocalParty() {
- return localParty;
- }
-
- /**
- * @param localParty The localParty to set.
- */
- public void setLocalParty(String localParty) {
- this.localParty = localParty;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the port.
- */
- @ManyToOne
- public OrkPort getPort() {
- return port;
- }
-
- /**
- * @param port The port to set.
- */
- public void setPort(OrkPort port) {
- this.port = port;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the remoteParty.
- */
- public String getRemoteParty() {
- return remoteParty;
- }
-
- /**
- * @param remoteParty The remoteParty to set.
- */
- public void setRemoteParty(String remoteParty) {
- this.remoteParty = remoteParty;
- }
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the timestamp.
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
- /**
- * @param timestamp The timestamp to set.
- */
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * @hibernate.many-to-one
- * @return Returns the service.
- */
- @ManyToOne
- public OrkService getService() {
- return service;
- }
-
-
- /**
- * @param server The service to set.
- */
- public void setService(OrkService service) {
- this.service = service;
- }
-
- public String getLocalEntryPoint() {
- return localEntryPoint;
- }
-
- public void setLocalEntryPoint(String localEntryPoint) {
- this.localEntryPoint = localEntryPoint;
- }
-
- @Transient
- public long getStopTime() {
- return timestamp.getTime() + duration;
- }
-
- @Transient
- public String getUrl() {
-
- if(service != null) {
- return service.getFileServeProtocol() + "://" +
- service.getHostname() + ":" + service.getFileServeTcpPort() +
- service.getContextPathWithPrefix() + service.getFileServePathWithPrefix() + "/" + filename;
- }
- else {
- return "";
- }
- }
-
- @Transient
- public String getPlayUrl() {
-
- return "javascript:play('" + getUrl() + "')";
- }
-
- public String getPortName() {
- return portName;
- }
-
-
- public void setPortName(String recPortName) {
- this.portName = recPortName;
- }
-
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.ToString;
+import net.sf.oreka.Direction;
+import javax.persistence.*;
+
+@Entity
+@Table(name = "orktape", indexes = {
+ @Index(columnList = "timestamp,portName", name = "timestamp_portName_idx"),
+ @Index(columnList = "nativeCallId", name = "nativeCallId")
+})
+@ToString
+public class OrkTape implements Serializable {
+
+ static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ private Date timestamp = new Date(0);
+ private long duration;
+ private String filename = "";
+
+ @ManyToOne
+ private OrkService service;
+
+ private String localParty = "";
+ private String localEntryPoint = "";
+ private String remoteParty = "";
+ private Direction direction;
+
+ @ManyToOne
+ private OrkPort port;
+
+ private String portName;
+ private Date expiryTimestamp = new Date(0);
+
+ private String nativeCallId;
+ private String state;
+
+ public OrkTape()
+ {
+ // Defaults
+ direction = Direction.UNKN;
+ }
+
+ /**
+ * @hibernate.property
+ * @hibernate.column
+ * name="direction"
+ * index="direction"
+ * not-null="true"
+ * @return Returns the direction.
+ */
+ public Direction getDirection() {
+ return direction;
+ }
+
+ /**
+ * @param direction The direction to set.
+ */
+ public void setDirection(Direction direction) {
+ this.direction = direction;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the duration.
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ /**
+ * @param duration The duration to set.
+ */
+ public void setDuration(long duration) {
+ this.duration = duration;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the expiryTimestamp.
+ */
+ public Date getExpiryTimestamp() {
+ return expiryTimestamp;
+ }
+
+ /**
+ * @param expiryTimestamp The expiryTimestamp to set.
+ */
+ public void setExpiryTimestamp(Date expiryTimestamp) {
+ this.expiryTimestamp = expiryTimestamp;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the filename.
+ */
+ public String getFilename() {
+ return filename;
+ }
+
+ /**
+ * @param filename The filename to set.
+ */
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the localParty.
+ */
+ public String getLocalParty() {
+ return localParty;
+ }
+
+ /**
+ * @param localParty The localParty to set.
+ */
+ public void setLocalParty(String localParty) {
+ this.localParty = localParty;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the port.
+ */
+ public OrkPort getPort() {
+ return port;
+ }
+
+ /**
+ * @param port The port to set.
+ */
+ public void setPort(OrkPort port) {
+ this.port = port;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the remoteParty.
+ */
+ public String getRemoteParty() {
+ return remoteParty;
+ }
+
+ /**
+ * @param remoteParty The remoteParty to set.
+ */
+ public void setRemoteParty(String remoteParty) {
+ this.remoteParty = remoteParty;
+ }
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the timestamp.
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * @param timestamp The timestamp to set.
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * @hibernate.many-to-one
+ * @return Returns the service.
+ */
+ public OrkService getService() {
+ return service;
+ }
+
+
+ /**
+ * @param server The service to set.
+ */
+ public void setService(OrkService service) {
+ this.service = service;
+ }
+
+ public String getLocalEntryPoint() {
+ return localEntryPoint;
+ }
+
+ public void setLocalEntryPoint(String localEntryPoint) {
+ this.localEntryPoint = localEntryPoint;
+ }
+
+ @Transient
+ public long getStopTime() {
+ return timestamp.getTime() + duration;
+ }
+
+ @Transient
+ public String getUrl() {
+
+ if(service != null) {
+ return service.getFileServeProtocol() + "://" +
+ service.getHostname() + ":" + service.getFileServeTcpPort() +
+ service.getContextPathWithPrefix() + service.getFileServePathWithPrefix() + "/" + filename;
+ }
+ else {
+ return "";
+ }
+ }
+
+ @Transient
+ public String getPlayUrl() {
+ return "javascript:play('" + getUrl() + "')";
+ }
+
+ public String getPortName() {
+ return portName;
+ }
+
+ public void setPortName(String recPortName) {
+ this.portName = recPortName;
+ }
+
+ public String getNativeCallId() {
+ return nativeCallId;
+ }
+
+ public void setNativeCallId(String nativeCallId) {
+ this.nativeCallId = nativeCallId;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+}
diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkUser.java b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkUser.java
similarity index 92%
rename from orkbasej/java/net/sf/oreka/persistent/OrkUser.java
rename to orkbasej/src/main/java/net/sf/oreka/persistent/OrkUser.java
index 159b2a78..f342d521 100644
--- a/orkbasej/java/net/sf/oreka/persistent/OrkUser.java
+++ b/orkbasej/src/main/java/net/sf/oreka/persistent/OrkUser.java
@@ -1,207 +1,207 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-/**
- *
- */
-package net.sf.oreka.persistent;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * @hibernate.class
- */
-@Entity
-@Table(name = "orkuser")
-public class OrkUser implements Serializable {
-
- static final long serialVersionUID = 1l;
- private int id = 0;
- private String password = "";
- private String firstname = "";
- private String lastname = "";
- private String email = "";
- private boolean deleted = false;
- private boolean disabled = false;
- private Date dateCreated = new Date(0);
- private Date dateDisabled = new Date(0);
- private Date dateDeleted = new Date(0);
-
- //private Set loginStrings;
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the email.
- */
- public String getEmail() {
- return email;
- }
-
-
- /**
- * @param email The email to set.
- */
- public void setEmail(String email) {
- this.email = email;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the firstname.
- */
- public String getFirstname() {
- return firstname;
- }
-
-
- /**
- * @param firstname The firstname to set.
- */
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
-
- /**
- * @hibernate.id
- * generator-class="native"
- * @return Returns the id.
- */
- @Id @GeneratedValue(strategy=GenerationType.AUTO)
- public int getId() {
- return id;
- }
-
-
- /**
- * @param id The id to set.
- */
- public void setId(int id) {
- this.id = id;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the lastname.
- */
- public String getLastname() {
- return lastname;
- }
-
-
- /**
- * @param lastname The lastname to set.
- */
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
-
- /**
- * @hibernate.property
- * not-null="true"
- * @return Returns the password.
- */
- public String getPassword() {
- return password;
- }
-
-
- /**
- * @param password The password to set.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
-
- /**
- *
- */
- public OrkUser() {
- //loginStrings = new HashSet();
- }
-
- public Date getDateCreated() {
- return dateCreated;
- }
-
-
-
- public void setDateCreated(Date dateCreated) {
- this.dateCreated = dateCreated;
- }
-
-
-
- public Date getDateDeleted() {
- return dateDeleted;
- }
-
-
-
- public void setDateDeleted(Date dateDeleted) {
- this.dateDeleted = dateDeleted;
- }
-
-
-
- public Date getDateDisabled() {
- return dateDisabled;
- }
-
-
-
- public void setDateDisabled(Date dateDisabled) {
- this.dateDisabled = dateDisabled;
- }
-
-
-
- public boolean isDeleted() {
- return deleted;
- }
-
-
-
- public void setDeleted(boolean deleted) {
- this.deleted = deleted;
- }
-
-
-
- public boolean isDisabled() {
- return disabled;
- }
-
-
-
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
-
-
-
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+/**
+ *
+ */
+package net.sf.oreka.persistent;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @hibernate.class
+ */
+@Entity
+@Table(name = "orkuser")
+public class OrkUser implements Serializable {
+
+ static final long serialVersionUID = 1l;
+ private int id = 0;
+ private String password = "";
+ private String firstname = "";
+ private String lastname = "";
+ private String email = "";
+ private boolean deleted = false;
+ private boolean disabled = false;
+ private Date dateCreated = new Date(0);
+ private Date dateDisabled = new Date(0);
+ private Date dateDeleted = new Date(0);
+
+ //private Set loginStrings;
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the email.
+ */
+ public String getEmail() {
+ return email;
+ }
+
+
+ /**
+ * @param email The email to set.
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the firstname.
+ */
+ public String getFirstname() {
+ return firstname;
+ }
+
+
+ /**
+ * @param firstname The firstname to set.
+ */
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+
+ /**
+ * @hibernate.id
+ * generator-class="native"
+ * @return Returns the id.
+ */
+ @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ public int getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id The id to set.
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the lastname.
+ */
+ public String getLastname() {
+ return lastname;
+ }
+
+
+ /**
+ * @param lastname The lastname to set.
+ */
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+
+ /**
+ * @hibernate.property
+ * not-null="true"
+ * @return Returns the password.
+ */
+ public String getPassword() {
+ return password;
+ }
+
+
+ /**
+ * @param password The password to set.
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+ /**
+ *
+ */
+ public OrkUser() {
+ //loginStrings = new HashSet();
+ }
+
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+
+
+ public void setDateCreated(Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
+
+
+ public Date getDateDeleted() {
+ return dateDeleted;
+ }
+
+
+
+ public void setDateDeleted(Date dateDeleted) {
+ this.dateDeleted = dateDeleted;
+ }
+
+
+
+ public Date getDateDisabled() {
+ return dateDisabled;
+ }
+
+
+
+ public void setDateDisabled(Date dateDisabled) {
+ this.dateDisabled = dateDisabled;
+ }
+
+
+
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+
+
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+
+
+
+}
diff --git a/orkbasej/java/net/sf/oreka/serializers/DomSerializer.java b/orkbasej/src/main/java/net/sf/oreka/serializers/DomSerializer.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/DomSerializer.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/DomSerializer.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/KeyValueSerializer.java b/orkbasej/src/main/java/net/sf/oreka/serializers/KeyValueSerializer.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/KeyValueSerializer.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/KeyValueSerializer.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/OrkSerializer.java b/orkbasej/src/main/java/net/sf/oreka/serializers/OrkSerializer.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/OrkSerializer.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/OrkSerializer.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/ServletRequestSerializer.java b/orkbasej/src/main/java/net/sf/oreka/serializers/ServletRequestSerializer.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/ServletRequestSerializer.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/ServletRequestSerializer.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/SingleLineSerializer.java b/orkbasej/src/main/java/net/sf/oreka/serializers/SingleLineSerializer.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/SingleLineSerializer.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/SingleLineSerializer.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/DomSerializerTest.java b/orkbasej/src/main/java/net/sf/oreka/serializers/test/DomSerializerTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/test/DomSerializerTest.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/DomSerializerTest.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java b/orkbasej/src/main/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java
similarity index 76%
rename from orkbasej/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java
index 71cb22f7..088ae2a2 100644
--- a/orkbasej/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java
+++ b/orkbasej/src/main/java/net/sf/oreka/serializers/test/NullHttpServletRequest.java
@@ -17,16 +17,10 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
+import javax.servlet.*;
+import javax.servlet.http.*;
public class NullHttpServletRequest implements HttpServletRequest
{
@@ -62,7 +56,37 @@ public Enumeration getParameterNames(){
public boolean isRequestedSessionIdValid(){return false;}
public boolean isRequestedSessionIdFromCookie(){return false;}
public boolean isRequestedSessionIdFromUrl(){return false;}
+
+ public boolean authenticate(HttpServletResponse httpServletResponse) throws IOException, ServletException {
+ return false;
+ }
+
+ public void login(String s, String s1) throws ServletException {
+
+ }
+
+ public void logout() throws ServletException {
+
+ }
+
+ public Collection getParts() throws IOException, ServletException {
+ return null;
+ }
+
+ public Part getPart(String s) throws IOException, ServletException {
+ return null;
+ }
+
+ public T upgrade(Class aClass) throws IOException, ServletException {
+ return null;
+ }
+
public int getContentLength(){return 0;}
+
+ public long getContentLengthLong() {
+ return 0;
+ }
+
public String getContentType(){return null;}
public String getProtocol(){return null;}
public String getScheme(){return null;}
@@ -76,6 +100,11 @@ public Enumeration getParameterNames(){
public Enumeration getAttributeNames(){return null;}
public Object getAttribute(String name){return null;}
public HttpSession getSession(){return null;}
+
+ public String changeSessionId() {
+ return null;
+ }
+
public BufferedReader getReader() throws IOException{return null;}
public String getCharacterEncoding(){return null;}
public void setAttribute(String name, Object o) {}
@@ -131,6 +160,34 @@ public int getLocalPort() {
return 0;
}
+ public ServletContext getServletContext() {
+ return null;
+ }
+
+ public AsyncContext startAsync() throws IllegalStateException {
+ return null;
+ }
+
+ public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException {
+ return null;
+ }
+
+ public boolean isAsyncStarted() {
+ return false;
+ }
+
+ public boolean isAsyncSupported() {
+ return false;
+ }
+
+ public AsyncContext getAsyncContext() {
+ return null;
+ }
+
+ public DispatcherType getDispatcherType() {
+ return null;
+ }
+
public Map getParameterMap() {
// TODO Auto-generated method stub
return null;
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/ServletRequestSerializerTest.java b/orkbasej/src/main/java/net/sf/oreka/serializers/test/ServletRequestSerializerTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/test/ServletRequestSerializerTest.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/ServletRequestSerializerTest.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/SingleLineSerializerTest.java b/orkbasej/src/main/java/net/sf/oreka/serializers/test/SingleLineSerializerTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/test/SingleLineSerializerTest.java
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/SingleLineSerializerTest.java
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/TestMessageSimple.xml b/orkbasej/src/main/java/net/sf/oreka/serializers/test/TestMessageSimple.xml
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/test/TestMessageSimple.xml
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/TestMessageSimple.xml
diff --git a/orkbasej/java/net/sf/oreka/serializers/test/TestNestedMessage.xml b/orkbasej/src/main/java/net/sf/oreka/serializers/test/TestNestedMessage.xml
similarity index 100%
rename from orkbasej/java/net/sf/oreka/serializers/test/TestNestedMessage.xml
rename to orkbasej/src/main/java/net/sf/oreka/serializers/test/TestNestedMessage.xml
diff --git a/orkbasej/java/net/sf/oreka/srvc/ObjectService.java b/orkbasej/src/main/java/net/sf/oreka/srvc/ObjectService.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/srvc/ObjectService.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/ObjectService.java
diff --git a/orkbasej/java/net/sf/oreka/srvc/ObjectServiceHbn.java b/orkbasej/src/main/java/net/sf/oreka/srvc/ObjectServiceHbn.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/srvc/ObjectServiceHbn.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/ObjectServiceHbn.java
diff --git a/orkbasej/java/net/sf/oreka/srvc/UserFilter.java b/orkbasej/src/main/java/net/sf/oreka/srvc/UserFilter.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/srvc/UserFilter.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/UserFilter.java
diff --git a/orkbasej/java/net/sf/oreka/srvc/UserService.java b/orkbasej/src/main/java/net/sf/oreka/srvc/UserService.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/srvc/UserService.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/UserService.java
diff --git a/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java b/orkbasej/src/main/java/net/sf/oreka/srvc/UserServiceHbn.java
similarity index 99%
rename from orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/UserServiceHbn.java
index 402b8627..ae74c0bf 100644
--- a/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java
+++ b/orkbasej/src/main/java/net/sf/oreka/srvc/UserServiceHbn.java
@@ -13,7 +13,7 @@
import net.sf.oreka.persistent.OrkLoginString;
import net.sf.oreka.persistent.OrkUser;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
diff --git a/orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java b/orkbasej/src/main/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java
rename to orkbasej/src/main/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java
diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabase.java b/orkbasej/src/main/java/net/sf/oreka/test/FillDatabase.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/test/FillDatabase.java
rename to orkbasej/src/main/java/net/sf/oreka/test/FillDatabase.java
diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java b/orkbasej/src/main/java/net/sf/oreka/test/FillDatabaseProgram.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java
rename to orkbasej/src/main/java/net/sf/oreka/test/FillDatabaseProgram.java
diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java b/orkbasej/src/main/java/net/sf/oreka/test/FillDatabaseUser.java
similarity index 100%
rename from orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java
rename to orkbasej/src/main/java/net/sf/oreka/test/FillDatabaseUser.java
diff --git a/orkbasej/java/net/sf/oreka/util/TomcatServerXMLParser.java b/orkbasej/src/main/java/net/sf/oreka/util/TomcatServerXMLParser.java
similarity index 96%
rename from orkbasej/java/net/sf/oreka/util/TomcatServerXMLParser.java
rename to orkbasej/src/main/java/net/sf/oreka/util/TomcatServerXMLParser.java
index 05da2cab..e5eebbed 100644
--- a/orkbasej/java/net/sf/oreka/util/TomcatServerXMLParser.java
+++ b/orkbasej/src/main/java/net/sf/oreka/util/TomcatServerXMLParser.java
@@ -1,367 +1,368 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2013, Orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-package net.sf.oreka.util;
-
-import java.io.File;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class TomcatServerXMLParser {
-
- static Logger logger = Logger.getLogger(TomcatServerXMLParser.class);
- private static String serverTcpPort = null;
- private static String audioContextPath = "";
- private static String audioFilePath = "";
- private static String scheme = null;
-
- private static String DEFAULT_TCPPORT = "8080";
- private static String DEFAULT_HOSTNAME = "localhost";
- private static String DEFAULT_SCHEME = "http";
- private static String tomcatHome = "";
- private static String defaultRecordingPath = "";
-
- private static final String TOMCAT_RECORDINGS_PATH = "/webapps/ROOT/";
-
- public static String getOrkTrackTcpPort(){
-
- // Default to 8080
- if (serverTcpPort == null)
- serverTcpPort = "8080";
-
- return serverTcpPort;
- }
-
- public static String getOrkWebTcpPort(){
-
- // Default to 8080
- if (serverTcpPort == null)
- serverTcpPort = "8080";
-
- return serverTcpPort;
- }
-
- public static String getTomcatTcpPort(){
-
- if (serverTcpPort == null)
- return DEFAULT_TCPPORT;
-
- return serverTcpPort;
- }
-
- // FOR NOW USE DEFAULTS
- public static String getOrkTrackHostName(){
-
-// if (serverHostName == null)
-// return DEFAULT_HOSTNAME;
-
- return DEFAULT_HOSTNAME;
- }
-
- public static String getOrkWebHostName(){
-
-// if (serverHostName == null)
-// return DEFAULT_HOSTNAME;
-
- return DEFAULT_HOSTNAME;
- }
-
- public static String getScheme(){
-
- if (scheme==null)
- return DEFAULT_SCHEME;
-
- return scheme;
- }
-
- public static String getStartURLFromTomcatConfig(){
- return getScheme() + "://" + getOrkWebHostName() + ":" + getOrkWebTcpPort() + "/";
- }
-
- // Assumes parseServerXML was already called by ContextListener at tomcat start
- public static String getAudioContextPath(){
- if (audioContextPath==null)
- audioContextPath="";
- return audioContextPath;
- }
-
- // Assumes parseServerXML was already called by ContextListener at tomcat start
- public static String getAudioFilePath() {
- if (audioFilePath==null)
- audioFilePath="";
- return audioFilePath;
- }
-
- public static String getDefaultRecordingPath() {
- return defaultRecordingPath;
- }
-
- public static void setDefaultRecordingPath(String defaultRecordingPath) {
- TomcatServerXMLParser.defaultRecordingPath = defaultRecordingPath;
- }
-
- public static String getTomcatHome() {
- return tomcatHome;
- }
-
- public static void setTomcatHome(String tomcatHome) {
- if (tomcatHome!=null && !tomcatHome.equals("")) {
- TomcatServerXMLParser.tomcatHome = tomcatHome;
- setDefaultRecordingPath(tomcatHome + TOMCAT_RECORDINGS_PATH);
- } else {
- tomcatHome = "";
- setDefaultRecordingPath("");
- }
- }
-
- // Parse server.xml file
- public static void parseServerXML(String tomcatHome) throws Exception {
-
- if (tomcatHome == null || tomcatHome.equals("")){
- if (logger.isDebugEnabled())
- logger.debug("parseServerXML() - no server.xml provided, will use defaults");
- return;
- }
-
- String serverXmlPath = tomcatHome + "/conf/server.xml";
-
- if (logger.isDebugEnabled())
- logger.debug("parseServerXML() - parsing Tomcat server.xml file, path: " + serverXmlPath);
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
-
- File serverConf = new File(serverXmlPath);
- Document document = builder.parse(serverConf);
- document.getDocumentElement().normalize();
-
- // Find Server node
- Node serverNode = document.getLastChild();
- NodeList serverNodeChildren = serverNode.getChildNodes();
-
- // Find Service node
- Node serviceNode = null;
- for (int i=0;i
-
-
-
- org.hibernate.dialect.MySQLInnoDBDialect
- 100
- com.mysql.jdbc.Driver
- jdbc:mysql://localhost/test
- password
- root
-
- update
- false
-
- true
- 1
- org.hibernate.cache.HashtableCacheProvider
-
+
+
+
+
+ org.hibernate.dialect.MySQLInnoDBDialect
+ 100
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost/test
+ password
+ root
+
+ update
+ false
+
+ true
+ 1
+ org.hibernate.cache.HashtableCacheProvider
+
\ No newline at end of file
diff --git a/orkbasej/java/database.hbm.xml b/orkbasej/src/resources/database.hbm.xml
similarity index 71%
rename from orkbasej/java/database.hbm.xml
rename to orkbasej/src/resources/database.hbm.xml
index af840175..b34df04d 100644
--- a/orkbasej/java/database.hbm.xml
+++ b/orkbasej/src/resources/database.hbm.xml
@@ -1,21 +1,21 @@
-
-
-
-
- org.hibernate.dialect.MySQLInnoDBDialect
- 100
- com.mysql.jdbc.Driver
- jdbc:mysql://localhost/test
- password
- root
-
- update
- false
-
- true
- 1
- org.hibernate.cache.HashtableCacheProvider
-
-
+
+
+
+
+ org.hibernate.dialect.MySQL55Dialect
+ 256
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost/oreka?useSSL=false
+ password
+ root
+
+ update
+ false
+
+ true
+ 1
+ org.hibernate.cache.HashtableCacheProvider
+
+
diff --git a/orkbasej/java/hsqldb.hbm.template.xml b/orkbasej/src/resources/hsqldb.hbm.template.xml
similarity index 100%
rename from orkbasej/java/hsqldb.hbm.template.xml
rename to orkbasej/src/resources/hsqldb.hbm.template.xml
diff --git a/orkbasej/java/logging-example.properties b/orkbasej/src/resources/logging-example.properties
similarity index 98%
rename from orkbasej/java/logging-example.properties
rename to orkbasej/src/resources/logging-example.properties
index f0c657ea..82a763a0 100644
--- a/orkbasej/java/logging-example.properties
+++ b/orkbasej/src/resources/logging-example.properties
@@ -3,34 +3,34 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %c %5p %C{1}:%L - %m%n
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
### orkweb.log ###
log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=c:/orkweb.log
-log4j.appender.file.MaxFileSize=7000KB
+log4j.appender.file.File=c:/orkweb.log
+log4j.appender.file.MaxFileSize=7000KB
log4j.appender.file.MaxBackupIndex=20
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
-
-### orklicense.log ###
-log4j.logger.net.sf.oreka.orkweb.LicenseManager=info, license
-log4j.appender.license=org.apache.log4j.RollingFileAppender
-log4j.appender.license.File=c:/orklicense.log
-log4j.appender.license.MaxFileSize=200KB
-log4j.appender.license.MaxBackupIndex=3
-log4j.appender.license.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
+
+### orklicense.log ###
+log4j.logger.net.sf.oreka.orkweb.LicenseManager=info, license
+log4j.appender.license=org.apache.log4j.RollingFileAppender
+log4j.appender.license.File=c:/orklicense.log
+log4j.appender.license.MaxFileSize=200KB
+log4j.appender.license.MaxBackupIndex=3
+log4j.appender.license.layout=org.apache.log4j.PatternLayout
log4j.appender.license.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
-
-log4j.rootLogger=info, file, stdout
-log4j.logger.net.sf.oreka=info
-log4j.logger.net.sf.oreka.orktrack=info
-log4j.logger.org.hibernate=error
-log4j.logger.org.hibernate.SQL=off
-log4j.logger.org.apache.tapestry=info
-log4j.logger.tapestry=error
-log4j.logger.org.apache.hivemind=info
-log4j.logger.hivemind=error
-log4j.logger.org.logicalcobwebs.proxool=error
-log4j.logger.org.apache.catalina=error
-log4j.logger.uk.ltd.getahead=warn
+
+log4j.rootLogger=info, file, stdout
+log4j.logger.net.sf.oreka=info
+log4j.logger.net.sf.oreka.orktrack=info
+log4j.logger.org.hibernate=error
+log4j.logger.org.hibernate.SQL=off
+log4j.logger.org.apache.tapestry=info
+log4j.logger.tapestry=error
+log4j.logger.org.apache.hivemind=info
+log4j.logger.hivemind=error
+log4j.logger.org.logicalcobwebs.proxool=error
+log4j.logger.org.apache.catalina=error
+log4j.logger.uk.ltd.getahead=warn
diff --git a/orkbasej/java/logging.properties b/orkbasej/src/resources/logging.properties
similarity index 98%
rename from orkbasej/java/logging.properties
rename to orkbasej/src/resources/logging.properties
index f0c657ea..82a763a0 100644
--- a/orkbasej/java/logging.properties
+++ b/orkbasej/src/resources/logging.properties
@@ -3,34 +3,34 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %c %5p %C{1}:%L - %m%n
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
### orkweb.log ###
log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=c:/orkweb.log
-log4j.appender.file.MaxFileSize=7000KB
+log4j.appender.file.File=c:/orkweb.log
+log4j.appender.file.MaxFileSize=7000KB
log4j.appender.file.MaxBackupIndex=20
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
-
-### orklicense.log ###
-log4j.logger.net.sf.oreka.orkweb.LicenseManager=info, license
-log4j.appender.license=org.apache.log4j.RollingFileAppender
-log4j.appender.license.File=c:/orklicense.log
-log4j.appender.license.MaxFileSize=200KB
-log4j.appender.license.MaxBackupIndex=3
-log4j.appender.license.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
+
+### orklicense.log ###
+log4j.logger.net.sf.oreka.orkweb.LicenseManager=info, license
+log4j.appender.license=org.apache.log4j.RollingFileAppender
+log4j.appender.license.File=c:/orklicense.log
+log4j.appender.license.MaxFileSize=200KB
+log4j.appender.license.MaxBackupIndex=3
+log4j.appender.license.layout=org.apache.log4j.PatternLayout
log4j.appender.license.layout.ConversionPattern=%d{ISO8601} %c %5p - %m%n
-
-log4j.rootLogger=info, file, stdout
-log4j.logger.net.sf.oreka=info
-log4j.logger.net.sf.oreka.orktrack=info
-log4j.logger.org.hibernate=error
-log4j.logger.org.hibernate.SQL=off
-log4j.logger.org.apache.tapestry=info
-log4j.logger.tapestry=error
-log4j.logger.org.apache.hivemind=info
-log4j.logger.hivemind=error
-log4j.logger.org.logicalcobwebs.proxool=error
-log4j.logger.org.apache.catalina=error
-log4j.logger.uk.ltd.getahead=warn
+
+log4j.rootLogger=info, file, stdout
+log4j.logger.net.sf.oreka=info
+log4j.logger.net.sf.oreka.orktrack=info
+log4j.logger.org.hibernate=error
+log4j.logger.org.hibernate.SQL=off
+log4j.logger.org.apache.tapestry=info
+log4j.logger.tapestry=error
+log4j.logger.org.apache.hivemind=info
+log4j.logger.hivemind=error
+log4j.logger.org.logicalcobwebs.proxool=error
+log4j.logger.org.apache.catalina=error
+log4j.logger.uk.ltd.getahead=warn
diff --git a/orkbasej/src/resources/logging.xml b/orkbasej/src/resources/logging.xml
new file mode 100644
index 00000000..25008db4
--- /dev/null
+++ b/orkbasej/src/resources/logging.xml
@@ -0,0 +1,84 @@
+
+
+
+
+ /var/log/orkweb/orkweb.log
+ /var/log/orkweb/access.log
+ /var/log/orkweb/orklicense.log
+
+
+
+
+
+
+
+
+
+ %d %p %c{1} [%t] %m%n
+
+
+
+
+
+
+
+
+
+ %d %p %c{1} [%t] %m%n
+
+
+
+
+
+
+
+
+
+ %d %p %c{1} [%t] %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/orkbasej/java/proxool-template.properties b/orkbasej/src/resources/proxool-template.properties
similarity index 100%
rename from orkbasej/java/proxool-template.properties
rename to orkbasej/src/resources/proxool-template.properties
diff --git a/orktrack/.classpath b/orktrack/.classpath
deleted file mode 100644
index 3a2bbaca..00000000
--- a/orktrack/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/orktrack/.gitignore b/orktrack/.gitignore
new file mode 100644
index 00000000..69d7cf60
--- /dev/null
+++ b/orktrack/.gitignore
@@ -0,0 +1,4 @@
+target/
+.settings
+classes/
+*.iml
\ No newline at end of file
diff --git a/orktrack/.project b/orktrack/.project
deleted file mode 100644
index 92ab63c8..00000000
--- a/orktrack/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- orktrack
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- com.sysdeo.eclipse.tomcat.tomcatnature
-
-
diff --git a/orktrack/deploy-template.xml b/orktrack/deploy-template.xml
index 21cf4876..208ec457 100644
--- a/orktrack/deploy-template.xml
+++ b/orktrack/deploy-template.xml
@@ -61,7 +61,7 @@
+ source="1.8">
@@ -75,7 +75,7 @@
+ source="1.8">
diff --git a/orktrack/pom.xml b/orktrack/pom.xml
new file mode 100644
index 00000000..d3cd35a6
--- /dev/null
+++ b/orktrack/pom.xml
@@ -0,0 +1,150 @@
+
+ 4.0.0
+ net.sf.oreka
+ orktrack
+ 0.0.2-SNAPSHOT
+ war
+
+ src/main/java
+
+
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.8
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.4
+
+
+
+
+ src/main/webapp
+
+
+
+
+
+
+ org.apache.tomcat.maven
+ tomcat7-maven-plugin
+ 2.1
+
+ /
+
+
+
+
+
+ com.github.m50d
+ aspectj-maven-plugin
+ 1.11.1
+
+
+
+ 1.8
+
+ 1.8
+
+ true
+ true
+ ignore
+ UTF-8
+
+ true
+
+
+
+ ${project.build.directory}/classes
+
+
+
+
+ io.astefanutti.metrics.aspectj
+ metrics-aspectj
+
+
+
+
+
+
+ compile
+ test-compile
+
+
+
+
+
+
+
+
+
+
+ net.sf.oreka
+ orkbasej
+ 0.0.2-SNAPSHOT
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 4.0.0
+ provided
+
+
+
+ org.projectlombok
+ lombok
+ 1.16.20
+ provided
+
+
+
+ io.dropwizard.metrics
+ metrics-core
+ 3.1.0
+
+
+
+ io.dropwizard.metrics
+ metrics-annotation
+ 3.1.0
+
+
+
+ io.astefanutti.metrics.aspectj
+ metrics-aspectj
+ 1.2.0
+
+
+
+ org.aspectj
+ aspectjrt
+ 1.9.1
+
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.17.0
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.17.0
+
+
+
+
\ No newline at end of file
diff --git a/orktrack/src/net/sf/oreka/orktrack/ConfigManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/ConfigManager.java
similarity index 98%
rename from orktrack/src/net/sf/oreka/orktrack/ConfigManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/ConfigManager.java
index 84fb2688..279f8c37 100644
--- a/orktrack/src/net/sf/oreka/orktrack/ConfigManager.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/ConfigManager.java
@@ -27,7 +27,7 @@
import net.sf.oreka.OrkException;
import net.sf.oreka.serializers.DomSerializer;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
/**
diff --git a/orktrack/src/main/java/net/sf/oreka/orktrack/Constants.java b/orktrack/src/main/java/net/sf/oreka/orktrack/Constants.java
new file mode 100644
index 00000000..bad31460
--- /dev/null
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/Constants.java
@@ -0,0 +1,8 @@
+package net.sf.oreka.orktrack;
+
+public class Constants {
+ public static final String APP_NAME = "OrkTrack";
+ public static final String DEFAULT_REGISTRY_NAME = "metrics-registry";
+
+
+}
diff --git a/orktrack/src/net/sf/oreka/orktrack/LogManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/LogManager.java
similarity index 60%
rename from orktrack/src/net/sf/oreka/orktrack/LogManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/LogManager.java
index bf395683..9c043f9c 100644
--- a/orktrack/src/net/sf/oreka/orktrack/LogManager.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/LogManager.java
@@ -13,42 +13,39 @@
package net.sf.oreka.orktrack;
-import java.io.File;
-
import net.sf.oreka.OrkException;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.ConfigurationSource;
+import org.apache.logging.log4j.core.config.xml.XmlConfiguration;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
+import java.io.File;
/**
* This singleton class manages all application log4j loggers
*/
public class LogManager {
- static LogManager logManager = null;
-
- String ConfigFilename = null;
-
- Logger rootLogger = null;
- Logger configLogger = null;
- Logger contextLogger = null;
- Logger portLogger = null;
- Logger userLogger = null;
- Logger recurrentLogger = null; // special logger for recurrent messages (annoying to have normally)
+ private static LogManager logManager = null;
+
+ private String ConfigFilename = null;
+
+ private Logger rootLogger = null;
+ private Logger configLogger = null;
+ private Logger contextLogger = null;
+ private Logger portLogger = null;
+ private Logger userLogger = null;
+ private Logger recurrentLogger = null; // special logger for recurrent messages (annoying to have normally)
- private LogManager()
+ private LogManager()
{
- rootLogger = Logger.getRootLogger();
- rootLogger.setLevel(Level.INFO);
- configLogger = Logger.getLogger("config");
- contextLogger = Logger.getLogger("context");
- portLogger = Logger.getLogger("port");
- userLogger = Logger.getLogger("user");
- recurrentLogger = Logger.getLogger("net.sf.oreka.recurrent");
+ rootLogger = org.apache.logging.log4j.LogManager.getRootLogger();
+ configLogger = org.apache.logging.log4j.LogManager.getLogger("config");
+ contextLogger = org.apache.logging.log4j.LogManager.getLogger("context");
+ portLogger = org.apache.logging.log4j.LogManager.getLogger("port");
+ userLogger = org.apache.logging.log4j.LogManager.getLogger("user");
+ recurrentLogger = org.apache.logging.log4j.LogManager.getLogger("net.sf.oreka.recurrent");
- BasicConfigurator.configure(); // in case there is no properties file
}
public static LogManager getInstance()
@@ -73,7 +70,11 @@ public void configure() throws OrkException {
if (file.exists()) {
// Attempt to configure log4j
- PropertyConfigurator.configure(ConfigFilename);
+ //PropertyConfigurator.configure(ConfigFilename);
+ LoggerContext context = (org.apache.logging.log4j.core.LoggerContext) org.apache.logging.log4j.LogManager.getContext(false);
+ XmlConfiguration config = new XmlConfiguration(context, ConfigurationSource.fromUri(file.toURI()));
+ context.start(config);
+
}
else {
throw new OrkException("Log4j properties file does not exist:" + ConfigFilename + " check your web.xml");
diff --git a/orktrack/src/net/sf/oreka/orktrack/OrkTrack.java b/orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrack.java
similarity index 61%
rename from orktrack/src/net/sf/oreka/orktrack/OrkTrack.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrack.java
index 75da7c42..2ecdfe31 100644
--- a/orktrack/src/net/sf/oreka/orktrack/OrkTrack.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrack.java
@@ -16,46 +16,41 @@
*/
package net.sf.oreka.orktrack;
-import java.util.Date;
-
+import com.codahale.metrics.JmxReporter;
+import com.codahale.metrics.MetricRegistry;
+import com.codahale.metrics.SharedMetricRegistries;
import net.sf.oreka.HibernateManager;
import net.sf.oreka.OrkObjectFactory;
-import net.sf.oreka.orktrack.messages.ConfigureLogMessage;
-import net.sf.oreka.orktrack.messages.InitMessage;
-import net.sf.oreka.orktrack.messages.MetadataMessage;
-import net.sf.oreka.orktrack.messages.PingMessage;
-import net.sf.oreka.orktrack.messages.TapeMessage;
-import net.sf.oreka.orktrack.messages.UserStateMessage;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import net.sf.oreka.orktrack.messages.*;
+import org.apache.logging.log4j.Logger;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+import static net.sf.oreka.orktrack.Constants.*;
public class OrkTrack {
- public static final String APP_NAME = "OrkTrack";
-
public static HibernateManager hibernateManager = HibernateManager.instance();
private static Date lastInMemoryObjectsSync = new Date(0);
-
- static Logger logger = Logger.getLogger(OrkTrack.class);
-
+ public static MetricRegistry METRIC_REGISTRY;
+ private static JmxReporter reporter;
+
+ private static Logger log = LogManager.getInstance().getRootLogger();
+
public OrkTrack() {
-
- LogManager.getInstance().getConfigLogger().log(Level.INFO, "Entering OrkTrack");
+ LogManager.getInstance().getConfigLogger().info("Entering OrkTrack");
}
- public static void initialize(String log4jConfigFile, String hibernateConfigFile, String configFile) {
-
- try {
+ public static void initialize(String log4jConfigFile, String hibernateConfigFile, String configFile) throws Exception {
+ try {
LogManager.getInstance().configure(log4jConfigFile);
- logger.info("========================================");
- logger.info(OrkTrack.APP_NAME + " starting ...");
-
+ log.info("========================================");
+ log.info(APP_NAME + " starting ...");
+
// Register all OrkObjects
- OrkObjectFactory.instance().registerOrkObject(new OrkTrackConfig());
+ OrkObjectFactory.instance().registerOrkObject(new OrkTrackConfig());
OrkObjectFactory.instance().registerOrkObject(new MetadataMessage());
OrkObjectFactory.instance().registerOrkObject(new TapeMessage());
OrkObjectFactory.instance().registerOrkObject(new UserStateMessage());
@@ -65,11 +60,22 @@ public static void initialize(String log4jConfigFile, String hibernateConfigFile
ConfigManager.getInstance().load(configFile);
hibernateManager.configure(hibernateConfigFile);
+
+ METRIC_REGISTRY = SharedMetricRegistries.getOrCreate(DEFAULT_REGISTRY_NAME);
+
+ reporter = JmxReporter.forRegistry(METRIC_REGISTRY)
+ .convertDurationsTo(TimeUnit.MILLISECONDS)
+ .convertRatesTo(TimeUnit.SECONDS)
+ .inDomain("orktrack")
+ .build();
+ reporter.start();
+
}
- catch (Exception e) {
- logger.error("OrkTrack.initialize: Error configuring Hibernate:" + e.getMessage());
+ catch (Throwable e) {
+ log.error("OrkTrack.initialize: Error configuring Hibernate:" + e.getMessage());
+ throw e ;
}
-
+
/*
boolean initOk = false;
//while(initOk == false) {
@@ -82,9 +88,10 @@ public static void initialize(String log4jConfigFile, String hibernateConfigFile
*/
refreshInMemoryObjects();
- logger.info(OrkTrack.APP_NAME + " started successfully.");
- logger.info("----------------------------------------");
+ log.info(APP_NAME + " started successfully.");
+ log.info("----------------------------------------");
+ METRIC_REGISTRY.counter(APP_NAME).inc();
}
public static void refreshInMemoryObjects() {
@@ -98,12 +105,4 @@ public static void refreshInMemoryObjects() {
}
}
- public static void main(String[] args)
- {
- //System.out.println("hello");
- //RecSegment seg = new RecSegment();
- //System.out.println(seg.getDuration());
- //OrkTrack orkTrack = new OrkTrack();
- }
-
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/OrkTrackConfig.java b/orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrackConfig.java
similarity index 84%
rename from orktrack/src/net/sf/oreka/orktrack/OrkTrackConfig.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrackConfig.java
index 24d04892..9b98a1a8 100644
--- a/orktrack/src/net/sf/oreka/orktrack/OrkTrackConfig.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/OrkTrackConfig.java
@@ -13,10 +13,14 @@
package net.sf.oreka.orktrack;
+import lombok.Getter;
+import lombok.Setter;
import net.sf.oreka.OrkException;
import net.sf.oreka.OrkObject;
import net.sf.oreka.serializers.OrkSerializer;
+@Getter
+@Setter
public class OrkTrackConfig implements OrkObject {
boolean ctiDriven = false;
@@ -33,14 +37,5 @@ public String getOrkClassName() {
public void validate() {
}
-
- public boolean isCtiDriven() {
- return ctiDriven;
- }
-
- public void setCtiDriven(boolean ctiDriven) {
- this.ctiDriven = ctiDriven;
- }
-
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/Port.java b/orktrack/src/main/java/net/sf/oreka/orktrack/Port.java
similarity index 99%
rename from orktrack/src/net/sf/oreka/orktrack/Port.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/Port.java
index e14b1273..a8b6d027 100644
--- a/orktrack/src/net/sf/oreka/orktrack/Port.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/Port.java
@@ -221,6 +221,7 @@ else if (tapeMessage.getStage() == TapeMessage.CaptureStage.STOP){
recTape.setPort(recPort);
recTape.setRemoteParty(stopMessage.getRemoteParty());
recTape.setTimestamp(timestamp);
+ recTape.setNativeCallId(stopMessage.getNativeCallId());
recTape.setService(srv);
hbnSession.save(recTape);
logger.info("#" + tapeMessage.getCapturePort() + ": written tape " + recTape.getId());
diff --git a/orktrack/src/net/sf/oreka/orktrack/PortManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/PortManager.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/PortManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/PortManager.java
diff --git a/orktrack/src/net/sf/oreka/orktrack/ProgramManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/ProgramManager.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/ProgramManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/ProgramManager.java
diff --git a/orktrack/src/net/sf/oreka/orktrack/ServiceManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/ServiceManager.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/ServiceManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/ServiceManager.java
diff --git a/orktrack/src/main/java/net/sf/oreka/orktrack/TapeManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/TapeManager.java
new file mode 100644
index 00000000..4f47bb40
--- /dev/null
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/TapeManager.java
@@ -0,0 +1,141 @@
+package net.sf.oreka.orktrack;
+
+import net.sf.oreka.orktrack.messages.TapeMessage;
+import net.sf.oreka.persistent.OrkSegment;
+import net.sf.oreka.persistent.OrkService;
+import net.sf.oreka.persistent.OrkTape;
+import net.sf.oreka.persistent.OrkUser;
+import org.apache.log4j.Logger;
+import org.hibernate.Session;
+import org.hibernate.query.Query;
+
+import java.util.Date;
+import java.util.Optional;
+
+
+public class TapeManager {
+
+ private Logger logger = Logger.getLogger(TapeManager.class);
+
+ static TapeManager tapeManager = null;
+
+ private TapeManager () {
+ }
+
+ public static TapeManager instance() {
+ if (tapeManager == null) {
+ tapeManager = new TapeManager();
+ }
+ return tapeManager;
+ }
+
+ public Optional getTapeByNativeCallID(Session hbnSession, String callId) {
+ Query query = hbnSession.createQuery("from OrkTape where nativeCallId=:nativeCallId order by id desc", OrkTape.class);
+ query.setParameter("nativeCallId", callId);
+ query.setMaxResults(1);
+ return query.uniqueResultOptional();
+ }
+
+ public Optional getBestMatchingRunningTape(Session hbnSession, TapeMessage tapeMessage) {
+ Query query = hbnSession.createQuery("from OrkTape where portName=:portName and nativeCallId=:nativeCallId and DATEDIFF(timestamp, NOW()) < :timeOffSet order by id desc", OrkTape.class);
+ query.setParameter("portName", tapeMessage.getCapturePort());
+ query.setParameter("nativeCallId", tapeMessage.getNativeCallId());
+
+ if (!tapeMessage.getNativeCallId().equals("")){
+ query.setParameter("timeOffSet", 7);
+ } else {
+ query.setParameter("timeOffSet", 1);
+ }
+ query.setMaxResults(1);
+ return query.uniqueResultOptional();
+ }
+
+ /**
+ * @param tapeMessage
+ * @param hbnSession
+ * @param srv
+ * @return false if the tape is rejected and should be deleted, otherwise true
+ */
+ public boolean notifyTapeMessage(TapeMessage tapeMessage, Session hbnSession, OrkService srv) {
+
+ boolean keepTape = true;
+ long date = ((long)tapeMessage.getTimestamp()) * 1000;
+ Date timestamp = new Date(date);
+
+ // create a new tape record
+ OrkTape recTape = new OrkTape();
+ recTape.setDirection(tapeMessage.getDirection());
+ recTape.setDuration(tapeMessage.getDuration());
+ recTape.setExpiryTimestamp(new Date());
+ recTape.setLocalParty(tapeMessage.getLocalParty());
+ recTape.setPortName(tapeMessage.getCapturePort());
+ recTape.setRemoteParty(tapeMessage.getRemoteParty());
+ recTape.setTimestamp(timestamp);
+ recTape.setNativeCallId(tapeMessage.getNativeCallId());
+ recTape.setState(tapeMessage.getStage().name());
+ recTape.setService(srv);
+
+ if (tapeMessage.getStage() == TapeMessage.CaptureStage.START) {
+ //also insert into db for tracking
+ // create a new tape record
+ recTape.setFilename(tapeMessage.getFilename()+".mcf");
+ hbnSession.save(recTape);
+ logger.info("Written start tape:" + tapeMessage.getRecId() + " as " + recTape.getId());
+ } else if (tapeMessage.getStage() == TapeMessage.CaptureStage.STOP) {
+ //Update if present
+ Optional existingTape = getBestMatchingRunningTape(hbnSession, tapeMessage);
+ if (existingTape.isPresent()){
+ recTape = existingTape.get();
+ recTape.setDuration(tapeMessage.getDuration());
+ recTape.setLocalParty(tapeMessage.getLocalParty());
+ recTape.setRemoteParty(tapeMessage.getRemoteParty());
+ recTape.setFilename(tapeMessage.getFilename());
+ recTape.setState(tapeMessage.getStage().name());
+ hbnSession.update(recTape);
+ logger.info("Updated stop tape:" + tapeMessage.getRecId() + " as " + recTape.getId());
+ }
+ } else if (tapeMessage.getStage() == TapeMessage.CaptureStage.READY){
+ // Tape stop message
+ //Retrieve Existing Tape if any
+ String currentCallState = null;
+ Optional existingTape = getBestMatchingRunningTape(hbnSession, tapeMessage);
+ if (existingTape.isPresent()){
+ recTape = existingTape.get();
+ currentCallState = recTape.getState();
+ recTape.setFilename(tapeMessage.getFilename());
+ recTape.setState(tapeMessage.getStage().name());
+
+ hbnSession.update(recTape);
+ logger.info("Updated ready tape:" + tapeMessage.getRecId() + " as " + recTape.getId());
+ } else {
+ recTape.setFilename(tapeMessage.getFilename());
+ hbnSession.save(recTape);
+ logger.info("Added ready tape:" + tapeMessage.getRecId() + " as " + recTape.getId());
+ }
+
+ OrkSegment recSegment = new OrkSegment();
+ recSegment.setTimestamp(timestamp);
+ recSegment.setDirection(tapeMessage.getDirection());
+ recSegment.setDuration(tapeMessage.getDuration());
+ recSegment.setRemoteParty(tapeMessage.getRemoteParty());
+ recSegment.setLocalParty(tapeMessage.getLocalParty());
+ recSegment.setLocalEntryPoint(tapeMessage.getLocalEntryPoint());
+ recSegment.setTape(recTape);
+ recSegment.setPortName(recTape.getPortName());
+
+ if(tapeMessage.getLocalParty() != "") {
+ OrkUser user = UserManager.instance().getByLoginString(tapeMessage.getLocalParty(), hbnSession);
+ recSegment.setUser(user);
+ }
+ if (ProgramManager.instance().filterSegmentAgainstAllPrograms(recSegment, hbnSession)) {
+ hbnSession.save(recSegment);
+ logger.info("Written segment:" + tapeMessage.getRecId() + " as " + recSegment.getId());
+ }
+ else {
+ logger.info("Tape:" + tapeMessage.getRecId() + " not retained by any program");
+ keepTape = false;
+ }
+ }
+ return keepTape;
+ }
+}
diff --git a/orktrack/src/net/sf/oreka/orktrack/UserManager.java b/orktrack/src/main/java/net/sf/oreka/orktrack/UserManager.java
similarity index 97%
rename from orktrack/src/net/sf/oreka/orktrack/UserManager.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/UserManager.java
index 22f490cc..11761670 100644
--- a/orktrack/src/net/sf/oreka/orktrack/UserManager.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/UserManager.java
@@ -18,7 +18,7 @@
import net.sf.oreka.persistent.OrkUser;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
import org.hibernate.Session;
public class UserManager {
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java
similarity index 89%
rename from orktrack/src/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java
index ee1f6b5c..714222a3 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/ConfigureLogMessage.java
@@ -20,16 +20,8 @@
import net.sf.oreka.orktrack.LogManager;
import net.sf.oreka.serializers.OrkSerializer;
-import org.apache.log4j.Logger;
-
public class ConfigureLogMessage extends SyncMessage {
- static Logger logger = Logger.getLogger(ConfigureLogMessage.class);
-
-
- public ConfigureLogMessage() {
- }
-
@Override
public AsyncMessage process() {
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/InitMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/InitMessage.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/messages/InitMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/InitMessage.java
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/MetadataMessage.java
similarity index 66%
rename from orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/MetadataMessage.java
index c815d4cd..c2f4615d 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/MetadataMessage.java
@@ -13,25 +13,26 @@
package net.sf.oreka.orktrack.messages;
+import lombok.Getter;
+import lombok.Setter;
import net.sf.oreka.Direction;
import net.sf.oreka.OrkException;
import net.sf.oreka.messages.AsyncMessage;
import net.sf.oreka.messages.SimpleResponseMessage;
import net.sf.oreka.messages.SyncMessage;
+import net.sf.oreka.orktrack.*;
import net.sf.oreka.orktrack.LogManager;
-import net.sf.oreka.orktrack.OrkTrack;
-import net.sf.oreka.orktrack.Port;
-import net.sf.oreka.orktrack.PortManager;
-import net.sf.oreka.orktrack.ServiceManager;
import net.sf.oreka.orktrack.messages.TapeMessage.CaptureStage;
import net.sf.oreka.persistent.OrkService;
import net.sf.oreka.serializers.OrkSerializer;
import net.sf.oreka.serializers.SingleLineSerializer;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;
+@Getter
+@Setter
public class MetadataMessage extends SyncMessage {
Logger log = null;
@@ -115,92 +116,5 @@ public void validate() {
}
- public String getCapturePort() {
- return capturePort;
- }
-
- public void setCapturePort(String capturePort) {
- this.capturePort = capturePort;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- public int getDuration() {
- return duration;
- }
-
- public void setDuration(int duration) {
- this.duration = duration;
- }
-
- public String getLocalEntryPoint() {
- return localEntryPoint;
- }
-
- public void setLocalEntryPoint(String localEntryPoint) {
- this.localEntryPoint = localEntryPoint;
- }
-
- public String getLocalParty() {
- return localParty;
- }
-
- public void setLocalParty(String localParty) {
- this.localParty = localParty;
- }
-
- public Logger getLog() {
- return log;
- }
-
- public void setLog(Logger log) {
- this.log = log;
- }
-
- public String getLoginString() {
- return loginString;
- }
-
- public void setLoginString(String loginString) {
- this.loginString = loginString;
- }
-
- public String getRemoteParty() {
- return remoteParty;
- }
-
- public void setRemoteParty(String remoteParty) {
- this.remoteParty = remoteParty;
- }
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
-
- public CaptureStage getStage() {
- return stage;
- }
-
- public void setStage(CaptureStage stage) {
- this.stage = stage;
- }
-
- public int getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(int timestamp) {
- this.timestamp = timestamp;
- }
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/PingMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/PingMessage.java
similarity index 83%
rename from orktrack/src/net/sf/oreka/orktrack/messages/PingMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/PingMessage.java
index 9c53cf2b..252b0bf1 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/PingMessage.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/PingMessage.java
@@ -13,27 +13,23 @@
package net.sf.oreka.orktrack.messages;
+import com.codahale.metrics.annotation.Timed;
+import io.astefanutti.metrics.aspectj.Metrics;
import net.sf.oreka.OrkException;
import net.sf.oreka.messages.AsyncMessage;
import net.sf.oreka.messages.SimpleResponseMessage;
import net.sf.oreka.messages.SyncMessage;
import net.sf.oreka.serializers.OrkSerializer;
-import org.apache.log4j.Logger;
-
+@Metrics(registry = "appMetrics")
public class PingMessage extends SyncMessage {
- static Logger logger = Logger.getLogger(PingMessage.class);
-
-
- public PingMessage() {
- }
-
@Override
+ @Timed(name = "process")
public AsyncMessage process() {
-
SimpleResponseMessage response = new SimpleResponseMessage();
response.setSuccess(true);
+ response.setComment("pong");
return response;
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeMessage.java
similarity index 52%
rename from orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeMessage.java
index d942436b..9ba1ac39 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeMessage.java
@@ -13,10 +13,16 @@
package net.sf.oreka.orktrack.messages;
+import com.codahale.metrics.SharedMetricRegistries;
+import com.codahale.metrics.annotation.Timed;
+import io.astefanutti.metrics.aspectj.Metrics;
+import lombok.Getter;
+import lombok.Setter;
import net.sf.oreka.Direction;
import net.sf.oreka.OrkException;
import net.sf.oreka.messages.AsyncMessage;
import net.sf.oreka.messages.SyncMessage;
+import net.sf.oreka.orktrack.Constants;
import net.sf.oreka.orktrack.OrkTrack;
import net.sf.oreka.orktrack.ServiceManager;
import net.sf.oreka.orktrack.TapeManager;
@@ -28,11 +34,14 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+@Getter
+@Setter
+@Metrics
public class TapeMessage extends SyncMessage {
- public enum CaptureStage {START , STOP, READY, COMPLETE, UNKN};
+ public enum CaptureStage {START , STOP, READY, COMPLETE, UNKN};
- static Logger logger = Logger.getLogger(TapeMessage.class);
+ static Logger log = Logger.getLogger(TapeMessage.class);
CaptureStage stage = CaptureStage.UNKN;
int timestamp = 0;
@@ -53,31 +62,27 @@ public enum CaptureStage {START , STOP, READY, COMPLETE, UNKN};
int dstTcpPort = 0;
String srcMac = "";
String dstMac = "";
+ String nativeCallId = "";
public TapeMessage() {
}
-
- public String getService() {
- return service;
- }
-
- public void setService(String service) {
- this.service = service;
- }
@Override
+ @Timed(name = "process")
public AsyncMessage process() {
- TapeResponse response = new TapeResponse();
+ SharedMetricRegistries.getOrCreate(Constants.DEFAULT_REGISTRY_NAME)
+ .meter(getClass().getName()+".processing."+stage).mark();
+
+ TapeResponse response = new TapeResponse();
Session session = null;
- Transaction tx = null;
-
+
try {
session = OrkTrack.hibernateManager.getSession();
- tx = session.beginTransaction();
-
+ Transaction tx = session.beginTransaction();
+
SingleLineSerializer ser = new SingleLineSerializer();
- logger.info("Message: " + ser.serialize(this));
+ log.info("Message: " + ser.serialize(this));
OrkService service = ServiceManager.retrieveOrCreate(this.service, this.getHostname(), session);
@@ -85,14 +90,14 @@ public AsyncMessage process() {
//port.notifyTapeMessage(this, session, service);
if (TapeManager.instance().notifyTapeMessage(this, session, service) == false) {
response.setDeleteTape(true);
- logger.debug("Tape deletion requested:" + this.getFilename());
+ log.debug("Tape deletion requested:" + this.getFilename());
}
response.setSuccess(true);
tx.commit();
}
catch (Exception e) {
- logger.error("TapeMessage.process: ", e);
+ log.error("TapeMessage.process: ", e);
response.setSuccess(false);
response.setComment(e.getMessage());
}
@@ -118,6 +123,7 @@ public void define(OrkSerializer serializer) throws OrkException {
direction = (Direction)serializer.enumValue("direction", direction, false);
loginString = serializer.stringValue("loginString", loginString, false);
service = serializer.stringValue("service", service, true);
+ nativeCallId = serializer.stringValue("nativecallid", nativeCallId, false);
}
public String getOrkClassName() {
@@ -126,167 +132,8 @@ public String getOrkClassName() {
public void validate() {
// TODO Auto-generated method stub
-
- }
-
- public String getCapturePort() {
- return capturePort;
- }
-
- public void setCapturePort(String capturePort) {
- this.capturePort = capturePort;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public void setDirection(Direction direction) {
- this.direction = direction;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public String getLocalEntryPoint() {
- return localEntryPoint;
- }
-
- public void setLocalEntryPoint(String localEntryPoint) {
- this.localEntryPoint = localEntryPoint;
- }
-
- public String getLocalParty() {
- return localParty;
- }
-
- public void setLocalParty(String localParty) {
- this.localParty = localParty;
- }
-
- public String getLoginString() {
- return loginString;
- }
-
- public void setLoginString(String loginString) {
- this.loginString = loginString;
- }
-
- public String getRemoteParty() {
- return remoteParty;
- }
-
- public void setRemoteParty(String remoteParty) {
- this.remoteParty = remoteParty;
- }
-
- public CaptureStage getStage() {
- return stage;
- }
-
- public void setStage(CaptureStage stage) {
- this.stage = stage;
- }
-
- public int getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(int timestamp) {
- this.timestamp = timestamp;
- }
-
- public int getDuration() {
- return duration;
- }
-
- public void setDuration(int duration) {
- this.duration = duration;
- }
-
- public String getCaptureId() {
- return captureId;
- }
-
-
- public void setCaptureId(String captureId) {
- this.captureId = captureId;
- }
-
-
- public String getDstIp() {
- return dstIp;
- }
-
-
- public void setDstIp(String dstIp) {
- this.dstIp = dstIp;
- }
-
-
- public String getDstMac() {
- return dstMac;
- }
-
-
- public void setDstMac(String dstMac) {
- this.dstMac = dstMac;
- }
-
-
- public int getDstTcpPort() {
- return dstTcpPort;
- }
-
- public void setDstTcpPort(int dstTcpPort) {
- this.dstTcpPort = dstTcpPort;
}
- public String getSrcIp() {
- return srcIp;
- }
-
-
- public void setSrcIp(String srcIp) {
- this.srcIp = srcIp;
- }
-
-
- public String getSrcMac() {
- return srcMac;
- }
-
-
- public void setSrcMac(String srcMac) {
- this.srcMac = srcMac;
- }
-
-
- public int getSrcTcpPort() {
- return srcTcpPort;
- }
-
-
- public void setSrcTcpPort(int srcTcpPort) {
- this.srcTcpPort = srcTcpPort;
- }
-
- public String getRecId() {
- return recId;
- }
-
-
- public void setRecId(String recId) {
- this.recId = recId;
- }
-
-
-
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/TapeResponse.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeResponse.java
similarity index 79%
rename from orktrack/src/net/sf/oreka/orktrack/messages/TapeResponse.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeResponse.java
index 7d40db7e..69d3627d 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/TapeResponse.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/TapeResponse.java
@@ -1,15 +1,18 @@
package net.sf.oreka.orktrack.messages;
+import lombok.Getter;
+import lombok.Setter;
import net.sf.oreka.OrkException;
import net.sf.oreka.messages.SimpleResponseMessage;
import net.sf.oreka.serializers.OrkSerializer;
+@Getter
+@Setter
public class TapeResponse extends SimpleResponseMessage {
private boolean deleteTape = false;
public void define(OrkSerializer serializer) throws OrkException {
-
super.define(serializer);
deleteTape = serializer.booleanValue("deletetape", deleteTape, false);
}
@@ -24,14 +27,5 @@ public void validate() {
}
- public boolean isDeleteTape() {
- return deleteTape;
- }
-
- public void setDeleteTape(boolean deleteTape) {
- this.deleteTape = deleteTape;
- }
-
-
}
diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/UserStateMessage.java
similarity index 94%
rename from orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/messages/UserStateMessage.java
index 937e3f34..3c84c256 100644
--- a/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/messages/UserStateMessage.java
@@ -17,15 +17,12 @@
import net.sf.oreka.messages.AsyncMessage;
import net.sf.oreka.messages.SimpleResponseMessage;
import net.sf.oreka.messages.SyncMessage;
+import net.sf.oreka.orktrack.*;
import net.sf.oreka.orktrack.LogManager;
-import net.sf.oreka.orktrack.OrkTrack;
-import net.sf.oreka.orktrack.Port;
-import net.sf.oreka.orktrack.PortManager;
-import net.sf.oreka.orktrack.UserManager;
import net.sf.oreka.persistent.OrkUser;
import net.sf.oreka.serializers.OrkSerializer;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;
diff --git a/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/AccessLogFilter.java b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/AccessLogFilter.java
new file mode 100644
index 00000000..e388daf6
--- /dev/null
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/AccessLogFilter.java
@@ -0,0 +1,59 @@
+package net.sf.oreka.orktrack.servlets;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+public class AccessLogFilter implements Filter {
+
+ private static final Logger logger = LogManager.getLogger("ACCESS");
+ private static final String logFormat = "%s %s %s %d %d";
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+ long startTime = System.currentTimeMillis();
+
+ HttpServletRequest httpServletRequest = (HttpServletRequest)servletRequest;
+ HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse;
+
+ filterChain.doFilter (httpServletRequest, servletResponse);
+
+ long elapsed = System.currentTimeMillis() - startTime;
+
+ logger.info(String.format(logFormat, getIpAddr(httpServletRequest), httpServletRequest.getMethod(), getFullURL(httpServletRequest), httpServletResponse.getStatus() , elapsed ));
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
+ public static String getFullURL(HttpServletRequest request) {
+ StringBuffer requestURL = request.getRequestURL();
+ String queryString = request.getQueryString();
+
+ if (queryString == null) {
+ return requestURL.toString();
+ } else {
+ return requestURL.append('?').append(queryString).toString();
+ }
+ }
+
+ public static String getIpAddr(HttpServletRequest request){
+ String ipAddress = request.getHeader("X-FORWARDED-FOR");
+ if (ipAddress == null) {
+ ipAddress = request.getRemoteAddr();
+ }
+ return ipAddress;
+ }
+}
diff --git a/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/CommandServlet.java b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/CommandServlet.java
new file mode 100644
index 00000000..5475f266
--- /dev/null
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/CommandServlet.java
@@ -0,0 +1,67 @@
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package net.sf.oreka.orktrack.servlets;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.oreka.messages.AsyncMessage;
+import net.sf.oreka.messages.SimpleResponseMessage;
+import net.sf.oreka.messages.SyncMessage;
+import net.sf.oreka.orktrack.OrkTrack;
+import net.sf.oreka.serializers.ServletRequestSerializer;
+import net.sf.oreka.serializers.SingleLineSerializer;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+
+public class CommandServlet extends HttpServlet {
+
+ static Logger logger = LogManager.getLogger(CommandServlet.class);
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ //#####OrkObjectFactory.instance().registerOrkObject(new TestMessage());
+ OrkTrack.refreshInMemoryObjects();
+
+ ServletRequestSerializer ser = new ServletRequestSerializer();
+ SingleLineSerializer ser2 = new SingleLineSerializer();
+
+ try {
+ SyncMessage obj = (SyncMessage) ser.deSerialize(request);
+ AsyncMessage rsp = obj.process();
+ logger.debug("Request: {}", ser2.serialize(obj));
+ String resp = ser2.serialize(rsp);
+ logger.debug("Response: " + resp);
+ response.getWriter().println(resp);
+ } catch (Throwable e) {
+ logger.error("Servlet Process threw Exception",e);
+ SimpleResponseMessage rsp = new SimpleResponseMessage();
+ rsp.setComment(e.getMessage());
+ rsp.setSuccess(false);
+ try {
+ String resp = ser2.serialize(rsp);
+ logger.debug("Request: " + request.getQueryString() + ", Response: " + resp);
+ response.getWriter().println(resp);
+ } catch (Exception ae) {
+ logger.error("Request: " + request.getQueryString() + ", Error:" + ae.getMessage());
+ }
+ }
+
+ }
+}
diff --git a/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/ContextListener.java b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/ContextListener.java
new file mode 100644
index 00000000..c9294d9a
--- /dev/null
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/servlets/ContextListener.java
@@ -0,0 +1,96 @@
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+package net.sf.oreka.orktrack.servlets;
+
+import net.sf.oreka.orktrack.Constants;
+import net.sf.oreka.orktrack.LogManager;
+import net.sf.oreka.orktrack.OrkTrack;
+import net.sf.oreka.util.TomcatServerXMLParser;
+import org.apache.logging.log4j.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+
+public class ContextListener implements ServletContextListener {
+
+ Logger log = LogManager.getInstance().getRootLogger();
+
+ public void contextDestroyed(ServletContextEvent arg0) {
+ log.info(Constants.APP_NAME + " shutting down.");
+ }
+
+ public void contextInitialized(ServletContextEvent servletContextEvent) {
+
+ ServletContext context = servletContextEvent.getServletContext();
+
+ String configFolder = context.getInitParameter("ConfigDirectory");
+ if (configFolder == null) {
+ configFolder = "c:/oreka/";
+ }
+
+ String log4jConfigFile = context.getInitParameter("Log4jConfigFile");
+ if (log4jConfigFile == null) {
+ log.error("OrkTrack ContextInitialized() Log4jConfigFile context-param missing in web.xml");
+ } else {
+ log.info("OrkTrack ContextInitialized() log4jConfigFile is " + log4jConfigFile);
+ log4jConfigFile = configFolder + "/" + log4jConfigFile;
+ }
+
+ String configFile = context.getInitParameter("ConfigFile");
+ if (configFile == null) {
+ log.error("OrkTrack ContextInitialized() ConfigFile context-param missing in web.xml");
+ } else {
+ log.info("OrkTrack ContextInitialized() configFile is " + configFile);
+ configFile = configFolder + "/" + configFile;
+ }
+
+ String hibernateConfigFile = context.getInitParameter("HibernateConfigFile");
+ if (hibernateConfigFile == null) {
+ log.error("OrkTrack ContextInitialized() HibernateConfigFile context-param missing in web.xml");
+ } else {
+ log.info("OrkTrack ContextInitialized() HibernateConfigFile is " + hibernateConfigFile);
+ hibernateConfigFile = configFolder + "/" + hibernateConfigFile;
+ }
+
+ // Get path to server.xml file
+ if (log.isDebugEnabled())
+ log.debug("OrkTrack ContextInitialized(): get Tomcat Home...");
+
+ String tomcatHome = context.getInitParameter("TomcatHome");
+
+ if (tomcatHome == null) {
+ log.warn("OrkTrack ContextInitialized(): TomcatHome context-param missing in web.xml");
+ } else {
+ TomcatServerXMLParser.setTomcatHome(tomcatHome);
+ log.info("OrkTrack ContextInitialized(): TomcatHome is set to " + tomcatHome);
+
+ // Parse Tomcat's server.xml file and set the audio and screen paths among other things
+ try {
+ TomcatServerXMLParser.parseServerXML(tomcatHome);
+ } catch (Exception e) {
+ log.error("OrkTrack ContextInitialized() error parsing server.xml at " + tomcatHome);
+ }
+ }
+
+ try{
+ //PortManager.instance().initialize();
+ OrkTrack.initialize(log4jConfigFile, hibernateConfigFile, configFile);
+ } catch (Throwable e){
+ log.error("OrkTrack ContextInitialized() threw exception",e);
+ }
+ }
+
+
+}
diff --git a/orktrack/src/net/sf/oreka/orktrack/test/InitMessageGenerator.java b/orktrack/src/main/java/net/sf/oreka/orktrack/test/InitMessageGenerator.java
similarity index 95%
rename from orktrack/src/net/sf/oreka/orktrack/test/InitMessageGenerator.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/test/InitMessageGenerator.java
index 1aca620b..b6cf6cf1 100644
--- a/orktrack/src/net/sf/oreka/orktrack/test/InitMessageGenerator.java
+++ b/orktrack/src/main/java/net/sf/oreka/orktrack/test/InitMessageGenerator.java
@@ -1,72 +1,72 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2017, orecx LLC
- *
- * http://www.orecx.com
- *
- */
-package net.sf.oreka.orktrack.test;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class InitMessageGenerator {
- private static StringBuffer msg = new StringBuffer();
- private static String hostName = "localhost";
-
- public static void main(String[] args) {
-
- InitMessageGenerator initMessageGenerator = new InitMessageGenerator();
- initMessageGenerator.setHostName("localhost");
-
- initMessageGenerator.sendURLRequest(initMessageGenerator.generateInitMessage());
- }
-
- public void sendURLRequest(String requestString) {
-
- // http://localhost:8080/orktrack/command?cmd=init
-
- String responseLine = "";
- StringBuffer responseSB = new StringBuffer();
-
- try {
- URL url = new URL(requestString);
- BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
-
- while ((responseLine = in.readLine()) != null) {
- responseSB.append(responseLine);
- }
- in.close();
-
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- System.out.println(responseSB.toString());
- }
-
- private StringBuffer getMessageBody() {
-
- msg = new StringBuffer();
- msg.append("http://").append(hostName).append(":8080/orktrack/command?cmd=init");
- return msg;
- }
-
- public String generateInitMessage() {
-
- StringBuffer sb = getMessageBody();
-
- System.out.println("Request: " + sb.toString());
-
- return sb.toString();
- }
-
- private void setHostName(String hostName) {
- InitMessageGenerator.hostName = hostName;
- }
-}
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2017, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ */
+package net.sf.oreka.orktrack.test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class InitMessageGenerator {
+ private static StringBuffer msg = new StringBuffer();
+ private static String hostName = "localhost";
+
+ public static void main(String[] args) {
+
+ InitMessageGenerator initMessageGenerator = new InitMessageGenerator();
+ initMessageGenerator.setHostName("localhost");
+
+ initMessageGenerator.sendURLRequest(initMessageGenerator.generateInitMessage());
+ }
+
+ public void sendURLRequest(String requestString) {
+
+ // http://localhost:8080/orktrack/command?cmd=init
+
+ String responseLine = "";
+ StringBuffer responseSB = new StringBuffer();
+
+ try {
+ URL url = new URL(requestString);
+ BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
+
+ while ((responseLine = in.readLine()) != null) {
+ responseSB.append(responseLine);
+ }
+ in.close();
+
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ System.out.println(responseSB.toString());
+ }
+
+ private StringBuffer getMessageBody() {
+
+ msg = new StringBuffer();
+ msg.append("http://").append(hostName).append(":8080/orktrack/command?cmd=init");
+ return msg;
+ }
+
+ public String generateInitMessage() {
+
+ StringBuffer sb = getMessageBody();
+
+ System.out.println("Request: " + sb.toString());
+
+ return sb.toString();
+ }
+
+ private void setHostName(String hostName) {
+ InitMessageGenerator.hostName = hostName;
+ }
+}
diff --git a/orktrack/src/net/sf/oreka/orktrack/test/PortTest.java b/orktrack/src/main/java/net/sf/oreka/orktrack/test/PortTest.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/test/PortTest.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/test/PortTest.java
diff --git a/orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java b/orktrack/src/main/java/net/sf/oreka/orktrack/test/ProgramTest.java
similarity index 100%
rename from orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java
rename to orktrack/src/main/java/net/sf/oreka/orktrack/test/ProgramTest.java
diff --git a/orktrack/src/main/resources/log4j2.xml b/orktrack/src/main/resources/log4j2.xml
new file mode 100644
index 00000000..927b3eae
--- /dev/null
+++ b/orktrack/src/main/resources/log4j2.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/orktrack/context/WEB-INF/web.xml b/orktrack/src/main/webapp/WEB-INF/web.xml
similarity index 60%
rename from orktrack/context/WEB-INF/web.xml
rename to orktrack/src/main/webapp/WEB-INF/web.xml
index 3316f3b0..5c924350 100644
--- a/orktrack/context/WEB-INF/web.xml
+++ b/orktrack/src/main/webapp/WEB-INF/web.xml
@@ -1,16 +1,18 @@
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+
orktrackConfigDirectory
- c:/oreka/
+ /etc/oreka/Log4jConfigFile
- logging.properties
+ logging.xmlConfigFile
@@ -22,26 +24,29 @@
TomcatHome
- C:/Program Files/Apache Software Foundation/Tomcat 7.0
+
-
- redirect
- org.apache.tapestry.RedirectFilter
-
-
- redirect
- /
-
- net.sf.oreka.orktrack.ContextListener
+ net.sf.oreka.orktrack.servlets.ContextListenercommand
- net.sf.oreka.orktrack.CommandServlet
+ net.sf.oreka.orktrack.servlets.CommandServlet1command/command
+
+
+ AccessLogFilter
+ net.sf.oreka.orktrack.servlets.AccessLogFilter
+
+
+
+ AccessLogFilter
+ /*
+
+
diff --git a/orktrack/src/net/sf/oreka/orktrack/CommandServlet.java b/orktrack/src/net/sf/oreka/orktrack/CommandServlet.java
deleted file mode 100644
index 2d8b7e0b..00000000
--- a/orktrack/src/net/sf/oreka/orktrack/CommandServlet.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Oreka -- A media capture and retrieval platform
- *
- * Copyright (C) 2005, orecx LLC
- *
- * http://www.orecx.com
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License.
- * Please refer to http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package net.sf.oreka.orktrack;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import net.sf.oreka.messages.AsyncMessage;
-import net.sf.oreka.messages.SimpleResponseMessage;
-import net.sf.oreka.messages.SyncMessage;
-import net.sf.oreka.serializers.ServletRequestSerializer;
-import net.sf.oreka.serializers.SingleLineSerializer;
-
-import org.apache.log4j.Logger;
-
-public class CommandServlet extends HttpServlet {
-
- static final long serialVersionUID = 1l;
- static Logger logger = Logger.getLogger(CommandServlet.class);
-
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
- {
- //#####OrkObjectFactory.instance().registerOrkObject(new TestMessage());
- OrkTrack.refreshInMemoryObjects();
-
- ServletRequestSerializer ser = new ServletRequestSerializer();
-
- try {
- SyncMessage obj = (SyncMessage)ser.deSerialize(request);
- AsyncMessage rsp = obj.process();
- SingleLineSerializer ser2 = new SingleLineSerializer();
- String req = ser2.serialize(obj);
- logger.debug("Request: " + req);
- PrintWriter out = response.getWriter();
- String resp = ser2.serialize(rsp);
- logger.debug("Reponse: " + resp);
- out.println(resp);
- }
- catch (Exception e) {
- logger.debug("Request: " + request.getQueryString());
- SimpleResponseMessage rsp = new SimpleResponseMessage();
- rsp.setComment(e.getMessage());
- rsp.setSuccess(false);
- SingleLineSerializer ser2 = new SingleLineSerializer();
- PrintWriter out = response.getWriter();
- try {
- String resp = ser2.serialize(rsp);
- logger.debug("Reponse: " + resp);
- out.println(resp);
- }
- catch (Exception ae) {
- logger.error("Error:" + ae.getMessage());
- }
- }
-
-// SingleLineSerializer ser2 = new SingleLineSerializer();
-// try {
-// OrkObject obj = ser.deSerialize(request);
-// response.setContentType("text/html");
-// PrintWriter out = response.getWriter();
-// out.println("");
-// out.println("");
-// out.println("Sucess");
-// out.println("");
-// out.println("");
-// out.println("