Examples of URIValue


Examples of org.apache.slide.projector.value.URIValue

    }
   
    private Application parseApplication(URI applicationUri) {
      try {
        SimpleImporter importer = new SimpleImporter();
        URI applicationDefinition = new URIValue(applicationUri.toString()+APPLICATION_CONFIG);
        StreamableValue applicationDefinitionResouce = ((StreamableValue)Projector.getRepository().getResource(applicationDefinition, context.getCredentials()));
        if ( applicationDefinitionResouce != null ) {
          InputStream configuration = applicationDefinitionResouce.getInputStream();
          ConfigurationHandler handler = new ConfigurationHandler(applicationUri);
          importer.addSimpleImportHandler(handler);
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

      }
      return null;
    }
   
  private synchronized void updateApplication(String uri) {
    URI applicationUri = new URIValue(uri);
        logger.log(Level.FINE, "Updating application '"+applicationUri+"'");
        // Compare newly parsed application with previously installed and send diffs
        Application installedApplication = (Application)installedApplications.get(applicationUri);
        Application updatedApplication = parseApplication(applicationUri);
        for ( Iterator i = installedApplication.getContent().entrySet().iterator(); i.hasNext(); ) {
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

                } catch (Exception e) {
                    logger.log(Level.SEVERE, "Descriptor factory " + clazz + " could not loaded!", e);
                }
            } else if ( path.matches("application/content/processors") ) {
              String uri = attributes.getValue("uri");
              application.addContent(Application.PROCESSORS, new URIValue(applicationUri+attributes.getValue("uri")));     
            } else if ( path.matches("application/content/messages") ) {
              application.addContent(Application.MESSAGES, new URIValue(applicationUri+attributes.getValue("uri")));     
            } else if ( path.matches("application/content/jobs") ) {
              application.addContent(Application.JOBS, new URIValue(applicationUri+attributes.getValue("uri")));     
            }
        }
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

        return routingConfigurations;
    }

    public void configure(Element element) {
    name = element.getAttributeValue("id");
        processorURI = new URIValue(element.getAttributeValue("processor"));
        List loadElements = element.getChildren("load");
    for ( Iterator i = loadElements.iterator(); i.hasNext(); ) {
      Element loadElement = (Element)i.next();
            String parameterName = loadElement.getAttributeValue("parameter");
            ParameterConfiguration parameterConfiguration = new ParameterConfiguration(parameterName);
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

      if ( trigger == null ) {
        throw new ValidationException(new ErrorMessage("trigger/triggerParameterMissing"));
      }
      // Decode instruction
    StringTokenizer tokenizer = new StringTokenizer(StringValueDescriptor.ANY.valueOf(parameter.get(INSTRUCTION_IDENTIFIER+trigger), context).toString(), ";");
    URI actionURI = new URIValue(tokenizer.nextToken());
    boolean validate = Boolean.valueOf(tokenizer.nextToken()).booleanValue();
    boolean wizard = Boolean.valueOf(tokenizer.nextToken()).booleanValue();
    String lastStep = tokenizer.nextToken();
    String targetStep = tokenizer.nextToken();
    String domain = tokenizer.nextToken();
    List involvedParamters = new ArrayList();
    while ( tokenizer.hasMoreTokens() ) {
      involvedParamters.add(tokenizer.nextToken());
    }
    Store store = context.getStore(Store.SESSION);
    // 1. Store all (request) parameters into requested domain
    Map map;
    MapValue mapResource = (MapValue)store.get(domain);
    if ( mapResource == null ) {
      map = new HashMap();
      mapResource = new MapValue(map);
      store.put(domain, mapResource);
    } else {
      map = mapResource.getMap();
    }
        map.put(ControlComposer.VALIDATE, new BooleanValue(validate));
      map.put(Process.STEP, new StringValue(targetStep));
      map.putAll(parameter);
      if ( validate ) {
        // 2. Validate parameters
        Processor processor = ProcessorManager.getInstance().getProcessor(actionURI);
        try {
          // Validate only given parameters to enable wizard like forms
          ParameterDescriptor[] parameterDescriptors = processor.getParameterDescriptors();
              for ( int i = 0; i < parameterDescriptors.length; i++ ) {
                String parameterName = parameterDescriptors[i].getName();
                  if ( involvedParamters.contains(parameterName) ) {
                    map.put(parameterName, ProcessorManager.prepareValue(parameterDescriptors[i], parameter.get(parameterName), context));
                  }
              }
              if ( wizard ) {
                  // Don't validate target step form
                map.put(ControlComposer.VALIDATE, BooleanValue.FALSE);
              }
          } catch ( ValidationException exception ) {
            // 3. Go back to form step if validation failes
          map.put(Process.STEP, new StringValue(lastStep));
        }
      }
      // 4. Launch target step if validation is successfull
    Processor formProcess = ProcessorManager.getInstance().getProcessor(new URIValue(domain));
        map.remove(RESULT);
        Result formResult = formProcess.process(parameter,  context);
        map.put(RESULT, formResult);
    Processor bookmark = ProcessorManager.getInstance().getProcessor(context.getBookmark());
        return bookmark.process(parameter,  context);
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

        String result = element.getAttributeValue("result");
        String store = element.getAttributeValue("store");
    int storeId = StoreHelper.getStoreByName(store);
        String key = element.getAttributeValue("key");
        String domain = element.getAttributeValue("domain");
        URI processorUri = ( processor == null ? null : new URIValue(processor) );
        Iterator children = element.getChildren().iterator();
      Value input = null;
        if ( children.hasNext() ) {
          Element childElement = (Element)children.next();
          input = ValueFactoryManager.getInstance().loadValue(childElement);
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

  public Value valueOf(Object value, Context context) throws ValueCastException {
        if ( value instanceof URIValue ) {
            return (URIValue)value;
        } else {
          try {
                return new URIValue(StringValueDescriptor.ANY.valueOf(value, null).toString());
            } catch ( ValueCastException exception ) {
              throw new ValueCastException(new ErrorMessage("uncastableUriValue", new Object[] { value }), exception);
            }
        }
  }
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

    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

Examples of org.apache.slide.projector.value.URIValue

  public String getElementName() {
      return "uri";
    }

  public Value load(Element element) {
    return new URIValue(element.getText());
  }
View Full Code Here

Examples of org.apache.slide.projector.value.URIValue

      }
     
      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
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.