Package org.apache.axis2.util
Class ObjectStateUtils
- java.lang.Object
-
- org.apache.axis2.util.ObjectStateUtils
-
- All Implemented Interfaces:
ExternalizeConstants
public class ObjectStateUtils extends Object implements ExternalizeConstants
Utility to write, read and activate externalized Objects
-
-
Field Summary
Fields Modifier and Type Field Description static String
NULL_OBJECT
static String
UNSUPPORTED_REVID
static String
UNSUPPORTED_SUID
-
Fields inherited from interface org.apache.axis2.context.externalize.ExternalizeConstants
ACTIVE_OBJECT, EMPTY_MARKER, EMPTY_OBJECT, LAST_ENTRY, OBJ_RESTORE_PROBLEM, OBJ_SAVE_PROBLEM
-
-
Constructor Summary
Constructors Constructor Description ObjectStateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
findHandler(ArrayList existingHandlers, MetaDataEntry metaDataEntry)
Find the Handler object that matches the criteriastatic AxisMessage
findMessage(AxisOperation op, String msgName, String msgElementName)
Find the AxisMessage object that matches the criteriastatic AxisOperation
findOperation(AxisService service, String opClassName, QName opQName)
Find the AxisOperation object that matches the criteriastatic AxisOperation
findOperation(AxisConfiguration axisConfig, String opClassName, QName opQName)
Find the AxisOperation object that matches the criteriastatic AxisService
findService(AxisConfiguration axisConfig, String serviceClassName, String serviceName)
Find the AxisService object that matches the criteriastatic AxisServiceGroup
findServiceGroup(AxisConfiguration axisConfig, String serviceGrpClassName, String serviceGrpName)
Find the AxisServiceGroup object that matches the criteriastatic TransportListener
findTransportListener(AxisConfiguration axisConfig, String listenerClassName)
Find the TransportListener object that matches the criteriastatic boolean
isEquivalent(ArrayList a1, ArrayList a2, boolean strict)
Compares the two collections to see if they are equivalent.static boolean
isEquivalent(LinkedList l1, LinkedList l2)
Compares the two collections to see if they are equivalent.static boolean
isEquivalent(Map m1, Map m2, boolean strict)
Compares the two collections to see if they are equivalent.static ArrayList
readArrayList(ObjectInput i, String desc)
Reads an array of objects from the specified input stream.static HashMap
readHashMap(ObjectInput i, String desc)
Read a hashmap of objects from the specified input stream.static LinkedList
readLinkedList(ObjectInput i, String desc)
Reads a linked list of objects from the specified input stream.static Object
readObject(ObjectInput i, String desc)
Read an object from the specified input stream.static String
readString(ObjectInput i, String desc)
Read a string from the specified input stream.static void
writeArrayList(ObjectOutput o, ArrayList al, String desc)
Write an array of objects to the specified output stream.static void
writeHashMap(ObjectOutput o, HashMap map, String desc)
Write a hashmap of objects to the specified output stream.static void
writeLinkedList(ObjectOutput o, LinkedList objlist, String desc)
Write a linked list of objects to the specified output stream.static void
writeObject(ObjectOutput o, Object obj, String desc)
Write an object to the specified output stream.static void
writeString(ObjectOutput o, String str, String desc)
Write a string to the specified output stream.
-
-
-
Field Detail
-
NULL_OBJECT
public static String NULL_OBJECT
-
UNSUPPORTED_SUID
public static final String UNSUPPORTED_SUID
- See Also:
- Constant Field Values
-
UNSUPPORTED_REVID
public static final String UNSUPPORTED_REVID
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeString
public static void writeString(ObjectOutput o, String str, String desc) throws IOException
Write a string to the specified output stream.- Parameters:
o
- The output streamstr
- The string to writedesc
- A text description to use for logging- Throws:
IOException
- Exception
-
readString
public static String readString(ObjectInput i, String desc) throws IOException, ClassNotFoundException
Read a string from the specified input stream. Returns null if no string is available.- Parameters:
i
- The input streamdesc
- A text description to use for logging- Returns:
- The string or null, if not available
- Throws:
IOException
ClassNotFoundException
-
writeObject
public static void writeObject(ObjectOutput o, Object obj, String desc) throws IOException
Write an object to the specified output stream.- Parameters:
o
- The output streamobj
- The object to writedesc
- A text description to use for logging- Throws:
IOException
- Exception
-
readObject
public static Object readObject(ObjectInput i, String desc) throws IOException, ClassNotFoundException
Read an object from the specified input stream. Returns null if no object is available.- Parameters:
i
- The input streamdesc
- A text description to use for logging- Returns:
- The object or null, if not available
- Throws:
IOException
ClassNotFoundException
-
writeArrayList
public static void writeArrayList(ObjectOutput o, ArrayList al, String desc) throws IOException
Write an array of objects to the specified output stream. NOTE: each object in the array should implement either java.io.Serializable or java.io.Externalizable in order to be saved- Parameters:
o
- The output streamal
- The ArrayList to writedesc
- A text description to use for logging- Throws:
IOException
- Exception
-
readArrayList
public static ArrayList readArrayList(ObjectInput i, String desc) throws IOException
Reads an array of objects from the specified input stream. Returns null if no array is available. NOTE: each object in the array should implement either java.io.Serializable or java.io.Externalizable in order to be saved- Parameters:
i
- The input streamdesc
- A text description to use for logging- Returns:
- The ArrayList or null, if not available
- Throws:
IOException
ClassNotFoundException
-
writeHashMap
public static void writeHashMap(ObjectOutput o, HashMap map, String desc) throws IOException
Write a hashmap of objects to the specified output stream. NOTE: each object in the map should implement either java.io.Serializable or java.io.Externalizable in order to be saved- Parameters:
o
- The output streammap
- The HashMap to writedesc
- A text description to use for logging- Throws:
IOException
- Exception
-
readHashMap
public static HashMap readHashMap(ObjectInput i, String desc) throws IOException
Read a hashmap of objects from the specified input stream. Returns null if no hashmap is available.- Parameters:
in
- The input streamdesc
- A text description to use for logging- Returns:
- The HashMap or null, if not available
- Throws:
IOException
ClassNotFoundException
-
writeLinkedList
public static void writeLinkedList(ObjectOutput o, LinkedList objlist, String desc) throws IOException
Write a linked list of objects to the specified output stream.- Parameters:
o
- The output streamlist
- The LinkedList to writedesc
- A text description to use for logging- Throws:
IOException
- Exception
-
readLinkedList
public static LinkedList readLinkedList(ObjectInput i, String desc) throws IOException
Reads a linked list of objects from the specified input stream. Returns null if no array is available.- Parameters:
in
- The input streamdesc
- A text description to use for logging- Returns:
- The linked list or null, if not available
- Throws:
IOException
ClassNotFoundException
-
findOperation
public static AxisOperation findOperation(AxisConfiguration axisConfig, String opClassName, QName opQName)
Find the AxisOperation object that matches the criteria- Parameters:
axisConfig
- The AxisConfiguration objectopClassName
- the class name string for the target object (could be a derived class)opQName
- the name associated with the operation- Returns:
- the AxisOperation object that matches the given criteria
-
findOperation
public static AxisOperation findOperation(AxisService service, String opClassName, QName opQName)
Find the AxisOperation object that matches the criteria- Parameters:
service
- The AxisService objectopClassName
- The class name string for the target object (could be a derived class)opQName
- the name associated with the operation- Returns:
- the AxisOperation object that matches the given criteria
-
findService
public static AxisService findService(AxisConfiguration axisConfig, String serviceClassName, String serviceName)
Find the AxisService object that matches the criteria- Parameters:
axisConfig
- The AxisConfiguration objectserviceClassName
- the class name string for the target object (could be a derived class)serviceName
- the name associated with the service- Returns:
- the AxisService object that matches the criteria
-
findServiceGroup
public static AxisServiceGroup findServiceGroup(AxisConfiguration axisConfig, String serviceGrpClassName, String serviceGrpName)
Find the AxisServiceGroup object that matches the criteria Note the saved service group meta information may not match up with any of the serviceGroups that are in the current AxisConfiguration object.- Parameters:
axisConfig
- The AxisConfiguration objectserviceGrpClassName
- the class name string for the target object (could be a derived class)serviceGrpName
- the name associated with the service group- Returns:
- the AxisServiceGroup object that matches the criteria
-
findMessage
public static AxisMessage findMessage(AxisOperation op, String msgName, String msgElementName)
Find the AxisMessage object that matches the criteria- Parameters:
op
- The AxisOperation objectmsgName
- The name associated with the messagemsgElementName
- The name associated with the message element- Returns:
- the AxisMessage object that matches the given criteria
-
findHandler
public static Object findHandler(ArrayList existingHandlers, MetaDataEntry metaDataEntry)
Find the Handler object that matches the criteria- Parameters:
existingHandlers
- The list of existing handlers and phaseshandlerClassName
- the class name string for the target object (could be a derived class)- Returns:
- the Handler object that matches the criteria
-
findTransportListener
public static TransportListener findTransportListener(AxisConfiguration axisConfig, String listenerClassName)
Find the TransportListener object that matches the criteria Note the saved meta information may not match up with any of the objects that are in the current AxisConfiguration object.- Parameters:
axisConfig
- The AxisConfiguration objectlistenerClassName
- the class name string for the target object (could be a derived class)- Returns:
- the TransportListener object that matches the criteria
-
isEquivalent
public static boolean isEquivalent(ArrayList a1, ArrayList a2, boolean strict)
Compares the two collections to see if they are equivalent.- Parameters:
a1
- The first collectiona2
- The second collectionstrict
- Indicates whether strict checking is required. Strict checking means that the two collections must have the same elements in the same order. Non-strict checking means that the two collections must have the same elements, but the order is not significant.- Returns:
- TRUE if the two collections are equivalent FALSE, otherwise
-
isEquivalent
public static boolean isEquivalent(Map m1, Map m2, boolean strict)
Compares the two collections to see if they are equivalent.- Parameters:
m1
- The first collectionm2
- The second collectionstrict
- Indicates whether strict checking is required. Strict checking means that the two collections must have the same mappings. Non-strict checking means that the two collections must have the same keys. In both cases, the order is not significant.- Returns:
- TRUE if the two collections are equivalent FALSE, otherwise
-
isEquivalent
public static boolean isEquivalent(LinkedList l1, LinkedList l2)
Compares the two collections to see if they are equivalent.- Parameters:
l1
- The first collectionl2
- The second collection- Returns:
- TRUE if the two collections are equivalent FALSE, otherwise
-
-