List of usage examples for org.apache.wicket Application get
public static Application get()
From source file:com.evolveum.midpoint.web.page.admin.server.dto.TaskDto.java
License:Apache License
public String getObjectDelta() { ObjectDeltaType objectDeltaType = getExtensionPropertyRealValue( SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, ObjectDeltaType.class); PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext(); try {//from w w w . j ava2s . com return prismContext.serializeAnyData(objectDeltaType, SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, PrismContext.LANG_XML); } catch (SchemaException e) { throw new SystemException("Couldn't serialize delta: " + e.getMessage(), e); } }
From source file:com.evolveum.midpoint.web.page.admin.server.handlers.dto.ExecuteChangesHandlerDto.java
License:Apache License
public String getObjectDeltaXml() { ObjectDeltaType objectDeltaType = taskDto .getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, ObjectDeltaType.class); if (objectDeltaType == null) { return null; }//from ww w . jav a 2 s.co m PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext(); try { return WebXmlUtil.stripNamespaceDeclarations(prismContext.serializeAnyData(objectDeltaType, SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, PrismContext.LANG_XML)); } catch (SchemaException e) { throw new SystemException("Couldn't serialize object delta: " + e.getMessage(), e); } }
From source file:com.evolveum.midpoint.web.page.admin.server.handlers.dto.QueryBasedHandlerDto.java
License:Apache License
public String getObjectQuery() { QueryType query = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, QueryType.class); if (query == null) { return null; }//from www . j a va2s. c om PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext(); try { return WebXmlUtil.stripNamespaceDeclarations(prismContext.serializeAnyData(query, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, PrismContext.LANG_XML)); } catch (SchemaException e) { throw new SystemException("Couldn't serialize query: " + e.getMessage(), e); } }
From source file:com.evolveum.midpoint.web.page.admin.server.handlers.dto.ReportCreateHandlerDto.java
License:Apache License
public String getReportParams() { PrismObject<TaskType> taskObject = taskDto.getTaskType().asPrismObject(); PrismContainer<ReportParameterType> container = taskObject .findContainer(new ItemPath(TaskType.F_EXTENSION, ReportConstants.REPORT_PARAMS_PROPERTY_NAME)); if (container == null || container.isEmpty()) { return null; }/*from w w w. j a va2s . co m*/ PrismContainerValue<ReportParameterType> pcv = container.getValue(); PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext(); try { return WebXmlUtil.stripNamespaceDeclarations(prismContext.serializeContainerValueToString(pcv, ReportConstants.REPORT_PARAMS_PROPERTY_NAME, PrismContext.LANG_XML)); } catch (SchemaException e) { throw new SystemException("Couldn't serialize report parameters: " + e.getMessage(), e); } }
From source file:com.evolveum.midpoint.web.page.admin.server.handlers.dto.ScriptExecutionHandlerDto.java
License:Apache License
public String getScript() { ExecuteScriptType script = taskDto.getExtensionPropertyRealValue(SchemaConstants.SE_EXECUTE_SCRIPT, ExecuteScriptType.class); if (script == null) { return null; }/*www. jav a 2s. c om*/ PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext(); try { return WebXmlUtil.stripNamespaceDeclarations(prismContext.serializeAnyData(script, SchemaConstants.SE_EXECUTE_SCRIPT, PrismContext.LANG_XML)); } catch (SchemaException e) { throw new SystemException("Couldn't serialize script: " + e.getMessage(), e); } }
From source file:com.evolveum.midpoint.web.util.MidPointResourceStreamLocator.java
License:Apache License
@Override public IResourceNameIterator newResourceNameIterator(String path, Locale locale, String style, String variation, String extension, boolean strict) { String pathWithoutExtension = path; String ext = extension;//from w w w .j a va 2 s . c o m if (ext == null && path != null) { String[] array = path.split("\\."); ext = array.length > 1 ? array[array.length - 1] : null; int extLength = ext != null ? ext.length() + 1 : 0; pathWithoutExtension = StringUtils.left(path, path.length() - extLength); } if (!containsIgnoreCase(EXTENSIONS, ext)) { return super.newResourceNameIterator(path, locale, style, variation, extension, strict); } List<String> extensions = new ArrayList<>(); if (containsIgnoreCase(MIMIFIED_EXTENSIONS, ext) && Application.exists() && Application.get().getResourceSettings().getUseMinifiedResources() && !pathWithoutExtension.endsWith(".min")) { extensions.add("min." + ext); } extensions.add(ext); return new SimpleResourceNameIterator(pathWithoutExtension, extensions); }
From source file:com.framgia.attendance.web.AttendanceApplication.java
@Override protected void init() { super.init(); authorize();/*from w w w . ja va 2 s. com*/ getDebugSettings().setOutputComponentPath(true); getDebugSettings().setAjaxDebugModeEnabled(false); // enable logger Application.get().getRequestLoggerSettings().setRequestLoggerEnabled(true); // mount pages mountPages(); try { new com.aspose.cells.License() .setLicense(getClass().getClassLoader().getResourceAsStream("Aspose.Total.Java.lic")); } catch (Exception e) { // logger.error("Aspose load error.", e); } }
From source file:com.gfactor.web.wicket.loader.OsgiClassResolver.java
License:Apache License
/** * {@inheritDoc}/*from w ww .j a va 2s.c om*/ * * @see org.apache.wicket.application.IClassResolver#getResources(java.lang.String) */ public Iterator<URL> getResources(String name) { logger.info("getResources = " + name); HashSet<URL> loadedFiles = new HashSet<URL>(); try { // Try the classloader for the wicket jar/bundle Enumeration<URL> resources = Application.class.getClassLoader().getResources(name); loadResources(resources, loadedFiles); logger.info("resources 1 = " + resources); logger.info("loadedFiles = " + loadedFiles); // Try the classloader for the user's application jar/bundle resources = Application.get().getClass().getClassLoader().getResources(name); logger.info("resources 2 = " + resources); loadResources(resources, loadedFiles); // Try the context class loader resources = Thread.currentThread().getContextClassLoader().getResources(name); logger.info("resources 3 = " + resources); loadResources(resources, loadedFiles); } catch (IOException e) { throw new WicketRuntimeException(e); } return loadedFiles.iterator(); }
From source file:com.gfactor.web.wicket.loader.OsgiClassResolver.java
License:Apache License
/** * {@inheritDoc}// ww w. ja v a 2s . co m * * @see org.apache.wicket.application.IClassResolver#resolveClass(java.lang.String) */ public Class<?> resolveClass(String classname) throws ClassNotFoundException { logger.info("resolveClass = " + classname); Class<?> clazz = null; try { ClassLoader loader = Application.get().getClass().getClassLoader(); logger.info("clazz2 loader = " + loader); Class<?> clazz2 = Class.forName(classname, false, loader); logger.info("clazz2 = " + clazz2); logger.info(""); clazz = this.wrappedClassResolver.resolveClass(classname); logger.info("clazz = " + clazz); } catch (ClassNotFoundException e) { // not found in parent classloader? look through the bundles... logger.info("resolveClass for bundles"); logger.info("bundle context = " + bundleCtx); Bundle[] bundles = bundleCtx.getBundles(); logger.info("bundles = " + bundles); if (bundles != null && bundles.length > 0) { logger.info("bundles[] length = " + bundles.length); for (Bundle bundle : bundles) { // logger.info(" -> bundle id= = "+ bundle.getBundleId()); if (bundle.getState() != Bundle.ACTIVE || !this.classIsExportedByBundle(classname, bundle)) continue; try { clazz = bundle.loadClass(classname); if (clazz != null) break; } catch (ClassNotFoundException ex) { ; // ignore and try next bundle.. } } } } if (clazz == null) throw new ClassNotFoundException(classname); return clazz; }
From source file:com.gitblit.utils.GitBlitDiffFormatter.java
License:Apache License
/** * Determines a limit to use for HTML diff output. * * @param key/*from www . ja v a 2 s . c om*/ * to use to read the value from the GitBlit settings, if available. * @param minimum * minimum value to enforce * @param maximum * maximum (and default) value to enforce * @return the limit */ private int getLimit(String key, int minimum, int maximum) { if (Application.exists()) { Application application = Application.get(); if (application instanceof GitBlitWebApp) { GitBlitWebApp webApp = (GitBlitWebApp) application; int configValue = webApp.settings().getInteger(key, maximum); if (configValue < minimum) { return minimum; } else if (configValue < maximum) { return configValue; } } } return maximum; }