Package org.structr.core

Examples of org.structr.core.Services


    config.setProperty("JsonRestServlet.user.class", "");
    config.setProperty("JsonRestServlet.user.autocreate", "false");
    config.setProperty("JsonRestServlet.defaultview", PropertyView.Public);
    config.setProperty("JsonRestServlet.outputdepth", "3");

    final Services services = Services.getInstance(config);

    securityContext    = SecurityContext.getSuperUserInstance();
    app      = StructrApp.getInstance(securityContext);

    // wait for service layer to be initialized
    do {
      try { Thread.sleep(100); } catch (Throwable t) {}

    } while (!services.isInitialized());
  }
View Full Code Here


    config.setProperty("CsvServlet.user.class", "");
    config.setProperty("CsvServlet.user.autocreate", "false");
    config.setProperty("CsvServlet.defaultview", PropertyView.Public);
    config.setProperty("CsvServlet.outputdepth", "3");

    final Services services = Services.getInstance(config);

    securityContext    = SecurityContext.getSuperUserInstance();
    app      = StructrApp.getInstance(securityContext);

    // wait for service layer to be initialized
    do {
      try { Thread.sleep(100); } catch (Throwable t) {}

    } while (!services.isInitialized());
  }
View Full Code Here

  }

  @Override
  public void run() {

    final Services servicesInstance = Services.getInstance();

    // wait for service layer to be initialized
    while(!servicesInstance.isInitialized()) {
      try { Thread.sleep(1000); } catch(InterruptedException iex) { }
    }

    // sleep 5 seconds more
    try { Thread.sleep(5000); } catch(InterruptedException iex) { }
View Full Code Here

    }

    final long timeout = ((Number)timeoutValue).longValue();

    // get or create new cached value
    final Services services = Services.getInstance();
    CachedValue cachedValue = (CachedValue)services.getAttribute(key);
    if (cachedValue == null) {

      cachedValue = new CachedValue(timeout);
      services.setAttribute(key, cachedValue);

    } else {

      cachedValue.setTimeoutSeconds(timeout);
    }
View Full Code Here

    config.setProperty(Services.TCP_PORT, "13465");
    config.setProperty(Services.UDP_PORT, "13466");
    config.setProperty(Services.SUPERUSER_USERNAME, "superadmin");
    config.setProperty(Services.SUPERUSER_PASSWORD, "sehrgeheim");

    final Services services = Services.getInstance(config);

    securityContext = SecurityContext.getSuperUserInstance();
    app = StructrApp.getInstance(securityContext);

    graphDbCommand = app.command(GraphDatabaseCommand.class);
    writeLogCommand = app.command(WriteLogCommand.class);
    readLogCommand = app.command(ReadLogCommand.class);

    // wait for service layer to be initialized
    do {
      try {
        Thread.sleep(100);
      } catch (Throwable t) {
      }

    } while (!services.isInitialized());
  }
View Full Code Here

    config.setProperty("StructrUiHandler.contextPath", "/structr");
    config.setProperty("StructrUiHandler.resourceBase", "src/main/resources/structr");
    config.setProperty("StructrUiHandler.directoriesListed", Boolean.toString(false));
    config.setProperty("StructrUiHandler.welcomeFiles", "index.html");

    final Services services = Services.getInstance(config);

    // wait for service layer to be initialized
    do {
      try {
        Thread.sleep(100);
      } catch (Throwable t) {
      }

    } while (!services.isInitialized());

    securityContext = SecurityContext.getSuperUserInstance();

    app = StructrApp.getInstance(securityContext);
View Full Code Here

    // test for cross site resource sharing
    String origin = request.getHeader("Origin");
    if (!StringUtils.isBlank(origin)) {

      final Services services = Services.getInstance();

      response.setHeader("Access-Control-Allow-Origin", origin);

       // allow cross site resource sharing (read only)
      final String maxAge = services.getConfigurationValue(Services.ACCESS_CONTROL_MAX_AGE);
      if (StringUtils.isNotBlank(maxAge)) {
        response.setHeader("Access-Control-MaxAge", maxAge);
      }

      final String allowMethods = services.getConfigurationValue(Services.ACCESS_CONTROL_ALLOW_METHODS);
      if (StringUtils.isNotBlank(allowMethods)) {
        response.setHeader("Access-Control-Allow-Methods", allowMethods);
      }

      final String allowHeaders = services.getConfigurationValue(Services.ACCESS_CONTROL_ALLOW_HEADERS);
      if (StringUtils.isNotBlank(allowHeaders)) {
        response.setHeader("Access-Control-Allow-Headers", allowHeaders);
      }

      final String allowCredentials = services.getConfigurationValue(Services.ACCESS_CONTROL_ALLOW_CREDENTIALS);
      if (StringUtils.isNotBlank(allowCredentials)) {
        response.setHeader("Access-Control-Allow-Credentials", allowCredentials);
      }

      final String exposeHeaders = services.getConfigurationValue(Services.ACCESS_CONTROL_EXPOSE_HEADERS);
      if (StringUtils.isNotBlank(exposeHeaders)) {
        response.setHeader("Access-Control-Expose-Headers", exposeHeaders);
      }
     }
View Full Code Here

    config.setProperty(Services.UDP_PORT, "13466");
    config.setProperty(Services.SUPERUSER_USERNAME, "superadmin");
    config.setProperty(Services.SUPERUSER_PASSWORD, "sehrgeheim");
    config.setProperty(HttpService.APPLICATION_TITLE, "structr unit test app" + timestamp);
   
    final Services services = Services.getInstance(config);

    // wait for service layer to be initialized
    do {
      try { Thread.sleep(100); } catch(Throwable t) {}
     
    } while(!services.isInitialized());

    securityContext           = SecurityContext.getSuperUserInstance();
   
    app = StructrApp.getInstance(securityContext);
   
View Full Code Here

TOP

Related Classes of org.structr.core.Services

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.