public EngineApplication(Engine engine) { this.engine = engine; getMetadataService().addExtension("log", MediaType.TEXT_PLAIN ); getMetadataService().addExtension("cxml", MediaType.APPLICATION_XML ); setStatusService(new EngineStatusService()); }
/** * Constructor. By default, it creates the necessary services. * * @param enabled * True if the service has been enabled. * */ public StatusService(boolean enabled) { this(enabled, new ConverterService(), new MetadataService(), new ConnegService()); // this.homeRef = new Reference("/"); }
/** * Constructor. */ public TaskService() { this.shutdownAllowed = false; setWrapped(wrap(createExecutorService())); }
@Override public synchronized void start() throws Exception { if ((getWrapped() == null) || getWrapped().isShutdown()) { setWrapped(wrap(createExecutorService(getCorePoolSize()))); } super.start(); }
@Override public synchronized void stop() throws Exception { super.stop(); if ((getWrapped() != null) && !getWrapped().isShutdown()) { getWrapped().shutdown(); } }
/** * Stops each service. * * @throws Exception */ public void stop() throws Exception { for (Service service : this) { service.stop(); } }
/** * Converts a regular Java object into a Representation. The converter will * use the preferred variant of the selected converter. * * @param source * The source object to convert. * @return The converted representation. * @throws IOException */ public Representation toRepresentation(Object source) throws IOException { return toRepresentation(source, null, null); }
/** * Converts a Representation into a regular Java object. * * @param source * The source representation to convert. * @return The converted Java object. * @throws IOException */ public Object toObject(Representation source) throws IOException { return toObject(source, null, null); }
/** * Starts each service. * * @throws Exception */ public void start() throws Exception { for (Service service : this) { service.start(); } }
/** Starts the Restlet. */ public synchronized void start() throws Exception { if (isEnabled()) { this.started = true; } }
/** * Creates a new thread factory that will properly name the Restlet created * threads with a "restlet-" prefix. * * @return A new thread factory. */ protected ThreadFactory createThreadFactory() { return new RestletThreadFactory(); }
/** * Sets the context. By default, it also updates the context of already * registered services. * * @param context * The context. */ public void setContext(Context context) { this.context = context; for (Service service : this) { service.setContext(context); } }
@Override public synchronized void start() throws Exception { if (getWrapped().isShutdown()) { setWrapped(wrap(createExecutorService())); } super.start(); }
@Override public synchronized void stop() throws Exception { super.stop(); if (!getWrapped().isShutdown()) { getWrapped().shutdown(); } }
/** * Maps an extension to some metadata (media type, language or character * set) to an extension. * * @param extension * The extension name. * @param metadata * The metadata to map. */ public void addExtension(String extension, Metadata metadata) { addExtension(extension, metadata, false); }
/** Stops the Restlet. */ public synchronized void stop() throws Exception { if (isEnabled()) { this.started = false; } }
/** * Creates a new thread factory that will properly name the Restlet created * threads with a "restlet-" prefix. * * @return A new thread factory. */ protected ThreadFactory createThreadFactory() { return new RestletThreadFactory(daemon); }
/** * Maps an extension to some metadata (media type, language or character * set) to an extension. * * @param extension * The extension name. * @param metadata * The metadata to map. */ public void addExtension(String extension, Metadata metadata) { addExtension(extension, metadata, false); }
/** Stops the Restlet. */ public synchronized void stop() throws Exception { if (isEnabled()) { this.started = false; } }
/** Starts the Restlet. */ public synchronized void start() throws Exception { if (isEnabled()) { this.started = true; } }