1 /**********************************************************************
2 * Copyright (c) 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM - Initial API and implementation
10 **********************************************************************/
11 package net.sourceforge.phpeclipse.wiki.internal;
13 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
18 public class Configuration implements IConfiguration {
19 private static final String MEMENTO_ID = "id";
21 private static final String MEMENTO_NAME = "name";
23 private static final String MEMENTO_USER = "user";
25 private static final String MEMENTO_URL = "url";
27 private static final String MEMENTO_PASSWORD = "password";
29 private static final String MEMENTO_TYPE_ID = "type-id";
31 protected String fId = "";
33 protected String fName = "";
35 protected String fUrl = "";
37 protected String fPassword = "";
39 protected String fUser = "";
41 protected String fType = "";
43 public Configuration() {
44 this(WikiEditorPlugin.HTTP_QUERY); // default type
47 public Configuration(String type) {
51 public String getId() {
55 public String getName() {
59 public String getURL() {
63 public String getPassword() {
70 * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
72 public String getUser() {
78 public String getType() {
85 * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
87 public boolean isActive() {
88 return ConfigurationManager.getInstance().isActive(this);
91 public void delete() {
92 ConfigurationManager.getInstance().removeConfiguration(this);
95 public boolean isWorkingCopy() {
99 public IConfigurationWorkingCopy getWorkingCopy() {
100 return new ConfigurationWorkingCopy(this);
103 protected void setInternal(IConfiguration monitor) {
104 fId = monitor.getId();
105 fName = monitor.getName();
106 fUrl = monitor.getURL();
107 fPassword = monitor.getPassword();
108 fUser = monitor.getUser();
109 fType = monitor.getType();
112 protected void save(IMemento memento) {
113 memento.putString(MEMENTO_ID, fId);
114 memento.putString(MEMENTO_NAME, fName);
115 memento.putString(MEMENTO_TYPE_ID, fType);
116 memento.putString(MEMENTO_USER, fUser);
117 memento.putString(MEMENTO_URL, fUrl);
118 memento.putString(MEMENTO_PASSWORD, fPassword);
121 protected void load(IMemento memento) {
122 fId = memento.getString(MEMENTO_ID);
126 fName = memento.getString(MEMENTO_NAME);
130 fType = memento.getString(MEMENTO_TYPE_ID);
134 fUser = memento.getString(MEMENTO_USER);
138 fUrl = memento.getString(MEMENTO_URL);
142 fPassword = memento.getString(MEMENTO_PASSWORD);
143 if (fPassword == null) {