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;
19 public class Configuration implements IConfiguration {
20 private static final String MEMENTO_ID = "id";
21 private static final String MEMENTO_USER = "user";
22 private static final String MEMENTO_URL = "url";
23 private static final String MEMENTO_PASSWORD = "password";
24 private static final String MEMENTO_TYPE_ID = "type-id";
27 protected String fUrl;
28 protected String fPassword;
29 protected String fUser;
30 protected String fType;
32 public Configuration() {
33 this( WikiEditorPlugin.HTTP_QUERY ); // default type
36 public Configuration(String type) {
41 * @see org.eclipse.monitor.internal.IConfiguration#getId()
43 public String getId() {
47 public String getURL() {
52 * @see org.eclipse.monitor.internal.IConfiguration#getRemotePort()
54 public String getPassword() {
59 * @see org.eclipse.monitor.internal.IConfiguration#getLocalPort()
61 public String getUser() {
67 public String getType() {
72 * @see org.eclipse.monitor.internal.IConfiguration#isRunning()
74 public boolean isActive() {
75 return ConfigurationManager.getInstance().isActive(this);
78 public void delete() {
79 ConfigurationManager.getInstance().removeConfiguration(this);
82 public boolean isWorkingCopy() {
86 public IConfigurationWorkingCopy getWorkingCopy() {
87 return new ConfigurationWorkingCopy(this);
90 protected void setInternal(IConfiguration monitor) {
92 fUrl = monitor.getURL();
93 fPassword = monitor.getPassword();
94 fUser = monitor.getUser();
95 fType = monitor.getType();
98 protected void save(IMemento memento) {
99 memento.putString(MEMENTO_ID, id);
100 memento.putString(MEMENTO_TYPE_ID, fType);
101 memento.putString(MEMENTO_USER, fUser);
102 memento.putString(MEMENTO_URL, fUrl);
103 memento.putString(MEMENTO_PASSWORD, fPassword);
106 protected void load(IMemento memento) {
107 id = memento.getString(MEMENTO_ID);
108 fType = memento.getString(MEMENTO_TYPE_ID);
109 fUser = memento.getString(MEMENTO_USER);
110 fUrl = memento.getString(MEMENTO_URL);
111 fPassword = memento.getString(MEMENTO_PASSWORD);