Package com.ibm.xsp.application

Examples of com.ibm.xsp.application.ApplicationEx


      // This might be because we are in a faces request, and no call to the SBT library had been made so far
      // In this case, we create the application object and we destroy it when the XPages application is destroyed
      FacesContextEx facesContext = FacesContextEx.getCurrentInstance();
      if(facesContext!=null) {
        final XspApplication newApp = app = (XspApplication)initApplication(facesContext.getExternalContext().getContext());
        ApplicationEx facesApplication = facesContext.getApplicationEx();
        facesApplication.addApplicationListener(new ApplicationListener() {
          public void applicationDestroyed(ApplicationEx application) {
          }
          public void applicationCreated(ApplicationEx application) {
            destroyApplication(newApp);
          }
View Full Code Here


    return app;
  }

  @Override
  public Application createApplication(Object context) {
    ApplicationEx facesApplication = ApplicationEx.getInstance();
    // Try to find the application name
    // We start from the the NotesContext, which should be defined
    String name = null;
    NotesContext ctx = NotesContext.getCurrentUnchecked();
    if(ctx!=null) {
      name = ctx.getModule().getModuleName();
    } else {
      name = facesApplication.getApplicationId();
    }
    return new XspApplication(facesApplication,(ServletContext)context,name);
  }
View Full Code Here

        FacesContext context = initContext(servletRequest, servletResponse);
        try {
        // Make sure that the app hasn't been discarded
        // If so, then we return a SERVICE_UNAVAILABLE error
          // Just for security
        ApplicationEx app = ((FacesContextEx)context).getApplicationEx();
        if(app.getController()==null) {
          emitError(servletResponse);
          return;
        }

        // Do whatever you need
View Full Code Here

   * @since org.openntf.domino.xsp 4.5.0
   */
  public static String getXspPropertyAsString(final String propertyName) {
    String result = "";
    try {
      ApplicationEx app = ApplicationEx.getInstance(FacesContext.getCurrentInstance());
      if (null == app) {
        result = getEnvironmentStringsAsString(propertyName);
      } else {
        result = app.getApplicationProperty(propertyName, "");
        if (StringUtil.isEmpty(result)) {
          result = getEnvironmentStringsAsString(propertyName);
        }
      }
    } catch (Throwable t) {
View Full Code Here

   * @return a {@link ValueBinding}
   */
  protected ValueBinding getValueBinding(final String variable) {
    ValueBinding ret = valueBindings.get(variable);
    if (ret == null) {
      ApplicationEx app = (ApplicationEx) context.getApplication();
      ret = app.createValueBinding("#{" + variable + "}");
      if ((ret instanceof ValueBindingEx)) {
        ValueBindingEx valueEx = (ValueBindingEx) ret;
        valueEx.setComponent(component);
        valueEx.setSourceReferenceId(null); // TODO RPr: What to set here
        valueEx.setExpectedType(Object.class);
View Full Code Here

      System.out.println("Beginning creation of implicit objects...");
    }
    // TODO RPr: I enabled the "setClassLoader" here
    Factory.setClassLoader(ctx.getContextClassLoader());

    final ApplicationEx app = ctx.getApplicationEx();
    final Map<Class<?>, List<?>> cache = new HashMap<Class<?>, List<?>>();

    Factory.setServiceLocator(new Factory.AppServiceLocator() {

      @SuppressWarnings("rawtypes")
      @Override
      public <T> List<T> findApplicationServices(final Class<T> serviceClazz) {
        List<T> ret = (List<T>) cache.get(serviceClazz);

        if (ret == null) {
          ret = AccessController.doPrivileged(new PrivilegedAction<List<T>>() {
            @Override
            public List<T> run() {
              return app.findServices(serviceClazz.getName());
            }
          });
          if (Comparable.class.isAssignableFrom(serviceClazz)) {
            Collections.sort((List<? extends Comparable>) ret);
          }
          cache.put(serviceClazz, ret);
        }
        return ret;
      }
    });

    FunctionFactory.setServiceLocator(new FunctionFactory.AppServiceLocator() {

      @SuppressWarnings("rawtypes")
      @Override
      public <T> List<T> findApplicationServices(final Class<T> serviceClazz) {
        List<T> ret = (List<T>) cache.get(serviceClazz);

        if (ret == null) {
          ret = AccessController.doPrivileged(new PrivilegedAction<List<T>>() {
            @Override
            public List<T> run() {
              return app.findServices(serviceClazz.getName());
            }
          });
          if (Comparable.class.isAssignableFrom(serviceClazz)) {
            Collections.sort((List<? extends Comparable>) ret);
          }
View Full Code Here

TOP

Related Classes of com.ibm.xsp.application.ApplicationEx

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.