Package org.apache.slide.projector

Examples of org.apache.slide.projector.URI


    }

    public Result process(Map parameter, Context context) throws Exception {
        Value[] idArray = ((ArrayValue)parameter.get(ID)).getArray();
        Value[] inputArray = ((ArrayValue)parameter.get(SimpleProcessor.INPUT)).getArray();
        URI activeIdResource = (URI)context.getBookmark();
        String activeId = null;
        int[] active = new int[0];
        if ( activeIdResource != null ) {
            activeId = activeIdResource.toString();
            String path = buildPathToActiveNode(null, activeId, idArray);
            if ( path != null ) {
                StringTokenizer tokenizer = new StringTokenizer(path, ",");
                active = new int[tokenizer.countTokens()];
                int counter = 0;
View Full Code Here


        importer.addSimpleImportHandler(handler);
        importer.parse(new InputSource(configuration));
        List removedProcessors = new ArrayList();
        alreadyInstalledProcessors.addAll(handler.getAddedProcessors());
        for ( Iterator i = handler.getRemovedProcessors().iterator(); i.hasNext(); ) {
          URI removedProcessorUri = (URI)i.next();
          uninstallProcessor(removedProcessorUri);
          alreadyInstalledProcessors.remove(removedProcessorUri);
        }
        installedProcessors.put(configurationUri, alreadyInstalledProcessors);
        Projector.getRepository().subscribe("Update", configurationUri, 0, this, Projector.getCredentials());
View Full Code Here

    public void uninstall(URI applicationUri, URI configurationUri) {
      logger.log(Level.FINE, "Uninstalling processors '"+configurationUri+"'");
      List processors = (List)installedProcessors.get(configurationUri);
      for ( Iterator j = processors.iterator(); j.hasNext(); ) {
        URI processorUri = (URI)j.next();
        uninstallProcessor(processorUri);
      }
    installedProcessors.remove(configurationUri);
    Projector.getRepository().unsubscribe(configurationUri, this, Projector.getCredentials());
    }
View Full Code Here

    }
   
    private void uninstallProcessor(URI processorUri) {
    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);
View Full Code Here

    public static ProcessorManager getInstance() {
        return processorManager;
    }

  public void notify(String uri, Map information) {
    URI configurationUri = new URIValue(uri);
    update((URI)configurationToApplication.get(configurationUri), configurationUri);
  }
View Full Code Here

      }
     
      public void startElement(SimplePath path, String name, AttributesImpl attributes, String leadingCDdata) {
            if (path.matches("processor")) {
              boolean modified = false, added = false;
              URI uri = new URIValue(attributes.getValue("uri"));
              removedProcessors.remove(uri);
              String configURI = attributes.getValue("config-uri");
                String processorName = attributes.getValue("name");
                String descriptionKey = attributes.getValue("description");
                String smallIcon = attributes.getValue("small-icon");
                String largeIcon = attributes.getValue("large-icon");
                String clazz = attributes.getValue("class");
                String bookmark = attributes.getValue("bookmark");
                Processor processor = (Processor)processorMap.get(uri);
                ProcessorDescriptor processorDescriptor = (ProcessorDescriptor)processorDescriptors.get(uri);
                try {
                  if ( processor == null ) {
                    processor = (Processor)processorClassLoader.loadClass(clazz).getConstructor(new Class[0]).newInstance(new Object[0]);
                    added = true;
                    modified = true;
                  }
                  if ( processorDescriptor == null ) {
                    processorDescriptor = new ProcessorDescriptor(uri);
                    modified = true;
                  }
                  if ( processorName == null ) processorName = uri.toString();
                  if ( processorDescriptor.getName() == null || !processorDescriptor.getName().equals(processorName) ) {
                    processorDescriptor.setName(processorName);
                    modified = true;
                  }
                  if ( descriptionKey == null ) {
                    descriptionKey = "processorManager/noProcessorDescriptionAvailable";
                  }
                  DefaultMessage description = null;
                  if ( processorDescriptor.getDescription() == null || !processorDescriptor.getDescription().getId().equals(descriptionKey) ) {
                    description = new DefaultMessage(descriptionKey);
                    processorDescriptor.setDescription(description);
                    modified = true;
                  }
                  if ( processorDescriptor.getProcessor() != processor ) {
                    processorDescriptor.setProcessor(processor);
                    modified = true;
                  }
                  URI smallIconUri = SMALL_DEFAULT_ICON, largeIconUri = LARGE_DEFAULT_ICON;
                  if ( smallIcon != null ) smallIconUri = new URIValue(smallIcon);
                  if ( largeIcon != null ) largeIconUri = new URIValue(largeIcon);
                  if ( processorDescriptor.getSmallIcon() == null || !processorDescriptor.getSmallIcon().equals(smallIconUri) ) {
                    processorDescriptor.setSmallIcon(smallIconUri);
                    modified = true;
                  }
                  if ( processorDescriptor.getLargeIcon() == null || !processorDescriptor.getLargeIcon().equals(largeIconUri) ) {
                      processorDescriptor.setLargeIcon(largeIconUri);
                    modified = true;
                  }
                  if ( bookmark != null ) {
                    boolean isBookmark = Boolean.valueOf(bookmark).booleanValue();
                    if ( processorDescriptor.isBookmark() != isBookmark ) {
                      processorDescriptor.setBookmark(isBookmark);
                      modified = true;
                    }
                  }
                  if ( processor instanceof ConfigurableProcessor && configURI != null ) {
                    if ( !configURI.startsWith("/") ) {
                      configURI = applicationUri.toString() + configURI;
                    }
                    URI configurationUri = new URIValue(configURI);
                    if ( processorDescriptor.getConfiguration() == null || !processorDescriptor.getConfiguration().equals(configurationUri) ) {
                      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);
View Full Code Here

    public URI createUser(String username, String password, Credentials credentials) throws UserExistsException, IOException {
      Value userExists = getResource(new URIValue(users+username), credentials);
      if ( userExists == NullValue.NULL || userExists != null ) {
            throw new UserExistsException(new ErrorMessage("userExists", new String[] { username }));
        } else {
          URI userUri = new URIValue(users+username);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+userUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
            httpState.setCredentials(null, host, credentials);
            int state = mkcolMethod.execute(httpState, new HttpConnection(host, port, protocol));
            if ( state == HttpStatus.SC_CREATED ) {
View Full Code Here

    public URI createRole(String rolename, Credentials credentials) throws RoleExistsException, IOException {
      Value userExists = getResource(new URIValue(domain+roles+rolename), credentials);
      if ( userExists == NullValue.NULL || userExists != null ) {
            throw new RoleExistsException(new ErrorMessage("roleExists", new String[] { rolename }));
        } else {
          URI roleUri = new URIValue(roles+rolename);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+roleUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
            httpState.setCredentials(null, host, credentials);
            int state = mkcolMethod.execute(httpState, new HttpConnection(host, port, protocol));
            if ( state == HttpStatus.SC_CREATED ) {
View Full Code Here

      }
    }

    class ConfigurationListener implements Subscriber {
      public void notify(String uri, Map information) {
        URI processorUri = new URIValue(uri);
        Processor processor = (Processor)configuredProcessors.get(processorUri);
        logger.log(Level.FINE, "Reloading processor with configuration URI='"+uri+"'");
        try {
          StreamableValue config = (StreamableValue)Projector.getRepository().getResource(processorUri, Projector.getCredentials());
          ((ConfigurableProcessor)processor).configure(config);
View Full Code Here

    List arrayEntries = new ArrayList();
    for ( int i = 0; i < values.length; i++ ) {
      Map map = ((MapValue)values[i]).getMap();
      Map resultMap = new HashMap();
      resultMap.putAll(map);
      URI uri = (URI)map.get(URI_ENTRY);
      Value content = Projector.getRepository().getResource(uri, context.getCredentials());
      if ( content != null ) {
        if ( instructions instanceof MapValue ) {
          if ( includeContent ) {
            content = new MultipleStreamableValue((StreamableValue) content);
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.URI

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.