/** * Create an external resource description for a custom resource. This is intended to be used * together with .... * * @param aInterface * the interface the resource should implement. * @param aParams * parameters passed to the resource when it is created. * @return the description. * @see CustomResourceSpecifier */ public static ExternalResourceDescription createExternalResourceDescription( Class<? extends Resource> aInterface, Object... aParams) { return createExternalResourceDescription(uniqueResourceKey(aInterface.getName()), aInterface, aParams); }
/** * Create an external resource description for a {@link SharedResourceObject}. * * @param aInterface * the interface the resource should implement. * @param aUrl * the URL from which the resource is initialized. * @param aParams * parameters passed to the resource when it is created. * @return the description. * @see ConfigurableDataResourceSpecifier * @see SharedResourceObject */ public static ExternalResourceDescription createExternalResourceDescription( Class<? extends SharedResourceObject> aInterface, String aUrl, Object... aParams) { return createExternalResourceDescription(uniqueResourceKey(aInterface.getName()), aInterface, aUrl, aParams); }
/** * Create an external resource description for a {@link SharedResourceObject}. * * @param aInterface * the interface the resource should implement. * @param aUrl * the URL from which the resource is initialized. * @param aParams * parameters passed to the resource when it is created. * @return the description. * @see ConfigurableDataResourceSpecifier * @see SharedResourceObject */ public static ExternalResourceDescription createExternalResourceDescription( Class<? extends SharedResourceObject> aInterface, URL aUrl, Object... aParams) { return createExternalResourceDescription(uniqueResourceKey(aInterface.getName()), aInterface, aUrl.toString(), aParams); }
/** * Scan the given resource specifier for external resource dependencies and whenever a dependency * with a compatible type is found, the resource will be bound. * * @param aDesc * a description. * @param aRes * the resource to bind. * @param aUrl * the URL from which the resource is initialized. * @param aParams * parameters passed to the resource when it is created. * @throws InvalidXMLException * if import resolution failed * @throws ClassNotFoundException * if the resource implementation class or interface class could not be accessed * @see SharedResourceObject */ public static void bindResource(ResourceSpecifier aDesc, Class<? extends SharedResourceObject> aRes, String aUrl, Object... aParams) throws InvalidXMLException, ClassNotFoundException { ExternalResourceDescription extRes = createExternalResourceDescription( uniqueResourceKey(aRes.getName()), aRes, aUrl, aParams); bind((AnalysisEngineDescription) aDesc, extRes); }
/** * Scan the given resource specifier for external resource dependencies and whenever a dependency * with the given key is encountered the resource will be bound. * * @param aDesc * a description. * @param aKey * the key to bind to. * @param aRes * the resource to bind. * @param aUrl * the URL from which the resource is initialized. * @param aParams * parameters passed to the resource when it is created. * @throws InvalidXMLException * if import resolution failed * @see SharedResourceObject */ public static void bindResource(ResourceSpecifier aDesc, String aKey, Class<? extends SharedResourceObject> aRes, String aUrl, Object... aParams) throws InvalidXMLException { ExternalResourceDescription extRes = createExternalResourceDescription( uniqueResourceKey(aRes.getName()), aRes, aUrl, aParams); bind((AnalysisEngineDescription) aDesc, aKey, extRes); }
/** * Scan the given resource specifier for external resource dependencies and whenever a dependency * with a compatible type is found, the resource will be bound. * * @param aDesc * a description. * @param aApi * the resource interface. * @param aRes * the resource to bind. * @param aParams * parameters passed to the resource when it is created. * @throws InvalidXMLException * if import resolution failed * @throws ClassNotFoundException * if the resource implementation class or interface class could not be accessed * @see CustomResourceSpecifier */ public static void bindResource(ResourceSpecifier aDesc, Class<?> aApi, Class<? extends Resource> aRes, String... aParams) throws InvalidXMLException, ClassNotFoundException { // Appending a disambiguation suffix it possible to have multiple instances of the same // resource with different settings to different keys. ExternalResourceDescription extRes = createExternalResourceDescription( uniqueResourceKey(aRes.getName()), aRes, (Object[]) aParams); bindResource(aDesc, extRes); }
/** * Scan the given resource specifier for external resource dependencies and whenever a dependency * with the given key is encountered, the given resource is bound to it. * * @param aDesc * a description. * @param aKey * the key to bind to. * @param aRes * the resource to bind. * @param aParams * parameters passed to the resource when it is created. * @throws InvalidXMLException * if import resolution failed * @see CustomResourceSpecifier */ public static void bindResource(ResourceSpecifier aDesc, String aKey, Class<? extends Resource> aRes, String... aParams) throws InvalidXMLException { if (ParameterizedDataResource.class.isAssignableFrom(aRes)) { createDependency(aDesc, aKey, DataResource.class); } // Appending a disambiguation suffix it possible to have multiple instances of the same // resource with different settings to different keys. ExternalResourceDescription extRes = createExternalResourceDescription( uniqueResourceKey(aRes.getName()), aRes, (Object[]) aParams); bindResource(aDesc, aKey, extRes); }