Package org.apache.webdav.lib

Examples of org.apache.webdav.lib.Subscriber


            final String uri = node.getAttribute("base-uri", "/");
            final int depth = DepthSupport.DEPTH_INFINITY;
            final int lifetime = node.getAttributeAsInt("subscription-lifetime", 3600);
            final int notificationDelay = node.getAttributeAsInt("notification-delay", 0);

            final Subscriber contentSubscriber = new Subscriber() {
                public void notify(String uri, Map information) {
                    NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(this), Domain.getDefaultNamespace());
                    try {
                        nat.begin();
                        Iterator keys = information.keySet().iterator();
                        while (keys.hasNext()) {
                            String key = keys.next().toString();
                            if ("uri".equals(key)) {
                                Uri theUri = nat.getUri(new SlideTokenImpl(new CredentialsToken("")), stripUri(information.get(key).toString()));
                                Store store = theUri.getStore();
                                if (store instanceof ExtendedStore) {
                                    Domain.log("Resetting cache for " + theUri, LOG_CHANNEL, Logger.INFO);
                                    ((ExtendedStore) store).removeObjectFromCache(theUri);
                                }
                            }
                        }
                        nat.commit();
                    } catch(Exception e) {
                      if (Domain.isEnabled(LOG_CHANNEL, Logger.ERROR)) {
                        Domain.log("Error clearing cache: " + e + ". See stderr for stacktrace.", LOG_CHANNEL, Logger.ERROR);
                        e.printStackTrace();
                      }
                    }
                }
            };

            final Subscriber structureSubscriber = new Subscriber() {
                public void notify(String uri, Map information) {
                    NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(this), Domain.getDefaultNamespace());
                    try {
                        nat.begin();
                      Iterator keys = information.keySet().iterator();
View Full Code Here


    private ProjectorClassLoader factoryClassLoader = new ProjectorClassLoader(this.getClass().getClassLoader(), new URIValue(Projector.getProjectorDir()+CLASSES_DIR));
   
    private ApplicationManager() {
        logger.log(Level.INFO, "Starting application manager");
      Projector.getRepository().subscribe("Update/newmember", new URIValue(Projector.getApplicationsDir()), 1,
          new Subscriber() {
        public void notify(String uri, Map information) {
          logger.log(Level.FINE, "Package manager received add event");
          applicationManager.installApplications();
        }
      }, context.getCredentials());
      Projector.getRepository().subscribe("Delete", new URIValue(Projector.getApplicationsDir()), 1,
          new Subscriber() {
        public void notify(String uri, Map information) {
          logger.log(Level.FINE, "Package manager received delete event");
          applicationManager.installApplications();
        }
      }, context.getCredentials());
View Full Code Here

        // install applications sorted by application dependencies
        List sortedApplications = sortApplications(applicationsToInstall);
        for ( Iterator i = sortedApplications.iterator(); i.hasNext(); ) {
          Application application = (Application)i.next();
            Projector.getRepository().subscribe("Update", application.getUri(), 0,
                new Subscriber() {
              public void notify(String uri, Map information) {
                applicationManager.updateApplication(uri);
              }
            }, context.getCredentials());
          install(Application.MESSAGES, application);
View Full Code Here

    processorMap.remove(processorUri);
    ProcessorDescriptor processorDescriptor = getProcessorDescriptor(processorUri);
    URI processorConfiguration = processorDescriptor.getConfiguration();
    if ( processorConfiguration != null ) {
      configuredProcessors.remove(processorConfiguration);
      Subscriber subscriber = (Subscriber)configurationListeners.get(processorConfiguration);
      Projector.getRepository().unsubscribe(processorConfiguration, subscriber, Projector.getCredentials());
      configurationListeners.remove(processorConfiguration);
    }
    processorDescriptors.remove(processorUri);
    logger.log(Level.FINE, "Removing processor: "+processorUri);
View Full Code Here

                      logger.log(Level.FINE, "Configuring processor with config-URI=" + configURI);
                      processorDescriptor.setConfiguration(configurationUri);
                      StreamableValue config = (StreamableValue)Projector.getRepository().getResource(configurationUri, Projector.getCredentials());
                      ((ConfigurableProcessor)processor).configure(config);
                      // listen for configuration changes
                      Subscriber subscriber = new ConfigurationListener();
                      Projector.getRepository().subscribe("Update", configurationUri, 0, subscriber, Projector.getCredentials());
                      configurationListeners.put(configurationUri, subscriber);
                      configuredProcessors.put(configurationUri, processor);
                      modified = true;
                    }
View Full Code Here

              context.setStep(STARTUP_IDENTIFIER+job.getName());
            }
            launchJob(job, context);
            if ( !restoreRunningJobs ) {
              Projector.getRepository().subscribe("Update", jobsUri, 0,
                new Subscriber() {
                public void notify(String uri, Map information) {
                  update(new URIValue(uri));
                }
              }, Projector.getCredentials());
            }
View Full Code Here

TOP

Related Classes of org.apache.webdav.lib.Subscriber

Copyright © 2018 www.massapicom. 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.