Package org.apache.jackrabbit.core.state

Examples of org.apache.jackrabbit.core.state.ItemStateException


            e = fse;
            // fall through
        }
        String msg = "failed to read property state: " + id.toString();
        log.debug(msg);
        throw new ItemStateException(msg, e);
    }
View Full Code Here


                writer.close();
            }
        } catch (Exception e) {
            String msg = "failed to write node state: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, e);
        }
    }
View Full Code Here

                int type = state.getType();
                try {
                    typeName = PropertyType.nameFromValue(type);
                } catch (IllegalArgumentException iae) {
                    // should never be getting here
                    throw new ItemStateException("unexpected property-type ordinal: " + type, iae);
                }

                writer.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
                writer.write("<" + PROPERTY_ELEMENT + " "
                        + NAME_ATTRIBUTE + "=\"" + Text.encodeIllegalXMLCharacters(state.getName().toString()) + "\" "
                        + PARENTUUID_ATTRIBUTE + "=\"" + state.getParentId() + "\" "
                        + MULTIVALUED_ATTRIBUTE + "=\"" + Boolean.toString(state.isMultiValued()) + "\" "
                        + DEFINITIONID_ATTRIBUTE + "=\"" + state.getDefinitionId().toString() + "\" "
                        + MODCOUNT_ATTRIBUTE + "=\"" + state.getModCount() + "\" "
                        + TYPE_ATTRIBUTE + "=\"" + typeName + "\">\n");
                // values
                writer.write("\t<" + VALUES_ELEMENT + ">\n");
                InternalValue[] values = state.getValues();
                if (values != null) {
                    for (int i = 0; i < values.length; i++) {
                        writer.write("\t\t<" + VALUE_ELEMENT + ">");
                        InternalValue val = values[i];
                        if (val != null) {
                            if (type == PropertyType.BINARY) {
                                // special handling required for binary value:
                                // put binary value in BLOB store
                                InputStream in = val.getStream();
                                String blobId = blobStore.createId(state.getPropertyId(), i);
                                try {
                                    blobStore.put(blobId, in, val.getLength());
                                } finally {
                                    IOUtils.closeQuietly(in);
                                }
                                // store id of BLOB as property value
                                writer.write(blobId);
                                // replace value instance with value backed by resource
                                // in BLOB store and discard old value instance (e.g. temp file)
                                if (blobStore instanceof ResourceBasedBLOBStore) {
                                    // optimization: if the BLOB store is resource-based
                                    // retrieve the resource directly rather than having
                                    // to read the BLOB from an input stream
                                    FileSystemResource fsRes =
                                            ((ResourceBasedBLOBStore) blobStore).getResource(blobId);
                                    values[i] = InternalValue.create(fsRes);
                                } else {
                                    in = blobStore.get(blobId);
                                    try {
                                        values[i] = InternalValue.create(in);
                                    } finally {
                                        try {
                                            in.close();
                                        } catch (IOException e) {
                                            // ignore
                                        }
                                    }
                                }
                                val.discard();
                            } else {
                                writer.write(Text.encodeIllegalXMLCharacters(val.toString()));
                            }
                        }
                        writer.write("</" + VALUE_ELEMENT + ">\n");
                    }
                }
                writer.write("\t</" + VALUES_ELEMENT + ">\n");
                writer.write("</" + PROPERTY_ELEMENT + ">\n");
            } finally {
                writer.close();
            }
        } catch (Exception e) {
            String msg = "failed to store property state: " + state.getParentId() + "/" + state.getName();
            log.debug(msg);
            throw new ItemStateException(msg, e);
        }
    }
View Full Code Here

                nodeFile.delete(true);
            }
        } catch (FileSystemException fse) {
            String msg = "failed to delete node state: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, fse);
        }
    }
View Full Code Here

                propFile.delete(true);
            }
        } catch (FileSystemException fse) {
            String msg = "failed to delete property state: " + state.getParentId() + "/" + state.getName();
            log.debug(msg);
            throw new ItemStateException(msg, fse);
        }
    }
View Full Code Here

            e = fse;
            // fall through
        }
        String msg = "failed to load references: " + id;
        log.debug(msg);
        throw new ItemStateException(msg, e);
    }
View Full Code Here

                writer.close();
            }
        } catch (Exception e) {
            String msg = "failed to store references: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, e);
        }
    }
View Full Code Here

                refsFile.delete(true);
            }
        } catch (FileSystemException fse) {
            String msg = "failed to delete references: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, fse);
        }
    }
View Full Code Here

            FileSystemResource nodeFile = new FileSystemResource(itemStateFS, nodeFilePath);
            return nodeFile.exists();
        } catch (FileSystemException fse) {
            String msg = "failed to check existence of item state: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, fse);
        }
    }
View Full Code Here

            FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
            return propFile.exists();
        } catch (FileSystemException fse) {
            String msg = "failed to check existence of item state: " + id;
            log.error(msg, fse);
            throw new ItemStateException(msg, fse);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.state.ItemStateException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.