~ubuntu-branches/ubuntu/hardy/steam/hardy

« back to all changes in this revision

Viewing changes to server/factories/ContainerFactory.pike

  • Committer: Bazaar Package Importer
  • Author(s): Alain Schroeder
  • Date: 2006-11-21 16:03:12 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061121160312-nf96y6nihzsyd2uv
Tags: 2.2.31-3
Add patch to prevent inconsistent data after shutdown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2004  Thomas Bopp, Thorsten Hampel, Ludger Merkens
 
1
/* Copyright (C) 2000-2005  Thomas Bopp, Thorsten Hampel, Ludger Merkens
2
2
 *
3
3
 *  This program is free software; you can redistribute it and/or modify
4
4
 *  it under the terms of the GNU General Public License as published by
14
14
 *  along with this program; if not, write to the Free Software
15
15
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 * 
17
 
 * $Id: ContainerFactory.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $
 
17
 * $Id: ContainerFactory.pike,v 1.1.1.1 2006/03/27 12:40:08 exodusd Exp $
18
18
 */
19
19
 
20
 
constant cvs_version="$Id: ContainerFactory.pike,v 1.1.1.1 2005/02/23 14:47:21 cvs Exp $";
 
20
constant cvs_version="$Id: ContainerFactory.pike,v 1.1.1.1 2006/03/27 12:40:08 exodusd Exp $";
21
21
 
22
22
inherit "/factories/ObjectFactory";
23
23
 
34
34
#include <types.h>
35
35
 
36
36
static void
37
 
create_object()
 
37
init_factory()
38
38
{
39
 
    ::create_object();
40
 
    register_attribute(Attribute(CONT_SIZE_X, "x-size", CMD_TYPE_FLOAT,
41
 
                                 0.0, 0, CONTROL_ATTR_CLIENT));
42
 
    register_attribute(Attribute(CONT_SIZE_Y, "y-size", CMD_TYPE_FLOAT,
43
 
                                 0.0, 0, CONTROL_ATTR_CLIENT));
44
 
    register_attribute(Attribute(CONT_SIZE_Z, "z-size", CMD_TYPE_FLOAT,
45
 
                                 0.0, 0, CONTROL_ATTR_CLIENT));
46
 
    register_attribute(Attribute(CONT_EXCHANGE_LINKS, "exchange links", 
 
39
    ::init_factory();
 
40
    register_class_attribute(Attribute(
 
41
                                 CONT_SIZE_X, "x-size", CMD_TYPE_FLOAT,
 
42
                                 0.0, 0, CONTROL_ATTR_CLIENT));
 
43
    register_class_attribute(Attribute(
 
44
                                 CONT_SIZE_Y, "y-size", CMD_TYPE_FLOAT,
 
45
                                 0.0, 0, CONTROL_ATTR_CLIENT));
 
46
    register_class_attribute(Attribute(
 
47
                                 CONT_SIZE_Z, "z-size", CMD_TYPE_FLOAT,
 
48
                                 0.0, 0, CONTROL_ATTR_CLIENT));
 
49
    register_class_attribute(Attribute(
 
50
                                 CONT_EXCHANGE_LINKS, "exchange links", 
47
51
                                 CMD_TYPE_INT, 0, // link exchange turned off
48
52
                                 REG_ACQ_ENVIRONMENT, CONTROL_ATTR_USER));
 
53
    register_class_attribute(Attribute(
 
54
                                 CONT_WSDL, "Container WSDL Description", 
 
55
                                 CMD_TYPE_OBJECT, 0, 
 
56
                                 REG_ACQ_ENVIRONMENT, CONTROL_ATTR_USER));
49
57
}
50
58
 
51
59
/**
55
63
 *  
56
64
 * @param mapping vars - execute vars, especially the containers name.
57
65
 * @return proxy of the newly created container.
58
 
 * @author <a href="mailto:astra@upb.de">Thomas Bopp</a>) 
59
66
 */
60
67
object execute(mapping vars)
61
68
{
62
69
    object obj;
63
70
    string name = vars["name"];
64
71
    try_event(EVENT_EXECUTE, CALLER, obj);
 
72
    if ( vars->transient ) {
 
73
      if ( mappingp(vars->attributes) )
 
74
        vars->attributes[OBJ_TEMP] = 1;
 
75
      else
 
76
        vars->attributes = ([ OBJ_TEMP : 1 ]);
 
77
    }
 
78
 
65
79
    obj = ::object_create(
66
80
        name, CLASS_NAME_CONTAINER, 0, vars["attributes"],
67
81
        vars["attributesAcquired"], vars["attributesLocked"]);