AnsweredAssumed Answered

Delete Alfresco Benchmark's Special ContentStore

Question asked by adelatorre on Dec 23, 2010
Hi:

I would like to know, how to delete content stores created by Server Benchmark ran in a production environment.

FileFolderRemoteLoader://

FileFolderRemoteLoader://TEST-01
FileFolderRemoteLoader://TEST-03
FileFolderRemoteLoader://TEST-02
FileFolderRemoteLoader://TEST-05
FileFolderRemoteLoader://TEST-04


The Alfresco Support says me to use:

NodeService.deleteStore(StoreRef);


But with this example:

/**
* Benchmark para JCCM
*
* by Entel
*/


package bm;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.apache.log4j.Logger;
import org.springframework.extensions.webscripts.AbstractWebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;

public class BorrarBMStore extends AbstractWebScript
{
   private static Logger log4j = Logger.getLogger(BorrarBMStore.class);

    ServiceRegistry serviceRegistry;

   public ServiceRegistry getServiceRegistry() {
      return serviceRegistry;
   }

   public void setServiceRegistry(ServiceRegistry serviceRegistry) {
      this.serviceRegistry = serviceRegistry;
   }

   
    public void execute(WebScriptRequest req, WebScriptResponse res)
        throws IOException
    {       
      log4j.debug("Entrando en servicio: " + this.getClass().getName());
      
      // entrada
      String protocol = req.getParameter("prot");
      String identifier = req.getParameter("ident");
      log4j.debug("protocolo: "+protocol+". identifier: "+identifier);
      
      // core
      NodeService nodeService = serviceRegistry.getNodeService();      
      // FileFolderRemoteLoader://TEST01
      nodeService.deleteStore(new StoreRef(protocol, identifier));

      // salida
      String resultado = "ok";
      Map<String, Object> model = new HashMap<String, Object>();
      String templatePath = "bm/borrarBMStore.get.html.ftl";
      model.put("resultado", resultado);   
      Writer writer = new OutputStreamWriter(res.getOutputStream(), "UTF-8") ;
      renderTemplate(templatePath, model, writer);      
      
      log4j.debug("Saliendo en servicio: " + this.getClass().getName());
    }
}


but I return this error


17:50:54,384 User:admin DEBUG [bm.BorrarBMStore] Entrando en servicio: bm.BorrarBMStore
17:50:54,392 User:admin DEBUG [bm.BorrarBMStore] protocolo: FileFolderRemoteLoader. identifier: TEST0
17:50:54,422  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 10300001 Access Denied.  You do not have the appropriate permissions to perform this operation.
org.alfresco.repo.security.permissions.AccessDeniedException: 10300001 Access Denied.  You do not have the appropriate permissions to perform this operation.
    at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:47)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:135)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy10.deleteStore(Unknown Source)
    at bm.BorrarBMStore.execute(BorrarBMStore.java:52)
    at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:373)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:325)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:424)
    at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:448)
    at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:294)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
    at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
    at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:116)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process


Any idea?

Is possible to delete a contentstore?

The solution anyway could be, make a backup before run benchmark and restore it after it.

Thanks,

Antonio

Outcomes