Examples of Extension


Examples of ca.simplegames.micro.Extension

      }
    }
  }

  public ExtensionsManager require(String name) throws Exception { //todo: improve the Exceptions
    Extension extension = null;
    Map<String, Object> yaml = extensionsConfigMap.get(name);
    File extensionLibDir;

    if (yaml != null && !registeredExtensions.contains(name)) {
      final String extensionLibFolderName = name + "/lib";

      if (extensionsFolder == null) {
        extensionLibDir = new File(site.getApplicationConfigPath(), "/extensions/" + extensionLibFolderName);
      } else {
        extensionLibDir = new File(extensionsFolder, extensionLibFolderName);
      }

      Class[] parameters = new Class[]{URL.class};
      URLClassLoader microClassLoader = (URLClassLoader) Micro.class.getClassLoader();
      Class sysclass = URLClassLoader.class;

      if (extensionLibDir.exists() && extensionLibDir.isDirectory()) {
        for (File file : site.files(extensionLibDir, ".jar")) {
          try {
            Method method = sysclass.getDeclaredMethod("addURL", parameters);
            method.setAccessible(true);
            method.invoke(microClassLoader, file.toURI().toURL());
          } catch (Throwable t) {
            t.printStackTrace();
            throw new IOException("Error, could not add URL to system classloader");
          }
        }

        try {
          Class classToLoad = Class.forName((String) yaml.get("class"), true, microClassLoader);
          extension = (Extension) classToLoad.newInstance();
        } catch (ClassNotFoundException e) {
          e.printStackTrace();
          throw new Exception(String.format("Class: %s, not found.", yaml.get("class")));
        }
      }

      if (extension == null) {
        // check if the Extension is using a Micro class...
        final Class klass = ClassUtilities.loadClass((String) yaml.get("class"));
        if (klass != null) {
          extension = (Extension) klass.newInstance();
        }
      }

      if (extension != null) {
        extension.register(name, site, yaml);

        if (registeredExtensions.isEmpty()) { //cosmetics
          site.getLog().info("Extensions:");
        }
        registeredExtensions.add(extension.getName());
        site.getLog().info(String.format(" - %s, loaded.", extension.getName()));
      } else {
        site.getLog().error(String.format("  %s, not loaded.", name));
      }
    }
    return this;
View Full Code Here

Examples of ca.uhn.fhir.model.api.annotation.Extension

      }
      int min = childAnnotation.min();
      int max = childAnnotation.max();
      TreeMap<Integer, BaseRuntimeDeclaredChildDefinition> orderMap = theOrderToElementDef;

      Extension extensionAttr = next.getAnnotation(Extension.class);
      if (extensionAttr != null) {
        orderMap = theOrderToExtensionDef;
      }

      /*
       * Anything that's marked as unknown is given a new ID that is <0 so that it doesn't conflict wityh any
       * given IDs and can be figured out later
       */
      while (order == Child.ORDER_UNKNOWN && orderMap.containsKey(order)) {
        order--;
      }

      List<Class<? extends IElement>> choiceTypes = new ArrayList<Class<? extends IElement>>();
      for (Class<? extends IElement> nextChoiceType : childAnnotation.type()) {
        choiceTypes.add(nextChoiceType);
      }

      if (orderMap.containsKey(order)) {
        throw new ConfigurationException("Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + theClass.getCanonicalName() + "'");
      }

      if (elementNames.contains(elementName)) {
        throw new ConfigurationException("Detected duplicate field name '" + elementName + "' in type '" + theClass.getCanonicalName() + "'");
      }

      Class<?> nextElementType = determineElementType(next);

      if (nextElementType.equals(ContainedDt.class)) {
        /*
         * Child is contained resources
         */
        RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName);
        orderMap.put(order, def);

      } else if (choiceTypes.size() > 1 && !ResourceReferenceDt.class.isAssignableFrom(nextElementType)) {
        /*
         * Child is a choice element
         */
        for (Class<? extends IElement> nextType : choiceTypes) {
          addScanAlso(nextType);
        }
        RuntimeChildChoiceDefinition def = new RuntimeChildChoiceDefinition(next, elementName, childAnnotation, descriptionAnnotation, choiceTypes);
        orderMap.put(order, def);

      } else if (next.getType().equals(ExtensionDt.class)) {

        RuntimeChildExtensionDt def = new RuntimeChildExtensionDt(next, elementName, childAnnotation, descriptionAnnotation);
        orderMap.put(order, def);
        if (IElement.class.isAssignableFrom(nextElementType)) {
          addScanAlso((Class<? extends IElement>) nextElementType);
        }

      } else if (extensionAttr != null) {
        /*
         * Child is an extension
         */
        Class<? extends IElement> et = (Class<? extends IElement>) nextElementType;
        RuntimeChildDeclaredExtensionDefinition def = new RuntimeChildDeclaredExtensionDefinition(next, childAnnotation, descriptionAnnotation, extensionAttr, elementName, extensionAttr.url(), et);
        orderMap.put(order, def);
        if (IElement.class.isAssignableFrom(nextElementType)) {
          addScanAlso((Class<? extends IElement>) nextElementType);
        }
      } else if (BaseResourceReference.class.isAssignableFrom(nextElementType)) {
View Full Code Here

Examples of com.atlassian.labs.speakeasy.model.Extension

        this.pluginAccessor = pluginAccessor;
        this.bundleContext = bundleContext;
    }
    public Extension build(Plugin plugin) throws PluginOperationFailedException
    {
        return buildGlobal(plugin, new Extension(plugin));
    }
