Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/314#discussion_r20349081
  
    --- Diff: 
usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java ---
    @@ -268,4 +294,31 @@ public String getUser() {
             }
         }
     
    +    @Override
    +    public Response exportPersistenceData(String preferredOrigin) {
    +        return exportPersistenceData(TypeCoercions.coerce(preferredOrigin, 
MementoCopyMode.class));
    +    }
    +    
    +    protected Response exportPersistenceData(MementoCopyMode 
preferredOrigin) {
    +        if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), 
Entitlements.SEE_ALL_SERVER_INFO, null))
    +            throw WebResourceUtils.unauthorized("User '%s' is not 
authorized for this operation", Entitlements.getEntitlementContext().user());
    +
    +        try {
    +            String label = 
mgmt().getManagementNodeId()+"-"+Time.makeDateSimpleStampString();
    +            PersistenceObjectStore targetStore = 
BrooklynPersistenceUtils.newPersistenceObjectStore(mgmt(), null, 
    +                "web-persistence-"+label+"-"+Identifiers.makeRandomId(4));
    +            BrooklynPersistenceUtils.writeMemento(mgmt(), targetStore, 
preferredOrigin);            
    +            
    +            ByteArrayOutputStream baos = new ByteArrayOutputStream();
    +            ArchiveBuilder.zip().addDirContentsAt( 
((FileBasedObjectStore)targetStore).getBaseDir(), "/" ).stream(baos);
    --- End diff --
    
    * Still getting an empty archive. If I open it with another unzip app then 
I get a subfolder with no name which contains the files along with another 
empty subfolder.
    
    * When replacing "/" with "" then the default unzip app shows the files at 
top level, but when opening with the alternative app (7Zip) I still get the 
empty subfolder.
    
    * Replacing "/" with getBaseDir().getName() seems to work the best - no 
unexpected phantom folders, works with the default Windows unzip app.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to