obixserver.util
Class ObjUtil

java.lang.Object
  extended by obixserver.util.ObjUtil

public class ObjUtil
extends Object

Utility class for Obj manipulation.


Field Summary
static obix.Contract CONTRACT_ALARM
           
static obix.Contract CONTRACT_ALARM_QUERY_OUT
           
static obix.Contract CONTRACT_ALARMFILTER
           
static obix.Contract CONTRACT_ALL_ALARM
           
static obix.Contract CONTRACT_BAD_URI
           
static obix.Contract CONTRACT_NIL
           
static obix.Contract CONTRACT_OBJ
           
static obix.Contract CONTRACT_PERMISSION
           
static obix.Contract CONTRACT_POINT_ALARM
           
static obix.Contract CONTRACT_POINT_STATEFUL_ALARM
           
static obix.Contract CONTRACT_STATEFUL_ALARM
           
static obix.Contract CONTRACT_UNSUPPORTED
           
static obix.Contract CONTRACT_WATCH
           
static String CONTRACT_WATCH_SERVICE_URI
           
static String CONTRACT_WATCH_URI
           
static obix.Contract CONTRACT_WATCHIN
           
static obix.Contract CONTRACT_WATCHOUT
           
static Logger logger
           
static String WATCH_SERVICE_URI
           
 
Constructor Summary
ObjUtil()
           
 
Method Summary
static obix.Obj cloneInstance(obix.Obj src, boolean nullName)
          Clone an obj instance without the subtree.
static obix.Obj cloneObj(obix.Obj src)
          Clone an object without setting kids and parent from the source obj.
static obix.Obj cloneObj(obix.Obj src, boolean nullName)
          Clone an object without setting kids and parent from the source obj.
static obix.Obj cloneObjTree(obix.Obj src)
          Clone an object, including it's children.
static obix.Obj cloneObjTree(obix.Obj src, boolean doTree, boolean nullName)
          Clone an object, possibly setting kids and parent from the source obj.
static obix.Obj cloneObjTreeNullNameRoot(obix.Obj src, boolean doTree, boolean nullName)
          Clone an object, possibly setting kids and parent from the source obj.
static void copyObjTreeValues(obix.Obj src, obix.Obj dst)
          Copy Obj tree.
static void copyObjValue(obix.Obj src, obix.Obj dst)
          Copies Obj value from src to dst.
static obix.Err createBadUriErr(obix.Uri uri)
          Creates an Err with the contract obix:BadUriErr
static obix.Err createPermissionErr(obix.Uri uri)
          Creates an Err with the contract obix:PermissionErr
static obix.Err createUnsupportedErr(obix.Uri uri)
          Creates an Err with the contract obix:PermissionErr
static void ensureHrefForTree(obix.Obj obj)
           
static String getLeafName(obix.Uri uri)
          Returns the 'leaf name' of a path.
static String getParentPath(obix.Uri uri)
          Returns the path of parent Obj in full relative path.
static obix.Obj loadFromResource(String file)
          Loads objects from a resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger

CONTRACT_BAD_URI

public static final obix.Contract CONTRACT_BAD_URI

CONTRACT_PERMISSION

public static final obix.Contract CONTRACT_PERMISSION

CONTRACT_UNSUPPORTED

public static final obix.Contract CONTRACT_UNSUPPORTED

CONTRACT_WATCHIN

public static final obix.Contract CONTRACT_WATCHIN

CONTRACT_WATCHOUT

public static final obix.Contract CONTRACT_WATCHOUT

CONTRACT_NIL

public static final obix.Contract CONTRACT_NIL

CONTRACT_WATCH

public static final obix.Contract CONTRACT_WATCH

CONTRACT_OBJ

public static final obix.Contract CONTRACT_OBJ

CONTRACT_WATCH_URI

public static final String CONTRACT_WATCH_URI
See Also:
Constant Field Values

CONTRACT_WATCH_SERVICE_URI

public static final String CONTRACT_WATCH_SERVICE_URI
See Also:
Constant Field Values

CONTRACT_POINT_ALARM

public static final obix.Contract CONTRACT_POINT_ALARM

CONTRACT_STATEFUL_ALARM

public static final obix.Contract CONTRACT_STATEFUL_ALARM

CONTRACT_ALARM

public static final obix.Contract CONTRACT_ALARM

CONTRACT_ALL_ALARM

