document/src/main/java/org/apache/servicemix/document/impl/blueprint/BlueprintDocumentFactory.java [47:75]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public void setRepository(DocumentRepository repository) {
        this.repository = repository;
    }

    public void afterPropertiesSet() throws Exception {
        if (document == null) {
            throw new IllegalStateException("document must be set");
        }
        if (repository != null) {
            this.documentId = repository.register(document.getBytes());
        } else if (bundleContext != null) {
            ServiceReference ref = bundleContext.getServiceReference(DocumentRepository.class.getName());
            if (ref == null) {
                throw new IllegalStateException("Can not get a reference to the DocumentRepository");
            }
            try {
                DocumentRepository rep = (DocumentRepository) bundleContext.getService(ref);
                this.documentId = rep.register(document.getBytes());
            } finally {
                if (ref != null) {
                    bundleContext.ungetService(ref);
                }
            }
        } else {
            throw new IllegalStateException("repoitory or bundleContext must be set");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



document/src/main/java/org/apache/servicemix/document/impl/spring/SpringDocumentFactory.java [73:101]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public void setRepository(DocumentRepository repository) {
        this.repository = repository;
    }

    public void afterPropertiesSet() throws Exception {
        if (document == null) {
            throw new IllegalStateException("document must be set");
        }
        if (repository != null) {
            this.documentId = repository.register(document.getBytes());
        } else if (bundleContext != null) {
            ServiceReference ref = bundleContext.getServiceReference(DocumentRepository.class.getName());
            if (ref == null) {
                throw new IllegalStateException("Can not get a reference to the DocumentRepository");
            }
            try {
                DocumentRepository rep = (DocumentRepository) bundleContext.getService(ref);
                this.documentId = rep.register(document.getBytes());
            } finally {
                if (ref != null) {
                    bundleContext.ungetService(ref);
                }
            }
        } else {
            throw new IllegalStateException("repoitory or bundleContext must be set");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



