Examples of CallbackType


Examples of com.github.dandelion.datatables.core.callback.CallbackType

    AbstractTableTag parent = (AbstractTableTag) findAncestorWithClass(this, AbstractTableTag.class);

    // The tag is evaluated only once, at the first iteration
    if (parent.isFirstIteration()) {

      CallbackType callbackType = null;
      try {
        callbackType = CallbackType.valueOf(this.type.toUpperCase().trim());
      }
      catch (IllegalArgumentException e) {
        StringBuilder sb = new StringBuilder();
        sb.append("'");
        sb.append(this.type);
        sb.append("' is not a valid callback type. Possible values are: ");
        sb.append(EnumUtils.printPossibleValuesOf(CallbackType.class));
        throw new JspException(sb.toString());
      }

      function = ProcessorUtils.getValueAfterProcessingBundles(function, request);
     
      // The callback has already been registered
      if (parent.getTable().getTableConfiguration().hasCallback(callbackType)) {
        parent.getTable()
            .getTableConfiguration()
            .getCallback(callbackType)
            .appendCode(
                (callbackType.hasReturn() ? "return " : "") + function + "("
                    + StringUtils.join(callbackType.getArgs(), ",") + ");");
      }
      // The callback hasn't been registered yet
      else {
        parent.getTable()
            .getTableConfiguration()
            .registerCallback(
                new Callback(callbackType, (callbackType.hasReturn() ? "return " : "") + function + "("
                    + StringUtils.join(callbackType.getArgs(), ",") + ");"));
      }
    }

    return EVAL_PAGE;
  }
View Full Code Here

