public RequestCycle(GeoServerApplication app, WebRequest req, WebResponse resp) { super(app, req, resp); callbacks = app.getBeansOfType(WicketCallback.class); }
public CallbackRequestCycleListener(GeoServerApplication app) { callbacks = app.getBeansOfType(WicketCallback.class); }
@Override public ListView createList(String id) { List pubPanels = filterLayerPanels(((GeoServerApplication) getGeoServerApplication()) .getBeansOfType(LayerConfigurationPanelInfo.class)); ListView pubPanelList = new ListView(id, pubPanels) { @Override protected void populateItem(ListItem item) { LayerConfigurationPanelInfo panelInfo = (LayerConfigurationPanelInfo) item .getModelObject(); try { LayerConfigurationPanel panel = panelInfo.getComponentClass() .getConstructor(String.class, IModel.class) .newInstance("content", myLayerModel); item.add((Component) panel); } catch (Exception e) { throw new WicketRuntimeException( "Failed to add pluggable layer configuration panels", e); } } }; return pubPanelList; }
protected ListView createList(String id) { List dataPanels = filterResourcePanels(((GeoServerApplication) getGeoServerApplication()) .getBeansOfType(ResourceConfigurationPanelInfo.class)); ListView dataPanelList = new ListView(id, dataPanels) { @Override protected void populateItem(ListItem item) { ResourceConfigurationPanelInfo panelInfo = (ResourceConfigurationPanelInfo) item .getModelObject(); try { final Class<ResourceConfigurationPanel> componentClass = panelInfo .getComponentClass(); final Constructor<ResourceConfigurationPanel> constructor; constructor = componentClass.getConstructor(String.class, IModel.class); ResourceConfigurationPanel panel = constructor.newInstance("content", myResourceModel); item.add((Component) panel); } catch (Exception e) { throw new WicketRuntimeException( "Failed to add pluggable resource configuration panels", e); } } }; return dataPanelList; }
@Override protected List<T> load() { GeoServerApplication app = getGeoServerApplication(); List<T> providers = app.getBeansOfType(providerClass); return providers; } };
@Override protected List<T> load() { GeoServerApplication app = getGeoServerApplication(); List<T> providers = app.getBeansOfType(providerClass); return providers; } };
@Override protected List<String> load() { List<StyleHandler> handlers = GeoServerApplication.get().getBeansOfType(StyleHandler.class); return Lists.transform( handlers, new Function<StyleHandler, String>() { @Nullable @Override public String apply(@Nullable StyleHandler styleHandler) { return styleHandler.getFormat(); } }); } }
List<SecurityNamedServicePanelInfo> lookupPanelInfos(Class<S> serviceClass) { List<SecurityNamedServicePanelInfo> panelInfos = new ArrayList(); for (SecurityNamedServicePanelInfo pageInfo : GeoServerApplication.get().getBeansOfType(SecurityNamedServicePanelInfo.class)) { if (serviceClass.isAssignableFrom(pageInfo.getServiceClass())) { panelInfos.add(pageInfo); } } if (panelInfos.isEmpty()) { throw new RuntimeException("Unable to find panel info for service class: " + serviceClass); } return panelInfos; }
List<SecurityNamedServicePanelInfo> lookupPanelInfos(Class<S> serviceClass) { List<SecurityNamedServicePanelInfo> panelInfos = new ArrayList(); for (SecurityNamedServicePanelInfo pageInfo : GeoServerApplication.get().getBeansOfType(SecurityNamedServicePanelInfo.class)) { if (serviceClass.isAssignableFrom(pageInfo.getServiceClass())) { panelInfos.add(pageInfo); } } if (panelInfos.isEmpty()) { throw new RuntimeException("Unable to find panel info for service class: " + serviceClass); } return panelInfos; }
List<SecurityNamedServicePanelInfo> lookupPanelInfos(Class<S> serviceClass) { List<SecurityNamedServicePanelInfo> panelInfos = new ArrayList(); for (SecurityNamedServicePanelInfo pageInfo : GeoServerApplication.get().getBeansOfType(SecurityNamedServicePanelInfo.class)) { if (serviceClass.isAssignableFrom(pageInfo.getServiceClass())) { panelInfos.add(pageInfo); } } if (panelInfos.isEmpty()) { throw new RuntimeException( "Unable to find panel info for service class: " + serviceClass); } return panelInfos; }
private ListView<LayerGroupConfigurationPanelInfo> extensionPanels() { final GeoServerApplication gsapp = getGeoServerApplication(); final List<LayerGroupConfigurationPanelInfo> extensions; extensions = gsapp.getBeansOfType(LayerGroupConfigurationPanelInfo.class); ListView<LayerGroupConfigurationPanelInfo> list; list = new ListView<LayerGroupConfigurationPanelInfo>("contributedPanels", extensions) { @Override protected void populateItem(ListItem<LayerGroupConfigurationPanelInfo> item) { final LayerGroupConfigurationPanelInfo panelInfo = item.getModelObject(); try { LayerGroupConfigurationPanel panel; Class<LayerGroupConfigurationPanel> componentClass; Constructor<? extends LayerGroupConfigurationPanel> constructor; componentClass = panelInfo.getComponentClass(); constructor = componentClass.getConstructor(String.class, IModel.class); panel = constructor.newInstance("content", lgModel); item.add(panel); } catch (Exception e) { throw new WicketRuntimeException( "Failed to add pluggable layergroup configuration panels", e); } } }; return list; }
protected ListView<NetCDFExtensionPanelInfo> createExtensionPanelList( String id, final IModel infoModel) { List<NetCDFExtensionPanelInfo> panels = GeoServerApplication.get().getBeansOfType(NetCDFExtensionPanelInfo.class); return new ListView<NetCDFExtensionPanelInfo>(id, panels) { @Override protected void populateItem(ListItem<NetCDFExtensionPanelInfo> item) { NetCDFExtensionPanelInfo info = item.getModelObject(); try { NetCDFExtensionPanel panel = info.getComponentClass() .getConstructor(String.class, IModel.class, NetCDFPanel.class) .newInstance("content", infoModel, NetCDFPanel.this); item.add(panel); } catch (Exception e) { throw new WicketRuntimeException( "Failed to create NetCDF extension panel of " + "type " + info.getComponentClass().getSimpleName(), e); } } }; } }
@Override public boolean isAccessAllowed(Class componentClass, Authentication authentication) { // if not admin just say no if (!super.isAccessAllowed(componentClass, authentication)) { return false; } // hide the page if there is demo around GeoServerApplication app = GeoServerApplication.get(); for (Class linkClass : linkClasses) { if(app.getBeansOfType(linkClass).size() > 0) { return true; } } return false; }
@SuppressWarnings("serial") public DemoPage(){ List<DemoLinkInfo> links = getGeoServerApplication().getBeansOfType(DemoLinkInfo.class); add(new ListView("demoList", links){ public void populateItem(ListItem item){ final DemoLinkInfo info = (DemoLinkInfo)item.getModelObject(); item.add(new BookmarkablePageLink("theLink", info.getComponentClass()) .add(new Label("theTitle", new StringResourceModel(info.getTitleKey(), (Component)null, null)))); item.add(new Label("theDescription", new StringResourceModel(info.getDescriptionKey(), (Component)null, null))); } }); } }
@Override public boolean isAccessAllowed(Class<?> componentClass, Authentication authentication) { // if not admin just say no if (!super.isAccessAllowed(componentClass, authentication)) { return false; } // hide the page if there is demo around GeoServerApplication app = GeoServerApplication.get(); for (Class<?> linkClass : linkClasses) { if (app.getBeansOfType(linkClass).size() > 0) { return true; } } return false; } }
private List<String> getAvailableWFSFormats() { List<String> formats = new ArrayList<String>(); final GeoServerApplication application = getGeoServerApplication(); for (WFSGetFeatureOutputFormat producer : application.getBeansOfType(WFSGetFeatureOutputFormat.class)) { for (String format : producer.getOutputFormats()) { formats.add(format); } } prepareFormatList(formats, new FormatComparator("format.wfs.")); return formats; }
@SuppressWarnings("serial") public ToolPage(){ List links = getGeoServerApplication().getBeansOfType(ToolLinkInfo.class); links.addAll(getGeoServerApplication().getBeansOfType(ToolLinkExternalInfo.class)); links = filterByAuth(links); add(new ListView("toolList", links){ public void populateItem(ListItem item){ final ComponentInfo info = (ComponentInfo) item.getModelObject(); AbstractLink link = null; if (info instanceof ToolLinkInfo) { final ToolLinkInfo tool = (ToolLinkInfo)info; link = new BookmarkablePageLink("theLink", tool.getComponentClass()); } else { final ToolLinkExternalInfo tool = (ToolLinkExternalInfo) info; link = new ExternalLink("theLink", tool.getHref()); } link.add(new Label("theTitle", new StringResourceModel(info.getTitleKey(), (Component)null, null))); item.add(link); item.add(new Label("theDescription", new StringResourceModel(info.getDescriptionKey(), (Component)null, null))); } }); } }
@SuppressWarnings("serial") public DemoPage() { List<DemoLinkInfo> links = getGeoServerApplication().getBeansOfType(DemoLinkInfo.class); add( new ListView("demoList", links) { public void populateItem(ListItem item) { final DemoLinkInfo info = (DemoLinkInfo) item.getModelObject(); item.add( new BookmarkablePageLink("theLink", info.getComponentClass()) .add( new Label( "theTitle", new StringResourceModel( info.getTitleKey(), (Component) null, null)))); item.add( new Label( "theDescription", new StringResourceModel( info.getDescriptionKey(), (Component) null, null))); } }); } }
List<Service> services(IModel<WorkspaceInfo> wsModel) { List<Service> services = new ArrayList(); for (ServiceMenuPageInfo page : getGeoServerApplication().getBeansOfType(ServiceMenuPageInfo.class)) { Service service = new Service(); service.adminPage = page; service.enabled = getGeoServer().getService(wsModel.getObject(), page.getServiceClass()) != null; //if service is disabled, create a placeholder model to hold a newly created one, // otherwise create a live model to the existing service Class<ServiceInfo> serviceClass = (Class<ServiceInfo>) page.getServiceClass(); service.model = !service.enabled ? new NewServiceModel(wsModel, serviceClass) : new ExistingServiceModel(wsModel, serviceClass); services.add(service); } return services; } }
List<Service> services(IModel<WorkspaceInfo> wsModel) { List<Service> services = new ArrayList<Service>(); for (ServiceMenuPageInfo page : getGeoServerApplication().getBeansOfType(ServiceMenuPageInfo.class)) { Service service = new Service(); service.adminPage = page; service.enabled = getGeoServer().getService(wsModel.getObject(), page.getServiceClass()) != null; // if service is disabled, create a placeholder model to hold a newly created one, // otherwise create a live model to the existing service @SuppressWarnings("unchecked") Class<ServiceInfo> serviceClass = (Class<ServiceInfo>) page.getServiceClass(); service.model = !service.enabled ? new NewServiceModel(wsModel, serviceClass) : new ExistingServiceModel(wsModel, serviceClass); services.add(service); } return services; } }