org.apache.jackrabbit.core.value
Class InternalValue

java.lang.Object
  extended by org.apache.jackrabbit.core.value.InternalValue

public class InternalValue
extends Object

InternalValue represents the internal format of a property value.

The following table specifies the internal format for every property type:

 PropertyTypeSTRINGLONGDOUBLEDATEBOOLEANNAMEPATHBINARYREFERENCE
Internal Format
String
Long
Double
Calendar
Boolean
Name
Path
BLOBFileValue
UUID


Field Summary
static InternalValue[] EMPTY_ARRAY
           
static boolean USE_DATA_STORE
          If set to 'true', the data store is used when configured in repository.xml
 
Method Summary
static InternalValue create(boolean value)
           
static InternalValue create(byte[] value)
           
static InternalValue create(Calendar value)
           
static InternalValue create(DataStore store, String id)
          Create a binary object with the given identifier.
static InternalValue create(double value)
           
static InternalValue create(File value)
           
static InternalValue create(FileSystemResource value)
           
static InternalValue create(InputStream value)
           
static InternalValue create(long value)
           
static InternalValue create(Name value)
           
static InternalValue[] create(Name[] values)
           
static InternalValue create(Path value)
           
static InternalValue create(String value)
           
static InternalValue[] create(String[] values)
           
static InternalValue create(UUID value)
           
static InternalValue create(Value value, NamePathResolver resolver)
          Create a new internal value from the given JCR value.
static InternalValue create(Value value, NamePathResolver resolver, DataStore store)
          Create a new internal value from the given JCR value.
 InternalValue createCopy()
           
static InternalValue createTemporary(InputStream value)
          Create an internal value that is backed by a temporary file.
static InternalValue createTemporary(InputStream value, DataStore store)
          Create an internal value that is backed by a temporary file (if data store usage is disabled or the store is null) or in the data store if it is not null and enabled.
 boolean equals(Object obj)
          
 BLOBFileValue getBLOBFileValue()
           
 boolean getBoolean()
           
 Calendar getDate()
           
 double getDouble()
           
 long getLong()
           
 Path getPath()
           
 Name getQName()
           
 String getString()
           
 int getType()
           
 UUID getUUID()
           
 int hashCode()
          
 Object internalValue()
          Deprecated.  
 void store(DataStore dataStore)
           
 Value toJCRValue(NamePathResolver resolver)
           
 String toString()
          Returns the string representation of this internal value.
static InternalValue valueOf(String s, int type)
          Parses the given string as an InternalValue of the specified type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final InternalValue[] EMPTY_ARRAY

USE_DATA_STORE

public static final boolean USE_DATA_STORE
If set to 'true', the data store is used when configured in repository.xml

Method Detail

create

public static InternalValue create(Value value,
                                   NamePathResolver resolver)
                            throws ValueFormatException,
                                   RepositoryException
Create a new internal value from the given JCR value. Large binary values are stored in a temporary file.

Parameters:
value - the JCR value
resolver -
Returns:
the created internal value
Throws:
ValueFormatException
RepositoryException

create

public static InternalValue create(Value value,
                                   NamePathResolver resolver,
                                   DataStore store)
                            throws ValueFormatException,
                                   RepositoryException
Create a new internal value from the given JCR value. If the data store is enabled, large binary values are stored in the data store.

Parameters:
value - the JCR value
resolver -
store - the data store
Returns:
the created internal value
Throws:
ValueFormatException
RepositoryException

create

public static InternalValue create(String value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(long value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(double value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(Calendar value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(boolean value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(byte[] value)
Parameters:
value -
Returns:
the created value

createTemporary

public static InternalValue createTemporary(InputStream value)
                                     throws RepositoryException
Create an internal value that is backed by a temporary file.

Parameters:
value - the stream
store - the data store
Returns:
the internal value
Throws:
RepositoryException

createTemporary

public static InternalValue createTemporary(InputStream value,
                                            DataStore store)
                                     throws RepositoryException
Create an internal value that is backed by a temporary file (if data store usage is disabled or the store is null) or in the data store if it is not null and enabled.

Parameters:
value - the stream
store - the data store or null to use a temporary file
Returns:
the internal value
Throws:
RepositoryException

create

public static InternalValue create(InputStream value)
                            throws RepositoryException
Parameters:
value -
temp -
Returns:
Throws:
IOException
RepositoryException

create

public static InternalValue create(FileSystemResource value)
                            throws IOException
Parameters:
value -
Returns:
Throws:
IOException

create

public static InternalValue create(File value)
                            throws IOException
Parameters:
value -
Returns:
Throws:
IOException

create

public static InternalValue create(DataStore store,
                                   String id)
Create a binary object with the given identifier.

Parameters:
store - the data store
id - the identifier
Returns:
the value

create

public static InternalValue create(Name value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue[] create(Name[] values)
Parameters:
values -
Returns:
the created value

create

public static InternalValue[] create(String[] values)
Parameters:
values -
Returns:
the created value

create

public static InternalValue create(Path value)
Parameters:
value -
Returns:
the created value

create

public static InternalValue create(UUID value)
Parameters:
value -
Returns:
the created value

toJCRValue

public Value toJCRValue(NamePathResolver resolver)
                 throws RepositoryException
Parameters:
resolver -
Returns:
Throws:
RepositoryException

internalValue

public Object internalValue()
Deprecated. 

Returns:
the internal object

getBLOBFileValue

public BLOBFileValue getBLOBFileValue()

getUUID

public UUID getUUID()

getBoolean

public boolean getBoolean()

getQName

public Name getQName()

getPath

public Path getPath()

getLong

public long getLong()

getDouble

public double getDouble()

getDate

public Calendar getDate()

getString

public String getString()

getType

public int getType()
Returns:
the type

createCopy

public InternalValue createCopy()
                         throws RepositoryException
Returns:
Throws:
RepositoryException

valueOf

public static InternalValue valueOf(String s,
                                    int type)
Parses the given string as an InternalValue of the specified type. The string must be in the format returned by the InternalValue.toString() method.

Parameters:
s - a String containing the InternalValue representation to be parsed.
type -
Returns:
the InternalValue represented by the arguments
Throws:
IllegalArgumentException - if the specified string can not be parsed as an InternalValue of the specified type.
See Also:
toString()

toString

public String toString()
Returns the string representation of this internal value.

Overrides:
toString in class Object
Returns:
string representation of this internal value

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

store

public void store(DataStore dataStore)
           throws RepositoryException,
                  IOException
Throws:
RepositoryException
IOException


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.