summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/TreeNode/Service.java
blob: 3685b3881de750298308c1733cebc78a21bb2b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// **********************************************************************
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package IceGrid.TreeNode;

import IceGrid.Model;
import IceGrid.ServiceDescriptor;
import IceGrid.ServiceInstanceDescriptor;
import IceGrid.TemplateDescriptor;
import IceGrid.Utils;

class Service extends Parent
{
    Service(String name,
	    String displayString,
	    ServiceInstanceDescriptor instanceDescriptor, 
	    ServiceDescriptor serviceDescriptor,
	    Editable editable,
	    Utils.Resolver resolver,
	    Application application,
	    Model model)
	throws DuplicateIdException
    {
	super(name, model);
	_displayString = displayString;
	_instanceDescriptor = instanceDescriptor;
	_serviceDescriptor = serviceDescriptor;
	_propertiesHolder = new PropertiesHolder(serviceDescriptor);

	_isEditable = editable != null;
	_resolver = resolver;

	boolean areChildrenEditable = _instanceDescriptor.template.length() == 0 && editable != null;

	_adapters = new Adapters(serviceDescriptor.adapters, 
				 areChildrenEditable, false, resolver, application, _model);
	addChild(_adapters);
	
	_dbEnvs = new DbEnvs(serviceDescriptor.dbEnvs, 
			     areChildrenEditable, resolver, _model);
	addChild(_dbEnvs);
    }

    public String toString()
    {
	if(_displayString != null)
	{
	    return _displayString;
	}
	else
	{
	    return _id;
	}
    }

    public PropertiesHolder getPropertiesHolder()
    {
	return _propertiesHolder;
    }

    public void unregister()
    {
	_adapters.unregister();
    }

    private ServiceInstanceDescriptor _instanceDescriptor;
    private ServiceDescriptor _serviceDescriptor;
    private String _displayString;
    private boolean _isEditable;
    private Utils.Resolver _resolver;
    private Adapters _adapters;
    private DbEnvs _dbEnvs;

    private PropertiesHolder _propertiesHolder;
}