Examples of LifecycleManager


Examples of org.apache.axiom.attachments.lifecycle.LifecycleManager

         if (log.isDebugEnabled()) {
               log.debug("Entering deleteAttachments()");
           }
          
         Attachments attachments = msgContext.getAttachmentMap();
         LifecycleManager lcm = (LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
           if (attachments != null) {
               // Get the list of Content IDs for the attachments...but does not try to pull the stream for new attachments.
               // (Pulling the stream for new attachments will probably fail...the stream is probably closed)
               List keys = attachments.getContentIDList();
               if (keys != null) {
                 String key = null;
                 File file = null;
                 DataSource dataSource = null;
                   for (int i = 0; i < keys.size(); i++) {
                       try {
                           key = (String) keys.get(i);
                           dataSource = attachments.getDataHandler(key).getDataSource();
                           if(dataSource instanceof CachedFileDataSource){
                             file = ((CachedFileDataSource)dataSource).getFile();
                             if (log.isDebugEnabled()) {
                                   log.debug("Delete cache attachment file: "+file.getName());
                            }
                             if(lcm!=null){
                                if(log.isDebugEnabled()){
                                    log.debug("deleting file using lifecyclemanager");
                                }
                                lcm.delete(file);
                            }else{
                                file.delete();
                            }
                           }
                       }
                       catch (Exception e) {
                         if (log.isDebugEnabled()) {
                               log.debug("Delete cache attachment file failed"+ e.getMessage());
                           }

                           if (file != null) {
                               if(lcm!=null){
                                   try{                                
                                       lcm.deleteOnExit(file);
                                   }catch(Exception ex){
                                       file.deleteOnExit();
                                   }
                               }
                               else{
View Full Code Here

Examples of org.apache.axiom.attachments.lifecycle.LifecycleManager

                                                String contentTypeString,
                                                boolean fileCacheForAttachments,
                                                String attachmentRepoDir,
                                                String attachmentSizeThreshold,
                                                int contentLength) {
        LifecycleManager manager = null;
        try {
            AxisConfiguration configuration = msgContext.getRootContext().getAxisConfiguration();
            manager = (LifecycleManager)configuration
                    .getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
            if (manager == null) {
View Full Code Here

Examples of org.apache.axiom.attachments.lifecycle.LifecycleManager

                                      OMFactory factory,
                                      boolean isOptimize,
                                      String attachmentDir) throws IOException, MessagingException {
        OMText omText = null;
        if (isOptimize) {
            LifecycleManager lm = getLifecycleManager(factory);
            int threshold = getThreshold(factory);
           
            // TODO Consider lowering the threshold in low memory situations ?
            //threshold = lm.getRuntimeThreshold(threshold);
           
            if (length >= threshold && attachmentDir != null) {
               
                // Get the file accessor
                FileAccessor fileAccessor = lm.create(attachmentDir);
                OutputStream fos = fileAccessor.getOutputStream();
               
                //Copy the bytes into the file
                ByteArrayInputStream is = new ByteArrayInputStream(b, off, length);
                BufferUtils.inputStream2OutputStream(is, fos);
                fos.close();
               
                // Delete this temp file on exit
                lm.deleteOnExit(fileAccessor.getFile());
                lm.deleteOnTimeInterval(DELETE_TIME, fileAccessor.getFile());
               
                // Create the OMText node from the datahandler
                DataHandler dh = fileAccessor.getDataHandler(null);
                omText = factory.createOMText(dh, isOptimize);
            }
View Full Code Here

Examples of org.apache.axiom.attachments.lifecycle.LifecycleManager

  
    /**
     * @deprecated
     */
    private static LifecycleManager getLifecycleManager(OMFactory factory) {
        LifecycleManager lm = null;
       
        /* TODO Support access to lifecycle manager from the factory
        if (factory.getProperty(LIFECYCLE_MANAGER)) {
            ...
        }
View Full Code Here

Examples of org.jboss.arquillian.warp.spi.LifecycleManager

    private <T> T inject(T object) {
        return injector.get().inject(object);
    }

    public void initializeLifecycleManagerAndInspectionRegistry(@Observes BeforeRequest event) {
        LifecycleManager lifecycleManager = inject(new LifecycleManagerImpl());

        manager.set(inject(lifecycleManager));
        registry.set(inject(new InspectionRegistry()));

        event.getRequest().setAttribute(WarpCommons.WARP_REQUEST_LIFECYCLE_MANAGER_ATTRIBUTE, lifecycleManager);
View Full Code Here

Examples of org.olat.commons.lifecycle.LifeCycleManager

    // this code must not have any error handling or retry, this will be done in super class
    if ( RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) != null ) {
      RepositoryEntry reloadedRe = (RepositoryEntry) DBFactory.getInstance().loadObject(repositoryEntry, true);
      reloadedRe.incrementLaunchCounter();
      reloadedRe.setLastUsage(new Date());
      LifeCycleManager lcManager = LifeCycleManager.createInstanceFor(reloadedRe);
      if (lcManager.lookupLifeCycleEntry(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION) != null) {
        Tracing.logAudit("Repository-Deletion: Remove from delete-list repositoryEntry=" + reloadedRe, RepositoryManager.class);
        LifeCycleManager.createInstanceFor(reloadedRe).deleteTimestampFor(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION);
      }
      RepositoryManager.getInstance().updateRepositoryEntry(reloadedRe);
    } else {
View Full Code Here

Examples of org.olat.commons.lifecycle.LifeCycleManager

    // this code must not have any error handling or retry, this will be done in super class
    if ( RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) != null ) {
      RepositoryEntry reloadedRe = (RepositoryEntry) DBFactory.getInstance().loadObject(repositoryEntry, true);
      reloadedRe.incrementDownloadCounter();
      reloadedRe.setLastUsage(new Date());
      LifeCycleManager lcManager = LifeCycleManager.createInstanceFor(reloadedRe);
      if (lcManager.lookupLifeCycleEntry(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION) != null) {
        Tracing.logAudit("Repository-Deletion: Remove from delete-list repositoryEntry=" + reloadedRe, RepositoryManager.class);
        LifeCycleManager.createInstanceFor(reloadedRe).deleteTimestampFor(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION);
      }
      Codepoint.hierarchicalCodepoint(IncrementDownloadCounterBackgroundTask.class, "executeTask-before-update", 1);
      RepositoryManager.getInstance().updateRepositoryEntry(reloadedRe);
View Full Code Here

Examples of org.olat.commons.lifecycle.LifeCycleManager

    // this code must not be synchronized because in case of exception we try it again
    // this code must not have any error handling or retry, this will be done in super class
    if ( RepositoryManager.getInstance().lookupRepositoryEntry(repositoryEntry.getKey()) != null ) {
      RepositoryEntry reloadedRe = (RepositoryEntry) DBFactory.getInstance().loadObject(repositoryEntry, true);
      reloadedRe.setLastUsage(new Date());
      LifeCycleManager lcManager = LifeCycleManager.createInstanceFor(reloadedRe);
      if (lcManager.lookupLifeCycleEntry(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION) != null) {
        Tracing.logAudit("Repository-Deletion: Remove from delete-list repositoryEntry=" + reloadedRe, RepositoryManager.class);
        lcManager.deleteTimestampFor(RepositoryDeletionManager.SEND_DELETE_EMAIL_ACTION);
      }
      RepositoryManager.getInstance().updateRepositoryEntry(reloadedRe);
    } else {
      log.info("Could not executeTask, because repositoryEntry does no longer exist");
    }
View Full Code Here

Examples of org.olat.commons.lifecycle.LifeCycleManager

        public void execute() {
           //o_clusterOK by:fj : must be fast
          Identity identity = (Identity)DBFactory.getInstance().loadObject(anIdentity, true);
          if (Tracing.isDebugEnabled(this.getClass())) Tracing.logDebug("setIdentityAsActiv beginSingleTransaction identity=" + identity, this.getClass());
          identity.setLastLogin(new Date());
          LifeCycleManager lifeCycleManagerForIdenitiy = LifeCycleManager.createInstanceFor(identity);
          if (lifeCycleManagerForIdenitiy.lookupLifeCycleEntry(SEND_DELETE_EMAIL_ACTION) != null) {
            Tracing.logAudit("User-Deletion: Remove from delete-list identity=" + identity, this.getClass());
            lifeCycleManagerForIdenitiy.deleteTimestampFor(SEND_DELETE_EMAIL_ACTION);
          }
          if (Tracing.isDebugEnabled(this.getClass())) Tracing.logDebug("setIdentityAsActiv updateObject identity=" + identity, this.getClass());
          DBFactory.getInstance().updateObject(identity);
          if (Tracing.isDebugEnabled(this.getClass())) Tracing.logDebug("setIdentityAsActiv committed identity=" + identity, this.getClass());
        }
View Full Code Here

Examples of org.olat.commons.lifecycle.LifeCycleManager

    log.debug("setValue index=" + index + " : " + value);
    customfields.put(CUSTOMFIELD_KEY + index, value);
  }

  public ProjectEvent getProjectEvent(Project.EventType eventType) {
    LifeCycleManager lifeCycleManager = LifeCycleManager.createInstanceFor(this);
    LifeCycleEntry startLifeCycleEntry = lifeCycleManager.lookupLifeCycleEntry(eventType.toString(), EVENT_START);
    LifeCycleEntry endLifeCycleEntry = lifeCycleManager.lookupLifeCycleEntry(eventType.toString(), EVENT_END);
    Date startDate = null;
    if (startLifeCycleEntry != null) {
      startDate = startLifeCycleEntry.getLcTimestamp();
    }
    Date endDate = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.