public static final obix.Contract CONTRACT_ALL_ALARM

CONTRACT_POINT_STATEFUL_ALARM

public static final obix.Contract CONTRACT_POINT_STATEFUL_ALARM

CONTRACT_ALARMFILTER

public static final obix.Contract CONTRACT_ALARMFILTER

CONTRACT_ALARM_QUERY_OUT

public static final obix.Contract CONTRACT_ALARM_QUERY_OUT

WATCH_SERVICE_URI

public static final String WATCH_SERVICE_URI
See Also:
Constant Field Values
Constructor Detail

ObjUtil

public ObjUtil()
Method Detail

cloneObj

public static obix.Obj cloneObj(obix.Obj src)
Clone an object without setting kids and parent from the source obj.

Parameters:
src - source Obj
Returns:
cloned object, or an Err obj if couldn't clone.

cloneObj

public static obix.Obj cloneObj(obix.Obj src,
                                boolean nullName)
Clone an object without setting kids and parent from the source obj.

Parameters:
nullName - if true, don't copy name
src - source Obj
Returns:
cloned object, or an Err obj if couldn't clone.

cloneInstance

public static obix.Obj cloneInstance(obix.Obj src,
                                     boolean nullName)
Clone an obj instance without the subtree.

Parameters:
src -
nullName -
Returns:
cloned Obj

cloneObjTree

public static obix.Obj cloneObjTree(obix.Obj src)
Clone an object, including it's children. Set also names of obj's.

Parameters:
src - source Obj
Returns:
cloned object tree, or an Err obj if couldn't clone.

cloneObjTree

public static obix.Obj cloneObjTree(obix.Obj src,
                                    boolean doTree,
                                    boolean nullName)
Clone an object, possibly setting kids and parent from the source obj.

Parameters:
src - source Obj
doTree - perform deep cloning, cloning also children
nullName - if true, don't copy name
Returns:
cloned object, or an Err obj if couldn't clone.

cloneObjTreeNullNameRoot

public static obix.Obj cloneObjTreeNullNameRoot(obix.Obj src,
                                                boolean doTree,
                                                boolean nullName)
Clone an object, possibly setting kids and parent from the source obj. Root of cloned tree has name null, rest of tree has name as specified by nullName.

Parameters:
src - source Obj
doTree - perform deep cloning, cloning also children
nullName - if true, don't copy name
Returns:
cloned object, or an Err obj if couldn't clone.

copyObjValue

public static void copyObjValue(obix.Obj src,
                                obix.Obj dst)
Copies Obj value from src to dst. If type is Obj (no value available), then this is a noop. Only a subset of the whole range of Obj is supported, and that is only those Objs that have values plus the mast 'Obj' itself.

Parameters:
src -
dst -

copyObjTreeValues

public static void copyObjTreeValues(obix.Obj src,
                                     obix.Obj dst)
Copy Obj tree. Throws exception if any item has mismatched between the src and dst Obj type. However, if a dst child item doesn't exist, it is created in the dst tree. This function is recursive.

Parameters:
src -
dst -

loadFromResource

public static obix.Obj loadFromResource(String file)
Loads objects from a resource. The resource files has to be on the classpath.

Parameters:
file -
Returns:
Obj tree as loaded from resource.
Throws:
ObixserverException

createBadUriErr

public static obix.Err createBadUriErr(obix.Uri uri)
Creates an Err with the contract obix:BadUriErr

Parameters:
uri -

createPermissionErr

public static obix.Err createPermissionErr(obix.Uri uri)
Creates an Err with the contract obix:PermissionErr

Parameters:
uri -

createUnsupportedErr

public static obix.Err createUnsupportedErr(obix.Uri uri)
Creates an Err with the contract obix:PermissionErr

Parameters:
uri -

getParentPath

public static String getParentPath(obix.Uri uri)
Returns the path of parent Obj in full relative path. E.g. parent of /obix/serverTime/ is /obix/

Parameters:
uri -
Returns:
parent URI.

getLeafName

public static String getLeafName(obix.Uri uri)
Returns the 'leaf name' of a path. e.g. for path /obix/serverTime/ the leaf name is serverTime

Parameters:
uri -
Returns:
leaf name.

ensureHrefForTree

public static void ensureHrefForTree(obix.Obj obj)


Copyright © 2006-2008 Peter Michalek All Rights Reserved.