@Override public Resource create(Request request) throws IllegalActionOnResourceException { String pid = request.get(PID, String.class); String factoryPid = request.get(FACTORY_PID, String.class); Configuration configuration = null; String location = request.get(BUNDLE_LOCATION, String.class); if (location != null) { if (pid != null) { try { configuration = m_configAdmin.getConfiguration(pid, location); } catch (IOException e) { throw new IllegalActionOnResourceException(request, e.getMessage()); } } else if (factoryPid != null) { try { configuration = m_configAdmin.createFactoryConfiguration(factoryPid, location); } catch (IOException e) { throw new IllegalActionOnResourceException(request, e.getMessage()); } } else { throw new IllegalActionOnResourceException( request, "factory pid or pid parameter is mandatory"); } } else { throw new IllegalActionOnResourceException(request, "location parameter is mandatory"); } ConfigurationResource configurationResource = new ConfigurationResource(configuration); synchronized (m_configurationResourceMap) { m_configurationResourceMap.put(pid, configurationResource); } return configurationResource; }
private RequestAttributes getRequestAttributes() { RequestAttributes attributes = request.get(RequestAttributes.class); if (attributes == null) { attributes = new RequestAttributes(); request.add(attributes); } return attributes; }
public static Sender create(String url) { return create(Request.get(url)); }
public static Response get(String url, int timeout) { return Sender.create(Request.get(url)).setTimeout(timeout).send(); }
public static Response get(String url) { return Sender.create(Request.get(url)).send(); }