Examples of com.github.dandelion.datatables.core.callback.CallbackType

      if (hasAttribute(element, "function")) {

        String functionStr = getStringValue(element, "function");
        functionStr = ProcessorUtils.getValueAfterProcessingBundles(functionStr, request);
        CallbackType callbackType = null;
        try {
          callbackType = CallbackType.valueOf(typeStr.toUpperCase().trim());
        } catch (IllegalArgumentException e) {
          StringBuilder sb = new StringBuilder();
          sb.append("'");
          sb.append(typeStr);
          sb.append("' is not a valid callback type. Possible values are: ");
          sb.append(EnumUtils.printPossibleValuesOf(CallbackType.class));
          throw new ConfigurationProcessingException(sb.toString());
        }

        if (configs.get(tableId).containsKey(ConfType.CALLBACK)) {
          List<Callback> callbacks = (List<Callback>) configs.get(tableId).get(ConfType.CALLBACK);

          if (Callback.hasCallback(callbackType, callbacks)) {
            Callback.findByType(callbackType, callbacks).appendCode(
                (callbackType.hasReturn() ? "return " : "") + functionStr + "("
                    + StringUtils.join(callbackType.getArgs(), ",") + ");");
          } else {
            callbacks.add(new Callback(callbackType, (callbackType.hasReturn() ? "return " : "")
                + functionStr + "(" + StringUtils.join(callbackType.getArgs(), ",") + ");"));
          }
        } else {
          List<Callback> callbacks = new ArrayList<Callback>();
          callbacks.add(new Callback(callbackType, (callbackType.hasReturn() ? "return " : "") + functionStr
              + "(" + StringUtils.join(callbackType.getArgs(), ",") + ");"));

          configs.get(tableId).put(ConfType.CALLBACK, callbacks);
        }
      } else {
        throw new ConfigurationProcessingException("The attribute '" + DataTablesDialect.DIALECT_PREFIX
View Full Code Here

Examples of org.apache.cayenne.modeler.editor.CallbackType

     * performs adding new callback method
     *
     * @param e event
     */
    public final void performAction(ActionEvent e) {
        CallbackType callbackType = getProjectController().getCurrentCallbackType();

        // generate methodName
        String methodNamePrefix = toMethodName(callbackType.getType());
        String methodName;
        // now that we're generating the method names based on the callback type, check to
        // see if the
        // raw prefix, no numbers, is taken.
        if (!getCallbackMap()
                .getCallbackDescriptor(callbackType.getType())
                .getCallbackMethods()
                .contains(methodNamePrefix)) {
            methodName = methodNamePrefix;
        }
        else {
            int counter = 1;
            do {
                methodName = methodNamePrefix + counter;
                counter++;
            } while (getCallbackMap()
                    .getCallbackDescriptor(callbackType.getType())
                    .getCallbackMethods()
                    .contains(methodName));
        }

        createCallbackMethod(getCallbackMap(), callbackType, methodName);
View Full Code Here

Examples of org.apache.cayenne.modeler.editor.CallbackType

     * base logic for callback method removing
     * @param actionEvent event
     */
    private void removeCallbackMethods(ActionEvent actionEvent) {
        ProjectController mediator = getProjectController();
        CallbackType callbackType = mediator.getCurrentCallbackType();

        String[] callbackMethods = mediator.getCurrentCallbackMethods();

        for (String callbackMethod : callbackMethods) {
            removeCallbackMethod(getCallbackMap(), callbackType, callbackMethod);
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

        config.setTrustedIssuers(trustedIssuers);

        FederationProtocolType protocol = new FederationProtocolType();
        config.setProtocol(protocol);

        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(AUTH_TYPE_VALUE);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI_1);
        audienceUris.getAudienceItem().add(AUDIENCE_URI_2);
        audienceUris.getAudienceItem().add(AUDIENCE_URI_3);
        config.setAudienceUris(audienceUris);

        protocol.setAuthenticationType(authType);
        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);

        ClaimTypesRequested claimTypeReq = new ClaimTypesRequested();
        ClaimType claimType = new ClaimType();
        claimType.setOptional(true);
        claimType.setType(CLAIM_TYPE_1);
        claimTypeReq.getClaimType().add(claimType);

        ClaimType claimType2 = new ClaimType();
        claimType2.setOptional(true);
        claimType2.setType(CLAIM_TYPE_2);
        claimTypeReq.getClaimType().add(claimType2);

        protocol.setClaimTypesRequested(claimTypeReq);

        CallbackType freshness = new CallbackType();
        freshness.setValue(FRESHNESS_VALUE);
        protocol.setFreshness(freshness);

        CallbackType homeRealm = new CallbackType();
        homeRealm.setType(ArgumentType.CLASS);
        homeRealm.setValue(HOME_REALM_CLASS);

        protocol.setHomeRealm(homeRealm);
        protocol.setRealm(TARGET_REALM);
        protocol.setReply(REPLY);
        protocol.setRequest("REQUEST");
        protocol.setVersion(PROTOCOL_VERSION);
       
        CallbackType issuer = new CallbackType();
        issuer.setValue(ISSUER);
        protocol.setIssuer(issuer);

        return rootConfig;

    }
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

    public Object getAuthenticationType() {
        if (this.authenticationType != null) {
            return this.authenticationType;
        }
        CallbackType cbt = getFederationProtocol().getAuthenticationType();
        if (cbt == null) {
            return null;
        }
        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
            this.authenticationType = new String(cbt.getValue());
        } else if (cbt.getType().equals(ArgumentType.CLASS)) {
            try {
                this.authenticationType =
                    Thread.currentThread().getContextClassLoader().loadClass(cbt.getValue()).newInstance();
            } catch (Exception e) {
                LOG.error("Failed to create instance of " + cbt.getValue(), e);
                throw new IllegalStateException("Failed to create instance of " + cbt.getValue());
            }           
        } else {
            LOG.error("Only String and Class are supported for 'AuthenticationType'");
            throw new IllegalStateException("Only String and Class are supported for AuthenticationType");
        }
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

   
    public Object getHomeRealm() {
        if (this.homeRealm != null) {
            return this.homeRealm;
        }
        CallbackType cbt = getFederationProtocol().getHomeRealm();
        if (cbt == null) {
            return null;
        }
        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
            this.homeRealm = new String(cbt.getValue());
        } else if (cbt.getType().equals(ArgumentType.CLASS)) {
            try {
                this.homeRealm =
                    Thread.currentThread().getContextClassLoader().loadClass(cbt.getValue()).newInstance();
            } catch (Exception e) {
                LOG.error("Failed to create instance of " + cbt.getValue(), e);
                throw new IllegalStateException("Failed to create instance of " + cbt.getValue());
            }           
        } else {
            LOG.error("Only String and Class are supported for 'HomeRealm'");
            throw new IllegalStateException("Only String and Class are supported for 'HomeRealm'");
        }
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

   
    public Object getIssuer() {
        if (this.issuer != null) {
            return this.issuer;
        }
        CallbackType cbt = getFederationProtocol().getIssuer();
        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
            this.issuer = new String(cbt.getValue());
        } else if (cbt.getType().equals(ArgumentType.CLASS)) {
            try {
                this.issuer =
                    Thread.currentThread().getContextClassLoader().loadClass(cbt.getValue()).newInstance();
            } catch (Exception e) {
                LOG.error("Failed to create instance of " + cbt.getValue(), e);
                throw new IllegalStateException("Failed to create instance of " + cbt.getValue());
            }
        } else {
            LOG.error("Only String and Class are supported for 'Issuer'");
            throw new IllegalStateException("Only String and Class are supported for 'Issuer'");
        }
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

        ks1.setFile(KEYSTORE_FILE);
        truststore.setKeyStore(ks1);
        certStores.getTrustManager().add(truststore);
        config.setCertificateStores(certStores);

        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(AUTH_TYPE_VALUE);

        AudienceUris audienceUris = new AudienceUris();
        audienceUris.getAudienceItem().add(AUDIENCE_URI_1);
        config.setAudienceUris(audienceUris);

        protocol.setAuthenticationType(authType);
        protocol.setRoleDelimiter(ROLE_DELIMITER);
        protocol.setRoleURI(ROLE_URI);

        ClaimTypesRequested claimTypeReq = new ClaimTypesRequested();
        ClaimType claimType = new ClaimType();
        claimType.setOptional(true);
        claimType.setType(CLAIM_TYPE_1);
        claimTypeReq.getClaimType().add(claimType);
        ClaimType claimType2 = new ClaimType();
        claimType2.setOptional(true);
        claimType2.setType(CLAIM_TYPE_2);
        claimTypeReq.getClaimType().add(claimType2);

        protocol.setClaimTypesRequested(claimTypeReq);

        protocol.setFreshness(FRESHNESS_VALUE);

        CallbackType homeRealm = new CallbackType();
        homeRealm.setType(ArgumentType.CLASS);
        homeRealm.setValue(HOME_REALM_CLASS);

        protocol.setHomeRealm(homeRealm);
        protocol.setRealm(TARGET_REALM);
        protocol.setReply(REPLY);
        protocol.setRequest("REQUEST");
        protocol.setVersion(PROTOCOL_VERSION);
       
        CallbackType issuer = new CallbackType();
        issuer.setValue(ISSUER);
        protocol.setIssuer(issuer);
       
        TokenValidators x = new TokenValidators();
        x.getValidator().add("org.apache.cxf.fediz.CustomValidator");
        x.getValidator().add("org.apache.cxf.fediz.core.NonexistentCustomValidator");
View Full Code Here

Examples of org.apache.cxf.fediz.core.config.jaxb.CallbackType

    private FedizConfig createConfigWithoutCB() throws JAXBException {
       
        FedizConfig config = createConfiguration();
        FederationProtocolType protocol = (FederationProtocolType)config.getContextConfig().get(0).getProtocol();
       
        CallbackType homeRealm = new CallbackType();
        homeRealm.setType(ArgumentType.STRING);
        homeRealm.setValue(TestCallbackHandler.TEST_HOME_REALM);
        protocol.setHomeRealm(homeRealm);
       
        CallbackType issuer = new CallbackType();
        issuer.setType(ArgumentType.STRING);
        issuer.setValue(TestCallbackHandler.TEST_IDP);
        protocol.setIssuer(issuer);
       
        CallbackType authType = new CallbackType();
        authType.setType(ArgumentType.STRING);
        authType.setValue(TestCallbackHandler.TEST_WAUTH);
        protocol.setAuthenticationType(authType);
       
        return 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.