You can add it to a List of project locations inside your Module 'configure':
public void configure(Binder binder) {
binder.bindList(Constants.SERVER_PROJECT_LOCATIONS_LIST).add("cayenne-xyz.xml");
}
Or explicitly pass it to ServerRuntime, when you are creating it.
Though the first approach provides better encapsulation of your framework.
Andrus
> On Aug 27, 2015, at 6:45 PM, Hugi Thordarson <[email protected]> wrote:
>
> That’s pretty awesome. One question though, how do I tell the Module about
> the location of it's Cayenne Model? (like I do with the configurationLocation
> parameter in ServerRuntime)
>
> Thanks!
> - hugi
>
>
>
>> On 27. ágú. 2015, at 10:44, Andrus Adamchik <[email protected]> wrote:
>>
>> Hi Hugi,
>>
>> Are you using DI by any chance in your app? Cause if you do, it becomes as
>> simple as making ServerRuntime one of the "services" and injecting it into
>> your framework.
>>
>> Or maybe you can invert that? Instead of telling the framework about
>> ServerRuntime, you tell ServerRuntime about your framework (essentially
>> relying on Cayenne to be your DI provider). To do that you expose your
>> framework as a DI Module. That's our preferred way of loading Cayenne
>> extensions. Maybe you can use the same approach with your own code:
>>
>> // this comes from your framework. The module can define a class that decla
>> public class MyModule implements Module {
>> public void configure(Binder binder) {
>>
>> // MyFrameworkImpl may inject ObjectContextFactory to obtain contexts
>> binder.bind(MyFramework.class).to(MyFrameworkImpl.class);
>> }
>> }
>>
>> // this is how you bootstrap both Cayenne and your framework in your app
>> MyModule m = new MyModule();
>> ServerRuntime runtime = new ServerRuntime("myproject.xml", m);
>>
>> MyFramework f = runtime.getInjector().getInstance(MyFramework.class);
>> // now you can call methods on f.
>>
>>
>> Andrus
>>
>>
>>> On Aug 27, 2015, at 11:54 AM, Hugi Thordarson <[email protected]> wrote:
>>>
>>>> On 27/08/2015 6:37pm, Hugi Thordarson wrote:
>>>>> I’m writing a Cayenne-based CRUD framework of sorts, in the form of a jar
>>>>> that plugs into Cayenne applications.
>>>>
>>>> Is there overlap with this: http://nhl.github.io/link-rest/ which was
>>>> already built over the top of Cayenne?
>>>
>>> Not really, what we're doing works at a little lower level and serves more
>>> specific requirements. Framework looks nice though—and it’s fun to see
>>> Cayenne in the wild.
>>>
>>> - hugi
>>
>