[Yanel-dev] Create new page (resource-creator Resource Contribution)

Balz Schreier balz.schreier at gmail.com
Wed Feb 9 16:40:17 CET 2011


But as a workaround (and to make me happy much earlier :-) :
commit the workaround (where one can say that the RC file should NEVER be
created) and then we can think of a proper solution.

Cheers
Balz

On Wed, Feb 9, 2011 at 4:38 PM, Balz Schreier <balz.schreier at gmail.com>wrote:

> Hi Michi,
> you are right, there is a return in that IF, but it obviously does not
> match the condition in my realm.
> As I do not understand the whole code there, I can only guess: Does it only
> look for 1:1 mappings to a certain Realm-Path ?
> In my realm, there is no single 1:1 mapping, all of the mapping is in the
> rc-map file.
>
> Maybe a slight refactoring of that IF section would help?
> I could think of the following way:
> - Try to receive the resource instance for the newly created realm PATH.
> - If the resource is not NULL, then there is no need to create the extra RC
> file, if it IS null, then you can go ahead and create the RC file.
>
> I used the retrieval of resources in my code this way:
>
> Resource res =
> Yanel.getInstance().getResourceManager().getResource(environment, realm,
> path);
>
> This works quite good.
> Cheers
> Balz
>
> On Wed, Feb 9, 2011 at 4:11 PM, Michael Wechner <michael.wechner at wyona.com
> > wrote:
>
>> Hi Balz
>>
>>
>> On 2/9/11 2:37 PM, Balz Schreier wrote:
>>
>>> Hi,
>>>
>>> does anybody know this:
>>>
>>> - Via Yanel Toolbar, you can create a new page in your realm (static web
>>> page).
>>> - This works fine, except that the creating resource does not only create
>>> the new HTML page but also saves a resource configuration file (RC) in the
>>> RC repository!
>>>
>>
>> it shouldn't actually, see
>> src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/rescreator/ResourceCreatorResource.java
>>
>>    private void createResourceConfiguration(Resource newResource) throws
>> Exception {
>>        // Check on resource configuration map first
>>        org.wyona.yanel.core.map.Realm realm = newResource.getRealm();
>>        String rcPath =
>> org.wyona.yanel.core.ResourceConfigurationMap.getRCPath(realm,
>> newResource.getPath());
>>        if (rcPath != null) {
>>            if (realm.getRTIRepository().existsNode(rcPath)) {
>>                ResourceConfiguration rc = new
>> ResourceConfiguration(realm.getRTIRepository().getNode(rcPath));
>>                if (rc != null &&
>> newResource.getRTD().getResourceTypeLocalName().equals(rc.getName()) &&
>> newResource.getRTD().getResourceTypeNamespace().equals(rc.getNamespace())) {
>>                    log.warn("Path of new resource '" +
>> newResource.getPath() + "' matches within resource configuration map and
>> hence no resource config will be created!");
>>                    return;
>>
>>
>>> <rc-repo>/<path>/<name>.html
>>>
>>> - Is there a way how you can configure it?
>>>
>>
>> what do mean exactly to configure it? That it does not get created?
>>
>>
>> Thanks
>>
>> Michael
>>
>>
>>
>>> If not:
>>> I wrote the attached patch, so that you can configure the resource
>>> whether it should create the RC file too.
>>> If you are happy with the extension, please commit :-)
>>>
>>> In the realm I am working for we do not want that RC file because we have
>>> a default resource dealing with any kind of static content.
>>>
>>> Thanks!
>>>
>>>
>> --
>> Yanel-development mailing list Yanel-development at wyona.com
>> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wyona.org/pipermail/yanel-development/attachments/20110209/6b91aa29/attachment.html>


More information about the Yanel-development mailing list