View Full Code Here

Examples of com.cedarsoft.file.Extension

    deserializeFrom.next();
    String extension = deserializeFrom.getText();

    closeTag( deserializeFrom );

    return new Extension( delimiter, extension );
  }
View Full Code Here

Examples of com.colorfulsoftware.atom.Extension

    }

    try {
      feed1 = feedDoc.readFeedToBean(badFeed6);
      Entry ent = feed1.getEntry("Atom-Powered Robots Run Amok");
      Extension ext = feedDoc.buildExtension("unbound:ele", null, null);
      List<Extension> extns = new LinkedList<Extension>();
      extns.add(ext);
      ent = feedDoc.buildEntry(ent.getId(), ent.getTitle(), ent
          .getUpdated(), ent.getRights(), ent.getContent(), ent
          .getAuthors(), ent.getCategories(), ent.getContributors(),
          ent.getLinks(), ent.getAttributes(), extns, ent
              .getPublished(), ent.getSummary(), ent.getSource());
      List<Entry> entries = feed1.getEntries();
      for (int i = 0; i < entries.size(); i++) {
        if (entries.get(i).getTitle().getText().equals(
            "Atom-Powered Robots Run Amok")) {
          entries.remove(i);
          break;
        }
      }
      entries.add(ent);
      feedDoc.buildFeed(feed1.getId(), feed1.getTitle(), feed1
          .getUpdated(), feed1.getRights(), feed1.getAuthors(), feed1
          .getCategories(), feed1.getContributors(),
          feed1.getLinks(), feed1.getAttributes(), feed1
              .getExtensions(), feed1.getGenerator(), feed1
              .getSubtitle(), feed1.getIcon(), feed1.getLogo(),
          entries);
      fail("should not get here.");
    } catch (Exception e) {
      assertTrue(e instanceof AtomSpecException);
      assertEquals(
          e.getMessage(),
          "the following extension prefix(es) ( unbound ) are not bound to a namespace declaration. See http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl.");
    }

    try {
      feed1 = feedDoc.readFeedToBean(badFeed6);
      Entry ent = feed1.getEntry("Atom-Powered Robots Run Amok");
      feedDoc.writeEntryDoc(new FileOutputStream(new File(
          "target/works.xml")), ent, null, null);
      Extension ext = feedDoc.buildExtension("unbound:ele", null, null);
      List<Extension> extns = new LinkedList<Extension>();
      extns.add(ext);
      ent = feedDoc.buildEntry(ent.getId(), ent.getTitle(), ent
          .getUpdated(), ent.getRights(), ent.getContent(), ent
          .getAuthors(), ent.getCategories(), ent.getContributors(),
View Full Code Here

Examples of com.dianping.cat.status.model.entity.Extension

        }
      }

      for (Entry<String, Extension> entry : info.getExtensions().entrySet()) {
        String id = entry.getKey();
        Extension ext = entry.getValue();

        com.dianping.cat.consumer.heartbeat.model.entity.Extension extension = period.findOrCreateExtension(id);
        for (Entry<String, String> kv : ext.getDynamicAttributes().entrySet()) {
          double value = Double.valueOf(kv.getValue());
          extension.getDetails().put(kv.getKey(), new Detail(kv.getKey()).setValue(value));
        }
      }
    } catch (Exception e) {
View Full Code Here

Examples of com.github.dandelion.datatables.core.extension.Extension

  @Override
  public void doProcess() {

    if (StringUtils.isNotBlank(stringifiedValue)) {

      Extension theme = null;

      try {
        theme = Theme.valueOf(stringifiedValue.toUpperCase()).getInstance();
      } catch (IllegalArgumentException e) {
        StringBuilder sb = new StringBuilder();
View Full Code Here

Examples of com.ibm.icu.impl.locale.Extension

      // other extensions are at the same level.
      // e.g. @a=ext-for-aa;calendar=japanese;m=ext-for-mm;x=priv-use

      TreeMap<String, String> kwds = new TreeMap<String, String>();
      for (Character key : extKeys) {
        Extension ext = exts.getExtension(key);
        if (ext instanceof UnicodeLocaleExtension) {
          UnicodeLocaleExtension uext = (UnicodeLocaleExtension) ext;
          Set<String> ukeys = uext.getUnicodeLocaleKeys();
          for (String bcpKey : ukeys) {
            String bcpType = uext.getUnicodeLocaleType(bcpKey);
            // convert to legacy key/type
            String lkey = bcp47ToLDMLKey(bcpKey);
            String ltype = bcp47ToLDMLType(lkey, ((bcpType.length() == 0) ? "yes" : bcpType)); // use "yes" as the value of typeless keywords
            // special handling for u-va-posix, since this is a variant, not a keyword
            if (lkey.equals("va") && ltype.equals("posix") && base.getVariant().length() == 0) {
              id = id + "_POSIX";
            } else {
              kwds.put(lkey, ltype);
            }
          }
          // Mapping Unicode locale attribute to the special keyword, attribute=xxx-yyy
          Set<String> uattributes = uext.getUnicodeLocaleAttributes();
          if (uattributes.size() > 0) {
            StringBuilder attrbuf = new StringBuilder();
            for (String attr : uattributes) {
              if (attrbuf.length() > 0) {
                attrbuf.append('-');
              }
              attrbuf.append(attr);
            }
            kwds.put(LOCALE_ATTRIBUTE_KEY, attrbuf.toString());
          }
        } else {
          kwds.put(String.valueOf(key), ext.getValue());
        }
      }

      if (!kwds.isEmpty()) {
        StringBuilder buf = new StringBuilder(id);
View Full Code Here

Examples of com.ibm.icu.impl.locale.LanguageTag.Extension

            // extensions
            Set exts = tag.getExtensions();
            if (exts != null) {
                Iterator itr = exts.iterator();
                while (itr.hasNext()) {
                    Extension e = (Extension)itr.next();
                    setExtension(e.getSingleton(), e.getValue());
                    //TODO: setExtension may throw an IllformedLocaleException.
                    //      In this csae, error index must be recalculated.
                }
            }
            // private use
View Full Code Here

Examples of com.jpoweredcart.common.entity.setting.Extension

public class ExtensionRowMapper implements RowMapper<Extension>{

  @Override
  public Extension mapRow(ResultSet rs, int rowNum) throws SQLException {
    Extension ex = new Extension();
    ex.setId(rs.getInt("extension_id"));
    ex.setType(rs.getString("type"));
    ex.setCode(rs.getString("code"));
    return ex;
  }
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.