KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > system > server > profile > basic > ProfileImpl


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.system.server.profile.basic;
23
24 import java.io.File JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.Collections JavaDoc;
27 import java.util.LinkedHashMap JavaDoc;
28 import java.util.Map JavaDoc;
29
30 import org.jboss.deployers.spi.structure.DeploymentContext;
31 import org.jboss.profileservice.spi.DeploymentTemplate;
32 import org.jboss.profileservice.spi.NoSuchDeploymentException;
33 import org.jboss.profileservice.spi.Profile;
34 import org.jboss.util.JBossObject;
35
36 /**
37  * A basic profile implementation that uses the filesystem to store deployments
38  * and admin metadata.
39  *
40  * TODO: this needs to be converted to a read/write VFS implementation.
41  *
42  * @author Scott.Stark@jboss.org
43  * @author adrian@jboss.org
44  * @version $Revision$
45  */

46 public class ProfileImpl extends JBossObject
47    implements Profile
48 {
49    private String JavaDoc name;
50    /** The directory containing the profiles */
51    private File JavaDoc profileRoot;
52    private LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext> bootstraps = new LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext>();
53    private LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext> deployments = new LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext>();
54    private LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext> deployers = new LinkedHashMap JavaDoc<String JavaDoc,DeploymentContext>();
55
56    public ProfileImpl(String JavaDoc profileRoot, String JavaDoc name)
57    {
58       this.name = name;
59       this.profileRoot = new File JavaDoc(profileRoot);
60       log.info("Using profile root:"+this.profileRoot.getAbsolutePath());
61    }
62
63    public String JavaDoc getName()
64    {
65       return name;
66    }
67
68    public String JavaDoc getVersion()
69    {
70       // TODO Auto-generated method stub
71
return null;
72    }
73
74    public void addBootstrap(DeploymentContext d)
75    {
76       bootstraps.put(d.getName(), d);
77    }
78
79    public void removeBootstrap(String JavaDoc name)
80    {
81       bootstraps.remove(name);
82    }
83
84    public DeploymentContext getBootstrap(String JavaDoc name) throws NoSuchDeploymentException
85    {
86       DeploymentContext deployment = bootstraps.get(name);
87       return deployment;
88    }
89
90    public Collection JavaDoc<DeploymentContext> getBootstraps()
91    {
92       return Collections.unmodifiableCollection(bootstraps.values());
93    }
94
95    public void addDeployer(DeploymentContext d)
96    {
97       deployers.put(d.getName(), d);
98    }
99
100    public void removeDeployer(String JavaDoc name)
101    {
102       deployers.remove(name);
103    }
104
105    public DeploymentContext getDeployer(String JavaDoc name) throws NoSuchDeploymentException
106    {
107       DeploymentContext deployment = deployers.get(name);
108       return deployment;
109    }
110
111    public Collection JavaDoc<DeploymentContext> getDeployers()
112    {
113       return Collections.unmodifiableCollection(deployers.values());
114    }
115
116    public DeploymentTemplate getTemplate(String JavaDoc name)
117          throws NoSuchDeploymentException
118    {
119       // TODO Auto-generated method stub
120
return null;
121    }
122
123    public void addDeployment(DeploymentContext d)
124    {
125       deployments.put(d.getName(), d);
126    }
127
128    public void removeDeployment(String JavaDoc name)
129    {
130       deployments.remove(name);
131    }
132
133    public DeploymentContext getDeployment(String JavaDoc name)
134          throws NoSuchDeploymentException
135    {
136       DeploymentContext deployment = deployments.get(name);
137       return deployment;
138    }
139
140    public Collection JavaDoc<DeploymentContext> getDeployments()
141    {
142       return Collections.unmodifiableCollection(deployments.values());
143    }
144
145    public Map JavaDoc<String JavaDoc, Object JavaDoc> getConfig()
146    {
147       // TODO Auto-generated method stub
148
return null;
149    }
150 }
151
Popular Tags