private void update()

in src/main/java/org/apache/sling/installer/core/impl/RegisteredResourceImpl.java [548:585]


    private void update(final TransformationResult tr)
    throws IOException {
        final InputStream is = tr.getInputStream();
        if ( tr.getResourceType() != null ) {
            this.resourceType = tr.getResourceType();
            if ( tr.getId() != null ) {
                this.entity = this.resourceType + ':' + tr.getId();
            } else {
                if ( !InstallableResource.TYPE_FILE.equals(this.getType())
                      && !InstallableResource.TYPE_PROPERTIES.equals(this.getType()) ) {

                    String lastIdPart = this.getURL();
                    final int slashPos = lastIdPart.lastIndexOf('/');
                    if ( slashPos != -1 ) {
                        lastIdPart = lastIdPart.substring(slashPos + 1);
                    }
                    this.entity = this.resourceType + ':' + lastIdPart;
                }
            }
        }
        if ( is != null ) {
            try {
                final File newDataFile = FileDataStore.SHARED.createNewDataFile(this.getType(), is);
                this.removeDataFile();
                this.dataFile = newDataFile;
            } finally {
                try {
                    is.close();
                } catch (final IOException ignore) {}
            }
        }
        if ( tr.getAttributes() != null ) {
            this.attributes.putAll(tr.getAttributes());
        }
        if ( tr.getVersion() != null ) {
            this.attributes.put(Constants.BUNDLE_VERSION, tr.getVersion().toString());
        }
    }